varn,t=Object.prototype.hasOwnProperty,e=Array.isArray;functionr(n){returnn.__wxWebviewId__?n.__wxWebviewId__:n.privateProperties?n.privateProperties.slaveId:void0}functiono(n){returnn.route||n.uri}functionu(n){return{id:r(n),path:o(n),query:n.options}}functioni(n){vart=function(n){returngetCurrentPages().find((function(t){returnr(t)===n}))}(n);returnt&&t.$vm}functiona(n,t){vare=i(n);returne&&functionn(t,e){varr,o;returnt&&(t.$scope&&((o=t.$scope).__wxExparserNodeId__||o.nodeId||o.id)===e?r=t:t.$children.find((function(t){returnr=n(t,e)}))),r}(e,t)}functionc(n,r){varo;returnn&&(o=r?function(n,r){varo,u=function(n,r){if(e(n))returnn;if(r&&(o=r,u=n,t.call(o,u)))return[n];varo,u;vari=[];returnn.replace(l,(function(n,t,e,r){returni.push(e?r.replace(/\\(\\)?/g,"$1"):t||n),r})),i}(r,n);for(o=u.shift();i=o,null!=i;){if(null==(n=n[o]))return;o=u.shift()}vari;returnn}(n.$data,r):Object.assign({},n.$data)),Promise.resolve({data:o})}functions(n,t){returnn&&Object.keys(t).forEach((function(e){n[e]=t[e]})),Promise.resolve()}functionf(t,e,r){returnnewPromise((function(o,u){if(!t)returnu(n.VM_NOT_EXISTS);if(!t[e])returnu(n.VM_NOT_EXISTS);vari,a=t[e].apply(t,r);!(i=a)||"object"!=typeofi&&"function"!=typeofi||"function"!=typeofi.then?o({result:a}):a.then((function(n){o({result:n})}))}))}!function(n){n.VM_NOT_EXISTS="VM_NOT_EXISTS",n.METHOD_NOT_EXISTS="METHOD_NOT_EXISTS"}(n||(n={}));varl=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;varp=/Sync$/;vard={getPageStack:function(){returnPromise.resolve({pageStack:getCurrentPages().map((function(n){returnu(n)}))})},getCurrentPage:function(){varn=getCurrentPages(),t=n.length;returnnewPromise((function(e,r){t?e(u(n[t-1])):r(Error("getCurrentPages().length=0"))}))},callUniMethod:function(n){vart=n.method,e=n.args;returnnewPromise((function(n,r){if(!uni[t])returnr(Error("uni."+t+" not exists"));if(function(n){returnp.test(n)}(t))returnn({result:uni[t].apply(uni,e)});varo=[Object.assign({},e[0]||{},{success:function(e){setTimeout((function(){n({result:e})}),"pageScrollTo"===t?350:0)},fail:function(n){r(Error(n.errMsg.replace(t+":fail ","")))}})];uni[t].apply(uni,o)}))}},g={getData:function(n){returnc(i(n.pageId),n.path)},setData:function(n){returns(i(n.pageId),n.data)},callMethod:function(t){vare,r=((e={})[n.VM_NOT_EXISTS]="Page["+t.pageId+"] not exists",e[n.METHOD_NOT_EXISTS]="page."+t.method+" not exists",e);returnnewPromise((function(n,e){f(i(t.pageId),t.method,t.args).then((function(t){returnn(t)})).catch((function(n){e(Error(r[n]))}))}))}};function_(n){returnn.nodeId||n.elementId}varv={getData:function(n){returnc(a(n.pageId,_(n)),n.path)},setData:function(n){returns(a(n.pageId,_(n)),n.data)},callMethod:function(t){vare,r=_(t),o=((e={})[n.VM_NOT_EXISTS]="Component["+t.pageId+":"+r+"] not exists",e[n.METHOD_NOT_EXISTS]="component."+t.method+" not exists",e);returnnewPromise((function(n,e){f(a(t.pageId,r),t.method,t.args).then((function(t){returnn(t)})).catch((function(n){e(Error(o[n]))}))}))}},m={};Object.keys(d).forEach((function(n){m["App."+n]=d[n]})),Object.keys(g).forEach((function(n){m["Page."+n]=g[n]})),Object.keys(v).forEach((function(n){m["Element."+n]=v[n]}));varh=process.env.UNI_AUTOMATOR_WS_ENDPOINT;setTimeout((function(){!function(n){void0===n&&(n={});vart=uni.connectSocket({url:h,complete:function(){}}),e=function(n){returnt.send({data:JSON.stringify(n)})};t.onOpen((function(t){n.success&&n.success(),console.log("自动化测试已开启...")})),t.onMessage((function(n){vart=JSON.parse(n.data),r=t.id,o=t.method,u=t.params,i={id:r},a=m[o];if(!a)returni.error={message:o+" unimplemented"},e(i);a(u).then((function(n){n&&(i.result=n)})).catch((function(n){i.error={message:n.message}})).finally((function(){e(i)}))})),t.onError((function(n){console.log("automator.onError",n)})),t.onClose((function(){n.fail&&n.fail({errMsg:"$$initRuntimeAutomator:fail"}),console.log("automator.onClose")}))}()}),500);
varn,t=Object.prototype.hasOwnProperty,e=Array.isArray;functionr(n){returnn.__wxWebviewId__?n.__wxWebviewId__:n.privateProperties?n.privateProperties.slaveId:void0}functiono(n){returnn.route||n.uri}functionu(n){return{id:r(n),path:o(n),query:n.options}}functioni(n){vart=function(n){returngetCurrentPages().find((function(t){returnr(t)===n}))}(n);returnt&&t.$vm}functiona(n,t){vare=i(n);returne&&functionn(t,e){varr,o;returnt&&(t.$scope&&((o=t.$scope).__wxExparserNodeId__||o.nodeId||o.id)===e?r=t:t.$children.find((function(t){returnr=n(t,e)}))),r}(e,t)}functionc(n,r){varo;returnn&&(o=r?function(n,r){varo,u=function(n,r){if(e(n))returnn;if(r&&(o=r,u=n,t.call(o,u)))return[n];varo,u;vari=[];returnn.replace(l,(function(n,t,e,r){returni.push(e?r.replace(/\\(\\)?/g,"$1"):t||n),r})),i}(r,n);for(o=u.shift();i=o,null!=i;){if(null==(n=n[o]))return;o=u.shift()}vari;returnn}(n.$data,r):Object.assign({},n.$data)),Promise.resolve({data:o})}functions(n,t){returnn&&Object.keys(t).forEach((function(e){n[e]=t[e]})),Promise.resolve()}functionf(t,e,r){returnnewPromise((function(o,u){if(!t)returnu(n.VM_NOT_EXISTS);if(!t[e])returnu(n.VM_NOT_EXISTS);vari,a=t[e].apply(t,r);!(i=a)||"object"!=typeofi&&"function"!=typeofi||"function"!=typeofi.then?o({result:a}):a.then((function(n){o({result:n})}))}))}!function(n){n.VM_NOT_EXISTS="VM_NOT_EXISTS",n.METHOD_NOT_EXISTS="METHOD_NOT_EXISTS"}(n||(n={}));varl=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;varp=/Sync$/;vard={getPageStack:function(){returnPromise.resolve({pageStack:getCurrentPages().map((function(n){returnu(n)}))})},getCurrentPage:function(){varn=getCurrentPages(),t=n.length;returnnewPromise((function(e,r){t?e(u(n[t-1])):r(Error("getCurrentPages().length=0"))}))},callUniMethod:function(n){vart=n.method,e=n.args;returnnewPromise((function(n,r){if(!uni[t])returnr(Error("uni."+t+" not exists"));if(function(n){returnp.test(n)}(t))returnn({result:uni[t].apply(uni,e)});varo=[Object.assign({},e[0]||{},{success:function(e){setTimeout((function(){n({result:e})}),"pageScrollTo"===t?350:0)},fail:function(n){r(Error(n.errMsg.replace(t+":fail ","")))}})];uni[t].apply(uni,o)}))}},g={getData:function(n){returnc(i(n.pageId),n.path)},setData:function(n){returns(i(n.pageId),n.data)},callMethod:function(t){vare,r=((e={})[n.VM_NOT_EXISTS]="Page["+t.pageId+"] not exists",e[n.METHOD_NOT_EXISTS]="page."+t.method+" not exists",e);returnnewPromise((function(n,e){f(i(t.pageId),t.method,t.args).then((function(t){returnn(t)})).catch((function(n){e(Error(r[n]))}))}))}};functionm(n){returnn.nodeId||n.elementId}var_={getData:function(n){returnc(a(n.pageId,m(n)),n.path)},setData:function(n){returns(a(n.pageId,m(n)),n.data)},callMethod:function(t){vare,r=m(t),o=((e={})[n.VM_NOT_EXISTS]="Component["+t.pageId+":"+r+"] not exists",e[n.METHOD_NOT_EXISTS]="component."+t.method+" not exists",e);returnnewPromise((function(n,e){f(a(t.pageId,r),t.method,t.args).then((function(t){returnn(t)})).catch((function(n){e(Error(o[n]))}))}))}},v={};Object.keys(d).forEach((function(n){v["App."+n]=d[n]})),Object.keys(g).forEach((function(n){v["Page."+n]=g[n]})),Object.keys(_).forEach((function(n){v["Element."+n]=_[n]}));varh=process.env.UNI_AUTOMATOR_WS_ENDPOINT;swan.$$initRuntimeAutomator=function(n){void0===n&&(n={});vart=uni.connectSocket({url:h,complete:function(){}}),e=function(n){returnt.send({data:JSON.stringify(n)})};t.onOpen((function(t){n.success&&n.success(),console.log("自动化测试已开启...")})),t.onMessage((function(n){vart=JSON.parse(n.data),r=t.id,o=t.method,u=t.params,i={id:r},a=v[o];if(!a)returni.error={message:o+" unimplemented"},e(i);a(u).then((function(n){n&&(i.result=n)})).catch((function(n){i.error={message:n.message}})).finally((function(){e(i)}))})),t.onError((function(n){console.log("automator.onError",n)})),t.onClose((function(){n.fail&&n.fail({errMsg:"$$initRuntimeAutomator:fail"}),console.log("automator.onClose")}))},setTimeout((function(){swan.$$initRuntimeAutomator()}),500);
varn,t=Object.prototype.hasOwnProperty,e=Array.isArray;functionr(n){returnn.__wxWebviewId__?n.__wxWebviewId__:n.privateProperties?n.privateProperties.slaveId:void0}functiono(n){returnn.route||n.uri}functionu(n){return{id:r(n),path:o(n),query:n.options}}functioni(n){vart=function(n){returngetCurrentPages().find((function(t){returnr(t)===n}))}(n);returnt&&t.$vm}functiona(n,t){vare=i(n);returne&&functionn(t,e){varr,o;returnt&&(t.$scope&&((o=t.$scope).__wxExparserNodeId__||o.nodeId||o.id)===e?r=t:t.$children.find((function(t){returnr=n(t,e)}))),r}(e,t)}functionc(n,r){varo;returnn&&(o=r?function(n,r){varo,u=function(n,r){if(e(n))returnn;if(r&&(o=r,u=n,t.call(o,u)))return[n];varo,u;vari=[];returnn.replace(l,(function(n,t,e,r){returni.push(e?r.replace(/\\(\\)?/g,"$1"):t||n),r})),i}(r,n);for(o=u.shift();i=o,null!=i;){if(null==(n=n[o]))return;o=u.shift()}vari;returnn}(n.$data,r):Object.assign({},n.$data)),Promise.resolve({data:o})}functions(n,t){returnn&&Object.keys(t).forEach((function(e){n[e]=t[e]})),Promise.resolve()}functionf(t,e,r){returnnewPromise((function(o,u){if(!t)returnu(n.VM_NOT_EXISTS);if(!t[e])returnu(n.VM_NOT_EXISTS);vari,a=t[e].apply(t,r);!(i=a)||"object"!=typeofi&&"function"!=typeofi||"function"!=typeofi.then?o({result:a}):a.then((function(n){o({result:n})}))}))}!function(n){n.VM_NOT_EXISTS="VM_NOT_EXISTS",n.METHOD_NOT_EXISTS="METHOD_NOT_EXISTS"}(n||(n={}));varl=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;varp=/Sync$/;vard={getPageStack:function(){returnPromise.resolve({pageStack:getCurrentPages().map((function(n){returnu(n)}))})},getCurrentPage:function(){varn=getCurrentPages(),t=n.length;returnnewPromise((function(e,r){t?e(u(n[t-1])):r(Error("getCurrentPages().length=0"))}))},callUniMethod:function(n){vart=n.method,e=n.args;returnnewPromise((function(n,r){if(!uni[t])returnr(Error("uni."+t+" not exists"));if(function(n){returnp.test(n)}(t))returnn({result:uni[t].apply(uni,e)});varo=[Object.assign({},e[0]||{},{success:function(e){setTimeout((function(){n({result:e})}),"pageScrollTo"===t?350:0)},fail:function(n){r(Error(n.errMsg.replace(t+":fail ","")))}})];uni[t].apply(uni,o)}))}},g={getData:function(n){returnc(i(n.pageId),n.path)},setData:function(n){returns(i(n.pageId),n.data)},callMethod:function(t){vare,r=((e={})[n.VM_NOT_EXISTS]="Page["+t.pageId+"] not exists",e[n.METHOD_NOT_EXISTS]="page."+t.method+" not exists",e);returnnewPromise((function(n,e){f(i(t.pageId),t.method,t.args).then((function(t){returnn(t)})).catch((function(n){e(Error(r[n]))}))}))}};functionm(n){returnn.nodeId||n.elementId}var_={getData:function(n){returnc(a(n.pageId,m(n)),n.path)},setData:function(n){returns(a(n.pageId,m(n)),n.data)},callMethod:function(t){vare,r=m(t),o=((e={})[n.VM_NOT_EXISTS]="Component["+t.pageId+":"+r+"] not exists",e[n.METHOD_NOT_EXISTS]="component."+t.method+" not exists",e);returnnewPromise((function(n,e){f(a(t.pageId,r),t.method,t.args).then((function(t){returnn(t)})).catch((function(n){e(Error(o[n]))}))}))}},v={};Object.keys(d).forEach((function(n){v["App."+n]=d[n]})),Object.keys(g).forEach((function(n){v["Page."+n]=g[n]})),Object.keys(_).forEach((function(n){v["Element."+n]=_[n]}));varh=process.env.UNI_AUTOMATOR_WS_ENDPOINT;wx.$$initRuntimeAutomator=function(n){void0===n&&(n={});vart=uni.connectSocket({url:h,complete:function(){}}),e=function(n){returnt.send({data:JSON.stringify(n)})};t.onOpen((function(t){n.success&&n.success(),console.log("自动化测试已开启...")})),t.onMessage((function(n){vart=JSON.parse(n.data),r=t.id,o=t.method,u=t.params,i={id:r},a=v[o];if(!a)returni.error={message:o+" unimplemented"},e(i);a(u).then((function(n){n&&(i.result=n)})).catch((function(n){i.error={message:n.message}})).finally((function(){e(i)}))})),t.onError((function(n){console.log("automator.onError",n)})),t.onClose((function(){n.fail&&n.fail({errMsg:"$$initRuntimeAutomator:fail"}),console.log("automator.onClose")}))},setTimeout((function(){wx.$$initRuntimeAutomator()}),500);
'use strict';functione(e){returne&&typeofe==='object'&&'default'ine?e.default:e}vart=e(require('licia/isWindows'));varn=e(require('jimp'));require('licia/isStr');require('qrcode-terminal');consta=require('qrcode-reader');constr={devtools:{name:'Wechat web devTools',remote:!0,automator:!0,paths:[t?'C:/Program Files (x86)/Tencent/微信web开发者工具/cli.bat':'/Applications/wechatwebdevtools.app/Contents/MacOS/cli'],required:['project.config.json','app.json','app.js'],defaultPort:9420},adapter:{'Tool.enableRemoteDebug':{reflect:async(e,t)=>{let{qrCode:r}=awaite('Tool.enableRemoteDebug',t,!1);returnr&&(r=await(function(e){constt=newBuffer(e,'base64');returnnewPromise(async(e,r)=>{consto=awaitn.read(t);constc=newa();c.callback=function(t,n){if(t)returnr(t);e(n.result)},c.decode(o.bitmap)})}(r))),{qrCode:r}}},'App.callUniMethod':{reflect:'App.callWxMethod'},'App.callFunction':{reflect:async(e,t)=>{returne('App.callFunction',Object.assign(Object.assign({},t),{functionDeclaration:(n=t.functionDeclaration,n[n.length-1]==='}'?n.replace('{','{\nvar uni = wx;\n'):n.replace('=>','=>{\nvar uni = wx;\nreturn ')+'}')}),!1);varn}},'Element.getHTML':{reflect:async(e,t)=>({html:(awaite('Element.getWXML',t,!1)).wxml})}}};module.exports=r