/*! *****************************************************************************Copyright (c) Microsoft Corporation.Permission to use, copy, modify, and/or distribute this software for anypurpose with or without fee is hereby granted.THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITHREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITYAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROMLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OROTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE ORPERFORMANCE OF THIS SOFTWARE.***************************************************************************** */
function__spreadArrays(){for(vars=0,i=0,il=arguments.length;i<il;i++)s+=arguments[i].length;varr=Array(s),k=0;for(i=0;i<il;i++)for(vara=arguments[i],j=0,jl=a.length;j<jl;j++,k++)r[k]=a[j];returnr}n=function(){functione(e){varn=this.constructor;returnthis.then((function(t){returnn.resolve(e()).then((function(){returnt}))}),(function(t){returnn.resolve(e()).then((function(){returnn.reject(t)}))}))}functionn(e){return!(!e||void0===e.length)}functiont(){}functiono(e){if(!(thisinstanceofo))thrownewTypeError("Promises must be constructed via new");if("function"!=typeofe)thrownewTypeError("not a function");this._state=0,this._handled=!1,this._value=void0,this._deferreds=[],c(e,this)}functionr(e,n){for(;3===e._state;)e=e._value;0!==e._state?(e._handled=!0,o._immediateFn((function(){vart=1===e._state?n.onFulfilled:n.onRejected;if(null!==t){varo;try{o=t(e._value)}catch(r){returnvoidf(n.promise,r)}i(n.promise,o)}else(1===e._state?i:f)(n.promise,e._value)}))):e._deferreds.push(n)}functioni(e,n){try{if(n===e)thrownewTypeError("A promise cannot be resolved with itself.");if(n&&("object"==typeofn||"function"==typeofn)){vart=n.then;if(ninstanceofo)returne._state=3,e._value=n,voidu(e);if("function"==typeoft)returnvoidc(function(e,n){returnfunction(){e.apply(n,arguments)}}(t,n),e)}e._state=1,e._value=n,u(e)}catch(r){f(e,r)}}functionf(e,n){e._state=2,e._value=n,u(e)}functionu(e){2===e._state&&0===e._deferreds.length&&o._immediateFn((function(){e._handled||o._unhandledRejectionFn(e._value)}));for(varn=0,t=e._deferreds.length;t>n;n++)r(e,e._deferreds[n]);e._deferreds=null}functionc(e,n){vart=!1;try{e((function(e){t||(t=!0,i(n,e))}),(function(e){t||(t=!0,f(n,e))}))}catch(o){if(t)return;t=!0,f(n,o)}}vara=setTimeout;o.prototype.catch=function(e){returnthis.then(null,e)},o.prototype.then=function(e,n){varo=newthis.constructor(t);returnr(this,newfunction(e,n,t){this.onFulfilled="function"==typeofe?e:null,this.onRejected="function"==typeofn?n:null,this.promise=t}(e,n,o)),o},o.prototype.finally=e,o.all=function(e){returnnewo((function(t,o){functionr(e,n){try{if(n&&("object"==typeofn||"function"==typeofn)){varu=n.then;if("function"==typeofu)returnvoidu.call(n,(function(n){r(e,n)}),o)}i[e]=n,0==--f&&t(i)}catch(c){o(c)}}if(!n(e))returno(newTypeError("Promise.all accepts an array"));vari=Array.prototype.slice.call(e);if(0===i.length)returnt([]);for(varf=i.length,u=0;i.length>u;u++)r(u,i[u])}))},o.resolve=function(e){returne&&"object"==typeofe&&e.constructor===o?e:newo((function(n){n(e)}))},o.reject=function(e){returnnewo((function(n,t){t(e)}))},o.race=function(e){returnnewo((function(t,r){if(!n(e))returnr(newTypeError("Promise.race accepts an array"));for(vari=0,f=e.length;f>i;i++)o.resolve(e[i]).then(t,r)}))},o._immediateFn="function"==typeofsetImmediate&&function(e){setImmediate(e)}||function(e){a(e,0)},o._unhandledRejectionFn=function(e){void0!==console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)};varl=function(){if("undefined"!=typeofself)returnself;if("undefined"!=typeofwindow)returnwindow;if("undefined"!=typeofglobal)returnglobal;throwError("unable to locate global object")}();"Promise"inl?l.Promise.prototype.finally||(l.Promise.prototype.finally=e):l.Promise=o},"object"==typeofexports&&"undefined"!=typeofmodule?n():"function"==typeofdefine&&define.amd?define(n):n();vargetRandomValues="undefined"!=typeofcrypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeofmsCrypto&&"function"==typeofmsCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),rnds8=newUint8Array(16);functionrng(){if(!getRandomValues)thrownewError("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");returngetRandomValues(rnds8)}for(varbyteToHex=[],i=0;i<256;++i)byteToHex[i]=(i+256).toString(16).substr(1);functionv4(options,buf,offset){vari=buf&&offset||0;"string"==typeofoptions&&(buf="binary"===options?newArray(16):null,options=null);varrnds=(options=options||{}).random||(options.rng||rng)();if(rnds[6]=15&rnds[6]|64,rnds[8]=63&rnds[8]|128,buf)for(varii=0;ii<16;++ii)buf[i+ii]=rnds[ii];returnbuf||function(buf,offset){vari=offset||0,bth=byteToHex;return[bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],"-",bth[buf[i++]],bth[buf[i++]],"-",bth[buf[i++]],bth[buf[i++]],"-",bth[buf[i++]],bth[buf[i++]],"-",bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]]].join("")}(rnds)}varhasOwnProperty=Object.prototype.hasOwnProperty,isArray=Array.isArray,PATH_RE=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;functiongetPaths(path,data){if(isArray(path))returnpath;if(data&&(val=data,key=path,hasOwnProperty.call(val,key)))return[path];varval,key,res=[];returnpath.replace(PATH_RE,(function(match,p1,offset,string){returnres.push(offset?string.replace(/\\(\\)?/g,"$1"):p1||match),string})),res}functiongetDataByPath(data,path){vardataPath,paths=getPaths(path,data);for(dataPath=paths.shift();null!=dataPath;){if(null==(data=data[dataPath]))return;dataPath=paths.shift()}returndata}varelementMap=newMap;functiontransEl(el){var_a;if(!function(el){if(el){vartagName=el.tagName;return0===tagName.indexOf("UNI-")||"BODY"===tagName||0===tagName.indexOf("V-UNI-")||el.__isUniElement}return!1}(el))throwError("no such element");varelement,elementId,elem={elementId:(element=el,elementId=element._id,elementId||(elementId=v4(),element._id=elementId,elementMap.set(elementId,{id:elementId,element:element})),elementId),tagName:el.tagName.toLocaleLowerCase().replace("uni-","")};if(el.__vue__)(vm=el.__vue__)&&(vm.$parent&&vm.$parent.$el===el&&(vm=vm.$parent),vm&&!(null===(_a=vm.$options)||void0===_a?void0:_a.isReserved)&&(elem.nodeId=function(vm){if(vm._$weex)returnvm._uid;if(vm._$id)returnvm._$id;if(vm.uid)returnvm.uid;varparent_1=function(vm){for(varparent=vm.$parent;parent;){if(parent._$id)returnparent;parent=parent.$parent}}(vm);if(!vm.$parent)return"-1";varvnode=vm.$vnode,context=vnode.context;returncontext&&context!==parent_1&&context._$id?context._$id+";"+parent_1._$id+","+vnode.data.attrs._i:parent_1._$id+","+vnode.data.attrs._i}(vm)));elsevarvm;return"video"===elem.tagName&&(elem.videoId=elem.nodeId),elem}functiongetVm(el){returnel.__vue__?{isVue3:!1,vm:el.__vue__}:{isVue3:!0,vm:el.__vueParentComponent}}functiongetScrollViewMain(el){var_a=getVm(el),isVue3=_a.isVue3,vm=_a.vm;returnisVue3?vm.exposed.$getMain():vm.$refs.main}varFUNCTIONS={input:{input:function(el,value){var_a=getVm(el),isVue3=_a.isVue3,vm=_a.vm;isVue3?vm.exposed&&vm.exposed.$triggerInput({value:value}):(vm.valueSync=value,vm.$triggerInput({},{value:value}))}},textarea:{input:function(el,value){var_a=getVm(el),isVue3=_a.isVue3,vm=_a.vm;isVue3?vm.exposed&&vm.exposed.$triggerInput({value:value}):(vm.valueSync=value,vm.$triggerInput({},{value:value}))}},"scroll-view":{scrollTo:function(el,x,y){varmain=getScrollViewMain(el);main.scrollLeft=x,main.scrollTop=y},scrollTop:function(el){returngetScrollViewMain(el).scrollTop},scrollLeft:function(el){returngetScrollViewMain(el).scrollLeft},scrollWidth:function(el){returngetScrollViewMain(el).scrollWidth},scrollHeight:function(el){returngetScrollViewMain(el).scrollHeight}},swiper:{swipeTo:function(el,index){el.__vue__.current=index}},"movable-view":{moveTo:function(el,x,y){el.__vue__._animationTo(x,y)}},switch:{tap:function(el){el.click()}},slider:{slideTo:function(el,value){varvm=el.__vue__,slider=vm.$refs["uni-slider"],offsetWidth=slider.offsetWidth,boxLeft=slider.getBoundingClientRect().left;vm.value=value,vm._onClick({x:(value-vm.min)*offsetWidth/(vm.max-vm.min)+boxLeft})}}};functioncreateTouchList(touchInits){var_a,touches=touchInits.map((function(touch){returnfunction(touch){if(document.createTouch)returndocument.createTouch(window,touch.target,touch.identifier,touch.pageX,touch.pageY,touch.screenX,touch.screenY);returnnewTouch(touch)}(touch)}));returndocument.createTouchList?(_a=document).createTouchList.apply(_a,touches):touches}varWebAdapter={getWindow:function(pageId){returnwindow},getDocument:function(pageId){returndocument},getEl:function(elementId){varelement=elementMap.get(elementId);if(!element)throwError("element destroyed");returnelement.element},getOffset:function(node){varrect=node.getBoundingClientRect();returnPromise.resolve({left:rect.left+window.pageXOffset,top:rect.top+window.pageYOffset})},querySelector:function(context,selector){return"page"===selector&&(selector="body"),Promise.resolve(transEl(context.querySelector(selector)))},querySelectorAll:function(context,selector){varelements=[],nodeList=document.querySelectorAll(selector);return[].forEach.call(nodeList,(function(node){try{elements.push(transEl(node))}catch(e){}})),Promise.resolve({elements:elements})},queryProperties:function(context,names){returnPromise.resolve({properties:names.map((function(name){varvalue=getDataByPath(context,name.replace(/-([a-z])/g,(function(g){returng[1].toUpperCase()})));return"document.documentElement.scrollTop"===name&&0===value&&(value=getDataByPath(context,"document.body.scrollTop")),value}))})},queryAttributes:function(context,names){returnPromise.resolve({attributes:names.map((function(name){returnString(context.getAttribute(name))}))})},queryStyles:function(context,names){varstyle=getComputedStyle(context);returnPromise.resolve({styles:names.map((function(name){returnstyle[name]}))})},queryHTML:function(context,type){returnPromise.resolve({html:(html="outer"===type?context.outerHTML:context.innerHTML,html.replace(/\n/g,"").replace(/(<uni-text[^>]*>)(<span[^>]*>[^<]*<\/span>)(.*?<\/uni-text>)/g,"$1$3").replace(/<\/?[^>]*>/g,(function(replacement){return-1<replacement.indexOf("<body")?"<page>":"</body>"===replacement?"</page>":0!==replacement.indexOf("<uni-")&&0!==replacement.indexOf("</uni-")?"":replacement.replace(/uni-/g,"").replace(/ role=""/g,"").replace(/ aria-label=""/g,"")})))});varhtml},dispatchTapEvent:function(el){returnel.click(),Promise.resolve()},dispatchLongpressEvent:function(el){returnPromise.resolve()},dispatchTouchEvent:function(el,type,eventInitDict){eventInitDict||(eventInitDict={}),eventInitDict.touches||(eventInitDict.touches=[]),eventInitDict.changedTouches||(eventInitDict.changedTouches=[]),eventInitDict.touches.length||eventInitDict.touches.push({identifier:Date.now(),target:el});vartouches=createTouchList(eventInitDict.touches),changedTouches=createTouchList(eventInitDict.changedTouches),targetTouches=createTouchList([]);returnel.dispatchEvent(newTouchEvent(type,{cancelable:!0,bubbles:!0,touches:touches,targetTouches:targetTouches,changedTouches:changedTouches})),Promise.resolve()},callFunction:function(el,functionName,args){varfn=getDataByPath(FUNCTIONS,functionName);returnfn?Promise.resolve({result:fn.apply(null,__spreadArrays([el],args))}):Promise.reject(Error(functionName+" not exists"))},triggerEvent:function(el,type,detail){varvm=el.__vue__;returnvm.$trigger&&vm.$trigger(type,{},detail),Promise.resolve()}};varApi=Object.assign({},function(adapter){return{"Page.getElement":function(params){returnadapter.querySelector(adapter.getDocument(params.pageId),params.selector)},"Page.getElements":function(params){returnadapter.querySelectorAll(adapter.getDocument(params.pageId),params.selector)},"Page.getWindowProperties":function(params){returnadapter.queryProperties(adapter.getWindow(params.pageId),params.names)}}}(WebAdapter),function(adapter){vargetEl=function(params){returnadapter.getEl(params.elementId,params.pageId)};return{"Element.getElement":function(params){returnadapter.querySelector(getEl(params),params.selector)},"Element.getElements":function(params){returnadapter.querySelectorAll(getEl(params),params.selector)},"Element.getDOMProperties":function(params){returnadapter.queryProperties(getEl(params),params.names)},"Element.getProperties":function(params){varel=getEl(params),ctx=el.__vue__||el.attr||{};returnel.__vueParentComponent&&(ctx=Object.assign({},ctx,el.__vueParentComponent.attrs,el.__vueParentComponent.props)),adapter.queryProperties(ctx,params.names)},"Element.getOffset":function(params){returnadapter.getOffset(getEl(params))},"Element.getAttributes":function(params){returnadapter.queryAttributes(getEl(params),params.names)},"Element.getStyles":function(params){returnadapter.queryStyles(getEl(params),params.names)},"Element.getHTML":function(params){returnadapter.queryHTML(getEl(params),params.type)},"Element.tap":function(params){returnadapter.dispatchTapEvent(getEl(params))},"Element.longpress":function(params){returnadapter.dispatchLongpressEvent(getEl(params))},"Element.touchstart":function(params){returnadapter.dispatchTouchEvent(getEl(params),"touchstart",params)},"Element.touchmove":function(params){returnadapter.dispatchTouchEvent(getEl(params),"touchmove",params)},"Element.touchend":function(params){returnadapter.dispatchTouchEvent(getEl(params),"touchend",params)},"Element.callFunction":function(params){returnadapter.callFunction(getEl(params),params.functionName,params.args)},"Element.triggerEvent":function(params){returnadapter.triggerEvent(getEl(params),params.type,params.detail)}}}(WebAdapter));functionsend(data){returnUniViewJSBridge.publishHandler("onAutoMessageReceive",data)}UniViewJSBridge.subscribe("sendAutoMessage",(function(_a){varid=_a.id,method=_a.method,params=_a.params,data={id:id};if("ping"==method)returndata.result="pong",voidsend(data);varfn=Api[method];if(!fn)returndata.error={message:method+" unimplemented"},send(data);try{fn(params).then((function(res){res&&(data.result=res)})).catch((function(err){data.error={message:err.message}})).finally((function(){send(data)}))}catch(err){data.error={message:err.message},send(data)}}));