1 line
7.3 KiB
JavaScript
1 line
7.3 KiB
JavaScript
|
(()=>{"use strict";var e={208:function(e,t,n){var i,s,o,r,a,c=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(s,o){function r(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,a)}c((i=i.apply(e,t||[])).next())}))},u=this&&this.__classPrivateFieldGet||function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)},l=this&&this.__classPrivateFieldSet||function(e,t,n,i,s){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?s.call(e,n):s?s.value=n:t.set(e,n),n};Object.defineProperty(t,"__esModule",{value:!0});const h=n(439);s=new WeakMap,o=new WeakMap,i=new WeakSet,r=function(){this.methodOutputTarget.ready=!1;const e=document.createElement("iframe");e.src=this.frameSrc,e.style.display="none",l(this,s,e,"f"),e.addEventListener("load",(()=>{if(!e.contentWindow)return!1;l(this,o,new h.CrossSiteWindowMessageChannel(e.contentWindow),"f"),u(this,o,"f").send("sync_method",void 0).then((e=>{var t,n;e.forEach((e=>{this.methodOutputTarget[e]=u(this,i,"m",a).call(this,e)})),this.methodOutputTarget.ready=!0,"function"==typeof this.methodOutputTarget.onReady&&(null===(n=(t=this.methodOutputTarget).onReady)||void 0===n||n.call(t))}))})),document.body.appendChild(e)},a=function(e){return t=>c(this,void 0,void 0,(function*(){if(!u(this,o,"f"))throw new Error("sdk not inited.");return yield u(this,o,"f").send("invoke",{apiName:e,args:t})}))},t.default=class{constructor(e,t){i.add(this),this.frameSrc=e,this.methodOutputTarget=t,s.set(this,void 0),o.set(this,void 0),u(this,i,"m",r).call(this)}}},576:function(e,t){var n,i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(s,o){function r(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,a)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.waitAnimationFrame=t.waitTimeout=t.AsyncQueue=t.AsyncMutex=t.createAsyncRef=t.Waiting=t.AsyncValue=void 0,function(e){e[e.PENDING=0]="PENDING",e[e.RESOLVE=1]="RESOLVE",e[e.REJECT=2]="REJECT"}(n||(n={}));class s{constructor(){this.state=n.PENDING,this.resolvePending=null,this.rejectPending=null}get(){return i(this,void 0,void 0,(function*(){return this.state===n.RESOLVE?this.value:this.state===n.REJECT?Promise.reject(this.value):(this.pendingRequest||(this.pendingRequest=new Promise(((e,t)=>{this.resolvePending=e,this.rejectPending=t}))),this.pendingRequest)}))}getSync(){return this.state===n.PENDING?void 0:this.value}set(e,t=!1){if(this.state!==n.PENDING)throw new Error("forbidden: set value more than once");this.value=e,t?(this.state=n.REJECT,this.rejectPending&&this.rejectPending(this.value)):(this.state=n.RESOLVE,this.resolvePending&&this.resolvePending(this.value)),this.resolvePending=null,this.rejectPending=null,this.pendingRequest=null}isPending(){return this.state===n.PENDING}isResolved(){return this.state===n.RESOLVE}isRejected(){return this.state===n.REJECT}}t.AsyncValue=s,t.Waiting=class{constructor(){this.value=new s}waitUntil(e){return i(this,void 0,void 0,(function*(){const t=yield this.value.get();return"function"==typeof e&&(yield e(t)),t}))}done(e){this.value.set(e)}},t.createAsyncRef=function(){const e=new s;return{ref(t){null!=t&&t!==e.getSync()&&e.set(t)},get current(){return e.get()},get currentSync(){return e.getSync()}}},t.AsyncMutex=class{lock(){if(this._lockPromise)throw new Error("mutex is locked!");this._lockP
|