diff --git a/carrot.yml b/carrot.yml
index 0e432dcc..40017e16 100644
--- a/carrot.yml
+++ b/carrot.yml
@@ -1,4 +1,4 @@
- name: whiteboard-bridge
repoPath: ../whiteboard-bridge
repoURL: 'https://github.com/netless-io/whiteboard-bridge.git'
- commit: e08d33e
+ commit: 3afa219
diff --git a/sdk/src/main/assets/whiteboard/e08d33e b/sdk/src/main/assets/whiteboard/3afa219
similarity index 100%
rename from sdk/src/main/assets/whiteboard/e08d33e
rename to sdk/src/main/assets/whiteboard/3afa219
diff --git a/sdk/src/main/assets/whiteboard/index.html b/sdk/src/main/assets/whiteboard/index.html
index 56306c19..eafdd55e 100644
--- a/sdk/src/main/assets/whiteboard/index.html
+++ b/sdk/src/main/assets/whiteboard/index.html
@@ -1 +1 @@
-
white-sdk-bridge Application
\ No newline at end of file
+white-sdk-bridge Application
\ No newline at end of file
diff --git a/sdk/src/main/assets/whiteboard/netless.5752da06.js b/sdk/src/main/assets/whiteboard/netless.afe90abd.js
similarity index 98%
rename from sdk/src/main/assets/whiteboard/netless.5752da06.js
rename to sdk/src/main/assets/whiteboard/netless.afe90abd.js
index 55c4b9ca..c6bdf24e 100644
--- a/sdk/src/main/assets/whiteboard/netless.5752da06.js
+++ b/sdk/src/main/assets/whiteboard/netless.afe90abd.js
@@ -257,7 +257,7 @@ var Xp=new jl.j,Qp=function(){function e(e){this.renderer=e}return e.prototype.i
*/
t.videoJsPlugin=function(e){var t;return e&&(t=e,I=x(x({},A),t)),{kind:S,render:de,defaultAttributes:{src:"",poster:"",hostTime:0,currentTime:0,paused:!0,muted:!1,volume:1,close:!0}}}},14976:function(e,t,n){function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw o}}return n}(e,t)||a(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e){return function(e){if(Array.isArray(e))return s(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||a(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){if(e){if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n2&&void 0!==arguments[2]&&arguments[2];n?this.asyncMethods.set(e,t):this.methods.set(e,t)}},{key:"registerAsyn",value:function(e,t){this.asyncMethods.set(e,t)}},{key:"recv",value:function(e){if("string"==typeof e){var t=(0,o.parseBridgeMessage)(e),n=t.type,r=t.actionId,i=t.method,a=t.payload;switch(this.verbose&&console.log({type:n,actionId:r,method:i,payload:a}),n){case o.BridgeEventType.req:var s={data:void 0,actionId:r,complete:!0},u=function(e,t){try{s.data=e.apply(t,a);var n=(0,o.bridgeMessageTemplate)(o.BridgeEventType.ack,r,o.ackTypeSuccess,s);window.ReactNativeWebView.postMessage(n)}catch(e){var i=(0,o.bridgeMessageTemplate)(o.BridgeEventType.ack,r,o.ackTypeError,e);window.ReactNativeWebView.postMessage(i)}},l=function(e,t){a.push((function(e,t){s.data=e,s.complete=!1!==t;var n="",i=!1;if("string"==typeof e)try{var a=JSON.parse(e);i=!(!a.error&&!a.__error)}catch(e){}else i=!(!e||!e.error&&!e.__error);n=i?(0,o.bridgeMessageTemplate)(o.BridgeEventType.ack,r,o.ackTypeError,s.data):(0,o.bridgeMessageTemplate)(o.BridgeEventType.ack,r,o.ackTypeSuccess,s),window.ReactNativeWebView.postMessage(n)}));try{e.apply(t,a)}catch(e){var n=(0,o.bridgeMessageTemplate)(o.BridgeEventType.ack,r,o.ackTypeError,e);window.ReactNativeWebView.postMessage(n)}},c=this.methods.get(i),h=this.asyncMethods.get(i);if(c)u(c,this.methods);else if(h)l(h,this.asyncMethods);else{var d=i.split(".");if(d.length<2)return;var f=d.pop(),p=d.join("."),v=this.methods.get(p);if(v){var m=v[f];if(m&&"function"==typeof m)return void u(m,v)}var g=this.asyncMethods.get(p);if(g){var y=g[f];if(y&&"function"==typeof y)return void l(y,g)}console.log("method ".concat(i," not found"))}break;case o.BridgeEventType.ack:var b=a;if(this.queue.has(r)){var x=this.queue.get(r);x.ack=!0,i===o.ackTypeError?x.reject(a):(x.resolve(b.data),x.callback&&x.callback(b.data)),b.complete&&this.queue.delete(r)}}}}}],n&&r(t.prototype,n),a&&r(t,a),e}();t.Bridge=a},5419:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.parseBridgeMessage=t.bridgeMessageTemplate=t.ackTypeError=t.ackTypeSuccess=t.BridgeEventType=void 0,function(e){e.req="req",e.evt="evt",e.ack="ack"}(t.BridgeEventType||(t.BridgeEventType={})),t.ackTypeSuccess="success",t.ackTypeError="error",t.bridgeMessageTemplate=function(e,t,n,r){return JSON.stringify({type:e,actionId:t,method:n,payload:r})},t.parseBridgeMessage=function(e){try{var t=JSON.parse(e);return{type:t.type,actionId:t.actionId,method:t.method,payload:t.payload}}catch(t){return console.log("parse bridge message ".concat(e," failed: "),t),{type:"fail",actionId:"",method:"",payload:e}}}},13324:function(e,t,n){var r=Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]},i=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.RNBridge=t.RNCommon=void 0,t.RNCommon=o(n(5419));var a=n(5397);Object.defineProperty(t,"RNBridge",{enumerable:!0,get:function(){return a.Bridge}})},79888:function(e,t){Object.defineProperty(t,"__esModule",{value:!0})},87980:function(e,t,n){function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}
/*! For license information please see index.js.LICENSE.txt */var i;e=n.nmd(e),window,i=function(e,t){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==r(e)&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(i,o,function(t){return e[t]}.bind(null,o));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=12)}([function(t,n){t.exports=e},function(e,t,n){(function(e,i){n.d(t,"a",(function(){return et}));var o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function a(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var s=function(){return(s=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function l(){for(var e=[],t=0;t2&&ne("box");var n=Q(t);return new Ee(e,Z(n),n.name,!0,n.equals)},shallowBox:function(e,t){return arguments.length>2&&ne("shallowBox"),te.box(e,{name:t,deep:!1})},array:function(e,t){arguments.length>2&&ne("array");var n=Q(t);return new Tt(e,Z(n),n.name)},shallowArray:function(e,t){return arguments.length>2&&ne("shallowArray"),te.array(e,{name:t,deep:!1})},map:function(e,t){arguments.length>2&&ne("map");var n=Q(t);return new kt(e,Z(n),n.name)},shallowMap:function(e,t){return arguments.length>2&&ne("shallowMap"),te.map(e,{name:t,deep:!1})},set:function(e,t){arguments.length>2&&ne("set");var n=Q(t);return new Rt(e,Z(n),n.name)},object:function(e,t,n){"string"==typeof arguments[1]&&ne("object");var r=Q(n);return rt({},e,t,r)},shallowObject:function(e,t){return"string"==typeof arguments[1]&&ne("shallowObject"),te.object(e,{},{name:t,deep:!1})},ref:K,shallow:J,deep:q,struct:$},te=function e(t,n,r){if("string"==typeof arguments[1])return q.apply(null,arguments);if(at(t))return t;var i=x(t)?e.object(t,n,r):Array.isArray(t)?e.array(t,n):M(t)?e.map(t,n):E(t)?e.set(t,n):t;if(i!==t)return i;v(!1)};function ne(e){v("Expected one or two arguments to observable."+e+". Did you accidentally try to use observable."+e+" as decorator?")}Object.keys(ee).forEach((function(e){return te[e]=ee[e]}));var re,ie,oe=G(!1,(function(e,t,n,r,i){var o=n.get,a=n.set,u=i[0]||{};!function(e,t,n){var r=Bt(e);n.name=r.name+"."+t,n.context=e,r.values[t]=new Se(n),Object.defineProperty(e,t,function(e){return Ft[e]||(Ft[e]={configurable:Ne.computedConfigurable,enumerable:!1,get:function(){return zt(this).read(this,e)},set:function(t){zt(this).write(this,e,t)}})}(t))}(e,t,s({get:o,set:a},u))}));oe({equals:j.structural}),function(e){e[e.NOT_TRACKING=-1]="NOT_TRACKING",e[e.UP_TO_DATE=0]="UP_TO_DATE",e[e.POSSIBLY_STALE=1]="POSSIBLY_STALE",e[e.STALE=2]="STALE"}(re||(re={})),function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"}(ie||(ie={}));var ae=function(e){this.cause=e};function se(e){return e instanceof ae}function ue(e){switch(e.dependenciesState){case re.UP_TO_DATE:return!1;case re.NOT_TRACKING:case re.STALE:return!0;case re.POSSIBLY_STALE:for(var t=ve(!0),n=fe(),r=e.observing,i=r.length,o=0;o0;Ne.computationDepth>0&&t&&v(!1),Ne.allowStateChanges||!t&&"strict"!==Ne.enforceActions||v(!1)}function ce(e,t,n){var r=ve(!0);ge(e),e.newObserving=new Array(e.observing.length+100),e.unboundDepsCount=0,e.runId=++Ne.runId;var i,o=Ne.trackingDerivation;if(Ne.trackingDerivation=e,!0===Ne.disableErrorBoundaries)i=t.call(n);else try{i=t.call(n)}catch(e){i=new ae(e)}return Ne.trackingDerivation=o,function(e){for(var t=e.observing,n=e.observing=e.newObserving,r=re.UP_TO_DATE,i=0,o=e.unboundDepsCount,a=0;ar&&(r=s.dependenciesState);for(n.length=i,e.newObserving=null,o=t.length;o--;)0===(s=t[o]).diffValue&&De(s,e),s.diffValue=0;for(;i--;){var s;1===(s=n[i]).diffValue&&(s.diffValue=0,ke(s,e))}r!==re.UP_TO_DATE&&(e.dependenciesState=r,e.onBecomeStale())}(e),e.observing.length,me(r),i}function he(e){var t=e.observing;e.observing=[];for(var n=t.length;n--;)De(t[n],e);e.dependenciesState=re.NOT_TRACKING}function de(e){var t=fe(),n=e();return pe(t),n}function fe(){var e=Ne.trackingDerivation;return Ne.trackingDerivation=null,e}function pe(e){Ne.trackingDerivation=e}function ve(e){var t=Ne.allowStateReads;return Ne.allowStateReads=e,t}function me(e){Ne.allowStateReads=e}function ge(e){if(e.dependenciesState!==re.UP_TO_DATE){e.dependenciesState=re.UP_TO_DATE;for(var t=e.observing,n=t.length;n--;)t[n].lowestObserverState=re.UP_TO_DATE}}var ye=0,be=1,xe=Object.getOwnPropertyDescriptor((function(){}),"name");function _e(e,t){var n=function(){return we(e,t,this,arguments)};return n.isMobxAction=!0,n}function we(e,t,n,r){var i=function(e,t,n){var r=Ge()&&!!e,i=0;if(r){i=Date.now();var o=n&&n.length||0,a=new Array(o);if(o>0)for(var s=0;s0&&!e.__mobxGlobals&&(Ce=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new Ie).version&&(Ce=!1),Ce?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new Ie):(setTimeout((function(){v("There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`")}),1),new Ie)}();function ke(e,t){var n=e.observers.length;n&&(e.observersIndexes[t.__mapid]=n),e.observers[n]=t,e.lowestObserverState>t.dependenciesState&&(e.lowestObserverState=t.dependenciesState)}function De(e,t){if(1===e.observers.length)e.observers.length=0,Pe(e);else{var n=e.observers,r=e.observersIndexes,i=n.pop();if(i!==t){var o=r[t.__mapid]||0;o?r[i.__mapid]=o:delete r[i.__mapid],n[o]=i}delete r[t.__mapid]}}function Pe(e){!1===e.isPendingUnobservation&&(e.isPendingUnobservation=!0,Ne.pendingUnobservations.push(e))}function Oe(){Ne.inBatch++}function Re(){if(0==--Ne.inBatch){Ue();for(var e=Ne.pendingUnobservations,t=0;t0&&Pe(e),!1)}function je(e,t){if(console.log("[mobx.trace] '"+e.name+"' is invalidated due to a change in: '"+t.name+"'"),e.isTracing===ie.BREAK){var n=[];!function e(t,n,r){n.length>=1e3?n.push("(and many more)"):(n.push(""+new Array(r).join("\t")+t.name),t.dependencies&&t.dependencies.forEach((function(t){return e(t,n,r+1)})))}((r=e,it(Vt(r,void 0))),n,1),new Function("debugger;\n/*\nTracing '"+e.name+"'\n\nYou are entering this break point because derivation '"+e.name+"' is being traced and '"+t.name+"' is now forcing it to update.\nJust follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update\nThe stackframe you are looking for is at least ~6-8 stack-frames up.\n\n"+(e instanceof Se?e.derivation.toString().replace(/[*]\//g,"/"):"")+"\n\nThe dependencies for this derivation are:\n\n"+n.join("\n")+"\n*/\n ")()}var r}var Be=function(){function e(e,t,n,r){void 0===e&&(e="Reaction@"+p()),void 0===r&&(r=!1),this.name=e,this.onInvalidate=t,this.errorHandler=n,this.requiresObservable=r,this.observing=[],this.newObserving=[],this.dependenciesState=re.NOT_TRACKING,this.diffValue=0,this.runId=0,this.unboundDepsCount=0,this.__mapid="#"+p(),this.isDisposed=!1,this._isScheduled=!1,this._isTrackPending=!1,this._isRunning=!1,this.isTracing=ie.NONE}return e.prototype.onBecomeStale=function(){this.schedule()},e.prototype.schedule=function(){this._isScheduled||(this._isScheduled=!0,Ne.pendingReactions.push(this),Ue())},e.prototype.isScheduled=function(){return this._isScheduled},e.prototype.runReaction=function(){if(!this.isDisposed){if(Oe(),this._isScheduled=!1,ue(this)){this._isTrackPending=!0;try{this.onInvalidate(),this._isTrackPending&&Ge()&&He({name:this.name,type:"scheduled-reaction"})}catch(e){this.reportExceptionInDerivation(e)}}Re()}},e.prototype.track=function(e){Oe();var t,n=Ge();n&&(t=Date.now(),Ve({name:this.name,type:"reaction"})),this._isRunning=!0;var r=ce(this,e,void 0);this._isRunning=!1,this._isTrackPending=!1,this.isDisposed&&he(this),se(r)&&this.reportExceptionInDerivation(r.cause),n&&Ye({time:Date.now()-t}),Re()},e.prototype.reportExceptionInDerivation=function(e){var t=this;if(this.errorHandler)this.errorHandler(e,this);else{if(Ne.disableErrorBoundaries)throw e;var n="[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this+"'";Ne.suppressReactionErrors?console.warn("[mobx] (error in reaction '"+this.name+"' suppressed, fix error of causing action below)"):console.error(n,e),Ge()&&He({type:"error",name:this.name,message:n,error:""+e}),Ne.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},e.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._isRunning||(Oe(),he(this),Re()))},e.prototype.getDisposer=function(){var e=this.dispose.bind(this);return e.$mobx=this,e},e.prototype.toString=function(){return"Reaction["+this.name+"]"},e.prototype.trace=function(e){void 0===e&&(e=!1),function(){for(var e=[],t=0;t0||Ne.isRunningReactions||function(e){e()}(Fe)}function Fe(){Ne.isRunningReactions=!0;for(var e=Ne.pendingReactions,t=0;e.length>0;){100==++t&&(console.error("Reaction doesn't converge to a stable state after 100 iterations. Probably there is a cycle in the reactive function: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",e):2===arguments.length&&"function"==typeof t?_e(e,t):1===arguments.length&&"string"==typeof e?Qe(e):!0!==r?Qe(t).apply(null,arguments):void(e[t]=_e(e.name||t,n.value))};function Je(e,t,n){_(e,t,_e(t,n.bind(e)))}qe.bound=function(e,t,n,r){return!0===r?(Je(e,t,n.value),null):n?{configurable:!0,enumerable:!1,get:function(){return Je(this,t,n.value||n.initializer.call(this)),this[t]},set:Xe}:{enumerable:!1,configurable:!0,set:function(e){Je(this,t,e)},get:function(){}}};var Ke=function(e){return e()};function $e(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Ke}function et(e,t,n){void 0===n&&(n=h),"boolean"==typeof n&&(n={fireImmediately:n});var r,i,o,a=n.name||"Reaction@"+p(),s=qe(a,n.onError?(r=n.onError,i=t,function(){try{return i.apply(this,arguments)}catch(e){r.call(this,e)}}):t),u=!n.scheduler&&!n.delay,l=$e(n),c=!0,d=!1,f=n.compareStructural?j.structural:n.equals||j.default,v=new Be(a,(function(){c||u?m():d||(d=!0,l(m))}),n.onError,n.requiresObservable);function m(){if(d=!1,!v.isDisposed){var t=!1;v.track((function(){var n=e(v);t=c||!f(o,n),o=n})),c&&n.fireImmediately&&s(o,v),c||!0!==t||s(o,v),c&&(c=!1)}}return v.schedule(),v.getDisposer()}function tt(e,t,n){return nt("onBecomeUnobserved",e,t,n)}function nt(e,t,n,r){var i="function"==typeof r?Vt(t,n):Vt(t),o="function"==typeof r?r:n,a=i[e];return"function"!=typeof a?v(!1):(i[e]=function(){a.call(this),o.call(this)},function(){i[e]=a})}function rt(e,t,n,r){var i=(r=Q(r)).defaultDecorator||(!1===r.deep?K:q);z(e),Bt(e,r.name,i.enhancer),Oe();try{for(var o in t){var a=Object.getOwnPropertyDescriptor(t,o),s=(n&&o in n?n[o]:a.get?oe:i)(e,o,a,!0);s&&Object.defineProperty(e,o,s)}}finally{Re()}return e}function it(e){var t,n,r={name:e.name};return e.observing&&e.observing.length>0&&(r.dependencies=(t=e.observing,n=[],t.forEach((function(e){-1===n.indexOf(e)&&n.push(e)})),n).map(it)),r}function ot(e,t){if(null==e)return!1;if(void 0!==t){if(Ht(e)){var n=e.$mobx;return n.values&&!!n.values[t]}return!1}return Ht(e)||!!e.$mobx||R(e)||ze(e)||Ae(e)}function at(e){return 1!==arguments.length&&v(!1),ot(e)}function st(e){switch(e.length){case 0:return Ne.trackingDerivation;case 1:return Vt(e[0]);case 2:return Vt(e[0],e[1])}}function ut(e,t){void 0===t&&(t=void 0),Oe();try{return e.apply(t)}finally{Re()}}function lt(e){return void 0!==e.interceptors&&e.interceptors.length>0}function ct(e,t){var n=e.interceptors||(e.interceptors=[]);return n.push(t),g((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ht(e,t){var n=fe();try{var r=e.interceptors;if(r)for(var i=0,o=r.length;i0}function ft(e,t){var n=e.changeListeners||(e.changeListeners=[]);return n.push(t),g((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function pt(e,t){var n=fe(),r=e.changeListeners;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},e.prototype.intercept=function(e){return ct(this,e)},e.prototype.observe=function(e,t){return void 0===t&&(t=!1),t&&e({object:this.array,type:"splice",index:0,added:this.values.slice(),addedCount:this.values.length,removed:[],removedCount:0}),ft(this,e)},e.prototype.getArrayLength=function(){return this.atom.reportObserved(),this.values.length},e.prototype.setArrayLength=function(e){if("number"!=typeof e||e<0)throw new Error("[mobx.array] Out of range: "+e);var t=this.values.length;if(e!==t)if(e>t){for(var n=new Array(e-t),r=0;r0&&e+t+1>xt&&At(e+t+1)},e.prototype.spliceWithArray=function(e,t,n){var r=this;le(this.atom);var i=this.values.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=c),lt(this)){var o=ht(this,{object:this.array,type:"splice",index:e,removedCount:t,added:n});if(!o)return c;t=o.removedCount,n=o.added}var a=(n=0===n.length?n:n.map((function(e){return r.enhancer(e,void 0)}))).length-t;this.updateArrayLength(i,a);var s=this.spliceItemsIntoValues(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice(e,n,s),this.dehanceValues(s)},e.prototype.spliceItemsIntoValues=function(e,t,n){var r;if(n.length<1e4)return(r=this.values).splice.apply(r,l([e,t],n));var i=this.values.slice(e,e+t);return this.values=this.values.slice(0,e).concat(n,this.values.slice(e+t)),i},e.prototype.notifyArrayChildUpdate=function(e,t,n){var r=!this.owned&&Ge(),i=dt(this),o=i||r?{object:this.array,type:"update",index:e,newValue:t,oldValue:n}:null;r&&Ve(s(s({},o),{name:this.atom.name})),this.atom.reportChanged(),i&&pt(this,o),r&&Ye()},e.prototype.notifyArraySplice=function(e,t,n){var r=!this.owned&&Ge(),i=dt(this),o=i||r?{object:this.array,type:"splice",index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;r&&Ve(s(s({},o),{name:this.atom.name})),this.atom.reportChanged(),i&&pt(this,o),r&&Ye()},e}(),Tt=function(e){function t(t,n,r,i){void 0===r&&(r="ObservableArray@"+p()),void 0===i&&(i=!1);var o=e.call(this)||this,a=new wt(r,n,o,i);if(w(o,"$mobx",a),t&&t.length){var s=Te(!0);o.spliceWithArray(0,0,t),Me(s)}return bt&&Object.defineProperty(a.array,"0",Mt),o}return a(t,e),t.prototype.intercept=function(e){return this.$mobx.intercept(e)},t.prototype.observe=function(e,t){return void 0===t&&(t=!1),this.$mobx.observe(e,t)},t.prototype.clear=function(){return this.splice(0)},t.prototype.concat=function(){for(var e=[],t=0;t-1&&(this.splice(t,1),!0)},t.prototype.move=function(e,t){function n(e){if(e<0)throw new Error("[mobx.array] Index out of bounds: "+e+" is negative");var t=this.$mobx.values.length;if(e>=t)throw new Error("[mobx.array] Index out of bounds: "+e+" is not smaller than "+t)}if(n.call(this,e),n.call(this,t),e!==t){var r,i=this.$mobx.values;r=e1)for(var n=1;n=2&&(this.player.currentTime=e)},e}(),d=(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),f=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},p=function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]1e3&&(n.lastSyncProgressTimestamp=r,n.selfUserInf&&n.selfUserInf.identity===i.host&&t.putAttributes({currentTime:e,play:n.playerState}))},n.handleSeekReaction=function(e,t){n.isHost()||n.player.current&&void 0!==t&&(n.player.current.currentTime=e+Date.now()/1e3-t)},n.handleRemove=function(){return f(n,void 0,void 0,(function(){var e;return p(this,(function(t){switch(t.label){case 0:return e=this.props.plugin,this.handleRemotePlayState(!1),[4,v(300)];case 1:return t.sent(),e.remove(),[2]}}))}))},n.timeUpdate=function(){if(n.player.current){var e=n.player.current.currentTime;n.onTimeUpdate(e)}},n.detectAudioClickEnable=function(){var e=n.props.plugin;return e.context&&e.context.identity?e.context.identity!==i.host?"none":"auto":"none"},n.renderMuteBox=function(){var e=n.props.plugin;return e.context&&e.context.identity&&e.context.identity!==i.host&&n.state.selfMute?o.createElement("div",{className:"media-mute-box"},o.createElement("div",{onClick:function(){n.setState({selfMute:!1})},onTouchStart:function(){n.setState({selfMute:!1})},style:{pointerEvents:"auto"},className:"media-mute-box-inner"},o.createElement("img",{src:u,alt:"mute_icon"}),o.createElement("span",null,"unmute"))):null},n.renderDeleteBtn=function(){var e=n.props.plugin;return e.context&&e.context.identity&&e.context.identity===i.host?o.createElement("div",{style:{pointerEvents:"auto"},className:"plugin-audio-box-delete",onClick:n.handleRemove},o.createElement("img",{src:c,alt:"delete_icon"})):null},n.renderNavigation=function(){return!0===n.props.plugin.attributes.isNavigationDisable?null:o.createElement("div",{className:"plugin-audio-box-nav"},o.createElement("div",null,o.createElement("img",{style:{width:20,marginLeft:8},src:l,alt:"audio_plugin"}),o.createElement("span",null,"Audio Player")),n.renderDeleteBtn())},n.handleFirstSeek=function(e){if(!e){var t,r=n.props.plugin,i=Date.now()/1e3;t=r.attributes.seekTime?r.attributes.seek+i-r.attributes.seekTime:r.attributes.seek,n.syncNode.syncProgress(t)}},n.player=o.createRef(),n.reactionPlayDisposer=n.startPlayReaction(),n.reactionSeekDisposer=n.startSeekReaction(),n.reactionVolumeDisposer=n.startVolumeReaction(),n.reactionMuteDisposer=n.startMuteTimeReaction(),n.reactionSeekTimeDisposer=n.startSeekTimeReaction(),n.reactionSyncDisposer=n.startSyncReaction(),n.state={play:!1,seek:0,selfMute:!1,currentTime:0,mute:!1,volume:1,isEnd:!1},n}return d(t,e),t.prototype.componentDidMount=function(){return f(this,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return this.syncNode=new h(this.player.current),[4,this.handleStartCondition()];case 1:return e.sent(),[2]}}))}))},t.prototype.startPlayReaction=function(){var e=this,t=this.props.plugin;return Object(s.a)((function(){return t.attributes.play}),(function(t){return f(e,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return this.isHost()?[3,2]:[4,this.handleNativePlayerState(t)];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))}))},t.prototype.startSeekTimeReaction=function(){var e=this,t=this.props.plugin;return Object(s.a)((function(){return t.attributes.seekTime}),(function(n){e.handleSeekReaction(t.attributes.seek,n)}))},t.prototype.startSeekReaction=function(){var e=this,t=this.props.plugin;return Object(s.a)((function(){return t.attributes.seek}),(function(n){e.handleSeekReaction(n,t.attributes.seekTime)}))},t.prototype.startSyncReaction=function(){var e=this,t=this.props.plugin;return Object(s.a)((function(){return t.attributes.currentTime}),(function(t){return f(e,void 0,void 0,(function(){return p(this,(function(e){return this.isHost()||this.player.current&&Math.abs(t-this.player.current.currentTime)>2&&(this.player.current.currentTime=t),[2]}))}))}))},t.prototype.startVolumeReaction=function(){var e=this,t=this.props.plugin;return Object(s.a)((function(){return t.attributes.volume}),(function(t){e.isHost()||e.player.current&&(e.player.current.volume=t)}))},t.prototype.startMuteTimeReaction=function(){var e=this,t=this.props.plugin;return Object(s.a)((function(){return t.attributes.mute}),(function(t){e.isHost()||e.setState({mute:t})}))},t.prototype.componentWillUnmount=function(){this.reactionPlayDisposer(),this.reactionSeekDisposer(),this.reactionMuteDisposer(),this.reactionVolumeDisposer(),this.reactionSyncDisposer(),this.player.current&&this.player.current.pause()},t.prototype.render=function(){var e=this,t=this.props,n=t.size,r=t.plugin,a=t.scale,s=0===a?1:a,u=navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform);return o.createElement("div",{className:"plugin-audio-box",style:{width:n.width/s,height:n.height/s,transform:"scale("+s+")"}},this.renderNavigation(),o.createElement("div",{className:"plugin-audio-box-body"},this.renderMuteBox(),o.createElement("div",{className:"white-plugin-audio-box"},o.createElement("audio",{className:"white-plugin-audio",src:r.attributes.pluginAudioUrl,ref:this.player,muted:this.state.mute?this.state.mute:this.state.selfMute,style:{width:"100%",height:54,pointerEvents:this.detectAudioClickEnable(),outline:"none"},onLoadedMetadataCapture:function(){return f(e,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return u?[4,v(300)]:[3,2];case 1:e.sent(),this.handleFirstSeek(this.state.isEnd),e.label=2;case 2:return[2]}}))}))},onEnded:function(){return f(e,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return this.player.current?this.selfUserInf?this.selfUserInf.identity!==i.host?[3,2]:(r.putAttributes({seek:0,seekTime:void 0,currentTime:0}),[4,v(500)]):[3,5]:[3,7];case 1:return e.sent(),this.player.current.load(),[3,4];case 2:return[4,v(1e3)];case 3:e.sent(),this.player.current.load(),e.label=4;case 4:return[3,7];case 5:return[4,v(1e3)];case 6:e.sent(),this.player.current.load(),e.label=7;case 7:return this.setState({isEnd:!0}),[2]}}))}))},controls:!0,controlsList:"nodownload nofullscreen",onTimeUpdate:this.timeUpdate,preload:"auto"}))))},t}(o.Component),b=(g=function(e,t){return(g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}g(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),x=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},_=function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1] img {\n width: 20px;\n margin-left: 8px;\n}\n.white-audio-plugin-nav-title {\n margin-left: 6px;\n font-size: 12px;\n font-weight: bold;\n flex-grow: 1;\n}\n.white-audio-plugin-nav-delete {\n width: 22px;\n height: 22px;\n border: 0;\n background-color: #ff756e;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 50%;\n margin-right: 8px;\n cursor: pointer;\n opacity: 0.6;\n transition: opacity 0.2s ease;\n}\n.white-audio-plugin-nav-delete > img {\n width: 14px;\n}\n.white-audio-plugin-nav-delete:hover {\n opacity: 1;\n}\n.white-audio-plugin-body {\n flex-grow: 1;\n background-color: #f2f4f5;\n display: flex;\n flex-flow: column nowrap;\n align-items: stretch;\n justify-content: center;\n}\n.white-audio-plugin-body > audio {\n flex-grow: 1;\n outline: none;\n}\n",""]),e.exports=t},function(e,t,n){e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=function(e,t){var n,r,i,o=e[1]||"",a=e[3];if(!a)return o;if(t&&"function"==typeof btoa){var s=(n=a,r=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),i="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(r),"/*# ".concat(i," */")),u=a.sources.map((function(e){return"/*# sourceURL=".concat(a.sourceRoot||"").concat(e," */")}));return[o].concat(u).concat([s]).join("\n")}return[o].join("\n")}(t,e);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n,r){"string"==typeof e&&(e=[[null,e,""]]);var i={};if(r)for(var o=0;o0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&(d=Date.now(),this.props.player&&(d=this.props.player.beginTimestamp+r),f=l+(d-c)/1e3,Math.abs(n.currentTime-f)>2&&(n.currentTime=f)),this.changedMap.changed("rate",i)&&(n.playbackRate=i),[2]}}))}))}));this.disposers.push(r),this.disposers.push((function(){return e.changedMap.clear()}))},t.prototype.componentWillUnmount=function(){var e;null===(e=this.player.current)||void 0===e||e.pause(),this.disposers.forEach((function(e){return e()}))},Object.defineProperty(t.prototype,"containerStyle",{get:function(){var e=this.props,t=e.size,n=e.scale||1;return{width:t.width/n,height:t.height/n,transform:"scale("+n+")"}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pointerEventsStyle",{get:function(){return{pointerEvents:this.isHost()?"auto":"none"}},enumerable:!1,configurable:!0}),t.prototype.render=function(){var e=this.props,t=e.room,n=e.player,r=e.plugin;return t||n?i.a.createElement("div",{className:"white-audio-plugin-container",style:this.containerStyle},!r.attributes.isNavigationDisable&&i.a.createElement("div",{className:"white-audio-plugin-nav"},i.a.createElement("img",{src:s.a,alt:"audio_plugin"}),i.a.createElement("span",{className:"white-audio-plugin-nav-title"},"Audio Player"),i.a.createElement("span",{className:"white-audio-plugin-nav-delete",style:this.pointerEventsStyle,onClick:this.removeSelf},i.a.createElement("img",{src:l.a,alt:"delete_icon"}))),i.a.createElement("div",{className:"white-audio-plugin-body"},i.a.createElement("audio",{src:r.attributes.src,style:this.pointerEventsStyle,controls:!!t,controlsList:"nodownload nofullscreen",preload:"auto",ref:this.player}))):null},t}(r.Component);n.d(t,"audioPlugin2",(function(){return _}));var _=Object.freeze({kind:"audio2",render:b,defaultAttributes:{src:"",hostTime:0,currentTime:0,paused:!0,muted:!1,volume:1},hitTest:function(e){var t=e.component.context.getMemberState();return!("eraser"===(null==t?void 0:t.currentApplianceName))}})}])},"object"==r(t)&&"object"==r(e)?e.exports=i(n(17328),n(71895)):n.amdD([,],i)},44112:function(e,t,n){function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}
-/*! For license information please see index.js.LICENSE.txt */var i;e=n.nmd(e),window,i=function(e,t){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==r(e)&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(i,o,function(t){return e[t]}.bind(null,o));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=12)}([function(t,n){t.exports=e},function(e,t,n){(function(e,i){n.d(t,"a",(function(){return nt}));var o=[];Object.freeze(o);var a={};Object.freeze(a);var s={};function u(){return"undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:s}function l(){return++De.mobxGuid}function c(e){throw h(!1,e),"X"}function h(e,t){if(!e)throw new Error("[mobx] "+(t||"An invariant failed, however the error is obfuscated because this is an production build."))}function d(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var f=function(){};function p(e){return null!==e&&"object"==r(e)}function v(e){if(null===e||"object"!=r(e))return!1;var t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function m(e,t,n){Object.defineProperty(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function g(e,t,n){Object.defineProperty(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function y(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(e){return p(e)&&!0===e[n]}}function b(e){return void 0!==u().Map&&e instanceof u().Map}function x(e){return e instanceof Set}function _(e){for(var t=[];;){var n=e.next();if(n.done)break;t.push(n.value)}return t}function w(){return"function"==typeof Symbol&&Symbol.toPrimitive||"@@toPrimitive"}function T(e){return null===e?null:"object"==r(e)?""+e:e}function M(e,t){for(var n=e.next();!n.done;)t(n.value),n=e.next()}function E(){return"function"==typeof Symbol&&Symbol.iterator||"@@iterator"}function S(e,t){g(e,E(),t)}function A(e){return e[E()]=C,e}function I(){return"function"==typeof Symbol&&Symbol.toStringTag||"@@toStringTag"}function C(){return this}var N=function(){function e(e){void 0===e&&(e="Atom@"+l()),this.name=e,this.isPendingUnobservation=!1,this.isBeingObserved=!1,this.observers=[],this.observersIndexes={},this.diffValue=0,this.lastAccessedBy=0,this.lowestObserverState=oe.NOT_TRACKING}return e.prototype.onBecomeUnobserved=function(){},e.prototype.onBecomeObserved=function(){},e.prototype.reportObserved=function(){return Be(this)},e.prototype.reportChanged=function(){Le(),function(e){if(e.lowestObserverState!==oe.STALE){e.lowestObserverState=oe.STALE;for(var t=e.observers,n=t.length;n--;){var r=t[n];r.dependenciesState===oe.UP_TO_DATE&&(r.isTracing!==ae.NONE&&Ue(r,e),r.onBecomeStale()),r.dependenciesState=oe.STALE}}}(this),je()},e.prototype.toString=function(){return this.name},e}(),k=y("Atom",N);function D(e,t,n){void 0===t&&(t=f),void 0===n&&(n=f);var r=new N(e);return it("onBecomeObserved",r,t,void 0),rt(r,n),r}function P(e,t){return e===t}var O={identity:P,structural:function(e,t){return Zt(e,t)},default:function(e,t){return function(e,t){return"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)}(e,t)||P(e,t)},shallow:function(e,t){return Zt(e,t,1)}},R=function(e,t){return(R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function L(e,t){function n(){this.constructor=e}R(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var j=function(){return(j=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function U(){for(var e=[],t=0;t2&&ie("box");var n=q(t);return new Ae(e,J(n),n.name,!0,n.equals)},shallowBox:function(e,t){return arguments.length>2&&ie("shallowBox"),re.box(e,{name:t,deep:!1})},array:function(e,t){arguments.length>2&&ie("array");var n=q(t);return new Et(e,J(n),n.name)},shallowArray:function(e,t){return arguments.length>2&&ie("shallowArray"),re.array(e,{name:t,deep:!1})},map:function(e,t){arguments.length>2&&ie("map");var n=q(t);return new Pt(e,J(n),n.name)},shallowMap:function(e,t){return arguments.length>2&&ie("shallowMap"),re.map(e,{name:t,deep:!1})},set:function(e,t){arguments.length>2&&ie("set");var n=q(t);return new jt(e,J(n),n.name)},object:function(e,t,n){"string"==typeof arguments[1]&&ie("object");var r=q(n);return ot({},e,t,r)},shallowObject:function(e,t){return"string"==typeof arguments[1]&&ie("shallowObject"),re.object(e,{},{name:t,deep:!1})},ref:ee,shallow:$,deep:K,struct:te},re=function e(t,n,r){if("string"==typeof arguments[1])return K.apply(null,arguments);if(ut(t))return t;var i=v(t)?e.object(t,n,r):Array.isArray(t)?e.array(t,n):b(t)?e.map(t,n):x(t)?e.set(t,n):t;if(i!==t)return i;c(!1)};function ie(e){c("Expected one or two arguments to observable."+e+". Did you accidentally try to use observable."+e+" as decorator?")}Object.keys(ne).forEach((function(e){return re[e]=ne[e]}));var oe,ae,se=V(!1,(function(e,t,n,r,i){var o=n.get,a=n.set,s=i[0]||{};!function(e,t,n){var r=Ft(e);n.name=r.name+"."+t,n.context=e,r.values[t]=new Ie(n),Object.defineProperty(e,t,function(e){return Gt[e]||(Gt[e]={configurable:De.computedConfigurable,enumerable:!1,get:function(){return Ht(this).read(this,e)},set:function(t){Ht(this).write(this,e,t)}})}(t))}(e,t,j({get:o,set:a},s))}));se({equals:O.structural}),function(e){e[e.NOT_TRACKING=-1]="NOT_TRACKING",e[e.UP_TO_DATE=0]="UP_TO_DATE",e[e.POSSIBLY_STALE=1]="POSSIBLY_STALE",e[e.STALE=2]="STALE"}(oe||(oe={})),function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"}(ae||(ae={}));var ue=function(e){this.cause=e};function le(e){return e instanceof ue}function ce(e){switch(e.dependenciesState){case oe.UP_TO_DATE:return!1;case oe.NOT_TRACKING:case oe.STALE:return!0;case oe.POSSIBLY_STALE:for(var t=ge(!0),n=ve(),r=e.observing,i=r.length,o=0;o0;De.computationDepth>0&&t&&c(!1),De.allowStateChanges||!t&&"strict"!==De.enforceActions||c(!1)}function de(e,t,n){var r=ge(!0);be(e),e.newObserving=new Array(e.observing.length+100),e.unboundDepsCount=0,e.runId=++De.runId;var i,o=De.trackingDerivation;if(De.trackingDerivation=e,!0===De.disableErrorBoundaries)i=t.call(n);else try{i=t.call(n)}catch(e){i=new ue(e)}return De.trackingDerivation=o,function(e){for(var t=e.observing,n=e.observing=e.newObserving,r=oe.UP_TO_DATE,i=0,o=e.unboundDepsCount,a=0;ar&&(r=s.dependenciesState);for(n.length=i,e.newObserving=null,o=t.length;o--;)0===(s=t[o]).diffValue&&Oe(s,e),s.diffValue=0;for(;i--;){var s;1===(s=n[i]).diffValue&&(s.diffValue=0,Pe(s,e))}r!==oe.UP_TO_DATE&&(e.dependenciesState=r,e.onBecomeStale())}(e),e.observing.length,ye(r),i}function fe(e){var t=e.observing;e.observing=[];for(var n=t.length;n--;)Oe(t[n],e);e.dependenciesState=oe.NOT_TRACKING}function pe(e){var t=ve(),n=e();return me(t),n}function ve(){var e=De.trackingDerivation;return De.trackingDerivation=null,e}function me(e){De.trackingDerivation=e}function ge(e){var t=De.allowStateReads;return De.allowStateReads=e,t}function ye(e){De.allowStateReads=e}function be(e){if(e.dependenciesState!==oe.UP_TO_DATE){e.dependenciesState=oe.UP_TO_DATE;for(var t=e.observing,n=t.length;n--;)t[n].lowestObserverState=oe.UP_TO_DATE}}var xe=0,_e=1,we=Object.getOwnPropertyDescriptor((function(){}),"name");function Te(e,t){var n=function(){return Me(e,t,this,arguments)};return n.isMobxAction=!0,n}function Me(e,t,n,r){var i=function(e,t,n){var r=Ve()&&!!e,i=0;if(r){i=Date.now();var o=n&&n.length||0,a=new Array(o);if(o>0)for(var s=0;s0&&!e.__mobxGlobals&&(ke=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new Ne).version&&(ke=!1),ke?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new Ne):(setTimeout((function(){c("There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`")}),1),new Ne)}();function Pe(e,t){var n=e.observers.length;n&&(e.observersIndexes[t.__mapid]=n),e.observers[n]=t,e.lowestObserverState>t.dependenciesState&&(e.lowestObserverState=t.dependenciesState)}function Oe(e,t){if(1===e.observers.length)e.observers.length=0,Re(e);else{var n=e.observers,r=e.observersIndexes,i=n.pop();if(i!==t){var o=r[t.__mapid]||0;o?r[i.__mapid]=o:delete r[i.__mapid],n[o]=i}delete r[t.__mapid]}}function Re(e){!1===e.isPendingUnobservation&&(e.isPendingUnobservation=!0,De.pendingUnobservations.push(e))}function Le(){De.inBatch++}function je(){if(0==--De.inBatch){ze();for(var e=De.pendingUnobservations,t=0;t0&&Re(e),!1)}function Ue(e,t){if(console.log("[mobx.trace] '"+e.name+"' is invalidated due to a change in: '"+t.name+"'"),e.isTracing===ae.BREAK){var n=[];!function e(t,n,r){n.length>=1e3?n.push("(and many more)"):(n.push(""+new Array(r).join("\t")+t.name),t.dependencies&&t.dependencies.forEach((function(t){return e(t,n,r+1)})))}((r=e,at(Yt(r,void 0))),n,1),new Function("debugger;\n/*\nTracing '"+e.name+"'\n\nYou are entering this break point because derivation '"+e.name+"' is being traced and '"+t.name+"' is now forcing it to update.\nJust follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update\nThe stackframe you are looking for is at least ~6-8 stack-frames up.\n\n"+(e instanceof Ie?e.derivation.toString().replace(/[*]\//g,"/"):"")+"\n\nThe dependencies for this derivation are:\n\n"+n.join("\n")+"\n*/\n ")()}var r}var Fe=function(){function e(e,t,n,r){void 0===e&&(e="Reaction@"+l()),void 0===r&&(r=!1),this.name=e,this.onInvalidate=t,this.errorHandler=n,this.requiresObservable=r,this.observing=[],this.newObserving=[],this.dependenciesState=oe.NOT_TRACKING,this.diffValue=0,this.runId=0,this.unboundDepsCount=0,this.__mapid="#"+l(),this.isDisposed=!1,this._isScheduled=!1,this._isTrackPending=!1,this._isRunning=!1,this.isTracing=ae.NONE}return e.prototype.onBecomeStale=function(){this.schedule()},e.prototype.schedule=function(){this._isScheduled||(this._isScheduled=!0,De.pendingReactions.push(this),ze())},e.prototype.isScheduled=function(){return this._isScheduled},e.prototype.runReaction=function(){if(!this.isDisposed){if(Le(),this._isScheduled=!1,ce(this)){this._isTrackPending=!0;try{this.onInvalidate(),this._isTrackPending&&Ve()&&We({name:this.name,type:"scheduled-reaction"})}catch(e){this.reportExceptionInDerivation(e)}}je()}},e.prototype.track=function(e){Le();var t,n=Ve();n&&(t=Date.now(),Ye({name:this.name,type:"reaction"})),this._isRunning=!0;var r=de(this,e,void 0);this._isRunning=!1,this._isTrackPending=!1,this.isDisposed&&fe(this),le(r)&&this.reportExceptionInDerivation(r.cause),n&&Qe({time:Date.now()-t}),je()},e.prototype.reportExceptionInDerivation=function(e){var t=this;if(this.errorHandler)this.errorHandler(e,this);else{if(De.disableErrorBoundaries)throw e;var n="[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this+"'";De.suppressReactionErrors?console.warn("[mobx] (error in reaction '"+this.name+"' suppressed, fix error of causing action below)"):console.error(n,e),Ve()&&We({type:"error",name:this.name,message:n,error:""+e}),De.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},e.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._isRunning||(Le(),fe(this),je()))},e.prototype.getDisposer=function(){var e=this.dispose.bind(this);return e.$mobx=this,e},e.prototype.toString=function(){return"Reaction["+this.name+"]"},e.prototype.trace=function(e){void 0===e&&(e=!1),function(){for(var e=[],t=0;t0||De.isRunningReactions||function(e){e()}(Ge)}function Ge(){De.isRunningReactions=!0;for(var e=De.pendingReactions,t=0;e.length>0;){100==++t&&(console.error("Reaction doesn't converge to a stable state after 100 iterations. Probably there is a cycle in the reactive function: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",e):2===arguments.length&&"function"==typeof t?Te(e,t):1===arguments.length&&"string"==typeof e?qe(e):!0!==r?qe(t).apply(null,arguments):void(e[t]=Te(e.name||t,n.value))};function $e(e,t,n){m(e,t,Te(t,n.bind(e)))}Ke.bound=function(e,t,n,r){return!0===r?($e(e,t,n.value),null):n?{configurable:!0,enumerable:!1,get:function(){return $e(this,t,n.value||n.initializer.call(this)),this[t]},set:Ze}:{enumerable:!1,configurable:!0,set:function(e){$e(this,t,e)},get:function(){}}};var et=function(e){return e()};function tt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:et}function nt(e,t,n){void 0===n&&(n=a),"boolean"==typeof n&&(n={fireImmediately:n});var r,i,o,s=n.name||"Reaction@"+l(),u=Ke(s,n.onError?(r=n.onError,i=t,function(){try{return i.apply(this,arguments)}catch(e){r.call(this,e)}}):t),c=!n.scheduler&&!n.delay,h=tt(n),d=!0,f=!1,p=n.compareStructural?O.structural:n.equals||O.default,v=new Fe(s,(function(){d||c?m():f||(f=!0,h(m))}),n.onError,n.requiresObservable);function m(){if(f=!1,!v.isDisposed){var t=!1;v.track((function(){var n=e(v);t=d||!p(o,n),o=n})),d&&n.fireImmediately&&u(o,v),d||!0!==t||u(o,v),d&&(d=!1)}}return v.schedule(),v.getDisposer()}function rt(e,t,n){return it("onBecomeUnobserved",e,t,n)}function it(e,t,n,r){var i="function"==typeof r?Yt(t,n):Yt(t),o="function"==typeof r?r:n,a=i[e];return"function"!=typeof a?c(!1):(i[e]=function(){a.call(this),o.call(this)},function(){i[e]=a})}function ot(e,t,n,r){var i=(r=q(r)).defaultDecorator||(!1===r.deep?ee:K);H(e),Ft(e,r.name,i.enhancer),Le();try{for(var o=Object.getOwnPropertyNames(t),a=0,s=o.length;a0&&(r.dependencies=(t=e.observing,n=[],t.forEach((function(e){-1===n.indexOf(e)&&n.push(e)})),n).map(at)),r}function st(e,t){if(null==e)return!1;if(void 0!==t){if(Wt(e)){var n=e.$mobx;return n.values&&!!n.values[t]}return!1}return Wt(e)||!!e.$mobx||k(e)||He(e)||Ce(e)}function ut(e){return 1!==arguments.length&&c(!1),st(e)}function lt(e){switch(e.length){case 0:return De.trackingDerivation;case 1:return Yt(e[0]);case 2:return Yt(e[0],e[1])}}function ct(e,t){void 0===t&&(t=void 0),Le();try{return e.apply(t)}finally{je()}}function ht(e){return void 0!==e.interceptors&&e.interceptors.length>0}function dt(e,t){var n=e.interceptors||(e.interceptors=[]);return n.push(t),d((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ft(e,t){var n=ve();try{var r=e.interceptors;if(r)for(var i=0,o=r.length;i0}function vt(e,t){var n=e.changeListeners||(e.changeListeners=[]);return n.push(t),d((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function mt(e,t){var n=ve(),r=e.changeListeners;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},e.prototype.intercept=function(e){return dt(this,e)},e.prototype.observe=function(e,t){return void 0===t&&(t=!1),t&&e({object:this.array,type:"splice",index:0,added:this.values.slice(),addedCount:this.values.length,removed:[],removedCount:0}),vt(this,e)},e.prototype.getArrayLength=function(){return this.atom.reportObserved(),this.values.length},e.prototype.setArrayLength=function(e){if("number"!=typeof e||e<0)throw new Error("[mobx.array] Out of range: "+e);var t=this.values.length;if(e!==t)if(e>t){for(var n=new Array(e-t),r=0;r0&&e+t+1>wt&&Ct(e+t+1)},e.prototype.spliceWithArray=function(e,t,n){var r=this;he(this.atom);var i=this.values.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=o),ht(this)){var a=ft(this,{object:this.array,type:"splice",index:e,removedCount:t,added:n});if(!a)return o;t=a.removedCount,n=a.added}var s=(n=0===n.length?n:n.map((function(e){return r.enhancer(e,void 0)}))).length-t;this.updateArrayLength(i,s);var u=this.spliceItemsIntoValues(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice(e,n,u),this.dehanceValues(u)},e.prototype.spliceItemsIntoValues=function(e,t,n){var r;if(n.length<1e4)return(r=this.values).splice.apply(r,U([e,t],n));var i=this.values.slice(e,e+t);return this.values=this.values.slice(0,e).concat(n,this.values.slice(e+t)),i},e.prototype.notifyArrayChildUpdate=function(e,t,n){var r=!this.owned&&Ve(),i=pt(this),o=i||r?{object:this.array,type:"update",index:e,newValue:t,oldValue:n}:null;r&&Ye(j(j({},o),{name:this.atom.name})),this.atom.reportChanged(),i&&mt(this,o),r&&Qe()},e.prototype.notifyArraySplice=function(e,t,n){var r=!this.owned&&Ve(),i=pt(this),o=i||r?{object:this.array,type:"splice",index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;r&&Ye(j(j({},o),{name:this.atom.name})),this.atom.reportChanged(),i&&mt(this,o),r&&Qe()},e}(),Et=function(e){function t(t,n,r,i){void 0===r&&(r="ObservableArray@"+l()),void 0===i&&(i=!1);var o=e.call(this)||this,a=new Mt(r,n,o,i);if(g(o,"$mobx",a),t&&t.length){var s=Ee(!0);o.spliceWithArray(0,0,t),Se(s)}return _t&&Object.defineProperty(a.array,"0",St),o}return L(t,e),t.prototype.intercept=function(e){return this.$mobx.intercept(e)},t.prototype.observe=function(e,t){return void 0===t&&(t=!1),this.$mobx.observe(e,t)},t.prototype.clear=function(){return this.splice(0)},t.prototype.concat=function(){for(var e=[],t=0;t-1&&(this.splice(t,1),!0)},t.prototype.move=function(e,t){function n(e){if(e<0)throw new Error("[mobx.array] Index out of bounds: "+e+" is negative");var t=this.$mobx.values.length;if(e>=t)throw new Error("[mobx.array] Index out of bounds: "+e+" is not smaller than "+t)}if(n.call(this,e),n.call(this,t),e!==t){var r,i=this.$mobx.values;r=e1)for(var n=1;n=2&&(this.player.currentTime=e)},e}(),d=(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),f=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},p=function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]1e3&&(n.lastSyncProgressTimestamp=r,n.selfUserInf&&n.selfUserInf.identity===i.host&&t.putAttributes({currentTime:e,play:n.playerState}))},n.handleNativePlayerState=function(e){return f(n,void 0,void 0,(function(){var t;return p(this,(function(n){switch(n.label){case 0:if(!e)return[3,7];if(!this.player.current)return[3,6];n.label=1;case 1:return n.trys.push([1,3,,6]),[4,this.player.current.play()];case 2:return n.sent(),[3,6];case 3:return""+(t=n.sent()).name!="NotAllowedError"&&""+t.name!="AbortError"?[3,5]:(this.setState({selfMute:!0}),[4,this.player.current.play()]);case 4:n.sent(),n.label=5;case 5:return[3,6];case 6:return[3,8];case 7:this.player.current&&this.player.current.pause(),n.label=8;case 8:return[2]}}))}))},n.handleSeekReaction=function(e,t){return f(n,void 0,void 0,(function(){return p(this,(function(n){return this.isHost()||this.player.current&&void 0!==t&&(this.player.current.currentTime=e+Date.now()/1e3-t),[2]}))}))},n.timeUpdate=function(){if(n.player.current){var e=n.player.current.currentTime;n.onTimeUpdate(e)}},n.detectVideoClickEnable=function(){var e=n.props.plugin;return e.context&&e.context.identity?e.context.identity!==i.host?"none":"auto":"none"},n.renderMuteBox=function(){var e=n.props.plugin;return e.context&&e.context.identity&&e.context.identity!==i.host&&n.state.selfMute?o.createElement("div",{className:"media-mute-box"},o.createElement("div",{onClick:function(){n.setState({selfMute:!1})},onTouchStart:function(){n.setState({selfMute:!1})},style:{pointerEvents:"auto"},className:"media-mute-box-inner"},o.createElement("img",{src:u,alt:"mute_icon"}),o.createElement("span",null,"unmute"))):null},n.handleRemove=function(){return f(n,void 0,void 0,(function(){var e;return p(this,(function(t){switch(t.label){case 0:return e=this.props.plugin,this.handleRemotePlayState(!1),[4,v(300)];case 1:return t.sent(),e.remove(),[2]}}))}))},n.renderDeleteBtn=function(){var e=n.props.plugin;return e.context&&e.context.identity&&e.context.identity===i.host?o.createElement("div",{style:{pointerEvents:"auto"},className:"plugin-audio-box-delete",onClick:n.handleRemove},o.createElement("img",{src:c,alt:"delete"})):null},n.renderNavigation=function(){return!0===n.props.plugin.attributes.isNavigationDisable?null:o.createElement("div",{className:"plugin-video-box-nav"},o.createElement("div",null,o.createElement("img",{style:{width:20,marginLeft:8},src:l,alt:"video_plugin"}),o.createElement("span",null,"Video Player")),n.renderDeleteBtn())},n.handleOnEnd=function(){return f(n,void 0,void 0,(function(){var e;return p(this,(function(t){switch(t.label){case 0:return e=this.props.plugin,this.player.current?this.selfUserInf?this.selfUserInf.identity!==i.host?[3,2]:(e.putAttributes({seek:0,seekTime:void 0,currentTime:0}),[4,v(500)]):[3,5]:[3,7];case 1:return t.sent(),this.player.current.load(),[3,4];case 2:return[4,v(1e3)];case 3:t.sent(),this.player.current.load(),t.label=4;case 4:return[3,7];case 5:return[4,v(1e3)];case 6:t.sent(),this.player.current.load(),t.label=7;case 7:return this.setState({isEnd:!0}),[2]}}))}))},n.handleOnLoadedMetadataCapture=function(){return f(n,void 0,void 0,(function(){var e,t;return p(this,(function(n){switch(n.label){case 0:return e=navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform),t=this.state.isEnd,e?[4,v(300)]:[3,2];case 1:n.sent(),this.handleFirstSeek(t),n.label=2;case 2:return[2]}}))}))},n.player=o.createRef(),n.reactionSeekDisposer=n.startSeekReaction(),n.reactionSeekTimeDisposer=n.startSeekTimeReaction(),n.reactionPlayDisposer=n.startPlayReaction(),n.reactionVolumeDisposer=n.startVolumeReaction(),n.reactionMuteDisposer=n.startMuteTimeReaction(),n.reactionSyncDisposer=n.startSyncReaction(),n.state={play:!1,seek:0,selfMute:!1,currentTime:0,mute:!1,volume:1,isEnd:!1},n}return d(t,e),t.prototype.componentDidMount=function(){return f(this,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return this.syncNode=new h(this.player.current),[4,this.handleStartCondition()];case 1:return e.sent(),[2]}}))}))},t.prototype.startPlayReaction=function(){var e=this,t=this.props.plugin;return Object(s.a)((function(){return t.attributes.play}),(function(t){return f(e,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return this.isHost()?[3,2]:[4,this.handleNativePlayerState(t)];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))}))},t.prototype.startSeekReaction=function(){var e=this,t=this.props.plugin;return Object(s.a)((function(){return t.attributes.seek}),(function(n){return f(e,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return[4,this.handleSeekReaction(n,t.attributes.seekTime)];case 1:return e.sent(),[2]}}))}))}))},t.prototype.startSyncReaction=function(){var e=this,t=this.props.plugin;return Object(s.a)((function(){return t.attributes.currentTime}),(function(t){return f(e,void 0,void 0,(function(){return p(this,(function(e){return this.isHost()||this.player.current&&Math.abs(t-this.player.current.currentTime)>2&&(this.player.current.currentTime=t),[2]}))}))}))},t.prototype.startSeekTimeReaction=function(){var e=this,t=this.props.plugin;return Object(s.a)((function(){return t.attributes.seekTime}),(function(n){return f(e,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return[4,this.handleSeekReaction(t.attributes.seek,n)];case 1:return e.sent(),[2]}}))}))}))},t.prototype.startVolumeReaction=function(){var e=this,t=this.props.plugin;return Object(s.a)((function(){return t.attributes.volume}),(function(t){e.isHost()||e.player.current&&(e.player.current.volume=t)}))},t.prototype.startMuteTimeReaction=function(){var e=this,t=this.props.plugin;return Object(s.a)((function(){return t.attributes.mute}),(function(t){e.isHost()||e.setState({mute:t})}))},t.prototype.componentWillUnmount=function(){this.reactionPlayDisposer(),this.reactionSeekDisposer(),this.reactionMuteDisposer(),this.reactionVolumeDisposer(),this.reactionSeekTimeDisposer(),this.reactionSyncDisposer(),this.player.current&&this.player.current.pause()},t.prototype.render=function(){var e=this.props,t=e.size,n=e.plugin,r=e.scale,i=this.state,a=i.mute,s=i.selfMute,u=0===r?1:r;return o.createElement("div",{className:"plugin-video-box",style:{width:t.width/u,height:t.height/u,transform:"scale("+u+")"}},this.renderNavigation(),o.createElement("div",{className:"plugin-video-box-body"},this.renderMuteBox(),o.createElement("div",{className:"white-plugin-video-box"},o.createElement("video",{"webkit-playsinline":"true",playsInline:!0,poster:n.attributes.poster,className:"white-plugin-video",src:n.attributes.pluginVideoUrl,ref:this.player,muted:a||s,style:{width:"100%",height:"100%",pointerEvents:this.detectVideoClickEnable(),outline:"none"},disablePictureInPicture:!0,onLoadedMetadataCapture:this.handleOnLoadedMetadataCapture,onEnded:this.handleOnEnd,controls:!0,controlsList:"nodownload nofullscreen",onTimeUpdate:this.timeUpdate,preload:"metadata"}))))},t}(o.Component),y=(m=function(e,t){return(m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}m(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),b=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},x=function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1] img {\n width: 20px;\n margin-left: 8px;\n}\n.white-video-plugin-nav-title {\n margin-left: 6px;\n font-size: 12px;\n font-weight: bold;\n flex-grow: 1;\n}\n.white-video-plugin-nav-delete {\n width: 22px;\n height: 22px;\n border: 0;\n background-color: #ff756e;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 50%;\n margin-right: 8px;\n cursor: pointer;\n opacity: 0.6;\n transition: opacity 0.2s ease;\n}\n.white-video-plugin-nav-delete > img {\n width: 14px;\n}\n.white-video-plugin-nav-delete:hover {\n opacity: 1;\n}\n.white-video-plugin-body {\n flex-grow: 1;\n background-color: #f2f4f5;\n display: flex;\n flex-flow: column nowrap;\n align-items: stretch;\n justify-content: center;\n height: calc(100% - 32px);\n}\n.white-video-plugin-body > audio {\n flex-grow: 1;\n outline: none;\n}\n",""]),e.exports=t},function(e,t,n){e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=function(e,t){var n,r,i,o=e[1]||"",a=e[3];if(!a)return o;if(t&&"function"==typeof btoa){var s=(n=a,r=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),i="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(r),"/*# ".concat(i," */")),u=a.sources.map((function(e){return"/*# sourceURL=".concat(a.sourceRoot||"").concat(e," */")}));return[o].concat(u).concat([s]).join("\n")}return[o].join("\n")}(t,e);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n,r){"string"==typeof e&&(e=[[null,e,""]]);var i={};if(r)for(var o=0;o0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&(d=Date.now(),this.props.player&&(d=this.props.player.beginTimestamp+r),f=l+(d-c)/1e3,Math.abs(n.currentTime-f)>2&&(n.currentTime=f)),this.changedMap.changed("rate",i)&&(n.playbackRate=i),[2]}}))}))}));this.disposers.push(r),this.disposers.push((function(){return e.changedMap.clear()}))},t.prototype.componentWillUnmount=function(){var e;null===(e=this.player.current)||void 0===e||e.pause(),this.disposers.forEach((function(e){return e()}))},Object.defineProperty(t.prototype,"containerStyle",{get:function(){var e=this.props,t=e.size,n=e.scale||1;return{width:t.width/n,height:t.height/n,transform:"scale("+n+")"}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pointerEventsStyle",{get:function(){return{pointerEvents:this.isHost()?"auto":"none"}},enumerable:!1,configurable:!0}),t.prototype.render=function(){var e=this.props,t=e.room,n=e.player,r=e.plugin;return t||n?i.a.createElement("div",{className:"white-video-plugin-container",style:this.containerStyle},!r.attributes.isNavigationDisable&&i.a.createElement("div",{className:"white-video-plugin-nav"},i.a.createElement("img",{src:s.a,alt:"video_plugin"}),i.a.createElement("span",{className:"white-video-plugin-nav-title"},"Video Player"),i.a.createElement("span",{className:"white-video-plugin-nav-delete",style:this.pointerEventsStyle,onClick:this.removeSelf},i.a.createElement("img",{src:l.a,alt:"delete_icon"}))),i.a.createElement("div",{className:"white-video-plugin-body"},i.a.createElement("video",{src:r.attributes.src,style:m({maxWidth:"100%",maxHeight:"100%"},this.pointerEventsStyle),controls:!!t,controlsList:"nodownload nofullscreen",preload:"metadata",ref:this.player,playsInline:!0,"webkit-playsinline":"true",poster:r.attributes.poster,disablePictureInPicture:!0}))):null},t}(r.Component);n.d(t,"videoPlugin2",(function(){return _}));var _=Object.freeze({kind:"video2",render:b,defaultAttributes:{src:"",hostTime:0,currentTime:0,paused:!0,muted:!1,volume:1},hitTest:function(e){var t=e.component.context.getMemberState();return!("eraser"===(null==t?void 0:t.currentApplianceName))}})}])},"object"==r(t)&&"object"==r(e)?e.exports=i(n(17328),n(71895)):n.amdD([,],i)},18371:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.playerStateNameSpace=t.playerNameSpace=t.sdkNameSpace=t.roomStateNamespace=t.roomNamespace=t.roomSyncNamespace=t.pptNamespace=t.ScaleMode=void 0,function(e){e[e.Scale=0]="Scale",e[e.AspectFit=1]="AspectFit",e[e.AspectFitScale=2]="AspectFitScale",e[e.AspectFitSpace=3]="AspectFitSpace",e[e.AspectFill=4]="AspectFill",e[e.AspectFillScale=5]="AspectFillScale"}(t.ScaleMode||(t.ScaleMode={})),t.pptNamespace="ppt",t.roomSyncNamespace="room.sync",t.roomNamespace="room",t.roomStateNamespace="room.state",t.sdkNameSpace="sdk",t.playerNameSpace="player",t.playerStateNameSpace="player.state"},46640:function(e,t,n){var r;function i(e,t,n){return i="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=v(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}},i(e,t,n||e)}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw o}}return n}(e,t)||M(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e){return function(e){if(Array.isArray(e))return E(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||M(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&p(e,t)}function u(e){var t=f();return function(){var n,r=v(e);if(t){var i=v(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return l(this,n)}}function l(e,t){return!t||"object"!==_(t)&&"function"!=typeof t?c(e):t}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h(e){var t="function"==typeof Map?new Map:void 0;return h=function(e){if(null===e||!function(e){return-1!==Function.toString.call(e).indexOf("[native code]")}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return d(e,arguments,v(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),p(n,e)},h(e)}function d(e,t,n){return d=f()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&p(i,n.prototype),i},d.apply(null,arguments)}function f(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function p(e,t){return p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},p(e,t)}function v(e){return v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},v(e)}function m(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function g(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){m(o,r,i,a,s,"next",e)}function s(e){m(o,r,i,a,s,"throw",e)}a(void 0)}))}}function y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function b(e,t){for(var n=0;n=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,i,o=!0,a=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){a=!0,i=e},f:function(){try{o||null==r.return||r.return()}finally{if(a)throw i}}}}function M(e,t){if(e){if("string"==typeof e)return E(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?E(e,t):void 0}}function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(this.timer=this.initInterval())}},{key:"invoke",value:function(){var e=this;if(0!==this.list.length&&void 0===this.currentInvoker){var t=this.list.shift();t&&(this.currentInvoker=t,t().then((function(){e.invoked()})).catch((function(t){console.error("[WindowManager]: create app error: ".concat(t.message)),e.invoked()})))}}},{key:"emitReady",value:function(){this.isEmit||setTimeout((function(){ae.emit("ready")}),50),this.isEmit=!0}},{key:"empty",value:function(){this.list=[],this.clear()}},{key:"destroy",value:function(){this.timer&&this.clear()}}]),e}(),ue=new Q.default,le=function(){var e=g(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new Promise((function(e,t){var n=indexedDB.open("__WindowManagerAppCache",2);n.onerror=function(e){t(e)},n.onupgradeneeded=function(e){var t=e.target.result;t.objectStoreNames.contains("apps")||t.createObjectStore("apps",{keyPath:"kind"}).createIndex("kind","kind",{unique:!0})},n.onsuccess=function(){var t=n.result;e(t)}}));case 2:Y=e.sent;case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ce=function(e,t){if(Y)return function(e,t){return new Promise((function(n,r){var i=e.transaction(["apps"],"readwrite").objectStore("apps").add(t);i.onsuccess=function(){return n()},i.onerror=function(){return r()}}))}(Y,{kind:e,sourceCode:t})},he=function(){var e=g(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Y){e.next=6;break}return e.next=3,de(Y,t);case 3:e.t0=e.sent,e.next=7;break;case 6:e.t0=null;case 7:return e.abrupt("return",e.t0);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();function de(e,t){return new Promise((function(n,r){var i=e.transaction(["apps"]).objectStore("apps").index("kind").get(t);i.onerror=function(e){return r(e)},i.onsuccess=function(){i.result?n(i.result):n(null)}}))}var fe=function(){var e=g(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,he(t);case 2:if(!(n=e.sent)){e.next=5;break}return e.abrupt("return",n.sourceCode);case 5:return e.next=7,ge(t,{timeout:1e4});case 7:return e.next=9,e.sent.text();case 9:return r=e.sent,e.next=12,ce(t,r);case 12:return e.abrupt("return",r);case 13:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),pe=function(e,t){var n=Function(e+"\n;return ".concat(t))();return void 0===n&&(n=window[t]),n},ve=function(){var e=g(regeneratorRuntime.mark((function e(t,n,r){var i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=r||"NetlessApp"+n,ae.emit("loadApp",{kind:n,status:"start"}),e.prev=2,e.next=5,fe(t);case 5:if((o=e.sent)&&0!==o.length){e.next=8;break}throw ae.emit("loadApp",{kind:n,status:"failed",reason:"script is empty."}),new Error("[WindowManager]: script is empty.");case 8:e.next=13;break;case 10:throw e.prev=10,e.t0=e.catch(2),ae.emit("loadApp",{kind:n,status:"failed",reason:e.t0.message}),e.t0;case 13:return e.abrupt("return",me(o,i,n));case 14:case"end":return e.stop()}}),e,null,[[2,10]])})));return function(t,n,r){return e.apply(this,arguments)}}(),me=function(e,t,n){try{var r=pe(e,t);return ae.emit("loadApp",{kind:n,status:"success"}),r}catch(r){if(r.message.includes("Can only have one anonymous define call per script file")){var i=window.define;"function"==typeof i&&i.amd&&delete i.amd;var o=pe(e,t);return ae.emit("loadApp",{kind:n,status:"success"}),o}throw ae.emit("loadApp",{kind:n,status:"failed",reason:r.message}),r}};function ge(e,t){return ye.apply(this,arguments)}function ye(){return ye=g(regeneratorRuntime.mark((function e(t,n){var r,i,o,a,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.timeout,i=void 0===r?1e4:r,o=new AbortController,a=setTimeout((function(){return o.abort()}),i),e.next=6,fetch(t,O(P({},n),{signal:o.signal,headers:{"content-type":"text/plain"}}));case 6:return s=e.sent,e.abrupt("return",(clearTimeout(a),s));case 8:case"end":return e.stop()}}),e)}))),ye.apply(this,arguments)}var be=function(){function e(){var t=this;y(this,e),this.kindEmitters=new Map,this.registered=new Map,this.appClassesCache=new Map,this.appClasses=new Map,this.syncRegisterApp=null,this.onSyncRegisterAppChange=function(e){t.register({kind:e.kind,src:e.src})}}var t,n;return x(e,[{key:"setSyncRegisterApp",value:function(e){this.syncRegisterApp=e}},{key:"register",value:(n=g(regeneratorRuntime.mark((function e(t){var n,r,i,o=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.appClassesCache.delete(t.kind),this.registered.set(t.kind,t),"string"==typeof(n=t.src)&&(r=function(){var e=g(regeneratorRuntime.mark((function e(){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ve(n,t.kind,t.name);case 2:return r=e.sent,e.abrupt("return",r.__esModule?r.default:r);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),this.syncRegisterApp&&this.syncRegisterApp({kind:t.kind,src:n,name:t.name})),"function"==typeof n&&(r=function(){var e=g(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n();case 2:if(!(t=e.sent)){e.next=5;break}return e.abrupt("return",((t.__esModule||t.default)&&(t=t.default),t));case 5:throw new Error("[WindowManager]: load remote script failed, ".concat(n));case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()),"object"==_(n)&&(r=function(){var e=g(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n);case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()),this.appClasses.set(t.kind,g(regeneratorRuntime.mark((function e(){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=o.appClassesCache.get(t.kind),e.abrupt("return",(n||(n=r(),o.appClassesCache.set(t.kind,n)),n));case 2:case"end":return e.stop()}}),e)})))),t.addHooks&&(i=this.createKindEmitter(t.kind))&&t.addHooks(i);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"unregister",value:function(e){this.appClasses.delete(e),this.appClassesCache.delete(e),this.registered.delete(e);var t=this.kindEmitters.get(e);t&&(t.clearListeners(),this.kindEmitters.delete(e))}},{key:"notifyApp",value:(t=g(regeneratorRuntime.mark((function e(t,n,r){var i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=this.kindEmitters.get(t),e.next=3,null==i?void 0:i.emit(n,r);case 3:case"end":return e.stop()}}),e,this)}))),function(e,n,r){return t.apply(this,arguments)})},{key:"createKindEmitter",value:function(e){if(!this.kindEmitters.has(e)){var t=new Q.default;this.kindEmitters.set(e,t)}return this.kindEmitters.get(e)}}]),e}(),xe=new be,_e=function(){var e=g(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null==(n=xe.appClasses.get(t))?void 0:n();case 2:return i=e.sent,e.abrupt("return",i&&(null==(r=i.config)?void 0:r.singleton)?t:"".concat(t,"-").concat(U.v4().replace("-","").slice(0,8)));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),we=function(e,t){if(e.focusScenePath!==t)return e.focusScenePath=t,e},Te=function(e,t){if(e&&e.isWritable&&e.state.sceneState.scenePath!==t){var n="/"===t?"":t;e.setScenePath(n)}},Me=function(e,t,n){e&&e.scenePathType(t)!==B.ScenePathType.None&&e.removeScenes(t,n)};j.debounce((function(e,t){e.emit("mainViewModeChange",t)}),200);var Ee=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=Se(e)[t];if(r){var i=r[n];if(i){var o=i.name;return t===ie?"/".concat(o):"".concat(t,"/").concat(o)}}},Se=function(e){return e.entireScenes()},Ae=function(e,t,n,r){for(var i,o=0;o0&&n.forEach((function(n){var r=e[n];if(r!==t._state[n])if(void 0===r)t._lastValue.set(n,t._state[n]),delete t._state[n],t._setRawState(n,r);else{t._lastValue.set(n,t._state[n]),t._state[n]=r;var i=r;if(j.isObject(r)){var o=t._refMap.get(r);o||(o=function(e){return{k:F.genUID(),v:e,__isRef:!0}}(r),t._refMap.set(r,o)),i=o}t._setRawState(n,i)}}))}else console.error(new Error('Cannot setState on Storage "'.concat(this.id,'" without writable access')),e)}},{key:"emptyStorage",value:function(){if(!(j.size(this._state)<=0)){if(this._destroyed)return void console.error(new Error('Cannot empty destroyed Storage "'.concat(this.id,'".')));if(!this._context.getIsWritable())return void console.error(new Error('Cannot empty Storage "'.concat(this.id,'" without writable access.')));this.setState(j.mapValues(this._state,j.noop))}}},{key:"deleteStorage",value:function(){if(null===this.id)throw new Error("Cannot delete main Storage");this._context.getIsWritable()?(this.destroy(),this._context.updateAttributes([Ze,this.id],void 0)):console.error(new Error('Cannot delete Storage "'.concat(this.id,'" without writable access.')))}},{key:"destroy",value:function(){this._destroyed=!0,this._sideEffect.flushAll()}},{key:"_getRawState",value:function(e){var t;return null===this.id?null!=(t=this._context.getAttributes())?t:e:j.get(this._context.getAttributes(),[Ze,this.id],e)}},{key:"_setRawState",value:function(e,t){if(null===this.id){if(e===Ze)throw new Error('Cannot set attribute internal filed "'.concat(Ze,'"'));return this._context.updateAttributes([e],t)}return this._context.updateAttributes([Ze,this.id,e],t)}},{key:"_updateProperties",value:function(e){var t;if(this._destroyed)console.error(new Error('Cannot call _updateProperties on destroyed Storage "'.concat(this.id,'".')));else if(e.length>0){for(var n={},r=0;rs.pageState.length-1?(console.warn("[WindowManager] nextPage: index out of range"),!1):(s.appProxy.setSceneIndex(t),!0));case 2:case"end":return e.stop()}}),e)}))),this.jumpPage=function(){var e=g(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",0<=t&&t=s.pageState.length?(console.warn("[WindowManager]: page index ".concat(t," out of range")),!1):s.appProxy.removeSceneByIndex(n));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.emitter=i.appEmitter,this.isAddApp=i.isAddApp}return x(e,[{key:"storage",get:function(){return this._storage||(this._storage=new qe(this)),this._storage}},{key:"pageState",get:function(){return this.appProxy.pageState}}]),e}(),Ke=function(){function e(t){var n=this;y(this,e),this.params=t,this.sceneNode=null,this.onSceneChange=function(e){n.sceneNode=e,n.params.notifyPageStateChange()};var r=this.params,i=r.displayer,o=r.scenePath;o&&(this.sceneNode=i.createScenesCallback(o,{onAddScene:this.onSceneChange,onRemoveScene:this.onSceneChange}))}return x(e,[{key:"getFullPath",value:function(e){var t,n=null==(t=this.sceneNode)?void 0:t.scenes;if(this.params.scenePath&&n){var r=n[e];if(r)return"".concat(this.params.scenePath,"/").concat(r)}}},{key:"toObject",value:function(){var e,t;return{index:(null==(e=this.params.view)?void 0:e.focusSceneIndex)||0,length:(null==(t=this.sceneNode)?void 0:t.scenes.length)||0}}},{key:"destroy",value:function(){var e;null==(e=this.sceneNode)||e.dispose()}}]),e}(),$e=function(e){return e.Apps="apps",e.Focus="focus",e.State="state",e.BoxState="boxState",e.MainViewCamera="mainViewCamera",e.MainViewSize="mainViewSize",e.Broadcaster="broadcaster",e.Cursors="cursors",e.Position="position",e.CursorState="cursorState",e.FullPath="fullPath",e.Registered="registered",e.IframeBridge="iframeBridge",e}($e||{}),et=new(function(){function e(t){var n=this;y(this,e),this.context=t,this.setAppFocus=function(e,t){t?n.context.safeSetAttributes({focus:e}):n.context.safeSetAttributes({focus:void 0})}}return x(e,[{key:"setContext",value:function(e){this.context=e}},{key:"apps",value:function(){return j.get(this.attributes,["apps"])}},{key:"getAppAttributes",value:function(e){return j.get(this.apps(),[e])}},{key:"getAppState",value:function(e){return j.get(this.apps(),[e,"state"])}},{key:"getMaximized",value:function(){return j.get(this.attributes,["maximized"])}},{key:"getMinimized",value:function(){return j.get(this.attributes,["minimized"])}},{key:"setupAppAttributes",value:function(e,t,n){var r;this.attributes.apps||this.context.safeSetAttributes({apps:{}});var i=["scenePath","title"];n||i.push("scenes");var o=j.pick(e.options,i),a={kind:e.kind,options:o,isDynamicPPT:n};"string"==typeof e.src&&(a.src=e.src),a.createdAt=Date.now(),this.context.safeUpdateAttributes(["apps",t],a),this.context.safeUpdateAttributes(["apps",t,"state"],(w(r={},$.Size,{}),w(r,$.Position,{}),w(r,$.SceneIndex,0),r))}},{key:"updateAppState",value:function(e,t,n){j.get(this.attributes,["apps",e,"state"])&&this.context.safeUpdateAttributes(["apps",e,"state",t],n)}},{key:"cleanAppAttributes",value:function(e){this.context.safeUpdateAttributes(["apps",e],void 0),this.context.safeSetAttributes(w({},e,void 0)),this.attributes.focus===e&&this.cleanFocus()}},{key:"cleanFocus",value:function(){this.context.safeSetAttributes({focus:void 0})}},{key:"getAppSceneIndex",value:function(e){var t;return null==(t=this.getAppState(e))?void 0:t[$.SceneIndex]}},{key:"getAppScenePath",value:function(e){var t,n;return null==(n=null==(t=this.getAppAttributes(e))?void 0:t.options)?void 0:n.scenePath}},{key:"getMainViewScenePath",value:function(){return this.attributes._mainScenePath}},{key:"getMainViewSceneIndex",value:function(){return this.attributes._mainSceneIndex}},{key:"getBoxState",value:function(){return this.attributes.boxState}},{key:"setMainViewScenePath",value:function(e){this.context.safeSetAttributes({_mainScenePath:e})}},{key:"setMainViewSceneIndex",value:function(e){this.context.safeSetAttributes({_mainSceneIndex:e})}},{key:"getMainViewCamera",value:function(){return j.get(this.attributes,["mainViewCamera"])}},{key:"getMainViewSize",value:function(){return j.get(this.attributes,["mainViewSize"])}},{key:"setMainViewCamera",value:function(e){this.context.safeSetAttributes({mainViewCamera:P({},e)})}},{key:"setMainViewSize",value:function(e){this.context.safeSetAttributes({mainViewSize:P({},e)})}},{key:"setMainViewCameraAndSize",value:function(e,t){this.context.safeSetAttributes({mainViewCamera:P({},e),mainViewSize:P({},t)})}},{key:"updateCursor",value:function(e,t){j.get(this.attributes,["cursors"])||this.context.safeUpdateAttributes(["cursors"],{}),j.get(this.attributes,["cursors",e])||this.context.safeUpdateAttributes(["cursors",e],{}),this.context.safeUpdateAttributes(["cursors",e,"position"],t)}},{key:"updateCursorState",value:function(e,t){j.get(this.attributes,["cursors",e])||this.context.safeUpdateAttributes(["cursors",e],{}),this.context.safeUpdateAttributes(["cursors",e,"cursorState"],t)}},{key:"getCursorState",value:function(e){return j.get(this.attributes,["cursors",e,"cursorState"])}},{key:"cleanCursor",value:function(e){this.context.safeUpdateAttributes(["cursors",e],void 0)}},{key:"setMainViewFocusPath",value:function(e){var t=this.getMainViewScenePath();t&&we(e,t)}},{key:"getIframeBridge",value:function(){return j.get(this.attributes,["iframeBridge"])}},{key:"setIframeBridge",value:function(e){if(j.isObject(e)){var t=this.getIframeBridge();for(var n in e){var r=e[n];t[n]!==r&&this.context.safeUpdateAttributes(["iframeBridge",n],r)}}}},{key:"attributes",get:function(){return this.context.getAttributes()}},{key:"focus",get:function(){return j.get(this.attributes,["focus"])}}]),e}())({getAttributes:function(){throw new Error("getAttributes not implemented")},safeSetAttributes:function(){throw new Error("safeSetAttributes not implemented")},safeUpdateAttributes:function(){throw new Error("safeUpdateAttributes not implemented")}}),tt=function(){for(var e,t=arguments.length,n=new Array(t),r=0;r0&&i.zIndex!==(null==(n=a.box)?void 0:n.zIndex)&&(null==(r=a.boxManager)||r.setZIndex(e,i.zIndex))}))})),null==(r=a.manager.refresher)||r.add("".concat(e,"-fullPath"),(function(){return B.autorun((function(){var e,t=null==(e=a.appAttributes)?void 0:e.fullPath;a.setFocusScenePathHandler(t),a._prevFullPath!==t&&(a.notifyPageStateChange(),a._prevFullPath=t)}))}))},this.setFocusScenePathHandler=j.debounce((function(e){var t;a.view&&e&&e!==(null==(t=a.view)?void 0:t.focusScenePath)&&we(a.view,e)}),50),this.notifyPageStateChange=j.debounce((function(){a.appEmitter.emit("pageStateChange",a.pageState)}),50),this.kind=t.kind,this.id=r,this.stateKey="".concat(this.id,"_state"),this.appProxies.set(this.id,this),this.appEmitter=new Q.default,this.appListener=this.makeAppEventListener(this.id),this.isAddApp=i,this.initScenes(),null!=(o=this.params.options)&&o.scenePath&&this.createView(),this._pageState=new Ke({displayer:this.manager.displayer,scenePath:this.scenePath,view:this.view,notifyPageStateChange:this.notifyPageStateChange})}var t,n,r,i,o,a,s,u;return x(e,[{key:"initScenes",value:function(){var e,t=this.params.options;t&&(this.scenePath=t.scenePath,(null==(e=this.appAttributes)?void 0:e.isDynamicPPT)&&this.scenePath?this.scenes=Se(this.manager.displayer)[this.scenePath]:this.scenes=t.scenes)}},{key:"getFullScenePath",value:function(){if(this.scenePath)return j.get(this.appAttributes,[$e.FullPath])||this.getFullScenePathFromScenes()}},{key:"getFullScenePathFromScenes",value:function(){var e=j.get(this.appAttributes,["state","SceneIndex"],0),t=function(e,t,n){var r;if(e&&t){var i=null==(r=Se(e)[t])?void 0:r[n];if(i)return"".concat(t,"/").concat(i.name)}}(this.manager.room,this.scenePath,e);return t&&this.setFullPath(t),t}},{key:"setFullPath",value:function(e){this.manager.safeUpdateAttributes(["apps",this.id,$e.FullPath],e)}},{key:"baseInsertApp",value:(u=g(regeneratorRuntime.mark((function e(){var t,n,r,i,o,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=a.length>0&&void 0!==a[0]&&a[0],(r=this.params).kind){e.next=4;break}throw new Error("[WindowManager]: kind require");case 4:return e.next=6,null==(n=xe.appClasses.get(r.kind))?void 0:n();case 6:if(i=e.sent,o=xe.registered.get(r.kind),!i){e.next=13;break}return e.next=11,this.setupApp(this.id,t,i,r.options,null==o?void 0:o.appOptions);case 11:e.next=14;break;case 13:throw new Error("[WindowManager]: app load failed ".concat(r.kind," ").concat(r.src));case 14:return e.abrupt("return",(ue.emit("updateManagerRect"),{appId:this.id,app:i}));case 15:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"setupApp",value:(s=g(regeneratorRuntime.mark((function e(t,n,r,i,o){var a,s,u=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(tt("setupApp",t,r,i),this.boxManager){e.next=2;break}throw new ze;case 2:s=new Je(this.manager,this.boxManager,t,this,o),this.appContext=s,e.prev=4,ue.once("".concat(t).concat(q.WindowCreated)).then(g(regeneratorRuntime.mark((function e(){var i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n||(o=u.getAppInitState(t),null==(i=u.boxManager)||i.updateBoxState(o)),u.appEmitter.onAny(u.appListener),u.appAttributesUpdateListener(t),u.setViewFocusScenePath(),setTimeout(g(regeneratorRuntime.mark((function e(){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("setup app",r),e.next=3,r.setup(s);case 3:n=e.sent,u.appResult=n,xe.notifyApp(u.kind,"created",{appId:t,result:n}),u.afterSetupApp(o),u.fixMobileSize();case 5:case"end":return e.stop()}}),e)}))),50);case 1:case"end":return e.stop()}}),e)})))),null==(a=this.boxManager)||a.createBox({appId:t,app:r,options:i,canOperate:this.manager.canOperate,smartPosition:this.isAddApp}),this.isAddApp&&this.box&&(this.store.updateAppState(t,$.ZIndex,this.box.zIndex),this.store.updateAppState(t,$.Size,{width:this.box.intrinsicWidth,height:this.box.intrinsicHeight}),this.boxManager.focusBox({appId:t},!1)),e.next=11;break;case 8:throw e.prev=8,e.t0=e.catch(4),console.error(e.t0),new Error("[WindowManager]: app setup error: ".concat(e.t0.message));case 11:case"end":return e.stop()}}),e,this,[[4,8]])}))),function(e,t,n,r,i){return s.apply(this,arguments)})},{key:"fixMobileSize",value:function(){var e,t,n=null==(e=this.boxManager)?void 0:e.getBox(this.id);n&&(null==(t=this.boxManager)||t.resizeBox({appId:this.id,width:n.intrinsicWidth+.001,height:n.intrinsicHeight+.001,skipUpdate:!0}))}},{key:"afterSetupApp",value:function(e){var t;e&&(null==e||!e.x||!e.y)&&(null==(t=this.boxManager)||t.setBoxInitState(this.id))}},{key:"onSeek",value:(a=g(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.appEmitter.emit("seek",t).catch((function(e){console.log("[WindowManager]: emit seek error: ".concat(e.message))})),r=this.getAppInitState(this.id),null==(n=this.boxManager)||n.updateBoxState(r);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"onReconnected",value:(o=g(regeneratorRuntime.mark((function t(){var n,r,i;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(Boolean(this.manager.attributes.apps[this.id])){t.next=4;break}return t.next=3,this.destroy(!0,!1,!0);case 3:return t.abrupt("return");case 4:return this.appEmitter.emit("reconnected",void 0),r=this.getAppInitState(this.id),t.next=8,this.destroy(!0,!1,!0);case 8:return i=this.params,t.next=11,new e(i,this.manager,this.id,this.isAddApp).baseInsertApp(!0);case 11:null==(n=this.boxManager)||n.updateBoxState(r);case 12:case"end":return t.stop()}}),t,this)}))),function(){return o.apply(this,arguments)})},{key:"onRemoveScene",value:(i=g(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.scenePath&&t.startsWith(this.scenePath+"/")&&(n=this.pageState.index,(r=this._pageState.getFullPath(n))||(n=0,r=this._pageState.getFullPath(n)),r&&this.setFullPath(r),this.setViewFocusScenePath(),this.view&&(this.view.focusSceneIndex=n));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"emitAppSceneStateChange",value:function(e){this.appEmitter.emit("sceneStateChange",e)}},{key:"emitAppIsWritableChange",value:function(){this.appEmitter.emit("writableChange",this.isWritable)}},{key:"makeAppEventListener",value:function(e){var t=this;return function(n,r){var i,o,a,s;if(t.manager.canOperate)switch(n){case"setBoxSize":null==(i=t.boxManager)||i.resizeBox({appId:e,width:r.width,height:r.height,skipUpdate:!1});break;case"setBoxMinSize":null==(o=t.boxManager)||o.setBoxMinSize({appId:e,minWidth:r.minwidth,minHeight:r.minheight});break;case"setBoxTitle":null==(a=t.boxManager)||a.setBoxTitle({appId:e,title:r.title});break;case ee.destroy:if("destroyed"===t.status)return;t.destroy(!0,!1,!0,null==r?void 0:r.error),null!=r&&r.error&&console.error(null==r?void 0:r.error);break;case"focus":null==(s=t.boxManager)||s.focusBox({appId:t.id}),rt.emit("focus",{appId:t.id})}}}},{key:"setScenePath",value:function(){if(this.manager.canOperate){var e=this.getFullScenePath();this.manager.room&&e&&this.view&&Te(this.manager.room,e)}}},{key:"setViewFocusScenePath",value:function(){var e=this.getFullScenePath();return e&&this.view&&we(this.view,e),e}},{key:"createView",value:(r=g(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.viewManager.createView(this.id);case 2:return t=e.sent,e.abrupt("return",(this.setViewFocusScenePath(),t));case 4:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"removeSceneByIndex",value:(n=g(regeneratorRuntime.mark((function e(t){var n,r,i=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=this._pageState.getFullPath(t))){e.next=6;break}return r=nt(t,this.pageState),e.abrupt("return",(this.setSceneIndexWithoutSync(r),this.manager.dispatchInternalEvent(q.SetAppFocusIndex,{type:"app",appID:this.id,index:r}),setTimeout((function(){Me(i.manager.room,n,t)}),100),!0));case 6:return e.abrupt("return",!1);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"setSceneIndexWithoutSync",value:function(e){this.view&&(this.view.focusSceneIndex=e)}},{key:"setSceneIndex",value:function(e){if(this.view){this.view.focusSceneIndex=e;var t=this._pageState.getFullPath(e);t&&this.setFullPath(t)}}},{key:"destroy",value:(t=g(regeneratorRuntime.mark((function e(t,n,r,i){var o,a,s,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("destroyed"===this.status){e.next=13;break}return this.status="destroyed",e.prev=2,e.next=5,xe.notifyApp(this.kind,"destroy",{appId:this.id});case 5:return e.next=7,this.appEmitter.emit("destroy",{error:i});case 7:e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),console.error("[WindowManager]: notifyApp error",e.t0.message,e.t0.stack);case 12:this.appEmitter.clearListeners(),ue.emit("destroy-".concat(this.id),{error:i}),t&&(null==(o=this.boxManager)||o.closeBox(this.id,r)),n&&(this.store.cleanAppAttributes(this.id),this.scenePath&&Me(this.manager.room,this.scenePath)),this.appProxies.delete(this.id),this._pageState.destroy(),this.viewManager.destroyView(this.id),this.manager.appStatus.delete(this.id),null==(a=this.manager.refresher)||a.remove(this.id),null==(s=this.manager.refresher)||s.remove(this.stateKey),null==(u=this.manager.refresher)||u.remove("".concat(this.id,"-fullPath")),this._prevFullPath=void 0;case 13:case"end":return e.stop()}}),e,this,[[2,9]])}))),function(e,n,r,i){return t.apply(this,arguments)})},{key:"close",value:function(){return this.destroy(!0,!0,!1)}},{key:"view",get:function(){return this.manager.viewManager.getView(this.id)}},{key:"viewIndex",get:function(){var e;return null==(e=this.view)?void 0:e.focusSceneIndex}},{key:"isWritable",get:function(){var e;return this.manager.canOperate&&!(null!=(e=this.box)&&e.readonly)}},{key:"attributes",get:function(){return this.manager.attributes[this.id]}},{key:"appAttributes",get:function(){return this.store.getAppAttributes(this.id)}},{key:"box",get:function(){var e;return null==(e=this.boxManager)?void 0:e.getBox(this.id)}},{key:"pageState",get:function(){return this._pageState.toObject()}}]),e}(),ot=function(){function e(t){y(this,e),this.displayer=t,this.views=new Map}return x(e,[{key:"createView",value:function(e){var t=at(this.displayer);return this.views.set(e,t),t}},{key:"getView",value:function(e){return this.views.get(e)}},{key:"destroyView",value:function(e){var t=this.views.get(e);if(t){try{t.release()}catch(e){}this.views.delete(e)}}},{key:"setViewScenePath",value:function(e,t){var n=this.views.get(e);n&&(n.focusScenePath=t)}},{key:"destroy",value:function(){this.views.forEach((function(e){try{e.release()}catch(e){}})),this.views.clear()}}]),e}(),at=function(e){var t=e.views.createView();return st(t),t},st=function(e){e.setCameraBound({maxContentMode:function(){return 10},minContentMode:function(){return.1}})},ut=function(){function e(t){var n=this;y(this,e),this.manager=t,this.started=!1,this.mainViewIsAddListener=!1,this.store=this.manager.store,this.viewMode=this.manager.windowManger.viewMode,this.sideEffectManager=new F.SideEffectManager,this.startListenWritableChange=function(){n.sideEffectManager.add((function(){return ue.on("writableChange",(function(e){e&&n.ensureCameraAndSize()}))}))},this.addCameraReaction=function(){var e;null==(e=n.manager.refresher)||e.add($e.MainViewCamera,n.cameraReaction)},this.cameraReaction=function(){return B.reaction((function(){return n.mainViewCamera}),(function(e){e&&e.id!==n.manager.uid&&(n.moveCameraToContian(n.mainViewSize),n.moveCamera(e))}),{fireImmediately:!0})},this.sizeChangeHandler=j.debounce((function(e){e&&(n.moveCameraToContian(e),n.moveCamera(n.mainViewCamera))}),30),this.onUpdateContainerSizeRatio=function(){var e=n.store.getMainViewSize();n.sizeChangeHandler(e)},this.onCameraUpdatedByDevice=function(e){n.viewMode!==B.ViewMode.Follower&&(n.store.setMainViewCamera(O(P({},e),{id:n.manager.uid})),j.isEqual(n.mainViewSize,O(P({},n.mainView.size),{id:n.manager.uid}))||n.setMainViewSize(n.view.size))},this.mainViewClickListener=function(){n.mainViewClickHandler()},this.setMainViewSize=j.debounce((function(e){n.store.setMainViewSize(O(P({},e),{id:n.manager.uid}))}),50),this._syncMainViewTimer=0,this.onCameraOrSizeUpdated=function(){ae.emit("cameraStateChange",n.cameraState),n.manager.room&&n.manager.room.syncMainView&&(clearTimeout(n._syncMainViewTimer),n._syncMainViewTimer=setTimeout(n.syncMainView,100,n.manager.room))},this.syncMainView=function(e){e.isWritable&&e.syncMainView(n.mainView)},this.setViewMode=function(e){n.viewMode=e},this.mainView=this.createMainView(),this.moveCameraSizeByAttributes(),ue.once("mainViewMounted").then((function(){n.addMainViewListener(),n.start(),n.ensureCameraAndSize(),n.startListenWritableChange()}));var r=function(){n.sizeChangeHandler(n.mainViewSize)};this.sideEffectManager.add((function(){return ue.on("playgroundSizeChange",r)})),this.sideEffectManager.add((function(){return ue.on("containerSizeRatioUpdate",n.onUpdateContainerSizeRatio)})),this.sideEffectManager.add((function(){return ue.on("startReconnect",(function(){n.didRelease||n.mainView.release()}))}))}var t;return x(e,[{key:"ensureCameraAndSize",value:function(){this.viewMode===B.ViewMode.Broadcaster&&(!this.mainViewCamera||!this.mainViewSize)&&(this.manager.dispatchInternalEvent(q.InitMainViewCamera),this.setCameraAndSize())}},{key:"moveCameraSizeByAttributes",value:function(){this.moveCameraToContian(this.mainViewSize),this.moveCamera(this.mainViewCamera)}},{key:"start",value:function(){this.sizeChangeHandler(this.mainViewSize),!this.started&&(this.addCameraListener(),this.addCameraReaction(),this.manager.room&&this.syncMainView(this.manager.room),this.started=!0)}},{key:"setCameraAndSize",value:function(){var e=O(P({},this.mainView.camera),{id:this.manager.uid}),t=O(P({},this.mainView.size),{id:this.manager.uid});this.store.setMainViewCameraAndSize(e,t)}},{key:"createMainView",value:function(){var e=at(this.manager.displayer),t=this.store.getMainViewScenePath();return t&&we(e,t),e}},{key:"onReconnect",value:function(){if(this.didRelease)this.rebind();else{var e=this.store.getMainViewScenePath();this.setFocusScenePath(e)}}},{key:"setFocusScenePath",value:function(e){if(e)return we(this.view,e)}},{key:"rebind",value:function(){var e=this.mainView.divElement,t=this.mainView.disableCameraTransform;this.stop(),this.didRelease||this.mainView.release(),this.removeMainViewListener(),this.mainView=this.createMainView(),this.mainView.disableCameraTransform=t,this.mainView.divElement=e,this.addMainViewListener(),this.start()}},{key:"addMainViewListener",value:function(){this.mainViewIsAddListener||this.view.divElement&&(this.view.divElement.addEventListener("click",this.mainViewClickListener),this.view.divElement.addEventListener("touchend",this.mainViewClickListener),this.mainViewIsAddListener=!0)}},{key:"removeMainViewListener",value:function(){this.view.divElement&&(this.view.divElement.removeEventListener("click",this.mainViewClickListener),this.view.divElement.removeEventListener("touchend",this.mainViewClickListener)),this.mainViewIsAddListener=!1}},{key:"mainViewClickHandler",value:(t=g(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:!this.manager.canOperate||(this.store.cleanFocus(),null==(t=this.manager.boxManager)||t.blurAllBox());case 1:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"addCameraListener",value:function(){this.view.callbacks.on("onCameraUpdatedByDevice",this.onCameraUpdatedByDevice),this.view.callbacks.on("onCameraUpdated",this.onCameraOrSizeUpdated),this.view.callbacks.on("onSizeUpdated",this.onCameraOrSizeUpdated)}},{key:"removeCameraListener",value:function(){this.view.callbacks.off("onCameraUpdatedByDevice",this.onCameraUpdatedByDevice),this.view.callbacks.off("onCameraUpdated",this.onCameraOrSizeUpdated),this.view.callbacks.off("onSizeUpdated",this.onCameraOrSizeUpdated)}},{key:"moveCameraToContian",value:function(e){j.isEmpty(e)||(this.view.moveCameraToContain({width:e.width,height:e.height,originX:-e.width/2,originY:-e.height/2,animationMode:B.AnimationMode.Immediately}),this.scale=this.view.camera.scale)}},{key:"moveCamera",value:function(e){if(!j.isEmpty(e)){if(j.isEqual(e,this.view.camera))return;var t=e.centerX,n=e.centerY,r=e.scale*(this.scale||1);this.view.moveCamera({centerX:t,centerY:n,scale:r,animationMode:B.AnimationMode.Immediately})}}},{key:"stop",value:function(){var e,t;this.removeCameraListener(),null==(e=this.manager.refresher)||e.remove($e.MainViewCamera),null==(t=this.manager.refresher)||t.remove($e.MainViewSize),this.started=!1}},{key:"destroy",value:function(){this.removeMainViewListener(),this.stop(),this.sideEffectManager.flushAll()}},{key:"mainViewCamera",get:function(){return this.store.getMainViewCamera()}},{key:"mainViewSize",get:function(){return this.store.getMainViewSize()}},{key:"didRelease",get:function(){return j.get(this.view,["didRelease"])}},{key:"view",get:function(){return this.mainView}},{key:"cameraState",get:function(){return P(P({},this.view.camera),this.view.size)}}]),e}(),lt=function(){function e(t){var n=this;y(this,e),this.context=t,this.addRedoUndoListeners=function(e){if(void 0===e)n.addViewCallbacks(n.context.mainView(),n.onCanRedoStepsUpdate,n.onCanUndoStepsUpdate);else{var t=n.context.getAppProxy(e);t&&t.view&&n.addViewCallbacks(t.view,n.onCanRedoStepsUpdate,n.onCanUndoStepsUpdate)}},this.addViewCallbacks=function(e,t,n){t(e.canRedoSteps),n(e.canUndoSteps),e.callbacks.on("onCanRedoStepsUpdate",t),e.callbacks.on("onCanUndoStepsUpdate",n)},this.disposeViewCallbacks=function(e){e.callbacks.off("onCanRedoStepsUpdate",n.onCanRedoStepsUpdate),e.callbacks.off("onCanUndoStepsUpdate",n.onCanUndoStepsUpdate)},this.onCanRedoStepsUpdate=function(e){ae.emit("canRedoStepsChange",e)},this.onCanUndoStepsUpdate=function(e){ae.emit("canUndoStepsChange",e)},this.disposePrevFocusViewRedoUndoListeners=function(e){var t;if(void 0===e)t=n.context.mainView();else{var r=n.context.getAppProxy(e);r&&r.view&&(t=r.view)}t&&n.disposeViewCallbacks(t)},ue.on("focusedChange",(function(e){n.disposePrevFocusViewRedoUndoListeners(e.prev),setTimeout((function(){n.addRedoUndoListeners(e.focused)}),0)})),ue.on("rootDirRemoved",(function(){n.disposePrevFocusViewRedoUndoListeners(t.focus()),n.addRedoUndoListeners(t.focus())})),this.addRedoUndoListeners(t.focus())}return x(e,[{key:"destroy",value:function(){this.disposePrevFocusViewRedoUndoListeners(this.context.focus())}}]),e}(),ct=function(){function e(t){var n=this;y(this,e),this.windowManger=t,this.appProxies=new Map,this.appStatus=new Map,this.store=et,this.isReplay=this.windowManger.isReplay,this.mainViewScenesLength=0,this.callbacksNode=null,this.appCreateQueue=new se,this.sideEffectManager=new F.SideEffectManager,this.sceneState=null,this.rootDirRemoving=!1,this.onRemoveScenes=function(){var e=g(regeneratorRuntime.mark((function e(t){var r,i,o,a,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((o=t.scenePath)!==ie){e.next=6;break}return e.next=4,n.onRootDirRemoved();case 4:return n.dispatchInternalEvent(q.RootDirRemoved),e.abrupt("return");case 6:if(!De(o)){e.next=14;break}return a=n.mainView.focusSceneIndex||0,(s=null==(r=n.callbacksNode)?void 0:r.scenes[a])||(a=0,s=null==(i=n.callbacksNode)?void 0:i.scenes[a]),s&&n.setMainViewScenePath("".concat(ie).concat(s)),e.next=12,n.setMainViewSceneIndex(a);case 12:e.next=15;break;case 14:n.appProxies.forEach((function(e){e.onRemoveScene(o)}));case 15:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.onReadonlyChanged=function(){n.appProxies.forEach((function(e){e.emitAppIsWritableChange()}))},this.onPlayerSeekStart=g(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.closeAll();case 2:case"end":return e.stop()}}),e)}))),this.onPlayerSeekDone=function(){var e=g(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.attributesUpdateCallback(n.attributes.apps);case 2:n.appProxies.forEach((function(e){e.onSeek(t)}));case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.createRootDirScenesCallback=function(){var e,t=!1;n.callbacksNode&&(n.callbacksNode.dispose(),t=!0),n.callbacksNode=n.displayer.createScenesCallback(ie,{onAddScene:n.onSceneChange,onRemoveScene:(e=g(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.onSceneChange(t);case 2:ue.emit("rootDirSceneRemoved",r);case 3:case"end":return e.stop()}}),e)}))),function(t,n){return e.apply(this,arguments)})}),n.callbacksNode&&(n.updateSceneState(n.callbacksNode),n.mainViewScenesLength=n.callbacksNode.scenes.length,t&&n.emitMainViewScenesChange(n.callbacksNode.scenes.length))},this.removeSceneByIndex=function(){var e=g(regeneratorRuntime.mark((function e(t){var r,i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=nt(t,n.windowManger.pageState),n.setSceneIndexWithoutSync(i),n.dispatchInternalEvent(q.SetAppFocusIndex,{type:"main",index:i}),o=null==(r=n.callbacksNode)?void 0:r.scenes[t],e.abrupt("return",(setTimeout((function(){o&&Me(n.room,"".concat(ie).concat(o),t)}),100),new Promise((function(e,t){ue.once("rootDirSceneRemoved").then((function(t){t===o&&e(!0)})).catch((function(e){console.log("[WindowManager]: removePage error: ".concat(e)),t(!1)}))}))));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.setSceneIndexWithoutSync=function(e){var t,r=null==(t=n.callbacksNode)?void 0:t.scenes[e];r&&n.mainViewProxy.setFocusScenePath("".concat(ie).concat(r))},this.onSceneChange=function(e){return n.mainViewScenesLength=e.scenes.length,n.updateSceneState(e),n.emitMainViewScenesChange(n.mainViewScenesLength)},this.emitMainViewScenesChange=function(e){return Promise.all([ae.emit("mainViewScenesLengthChange",e),ue.emit("changePageState")])},this.updateSceneState=function(e){var t=n.store.getMainViewSceneIndex()||0,r=e.scenes[t];r||(r=e.scenes[n.mainView.focusSceneIndex||0]),n.sceneState={scenePath:"".concat(ie).concat(r),contextPath:e.path,index:t,scenes:e.scenes.map((function(e){return{name:e}})),sceneName:r},ae.emit("sceneStateChange",n.sceneState)},this.onBoxMove=function(e){n.dispatchInternalEvent(q.AppMove,e),n.store.updateAppState(e.appId,$.Position,{x:e.x,y:e.y})},this.onBoxResize=function(e){e.width&&e.height&&(n.dispatchInternalEvent(q.AppResize,e),n.store.updateAppState(e.appId,$.Size,{width:e.width,height:e.height}))},this.onBoxFocus=function(e){n.windowManger.safeSetAttributes({focus:e.appId})},this.onBoxClose=function(e){var t=n.appProxies.get(e.appId);t&&t.destroy(!1,!0,!0,e.error)},this.onBoxStateChange=function(e){n.dispatchInternalEvent(q.AppBoxStateChange,e)},this.addAppsChangeListener=function(){var e;null==(e=n.refresher)||e.add("apps",(function(){return Ve((function(){return n.attributes.apps}),(function(){n.attributesUpdateCallback(n.attributes.apps)}))}))},this.addAppCloseListener=function(){var e;null==(e=n.refresher)||e.add("appsClose",(function(){return We(n.attributes.apps,(function(){n.onAppDelete(n.attributes.apps)}))}))},this.onMainViewIndexChange=function(e){void 0!==e&&n._prevSceneIndex!==e&&(ae.emit("mainViewSceneIndexChange",e),ue.emit("changePageState"),n.callbacksNode&&n.updateSceneState(n.callbacksNode),n._prevSceneIndex=e)},this.onFocusChange=function(e){var t;n._prevFocused!==e&&(ae.emit("focusedChange",e),ue.emit("focusedChange",{focused:e,prev:n._prevFocused}),n._prevFocused=e,void 0!==e&&(null==(t=n.boxManager)||t.focusBox({appId:e}),setTimeout((function(){var t=n.appProxies.get(e);t&&xe.notifyApp(t.kind,"focus",{appId:e})}),0)))},this.attributesUpdateCallback=j.debounce((function(e){return n._attributesUpdateCallback(e)}),100),this._appIds=[],this.onRegisteredChange=function(e){!e||Object.entries(e).forEach((function(e){var t=o(e,2),n=t[0],r=t[1];xe.appClasses.has(n)||xe.register({kind:n,src:r.src,name:r.name})}))},this.onMinimized=function(e){var t,r;(null==(t=n.boxManager)?void 0:t.minimized)!==e&&(!0===e&&(null==(r=n.boxManager)||r.blurAllBox()),setTimeout((function(){var t;null==(t=n.boxManager)||t.setMinimized(Boolean(e))}),0))},this.onAppDelete=function(){var e=g(regeneratorRuntime.mark((function e(t){var r,i,a,s,u,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=Object.keys(t),i=T(n.appProxies.entries()),e.prev=2,i.s();case 4:if((a=i.n()).done){e.next=12;break}if(s=o(a.value,2),u=s[0],l=s[1],e.t0=r.includes(u),e.t0){e.next=10;break}return e.next=10,l.destroy(!0,!1,!0);case 10:e.next=4;break;case 12:e.next=17;break;case 14:e.prev=14,e.t1=e.catch(2),i.e(e.t1);case 17:return e.prev=17,i.f(),e.finish(17);case 20:case"end":return e.stop()}}),e,null,[[2,14,17,20]])})));return function(t){return e.apply(this,arguments)}}(),this.closeAll=g(regeneratorRuntime.mark((function e(){var t,r,i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=T(n.appProxies.entries()),e.prev=1,t.s();case 3:if((r=t.n()).done){e.next=9;break}return i=o(r.value,2),i[0],a=i[1],e.next=7,a.destroy(!0,!1,!0);case 7:e.next=3;break;case 9:e.next=14;break;case 11:e.prev=11,e.t0=e.catch(1),t.e(e.t0);case 14:return e.prev=14,t.f(),e.finish(14);case 17:case"end":return e.stop()}}),e,null,[[1,11,14,17]])}))),this.displayerStateListener=function(e){var t=e.sceneState;if(t){var r=t.scenePath;n.appProxies.forEach((function(e){e.scenePath&&r.startsWith(e.scenePath)&&(e.emitAppSceneStateChange(t),e.setFullPath(r))}))}n.appProxies.forEach((function(t){t.appEmitter.emit("roomStateChange",e)})),ue.emit("observerIdChange",n.displayer.observerId)},this.displayerWritableListener=function(e){var t,r,i=!e,o=void 0===n.windowManger.readonly||!1===n.windowManger.readonly;void 0===n.windowManger.readonly?null==(t=n.boxManager)||t.setReadonly(e):null==(r=n.boxManager)||r.setReadonly(!(i&&o)),n.appProxies.forEach((function(e){e.emitAppIsWritableChange()})),ue.emit("writableChange",i)},this.updateSceneIndex=function(){var e=n.store.getMainViewScenePath(),t=Ie(e),r=Se(n.displayer)[t];if(r.length){var i=e.replace(t,"").replace("/",""),o=r.findIndex((function(e){return e.name===i}));j.isInteger(o)&&o>=0&&n.safeSetAttributes({_mainSceneIndex:o})}},this.updateRootDirRemoving=function(e){n.rootDirRemoving=e},this.displayer=t.displayer,this.store.setContext({getAttributes:function(){return n.attributes},safeSetAttributes:function(e){return n.safeSetAttributes(e)},safeUpdateAttributes:function(e,t){return n.safeUpdateAttributes(e,t)}}),this.mainViewProxy=new ut(this),this.viewManager=new ot(this.displayer),this.appListeners=new Pe(this),this.displayer.callbacks.on(this.eventName,this.displayerStateListener),this.appListeners.addListeners(),this.refresher=Ab,this.refresher.setRoom(this.room),this.refresher.setContext({emitter:ue}),this.sideEffectManager.add((function(){return function(){var e,t,r;n.appCreateQueue.destroy(),n.mainViewProxy.destroy(),null==(e=n.refresher)||e.destroy(),n.viewManager.destroy(),null==(t=n.boxManager)||t.destroy(),null==(r=n.callbacksNode)||r.dispose()}})),ue.once("onCreated").then((function(){return n.onCreated()})),ue.on("onReconnected",(function(){return n.onReconnected()})),B.isPlayer(this.displayer)&&(ue.on("seekStart",this.onPlayerSeekStart),ue.on("seek",this.onPlayerSeekDone)),ue.on("removeScenes",this.onRemoveScenes),ue.on("setReadonly",this.onReadonlyChanged),this.createRootDirScenesCallback(),xe.setSyncRegisterApp((function(e){n.safeUpdateAttributes([$e.Registered,e.kind],e)}))}var t,n,r,i,a,s,u,l,c,h,d;return x(e,[{key:"onRootDirRemoved",value:(d=g(regeneratorRuntime.mark((function e(){var t,n,r,i,a,s,u=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=!(u.length>0&&void 0!==u[0])||u[0],this.setMainViewScenePath(oe),this.createRootDirScenesCallback(),n=T(this.appProxies.entries()),e.prev=3,n.s();case 5:if((r=n.n()).done){e.next=13;break}if(i=o(r.value,2),a=i[0],s=i[1],e.t0=s.view,!e.t0){e.next=11;break}return e.next=11,this.closeApp(a,t);case 11:e.next=5;break;case 13:e.next=18;break;case 15:e.prev=15,e.t1=e.catch(3),n.e(e.t1);case 18:return e.prev=18,n.f(),e.finish(18);case 21:this.mainViewProxy.rebind(),ue.emit("rootDirRemoved"),this.updateRootDirRemoving(!1);case 22:case"end":return e.stop()}}),e,this,[[3,15,18,21]])}))),function(){return d.apply(this,arguments)})},{key:"getMainViewSceneDir",value:function(){var e=this.store.getMainViewScenePath();if(e)return Ie(e);throw new Error("[WindowManager]: mainViewSceneDir not found")}},{key:"onCreated",value:(h=g(regeneratorRuntime.mark((function e(){var t,n,r,i,o,a,s,u=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.attributesUpdateCallback(this.attributes.apps);case 2:if(ue.emit("updateManagerRect"),rt.on("move",this.onBoxMove),rt.on("resize",this.onBoxResize),rt.on("focus",this.onBoxFocus),rt.on("close",this.onBoxClose),rt.on("boxStateChange",this.onBoxStateChange),this.addAppsChangeListener(),this.addAppCloseListener(),null==(t=this.refresher)||t.add("maximized",(function(){return B.autorun((function(){var e,t=u.attributes.maximized;null==(e=u.boxManager)||e.setMaximized(Boolean(t))}))})),null==(n=this.refresher)||n.add("minimized",(function(){return B.autorun((function(){var e=u.attributes.minimized;u.onMinimized(e)}))})),null==(r=this.refresher)||r.add("mainViewIndex",(function(){return B.autorun((function(){var e=j.get(u.attributes,"_mainSceneIndex");u.onMainViewIndexChange(e)}))})),null==(i=this.refresher)||i.add("focusedChange",(function(){return B.autorun((function(){var e=j.get(u.attributes,"focus");u.onFocusChange(e)}))})),null==(o=this.refresher)||o.add("registeredChange",(function(){return B.autorun((function(){var e=j.get(u.attributes,$e.Registered);u.onRegisteredChange(e)}))})),this.attributes.apps&&0!==Object.keys(this.attributes.apps).length){e.next=20;break}if(s=this.store.getMainViewScenePath()){e.next=19;break}return e.abrupt("return");case 19:this.resetScenePath(s);case 20:this.displayerWritableListener(!(null!=(a=this.room)&&a.isWritable)),this.displayer.callbacks.on("onEnableWriteNowChanged",this.displayerWritableListener),this._prevFocused=this.attributes.focus,this.sideEffectManager.add((function(){var e=new lt({mainView:function(){return u.mainViewProxy.view},focus:function(){return u.attributes.focus},getAppProxy:function(e){return u.appProxies.get(e)}});return function(){return e.destroy()}}));case 21:case"end":return e.stop()}}),e,this)}))),function(){return h.apply(this,arguments)})},{key:"notifyAppsChange",value:function(e){(this._appIds.length!==e.length||!this._appIds.every((function(t){return e.includes(t)})))&&(this._appIds=e,ae.emit("appsChange",e))}},{key:"_attributesUpdateCallback",value:(c=g(regeneratorRuntime.mark((function e(t){var n,r,i,o,a,s=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t&&Cb.container){0===(n=Object.keys(t)).length&&this.appCreateQueue.emitReady(),r=j.orderBy(n.map((function(e){return{id:e,createdAt:t[e].createdAt}})),"createdAt","asc").map((function(e){return e.id})),this.notifyAppsChange(r),i=T(r);try{for(a=function(){var e=o.value;if(!s.appProxies.has(e)&&!s.appStatus.has(e)){var n=t[e];try{if(!s.attributes[e])throw new Error("appAttributes is undefined");s.appCreateQueue.push((function(){return s.appStatus.set(e,te.StartCreate),s.baseInsertApp({kind:n.kind,options:n.options,isDynamicPPT:n.isDynamicPPT},e,!1)})),s.focusByAttributes(t)}catch(e){console.warn("[WindowManager]: Insert App Error",e)}}},i.s();!(o=i.n()).done;)a()}catch(e){i.e(e)}finally{i.f()}}case 1:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"refresh",value:function(){this.attributesUpdateCallback(this.attributes.apps)}},{key:"setBoxManager",value:function(e){this.boxManager=e}},{key:"resetMaximized",value:function(){var e;null==(e=this.boxManager)||e.setMaximized(Boolean(this.store.getMaximized()))}},{key:"resetMinimized",value:function(){var e;null==(e=this.boxManager)||e.setMinimized(Boolean(this.store.getMinimized()))}},{key:"bindMainView",value:function(e,t){var n=this.mainViewProxy.view;n.disableCameraTransform=t,n.divElement=e,n.focusScenePath||this.setMainViewFocusPath(),ue.emit("mainViewMounted")}},{key:"setMainViewFocusPath",value:function(e){var t,n=e||this.store.getMainViewScenePath();if(n)return we(this.mainView,n),(null==(t=this.mainView)?void 0:t.focusScenePath)===n}},{key:"resetScenePath",value:function(e){this.displayer.state.sceneState.scenePath!==e&&Te(this.room,e)}},{key:"addApp",value:(l=g(regeneratorRuntime.mark((function e(t,n){var r,i,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return tt("addApp",t),e.next=3,this.beforeAddApp(t,n);case 3:return r=e.sent,i=r.appId,o=r.needFocus,e.next=8,this.baseInsertApp(t,i,!0,o);case 8:return a=e.sent,e.abrupt("return",(this.afterAddApp(a),null==a?void 0:a.id));case 10:case"end":return e.stop()}}),e,this)}))),function(e,t){return l.apply(this,arguments)})},{key:"beforeAddApp",value:(u=g(regeneratorRuntime.mark((function e(t,n){var r,i,o,a,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,_e(t.kind);case 2:return o=e.sent,this.appStatus.set(o,te.StartCreate),a=null!=(r=t.attributes)?r:{},this.safeUpdateAttributes([o],a),this.store.setupAppAttributes(t,o,n),s=!(null!=(i=this.boxManager)&&i.minimized),e.abrupt("return",(s&&this.store.setAppFocus(o,!0),{appId:o,needFocus:s}));case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return u.apply(this,arguments)})},{key:"afterAddApp",value:function(e){var t,n;if(e&&e.box){var r=e.box;rt.emit("move",{appId:e.id,x:null==r?void 0:r.intrinsicX,y:null==r?void 0:r.intrinsicY}),this.store.updateAppState(e.id,$.ZIndex,r.zIndex)}null!=(t=this.boxManager)&&t.minimized&&(null==(n=this.boxManager)||n.setMinimized(!1,!1))}},{key:"closeApp",value:(s=g(regeneratorRuntime.mark((function e(t){var n,r,i=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=!(i.length>1&&void 0!==i[1])||i[1],(r=this.appProxies.get(t))&&r.destroy(!0,n,!1);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"baseInsertApp",value:(a=g(regeneratorRuntime.mark((function e(t,n,r,i){var o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.appProxies.has(n)){e.next=3;break}return console.warn("[WindowManager]: app duplicate exists and cannot be created again"),e.abrupt("return");case 3:if(!(o=new it(t,this,n,r))){e.next=9;break}return e.next=7,o.baseInsertApp(i);case 7:return this.appStatus.delete(n),e.abrupt("return",o);case 9:throw this.appStatus.delete(n),new Error("[WindowManger]: initialize AppProxy failed");case 10:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return a.apply(this,arguments)})},{key:"safeSetAttributes",value:function(e){this.windowManger.safeSetAttributes(e)}},{key:"safeUpdateAttributes",value:function(e,t){this.windowManger.safeUpdateAttributes(e,t)}},{key:"setMainViewScenePath",value:(i=g(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.room){e.next=17;break}if(n=this.displayer.scenePathType(t),Ie(t)===ie){e.next=4;break}throw new Error('[WindowManager]: main view scenePath must in root dir "/"');case 4:if(n!==B.ScenePathType.None){e.next=6;break}throw new Error("[WindowManager]: ".concat(t," not valid scene"));case 6:if(n!==B.ScenePathType.Page){e.next=11;break}return e.next=9,this._setMainViewScenePath(t);case 9:e.next=17;break;case 11:if(n!==B.ScenePathType.Dir){e.next=17;break}if(r=Ee(this.displayer,t),e.t0=r,!e.t0){e.next=17;break}return e.next=17,this._setMainViewScenePath(r);case 17:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"_setMainViewScenePath",value:(r=g(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.setMainViewFocusPath(t)&&(this.safeSetAttributes({_mainScenePath:t}),this.store.setMainViewFocusPath(this.mainView),this.updateSceneIndex(),this.dispatchSetMainViewScenePath(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"setMainViewSceneIndex",value:(n=g(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.room){e.next=9;break}if(this.store.getMainViewSceneIndex()!==t){e.next=3;break}return e.abrupt("return");case 3:if(r=null==(n=this.callbacksNode)?void 0:n.scenes[t],i="".concat(ie).concat(r),!r){e.next=8;break}this.setMainViewFocusPath(i)&&(this.store.setMainViewScenePath(i),this.store.setMainViewSceneIndex(t),this.dispatchSetMainViewScenePath(i)),e.next=9;break;case 8:throw new Error("[WindowManager]: ".concat(t," not valid index"));case 9:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"dispatchSetMainViewScenePath",value:function(e){this.dispatchInternalEvent(q.SetMainViewScenePath,{nextScenePath:e}),ae.emit("mainViewScenePathChange",e),Te(this.room,e)}},{key:"getAppInitPath",value:function(e){var t,n=this.store.getAppAttributes(e);if(n)return null==(t=null==n?void 0:n.options)?void 0:t.scenePath}},{key:"safeDispatchMagixEvent",value:function(e,t){this.canOperate&&this.displayer.dispatchMagixEvent(e,t)}},{key:"focusByAttributes",value:function(e){var t;if(e&&Object.keys(e).length===(null==(t=this.boxManager)?void 0:t.boxSize)){var n=this.store.focus;n&&this.boxManager.focusBox({appId:n})}}},{key:"onReconnected",value:(t=g(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.attributesUpdateCallback(this.attributes.apps),t=Array.from(this.appProxies.values()).map((function(e){return e.onReconnected()})),this.mainViewProxy.onReconnect(),e.next=5,Promise.all(t);case 5:this.callbacksNode&&this.onSceneChange(this.callbacksNode);case 6:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"notifyContainerRectUpdate",value:function(e){this.appProxies.forEach((function(t){t.appEmitter.emit("containerRectUpdate",e)}))}},{key:"dispatchInternalEvent",value:function(e,t){this.safeDispatchMagixEvent(J,{eventName:e,payload:t})}},{key:"destroy",value:function(){this.displayer.callbacks.off(this.eventName,this.displayerStateListener),this.displayer.callbacks.off("onEnableWriteNowChanged",this.displayerWritableListener),this.appListeners.removeListeners(),rt.clearListeners(),ue.clearListeners(),this.appProxies.size&&this.appProxies.forEach((function(e){e.destroy(!0,!1,!0)})),ae.clearListeners(),this.sideEffectManager.flushAll(),this._prevFocused=void 0,this._prevSceneIndex=void 0}},{key:"eventName",get:function(){return B.isRoom(this.displayer)?"onRoomStateChanged":"onPlayerStateChanged"}},{key:"attributes",get:function(){return this.windowManger.attributes}},{key:"canOperate",get:function(){return this.windowManger.canOperate}},{key:"room",get:function(){return B.isRoom(this.displayer)?this.displayer:void 0}},{key:"mainView",get:function(){return this.mainViewProxy.view}},{key:"focusApp",get:function(){if(this.store.focus)return this.appProxies.get(this.store.focus)}},{key:"uid",get:function(){var e;return(null==(e=this.room)?void 0:e.uid)||""}}]),e}(),ht=function(){if(Ne(B.WhiteVersion)Cb.containerSizeRatio?(i=r*Cb.containerSizeRatio,t.classList.toggle("netless-window-manager-sizer-horizontal",!0)):(r=i/Cb.containerSizeRatio,t.classList.toggle("netless-window-manager-sizer-horizontal",!1)),n.style.width="".concat(r,"px"),n.style.height="".concat(i,"px"))}},{key:"disconnect",value:function(){var e;null==(e=this.containerResizeObserver)||e.disconnect(),j.isFunction(this.disposer)&&(this.disposer(),this.disposer=void 0)}}],[{key:"create",value:function(t,n,r,i){var o=new e(i);return o.observePlaygroundSize(t,n,r),o}}]),e}(),mt={exports:{}},gt={},yt=Object.getOwnPropertySymbols,bt=Object.prototype.hasOwnProperty,xt=Object.prototype.propertyIsEnumerable;function _t(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var wt=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,r,i=_t(e),o=1;o0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function U(){for(var e=[],t=0;t2&&ie("box");var n=q(t);return new Ae(e,J(n),n.name,!0,n.equals)},shallowBox:function(e,t){return arguments.length>2&&ie("shallowBox"),re.box(e,{name:t,deep:!1})},array:function(e,t){arguments.length>2&&ie("array");var n=q(t);return new Et(e,J(n),n.name)},shallowArray:function(e,t){return arguments.length>2&&ie("shallowArray"),re.array(e,{name:t,deep:!1})},map:function(e,t){arguments.length>2&&ie("map");var n=q(t);return new Pt(e,J(n),n.name)},shallowMap:function(e,t){return arguments.length>2&&ie("shallowMap"),re.map(e,{name:t,deep:!1})},set:function(e,t){arguments.length>2&&ie("set");var n=q(t);return new jt(e,J(n),n.name)},object:function(e,t,n){"string"==typeof arguments[1]&&ie("object");var r=q(n);return ot({},e,t,r)},shallowObject:function(e,t){return"string"==typeof arguments[1]&&ie("shallowObject"),re.object(e,{},{name:t,deep:!1})},ref:ee,shallow:$,deep:K,struct:te},re=function e(t,n,r){if("string"==typeof arguments[1])return K.apply(null,arguments);if(ut(t))return t;var i=v(t)?e.object(t,n,r):Array.isArray(t)?e.array(t,n):b(t)?e.map(t,n):x(t)?e.set(t,n):t;if(i!==t)return i;c(!1)};function ie(e){c("Expected one or two arguments to observable."+e+". Did you accidentally try to use observable."+e+" as decorator?")}Object.keys(ne).forEach((function(e){return re[e]=ne[e]}));var oe,ae,se=V(!1,(function(e,t,n,r,i){var o=n.get,a=n.set,s=i[0]||{};!function(e,t,n){var r=Ft(e);n.name=r.name+"."+t,n.context=e,r.values[t]=new Ie(n),Object.defineProperty(e,t,function(e){return Gt[e]||(Gt[e]={configurable:De.computedConfigurable,enumerable:!1,get:function(){return Ht(this).read(this,e)},set:function(t){Ht(this).write(this,e,t)}})}(t))}(e,t,j({get:o,set:a},s))}));se({equals:O.structural}),function(e){e[e.NOT_TRACKING=-1]="NOT_TRACKING",e[e.UP_TO_DATE=0]="UP_TO_DATE",e[e.POSSIBLY_STALE=1]="POSSIBLY_STALE",e[e.STALE=2]="STALE"}(oe||(oe={})),function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"}(ae||(ae={}));var ue=function(e){this.cause=e};function le(e){return e instanceof ue}function ce(e){switch(e.dependenciesState){case oe.UP_TO_DATE:return!1;case oe.NOT_TRACKING:case oe.STALE:return!0;case oe.POSSIBLY_STALE:for(var t=ge(!0),n=ve(),r=e.observing,i=r.length,o=0;o0;De.computationDepth>0&&t&&c(!1),De.allowStateChanges||!t&&"strict"!==De.enforceActions||c(!1)}function de(e,t,n){var r=ge(!0);be(e),e.newObserving=new Array(e.observing.length+100),e.unboundDepsCount=0,e.runId=++De.runId;var i,o=De.trackingDerivation;if(De.trackingDerivation=e,!0===De.disableErrorBoundaries)i=t.call(n);else try{i=t.call(n)}catch(e){i=new ue(e)}return De.trackingDerivation=o,function(e){for(var t=e.observing,n=e.observing=e.newObserving,r=oe.UP_TO_DATE,i=0,o=e.unboundDepsCount,a=0;ar&&(r=s.dependenciesState);for(n.length=i,e.newObserving=null,o=t.length;o--;)0===(s=t[o]).diffValue&&Oe(s,e),s.diffValue=0;for(;i--;){var s;1===(s=n[i]).diffValue&&(s.diffValue=0,Pe(s,e))}r!==oe.UP_TO_DATE&&(e.dependenciesState=r,e.onBecomeStale())}(e),e.observing.length,ye(r),i}function fe(e){var t=e.observing;e.observing=[];for(var n=t.length;n--;)Oe(t[n],e);e.dependenciesState=oe.NOT_TRACKING}function pe(e){var t=ve(),n=e();return me(t),n}function ve(){var e=De.trackingDerivation;return De.trackingDerivation=null,e}function me(e){De.trackingDerivation=e}function ge(e){var t=De.allowStateReads;return De.allowStateReads=e,t}function ye(e){De.allowStateReads=e}function be(e){if(e.dependenciesState!==oe.UP_TO_DATE){e.dependenciesState=oe.UP_TO_DATE;for(var t=e.observing,n=t.length;n--;)t[n].lowestObserverState=oe.UP_TO_DATE}}var xe=0,_e=1,we=Object.getOwnPropertyDescriptor((function(){}),"name");function Te(e,t){var n=function(){return Me(e,t,this,arguments)};return n.isMobxAction=!0,n}function Me(e,t,n,r){var i=function(e,t,n){var r=Ve()&&!!e,i=0;if(r){i=Date.now();var o=n&&n.length||0,a=new Array(o);if(o>0)for(var s=0;s0&&!e.__mobxGlobals&&(ke=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new Ne).version&&(ke=!1),ke?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new Ne):(setTimeout((function(){c("There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`")}),1),new Ne)}();function Pe(e,t){var n=e.observers.length;n&&(e.observersIndexes[t.__mapid]=n),e.observers[n]=t,e.lowestObserverState>t.dependenciesState&&(e.lowestObserverState=t.dependenciesState)}function Oe(e,t){if(1===e.observers.length)e.observers.length=0,Re(e);else{var n=e.observers,r=e.observersIndexes,i=n.pop();if(i!==t){var o=r[t.__mapid]||0;o?r[i.__mapid]=o:delete r[i.__mapid],n[o]=i}delete r[t.__mapid]}}function Re(e){!1===e.isPendingUnobservation&&(e.isPendingUnobservation=!0,De.pendingUnobservations.push(e))}function Le(){De.inBatch++}function je(){if(0==--De.inBatch){ze();for(var e=De.pendingUnobservations,t=0;t0&&Re(e),!1)}function Ue(e,t){if(console.log("[mobx.trace] '"+e.name+"' is invalidated due to a change in: '"+t.name+"'"),e.isTracing===ae.BREAK){var n=[];!function e(t,n,r){n.length>=1e3?n.push("(and many more)"):(n.push(""+new Array(r).join("\t")+t.name),t.dependencies&&t.dependencies.forEach((function(t){return e(t,n,r+1)})))}((r=e,at(Yt(r,void 0))),n,1),new Function("debugger;\n/*\nTracing '"+e.name+"'\n\nYou are entering this break point because derivation '"+e.name+"' is being traced and '"+t.name+"' is now forcing it to update.\nJust follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update\nThe stackframe you are looking for is at least ~6-8 stack-frames up.\n\n"+(e instanceof Ie?e.derivation.toString().replace(/[*]\//g,"/"):"")+"\n\nThe dependencies for this derivation are:\n\n"+n.join("\n")+"\n*/\n ")()}var r}var Fe=function(){function e(e,t,n,r){void 0===e&&(e="Reaction@"+l()),void 0===r&&(r=!1),this.name=e,this.onInvalidate=t,this.errorHandler=n,this.requiresObservable=r,this.observing=[],this.newObserving=[],this.dependenciesState=oe.NOT_TRACKING,this.diffValue=0,this.runId=0,this.unboundDepsCount=0,this.__mapid="#"+l(),this.isDisposed=!1,this._isScheduled=!1,this._isTrackPending=!1,this._isRunning=!1,this.isTracing=ae.NONE}return e.prototype.onBecomeStale=function(){this.schedule()},e.prototype.schedule=function(){this._isScheduled||(this._isScheduled=!0,De.pendingReactions.push(this),ze())},e.prototype.isScheduled=function(){return this._isScheduled},e.prototype.runReaction=function(){if(!this.isDisposed){if(Le(),this._isScheduled=!1,ce(this)){this._isTrackPending=!0;try{this.onInvalidate(),this._isTrackPending&&Ve()&&We({name:this.name,type:"scheduled-reaction"})}catch(e){this.reportExceptionInDerivation(e)}}je()}},e.prototype.track=function(e){Le();var t,n=Ve();n&&(t=Date.now(),Ye({name:this.name,type:"reaction"})),this._isRunning=!0;var r=de(this,e,void 0);this._isRunning=!1,this._isTrackPending=!1,this.isDisposed&&fe(this),le(r)&&this.reportExceptionInDerivation(r.cause),n&&Qe({time:Date.now()-t}),je()},e.prototype.reportExceptionInDerivation=function(e){var t=this;if(this.errorHandler)this.errorHandler(e,this);else{if(De.disableErrorBoundaries)throw e;var n="[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this+"'";De.suppressReactionErrors?console.warn("[mobx] (error in reaction '"+this.name+"' suppressed, fix error of causing action below)"):console.error(n,e),Ve()&&We({type:"error",name:this.name,message:n,error:""+e}),De.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},e.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._isRunning||(Le(),fe(this),je()))},e.prototype.getDisposer=function(){var e=this.dispose.bind(this);return e.$mobx=this,e},e.prototype.toString=function(){return"Reaction["+this.name+"]"},e.prototype.trace=function(e){void 0===e&&(e=!1),function(){for(var e=[],t=0;t0||De.isRunningReactions||function(e){e()}(Ge)}function Ge(){De.isRunningReactions=!0;for(var e=De.pendingReactions,t=0;e.length>0;){100==++t&&(console.error("Reaction doesn't converge to a stable state after 100 iterations. Probably there is a cycle in the reactive function: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",e):2===arguments.length&&"function"==typeof t?Te(e,t):1===arguments.length&&"string"==typeof e?qe(e):!0!==r?qe(t).apply(null,arguments):void(e[t]=Te(e.name||t,n.value))};function $e(e,t,n){m(e,t,Te(t,n.bind(e)))}Ke.bound=function(e,t,n,r){return!0===r?($e(e,t,n.value),null):n?{configurable:!0,enumerable:!1,get:function(){return $e(this,t,n.value||n.initializer.call(this)),this[t]},set:Ze}:{enumerable:!1,configurable:!0,set:function(e){$e(this,t,e)},get:function(){}}};var et=function(e){return e()};function tt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:et}function nt(e,t,n){void 0===n&&(n=a),"boolean"==typeof n&&(n={fireImmediately:n});var r,i,o,s=n.name||"Reaction@"+l(),u=Ke(s,n.onError?(r=n.onError,i=t,function(){try{return i.apply(this,arguments)}catch(e){r.call(this,e)}}):t),c=!n.scheduler&&!n.delay,h=tt(n),d=!0,f=!1,p=n.compareStructural?O.structural:n.equals||O.default,v=new Fe(s,(function(){d||c?m():f||(f=!0,h(m))}),n.onError,n.requiresObservable);function m(){if(f=!1,!v.isDisposed){var t=!1;v.track((function(){var n=e(v);t=d||!p(o,n),o=n})),d&&n.fireImmediately&&u(o,v),d||!0!==t||u(o,v),d&&(d=!1)}}return v.schedule(),v.getDisposer()}function rt(e,t,n){return it("onBecomeUnobserved",e,t,n)}function it(e,t,n,r){var i="function"==typeof r?Yt(t,n):Yt(t),o="function"==typeof r?r:n,a=i[e];return"function"!=typeof a?c(!1):(i[e]=function(){a.call(this),o.call(this)},function(){i[e]=a})}function ot(e,t,n,r){var i=(r=q(r)).defaultDecorator||(!1===r.deep?ee:K);H(e),Ft(e,r.name,i.enhancer),Le();try{for(var o=Object.getOwnPropertyNames(t),a=0,s=o.length;a0&&(r.dependencies=(t=e.observing,n=[],t.forEach((function(e){-1===n.indexOf(e)&&n.push(e)})),n).map(at)),r}function st(e,t){if(null==e)return!1;if(void 0!==t){if(Wt(e)){var n=e.$mobx;return n.values&&!!n.values[t]}return!1}return Wt(e)||!!e.$mobx||k(e)||He(e)||Ce(e)}function ut(e){return 1!==arguments.length&&c(!1),st(e)}function lt(e){switch(e.length){case 0:return De.trackingDerivation;case 1:return Yt(e[0]);case 2:return Yt(e[0],e[1])}}function ct(e,t){void 0===t&&(t=void 0),Le();try{return e.apply(t)}finally{je()}}function ht(e){return void 0!==e.interceptors&&e.interceptors.length>0}function dt(e,t){var n=e.interceptors||(e.interceptors=[]);return n.push(t),d((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ft(e,t){var n=ve();try{var r=e.interceptors;if(r)for(var i=0,o=r.length;i0}function vt(e,t){var n=e.changeListeners||(e.changeListeners=[]);return n.push(t),d((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function mt(e,t){var n=ve(),r=e.changeListeners;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},e.prototype.intercept=function(e){return dt(this,e)},e.prototype.observe=function(e,t){return void 0===t&&(t=!1),t&&e({object:this.array,type:"splice",index:0,added:this.values.slice(),addedCount:this.values.length,removed:[],removedCount:0}),vt(this,e)},e.prototype.getArrayLength=function(){return this.atom.reportObserved(),this.values.length},e.prototype.setArrayLength=function(e){if("number"!=typeof e||e<0)throw new Error("[mobx.array] Out of range: "+e);var t=this.values.length;if(e!==t)if(e>t){for(var n=new Array(e-t),r=0;r0&&e+t+1>wt&&Ct(e+t+1)},e.prototype.spliceWithArray=function(e,t,n){var r=this;he(this.atom);var i=this.values.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=o),ht(this)){var a=ft(this,{object:this.array,type:"splice",index:e,removedCount:t,added:n});if(!a)return o;t=a.removedCount,n=a.added}var s=(n=0===n.length?n:n.map((function(e){return r.enhancer(e,void 0)}))).length-t;this.updateArrayLength(i,s);var u=this.spliceItemsIntoValues(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice(e,n,u),this.dehanceValues(u)},e.prototype.spliceItemsIntoValues=function(e,t,n){var r;if(n.length<1e4)return(r=this.values).splice.apply(r,U([e,t],n));var i=this.values.slice(e,e+t);return this.values=this.values.slice(0,e).concat(n,this.values.slice(e+t)),i},e.prototype.notifyArrayChildUpdate=function(e,t,n){var r=!this.owned&&Ve(),i=pt(this),o=i||r?{object:this.array,type:"update",index:e,newValue:t,oldValue:n}:null;r&&Ye(j(j({},o),{name:this.atom.name})),this.atom.reportChanged(),i&&mt(this,o),r&&Qe()},e.prototype.notifyArraySplice=function(e,t,n){var r=!this.owned&&Ve(),i=pt(this),o=i||r?{object:this.array,type:"splice",index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;r&&Ye(j(j({},o),{name:this.atom.name})),this.atom.reportChanged(),i&&mt(this,o),r&&Qe()},e}(),Et=function(e){function t(t,n,r,i){void 0===r&&(r="ObservableArray@"+l()),void 0===i&&(i=!1);var o=e.call(this)||this,a=new Mt(r,n,o,i);if(g(o,"$mobx",a),t&&t.length){var s=Ee(!0);o.spliceWithArray(0,0,t),Se(s)}return _t&&Object.defineProperty(a.array,"0",St),o}return L(t,e),t.prototype.intercept=function(e){return this.$mobx.intercept(e)},t.prototype.observe=function(e,t){return void 0===t&&(t=!1),this.$mobx.observe(e,t)},t.prototype.clear=function(){return this.splice(0)},t.prototype.concat=function(){for(var e=[],t=0;t-1&&(this.splice(t,1),!0)},t.prototype.move=function(e,t){function n(e){if(e<0)throw new Error("[mobx.array] Index out of bounds: "+e+" is negative");var t=this.$mobx.values.length;if(e>=t)throw new Error("[mobx.array] Index out of bounds: "+e+" is not smaller than "+t)}if(n.call(this,e),n.call(this,t),e!==t){var r,i=this.$mobx.values;r=e1)for(var n=1;n=2&&(this.player.currentTime=e)},e}(),d=(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),f=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},p=function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]1e3&&(n.lastSyncProgressTimestamp=r,n.selfUserInf&&n.selfUserInf.identity===i.host&&t.putAttributes({currentTime:e,play:n.playerState}))},n.handleNativePlayerState=function(e){return f(n,void 0,void 0,(function(){var t;return p(this,(function(n){switch(n.label){case 0:if(!e)return[3,7];if(!this.player.current)return[3,6];n.label=1;case 1:return n.trys.push([1,3,,6]),[4,this.player.current.play()];case 2:return n.sent(),[3,6];case 3:return""+(t=n.sent()).name!="NotAllowedError"&&""+t.name!="AbortError"?[3,5]:(this.setState({selfMute:!0}),[4,this.player.current.play()]);case 4:n.sent(),n.label=5;case 5:return[3,6];case 6:return[3,8];case 7:this.player.current&&this.player.current.pause(),n.label=8;case 8:return[2]}}))}))},n.handleSeekReaction=function(e,t){return f(n,void 0,void 0,(function(){return p(this,(function(n){return this.isHost()||this.player.current&&void 0!==t&&(this.player.current.currentTime=e+Date.now()/1e3-t),[2]}))}))},n.timeUpdate=function(){if(n.player.current){var e=n.player.current.currentTime;n.onTimeUpdate(e)}},n.detectVideoClickEnable=function(){var e=n.props.plugin;return e.context&&e.context.identity?e.context.identity!==i.host?"none":"auto":"none"},n.renderMuteBox=function(){var e=n.props.plugin;return e.context&&e.context.identity&&e.context.identity!==i.host&&n.state.selfMute?o.createElement("div",{className:"media-mute-box"},o.createElement("div",{onClick:function(){n.setState({selfMute:!1})},onTouchStart:function(){n.setState({selfMute:!1})},style:{pointerEvents:"auto"},className:"media-mute-box-inner"},o.createElement("img",{src:u,alt:"mute_icon"}),o.createElement("span",null,"unmute"))):null},n.handleRemove=function(){return f(n,void 0,void 0,(function(){var e;return p(this,(function(t){switch(t.label){case 0:return e=this.props.plugin,this.handleRemotePlayState(!1),[4,v(300)];case 1:return t.sent(),e.remove(),[2]}}))}))},n.renderDeleteBtn=function(){var e=n.props.plugin;return e.context&&e.context.identity&&e.context.identity===i.host?o.createElement("div",{style:{pointerEvents:"auto"},className:"plugin-audio-box-delete",onClick:n.handleRemove},o.createElement("img",{src:c,alt:"delete"})):null},n.renderNavigation=function(){return!0===n.props.plugin.attributes.isNavigationDisable?null:o.createElement("div",{className:"plugin-video-box-nav"},o.createElement("div",null,o.createElement("img",{style:{width:20,marginLeft:8},src:l,alt:"video_plugin"}),o.createElement("span",null,"Video Player")),n.renderDeleteBtn())},n.handleOnEnd=function(){return f(n,void 0,void 0,(function(){var e;return p(this,(function(t){switch(t.label){case 0:return e=this.props.plugin,this.player.current?this.selfUserInf?this.selfUserInf.identity!==i.host?[3,2]:(e.putAttributes({seek:0,seekTime:void 0,currentTime:0}),[4,v(500)]):[3,5]:[3,7];case 1:return t.sent(),this.player.current.load(),[3,4];case 2:return[4,v(1e3)];case 3:t.sent(),this.player.current.load(),t.label=4;case 4:return[3,7];case 5:return[4,v(1e3)];case 6:t.sent(),this.player.current.load(),t.label=7;case 7:return this.setState({isEnd:!0}),[2]}}))}))},n.handleOnLoadedMetadataCapture=function(){return f(n,void 0,void 0,(function(){var e,t;return p(this,(function(n){switch(n.label){case 0:return e=navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform),t=this.state.isEnd,e?[4,v(300)]:[3,2];case 1:n.sent(),this.handleFirstSeek(t),n.label=2;case 2:return[2]}}))}))},n.player=o.createRef(),n.reactionSeekDisposer=n.startSeekReaction(),n.reactionSeekTimeDisposer=n.startSeekTimeReaction(),n.reactionPlayDisposer=n.startPlayReaction(),n.reactionVolumeDisposer=n.startVolumeReaction(),n.reactionMuteDisposer=n.startMuteTimeReaction(),n.reactionSyncDisposer=n.startSyncReaction(),n.state={play:!1,seek:0,selfMute:!1,currentTime:0,mute:!1,volume:1,isEnd:!1},n}return d(t,e),t.prototype.componentDidMount=function(){return f(this,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return this.syncNode=new h(this.player.current),[4,this.handleStartCondition()];case 1:return e.sent(),[2]}}))}))},t.prototype.startPlayReaction=function(){var e=this,t=this.props.plugin;return Object(s.a)((function(){return t.attributes.play}),(function(t){return f(e,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return this.isHost()?[3,2]:[4,this.handleNativePlayerState(t)];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))}))},t.prototype.startSeekReaction=function(){var e=this,t=this.props.plugin;return Object(s.a)((function(){return t.attributes.seek}),(function(n){return f(e,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return[4,this.handleSeekReaction(n,t.attributes.seekTime)];case 1:return e.sent(),[2]}}))}))}))},t.prototype.startSyncReaction=function(){var e=this,t=this.props.plugin;return Object(s.a)((function(){return t.attributes.currentTime}),(function(t){return f(e,void 0,void 0,(function(){return p(this,(function(e){return this.isHost()||this.player.current&&Math.abs(t-this.player.current.currentTime)>2&&(this.player.current.currentTime=t),[2]}))}))}))},t.prototype.startSeekTimeReaction=function(){var e=this,t=this.props.plugin;return Object(s.a)((function(){return t.attributes.seekTime}),(function(n){return f(e,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return[4,this.handleSeekReaction(t.attributes.seek,n)];case 1:return e.sent(),[2]}}))}))}))},t.prototype.startVolumeReaction=function(){var e=this,t=this.props.plugin;return Object(s.a)((function(){return t.attributes.volume}),(function(t){e.isHost()||e.player.current&&(e.player.current.volume=t)}))},t.prototype.startMuteTimeReaction=function(){var e=this,t=this.props.plugin;return Object(s.a)((function(){return t.attributes.mute}),(function(t){e.isHost()||e.setState({mute:t})}))},t.prototype.componentWillUnmount=function(){this.reactionPlayDisposer(),this.reactionSeekDisposer(),this.reactionMuteDisposer(),this.reactionVolumeDisposer(),this.reactionSeekTimeDisposer(),this.reactionSyncDisposer(),this.player.current&&this.player.current.pause()},t.prototype.render=function(){var e=this.props,t=e.size,n=e.plugin,r=e.scale,i=this.state,a=i.mute,s=i.selfMute,u=0===r?1:r;return o.createElement("div",{className:"plugin-video-box",style:{width:t.width/u,height:t.height/u,transform:"scale("+u+")"}},this.renderNavigation(),o.createElement("div",{className:"plugin-video-box-body"},this.renderMuteBox(),o.createElement("div",{className:"white-plugin-video-box"},o.createElement("video",{"webkit-playsinline":"true",playsInline:!0,poster:n.attributes.poster,className:"white-plugin-video",src:n.attributes.pluginVideoUrl,ref:this.player,muted:a||s,style:{width:"100%",height:"100%",pointerEvents:this.detectVideoClickEnable(),outline:"none"},disablePictureInPicture:!0,onLoadedMetadataCapture:this.handleOnLoadedMetadataCapture,onEnded:this.handleOnEnd,controls:!0,controlsList:"nodownload nofullscreen",onTimeUpdate:this.timeUpdate,preload:"metadata"}))))},t}(o.Component),y=(m=function(e,t){return(m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}m(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),b=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},x=function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1] img {\n width: 20px;\n margin-left: 8px;\n}\n.white-video-plugin-nav-title {\n margin-left: 6px;\n font-size: 12px;\n font-weight: bold;\n flex-grow: 1;\n}\n.white-video-plugin-nav-delete {\n width: 22px;\n height: 22px;\n border: 0;\n background-color: #ff756e;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 50%;\n margin-right: 8px;\n cursor: pointer;\n opacity: 0.6;\n transition: opacity 0.2s ease;\n}\n.white-video-plugin-nav-delete > img {\n width: 14px;\n}\n.white-video-plugin-nav-delete:hover {\n opacity: 1;\n}\n.white-video-plugin-body {\n flex-grow: 1;\n background-color: #f2f4f5;\n display: flex;\n flex-flow: column nowrap;\n align-items: stretch;\n justify-content: center;\n height: calc(100% - 32px);\n}\n.white-video-plugin-body > audio {\n flex-grow: 1;\n outline: none;\n}\n",""]),e.exports=t},function(e,t,n){e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=function(e,t){var n,r,i,o=e[1]||"",a=e[3];if(!a)return o;if(t&&"function"==typeof btoa){var s=(n=a,r=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),i="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(r),"/*# ".concat(i," */")),u=a.sources.map((function(e){return"/*# sourceURL=".concat(a.sourceRoot||"").concat(e," */")}));return[o].concat(u).concat([s]).join("\n")}return[o].join("\n")}(t,e);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n,r){"string"==typeof e&&(e=[[null,e,""]]);var i={};if(r)for(var o=0;o0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&(d=Date.now(),this.props.player&&(d=this.props.player.beginTimestamp+r),f=l+(d-c)/1e3,Math.abs(n.currentTime-f)>2&&(n.currentTime=f)),this.changedMap.changed("rate",i)&&(n.playbackRate=i),[2]}}))}))}));this.disposers.push(r),this.disposers.push((function(){return e.changedMap.clear()}))},t.prototype.componentWillUnmount=function(){var e;null===(e=this.player.current)||void 0===e||e.pause(),this.disposers.forEach((function(e){return e()}))},Object.defineProperty(t.prototype,"containerStyle",{get:function(){var e=this.props,t=e.size,n=e.scale||1;return{width:t.width/n,height:t.height/n,transform:"scale("+n+")"}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pointerEventsStyle",{get:function(){return{pointerEvents:this.isHost()?"auto":"none"}},enumerable:!1,configurable:!0}),t.prototype.render=function(){var e=this.props,t=e.room,n=e.player,r=e.plugin;return t||n?i.a.createElement("div",{className:"white-video-plugin-container",style:this.containerStyle},!r.attributes.isNavigationDisable&&i.a.createElement("div",{className:"white-video-plugin-nav"},i.a.createElement("img",{src:s.a,alt:"video_plugin"}),i.a.createElement("span",{className:"white-video-plugin-nav-title"},"Video Player"),i.a.createElement("span",{className:"white-video-plugin-nav-delete",style:this.pointerEventsStyle,onClick:this.removeSelf},i.a.createElement("img",{src:l.a,alt:"delete_icon"}))),i.a.createElement("div",{className:"white-video-plugin-body"},i.a.createElement("video",{src:r.attributes.src,style:m({maxWidth:"100%",maxHeight:"100%"},this.pointerEventsStyle),controls:!!t,controlsList:"nodownload nofullscreen",preload:"metadata",ref:this.player,playsInline:!0,"webkit-playsinline":"true",poster:r.attributes.poster,disablePictureInPicture:!0}))):null},t}(r.Component);n.d(t,"videoPlugin2",(function(){return _}));var _=Object.freeze({kind:"video2",render:b,defaultAttributes:{src:"",hostTime:0,currentTime:0,paused:!0,muted:!1,volume:1},hitTest:function(e){var t=e.component.context.getMemberState();return!("eraser"===(null==t?void 0:t.currentApplianceName))}})}])},"object"==r(t)&&"object"==r(e)?e.exports=i(n(17328),n(71895)):n.amdD([,],i)},18371:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.playerStateNameSpace=t.playerNameSpace=t.sdkNameSpace=t.roomStateNamespace=t.roomNamespace=t.roomSyncNamespace=t.pptNamespace=t.ScaleMode=void 0,function(e){e[e.Scale=0]="Scale",e[e.AspectFit=1]="AspectFit",e[e.AspectFitScale=2]="AspectFitScale",e[e.AspectFitSpace=3]="AspectFitSpace",e[e.AspectFill=4]="AspectFill",e[e.AspectFillScale=5]="AspectFillScale"}(t.ScaleMode||(t.ScaleMode={})),t.pptNamespace="ppt",t.roomSyncNamespace="room.sync",t.roomNamespace="room",t.roomStateNamespace="room.state",t.sdkNameSpace="sdk",t.playerNameSpace="player",t.playerStateNameSpace="player.state"},46640:function(e,t,n){var r;function i(e,t,n){return i="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=v(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}},i(e,t,n||e)}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw o}}return n}(e,t)||M(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e){return function(e){if(Array.isArray(e))return E(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||M(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&p(e,t)}function u(e){var t=f();return function(){var n,r=v(e);if(t){var i=v(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return l(this,n)}}function l(e,t){return!t||"object"!==_(t)&&"function"!=typeof t?c(e):t}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h(e){var t="function"==typeof Map?new Map:void 0;return h=function(e){if(null===e||!function(e){return-1!==Function.toString.call(e).indexOf("[native code]")}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return d(e,arguments,v(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),p(n,e)},h(e)}function d(e,t,n){return d=f()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&p(i,n.prototype),i},d.apply(null,arguments)}function f(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function p(e,t){return p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},p(e,t)}function v(e){return v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},v(e)}function m(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function g(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){m(o,r,i,a,s,"next",e)}function s(e){m(o,r,i,a,s,"throw",e)}a(void 0)}))}}function y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function b(e,t){for(var n=0;n=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,i,o=!0,a=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){a=!0,i=e},f:function(){try{o||null==r.return||r.return()}finally{if(a)throw i}}}}function M(e,t){if(e){if("string"==typeof e)return E(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?E(e,t):void 0}}function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(this.timer=this.initInterval())}},{key:"invoke",value:function(){var e=this;if(0!==this.list.length&&void 0===this.currentInvoker){var t=this.list.shift();t&&(this.currentInvoker=t,t().then((function(){e.invoked()})).catch((function(t){console.error("[WindowManager]: create app error: ".concat(t.message)),e.invoked()})))}}},{key:"emitReady",value:function(){this.isEmit||setTimeout((function(){ae.emit("ready")}),50),this.isEmit=!0}},{key:"empty",value:function(){this.list=[],this.clear()}},{key:"destroy",value:function(){this.timer&&this.clear()}}]),e}(),ue=new Q.default,le=function(){var e=g(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new Promise((function(e,t){var n=indexedDB.open("__WindowManagerAppCache",2);n.onerror=function(e){t(e)},n.onupgradeneeded=function(e){var t=e.target.result;t.objectStoreNames.contains("apps")||t.createObjectStore("apps",{keyPath:"kind"}).createIndex("kind","kind",{unique:!0})},n.onsuccess=function(){var t=n.result;e(t)}}));case 2:Y=e.sent;case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ce=function(e,t){if(Y)return function(e,t){return new Promise((function(n,r){var i=e.transaction(["apps"],"readwrite").objectStore("apps").add(t);i.onsuccess=function(){return n()},i.onerror=function(){return r()}}))}(Y,{kind:e,sourceCode:t})},he=function(){var e=g(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Y){e.next=6;break}return e.next=3,de(Y,t);case 3:e.t0=e.sent,e.next=7;break;case 6:e.t0=null;case 7:return e.abrupt("return",e.t0);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();function de(e,t){return new Promise((function(n,r){var i=e.transaction(["apps"]).objectStore("apps").index("kind").get(t);i.onerror=function(e){return r(e)},i.onsuccess=function(){i.result?n(i.result):n(null)}}))}var fe=function(){var e=g(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,he(t);case 2:if(!(n=e.sent)){e.next=5;break}return e.abrupt("return",n.sourceCode);case 5:return e.next=7,ge(t,{timeout:1e4});case 7:return e.next=9,e.sent.text();case 9:return r=e.sent,e.next=12,ce(t,r);case 12:return e.abrupt("return",r);case 13:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),pe=function(e,t){var n=Function(e+"\n;return ".concat(t))();return void 0===n&&(n=window[t]),n},ve=function(){var e=g(regeneratorRuntime.mark((function e(t,n,r){var i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=r||"NetlessApp"+n,ae.emit("loadApp",{kind:n,status:"start"}),e.prev=2,e.next=5,fe(t);case 5:if((o=e.sent)&&0!==o.length){e.next=8;break}throw ae.emit("loadApp",{kind:n,status:"failed",reason:"script is empty."}),new Error("[WindowManager]: script is empty.");case 8:e.next=13;break;case 10:throw e.prev=10,e.t0=e.catch(2),ae.emit("loadApp",{kind:n,status:"failed",reason:e.t0.message}),e.t0;case 13:return e.abrupt("return",me(o,i,n));case 14:case"end":return e.stop()}}),e,null,[[2,10]])})));return function(t,n,r){return e.apply(this,arguments)}}(),me=function(e,t,n){try{var r=pe(e,t);return ae.emit("loadApp",{kind:n,status:"success"}),r}catch(r){if(r.message.includes("Can only have one anonymous define call per script file")){var i=window.define;"function"==typeof i&&i.amd&&delete i.amd;var o=pe(e,t);return ae.emit("loadApp",{kind:n,status:"success"}),o}throw ae.emit("loadApp",{kind:n,status:"failed",reason:r.message}),r}};function ge(e,t){return ye.apply(this,arguments)}function ye(){return ye=g(regeneratorRuntime.mark((function e(t,n){var r,i,o,a,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.timeout,i=void 0===r?1e4:r,o=new AbortController,a=setTimeout((function(){return o.abort()}),i),e.next=6,fetch(t,O(P({},n),{signal:o.signal,headers:{"content-type":"text/plain"}}));case 6:return s=e.sent,e.abrupt("return",(clearTimeout(a),s));case 8:case"end":return e.stop()}}),e)}))),ye.apply(this,arguments)}var be=function(){function e(){var t=this;y(this,e),this.kindEmitters=new Map,this.registered=new Map,this.appClassesCache=new Map,this.appClasses=new Map,this.syncRegisterApp=null,this.onSyncRegisterAppChange=function(e){t.register({kind:e.kind,src:e.src})}}var t,n;return x(e,[{key:"setSyncRegisterApp",value:function(e){this.syncRegisterApp=e}},{key:"register",value:(n=g(regeneratorRuntime.mark((function e(t){var n,r,i,o=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.appClassesCache.delete(t.kind),this.registered.set(t.kind,t),"string"==typeof(n=t.src)&&(r=function(){var e=g(regeneratorRuntime.mark((function e(){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ve(n,t.kind,t.name);case 2:return r=e.sent,e.abrupt("return",r.__esModule?r.default:r);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),this.syncRegisterApp&&this.syncRegisterApp({kind:t.kind,src:n,name:t.name})),"function"==typeof n&&(r=function(){var e=g(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n();case 2:if(!(t=e.sent)){e.next=5;break}return e.abrupt("return",((t.__esModule||t.default)&&(t=t.default),t));case 5:throw new Error("[WindowManager]: load remote script failed, ".concat(n));case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()),"object"==_(n)&&(r=function(){var e=g(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n);case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()),this.appClasses.set(t.kind,g(regeneratorRuntime.mark((function e(){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=o.appClassesCache.get(t.kind),e.abrupt("return",(n||(n=r(),o.appClassesCache.set(t.kind,n)),n));case 2:case"end":return e.stop()}}),e)})))),t.addHooks&&(i=this.createKindEmitter(t.kind))&&t.addHooks(i);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"unregister",value:function(e){this.appClasses.delete(e),this.appClassesCache.delete(e),this.registered.delete(e);var t=this.kindEmitters.get(e);t&&(t.clearListeners(),this.kindEmitters.delete(e))}},{key:"notifyApp",value:(t=g(regeneratorRuntime.mark((function e(t,n,r){var i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=this.kindEmitters.get(t),e.next=3,null==i?void 0:i.emit(n,r);case 3:case"end":return e.stop()}}),e,this)}))),function(e,n,r){return t.apply(this,arguments)})},{key:"createKindEmitter",value:function(e){if(!this.kindEmitters.has(e)){var t=new Q.default;this.kindEmitters.set(e,t)}return this.kindEmitters.get(e)}}]),e}(),xe=new be,_e=function(){var e=g(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null==(n=xe.appClasses.get(t))?void 0:n();case 2:return i=e.sent,e.abrupt("return",i&&(null==(r=i.config)?void 0:r.singleton)?t:"".concat(t,"-").concat(U.v4().replace("-","").slice(0,8)));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),we=function(e,t){if(e.focusScenePath!==t)return e.focusScenePath=t,e},Te=function(e,t){if(e&&e.isWritable&&e.state.sceneState.scenePath!==t){var n="/"===t?"":t;e.setScenePath(n)}},Me=function(e,t,n){e&&e.scenePathType(t)!==B.ScenePathType.None&&e.removeScenes(t,n)};j.debounce((function(e,t){e.emit("mainViewModeChange",t)}),200);var Ee=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=Se(e)[t];if(r){var i=r[n];if(i){var o=i.name;return t===ie?"/".concat(o):"".concat(t,"/").concat(o)}}},Se=function(e){return e.entireScenes()},Ae=function(e,t,n,r){for(var i,o=0;o0&&n.forEach((function(n){var r=e[n];if(r!==t._state[n])if(void 0===r)t._lastValue.set(n,t._state[n]),delete t._state[n],t._setRawState(n,r);else{t._lastValue.set(n,t._state[n]),t._state[n]=r;var i=r;if(j.isObject(r)){var o=t._refMap.get(r);o||(o=function(e){return{k:F.genUID(),v:e,__isRef:!0}}(r),t._refMap.set(r,o)),i=o}t._setRawState(n,i)}}))}else console.error(new Error('Cannot setState on Storage "'.concat(this.id,'" without writable access')),e)}},{key:"emptyStorage",value:function(){if(!(j.size(this._state)<=0)){if(this._destroyed)return void console.error(new Error('Cannot empty destroyed Storage "'.concat(this.id,'".')));if(!this._context.getIsWritable())return void console.error(new Error('Cannot empty Storage "'.concat(this.id,'" without writable access.')));this.setState(j.mapValues(this._state,j.noop))}}},{key:"deleteStorage",value:function(){if(null===this.id)throw new Error("Cannot delete main Storage");this._context.getIsWritable()?(this.destroy(),this._context.updateAttributes([Ze,this.id],void 0)):console.error(new Error('Cannot delete Storage "'.concat(this.id,'" without writable access.')))}},{key:"destroy",value:function(){this._destroyed=!0,this._sideEffect.flushAll()}},{key:"_getRawState",value:function(e){var t;return null===this.id?null!=(t=this._context.getAttributes())?t:e:j.get(this._context.getAttributes(),[Ze,this.id],e)}},{key:"_setRawState",value:function(e,t){if(null===this.id){if(e===Ze)throw new Error('Cannot set attribute internal filed "'.concat(Ze,'"'));return this._context.updateAttributes([e],t)}return this._context.updateAttributes([Ze,this.id,e],t)}},{key:"_updateProperties",value:function(e){var t;if(this._destroyed)console.error(new Error('Cannot call _updateProperties on destroyed Storage "'.concat(this.id,'".')));else if(e.length>0){for(var n={},r=0;rs.pageState.length-1?(console.warn("[WindowManager] nextPage: index out of range"),!1):(s.appProxy.setSceneIndex(t),!0));case 2:case"end":return e.stop()}}),e)}))),this.jumpPage=function(){var e=g(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",0<=t&&t=s.pageState.length?(console.warn("[WindowManager]: page index ".concat(t," out of range")),!1):s.appProxy.removeSceneByIndex(n));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.emitter=i.appEmitter,this.isAddApp=i.isAddApp}return x(e,[{key:"storage",get:function(){return this._storage||(this._storage=new qe(this)),this._storage}},{key:"pageState",get:function(){return this.appProxy.pageState}}]),e}(),Ke=function(){function e(t){var n=this;y(this,e),this.params=t,this.sceneNode=null,this.onSceneChange=function(e){n.sceneNode=e,n.params.notifyPageStateChange()};var r=this.params,i=r.displayer,o=r.scenePath;o&&(this.sceneNode=i.createScenesCallback(o,{onAddScene:this.onSceneChange,onRemoveScene:this.onSceneChange}))}return x(e,[{key:"getFullPath",value:function(e){var t,n=null==(t=this.sceneNode)?void 0:t.scenes;if(this.params.scenePath&&n){var r=n[e];if(r)return"".concat(this.params.scenePath,"/").concat(r)}}},{key:"toObject",value:function(){var e,t;return{index:(null==(e=this.params.view)?void 0:e.focusSceneIndex)||0,length:(null==(t=this.sceneNode)?void 0:t.scenes.length)||0}}},{key:"destroy",value:function(){var e;null==(e=this.sceneNode)||e.dispose()}}]),e}(),$e=function(e){return e.Apps="apps",e.Focus="focus",e.State="state",e.BoxState="boxState",e.MainViewCamera="mainViewCamera",e.MainViewSize="mainViewSize",e.Broadcaster="broadcaster",e.Cursors="cursors",e.Position="position",e.CursorState="cursorState",e.FullPath="fullPath",e.Registered="registered",e.IframeBridge="iframeBridge",e}($e||{}),et=new(function(){function e(t){var n=this;y(this,e),this.context=t,this.setAppFocus=function(e,t){t?n.context.safeSetAttributes({focus:e}):n.context.safeSetAttributes({focus:void 0})}}return x(e,[{key:"setContext",value:function(e){this.context=e}},{key:"apps",value:function(){return j.get(this.attributes,["apps"])}},{key:"getAppAttributes",value:function(e){return j.get(this.apps(),[e])}},{key:"getAppState",value:function(e){return j.get(this.apps(),[e,"state"])}},{key:"getMaximized",value:function(){return j.get(this.attributes,["maximized"])}},{key:"getMinimized",value:function(){return j.get(this.attributes,["minimized"])}},{key:"setupAppAttributes",value:function(e,t,n){var r;this.attributes.apps||this.context.safeSetAttributes({apps:{}});var i=["scenePath","title"];n||i.push("scenes");var o=j.pick(e.options,i),a={kind:e.kind,options:o,isDynamicPPT:n};"string"==typeof e.src&&(a.src=e.src),a.createdAt=Date.now(),this.context.safeUpdateAttributes(["apps",t],a),this.context.safeUpdateAttributes(["apps",t,"state"],(w(r={},$.Size,{}),w(r,$.Position,{}),w(r,$.SceneIndex,0),r))}},{key:"updateAppState",value:function(e,t,n){j.get(this.attributes,["apps",e,"state"])&&this.context.safeUpdateAttributes(["apps",e,"state",t],n)}},{key:"cleanAppAttributes",value:function(e){this.context.safeUpdateAttributes(["apps",e],void 0),this.context.safeSetAttributes(w({},e,void 0)),this.attributes.focus===e&&this.cleanFocus()}},{key:"cleanFocus",value:function(){this.context.safeSetAttributes({focus:void 0})}},{key:"getAppSceneIndex",value:function(e){var t;return null==(t=this.getAppState(e))?void 0:t[$.SceneIndex]}},{key:"getAppScenePath",value:function(e){var t,n;return null==(n=null==(t=this.getAppAttributes(e))?void 0:t.options)?void 0:n.scenePath}},{key:"getMainViewScenePath",value:function(){return this.attributes._mainScenePath}},{key:"getMainViewSceneIndex",value:function(){return this.attributes._mainSceneIndex}},{key:"getBoxState",value:function(){return this.attributes.boxState}},{key:"setMainViewScenePath",value:function(e){this.context.safeSetAttributes({_mainScenePath:e})}},{key:"setMainViewSceneIndex",value:function(e){this.context.safeSetAttributes({_mainSceneIndex:e})}},{key:"getMainViewCamera",value:function(){return j.get(this.attributes,["mainViewCamera"])}},{key:"getMainViewSize",value:function(){return j.get(this.attributes,["mainViewSize"])}},{key:"setMainViewCamera",value:function(e){this.context.safeSetAttributes({mainViewCamera:P({},e)})}},{key:"setMainViewSize",value:function(e){this.context.safeSetAttributes({mainViewSize:P({},e)})}},{key:"setMainViewCameraAndSize",value:function(e,t){this.context.safeSetAttributes({mainViewCamera:P({},e),mainViewSize:P({},t)})}},{key:"updateCursor",value:function(e,t){j.get(this.attributes,["cursors"])||this.context.safeUpdateAttributes(["cursors"],{}),j.get(this.attributes,["cursors",e])||this.context.safeUpdateAttributes(["cursors",e],{}),this.context.safeUpdateAttributes(["cursors",e,"position"],t)}},{key:"updateCursorState",value:function(e,t){j.get(this.attributes,["cursors",e])||this.context.safeUpdateAttributes(["cursors",e],{}),this.context.safeUpdateAttributes(["cursors",e,"cursorState"],t)}},{key:"getCursorState",value:function(e){return j.get(this.attributes,["cursors",e,"cursorState"])}},{key:"cleanCursor",value:function(e){this.context.safeUpdateAttributes(["cursors",e],void 0)}},{key:"setMainViewFocusPath",value:function(e){var t=this.getMainViewScenePath();t&&we(e,t)}},{key:"getIframeBridge",value:function(){return j.get(this.attributes,["iframeBridge"])}},{key:"setIframeBridge",value:function(e){if(j.isObject(e)){var t=this.getIframeBridge();for(var n in e){var r=e[n];t[n]!==r&&this.context.safeUpdateAttributes(["iframeBridge",n],r)}}}},{key:"attributes",get:function(){return this.context.getAttributes()}},{key:"focus",get:function(){return j.get(this.attributes,["focus"])}}]),e}())({getAttributes:function(){throw new Error("getAttributes not implemented")},safeSetAttributes:function(){throw new Error("safeSetAttributes not implemented")},safeUpdateAttributes:function(){throw new Error("safeUpdateAttributes not implemented")}}),tt=function(){for(var e,t=arguments.length,n=new Array(t),r=0;r0&&i.zIndex!==(null==(n=a.box)?void 0:n.zIndex)&&(null==(r=a.boxManager)||r.setZIndex(e,i.zIndex))}))})),null==(r=a.manager.refresher)||r.add("".concat(e,"-fullPath"),(function(){return B.autorun((function(){var e,t=null==(e=a.appAttributes)?void 0:e.fullPath;a.setFocusScenePathHandler(t),a._prevFullPath!==t&&(a.notifyPageStateChange(),a._prevFullPath=t)}))}))},this.setFocusScenePathHandler=j.debounce((function(e){var t;a.view&&e&&e!==(null==(t=a.view)?void 0:t.focusScenePath)&&we(a.view,e)}),50),this.notifyPageStateChange=j.debounce((function(){a.appEmitter.emit("pageStateChange",a.pageState)}),50),this.kind=t.kind,this.id=r,this.stateKey="".concat(this.id,"_state"),this.appProxies.set(this.id,this),this.appEmitter=new Q.default,this.appListener=this.makeAppEventListener(this.id),this.isAddApp=i,this.initScenes(),null!=(o=this.params.options)&&o.scenePath&&this.createView(),this._pageState=new Ke({displayer:this.manager.displayer,scenePath:this.scenePath,view:this.view,notifyPageStateChange:this.notifyPageStateChange})}var t,n,r,i,o,a,s,u;return x(e,[{key:"initScenes",value:function(){var e,t=this.params.options;t&&(this.scenePath=t.scenePath,(null==(e=this.appAttributes)?void 0:e.isDynamicPPT)&&this.scenePath?this.scenes=Se(this.manager.displayer)[this.scenePath]:this.scenes=t.scenes)}},{key:"getFullScenePath",value:function(){if(this.scenePath)return j.get(this.appAttributes,[$e.FullPath])||this.getFullScenePathFromScenes()}},{key:"getFullScenePathFromScenes",value:function(){var e=j.get(this.appAttributes,["state","SceneIndex"],0),t=function(e,t,n){var r;if(e&&t){var i=null==(r=Se(e)[t])?void 0:r[n];if(i)return"".concat(t,"/").concat(i.name)}}(this.manager.room,this.scenePath,e);return t&&this.setFullPath(t),t}},{key:"setFullPath",value:function(e){this.manager.safeUpdateAttributes(["apps",this.id,$e.FullPath],e)}},{key:"baseInsertApp",value:(u=g(regeneratorRuntime.mark((function e(){var t,n,r,i,o,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=a.length>0&&void 0!==a[0]&&a[0],(r=this.params).kind){e.next=4;break}throw new Error("[WindowManager]: kind require");case 4:return e.next=6,null==(n=xe.appClasses.get(r.kind))?void 0:n();case 6:if(i=e.sent,o=xe.registered.get(r.kind),!i){e.next=13;break}return e.next=11,this.setupApp(this.id,t,i,r.options,null==o?void 0:o.appOptions);case 11:e.next=14;break;case 13:throw new Error("[WindowManager]: app load failed ".concat(r.kind," ").concat(r.src));case 14:return e.abrupt("return",(ue.emit("updateManagerRect"),{appId:this.id,app:i}));case 15:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"setupApp",value:(s=g(regeneratorRuntime.mark((function e(t,n,r,i,o){var a,s,u=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(tt("setupApp",t,r,i),this.boxManager){e.next=2;break}throw new ze;case 2:s=new Je(this.manager,this.boxManager,t,this,o),this.appContext=s,e.prev=4,ue.once("".concat(t).concat(q.WindowCreated)).then(g(regeneratorRuntime.mark((function e(){var i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n||(o=u.getAppInitState(t),null==(i=u.boxManager)||i.updateBoxState(o)),u.appEmitter.onAny(u.appListener),u.appAttributesUpdateListener(t),u.setViewFocusScenePath(),setTimeout(g(regeneratorRuntime.mark((function e(){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("setup app",r),e.next=3,r.setup(s);case 3:n=e.sent,u.appResult=n,xe.notifyApp(u.kind,"created",{appId:t,result:n}),u.afterSetupApp(o),u.fixMobileSize();case 5:case"end":return e.stop()}}),e)}))),50);case 1:case"end":return e.stop()}}),e)})))),null==(a=this.boxManager)||a.createBox({appId:t,app:r,options:i,canOperate:this.manager.canOperate,smartPosition:this.isAddApp}),this.isAddApp&&this.box&&(this.store.updateAppState(t,$.ZIndex,this.box.zIndex),this.store.updateAppState(t,$.Size,{width:this.box.intrinsicWidth,height:this.box.intrinsicHeight}),this.boxManager.focusBox({appId:t},!1)),e.next=11;break;case 8:throw e.prev=8,e.t0=e.catch(4),console.error(e.t0),new Error("[WindowManager]: app setup error: ".concat(e.t0.message));case 11:case"end":return e.stop()}}),e,this,[[4,8]])}))),function(e,t,n,r,i){return s.apply(this,arguments)})},{key:"fixMobileSize",value:function(){var e,t,n=null==(e=this.boxManager)?void 0:e.getBox(this.id);n&&(null==(t=this.boxManager)||t.resizeBox({appId:this.id,width:n.intrinsicWidth+.001,height:n.intrinsicHeight+.001,skipUpdate:!0}))}},{key:"afterSetupApp",value:function(e){var t;e&&(null==e||!e.x||!e.y)&&(null==(t=this.boxManager)||t.setBoxInitState(this.id))}},{key:"onSeek",value:(a=g(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.appEmitter.emit("seek",t).catch((function(e){console.log("[WindowManager]: emit seek error: ".concat(e.message))})),r=this.getAppInitState(this.id),null==(n=this.boxManager)||n.updateBoxState(r);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"onReconnected",value:(o=g(regeneratorRuntime.mark((function t(){var n,r,i;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(Boolean(this.manager.attributes.apps[this.id])){t.next=4;break}return t.next=3,this.destroy(!0,!1,!0);case 3:return t.abrupt("return");case 4:return this.appEmitter.emit("reconnected",void 0),r=this.getAppInitState(this.id),t.next=8,this.destroy(!0,!1,!0);case 8:return i=this.params,t.next=11,new e(i,this.manager,this.id,this.isAddApp).baseInsertApp(!0);case 11:null==(n=this.boxManager)||n.updateBoxState(r);case 12:case"end":return t.stop()}}),t,this)}))),function(){return o.apply(this,arguments)})},{key:"onRemoveScene",value:(i=g(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.scenePath&&t.startsWith(this.scenePath+"/")&&(n=this.pageState.index,(r=this._pageState.getFullPath(n))||(n=0,r=this._pageState.getFullPath(n)),r&&this.setFullPath(r),this.setViewFocusScenePath(),this.view&&(this.view.focusSceneIndex=n));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"emitAppSceneStateChange",value:function(e){this.appEmitter.emit("sceneStateChange",e)}},{key:"emitAppIsWritableChange",value:function(){this.appEmitter.emit("writableChange",this.isWritable)}},{key:"makeAppEventListener",value:function(e){var t=this;return function(n,r){var i,o,a,s;if(t.manager.canOperate)switch(n){case"setBoxSize":null==(i=t.boxManager)||i.resizeBox({appId:e,width:r.width,height:r.height,skipUpdate:!1});break;case"setBoxMinSize":null==(o=t.boxManager)||o.setBoxMinSize({appId:e,minWidth:r.minwidth,minHeight:r.minheight});break;case"setBoxTitle":null==(a=t.boxManager)||a.setBoxTitle({appId:e,title:r.title});break;case ee.destroy:if("destroyed"===t.status)return;t.destroy(!0,!1,!0,null==r?void 0:r.error),null!=r&&r.error&&console.error(null==r?void 0:r.error);break;case"focus":null==(s=t.boxManager)||s.focusBox({appId:t.id}),rt.emit("focus",{appId:t.id})}}}},{key:"setScenePath",value:function(){if(this.manager.canOperate){var e=this.getFullScenePath();this.manager.room&&e&&this.view&&Te(this.manager.room,e)}}},{key:"setViewFocusScenePath",value:function(){var e=this.getFullScenePath();return e&&this.view&&we(this.view,e),e}},{key:"createView",value:(r=g(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.viewManager.createView(this.id);case 2:return t=e.sent,e.abrupt("return",(this.setViewFocusScenePath(),t));case 4:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"removeSceneByIndex",value:(n=g(regeneratorRuntime.mark((function e(t){var n,r,i=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=this._pageState.getFullPath(t))){e.next=6;break}return r=nt(t,this.pageState),e.abrupt("return",(this.setSceneIndexWithoutSync(r),this.manager.dispatchInternalEvent(q.SetAppFocusIndex,{type:"app",appID:this.id,index:r}),setTimeout((function(){Me(i.manager.room,n,t)}),100),!0));case 6:return e.abrupt("return",!1);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"setSceneIndexWithoutSync",value:function(e){this.view&&(this.view.focusSceneIndex=e)}},{key:"setSceneIndex",value:function(e){if(this.view){this.view.focusSceneIndex=e;var t=this._pageState.getFullPath(e);t&&this.setFullPath(t)}}},{key:"destroy",value:(t=g(regeneratorRuntime.mark((function e(t,n,r,i){var o,a,s,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("destroyed"===this.status){e.next=13;break}return this.status="destroyed",e.prev=2,e.next=5,xe.notifyApp(this.kind,"destroy",{appId:this.id});case 5:return e.next=7,this.appEmitter.emit("destroy",{error:i});case 7:e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),console.error("[WindowManager]: notifyApp error",e.t0.message,e.t0.stack);case 12:this.appEmitter.clearListeners(),ue.emit("destroy-".concat(this.id),{error:i}),t&&(null==(o=this.boxManager)||o.closeBox(this.id,r)),n&&(this.store.cleanAppAttributes(this.id),this.scenePath&&Me(this.manager.room,this.scenePath)),this.appProxies.delete(this.id),this._pageState.destroy(),this.viewManager.destroyView(this.id),this.manager.appStatus.delete(this.id),null==(a=this.manager.refresher)||a.remove(this.id),null==(s=this.manager.refresher)||s.remove(this.stateKey),null==(u=this.manager.refresher)||u.remove("".concat(this.id,"-fullPath")),this._prevFullPath=void 0;case 13:case"end":return e.stop()}}),e,this,[[2,9]])}))),function(e,n,r,i){return t.apply(this,arguments)})},{key:"close",value:function(){return this.destroy(!0,!0,!1)}},{key:"view",get:function(){return this.manager.viewManager.getView(this.id)}},{key:"viewIndex",get:function(){var e;return null==(e=this.view)?void 0:e.focusSceneIndex}},{key:"isWritable",get:function(){var e;return this.manager.canOperate&&!(null!=(e=this.box)&&e.readonly)}},{key:"attributes",get:function(){return this.manager.attributes[this.id]}},{key:"appAttributes",get:function(){return this.store.getAppAttributes(this.id)}},{key:"box",get:function(){var e;return null==(e=this.boxManager)?void 0:e.getBox(this.id)}},{key:"pageState",get:function(){return this._pageState.toObject()}}]),e}(),ot=function(){function e(t){y(this,e),this.displayer=t,this.views=new Map}return x(e,[{key:"createView",value:function(e){var t=at(this.displayer);return this.views.set(e,t),t}},{key:"getView",value:function(e){return this.views.get(e)}},{key:"destroyView",value:function(e){var t=this.views.get(e);if(t){try{t.release()}catch(e){}this.views.delete(e)}}},{key:"setViewScenePath",value:function(e,t){var n=this.views.get(e);n&&(n.focusScenePath=t)}},{key:"destroy",value:function(){this.views.forEach((function(e){try{e.release()}catch(e){}})),this.views.clear()}}]),e}(),at=function(e){var t=e.views.createView();return st(t),t},st=function(e){e.setCameraBound({maxContentMode:function(){return 10},minContentMode:function(){return.1}})},ut=function(){function e(t){var n=this;y(this,e),this.manager=t,this.started=!1,this.mainViewIsAddListener=!1,this.store=this.manager.store,this.viewMode=this.manager.windowManger.viewMode,this.sideEffectManager=new F.SideEffectManager,this.startListenWritableChange=function(){n.sideEffectManager.add((function(){return ue.on("writableChange",(function(e){e&&n.ensureCameraAndSize(),n.manager.room&&n.syncMainView(n.manager.room)}))}))},this.addCameraReaction=function(){var e;null==(e=n.manager.refresher)||e.add($e.MainViewCamera,n.cameraReaction)},this.cameraReaction=function(){return B.reaction((function(){return n.mainViewCamera}),(function(e){e&&e.id!==n.manager.uid&&(n.moveCameraToContian(n.mainViewSize),n.moveCamera(e))}),{fireImmediately:!0})},this.sizeChangeHandler=j.debounce((function(e){e&&(n.moveCameraToContian(e),n.moveCamera(n.mainViewCamera))}),30),this.onUpdateContainerSizeRatio=function(){var e=n.store.getMainViewSize();n.sizeChangeHandler(e)},this.onCameraUpdatedByDevice=function(e){n.viewMode!==B.ViewMode.Follower&&(n.store.setMainViewCamera(O(P({},e),{id:n.manager.uid})),j.isEqual(n.mainViewSize,O(P({},n.mainView.size),{id:n.manager.uid}))||n.setMainViewSize(n.view.size))},this.mainViewClickListener=function(){n.mainViewClickHandler()},this.setMainViewSize=j.debounce((function(e){n.store.setMainViewSize(O(P({},e),{id:n.manager.uid}))}),50),this._syncMainViewTimer=0,this.onCameraOrSizeUpdated=function(){ae.emit("cameraStateChange",n.cameraState),n.manager.room&&n.manager.room.syncMainView&&(clearTimeout(n._syncMainViewTimer),n._syncMainViewTimer=setTimeout(n.syncMainView,100,n.manager.room))},this.syncMainView=function(e){e.isWritable&&e.syncMainView(n.mainView)},this.setViewMode=function(e){n.viewMode=e},this.mainView=this.createMainView(),this.moveCameraSizeByAttributes(),ue.once("mainViewMounted").then((function(){n.addMainViewListener(),n.start(),n.ensureCameraAndSize(),n.startListenWritableChange()}));var r=function(){n.sizeChangeHandler(n.mainViewSize)};this.sideEffectManager.add((function(){return ue.on("playgroundSizeChange",r)})),this.sideEffectManager.add((function(){return ue.on("containerSizeRatioUpdate",n.onUpdateContainerSizeRatio)})),this.sideEffectManager.add((function(){return ue.on("startReconnect",(function(){n.didRelease||n.mainView.release()}))}))}var t;return x(e,[{key:"ensureCameraAndSize",value:function(){this.viewMode===B.ViewMode.Broadcaster&&(!this.mainViewCamera||!this.mainViewSize)&&(this.manager.dispatchInternalEvent(q.InitMainViewCamera),this.setCameraAndSize())}},{key:"moveCameraSizeByAttributes",value:function(){this.moveCameraToContian(this.mainViewSize),this.moveCamera(this.mainViewCamera)}},{key:"start",value:function(){this.sizeChangeHandler(this.mainViewSize),!this.started&&(this.addCameraListener(),this.addCameraReaction(),this.manager.room&&this.syncMainView(this.manager.room),this.started=!0)}},{key:"setCameraAndSize",value:function(){var e=O(P({},this.mainView.camera),{id:this.manager.uid}),t=O(P({},this.mainView.size),{id:this.manager.uid});this.store.setMainViewCameraAndSize(e,t)}},{key:"createMainView",value:function(){var e=at(this.manager.displayer),t=this.store.getMainViewScenePath();return t&&we(e,t),e}},{key:"onReconnect",value:function(){if(this.didRelease)this.rebind();else{var e=this.store.getMainViewScenePath();this.setFocusScenePath(e)}}},{key:"setFocusScenePath",value:function(e){if(e)return we(this.view,e)}},{key:"rebind",value:function(){var e=this.mainView.divElement,t=this.mainView.disableCameraTransform;this.stop(),this.didRelease||this.mainView.release(),this.removeMainViewListener(),this.mainView=this.createMainView(),this.mainView.disableCameraTransform=t,this.mainView.divElement=e,this.addMainViewListener(),this.start()}},{key:"addMainViewListener",value:function(){this.mainViewIsAddListener||this.view.divElement&&(this.view.divElement.addEventListener("click",this.mainViewClickListener),this.view.divElement.addEventListener("touchend",this.mainViewClickListener),this.mainViewIsAddListener=!0)}},{key:"removeMainViewListener",value:function(){this.view.divElement&&(this.view.divElement.removeEventListener("click",this.mainViewClickListener),this.view.divElement.removeEventListener("touchend",this.mainViewClickListener)),this.mainViewIsAddListener=!1}},{key:"mainViewClickHandler",value:(t=g(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:!this.manager.canOperate||(this.store.cleanFocus(),null==(t=this.manager.boxManager)||t.blurAllBox());case 1:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"addCameraListener",value:function(){this.view.callbacks.on("onCameraUpdatedByDevice",this.onCameraUpdatedByDevice),this.view.callbacks.on("onCameraUpdated",this.onCameraOrSizeUpdated),this.view.callbacks.on("onSizeUpdated",this.onCameraOrSizeUpdated)}},{key:"removeCameraListener",value:function(){this.view.callbacks.off("onCameraUpdatedByDevice",this.onCameraUpdatedByDevice),this.view.callbacks.off("onCameraUpdated",this.onCameraOrSizeUpdated),this.view.callbacks.off("onSizeUpdated",this.onCameraOrSizeUpdated)}},{key:"moveCameraToContian",value:function(e){j.isEmpty(e)||(this.view.moveCameraToContain({width:e.width,height:e.height,originX:-e.width/2,originY:-e.height/2,animationMode:B.AnimationMode.Immediately}),this.scale=this.view.camera.scale)}},{key:"moveCamera",value:function(e){if(!j.isEmpty(e)){if(j.isEqual(e,this.view.camera))return;var t=e.centerX,n=e.centerY,r=e.scale*(this.scale||1);this.view.moveCamera({centerX:t,centerY:n,scale:r,animationMode:B.AnimationMode.Immediately})}}},{key:"stop",value:function(){var e,t;this.removeCameraListener(),null==(e=this.manager.refresher)||e.remove($e.MainViewCamera),null==(t=this.manager.refresher)||t.remove($e.MainViewSize),this.started=!1}},{key:"destroy",value:function(){this.removeMainViewListener(),this.stop(),this.sideEffectManager.flushAll()}},{key:"mainViewCamera",get:function(){return this.store.getMainViewCamera()}},{key:"mainViewSize",get:function(){return this.store.getMainViewSize()}},{key:"didRelease",get:function(){return j.get(this.view,["didRelease"])}},{key:"view",get:function(){return this.mainView}},{key:"cameraState",get:function(){return P(P({},this.view.camera),this.view.size)}}]),e}(),lt=function(){function e(t){var n=this;y(this,e),this.context=t,this.addRedoUndoListeners=function(e){if(void 0===e)n.addViewCallbacks(n.context.mainView(),n.onCanRedoStepsUpdate,n.onCanUndoStepsUpdate);else{var t=n.context.getAppProxy(e);t&&t.view&&n.addViewCallbacks(t.view,n.onCanRedoStepsUpdate,n.onCanUndoStepsUpdate)}},this.addViewCallbacks=function(e,t,n){t(e.canRedoSteps),n(e.canUndoSteps),e.callbacks.on("onCanRedoStepsUpdate",t),e.callbacks.on("onCanUndoStepsUpdate",n)},this.disposeViewCallbacks=function(e){e.callbacks.off("onCanRedoStepsUpdate",n.onCanRedoStepsUpdate),e.callbacks.off("onCanUndoStepsUpdate",n.onCanUndoStepsUpdate)},this.onCanRedoStepsUpdate=function(e){ae.emit("canRedoStepsChange",e)},this.onCanUndoStepsUpdate=function(e){ae.emit("canUndoStepsChange",e)},this.disposePrevFocusViewRedoUndoListeners=function(e){var t;if(void 0===e)t=n.context.mainView();else{var r=n.context.getAppProxy(e);r&&r.view&&(t=r.view)}t&&n.disposeViewCallbacks(t)},ue.on("focusedChange",(function(e){n.disposePrevFocusViewRedoUndoListeners(e.prev),setTimeout((function(){n.addRedoUndoListeners(e.focused)}),0)})),ue.on("rootDirRemoved",(function(){n.disposePrevFocusViewRedoUndoListeners(t.focus()),n.addRedoUndoListeners(t.focus())})),this.addRedoUndoListeners(t.focus())}return x(e,[{key:"destroy",value:function(){this.disposePrevFocusViewRedoUndoListeners(this.context.focus())}}]),e}(),ct=function(){function e(t){var n=this;y(this,e),this.windowManger=t,this.appProxies=new Map,this.appStatus=new Map,this.store=et,this.isReplay=this.windowManger.isReplay,this.mainViewScenesLength=0,this.callbacksNode=null,this.appCreateQueue=new se,this.sideEffectManager=new F.SideEffectManager,this.sceneState=null,this.rootDirRemoving=!1,this.onRemoveScenes=function(){var e=g(regeneratorRuntime.mark((function e(t){var r,i,o,a,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((o=t.scenePath)!==ie){e.next=6;break}return e.next=4,n.onRootDirRemoved();case 4:return n.dispatchInternalEvent(q.RootDirRemoved),e.abrupt("return");case 6:if(!De(o)){e.next=14;break}return a=n.mainView.focusSceneIndex||0,(s=null==(r=n.callbacksNode)?void 0:r.scenes[a])||(a=0,s=null==(i=n.callbacksNode)?void 0:i.scenes[a]),s&&n.setMainViewScenePath("".concat(ie).concat(s)),e.next=12,n.setMainViewSceneIndex(a);case 12:e.next=15;break;case 14:n.appProxies.forEach((function(e){e.onRemoveScene(o)}));case 15:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.onReadonlyChanged=function(){n.appProxies.forEach((function(e){e.emitAppIsWritableChange()}))},this.onPlayerSeekStart=g(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.closeAll();case 2:case"end":return e.stop()}}),e)}))),this.onPlayerSeekDone=function(){var e=g(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.attributesUpdateCallback(n.attributes.apps);case 2:n.appProxies.forEach((function(e){e.onSeek(t)}));case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.createRootDirScenesCallback=function(){var e,t=!1;n.callbacksNode&&(n.callbacksNode.dispose(),t=!0),n.callbacksNode=n.displayer.createScenesCallback(ie,{onAddScene:n.onSceneChange,onRemoveScene:(e=g(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.onSceneChange(t);case 2:ue.emit("rootDirSceneRemoved",r);case 3:case"end":return e.stop()}}),e)}))),function(t,n){return e.apply(this,arguments)})}),n.callbacksNode&&(n.updateSceneState(n.callbacksNode),n.mainViewScenesLength=n.callbacksNode.scenes.length,t&&n.emitMainViewScenesChange(n.callbacksNode.scenes.length))},this.removeSceneByIndex=function(){var e=g(regeneratorRuntime.mark((function e(t){var r,i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=nt(t,n.windowManger.pageState),n.setSceneIndexWithoutSync(i),n.dispatchInternalEvent(q.SetAppFocusIndex,{type:"main",index:i}),o=null==(r=n.callbacksNode)?void 0:r.scenes[t],e.abrupt("return",(setTimeout((function(){o&&Me(n.room,"".concat(ie).concat(o),t)}),100),new Promise((function(e,t){ue.once("rootDirSceneRemoved").then((function(t){t===o&&e(!0)})).catch((function(e){console.log("[WindowManager]: removePage error: ".concat(e)),t(!1)}))}))));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.setSceneIndexWithoutSync=function(e){var t,r=null==(t=n.callbacksNode)?void 0:t.scenes[e];r&&n.mainViewProxy.setFocusScenePath("".concat(ie).concat(r))},this.onSceneChange=function(e){return n.mainViewScenesLength=e.scenes.length,n.updateSceneState(e),n.emitMainViewScenesChange(n.mainViewScenesLength)},this.emitMainViewScenesChange=function(e){return Promise.all([ae.emit("mainViewScenesLengthChange",e),ue.emit("changePageState")])},this.updateSceneState=function(e){var t=n.store.getMainViewSceneIndex()||0,r=e.scenes[t];r||(r=e.scenes[n.mainView.focusSceneIndex||0]),n.sceneState={scenePath:"".concat(ie).concat(r),contextPath:e.path,index:t,scenes:e.scenes.map((function(e){return{name:e}})),sceneName:r},ae.emit("sceneStateChange",n.sceneState)},this.onBoxMove=function(e){n.dispatchInternalEvent(q.AppMove,e),n.store.updateAppState(e.appId,$.Position,{x:e.x,y:e.y})},this.onBoxResize=function(e){e.width&&e.height&&(n.dispatchInternalEvent(q.AppResize,e),n.store.updateAppState(e.appId,$.Size,{width:e.width,height:e.height}))},this.onBoxFocus=function(e){n.windowManger.safeSetAttributes({focus:e.appId})},this.onBoxClose=function(e){var t=n.appProxies.get(e.appId);t&&t.destroy(!1,!0,!0,e.error)},this.onBoxStateChange=function(e){n.dispatchInternalEvent(q.AppBoxStateChange,e)},this.addAppsChangeListener=function(){var e;null==(e=n.refresher)||e.add("apps",(function(){return Ve((function(){return n.attributes.apps}),(function(){n.attributesUpdateCallback(n.attributes.apps)}))}))},this.addAppCloseListener=function(){var e;null==(e=n.refresher)||e.add("appsClose",(function(){return We(n.attributes.apps,(function(){n.onAppDelete(n.attributes.apps)}))}))},this.onMainViewIndexChange=function(e){void 0!==e&&n._prevSceneIndex!==e&&(ae.emit("mainViewSceneIndexChange",e),ue.emit("changePageState"),n.callbacksNode&&n.updateSceneState(n.callbacksNode),n._prevSceneIndex=e)},this.onFocusChange=function(e){var t;n._prevFocused!==e&&(ae.emit("focusedChange",e),ue.emit("focusedChange",{focused:e,prev:n._prevFocused}),n._prevFocused=e,void 0!==e&&(null==(t=n.boxManager)||t.focusBox({appId:e}),setTimeout((function(){var t=n.appProxies.get(e);t&&xe.notifyApp(t.kind,"focus",{appId:e})}),0)))},this.attributesUpdateCallback=j.debounce((function(e){return n._attributesUpdateCallback(e)}),100),this._appIds=[],this.onRegisteredChange=function(e){!e||Object.entries(e).forEach((function(e){var t=o(e,2),n=t[0],r=t[1];xe.appClasses.has(n)||xe.register({kind:n,src:r.src,name:r.name})}))},this.onMinimized=function(e){var t,r;(null==(t=n.boxManager)?void 0:t.minimized)!==e&&(!0===e&&(null==(r=n.boxManager)||r.blurAllBox()),setTimeout((function(){var t;null==(t=n.boxManager)||t.setMinimized(Boolean(e))}),0))},this.onAppDelete=function(){var e=g(regeneratorRuntime.mark((function e(t){var r,i,a,s,u,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=Object.keys(t),i=T(n.appProxies.entries()),e.prev=2,i.s();case 4:if((a=i.n()).done){e.next=12;break}if(s=o(a.value,2),u=s[0],l=s[1],e.t0=r.includes(u),e.t0){e.next=10;break}return e.next=10,l.destroy(!0,!1,!0);case 10:e.next=4;break;case 12:e.next=17;break;case 14:e.prev=14,e.t1=e.catch(2),i.e(e.t1);case 17:return e.prev=17,i.f(),e.finish(17);case 20:case"end":return e.stop()}}),e,null,[[2,14,17,20]])})));return function(t){return e.apply(this,arguments)}}(),this.closeAll=g(regeneratorRuntime.mark((function e(){var t,r,i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=T(n.appProxies.entries()),e.prev=1,t.s();case 3:if((r=t.n()).done){e.next=9;break}return i=o(r.value,2),i[0],a=i[1],e.next=7,a.destroy(!0,!1,!0);case 7:e.next=3;break;case 9:e.next=14;break;case 11:e.prev=11,e.t0=e.catch(1),t.e(e.t0);case 14:return e.prev=14,t.f(),e.finish(14);case 17:case"end":return e.stop()}}),e,null,[[1,11,14,17]])}))),this.displayerStateListener=function(e){var t=e.sceneState;if(t){var r=t.scenePath;n.appProxies.forEach((function(e){e.scenePath&&r.startsWith(e.scenePath)&&(e.emitAppSceneStateChange(t),e.setFullPath(r))}))}n.appProxies.forEach((function(t){t.appEmitter.emit("roomStateChange",e)})),ue.emit("observerIdChange",n.displayer.observerId)},this.displayerWritableListener=function(e){var t,r,i=!e,o=void 0===n.windowManger.readonly||!1===n.windowManger.readonly;void 0===n.windowManger.readonly?null==(t=n.boxManager)||t.setReadonly(e):null==(r=n.boxManager)||r.setReadonly(!(i&&o)),n.appProxies.forEach((function(e){e.emitAppIsWritableChange()})),ue.emit("writableChange",i)},this.updateSceneIndex=function(){var e=n.store.getMainViewScenePath(),t=Ie(e),r=Se(n.displayer)[t];if(r.length){var i=e.replace(t,"").replace("/",""),o=r.findIndex((function(e){return e.name===i}));j.isInteger(o)&&o>=0&&n.safeSetAttributes({_mainSceneIndex:o})}},this.updateRootDirRemoving=function(e){n.rootDirRemoving=e},this.displayer=t.displayer,this.store.setContext({getAttributes:function(){return n.attributes},safeSetAttributes:function(e){return n.safeSetAttributes(e)},safeUpdateAttributes:function(e,t){return n.safeUpdateAttributes(e,t)}}),this.mainViewProxy=new ut(this),this.viewManager=new ot(this.displayer),this.appListeners=new Pe(this),this.displayer.callbacks.on(this.eventName,this.displayerStateListener),this.appListeners.addListeners(),this.refresher=Ab,this.refresher.setRoom(this.room),this.refresher.setContext({emitter:ue}),this.sideEffectManager.add((function(){return function(){var e,t,r;n.appCreateQueue.destroy(),n.mainViewProxy.destroy(),null==(e=n.refresher)||e.destroy(),n.viewManager.destroy(),null==(t=n.boxManager)||t.destroy(),null==(r=n.callbacksNode)||r.dispose()}})),ue.once("onCreated").then((function(){return n.onCreated()})),ue.on("onReconnected",(function(){return n.onReconnected()})),B.isPlayer(this.displayer)&&(ue.on("seekStart",this.onPlayerSeekStart),ue.on("seek",this.onPlayerSeekDone)),ue.on("removeScenes",this.onRemoveScenes),ue.on("setReadonly",this.onReadonlyChanged),this.createRootDirScenesCallback(),xe.setSyncRegisterApp((function(e){n.safeUpdateAttributes([$e.Registered,e.kind],e)}))}var t,n,r,i,a,s,u,l,c,h,d;return x(e,[{key:"onRootDirRemoved",value:(d=g(regeneratorRuntime.mark((function e(){var t,n,r,i,a,s,u=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=!(u.length>0&&void 0!==u[0])||u[0],this.setMainViewScenePath(oe),this.createRootDirScenesCallback(),n=T(this.appProxies.entries()),e.prev=3,n.s();case 5:if((r=n.n()).done){e.next=13;break}if(i=o(r.value,2),a=i[0],s=i[1],e.t0=s.view,!e.t0){e.next=11;break}return e.next=11,this.closeApp(a,t);case 11:e.next=5;break;case 13:e.next=18;break;case 15:e.prev=15,e.t1=e.catch(3),n.e(e.t1);case 18:return e.prev=18,n.f(),e.finish(18);case 21:this.mainViewProxy.rebind(),ue.emit("rootDirRemoved"),this.updateRootDirRemoving(!1);case 22:case"end":return e.stop()}}),e,this,[[3,15,18,21]])}))),function(){return d.apply(this,arguments)})},{key:"getMainViewSceneDir",value:function(){var e=this.store.getMainViewScenePath();if(e)return Ie(e);throw new Error("[WindowManager]: mainViewSceneDir not found")}},{key:"onCreated",value:(h=g(regeneratorRuntime.mark((function e(){var t,n,r,i,o,a,s,u=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.attributesUpdateCallback(this.attributes.apps);case 2:if(ue.emit("updateManagerRect"),rt.on("move",this.onBoxMove),rt.on("resize",this.onBoxResize),rt.on("focus",this.onBoxFocus),rt.on("close",this.onBoxClose),rt.on("boxStateChange",this.onBoxStateChange),this.addAppsChangeListener(),this.addAppCloseListener(),null==(t=this.refresher)||t.add("maximized",(function(){return B.autorun((function(){var e,t=u.attributes.maximized;null==(e=u.boxManager)||e.setMaximized(Boolean(t))}))})),null==(n=this.refresher)||n.add("minimized",(function(){return B.autorun((function(){var e=u.attributes.minimized;u.onMinimized(e)}))})),null==(r=this.refresher)||r.add("mainViewIndex",(function(){return B.autorun((function(){var e=j.get(u.attributes,"_mainSceneIndex");u.onMainViewIndexChange(e)}))})),null==(i=this.refresher)||i.add("focusedChange",(function(){return B.autorun((function(){var e=j.get(u.attributes,"focus");u.onFocusChange(e)}))})),null==(o=this.refresher)||o.add("registeredChange",(function(){return B.autorun((function(){var e=j.get(u.attributes,$e.Registered);u.onRegisteredChange(e)}))})),this.attributes.apps&&0!==Object.keys(this.attributes.apps).length){e.next=20;break}if(s=this.store.getMainViewScenePath()){e.next=19;break}return e.abrupt("return");case 19:this.resetScenePath(s);case 20:this.displayerWritableListener(!(null!=(a=this.room)&&a.isWritable)),this.displayer.callbacks.on("onEnableWriteNowChanged",this.displayerWritableListener),this._prevFocused=this.attributes.focus,this.sideEffectManager.add((function(){var e=new lt({mainView:function(){return u.mainViewProxy.view},focus:function(){return u.attributes.focus},getAppProxy:function(e){return u.appProxies.get(e)}});return function(){return e.destroy()}}));case 21:case"end":return e.stop()}}),e,this)}))),function(){return h.apply(this,arguments)})},{key:"notifyAppsChange",value:function(e){(this._appIds.length!==e.length||!this._appIds.every((function(t){return e.includes(t)})))&&(this._appIds=e,ae.emit("appsChange",e))}},{key:"_attributesUpdateCallback",value:(c=g(regeneratorRuntime.mark((function e(t){var n,r,i,o,a,s=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t&&Cb.container){0===(n=Object.keys(t)).length&&this.appCreateQueue.emitReady(),r=j.orderBy(n.map((function(e){return{id:e,createdAt:t[e].createdAt}})),"createdAt","asc").map((function(e){return e.id})),this.notifyAppsChange(r),i=T(r);try{for(a=function(){var e=o.value;if(!s.appProxies.has(e)&&!s.appStatus.has(e)){var n=t[e];try{if(!s.attributes[e])throw new Error("appAttributes is undefined");s.appCreateQueue.push((function(){return s.appStatus.set(e,te.StartCreate),s.baseInsertApp({kind:n.kind,options:n.options,isDynamicPPT:n.isDynamicPPT},e,!1)})),s.focusByAttributes(t)}catch(e){console.warn("[WindowManager]: Insert App Error",e)}}},i.s();!(o=i.n()).done;)a()}catch(e){i.e(e)}finally{i.f()}}case 1:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"refresh",value:function(){this.attributesUpdateCallback(this.attributes.apps)}},{key:"setBoxManager",value:function(e){this.boxManager=e}},{key:"resetMaximized",value:function(){var e;null==(e=this.boxManager)||e.setMaximized(Boolean(this.store.getMaximized()))}},{key:"resetMinimized",value:function(){var e;null==(e=this.boxManager)||e.setMinimized(Boolean(this.store.getMinimized()))}},{key:"bindMainView",value:function(e,t){var n=this.mainViewProxy.view;n.disableCameraTransform=t,n.divElement=e,n.focusScenePath||this.setMainViewFocusPath(),ue.emit("mainViewMounted")}},{key:"setMainViewFocusPath",value:function(e){var t,n=e||this.store.getMainViewScenePath();if(n)return we(this.mainView,n),(null==(t=this.mainView)?void 0:t.focusScenePath)===n}},{key:"resetScenePath",value:function(e){this.displayer.state.sceneState.scenePath!==e&&Te(this.room,e)}},{key:"addApp",value:(l=g(regeneratorRuntime.mark((function e(t,n){var r,i,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return tt("addApp",t),e.next=3,this.beforeAddApp(t,n);case 3:return r=e.sent,i=r.appId,o=r.needFocus,e.next=8,this.baseInsertApp(t,i,!0,o);case 8:return a=e.sent,e.abrupt("return",(this.afterAddApp(a),null==a?void 0:a.id));case 10:case"end":return e.stop()}}),e,this)}))),function(e,t){return l.apply(this,arguments)})},{key:"beforeAddApp",value:(u=g(regeneratorRuntime.mark((function e(t,n){var r,i,o,a,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,_e(t.kind);case 2:return o=e.sent,this.appStatus.set(o,te.StartCreate),a=null!=(r=t.attributes)?r:{},this.safeUpdateAttributes([o],a),this.store.setupAppAttributes(t,o,n),s=!(null!=(i=this.boxManager)&&i.minimized),e.abrupt("return",(s&&this.store.setAppFocus(o,!0),{appId:o,needFocus:s}));case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return u.apply(this,arguments)})},{key:"afterAddApp",value:function(e){var t,n;if(e&&e.box){var r=e.box;rt.emit("move",{appId:e.id,x:null==r?void 0:r.intrinsicX,y:null==r?void 0:r.intrinsicY}),this.store.updateAppState(e.id,$.ZIndex,r.zIndex)}null!=(t=this.boxManager)&&t.minimized&&(null==(n=this.boxManager)||n.setMinimized(!1,!1))}},{key:"closeApp",value:(s=g(regeneratorRuntime.mark((function e(t){var n,r,i=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=!(i.length>1&&void 0!==i[1])||i[1],(r=this.appProxies.get(t))&&r.destroy(!0,n,!1);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"baseInsertApp",value:(a=g(regeneratorRuntime.mark((function e(t,n,r,i){var o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.appProxies.has(n)){e.next=3;break}return console.warn("[WindowManager]: app duplicate exists and cannot be created again"),e.abrupt("return");case 3:if(!(o=new it(t,this,n,r))){e.next=9;break}return e.next=7,o.baseInsertApp(i);case 7:return this.appStatus.delete(n),e.abrupt("return",o);case 9:throw this.appStatus.delete(n),new Error("[WindowManger]: initialize AppProxy failed");case 10:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return a.apply(this,arguments)})},{key:"safeSetAttributes",value:function(e){this.windowManger.safeSetAttributes(e)}},{key:"safeUpdateAttributes",value:function(e,t){this.windowManger.safeUpdateAttributes(e,t)}},{key:"setMainViewScenePath",value:(i=g(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.room){e.next=17;break}if(n=this.displayer.scenePathType(t),Ie(t)===ie){e.next=4;break}throw new Error('[WindowManager]: main view scenePath must in root dir "/"');case 4:if(n!==B.ScenePathType.None){e.next=6;break}throw new Error("[WindowManager]: ".concat(t," not valid scene"));case 6:if(n!==B.ScenePathType.Page){e.next=11;break}return e.next=9,this._setMainViewScenePath(t);case 9:e.next=17;break;case 11:if(n!==B.ScenePathType.Dir){e.next=17;break}if(r=Ee(this.displayer,t),e.t0=r,!e.t0){e.next=17;break}return e.next=17,this._setMainViewScenePath(r);case 17:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"_setMainViewScenePath",value:(r=g(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.setMainViewFocusPath(t)&&(this.safeSetAttributes({_mainScenePath:t}),this.store.setMainViewFocusPath(this.mainView),this.updateSceneIndex(),this.dispatchSetMainViewScenePath(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"setMainViewSceneIndex",value:(n=g(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.room){e.next=9;break}if(this.store.getMainViewSceneIndex()!==t){e.next=3;break}return e.abrupt("return");case 3:if(r=null==(n=this.callbacksNode)?void 0:n.scenes[t],i="".concat(ie).concat(r),!r){e.next=8;break}this.setMainViewFocusPath(i)&&(this.store.setMainViewScenePath(i),this.store.setMainViewSceneIndex(t),this.dispatchSetMainViewScenePath(i)),e.next=9;break;case 8:throw new Error("[WindowManager]: ".concat(t," not valid index"));case 9:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"dispatchSetMainViewScenePath",value:function(e){this.dispatchInternalEvent(q.SetMainViewScenePath,{nextScenePath:e}),ae.emit("mainViewScenePathChange",e),Te(this.room,e)}},{key:"getAppInitPath",value:function(e){var t,n=this.store.getAppAttributes(e);if(n)return null==(t=null==n?void 0:n.options)?void 0:t.scenePath}},{key:"safeDispatchMagixEvent",value:function(e,t){this.canOperate&&this.displayer.dispatchMagixEvent(e,t)}},{key:"focusByAttributes",value:function(e){var t;if(e&&Object.keys(e).length===(null==(t=this.boxManager)?void 0:t.boxSize)){var n=this.store.focus;n&&this.boxManager.focusBox({appId:n})}}},{key:"onReconnected",value:(t=g(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.attributesUpdateCallback(this.attributes.apps),t=Array.from(this.appProxies.values()).map((function(e){return e.onReconnected()})),this.mainViewProxy.onReconnect(),e.next=5,Promise.all(t);case 5:this.callbacksNode&&this.onSceneChange(this.callbacksNode);case 6:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"notifyContainerRectUpdate",value:function(e){this.appProxies.forEach((function(t){t.appEmitter.emit("containerRectUpdate",e)}))}},{key:"dispatchInternalEvent",value:function(e,t){this.safeDispatchMagixEvent(J,{eventName:e,payload:t})}},{key:"destroy",value:function(){this.displayer.callbacks.off(this.eventName,this.displayerStateListener),this.displayer.callbacks.off("onEnableWriteNowChanged",this.displayerWritableListener),this.appListeners.removeListeners(),rt.clearListeners(),ue.clearListeners(),this.appProxies.size&&this.appProxies.forEach((function(e){e.destroy(!0,!1,!0)})),ae.clearListeners(),this.sideEffectManager.flushAll(),this._prevFocused=void 0,this._prevSceneIndex=void 0}},{key:"eventName",get:function(){return B.isRoom(this.displayer)?"onRoomStateChanged":"onPlayerStateChanged"}},{key:"attributes",get:function(){return this.windowManger.attributes}},{key:"canOperate",get:function(){return this.windowManger.canOperate}},{key:"room",get:function(){return B.isRoom(this.displayer)?this.displayer:void 0}},{key:"mainView",get:function(){return this.mainViewProxy.view}},{key:"focusApp",get:function(){if(this.store.focus)return this.appProxies.get(this.store.focus)}},{key:"uid",get:function(){var e;return(null==(e=this.room)?void 0:e.uid)||""}}]),e}(),ht=function(){if(Ne(B.WhiteVersion)Cb.containerSizeRatio?(i=r*Cb.containerSizeRatio,t.classList.toggle("netless-window-manager-sizer-horizontal",!0)):(r=i/Cb.containerSizeRatio,t.classList.toggle("netless-window-manager-sizer-horizontal",!1)),n.style.width="".concat(r,"px"),n.style.height="".concat(i,"px"))}},{key:"disconnect",value:function(){var e;null==(e=this.containerResizeObserver)||e.disconnect(),j.isFunction(this.disposer)&&(this.disposer(),this.disposer=void 0)}}],[{key:"create",value:function(t,n,r,i){var o=new e(i);return o.observePlaygroundSize(t,n,r),o}}]),e}(),mt={exports:{}},gt={},yt=Object.getOwnPropertySymbols,bt=Object.prototype.hasOwnProperty,xt=Object.prototype.propertyIsEnumerable;function _t(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var wt=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,r,i=_t(e),o=1;ot}return!1}function yl(e,t,n,r,i,o){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o}var bl={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach((function(e){bl[e]=new yl(e,0,!1,e,null,!1)})),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach((function(e){var t=e[0];bl[t]=new yl(t,1,!1,e[1],null,!1)})),["contentEditable","draggable","spellCheck","value"].forEach((function(e){bl[e]=new yl(e,2,!1,e.toLowerCase(),null,!1)})),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach((function(e){bl[e]=new yl(e,2,!1,e,null,!1)})),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach((function(e){bl[e]=new yl(e,3,!1,e.toLowerCase(),null,!1)})),["checked","multiple","muted","selected"].forEach((function(e){bl[e]=new yl(e,3,!0,e,null,!1)})),["capture","download"].forEach((function(e){bl[e]=new yl(e,4,!1,e,null,!1)})),["cols","rows","size","span"].forEach((function(e){bl[e]=new yl(e,6,!1,e,null,!1)})),["rowSpan","start"].forEach((function(e){bl[e]=new yl(e,5,!1,e.toLowerCase(),null,!1)}));var xl=/[\-:]([a-z])/g;function _l(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach((function(e){var t=e.replace(xl,_l);bl[t]=new yl(t,1,!1,e,null,!1)})),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach((function(e){var t=e.replace(xl,_l);bl[t]=new yl(t,1,!1,e,"http://www.w3.org/1999/xlink",!1)})),["xml:base","xml:lang","xml:space"].forEach((function(e){var t=e.replace(xl,_l);bl[t]=new yl(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1)})),["tabIndex","crossOrigin"].forEach((function(e){bl[e]=new yl(e,1,!1,e.toLowerCase(),null,!1)})),bl.xlinkHref=new yl("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0),["src","href","action","formAction"].forEach((function(e){bl[e]=new yl(e,1,!1,e.toLowerCase(),null,!0)}));var wl=Iu.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function Tl(e,t,n,r){var i=bl.hasOwnProperty(t)?bl[t]:null;(null!==i?0===i.type:!r&&!(!(2=n.length))throw Error(ku(93));n=n[0]}t=n}null==t&&(t=""),n=t}e._wrapperState={initialValue:Vl(n)}}function ic(e,t){var n=Vl(t.value),r=Vl(t.defaultValue);null!=n&&((n=""+n)!==e.value&&(e.value=n),null==t.defaultValue&&e.defaultValue!==n&&(e.defaultValue=n)),null!=r&&(e.defaultValue=""+r)}function oc(e){var t=e.textContent;t===e._wrapperState.initialValue&&""!==t&&null!==t&&(e.value=t)}var ac="http://www.w3.org/1999/xhtml",sc="http://www.w3.org/2000/svg";function uc(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function lc(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?uc(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var cc,hc=function(e){return"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction((function(){return e(t,n)}))}:e}((function(e,t){if(e.namespaceURI!==sc||"innerHTML"in e)e.innerHTML=t;else{for((cc=cc||document.createElement("div")).innerHTML="",t=cc.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}}));function dc(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}function fc(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var pc={animationend:fc("Animation","AnimationEnd"),animationiteration:fc("Animation","AnimationIteration"),animationstart:fc("Animation","AnimationStart"),transitionend:fc("Transition","TransitionEnd")},vc={},mc={};function gc(e){if(vc[e])return vc[e];if(!pc[e])return e;var t,n=pc[e];for(t in n)if(n.hasOwnProperty(t)&&t in mc)return vc[e]=n[t];return e}Ku&&(mc=document.createElement("div").style,"AnimationEvent"in window||(delete pc.animationend.animation,delete pc.animationiteration.animation,delete pc.animationstart.animation),"TransitionEvent"in window||delete pc.transitionend.transition);var yc=gc("animationend"),bc=gc("animationiteration"),xc=gc("animationstart"),_c=gc("transitionend"),wc="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Tc=new("function"==typeof WeakMap?WeakMap:Map);function Mc(e){var t=Tc.get(e);return void 0===t&&(t=new Map,Tc.set(e,t)),t}function Ec(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{0!=(1026&(t=e).effectTag)&&(n=t.return),e=t.return}while(e)}return 3===t.tag?n:null}function Sc(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function Ac(e){if(Ec(e)!==e)throw Error(ku(188))}function Ic(e){if(e=function(e){var t=e.alternate;if(!t){if(null===(t=Ec(e)))throw Error(ku(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(null===i)break;var o=i.alternate;if(null===o){if(null!==(r=i.return)){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return Ac(i),e;if(o===r)return Ac(i),t;o=o.sibling}throw Error(ku(188))}if(n.return!==r.return)n=i,r=o;else{for(var a=!1,s=i.child;s;){if(s===n){a=!0,n=i,r=o;break}if(s===r){a=!0,r=i,n=o;break}s=s.sibling}if(!a){for(s=o.child;s;){if(s===n){a=!0,n=o,r=i;break}if(s===r){a=!0,r=o,n=i;break}s=s.sibling}if(!a)throw Error(ku(189))}}if(n.alternate!==r)throw Error(ku(190))}if(3!==n.tag)throw Error(ku(188));return n.stateNode.current===n?e:t}(e),!e)return null;for(var t=e;;){if(5===t.tag||6===t.tag)return t;if(t.child)t.child.return=t,t=t.child;else{if(t===e)break;for(;!t.sibling;){if(!t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}}return null}function Cc(e,t){if(null==t)throw Error(ku(30));return null==e?t:Array.isArray(e)?Array.isArray(t)?(e.push.apply(e,t),e):(e.push(t),e):Array.isArray(t)?[e].concat(t):[e,t]}function Nc(e,t,n){Array.isArray(e)?e.forEach(t,n):e&&t.call(n,e)}var kc=null;function Dc(e){if(e){var t=e._dispatchListeners,n=e._dispatchInstances;if(Array.isArray(t))for(var r=0;rLc.length&&Lc.push(e)}function Bc(e,t,n,r){if(Lc.length){var i=Lc.pop();return i.topLevelType=e,i.eventSystemFlags=r,i.nativeEvent=t,i.targetInst=n,i}return{topLevelType:e,eventSystemFlags:r,nativeEvent:t,targetInst:n,ancestors:[]}}function Uc(e){var t=e.targetInst,n=t;do{if(!n){e.ancestors.push(n);break}var r=n;if(3===r.tag)r=r.stateNode.containerInfo;else{for(;r.return;)r=r.return;r=3!==r.tag?null:r.stateNode.containerInfo}if(!r)break;5!==(t=n.tag)&&6!==t||e.ancestors.push(n),n=td(r)}while(n);for(n=0;n=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Lh(r)}}function Bh(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?Bh(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function Uh(){for(var e=window,t=Rh();t instanceof e.HTMLIFrameElement;){try{var n="string"==typeof t.contentWindow.location.href}catch(e){n=!1}if(!n)break;t=Rh((e=t.contentWindow).document)}return t}function Fh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}var zh="$?",Gh="$!",Hh=null,Vh=null;function Wh(e,t){switch(e){case"button":case"input":case"select":case"textarea":return!!t.autoFocus}return!1}function Yh(e,t){return"textarea"===e||"option"===e||"noscript"===e||"string"==typeof t.children||"number"==typeof t.children||"object"==_(t.dangerouslySetInnerHTML)&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var Xh="function"==typeof setTimeout?setTimeout:void 0,Qh="function"==typeof clearTimeout?clearTimeout:void 0;function Zh(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break}return e}function qh(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if("$"===n||n===Gh||n===zh){if(0===t)return e;t--}else"/$"===n&&t++}e=e.previousSibling}return null}var Jh=Math.random().toString(36).slice(2),Kh="__reactInternalInstance$"+Jh,$h="__reactEventHandlers$"+Jh,ed="__reactContainere$"+Jh;function td(e){var t=e[Kh];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ed]||n[Kh]){if(n=t.alternate,null!==t.child||null!==n&&null!==n.child)for(e=qh(e);null!==e;){if(n=e[Kh])return n;e=qh(e)}return t}n=(e=n).parentNode}return null}function nd(e){return!(e=e[Kh]||e[ed])||5!==e.tag&&6!==e.tag&&13!==e.tag&&3!==e.tag?null:e}function rd(e){if(5===e.tag||6===e.tag)return e.stateNode;throw Error(ku(33))}function id(e){return e[$h]||null}function od(e){do{e=e.return}while(e&&5!==e.tag);return e||null}function ad(e,t){var n=e.stateNode;if(!n)return null;var r=Uu(n);if(!r)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(r=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!r;break e;default:e=!1}if(e)return null;if(n&&"function"!=typeof n)throw Error(ku(231,t,_(n)));return n}function sd(e,t,n){(t=ad(e,n.dispatchConfig.phasedRegistrationNames[t]))&&(n._dispatchListeners=Cc(n._dispatchListeners,t),n._dispatchInstances=Cc(n._dispatchInstances,e))}function ud(e){if(e&&e.dispatchConfig.phasedRegistrationNames){for(var t=e._targetInst,n=[];t;)n.push(t),t=od(t);for(t=n.length;0this.eventPool.length&&this.eventPool.push(e)}function _d(e){e.eventPool=[],e.getPooled=bd,e.release=xd}Cu(yd.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=md)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=md)},persist:function(){this.isPersistent=md},isPersistent:gd,destructor:function(){var e,t=this.constructor.Interface;for(e in t)this[e]=null;this.nativeEvent=this._targetInst=this.dispatchConfig=null,this.isPropagationStopped=this.isDefaultPrevented=gd,this._dispatchInstances=this._dispatchListeners=null}}),yd.Interface={type:null,target:null,currentTarget:function(){return null},eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null},yd.extend=function(e){function t(){}function n(){return r.apply(this,arguments)}var r=this;t.prototype=r.prototype;var i=new t;return Cu(i,n.prototype),n.prototype=i,n.prototype.constructor=n,n.Interface=Cu({},r.Interface,e),n.extend=r.extend,_d(n),n},_d(yd);var wd=yd.extend({data:null}),Td=yd.extend({data:null}),Md=[9,13,27,32],Ed=Ku&&"CompositionEvent"in window,Sd=null;Ku&&"documentMode"in document&&(Sd=document.documentMode);var Ad=Ku&&"TextEvent"in window&&!Sd,Id=Ku&&(!Ed||Sd&&8=Sd),Cd=String.fromCharCode(32),Nd={beforeInput:{phasedRegistrationNames:{bubbled:"onBeforeInput",captured:"onBeforeInputCapture"},dependencies:["compositionend","keypress","textInput","paste"]},compositionEnd:{phasedRegistrationNames:{bubbled:"onCompositionEnd",captured:"onCompositionEndCapture"},dependencies:"blur compositionend keydown keypress keyup mousedown".split(" ")},compositionStart:{phasedRegistrationNames:{bubbled:"onCompositionStart",captured:"onCompositionStartCapture"},dependencies:"blur compositionstart keydown keypress keyup mousedown".split(" ")},compositionUpdate:{phasedRegistrationNames:{bubbled:"onCompositionUpdate",captured:"onCompositionUpdateCapture"},dependencies:"blur compositionupdate keydown keypress keyup mousedown".split(" ")}},kd=!1;function Dd(e,t){switch(e){case"keyup":return-1!==Md.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"blur":return!0;default:return!1}}function Pd(e){return"object"==_(e=e.detail)&&"data"in e?e.data:null}var Od=!1;var Rd={eventTypes:Nd,extractEvents:function(e,t,n,r){var i;if(Ed)e:{switch(e){case"compositionstart":var o=Nd.compositionStart;break e;case"compositionend":o=Nd.compositionEnd;break e;case"compositionupdate":o=Nd.compositionUpdate;break e}o=void 0}else Od?Dd(e,n)&&(o=Nd.compositionEnd):"keydown"===e&&229===n.keyCode&&(o=Nd.compositionStart);return o?(Id&&"ko"!==n.locale&&(Od||o!==Nd.compositionStart?o===Nd.compositionEnd&&Od&&(i=vd()):(fd="value"in(dd=r)?dd.value:dd.textContent,Od=!0)),o=wd.getPooled(o,t,n,r),i?o.data=i:null!==(i=Pd(n))&&(o.data=i),hd(o),i=o):i=null,(e=Ad?function(e,t){switch(e){case"compositionend":return Pd(t);case"keypress":return 32!==t.which?null:(kd=!0,Cd);case"textInput":return(e=t.data)===Cd&&kd?null:e;default:return null}}(e,n):function(e,t){if(Od)return"compositionend"===e||!Ed&&Dd(e,t)?(e=vd(),pd=fd=dd=null,Od=!1,e):null;switch(e){case"paste":default:return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=document.documentMode,mf={select:{phasedRegistrationNames:{bubbled:"onSelect",captured:"onSelectCapture"},dependencies:"blur contextmenu dragend focus keydown keyup mousedown mouseup selectionchange".split(" ")}},gf=null,yf=null,bf=null,xf=!1;function _f(e,t){var n=t.window===t?t.document:9===t.nodeType?t:t.ownerDocument;return xf||null==gf||gf!==Rh(n)?null:("selectionStart"in(n=gf)&&Fh(n)?n={start:n.selectionStart,end:n.selectionEnd}:n={anchorNode:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset},bf&&pf(bf,n)?null:(bf=n,(e=yd.getPooled(mf.select,yf,e,t)).type="select",e.target=gf,hd(e),e))}var wf={eventTypes:mf,extractEvents:function(e,t,n,r,i,o){if(!(o=!(i=o||(r.window===r?r.document:9===r.nodeType?r:r.ownerDocument)))){e:{i=Mc(i),o=qu.onSelect;for(var a=0;aLf||(e.current=Rf[Lf],Rf[Lf]=null,Lf--)}function Bf(e,t){Lf++,Rf[Lf]=e.current,e.current=t}var Uf={},Ff={current:Uf},zf={current:!1},Gf=Uf;function Hf(e,t){var n=e.type.contextTypes;if(!n)return Uf;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i,o={};for(i in n)o[i]=t[i];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function Vf(e){return null!=(e=e.childContextTypes)}function Wf(){jf(zf),jf(Ff)}function Yf(e,t,n){if(Ff.current!==Uf)throw Error(ku(168));Bf(Ff,t),Bf(zf,n)}function Xf(e,t,n){var r=e.stateNode;if(e=t.childContextTypes,"function"!=typeof r.getChildContext)return n;for(var i in r=r.getChildContext())if(!(i in e))throw Error(ku(108,Gl(t)||"Unknown",i));return Cu({},n,{},r)}function Qf(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Uf,Gf=Ff.current,Bf(Ff,e),Bf(zf,zf.current),!0}function Zf(e,t,n){var r=e.stateNode;if(!r)throw Error(ku(169));n?(e=Xf(e,t,Gf),r.__reactInternalMemoizedMergedChildContext=e,jf(zf),jf(Ff),Bf(Ff,e)):jf(zf),Bf(zf,n)}var qf=Nu.unstable_runWithPriority,Jf=Nu.unstable_scheduleCallback,Kf=Nu.unstable_cancelCallback,$f=Nu.unstable_requestPaint,ep=Nu.unstable_now,tp=Nu.unstable_getCurrentPriorityLevel,np=Nu.unstable_ImmediatePriority,rp=Nu.unstable_UserBlockingPriority,ip=Nu.unstable_NormalPriority,op=Nu.unstable_LowPriority,ap=Nu.unstable_IdlePriority,sp={},up=Nu.unstable_shouldYield,lp=void 0!==$f?$f:function(){},cp=null,hp=null,dp=!1,fp=ep(),pp=1e4>fp?ep:function(){return ep()-fp};function vp(){switch(tp()){case np:return 99;case rp:return 98;case ip:return 97;case op:return 96;case ap:return 95;default:throw Error(ku(332))}}function mp(e){switch(e){case 99:return np;case 98:return rp;case 97:return ip;case 96:return op;case 95:return ap;default:throw Error(ku(332))}}function gp(e,t){return e=mp(e),qf(e,t)}function yp(e,t,n){return e=mp(e),Jf(e,t,n)}function bp(e){return null===cp?(cp=[e],hp=Jf(np,_p)):cp.push(e),sp}function xp(){if(null!==hp){var e=hp;hp=null,Kf(e)}_p()}function _p(){if(!dp&&null!==cp){dp=!0;var e=0;try{var t=cp;gp(99,(function(){for(;e=t&&(im=!0),e.firstContext=null)}function Dp(e,t){if(Ap!==e&&!1!==t&&0!==t)if(("number"!=typeof t||1073741823===t)&&(Ap=e,t=1073741823),t={context:e,observedBits:t,next:null},null===Sp){if(null===Ep)throw Error(ku(308));Sp=t,Ep.dependencies={expirationTime:0,firstContext:t,responders:null}}else Sp=Sp.next=t;return e._currentValue}var Pp=!1;function Op(e){e.updateQueue={baseState:e.memoizedState,baseQueue:null,shared:{pending:null},effects:null}}function Rp(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,baseQueue:e.baseQueue,shared:e.shared,effects:e.effects})}function Lp(e,t){return(e={expirationTime:e,suspenseConfig:t,tag:0,payload:null,callback:null,next:null}).next=e}function jp(e,t){if(null!==(e=e.updateQueue)){var n=(e=e.shared).pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}}function Bp(e,t){var n=e.alternate;null!==n&&Rp(n,e),null===(n=(e=e.updateQueue).baseQueue)?(e.baseQueue=t.next=t,t.next=t):(t.next=n.next,n.next=t)}function Up(e,t,n,r){var i=e.updateQueue;Pp=!1;var o=i.baseQueue,a=i.shared.pending;if(null!==a){if(null!==o){var s=o.next;o.next=a.next,a.next=s}o=a,i.shared.pending=null,null!==(s=e.alternate)&&(null!==(s=s.updateQueue)&&(s.baseQueue=a))}if(null!==o){s=o.next;var u=i.baseState,l=0,c=null,h=null,d=null;if(null!==s)for(var f=s;;){if((a=f.expirationTime)l&&(l=a)}else{null!==d&&(d=d.next={expirationTime:1073741823,suspenseConfig:f.suspenseConfig,tag:f.tag,payload:f.payload,callback:f.callback,next:null}),jg(a,f.suspenseConfig);e:{var v=e,m=f;switch(a=t,p=n,m.tag){case 1:if("function"==typeof(v=m.payload)){u=v.call(p,u,a);break e}u=v;break e;case 3:v.effectTag=-4097&v.effectTag|64;case 0:if(null==(a="function"==typeof(v=m.payload)?v.call(p,u,a):v))break e;u=Cu({},u,a);break e;case 2:Pp=!0}}null!==f.callback&&(e.effectTag|=32,null===(a=i.effects)?i.effects=[f]:a.push(f))}if(null===(f=f.next)||f===s){if(null===(a=i.shared.pending))break;f=o.next=a.next,a.next=s,i.baseQueue=o=a,i.shared.pending=null}}null===d?c=u:d.next=h,i.baseState=c,i.baseQueue=d,Bg(l),e.expirationTime=l,e.memoizedState=u}}function Fp(e,t,n){if(e=t.effects,t.effects=null,null!==e)for(t=0;tv?(m=p,p=null):m=p.sibling;var g=d(i,p,s[v],u);if(null===g){null===p&&(p=m);break}e&&p&&null===g.alternate&&t(i,p),a=o(g,a,v),null===c?l=g:c.sibling=g,c=g,p=m}if(v===s.length)return n(i,p),l;if(null===p){for(;vv?(m=p,p=null):m=p.sibling;var y=d(i,p,g.value,u);if(null===y){null===p&&(p=m);break}e&&p&&null===y.alternate&&t(i,p),a=o(y,a,v),null===c?l=y:c.sibling=y,c=y,p=m}if(g.done)return n(i,p),l;if(null===p){for(;!g.done;v++,g=s.next())null!==(g=h(i,g.value,u))&&(a=o(g,a,v),null===c?l=g:c.sibling=g,c=g);return l}for(p=r(i,p);!g.done;v++,g=s.next())null!==(g=f(p,i,v,g.value,u))&&(e&&null!==g.alternate&&p.delete(null===g.key?v:g.key),a=o(g,a,v),null===c?l=g:c.sibling=g,c=g);return e&&p.forEach((function(e){return t(i,e)})),l}(s,u,l,c);if(v&&Jp(s,l),void 0===l&&!p)switch(s.tag){case 1:case 0:throw s=s.type,Error(ku(152,s.displayName||s.name||"Component"))}return n(s,u)}}var $p=Kp(!0),ev=Kp(!1),tv={},nv={current:tv},rv={current:tv},iv={current:tv};function ov(e){if(e===tv)throw Error(ku(174));return e}function av(e,t){switch(Bf(iv,t),Bf(rv,e),Bf(nv,tv),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:lc(null,"");break;default:t=lc(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}jf(nv),Bf(nv,t)}function sv(){jf(nv),jf(rv),jf(iv)}function uv(e){ov(iv.current);var t=ov(nv.current),n=lc(t,e.type);t!==n&&(Bf(rv,e),Bf(nv,n))}function lv(e){rv.current===e&&(jf(nv),jf(rv))}var cv={current:0};function hv(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||n.data===zh||n.data===Gh))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!=(64&t.effectTag))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}function dv(e,t){return{responder:e,props:t}}var fv=wl.ReactCurrentDispatcher,pv=wl.ReactCurrentBatchConfig,vv=0,mv=null,gv=null,yv=null,bv=!1;function xv(){throw Error(ku(321))}function _v(e,t){if(null===t)return!1;for(var n=0;no))throw Error(ku(301));o+=1,yv=gv=null,t.updateQueue=null,fv.current=Xv,e=n(r,i)}while(t.expirationTime===vv)}if(fv.current=Vv,t=null!==gv&&null!==gv.next,vv=0,yv=gv=mv=null,bv=!1,t)throw Error(ku(300));return e}function Tv(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===yv?mv.memoizedState=yv=e:yv=yv.next=e,yv}function Mv(){if(null===gv){var e=mv.alternate;e=null!==e?e.memoizedState:null}else e=gv.next;var t=null===yv?mv.memoizedState:yv.next;if(null!==t)yv=t,gv=e;else{if(null===e)throw Error(ku(310));e={memoizedState:(gv=e).memoizedState,baseState:gv.baseState,baseQueue:gv.baseQueue,queue:gv.queue,next:null},null===yv?mv.memoizedState=yv=e:yv=yv.next=e}return yv}function Ev(e,t){return"function"==typeof t?t(e):t}function Sv(e){var t=Mv(),n=t.queue;if(null===n)throw Error(ku(311));n.lastRenderedReducer=e;var r=gv,i=r.baseQueue,o=n.pending;if(null!==o){if(null!==i){var a=i.next;i.next=o.next,o.next=a}r.baseQueue=i=o,n.pending=null}if(null!==i){i=i.next,r=r.baseState;var s=a=o=null,u=i;do{var l=u.expirationTime;if(lmv.expirationTime&&(mv.expirationTime=l,Bg(l))}else null!==s&&(s=s.next={expirationTime:1073741823,suspenseConfig:u.suspenseConfig,action:u.action,eagerReducer:u.eagerReducer,eagerState:u.eagerState,next:null}),jg(l,u.suspenseConfig),r=u.eagerReducer===e?u.eagerState:e(r,u.action);u=u.next}while(null!==u&&u!==i);null===s?o=r:s.next=a,df(r,t.memoizedState)||(im=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=s,n.lastRenderedState=r}return[t.memoizedState,n.dispatch]}function Av(e){var t=Mv(),n=t.queue;if(null===n)throw Error(ku(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,o=t.memoizedState;if(null!==i){n.pending=null;var a=i=i.next;do{o=e(o,a.action),a=a.next}while(a!==i);df(o,t.memoizedState)||(im=!0),t.memoizedState=o,null===t.baseQueue&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Iv(e){var t=Tv();return"function"==typeof e&&(e=e()),t.memoizedState=t.baseState=e,e=(e=t.queue={pending:null,dispatch:null,lastRenderedReducer:Ev,lastRenderedState:e}).dispatch=Hv.bind(null,mv,e),[t.memoizedState,e]}function Cv(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},null===(t=mv.updateQueue)?(t={lastEffect:null},mv.updateQueue=t,t.lastEffect=e.next=e):null===(n=t.lastEffect)?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function Nv(){return Mv().memoizedState}function kv(e,t,n,r){var i=Tv();mv.effectTag|=e,i.memoizedState=Cv(1|t,n,void 0,void 0===r?null:r)}function Dv(e,t,n,r){var i=Mv();r=void 0===r?null:r;var o=void 0;if(null!==gv){var a=gv.memoizedState;if(o=a.destroy,null!==r&&_v(r,a.deps))return void Cv(t,n,o,r)}mv.effectTag|=e,i.memoizedState=Cv(1|t,n,o,r)}function Pv(e,t){return kv(516,4,e,t)}function Ov(e,t){return Dv(516,4,e,t)}function Rv(e,t){return Dv(4,2,e,t)}function Lv(e,t){return"function"==typeof t?(e=e(),t(e),function(){t(null)}):null!=t?(e=e(),t.current=e,function(){t.current=null}):void 0}function jv(e,t,n){return n=null!=n?n.concat([e]):null,Dv(4,2,Lv.bind(null,t,e),n)}function Bv(){}function Uv(e,t){return Tv().memoizedState=[e,void 0===t?null:t],e}function Fv(e,t){var n=Mv();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&_v(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function zv(e,t){var n=Mv();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&_v(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Gv(e,t,n){var r=vp();gp(98>r?98:r,(function(){e(!0)})),gp(97<\/script>",e=e.removeChild(e.firstChild)):"string"==typeof r.is?e=a.createElement(i,{is:r.is}):(e=a.createElement(i),"select"===i&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,i),e[Kh]=t,e[$h]=r,pm(e,t),t.stateNode=e,a=kh(i,r),i){case"iframe":case"object":case"embed":bh("load",e),s=r;break;case"video":case"audio":for(s=0;sr.tailExpiration&&1t)&&xg.set(e,t))}}function Ag(e,t){e.expirationTime=(e=n>(e=e.nextKnownPendingLevel)?n:e)&&t!==e?0:e}function Cg(e){if(0!==e.lastExpiredTime)e.callbackExpirationTime=1073741823,e.callbackPriority=99,e.callbackNode=bp(kg.bind(null,e));else{var t=Ig(e),n=e.callbackNode;if(0===t)null!==n&&(e.callbackNode=null,e.callbackExpirationTime=0,e.callbackPriority=90);else{var r=Mg();if(1073741823===t?r=99:1===t||2===t?r=95:r=0>=(r=10*(1073741821-t)-10*(1073741821-r))?99:250>=r?98:5250>=r?97:95,null!==n){var i=e.callbackPriority;if(e.callbackExpirationTime===t&&i>=r)return;n!==sp&&Kf(n)}e.callbackExpirationTime=t,e.callbackPriority=r,t=1073741823===t?bp(kg.bind(null,e)):yp(r,Ng.bind(null,e),{timeout:10*(1073741821-t)-pp()}),e.callbackNode=t}}}function Ng(e,t){if(Tg=0,t)return fy(e,t=Mg()),Cg(e),null;var n=Ig(e);if(0!==n){if(t=e.callbackNode,0!=(48&tg))throw Error(ku(327));if(Xg(),e===ng&&n===ig||Og(e,n),null!==rg){var r=tg;tg|=qm;for(var i=Lg();;)try{Fg();break}catch(t){Rg(e,t)}if(Ip(),tg=r,Qm.current=i,1===og)throw t=ag,Og(e,n),hy(e,n),Cg(e),t;if(null===rg)switch(i=e.finishedWork=e.current.alternate,e.finishedExpirationTime=n,r=og,ng=null,r){case Km:case 1:throw Error(ku(345));case 2:fy(e,2=n){e.lastPingedTime=n,Og(e,n);break}}if(0!==(o=Ig(e))&&o!==n)break;if(0!==r&&r!==n){e.lastPingedTime=r;break}e.timeoutHandle=Xh(Vg.bind(null,e),i);break}Vg(e);break;case eg:if(hy(e,n),n===(r=e.lastSuspendedTime)&&(e.nextKnownPendingLevel=Hg(i)),hg&&(0===(i=e.lastPingedTime)||i>=n)){e.lastPingedTime=n,Og(e,n);break}if(0!==(i=Ig(e))&&i!==n)break;if(0!==r&&r!==n){e.lastPingedTime=r;break}if(1073741823!==ug?r=10*(1073741821-ug)-pp():1073741823===sg?r=0:(r=10*(1073741821-sg)-5e3,0>(r=(i=pp())-r)&&(r=0),(n=10*(1073741821-n)-i)<(r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Xm(r/1960))-r)&&(r=n)),10=(r=0|a.busyMinDurationMs)?r=0:(i=0|a.busyDelayMs,r=(o=pp()-(10*(1073741821-o)-(0|a.timeoutMs||5e3)))<=i?0:i+r-o),10 component higher in the tree to provide a loading indicator or placeholder to display."+Hl(a))}5!==og&&(og=2),s=Sm(s,a),h=o;do{switch(h.tag){case 3:u=s,h.effectTag|=4096,h.expirationTime=t,Bp(h,Vm(h,u,t));break e;case 1:u=s;var x=h.type,w=h.stateNode;if(0==(64&h.effectTag)&&("function"==typeof x.getDerivedStateFromError||null!==w&&"function"==typeof w.componentDidCatch&&(null===mg||!mg.has(w)))){h.effectTag|=4096,h.expirationTime=t,Bp(h,Wm(h,u,t));break e}}h=h.return}while(null!==h)}rg=Gg(rg)}catch(e){t=e;continue}break}}function Lg(){var e=Qm.current;return Qm.current=Vv,null===e?Vv:e}function jg(e,t){ecg&&(cg=e)}function Ug(){for(;null!==rg;)rg=zg(rg)}function Fg(){for(;null!==rg&&!up();)rg=zg(rg)}function zg(e){var t=Ym(e.alternate,e,ig);return e.memoizedProps=e.pendingProps,null===t&&(t=Gg(e)),Zm.current=null,t}function Gg(e){rg=e;do{var t=rg.alternate;if(e=rg.return,0==(2048&rg.effectTag)){if(t=Mm(t,rg,ig),1===ig||1!==rg.childExpirationTime){for(var n=0,r=rg.child;null!==r;){var i=r.expirationTime,o=r.childExpirationTime;i>n&&(n=i),o>n&&(n=o),r=r.sibling}rg.childExpirationTime=n}if(null!==t)return t;null!==e&&0==(2048&e.effectTag)&&(null===e.firstEffect&&(e.firstEffect=rg.firstEffect),null!==rg.lastEffect&&(null!==e.lastEffect&&(e.lastEffect.nextEffect=rg.firstEffect),e.lastEffect=rg.lastEffect),1(e=e.childExpirationTime)?t:e}function Vg(e){var t=vp();return gp(99,Wg.bind(null,e,t)),null}function Wg(e,t){do{Xg()}while(null!==yg);if(0!=(48&tg))throw Error(ku(327));var n=e.finishedWork,r=e.finishedExpirationTime;if(null===n)return null;if(e.finishedWork=null,e.finishedExpirationTime=0,n===e.current)throw Error(ku(177));e.callbackNode=null,e.callbackExpirationTime=0,e.callbackPriority=90,e.nextKnownPendingLevel=0;var i=Hg(n);if(e.firstPendingTime=i,r<=e.lastSuspendedTime?e.firstSuspendedTime=e.lastSuspendedTime=e.nextKnownPendingLevel=0:r<=e.firstSuspendedTime&&(e.firstSuspendedTime=r-1),r<=e.lastPingedTime&&(e.lastPingedTime=0),r<=e.lastExpiredTime&&(e.lastExpiredTime=0),e===ng&&(rg=ng=null,ig=0),1s&&(l=s,s=a,a=l),l=jh(b,a),c=jh(b,s),l&&c&&(1!==_.rangeCount||_.anchorNode!==l.node||_.anchorOffset!==l.offset||_.focusNode!==c.node||_.focusOffset!==c.offset)&&((x=x.createRange()).setStart(l.node,l.offset),_.removeAllRanges(),a>s?(_.addRange(x),_.extend(c.node,c.offset)):(x.setEnd(c.node,c.offset),_.addRange(x))))),x=[],_=b);_=_.parentNode;)1===_.nodeType&&x.push({element:_,left:_.scrollLeft,top:_.scrollTop});for("function"==typeof b.focus&&b.focus(),b=0;b=n?ym(e,t,n):(Bf(cv,1&cv.current),null!==(t=wm(e,t,n))?t.sibling:null);Bf(cv,1&cv.current);break;case 19:if(r=t.childExpirationTime>=n,0!=(64&e.effectTag)){if(r)return _m(e,t,n);t.effectTag|=64}if(null!==(i=t.memoizedState)&&(i.rendering=null,i.tail=null),Bf(cv,cv.current),!r)return null}return wm(e,t,n)}im=!1}}else im=!1;switch(t.expirationTime=0,t.tag){case 2:if(r=t.type,null!==e&&(e.alternate=null,t.alternate=null,t.effectTag|=2),e=t.pendingProps,i=Hf(t,Ff.current),kp(t,n),i=wv(null,t,r,e,i,n),t.effectTag|=1,"object"==_(i)&&null!==i&&"function"==typeof i.render&&void 0===i.$$typeof){if(t.tag=1,t.memoizedState=null,t.updateQueue=null,Vf(r)){var o=!0;Qf(t)}else o=!1;t.memoizedState=null!==i.state&&void 0!==i.state?i.state:null,Op(t);var a=r.getDerivedStateFromProps;"function"==typeof a&&Hp(t,r,a,e),i.updater=Vp,t.stateNode=i,i._reactInternalFiber=t,Qp(t,r,e,n),t=dm(null,t,r,!0,o,n)}else t.tag=0,om(null,t,i,n),t=t.child;return t;case 16:e:{if(i=t.elementType,null!==e&&(e.alternate=null,t.alternate=null,t.effectTag|=2),e=t.pendingProps,function(e){if(-1===e._status){e._status=0;var t=e._ctor;t=t(),e._result=t,t.then((function(t){0===e._status&&(t=t.default,e._status=1,e._result=t)}),(function(t){0===e._status&&(e._status=2,e._result=t)}))}}(i),1!==i._status)throw i._result;switch(i=i._result,t.type=i,o=t.tag=function(e){if("function"==typeof e)return ry(e)?1:0;if(null!=e){if((e=e.$$typeof)===Ol)return 11;if(e===jl)return 14}return 2}(i),e=Tp(i,e),o){case 0:t=cm(null,t,i,e,n);break e;case 1:t=hm(null,t,i,e,n);break e;case 11:t=am(null,t,i,e,n);break e;case 14:t=sm(null,t,i,Tp(i.type,e),r,n);break e}throw Error(ku(306,i,""))}return t;case 0:return r=t.type,i=t.pendingProps,cm(e,t,r,i=t.elementType===r?i:Tp(r,i),n);case 1:return r=t.type,i=t.pendingProps,hm(e,t,r,i=t.elementType===r?i:Tp(r,i),n);case 3:if(fm(t),r=t.updateQueue,null===e||null===r)throw Error(ku(282));if(r=t.pendingProps,i=null!==(i=t.memoizedState)?i.element:null,Rp(e,t),Up(t,r,null,n),(r=t.memoizedState.element)===i)nm(),t=wm(e,t,n);else{if((i=t.stateNode.hydrate)&&(Zv=Zh(t.stateNode.containerInfo.firstChild),Qv=t,i=qv=!0),i)for(n=ev(t,null,r,n),t.child=n;n;)n.effectTag=-3&n.effectTag|1024,n=n.sibling;else om(e,t,r,n),nm();t=t.child}return t;case 5:return uv(t),null===e&&$v(t),r=t.type,i=t.pendingProps,o=null!==e?e.memoizedProps:null,a=i.children,Yh(r,i)?a=null:null!==o&&Yh(r,o)&&(t.effectTag|=16),lm(e,t),4&t.mode&&1!==n&&i.hidden?(t.expirationTime=t.childExpirationTime=1,t=null):(om(e,t,a,n),t=t.child),t;case 6:return null===e&&$v(t),null;case 13:return ym(e,t,n);case 4:return av(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=$p(t,null,r,n):om(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,am(e,t,r,i=t.elementType===r?i:Tp(r,i),n);case 7:return om(e,t,t.pendingProps,n),t.child;case 8:case 12:return om(e,t,t.pendingProps.children,n),t.child;case 10:e:{r=t.type._context,i=t.pendingProps,a=t.memoizedProps,o=i.value;var s=t.type._context;if(Bf(Mp,s._currentValue),s._currentValue=o,null!==a)if(s=a.value,0===(o=df(s,o)?0:0|("function"==typeof r._calculateChangedBits?r._calculateChangedBits(s,o):1073741823))){if(a.children===i.children&&!zf.current){t=wm(e,t,n);break e}}else for(null!==(s=t.child)&&(s.return=t);null!==s;){var u=s.dependencies;if(null!==u){a=s.child;for(var l=u.firstContext;null!==l;){if(l.context===r&&0!=(l.observedBits&o)){1===s.tag&&((l=Lp(n,null)).tag=2,jp(s,l)),s.expirationTime=t&&e<=t}function hy(e,t){var n=e.firstSuspendedTime,r=e.lastSuspendedTime;nt||0===n)&&(e.lastSuspendedTime=t),t<=e.lastPingedTime&&(e.lastPingedTime=0),t<=e.lastExpiredTime&&(e.lastExpiredTime=0)}function dy(e,t){t>e.firstPendingTime&&(e.firstPendingTime=t);var n=e.firstSuspendedTime;0!==n&&(t>=n?e.firstSuspendedTime=e.lastSuspendedTime=e.nextKnownPendingLevel=0:t>=e.lastSuspendedTime&&(e.lastSuspendedTime=t+1),t>e.nextKnownPendingLevel&&(e.nextKnownPendingLevel=t))}function fy(e,t){var n=e.lastExpiredTime;(0===n||n>t)&&(e.lastExpiredTime=t)}function py(e,t,n,r){var i=t.current,o=Mg(),a=zp.suspense;o=Eg(o,i,a);e:if(n){t:{if(Ec(n=n._reactInternalFiber)!==n||1!==n.tag)throw Error(ku(170));var s=n;do{switch(s.tag){case 3:s=s.stateNode.context;break t;case 1:if(Vf(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break t}}s=s.return}while(null!==s);throw Error(ku(171))}if(1===n.tag){var u=n.type;if(Vf(u)){n=Xf(n,u,s);break e}}n=s}else n=Uf;return null===t.context?t.context=n:t.pendingContext=n,(t=Lp(o,a)).payload={element:e},null!==(r=void 0===r?null:r)&&(t.callback=r),jp(i,t),Sg(i,o),o}function vy(e){return(e=e.current).child?(e.child.tag,e.child.stateNode):null}function my(e,t){null!==(e=e.memoizedState)&&null!==e.dehydrated&&e.retryTime=t||n<0||h&&e-l>=o}function m(){var e,n,r=rb();if(v(r))return g(r);s=setTimeout(m,(n=t-((e=r)-u),h?ob(n,o-(e-l)):n))}function g(e){return s=void 0,d&&r?f(e):(r=i=void 0,a)}function y(){var e=rb(),n=v(e);if(r=arguments,i=this,u=e,n){if(void 0===s)return p(u);if(h)return clearTimeout(s),s=setTimeout(m,t),f(u)}return void 0===s&&(s=setTimeout(m,t)),a}return t=nb(t)||0,Jy(n)&&(c=!!n.leading,o=(h="maxWait"in n)?ib(nb(n.maxWait)||0,t):o,d="trailing"in n?!!n.trailing:d),y.cancel=function(){void 0!==s&&clearTimeout(s),l=0,r=u=i=s=void 0},y.flush=function(){return void 0===s?a:g(rb())},y}var sb=function(e){s(n,e);var t=u(n);function n(e){var r;return y(this,n),(r=t.call(this,e)).seeking=!1,r.mobileSeeking=!1,r.track=null,r.hoverTime=null,r.offset=0,r.secondsPrefix="00:00:",r.minutesPrefix="00:",r.seekPause=!1,r.handleTouchSeeking=function(e){for(var t=0,n=0;nthis.state.trackWidth&&(e=this.state.trackWidth-this.hoverTime.offsetWidth))),{transform:"translateX(".concat(e,"px)")}}},{key:"secondsToTime",value:function(e){e=Math.round(e+this.offset);var t=Math.floor(e/3600),n=e%3600,r=Math.floor(n/60),i=Math.ceil(n%60);return{hh:t.toString(),mm:r<10?"0"+r:r.toString(),ss:i<10?"0"+i:i.toString()}}},{key:"getHoverTime",value:function(){var e=100*this.state.seekHoverPosition/this.state.trackWidth,t=Math.floor(+e*(this.props.total/100)),n=this.secondsToTime(t);return this.props.total+this.offset<60?this.secondsPrefix+n.ss:this.props.total+this.offset<3600?this.minutesPrefix+n.mm+":"+n.ss:n.hh+":"+n.mm+":"+n.ss}},{key:"isThumbActive",value:function(){return this.state.seekHoverPosition>0||this.seeking}},{key:"drawHoverTime",value:function(){var e=this;return this.props.hideHoverTime?null:ln.createElement("div",{className:this.isThumbActive()?"hover-time active":"hover-time",style:this.getHoverTimePosition(),ref:function(t){return e.hoverTime=t}},this.getHoverTime())}},{key:"render",value:function(){var e=this;return ln.createElement("div",{className:"seek-slider"},ln.createElement("div",{className:"track",ref:function(t){return e.track=t},onMouseMove:function(t){return e.handleTrackHover(!1,t)},onMouseLeave:function(t){return e.handleTrackHover(!0,t)},onMouseDown:this.onMouseDown,onTouchStart:function(t){e.setMobileSeeking(!0),e.onMouseDown(t)},onMouseUp:this.onMouseUp,onTouchEnd:this.onMouseUp},ln.createElement("div",{className:"main"},this.renderBufferProgress(),this.renderHoverProgress(),this.renderProgress())),this.drawHoverTime(),this.renderThumb())}}]),n}(mt.exports.Component),ub=function(e){s(n,e);var t=u(n);function n(e){var r;return y(this,n),(r=t.call(this,e)).stageVolume=0,r.updateVolumeTimer=0,r.onVolumeSeeking=!1,r.onClickOperationButton=function(){r.props.paused?r.props.play():r.props.pause()},r.operationButton=function(){return r.props.paused?ln.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNOCA1LjE0djE0bDExLTdsLTExLTd6IiBmaWxsPSIjZmZmIj48L3BhdGg+PC9zdmc+Cg=="}):ln.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMTQgMTloNFY1aC00TTYgMTloNFY1SDZ2MTR6IiBmaWxsPSIjZmZmIj48L3BhdGg+PC9zdmc+Cg=="})},r.operationVolumeButton=function(){return r.props.volume>.9?ln.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMTQgMy4yM3YyLjA2YzIuODkuODYgNSAzLjU0IDUgNi43MXMtMi4xMSA1Ljg0LTUgNi43djIuMDdjNC0uOTEgNy00LjQ5IDctOC43N2MwLTQuMjgtMy03Ljg2LTctOC43N00xNi41IDEyYzAtMS43Ny0xLTMuMjktMi41LTQuMDNWMTZjMS41LS43MSAyLjUtMi4yNCAyLjUtNE0zIDl2Nmg0bDUgNVY0TDcgOUgzeiIgZmlsbD0iI2ZmZiI+PC9wYXRoPjwvc3ZnPgo="}):0===r.props.volume?ln.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNNyA5djZoNGw1IDVWNGwtNSA1SDd6IiBmaWxsPSIjZmZmIj48L3BhdGg+PC9zdmc+Cg=="}):ln.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNNSA5djZoNGw1IDVWNEw5IDltOS41IDNjMC0xLjc3LTEtMy4yOS0yLjUtNC4wM1YxNmMxLjUtLjcxIDIuNS0yLjI0IDIuNS00eiIgZmlsbD0iI2ZmZiI+PC9wYXRoPjwvc3ZnPgo="})},r.handleClickVolume=function(){0===r.props.volume?0!==r.stageVolume?r.props.setVolume(r.stageVolume):r.props.setVolume(1):(r.stageVolume=r.props.volume,r.props.setVolume(0))},r.onChange=function(e){r.setState({currentTime:e}),e&&r.changeTime(e)},r.changeTime=ab((function(e){r.props.setCurrentTime(e)}),50),r.onVolumeChange=function(e){r.changeVolume(e),r.setState({seekVolume:e/100})},r.changeVolume=ab((function(e){r.props.setVolume(e/100)}),50),r.onVolumeSeekStart=function(){r.onVolumeSeeking=!0},r.onVolumeSeekEnd=ab((function(){r.onVolumeSeeking=!1}),500),r.onProgressSeekStart=function(){return r.setState({isPlayerSeeking:!0})},r.onProgressSeekEnd=ab((function(){r.setState({isPlayerSeeking:!1})}),500),r.state={isPlayerSeeking:!1,isVolumeHover:!1,seekVolume:1,visible:!0,currentTime:0},r.stageVolume=e.volume,r}return x(n,[{key:"componentDidMount",value:function(){var e=this;this.updateVolumeTimer=setInterval((function(){e.onVolumeSeeking||e.setState({seekVolume:e.props.volume}),e.state.isPlayerSeeking||e.setState({currentTime:e.props.currentTime})}),100)}},{key:"componentWillUnmount",value:function(){this.updateVolumeTimer&&clearInterval(this.updateVolumeTimer)}},{key:"render",value:function(){var e=this,t=this.props,n=t.duration,r=t.currentTime;return ln.createElement("div",{className:"player-controller",style:{opacity:this.props.visible?"1":"0"}},ln.createElement("div",{className:"player-controller-progress"},ln.createElement(sb,{total:n,current:this.state.currentTime,onChange:this.onChange,buffered:this.props.buffered,bufferColor:"rgba(255,255,255,0.3)",hideHoverTime:!0,limitTimeTooltipBySides:!0,onSeekStart:this.onProgressSeekStart,onSeekEnd:this.onProgressSeekEnd,play:this.props.play,pause:this.props.pause,paused:this.props.paused,scale:this.props.scale})),ln.createElement("div",{className:"player-controller-actions"},ln.createElement("div",{className:"player-controller-actions-left"},ln.createElement("div",{onClick:this.onClickOperationButton,className:"player-controller-play"},this.operationButton()),ln.createElement("div",{className:"player-volume-box",onMouseEnter:function(){return e.setState({isVolumeHover:!0})},onMouseLeave:function(){return e.setState({isVolumeHover:!1})}},ln.createElement("div",{onClick:this.handleClickVolume,className:"player-volume"},this.operationVolumeButton()),ln.createElement("div",{className:"player-volume-slider"},ln.createElement(sb,{total:100,current:100*this.state.seekVolume,onChange:this.onVolumeChange,onSeekStart:this.onVolumeSeekStart,onSeekEnd:this.onVolumeSeekEnd,scale:this.props.scale,limitTimeTooltipBySides:!0,hideHoverTime:!0})))),ln.createElement("div",{className:"player-mid-box-time"},lb(Math.floor(r/1e3))," /"," ",lb(Math.floor(n/1e3)))))}}]),n}(mt.exports.Component);function lb(e){var t=e%60,n=(e-t)/60;if(n>=60){var r=n%60;return"".concat(cb((n-r)/60),":").concat(cb(r),":").concat(cb(t))}return"".concat(cb(n),":").concat(cb(t))}function cb(e){return e<=9?"0".concat(e):"".concat(e)}var hb=function(e){s(n,e);var t=u(n);function n(){var e;return y(this,n),(e=t.apply(this,arguments)).putAttributes=function(t){var n=e.props.context,r=n.getAttributes()||{};for(var i in t)r[i]!==t[i]&&n.updateAttributes([i],t[i])},e}return x(n,[{key:"render",value:function(){var e=this.props.context,t=e.getRoom(),n=t?void 0:e.getDisplayer(),r=this.putAttributes;return ln.createElement(db,{room:t,player:n,context:e,plugin:{putAttributes:r}})}}]),n}(mt.exports.Component),db=function(e){s(n,e);var t=u(n);function n(e){var r;return y(this,n),(r=t.call(this,e)).alertMask=null,r.container=ln.createRef(),r.controllerHiddenTimer=0,r.syncPlayerTimer=0,r.retryCount=0,r.decreaseRetryTimer=0,r.noSoundSyncCount=0,r.showController=function(){r.setState({controllerVisible:!0}),r.debounceHidingController()},r.play=function(){var e,t=null==(e=r.props.room)?void 0:e.calibrationTimestamp;r.debug(">>> play",{paused:!1,hostTime:t}),r.isEnabled()&&r.props.plugin.putAttributes({paused:!1,hostTime:t})},r.pause=function(){var e=Ly(r.getAttributes(),r.props);r.debug(">>> pause",{paused:!0,currentTime:e}),r.isEnabled()&&r.props.plugin.putAttributes({paused:!0,currentTime:e})},r.setVolume=function(e){r.debug(">>> volume",{volume:e}),r.isEnabled()&&r.props.plugin.putAttributes({volume:e}),r.isEnabled()&&r.props.plugin.putAttributes({volume:e,muted:0===e})},r.setCurrentTime=function(e){var t,n=null==(t=r.props.room)?void 0:t.calibrationTimestamp;r.debug(">>> seek",{currentTime:e/1e3,hostTime:n}),r.isEnabled()&&r.props.plugin.putAttributes({currentTime:e/1e3,hostTime:n})},r.resetPlayer=function(){var e;null==(e=r.player)||e.autoplay(!1),r.state.NoSound||(r.debug(">>> ended",{paused:!0,currentTime:0}),r.isEnabled()&&r.props.plugin.putAttributes({paused:!0,currentTime:0}))},r.syncPlayerWithAttributes=function(){var e,t=r.getAttributes();if(t){var n=r.player;if(n&&(!r.state.NoSound||(r.noSoundSyncCount+=1)%8==0)){n.paused()!==t.paused&&(r.debug("<<< paused -> %o",t.paused),t.paused?n.pause():null==(e=n.play())||e.catch(r.catchPlayFail)),n.muted()!==t.muted&&(r.debug("<<< muted -> %o",t.muted),n.muted(t.muted)),n.volume()!==t.volume&&(r.debug("<<< volume -> %o",t.volume),n.volume(t.volume));var i=Ly(t,r.props),o=Ry.currentTimeMaxError;r.state.NoSound&&(o*=3),i>n.duration()?r.resetPlayer():Math.abs(n.currentTime()-i)>o&&(r.debug("<<< currentTime -> %o",i),n.currentTime(i))}}},r.debounceHidingController=function(){r.controllerHiddenTimer&&(clearTimeout(r.controllerHiddenTimer),r.controllerHiddenTimer=0),r.controllerHiddenTimer=setTimeout((function(){r.setState({controllerVisible:!1}),r.controllerHiddenTimer=0}),3e3)},r.decreaseRetryCount=function(){r.player&&r.retryCount>0&&(r.retryCount=r.retryCount-1)},r.catchPlayFail=function(e){var t,n,i=String(e);if(jy&&i.includes("NotAllowedError")||i.includes("interact"))null==(t=r.player)||t.autoplay("any"),r.setState({NoSound:!0});else{var o=null==(n=r.player)?void 0:n.error();o&&(r.retryCount<=3?(r.initPlayer(),r.retryCount=r.retryCount+1):(r.debug("catch videojs media error",o),r.setState({MediaError:!0}))),r.debug("catch error",e)}},r.fixPlayFail=function(){r.debug("try to fix play state"),r.setState({NoSound:!1});var e=r.getAttributes(),t=e.muted,n=e.volume;r.player&&(r.player.muted(t),r.player.volume(n))},r.initPlayer=g(regeneratorRuntime.mark((function e(){var t,n,i,o,a,s,u,l,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return null==(t=r.player)||t.dispose(),r.player=void 0,r.debug("creating elements ..."),n=r.getAttributes(),i=n.type,o=n.src,a=n.poster,(s=document.createElement("div")).setAttribute("data-vjs-player",""),(u=document.createElement("video")).className="video-js",a&&(u.poster=a),u.setAttribute("playsInline",""),u.setAttribute("webkit-playsinline",""),l=document.createElement("source"),new URL(o).pathname.endsWith(".m3u8")?l.type="application/x-mpegURL":u.src=o,l.src=o,i&&(l.type=i),u.appendChild(l),s.appendChild(u),r.container.current.appendChild(s),e.next=14,new Promise((function(e){return(window.requestAnimationFrame||window.setTimeout)(e)}));case 14:r.debug("initializing videojs() ..."),c=Z.default(u),r.player=c,window.player=c,c.one("loadedmetadata",r.gracefullyUpdate),c.on("ready",(function(){var e;null==(e=Ry.onPlayer)||e.call(Ry,c),c.on("timeupdate",r.gracefullyUpdate),c.on("volumechange",r.gracefullyUpdate),c.on("seeked",r.gracefullyUpdate),c.on("play",r.gracefullyUpdate),c.on("pause",r.gracefullyUpdate),c.on("ended",r.resetPlayer)})),c.on("error",r.catchPlayFail),r.setState({MediaError:!1});case 17:case"end":return e.stop()}}),e)}))),r.gracefullyUpdate=function(){return r.setState({updater:!r.state.updater})},r.setupAlert=function(e){e&&(e.addEventListener("touchstart",r.fixPlayFail),e.addEventListener("click",r.fixPlayFail)),r.alertMask=e},r.setupReload=function(e){e&&(e.addEventListener("touchstart",r.initPlayer),e.addEventListener("click",r.initPlayer))},r.state={NoSound:!1,MediaError:!1,updater:!1,controllerVisible:!1},e.room&&function(e){if(!e.calibrationTimestamp)throw new Error("@netless/app-media-player@0.1.0-alpha.5 requires white-web-sdk@^2.13.8 to work properly.")}(e.room),r}return x(n,[{key:"getAttributes",value:function(){var e=this.props.context.getAttributes();if(e){if(e=Dy(Dy({},Py),e),this.player){var t=Ly(e,this.props),n=this.player.duration();!e.paused&&t>n&&(r=Dy({},e),e=Sy(r,Ay({currentTime:0,paused:!0})),this.resetPlayer())}var r;return e}}},{key:"isShowingPoster",value:function(){var e=this.getAttributes();return!(null!=e&&e.src)||By.some((function(t){return e.src.endsWith(t)}))}},{key:"render",value:function(){var e,t;if(!this.props.room&&!this.props.player)return null;var n=this.getAttributes();if(!n)return null;var r=1e3*((null==(e=this.player)?void 0:e.duration())||1e3),i=(null==(t=this.player)?void 0:t.bufferedPercent())||0;return ln.createElement("div",{className:this.isEnabled()?"vjs-p":"vjs-p disabled",onMouseEnter:this.showController,onMouseMove:this.showController},ln.createElement("div",{className:"video-js-plugin-player",ref:this.container}),this.isShowingPoster()&&ln.createElement("div",{className:"video-js-plugin-poster"},n.poster&&ln.createElement("img",{src:n.poster,alt:"",draggable:!1})),ln.createElement(ub,{duration:r,volume:n.volume,setVolume:this.setVolume,paused:n.paused,play:this.play,pause:this.pause,currentTime:1e3*Ly(n,this.props),setCurrentTime:this.setCurrentTime,buffered:r*i,visible:!0}),this.state.NoSound&&ln.createElement("div",{ref:this.setupAlert,className:"videojs-plugin-muted-alert"}),this.state.MediaError&&ln.createElement("div",{className:"videojs-plugin-recovery-mode"},ln.createElement("button",{ref:this.setupReload},"Reload Player")))}},{key:"debug",value:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i0&&void 0!==arguments[0]?arguments[0]:B.AnimationMode.Immediately;if(this.inDisplaySceneDir){var t=this.attributes,n=t.width,r=void 0===n?1280:n,i=t.height,o=void 0===i?720:i,a=r?-r/2:0,s=o?-o/2:0;this.manager.moveCameraToContain({originX:a,originY:s,width:r,height:o,animationMode:e})}}},{key:"handleSetPage",value:function(e){if(!this.isReplay&&this.attributes.displaySceneDir){var t=e.payload,n=this.displayer,r=n.entireScenes()[this.attributes.displaySceneDir];if(!r||r.length!==t){var i=function(e,t){return new Array(e).fill(0).map((function(e,n){return t(n)}))}(t,(function(e){return{name:String(e+1)}}));n.putScenes(this.attributes.displaySceneDir,i),this.manager.setMainViewScenePath(this.attributes.displaySceneDir)}}}},{key:"listenIframe",value:function(t){var n=this;t.url&&this.iframe.src!==t.url&&(this.src_url_equal_anchor||(this.src_url_equal_anchor=document.createElement("a")),this.src_url_equal_anchor.href=t.url,this.src_url_equal_anchor.href!==this.iframe.src&&(this.iframe.src=t.url)),this.iframe.width="".concat(t.width,"px"),this.iframe.height="".concat(t.height,"px"),this.sideEffectManager.addEventListener(this.iframe,"load",(function(t){var r;n.postMessage({kind:"Init",payload:{attributes:n.attributes,roomState:null==(r=e.displayer)?void 0:r.state,currentPage:n.currentPage,observerId:n.displayer.observerId}}),e.emitter.emit("IframeLoad",t),n.sideEffectManager.addDisposer(e.emitter.on("Ready",(function(){var e;n.postMessage(null==(e=n.attributes.lastEvent)?void 0:e.payload)})),gb),n.computedStyleAndIframeDisplay()}),void 0,_b)}},{key:"listenDisplayerState",value:function(){var e=this;this.isReplay&&(this.displayer._phase===B.PlayerPhase.Playing&&this.computedStyleAndIframeDisplay(),this.sideEffectManager.add((function(){return e.displayer.callbacks.on("onPhaseChanged",e.onPhaseChangedListener),function(){return e.displayer.callbacks.off("onPhaseChanged",e.onPhaseChangedListener)}}),wb)),this.computedStyleAndIframeDisplay()}},{key:"computedStyleAndIframeDisplay",value:function(){this.computedStyle(this.displayer.state),this.computedIframeDisplay(this.displayer.state,this.attributes)}},{key:"listenDisplayerCallbacks",value:function(){this.displayer.callbacks.on(this.callbackName,this.stateChangeListener)}},{key:"computedStyle",value:function(e){var t=this.manager.cameraState,n=this.attributes.width||1280,r=this.attributes.height||720;if(this.iframe){var i=t.width,o=t.height,a=t.scale,s=t.centerX,u=t.centerY,l=this.rootRect||{x:0,y:0},c="".concat(i/2+l.x,"px"),h="".concat(o/2+l.y,"px"),d=-u*a+(o-r)/2*a,f=["position: absolute;","border: 0.1px solid rgba(0,0,0,0);","top: 0px;","left: 0px;","transform-origin: ".concat(c," ").concat(h,";"),"transform: translate(".concat(-s*a+(i-n)/2*a,"px,").concat(d,"px) scale(").concat(a,", ").concat(a,");")];this.cssList=f,this.computedZindex(),this.updateStyle()}}},{key:"computedIframeDisplay",value:function(t,n){this.inDisplaySceneDir?e.emitter.emit("DispayIframe"):e.emitter.emit("HideIframe")}},{key:"computedZindex",value:function(){var e="z-index: -1;",t=this.cssList.findIndex((function(t){return t===e}));-1!==t&&this.cssList.splice(t,1),(!this.isClicker()||this.isDisableInput)&&this.cssList.push(e)}},{key:"updateStyle",value:function(){this.iframe.style.cssText=this.cssList.join(" ")}},{key:"messageListener",value:function(e){if(tt("<<<",JSON.stringify(e.data)),e.origin===this.iframeOrigin){var t=e.data;switch(t.kind){case"SetAttributes":this.handleSetAttributes(t);break;case"RegisterMagixEvent":this.handleRegisterMagixEvent(t);break;case"RemoveMagixEvent":this.handleRemoveMagixEvent(t);break;case"DispatchMagixEvent":this.handleDispatchMagixEvent(t);break;case"RemoveAllMagixEvent":this.handleRemoveAllMagixEvent();break;case"NextPage":this.handleNextPage();break;case"PrevPage":this.handlePrevPage();break;case"SDKCreate":this.handleSDKCreate();break;case"SetPage":this.handleSetPage(t);break;case"GetAttributes":this.handleGetAttributes();break;case"PageTo":this.handlePageTo(t);break;default:tt("".concat(t.kind," not allow event."))}}}},{key:"handleSDKCreate",value:function(){this.postMessage({kind:"Init",payload:{attributes:this.attributes,roomState:this.displayer.state,currentPage:this.currentPage,observerId:this.displayer.observerId}})}},{key:"handleDispatchMagixEvent",value:function(e){var t=e.payload;this.appManager.safeDispatchMagixEvent(t.event,t.payload)}},{key:"handleSetAttributes",value:function(e){this.setAttributes(e.payload)}},{key:"handleRegisterMagixEvent",value:function(e){var t=this,n=e.payload,r=function(e){e.authorId!==t.displayer.observerId&&t.postMessage({kind:"ReciveMagixEvent",payload:e})};this.magixEventMap.set(n,r),this.displayer.addMagixEventListener(n,r)}},{key:"handleRemoveMagixEvent",value:function(e){var t=e.payload,n=this.magixEventMap.get(t);this.displayer.removeMagixEventListener(t,n)}},{key:"handleNextPage",value:function(){this.manager.canOperate&&(this.manager.nextPage(),this.dispatchMagixEvent("NextPage",{}))}},{key:"handlePrevPage",value:function(){this.manager.canOperate&&(this.manager.prevPage(),this.dispatchMagixEvent("PrevPage",{}))}},{key:"handlePageTo",value:function(e){if(this.manager.canOperate){var t=e.payload;if(!Number.isSafeInteger(t)||t<=0)return;this.manager.setMainViewSceneIndex(t-1),this.dispatchMagixEvent("PageTo",t-1)}}},{key:"handleRemoveAllMagixEvent",value:function(){var e=this;this.magixEventMap.forEach((function(t,n){e.displayer.removeMagixEventListener(n,t)})),this.magixEventMap.clear()}},{key:"handleGetAttributes",value:function(){this.postMessage({kind:"GetAttributes",payload:this.attributes})}},{key:"postMessage",value:function(e){var t;this.iframe&&(null==(t=this.iframe.contentWindow)||t.postMessage(JSON.parse(JSON.stringify(e)),"*"))}},{key:"dispatchMagixEvent",value:function(e,t){this.manager.canOperate&&(this.setAttributes({lastEvent:{name:e,payload:t}}),this.displayer.dispatchMagixEvent(e,t))}},{key:"isClicker",value:function(){if(this.readonly)return!1;var e=this.displayer.state.memberState.currentApplianceName;return this.allowAppliances.includes(e)}},{key:"attributes",get:function(){return this.appManager.store.getIframeBridge()}},{key:"isReplay",get:function(){return this.manager.isReplay}},{key:"callbackName",get:function(){return this.isReplay?"onPlayerStateChanged":"onRoomStateChanged"}},{key:"iframeOrigin",get:function(){if(this.iframe)try{return new URL(this.iframe.src).origin}catch(e){console.warn(e)}}},{key:"currentIndex",get:function(){return this.manager.mainViewSceneIndex}},{key:"currentPage",get:function(){return this.currentIndex+1}},{key:"totalPage",get:function(){return this.manager.mainViewScenesLength}},{key:"readonly",get:function(){return!this.displayer.isWritable}},{key:"inDisplaySceneDir",get:function(){return this.manager.mainViewSceneDir===this.attributes.displaySceneDir}},{key:"isDisableInput",get:function(){return!("disableDeviceInputs"in this.displayer)||this.displayer.disableDeviceInputs}}],[{key:"onCreate",value:function(t){e.emitter.emit("StartCreate"),e.emitter.emit("OnCreate",t),e.emitter.emit("created")}}]),e}(),Sb=Eb;Sb.kind="IframeBridge",Sb.hiddenClass="netless-iframe-brdige-hidden",Sb.emitter=new Q.default,Sb.displayer=null,Sb.alreadyCreate=!1;var Ab=new xo({emitter:ue}),Ib=function(e){s(b,e);var t,n,r,i,o,a,l,c,h,d,f,p,v,m=u(b);function b(e){var t;return y(this,b),(t=m.call(this,e)).version="0.4.64",t.dependencies={dependencies:{"@juggle/resize-observer":"^3.3.1","@netless/telebox-insider":"0.2.27",emittery:"^0.9.2",lodash:"^4.17.21","p-retry":"^4.6.1","side-effect-manager":"^0.1.5",uuid:"^7.0.3","video.js":">=7"},peerDependencies:{jspdf:"2.5.1","white-web-sdk":"^2.16.0"},devDependencies:{"@netless/app-docs-viewer":"^0.2.16","@netless/app-media-player":"0.1.0-beta.5","@rollup/plugin-commonjs":"^20.0.0","@rollup/plugin-node-resolve":"^13.0.4","@rollup/plugin-url":"^6.1.0","@sveltejs/vite-plugin-svelte":"^1.0.0-next.22","@tsconfig/svelte":"^2.0.1","@types/debug":"^4.1.7","@types/lodash":"^4.14.182","@types/lodash-es":"^4.17.4","@types/uuid":"^8.3.1","@typescript-eslint/eslint-plugin":"^4.30.0","@typescript-eslint/parser":"^4.30.0","@vitest/ui":"^0.14.1",cypress:"^8.7.0",dotenv:"^10.0.0",eslint:"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-svelte3":"^3.2.0",jsdom:"^19.0.0",jspdf:"^2.5.1",less:"^4.1.1",prettier:"^2.3.2","prettier-plugin-svelte":"^2.4.0","rollup-plugin-analyzer":"^4.0.0","rollup-plugin-styles":"^3.14.1",svelte:"^3.42.4",typescript:"^4.5.5",vite:"^2.5.3",vitest:"^0.14.1","white-web-sdk":"2.16.43"}},t.emitter=ae,t.viewMode=B.ViewMode.Broadcaster,t.isReplay=B.isPlayer(t.displayer),t.containerSizeRatio=b.containerSizeRatio,b.displayer=e.displayer,window.NETLESS_DEPS={dependencies:{"@juggle/resize-observer":"^3.3.1","@netless/telebox-insider":"0.2.27",emittery:"^0.9.2",lodash:"^4.17.21","p-retry":"^4.6.1","side-effect-manager":"^0.1.5",uuid:"^7.0.3","video.js":">=7"},peerDependencies:{jspdf:"2.5.1","white-web-sdk":"^2.16.0"},devDependencies:{"@netless/app-docs-viewer":"^0.2.16","@netless/app-media-player":"0.1.0-beta.5","@rollup/plugin-commonjs":"^20.0.0","@rollup/plugin-node-resolve":"^13.0.4","@rollup/plugin-url":"^6.1.0","@sveltejs/vite-plugin-svelte":"^1.0.0-next.22","@tsconfig/svelte":"^2.0.1","@types/debug":"^4.1.7","@types/lodash":"^4.14.182","@types/lodash-es":"^4.17.4","@types/uuid":"^8.3.1","@typescript-eslint/eslint-plugin":"^4.30.0","@typescript-eslint/parser":"^4.30.0","@vitest/ui":"^0.14.1",cypress:"^8.7.0",dotenv:"^10.0.0",eslint:"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-svelte3":"^3.2.0",jsdom:"^19.0.0",jspdf:"^2.5.1",less:"^4.1.1",prettier:"^2.3.2","prettier-plugin-svelte":"^2.4.0","rollup-plugin-analyzer":"^4.0.0","rollup-plugin-styles":"^3.14.1",svelte:"^3.42.4",typescript:"^4.5.5",vite:"^2.5.3",vitest:"^0.14.1","white-web-sdk":"2.16.43"}},t}return x(b,[{key:"bindContainer",value:function(e){var t,n,r,i,o,a;if(B.isRoom(this.displayer)&&this.room.phase!==B.RoomPhase.Connected)throw new Ge;if(b.isCreated&&b.container)b.container.firstChild&&e.appendChild(b.container.firstChild);else if(b.params){var s=b.params,u=b.initContainer(this,e,s);this.boxManager&&this.boxManager.destroy();var l=function(e,t,n,r,i){return new Ii({safeSetAttributes:function(t){return e.safeSetAttributes(t)},getMainView:function(){return e.mainView},updateAppState:function(){var t,n;return null==(n=e.appManager)?void 0:(t=n.store).updateAppState.apply(t,arguments)},canOperate:function(){return e.canOperate},notifyContainerRectUpdate:function(t){var n;return null==(n=e.appManager)?void 0:n.notifyContainerRectUpdate(t)},cleanFocus:function(){var t;return null==(t=e.appManager)?void 0:t.store.cleanFocus()},setAppFocus:function(t){var n;return null==(n=e.appManager)?void 0:n.store.setAppFocus(t,!0)},callbacks:t,emitter:n,boxEmitter:r},i)}(this,ae,ue,rt,{collectorContainer:s.collectorContainer,collectorStyles:s.collectorStyles,prefersColorScheme:s.prefersColorScheme});this.boxManager=l,null==(t=this.appManager)||t.setBoxManager(l),this.bindMainView(u,s.disableCameraTransform),b.wrapper&&(null==(n=this.cursorManager)||n.setupWrapper(b.wrapper))}ue.emit("updateManagerRect"),null==(r=this.appManager)||r.refresh(),null==(i=this.appManager)||i.resetMaximized(),null==(o=this.appManager)||o.resetMinimized(),null==(a=this.appManager)||a.displayerWritableListener(!this.room.isWritable),b.container=e}},{key:"bindCollectorContainer",value:function(e){b.isCreated&&this.boxManager?this.boxManager.setCollectorContainer(e):b.params&&(b.params.collectorContainer=e)}},{key:"addApp",value:(v=g(regeneratorRuntime.mark((function e(t){var n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.appManager){e.next=2;break}return e.abrupt("return",this.appManager.rootDirRemoving?new Promise((function(e,r){ue.once("rootDirRemoved").then(g(regeneratorRuntime.mark((function i(){var o;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.prev=0,i.next=3,n._addApp(t);case 3:o=i.sent,e(o),i.next=10;break;case 7:i.prev=7,i.t0=i.catch(0),r(i.t0.message);case 10:case"end":return i.stop()}}),i,null,[[0,7]])}))))})):this._addApp(t));case 2:throw new Le;case 3:case"end":return e.stop()}}),e,this)}))),function(e){return v.apply(this,arguments)})},{key:"_addApp",value:(p=g(regeneratorRuntime.mark((function e(t){var n,r,i,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.appManager){e.next=20;break}if(t.kind&&"string"==typeof t.kind){e.next=3;break}throw new Be;case 3:return e.next=5,null==(n=xe.appClasses.get(t.kind))?void 0:n();case 5:if(!((o=e.sent)&&(null==(r=o.config)?void 0:r.singleton)&&this.appManager.appProxies.has(t.kind))){e.next=8;break}throw new Oe;case 8:if(void 0!==(a=this.setupScenePath(t,this.appManager))){e.next=13;break}e.t0=void 0,e.next=17;break;case 13:return null!=(i=null==t?void 0:t.options)&&i.scenePath&&(t.options.scenePath=Ce(t.options.scenePath)),e.next=16,this.appManager.addApp(t,Boolean(a));case 16:e.t0=e.sent;case 17:return e.abrupt("return",e.t0);case 20:throw new Le;case 21:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"setupScenePath",value:function(e,t){var n=!1;if(e.options){var r=e.options,i=r.scenePath,o=r.scenes;if(i){if(!function(e){return e.startsWith("/")}(i))throw new Fe;for(var a=0,s=Object.keys(this.apps||{});a0&&(this.isDynamicPPT(o)?(n=!0,Se(this.displayer)[i]||Ae(this.room,i,o)):Se(this.displayer)[i]||Ae(this.room,i,[{name:o[0].name}])),i&&void 0===o&&Ae(this.room,i,[{}])}return n}},{key:"setMainViewScenePath",value:(f=g(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this.appManager,!e.t0){e.next=4;break}return e.next=4,this.appManager.setMainViewScenePath(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return f.apply(this,arguments)})},{key:"setMainViewSceneIndex",value:(d=g(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this.appManager,!e.t0){e.next=4;break}return e.next=4,this.appManager.setMainViewSceneIndex(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return d.apply(this,arguments)})},{key:"nextPage",value:(h=g(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.appManager){e.next=12;break}if(!((t=this.mainViewSceneIndex+1)>=this.mainViewScenesLength)){e.next=6;break}e.t0=(console.warn("[WindowManager]: current page is the last page"),!1),e.next=9;break;case 6:return e.next=8,this.appManager.setMainViewSceneIndex(t);case 8:e.t0=!0;case 9:return e.abrupt("return",e.t0);case 12:return e.abrupt("return",!1);case 13:case"end":return e.stop()}}),e,this)}))),function(){return h.apply(this,arguments)})},{key:"prevPage",value:(c=g(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.appManager){e.next=12;break}if(!((t=this.mainViewSceneIndex-1)<0)){e.next=6;break}e.t0=(console.warn("[WindowManager]: current page is the first page"),!1),e.next=9;break;case 6:return e.next=8,this.appManager.setMainViewSceneIndex(t);case 8:e.t0=!0;case 9:return e.abrupt("return",e.t0);case 12:return e.abrupt("return",!1);case 13:case"end":return e.stop()}}),e,this)}))),function(){return c.apply(this,arguments)})},{key:"jumpPage",value:(l=g(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.appManager){e.next=11;break}if(!(t<0||t>=this.pageState.length)){e.next=5;break}e.t1=(console.warn("[WindowManager]: index ".concat(t," out of range")),!1),e.next=8;break;case 5:return e.next=7,this.appManager.setMainViewSceneIndex(t);case 7:e.t1=!0;case 8:e.t0=e.t1,e.next=12;break;case 11:e.t0=!1;case 12:return e.abrupt("return",e.t0);case 13:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"addPage",value:(a=g(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.appManager&&(n=null==t?void 0:t.after,r=null==t?void 0:t.scene,n?(i=this.mainViewSceneIndex+1,this.room.putScenes(ie,[r||{}],i)):this.room.putScenes(ie,[r||{}]));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"removePage",value:(o=g(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.appManager){e.next=5;break}return n=void 0===t?this.pageState.index:t,e.abrupt("return",1===this.pageState.length?(console.warn("[WindowManager]: can not remove the last page"),!1):n<0||n>=this.pageState.length?(console.warn("[WindowManager]: index ".concat(t," out of range")),!1):this.appManager.removeSceneByIndex(n));case 5:return e.abrupt("return",!1);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"getMainViewScenePath",value:function(){var e;return null==(e=this.appManager)?void 0:e.store.getMainViewScenePath()}},{key:"getMainViewSceneIndex",value:function(){var e;return null==(e=this.appManager)?void 0:e.store.getMainViewSceneIndex()}},{key:"setReadonly",value:function(e){var t;this.readonly=e,null==(t=this.boxManager)||t.setReadonly(e),ue.emit("setReadonly",e)}},{key:"switchMainViewToWriter",value:function(){var e;return null==(e=this.appManager)?void 0:e.mainViewProxy.mainViewClickHandler()}},{key:"onAppDestroy",value:function(e,t){!function(e,t){ue.once(e).then(t)}("destroy-".concat(e),t)}},{key:"setViewMode",value:function(e){var t,n,r,i;(e===B.ViewMode.Broadcaster||e===B.ViewMode.Follower)&&(this.canOperate&&e===B.ViewMode.Broadcaster&&(null==(t=this.appManager)||t.mainViewProxy.setCameraAndSize()),null==(n=this.appManager)||n.mainViewProxy.start()),e===B.ViewMode.Freedom&&(null==(r=this.appManager)||r.mainViewProxy.stop()),this.viewMode=e,null==(i=this.appManager)||i.mainViewProxy.setViewMode(e)}},{key:"setBoxState",value:function(e){if(this.canOperate)switch(e){case"normal":this.setMaximized(!1),this.setMinimized(!1);break;case"maximized":this.setMaximized(!0),this.setMinimized(!1);break;case"minimized":this.setMinimized(!0)}}},{key:"setMaximized",value:function(e){var t;!this.canOperate||null==(t=this.boxManager)||t.setMaximized(e,!1)}},{key:"setMinimized",value:function(e){var t;!this.canOperate||null==(t=this.boxManager)||t.setMinimized(e,!1)}},{key:"setFullscreen",value:function(e){var t;this._fullscreen!==e&&(this._fullscreen=e,null==(t=b.sizer)||t.classList.toggle("netless-window-manager-fullscreen",e),ae.emit("fullscreenChange",e))}},{key:"queryAll",value:function(){var e;return Array.from((null==(e=this.appManager)?void 0:e.appProxies.values())||[])}},{key:"queryOne",value:function(e){var t;return null==(t=this.appManager)?void 0:t.appProxies.get(e)}},{key:"closeApp",value:(i=g(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",null==(n=this.appManager)?void 0:n.closeApp(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"focusApp",value:function(e){var t,n,r,i=null==(t=this.boxManager)?void 0:t.getBox(e);i&&(null==(n=this.boxManager)||n.focusBox({appId:e},!1),(null==(r=this.boxManager)?void 0:r.teleBoxManager).makeBoxTop(i,!1))}},{key:"moveCamera",value:function(e){var t,n=this,r=j.omit(e,["animationMode"]),i=P({},this.mainView.camera);j.isEqual(P(P({},i),r),i)||(this.mainView.moveCamera(e),null==(t=this.appManager)||t.dispatchInternalEvent(q.MoveCamera,e),setTimeout((function(){var e;null==(e=n.appManager)||e.mainViewProxy.setCameraAndSize()}),500))}},{key:"moveCameraToContain",value:function(e){var t,n=this;this.mainView.moveCameraToContain(e),null==(t=this.appManager)||t.dispatchInternalEvent(q.MoveCameraToContain,e),setTimeout((function(){var e;null==(e=n.appManager)||e.mainViewProxy.setCameraAndSize()}),500)}},{key:"convertToPointInWorld",value:function(e){return this.mainView.convertToPointInWorld(e)}},{key:"setCameraBound",value:function(e){this.mainView.setCameraBound(e)}},{key:"onDestroy",value:function(){this._destroy()}},{key:"destroy",value:function(){this._destroy()}},{key:"_destroy",value:function(){var e,t,n,r,i;null==(e=this.containerResizeObserver)||e.disconnect(),null==(t=this.appManager)||t.destroy(),null==(n=this.cursorManager)||n.destroy(),b.container=void 0,b.wrapper=void 0,b.sizer=void 0,b.isCreated=!1,b.playground&&(null==(r=b.playground.parentNode)||r.removeChild(b.playground)),b.params=void 0,null==(i=this._iframeBridge)||i.destroy(),this._iframeBridge=void 0,tt("Destroyed")}},{key:"bindMainView",value:function(e,t){var n;this.appManager&&(this.appManager.bindMainView(e,Boolean(t)),null==(n=this.cursorManager)||n.setMainViewDivElement(e))}},{key:"safeSetAttributes",value:function(e){this.canOperate&&this.setAttributes(e)}},{key:"safeUpdateAttributes",value:function(e,t){this.canOperate&&this.updateAttributes(e,t)}},{key:"setPrefersColorScheme",value:function(e){var t,n;null==(n=null==(t=this.appManager)?void 0:t.boxManager)||n.setPrefersColorScheme(e)}},{key:"cleanCurrentScene",value:function(){var e;tt("clean current scene"),null==(e=this.focusedView)||e.cleanCurrentScene()}},{key:"redo",value:function(){var e;return(null==(e=this.focusedView)?void 0:e.redo())||0}},{key:"undo",value:function(){var e;return(null==(e=this.focusedView)?void 0:e.undo())||0}},{key:"delete",value:function(){var e;null==(e=this.focusedView)||e.delete()}},{key:"copy",value:function(){var e;null==(e=this.focusedView)||e.copy()}},{key:"paste",value:function(){var e;null==(e=this.focusedView)||e.paste()}},{key:"duplicate",value:function(){var e;null==(e=this.focusedView)||e.duplicate()}},{key:"insertText",value:function(e,t,n){var r;return(null==(r=this.focusedView)?void 0:r.insertText(e,t,n))||""}},{key:"insertImage",value:function(e){var t;return null==(t=this.focusedView)?void 0:t.insertImage(e)}},{key:"completeImageUpload",value:function(e,t){var n;return null==(n=this.focusedView)?void 0:n.completeImageUpload(e,t)}},{key:"lockImage",value:function(e,t){var n;return null==(n=this.focusedView)?void 0:n.lockImage(e,t)}},{key:"lockImages",value:function(e){var t;return null==(t=this.focusedView)?void 0:t.lockImages(e)}},{key:"refresh",value:function(){var e;this._refresh(),null==(e=this.appManager)||e.dispatchInternalEvent(q.Refresh)}},{key:"_refresh",value:function(){var e,t,n;null==(e=this.appManager)||e.mainViewProxy.rebind(),b.container&&this.bindContainer(b.container),null==(n=null==(t=this.appManager)?void 0:t.refresher)||n.refresh()}},{key:"setContainerSizeRatio",value:function(e){if(!(j.isNumber(e)&&e>0))throw new Error("[WindowManager]: updateContainerSizeRatio error, ratio must be a positive number. but got ".concat(e));b.containerSizeRatio=e,this.containerSizeRatio=e,ue.emit("containerSizeRatioUpdate",e)}},{key:"isDynamicPPT",value:function(e){var t,n,r=null==(n=null==(t=e[0])?void 0:t.ppt)?void 0:n.src;return null==r?void 0:r.startsWith("pptx://")}},{key:"ensureAttributes",value:(r=g(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=j.isNull(this.attributes),!e.t0){e.next=4;break}return e.next=4,ke(50);case 4:j.isObject(this.attributes)&&(this.attributes[$e.Apps]||this.safeSetAttributes(w({},$e.Apps,{})),this.attributes[$e.Cursors]||this.safeSetAttributes(w({},$e.Cursors,{})),this.attributes._mainScenePath||this.safeSetAttributes({_mainScenePath:oe}),this.attributes._mainSceneIndex||this.safeSetAttributes({_mainSceneIndex:0}),this.attributes[$e.Registered]||this.safeSetAttributes(w({},$e.Registered,{})),this.attributes[$e.IframeBridge]||this.safeSetAttributes(w({},$e.IframeBridge,{})));case 5:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"getIframeBridge",value:function(){if(!this.appManager)throw new Error("[WindowManager]: should call getIframeBridge() after await mount()");return this._iframeBridge||(this._iframeBridge=new Sb(this,this.appManager)),this._iframeBridge}},{key:"mainView",get:function(){if(this.appManager)return this.appManager.mainViewProxy.view;throw new Le}},{key:"camera",get:function(){if(this.appManager)return this.appManager.mainViewProxy.view.camera;throw new Le}},{key:"cameraState",get:function(){if(this.appManager)return this.appManager.mainViewProxy.cameraState;throw new Le}},{key:"apps",get:function(){var e;return null==(e=this.appManager)?void 0:e.store.apps()}},{key:"boxState",get:function(){var e;if(this.appManager)return null==(e=this.appManager.boxManager)?void 0:e.boxState;throw new Le}},{key:"darkMode",get:function(){var e,t;return Boolean(null==(t=null==(e=this.appManager)?void 0:e.boxManager)?void 0:t.darkMode)}},{key:"prefersColorScheme",get:function(){var e;if(this.appManager)return null==(e=this.appManager.boxManager)?void 0:e.prefersColorScheme;throw new Le}},{key:"focused",get:function(){return this.attributes.focus}},{key:"focusedView",get:function(){var e,t;return(null==(t=null==(e=this.appManager)?void 0:e.focusApp)?void 0:t.view)||this.mainView}},{key:"mainViewSceneIndex",get:function(){var e;return(null==(e=this._pageState)?void 0:e.index)||0}},{key:"mainViewSceneDir",get:function(){var e;if(this.appManager)return null==(e=this.appManager)?void 0:e.getMainViewSceneDir();throw new Le}},{key:"topApp",get:function(){var e,t;return null==(t=null==(e=this.boxManager)?void 0:e.getTopBox())?void 0:t.id}},{key:"mainViewScenesLength",get:function(){var e;return(null==(e=this._pageState)?void 0:e.length)||0}},{key:"canRedoSteps",get:function(){var e;return(null==(e=this.focusedView)?void 0:e.canRedoSteps)||0}},{key:"canUndoSteps",get:function(){var e;return(null==(e=this.focusedView)?void 0:e.canUndoSteps)||0}},{key:"sceneState",get:function(){if(this.appManager)return this.appManager.sceneState;throw new Le}},{key:"pageState",get:function(){if(this._pageState)return this._pageState.toObject();throw new Le}},{key:"fullscreen",get:function(){return Boolean(this._fullscreen)}},{key:"canOperate",get:function(){return!!B.isRoom(this.displayer)&&(this.displayer.isWritable&&this.displayer.phase===B.RoomPhase.Connected)}},{key:"room",get:function(){return this.displayer}}],[{key:"mount",value:(n=g(regeneratorRuntime.mark((function e(t){var n,r,i,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.room,b.container=t.container,r=t.containerSizeRatio,i=t.debug,o=t.cursor,b.params=t,b.displayer=t.room,ht(),!B.isRoom(n)){e.next=11;break}if(n.phase===B.RoomPhase.Connected){e.next=7;break}throw new Error("[WindowManager]: Room only Connected can be mount");case 7:return n.phase===B.RoomPhase.Connected&&n.isWritable&&(n.disableSerialization=!1),e.next=10,this.initManager(n);case 10:a=e.sent;case 11:if(!b.isCreated){e.next=13;break}throw new Error("[WindowManager]: Already created cannot be created again");case 13:if(this.debug=Boolean(i),tt("Already insert room",a),!B.isRoom(this.displayer)){e.next=18;break}if(a){e.next=16;break}throw new Error("[WindowManager]: init InvisiblePlugin failed");case 16:e.next=20;break;case 18:return e.next=20,X.default(function(){var e=g(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.getInvisiblePlugin(b.kind);case 2:if(a=e.sent){e.next=5;break}throw tt("manager is empty. retrying ".concat(t)),new Error;case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),{retries:10,maxTimeout:5e3});case 20:if(a){e.next=22;break}throw new Error("[WindowManager]: create manager failed");case 22:return r&&(b.containerSizeRatio=r),e.next=25,a.ensureAttributes();case 25:return a._fullscreen=t.fullscreen,a.appManager=new ct(a),a._pageState=new bo(a.appManager),a.cursorManager=new yo(a.appManager,Boolean(o),t.applianceIcons),r&&(a.containerSizeRatio=r),t.container&&a.bindContainer(t.container),_o(n,a),ue.emit("onCreated"),b.isCreated=!0,e.prev=34,e.next=37,le();case 37:e.next=42;break;case 39:e.prev=39,e.t0=e.catch(34),console.warn("[WindowManager]: indexedDB open failed"),console.log(e.t0);case 42:return e.abrupt("return",a);case 43:case"end":return e.stop()}}),e,this,[[34,39]])}))),function(e){return n.apply(this,arguments)})},{key:"initManager",value:(t=g(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((n=t.getInvisiblePlugin(b.kind))||!B.isRoom(t)){e.next=24;break}if(!1!==t.isWritable){e.next=21;break}return e.prev=3,e.next=6,t.setWritable(!0);case 6:e.next=11;break;case 8:throw e.prev=8,e.t0=e.catch(3),new Error("[WindowManger]: room must be switched to be writable");case 11:return e.next=13,ft(t);case 13:return null==(n=e.sent)||n.ensureAttributes(),e.next=17,ke(500);case 17:return e.next=19,t.setWritable(!1);case 19:e.next=24;break;case 21:return e.next=23,ft(t);case 23:n=e.sent;case 24:return e.abrupt("return",n);case 25:case"end":return e.stop()}}),e,null,[[3,8]])}))),function(e){return t.apply(this,arguments)})},{key:"initContainer",value:function(e,t,n){var r=n.chessboard,i=n.overwriteStyles,o=n.fullscreen;b.container||(b.container=t);var a=function(e){var t=document.createElement("div");t.className="netless-window-manager-playground";var n=document.createElement("div");n.className="netless-window-manager-sizer";var r=document.createElement("div");r.className="netless-window-manager-wrapper";var i=document.createElement("div");return i.className="netless-window-manager-main-view",t.appendChild(n),n.appendChild(r),r.appendChild(i),e.appendChild(t),Cb.wrapper=r,{playground:t,wrapper:r,sizer:n,mainViewElement:i}}(t),s=a.playground,u=a.wrapper,l=a.sizer,c=a.mainViewElement;if(b.playground=s,r&&l.classList.add("netless-window-manager-chess-sizer"),o&&l.classList.add("netless-window-manager-fullscreen"),i){var h=document.createElement("style");h.textContent=i,s.appendChild(h)}return e.containerResizeObserver=vt.create(s,l,u,ue),b.wrapper=u,b.sizer=l,c}},{key:"register",value:function(e){return xe.register(e)}},{key:"unregister",value:function(e){return xe.unregister(e)}},{key:"registered",get:function(){return xe.registered}}]),b}(B.InvisiblePlugin),Cb=Ib;Cb.kind="WindowManager",Cb.debug=!1,Cb.containerSizeRatio=9/16,Cb.isCreated=!1,Cb.debug&&function(e){Ry=Dy(Dy({},Oy),e)}({verbose:!0}),Cb.register({kind:Tu.kind,src:Tu}),Cb.register({kind:fb.kind,src:fb}),t.AppCreateError=Oe,t.AppManagerNotInitError=Le,t.AppNotRegisterError=Re,t.BindContainerRoomPhaseInvalidError=Ge,t.BoxManagerNotFoundError=ze,t.BoxNotCreatedError=Ue,t.BuiltinApps=pb,t.DomEvents=mb,t.IframeBridge=Sb,t.IframeEvents=vb,t.InvalidScenePath=Fe,t.ParamsInvalidError=Be,t.WhiteWebSDKInvalidError=je,t.WindowManager=Cb,t.calculateNextIndex=nt,t.reconnectRefresher=Ab},6513:function(e,t,n){var r=n(49766).Buffer;function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})})),t}Object.defineProperty(t,"__esModule",{value:!0}),t.xml2json=t.xml2js=t.json2xml=t.js2xml=void 0;var a=void 0!==n.g?n.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},s=[],u=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,c=!1;function h(){c=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,n=e.length;t>18&63]+s[i>>12&63]+s[i>>6&63]+s[63&i]);return o.join("")}function f(e){var t;c||h();for(var n=e.length,r=n%3,i="",o=[],a=16383,u=0,l=n-r;ul?l:u+a));return 1===r?(t=e[n-1],i+=s[t>>2],i+=s[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=s[t>>10],i+=s[t>>4&63],i+=s[t<<2&63],i+="="),o.push(i),o.join("")}function p(e,t,n,r,i){var o,a,s=8*i-r-1,u=(1<>1,c=-7,h=n?i-1:0,d=n?-1:1,f=e[t+h];for(h+=d,o=f&(1<<-c)-1,f>>=-c,c+=s;c>0;o=256*o+e[t+h],h+=d,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=r;c>0;a=256*a+e[t+h],h+=d,c-=8);if(0===o)o=1-l;else{if(o===u)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),o-=l}return(f?-1:1)*a*Math.pow(2,o-r)}function v(e,t,n,r,i,o){var a,s,u,l=8*o-i-1,c=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,v=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+h>=1?d/u:d*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=c?(s=0,a=c):a+h>=1?(s=(t*u-1)*Math.pow(2,i),a+=h):(s=t*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;e[n+f]=255&s,f+=p,s/=256,i-=8);for(a=a<0;e[n+f]=255&a,f+=p,a/=256,l-=8);e[n+f-p]|=128*v}var m={}.toString,g=Array.isArray||function(e){return"[object Array]"==m.call(e)};function y(){return x.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function b(e,t){if(y()=y())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+y().toString(16)+" bytes");return 0|e}function S(e){return!(null==e||!e._isBuffer)}function A(e,t){if(S(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return ee(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return te(e).length;default:if(r)return ee(e).length;t=(""+t).toLowerCase(),r=!0}}function I(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return H(this,t,n);case"utf8":case"utf-8":return U(this,t,n);case"ascii":return z(this,t,n);case"latin1":case"binary":return G(this,t,n);case"base64":return B(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return V(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function C(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function N(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=x.from(t,r)),S(t))return 0===t.length?-1:k(e,t,n,r,i);if("number"==typeof t)return t&=255,x.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):k(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function k(e,t,n,r,i){var o,a=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,n/=2}function l(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var c=-1;for(o=n;os&&(n=s-u),o=n;o>=0;o--){for(var h=!0,d=0;di&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function B(e,t,n){return 0===t&&n===e.length?f(e):f(e.slice(t,n))}function U(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i239?4:l>223?3:l>191?2:1;if(i+h<=n)switch(h){case 1:l<128&&(c=l);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&l)<<6|63&o)>127&&(c=u);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(u=(15&l)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&l)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(c=u)}null===c?(c=65533,h=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=h}return function(e){var t=e.length;if(t<=F)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),""},x.prototype.compare=function(e,t,n,r,i){if(!S(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),s=Math.min(o,a),u=this.slice(r,i),l=e.slice(t,n),c=0;ci)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return D(this,e,t,n);case"utf8":case"utf-8":return P(this,e,t,n);case"ascii":return O(this,e,t,n);case"latin1":case"binary":return R(this,e,t,n);case"base64":return L(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},x.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var F=4096;function z(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;ir)&&(n=r);for(var i="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function Y(e,t,n,r,i,o){if(!S(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function X(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function Q(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function Z(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function q(e,t,n,r,i){return i||Z(e,0,n,4),v(e,t,n,r,23,4),n+4}function J(e,t,n,r,i){return i||Z(e,0,n,8),v(e,t,n,r,52,8),n+8}x.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(i*=256);)r+=this[e+--t]*i;return r},x.prototype.readUInt8=function(e,t){return t||W(e,1,this.length),this[e]},x.prototype.readUInt16LE=function(e,t){return t||W(e,2,this.length),this[e]|this[e+1]<<8},x.prototype.readUInt16BE=function(e,t){return t||W(e,2,this.length),this[e]<<8|this[e+1]},x.prototype.readUInt32LE=function(e,t){return t||W(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},x.prototype.readUInt32BE=function(e,t){return t||W(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},x.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||W(e,t,this.length);for(var r=this[e],i=1,o=0;++o=(i*=128)&&(r-=Math.pow(2,8*t)),r},x.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||W(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},x.prototype.readInt8=function(e,t){return t||W(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},x.prototype.readInt16LE=function(e,t){t||W(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},x.prototype.readInt16BE=function(e,t){t||W(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},x.prototype.readInt32LE=function(e,t){return t||W(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},x.prototype.readInt32BE=function(e,t){return t||W(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},x.prototype.readFloatLE=function(e,t){return t||W(e,4,this.length),p(this,e,!0,23,4)},x.prototype.readFloatBE=function(e,t){return t||W(e,4,this.length),p(this,e,!1,23,4)},x.prototype.readDoubleLE=function(e,t){return t||W(e,8,this.length),p(this,e,!0,52,8)},x.prototype.readDoubleBE=function(e,t){return t||W(e,8,this.length),p(this,e,!1,52,8)},x.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||Y(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+n},x.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||Y(this,e,t,1,255,0),x.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},x.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||Y(this,e,t,2,65535,0),x.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):X(this,e,t,!0),t+2},x.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||Y(this,e,t,2,65535,0),x.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):X(this,e,t,!1),t+2},x.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||Y(this,e,t,4,4294967295,0),x.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):Q(this,e,t,!0),t+4},x.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||Y(this,e,t,4,4294967295,0),x.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Q(this,e,t,!1),t+4},x.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);Y(this,e,t,n,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+n},x.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);Y(this,e,t,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},x.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||Y(this,e,t,1,127,-128),x.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},x.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||Y(this,e,t,2,32767,-32768),x.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):X(this,e,t,!0),t+2},x.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||Y(this,e,t,2,32767,-32768),x.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):X(this,e,t,!1),t+2},x.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||Y(this,e,t,4,2147483647,-2147483648),x.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):Q(this,e,t,!0),t+4},x.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||Y(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),x.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Q(this,e,t,!1),t+4},x.prototype.writeFloatLE=function(e,t,n){return q(this,e,t,!0,n)},x.prototype.writeFloatBE=function(e,t,n){return q(this,e,t,!1,n)},x.prototype.writeDoubleLE=function(e,t,n){return J(this,e,t,!0,n)},x.prototype.writeDoubleBE=function(e,t,n){return J(this,e,t,!1,n)},x.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(o<1e3||!x.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function te(e){return function(e){var t,n,r,i,o,a;c||h();var s=e.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===e[s-2]?2:"="===e[s-1]?1:0,a=new l(3*s/4-o),r=o>0?s-4:s;var d=0;for(t=0,n=0;t>16&255,a[d++]=i>>8&255,a[d++]=255&i;return 2===o?(i=u[e.charCodeAt(t)]<<2|u[e.charCodeAt(t+1)]>>4,a[d++]=255&i):1===o&&(i=u[e.charCodeAt(t)]<<10|u[e.charCodeAt(t+1)]<<4|u[e.charCodeAt(t+2)]>>2,a[d++]=i>>8&255,a[d++]=255&i),a}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(K,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function ne(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function re(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var ie={};function oe(){}function ae(){ae.init.call(this)}function se(e){return void 0===e._maxListeners?ae.defaultMaxListeners:e._maxListeners}function ue(e,t,n){if(t)e.call(n);else for(var r=e.length,i=me(e,r),o=0;o0&&a.length>i){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=a.length,s=u,"function"==typeof console.warn?console.warn(s):console.log(s)}}else a=o[t]=n,++e._eventsCount;return e}function pe(e,t,n){var r=!1;function i(){e.removeListener(t,i),r||(r=!0,n.apply(e,arguments))}return i.listener=n,i}function ve(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function me(e,t){for(var n=new Array(t);t--;)n[t]=e[t];return n}function ge(){throw new Error("setTimeout has not been defined")}function ye(){throw new Error("clearTimeout has not been defined")}oe.prototype=Object.create(null),ae.EventEmitter=ae,ae.usingDomains=!1,ae.prototype.domain=void 0,ae.prototype._events=void 0,ae.prototype._maxListeners=void 0,ae.defaultMaxListeners=10,ae.init=function(){this.domain=null,ae.usingDomains&&undefined.active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new oe,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},ae.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},ae.prototype.getMaxListeners=function(){return se(this)},ae.prototype.emit=function(e){var t,n,r,i,o,a,s,u="error"===e;if(a=this._events)u=u&&null==a.error;else if(!u)return!1;if(s=this.domain,u){if(t=arguments[1],!s){if(t instanceof Error)throw t;var l=new Error('Uncaught, unspecified "error" event. ('+t+")");throw l.context=t,l}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=s,t.domainThrown=!1,s.emit("error",t),!1}if(!(n=a[e]))return!1;var c="function"==typeof n;switch(r=arguments.length){case 1:ue(n,c,this);break;case 2:le(n,c,this,arguments[1]);break;case 3:ce(n,c,this,arguments[1],arguments[2]);break;case 4:he(n,c,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),o=1;o0;)if(n[o]===t||n[o].listener&&n[o].listener===t){a=n[o].listener,i=o;break}if(i<0)return this;if(1===n.length){if(n[0]=void 0,0==--this._eventsCount)return this._events=new oe,this;delete r[e]}else!function(e,t){for(var n=t,r=n+1,i=e.length;r0?Reflect.ownKeys(this._events):[]};var be=ge,xe=ye;function _e(e){if(be===setTimeout)return setTimeout(e,0);if((be===ge||!be)&&setTimeout)return be=setTimeout,setTimeout(e,0);try{return be(e,0)}catch(t){try{return be.call(null,e,0)}catch(t){return be.call(this,e,0)}}}"function"==typeof a.setTimeout&&(be=setTimeout),"function"==typeof a.clearTimeout&&(xe=clearTimeout);var we,Te=[],Me=!1,Ee=-1;function Se(){Me&&we&&(Me=!1,we.length?Te=we.concat(Te):Ee=-1,Te.length&&Ae())}function Ae(){if(!Me){var e=_e(Se);Me=!0;for(var t=Te.length;t;){for(we=Te,Te=[];++Ee1)for(var n=1;n=i)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}})),a=r[n];n=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),et(t)?n.showHidden=t:t&&ct(n,t),rt(n.showHidden)&&(n.showHidden=!1),rt(n.depth)&&(n.depth=2),rt(n.colors)&&(n.colors=!1),rt(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=Ze),Je(n,e,n.depth)}function Ze(e,t){var n=Qe.styles[t];return n?"["+Qe.colors[n][0]+"m"+e+"["+Qe.colors[n][1]+"m":e}function qe(e,t){return e}function Je(e,t,n){if(e.customInspect&&t&&ut(t.inspect)&&t.inspect!==Qe&&(!t.constructor||t.constructor.prototype!==t)){var r=t.inspect(n,e);return nt(r)||(r=Je(e,r,n)),r}var i=function(e,t){if(rt(t))return e.stylize("undefined","undefined");if(nt(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(r=t,"number"==typeof r)return e.stylize(""+t,"number");var r;if(et(t))return e.stylize(""+t,"boolean");if(tt(t))return e.stylize("null","null")}(e,t);if(i)return i;var o=Object.keys(t),a=function(e){var t={};return e.forEach((function(e,n){t[e]=!0})),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(t)),st(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return Ke(t);if(0===o.length){if(ut(t)){var s=t.name?": "+t.name:"";return e.stylize("[Function"+s+"]","special")}if(it(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(at(t))return e.stylize(Date.prototype.toString.call(t),"date");if(st(t))return Ke(t)}var u,l,c="",h=!1,d=["{","}"];(u=t,Array.isArray(u)&&(h=!0,d=["[","]"]),ut(t))&&(c=" [Function"+(t.name?": "+t.name:"")+"]");return it(t)&&(c=" "+RegExp.prototype.toString.call(t)),at(t)&&(c=" "+Date.prototype.toUTCString.call(t)),st(t)&&(c=" "+Ke(t)),0!==o.length||h&&0!=t.length?n<0?it(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),l=h?function(e,t,n,r,i){for(var o=[],a=0,s=t.length;a60)return n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1];return n[0]+t+" "+e.join(", ")+" "+n[1]}(l,c,d)):d[0]+c+d[1]}function Ke(e){return"["+Error.prototype.toString.call(e)+"]"}function $e(e,t,n,r,i,o){var a,s,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(s=e.stylize("[Setter]","special")),ht(r,i)||(a="["+i+"]"),s||(e.seen.indexOf(u.value)<0?(s=tt(n)?Je(e,u.value,null):Je(e,u.value,n-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+s.split("\n").map((function(e){return" "+e})).join("\n")):s=e.stylize("[Circular]","special")),rt(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function et(e){return"boolean"==typeof e}function tt(e){return null===e}function nt(e){return"string"==typeof e}function rt(e){return void 0===e}function it(e){return ot(e)&&"[object RegExp]"===lt(e)}function ot(e){return"object"===i(e)&&null!==e}function at(e){return ot(e)&&"[object Date]"===lt(e)}function st(e){return ot(e)&&("[object Error]"===lt(e)||e instanceof Error)}function ut(e){return"function"==typeof e}function lt(e){return Object.prototype.toString.call(e)}function ct(e,t){if(!t||!ot(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}function ht(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function dt(){this.head=null,this.tail=null,this.length=0}Qe.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},Qe.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},dt.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},dt.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},dt.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},dt.prototype.clear=function(){this.head=this.tail=null,this.length=0},dt.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},dt.prototype.concat=function(e){if(0===this.length)return x.alloc(0);if(1===this.length)return this.head.data;for(var t=x.allocUnsafe(e>>>0),n=this.head,r=0;n;)n.data.copy(t,r),r+=n.data.length,n=n.next;return t};var ft=x.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function pt(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),function(e){if(e&&!ft(e))throw new Error("Unknown encoding: "+e)}(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=mt;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=gt;break;default:return void(this.write=vt)}this.charBuffer=new x(6),this.charReceived=0,this.charLength=0}function vt(e){return e.toString(this.encoding)}function mt(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function gt(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}pt.prototype.write=function(e){for(var t="";this.charLength;){var n=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived=55296&&i<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var r=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,r),r-=this.charReceived);var i;r=(t+=e.toString(this.encoding,0,r)).length-1;if((i=t.charCodeAt(r))>=55296&&i<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),e.copy(this.charBuffer,0,0,o),t.substring(0,r)}return t},pt.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(t<=2&&n>>4==14){this.charLength=3;break}if(t<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=t},pt.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;t+=r.slice(0,n).toString(i)}return t};var yt=Object.freeze({__proto__:null,StringDecoder:pt});_t.ReadableState=xt;var bt=function(e){if(rt(Ye)&&(Ye=ze.env.NODE_DEBUG||""),e=e.toUpperCase(),!Xe[e])if(new RegExp("\\b"+e+"\\b","i").test(Ye)){Xe[e]=function(){var t=Ve.apply(null,arguments);console.error("%s %d: %s",e,0,t)}}else Xe[e]=function(){};return Xe[e]}("stream");function xt(e,t){e=e||{},this.objectMode=!!e.objectMode,t instanceof Zt&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var n=e.highWaterMark,r=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r,this.highWaterMark=~~this.highWaterMark,this.buffer=new dt,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(this.decoder=new pt(e.encoding),this.encoding=e.encoding)}function _t(e){if(!(this instanceof _t))return new _t(e);this._readableState=new xt(e,this),this.readable=!0,e&&"function"==typeof e.read&&(this._read=e.read),ae.call(this)}function wt(e,t,n,r,i){var o=function(e,t){var n=null;x.isBuffer(t)||"string"==typeof t||null==t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));return n}(t,n);if(o)e.emit("error",o);else if(null===n)t.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,Et(e)}(e,t);else if(t.objectMode||n&&n.length>0)if(t.ended&&!i){var a=new Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&i){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else{var u;!t.decoder||i||r||(n=t.decoder.write(n),u=!t.objectMode&&0===n.length),i||(t.reading=!1),u||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&Et(e))),function(e,t){t.readingMore||(t.readingMore=!0,Ie(At,e,t))}(e,t)}else i||(t.reading=!1);return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=Tt?e=Tt:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function Et(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(bt("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?Ie(St,e):St(e))}function St(e){bt("emit readable"),e.emit("readable"),Nt(e)}function At(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;eo.length?o.length:e;if(a===o.length?i+=o:i+=o.slice(0,e),0===(e-=a)){a===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(a));break}++r}return t.length-=r,i}(e,t):function(e,t){var n=x.allocUnsafe(e),r=t.head,i=1;r.data.copy(n),e-=r.data.length;for(;r=r.next;){var o=r.data,a=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,a),0===(e-=a)){a===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(a));break}++i}return t.length-=i,n}(e,t);return r}(e,t.buffer,t.decoder),n);var n}function Dt(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,Ie(Pt,t,e))}function Pt(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function Ot(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return bt("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?Dt(this):Et(this),null;if(0===(e=Mt(e,t))&&t.ended)return 0===t.length&&Dt(this),null;var r,i=t.needReadable;return bt("need readable",i),(0===t.length||t.length-e0?kt(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&Dt(this)),null!==r&&this.emit("data",r),r},_t.prototype._read=function(e){this.emit("error",new Error("not implemented"))},_t.prototype.pipe=function(e,t){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=e;break;case 1:r.pipes=[r.pipes,e];break;default:r.pipes.push(e)}r.pipesCount+=1,bt("pipe count=%d opts=%j",r.pipesCount,t);var i=!t||!1!==t.end?a:l;function o(e){bt("onunpipe"),e===n&&l()}function a(){bt("onend"),e.end()}r.endEmitted?Ie(i):n.once("end",i),e.on("unpipe",o);var s=function(e){return function(){var t=e._readableState;bt("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&e.listeners("data").length&&(t.flowing=!0,Nt(e))}}(n);e.on("drain",s);var u=!1;function l(){bt("cleanup"),e.removeListener("close",f),e.removeListener("finish",p),e.removeListener("drain",s),e.removeListener("error",d),e.removeListener("unpipe",o),n.removeListener("end",a),n.removeListener("end",l),n.removeListener("data",h),u=!0,!r.awaitDrain||e._writableState&&!e._writableState.needDrain||s()}var c=!1;function h(t){bt("ondata"),c=!1,!1!==e.write(t)||c||((1===r.pipesCount&&r.pipes===e||r.pipesCount>1&&-1!==Ot(r.pipes,e))&&!u&&(bt("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,c=!0),n.pause())}function d(t){var n;bt("onerror",t),v(),e.removeListener("error",d),0===(n="error",e.listeners(n).length)&&e.emit("error",t)}function f(){e.removeListener("finish",p),v()}function p(){bt("onfinish"),e.removeListener("close",f),v()}function v(){bt("unpipe"),n.unpipe(e)}return n.on("data",h),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",d),e.once("close",f),e.once("finish",p),e.emit("pipe",n),r.flowing||(bt("pipe resume"),n.resume()),e},_t.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this)),this;if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Bt.prototype._write=function(e,t,n){n(new Error("not implemented"))},Bt.prototype._writev=null,Bt.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,Vt(e,t),n&&(t.finished?Ie(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n)},Ge(Zt,_t);for(var Yt=Object.keys(Bt.prototype),Xt=0;Xt"===a?(S(r,"onsgmldeclaration",r.sgmlDecl),r.sgmlDecl="",r.state=T.TEXT):v(a)?(r.state=T.SGML_DECL_QUOTED,r.sgmlDecl+=a):r.sgmlDecl+=a;continue;case T.SGML_DECL_QUOTED:a===r.q&&(r.state=T.SGML_DECL,r.q=""),r.sgmlDecl+=a;continue;case T.DOCTYPE:">"===a?(r.state=T.TEXT,S(r,"ondoctype",r.doctype),r.doctype=!0):(r.doctype+=a,"["===a?r.state=T.DOCTYPE_DTD:v(a)&&(r.state=T.DOCTYPE_QUOTED,r.q=a));continue;case T.DOCTYPE_QUOTED:r.doctype+=a,a===r.q&&(r.q="",r.state=T.DOCTYPE);continue;case T.DOCTYPE_DTD:r.doctype+=a,"]"===a?r.state=T.DOCTYPE:v(a)&&(r.state=T.DOCTYPE_DTD_QUOTED,r.q=a);continue;case T.DOCTYPE_DTD_QUOTED:r.doctype+=a,a===r.q&&(r.state=T.DOCTYPE_DTD,r.q="");continue;case T.COMMENT:"-"===a?r.state=T.COMMENT_ENDING:r.comment+=a;continue;case T.COMMENT_ENDING:"-"===a?(r.state=T.COMMENT_ENDED,r.comment=I(r.opt,r.comment),r.comment&&S(r,"oncomment",r.comment),r.comment=""):(r.comment+="-"+a,r.state=T.COMMENT);continue;case T.COMMENT_ENDED:">"!==a?(k(r,"Malformed comment"),r.comment+="--"+a,r.state=T.COMMENT):r.state=T.TEXT;continue;case T.CDATA:"]"===a?r.state=T.CDATA_ENDING:r.cdata+=a;continue;case T.CDATA_ENDING:"]"===a?r.state=T.CDATA_ENDING_2:(r.cdata+="]"+a,r.state=T.CDATA);continue;case T.CDATA_ENDING_2:">"===a?(r.cdata&&S(r,"oncdata",r.cdata),S(r,"onclosecdata"),r.cdata="",r.state=T.TEXT):"]"===a?r.cdata+="]":(r.cdata+="]]"+a,r.state=T.CDATA);continue;case T.PROC_INST:"?"===a?r.state=T.PROC_INST_ENDING:p(a)?r.state=T.PROC_INST_BODY:r.procInstName+=a;continue;case T.PROC_INST_BODY:if(!r.procInstBody&&p(a))continue;"?"===a?r.state=T.PROC_INST_ENDING:r.procInstBody+=a;continue;case T.PROC_INST_ENDING:">"===a?(S(r,"onprocessinginstruction",{name:r.procInstName,body:r.procInstBody}),r.procInstName=r.procInstBody="",r.state=T.TEXT):(r.procInstBody+="?"+a,r.state=T.PROC_INST_BODY);continue;case T.OPEN_TAG:g(h,a)?r.tagName+=a:(D(r),">"===a?R(r):"/"===a?r.state=T.OPEN_TAG_SLASH:(p(a)||k(r,"Invalid character in tag name"),r.state=T.ATTRIB));continue;case T.OPEN_TAG_SLASH:">"===a?(R(r,!0),L(r)):(k(r,"Forward-slash in opening tag not followed by >"),r.state=T.ATTRIB);continue;case T.ATTRIB:if(p(a))continue;">"===a?R(r):"/"===a?r.state=T.OPEN_TAG_SLASH:g(c,a)?(r.attribName=a,r.attribValue="",r.state=T.ATTRIB_NAME):k(r,"Invalid attribute name");continue;case T.ATTRIB_NAME:"="===a?r.state=T.ATTRIB_VALUE:">"===a?(k(r,"Attribute without value"),r.attribValue=r.attribName,O(r),R(r)):p(a)?r.state=T.ATTRIB_NAME_SAW_WHITE:g(h,a)?r.attribName+=a:k(r,"Invalid attribute name");continue;case T.ATTRIB_NAME_SAW_WHITE:if("="===a)r.state=T.ATTRIB_VALUE;else{if(p(a))continue;k(r,"Attribute without value"),r.tag.attributes[r.attribName]="",r.attribValue="",S(r,"onattribute",{name:r.attribName,value:""}),r.attribName="",">"===a?R(r):g(c,a)?(r.attribName=a,r.state=T.ATTRIB_NAME):(k(r,"Invalid attribute name"),r.state=T.ATTRIB)}continue;case T.ATTRIB_VALUE:if(p(a))continue;v(a)?(r.q=a,r.state=T.ATTRIB_VALUE_QUOTED):(k(r,"Unquoted attribute value"),r.state=T.ATTRIB_VALUE_UNQUOTED,r.attribValue=a);continue;case T.ATTRIB_VALUE_QUOTED:if(a!==r.q){"&"===a?r.state=T.ATTRIB_VALUE_ENTITY_Q:r.attribValue+=a;continue}O(r),r.q="",r.state=T.ATTRIB_VALUE_CLOSED;continue;case T.ATTRIB_VALUE_CLOSED:p(a)?r.state=T.ATTRIB:">"===a?R(r):"/"===a?r.state=T.OPEN_TAG_SLASH:g(c,a)?(k(r,"No whitespace between attributes"),r.attribName=a,r.attribValue="",r.state=T.ATTRIB_NAME):k(r,"Invalid attribute name");continue;case T.ATTRIB_VALUE_UNQUOTED:if(!m(a)){"&"===a?r.state=T.ATTRIB_VALUE_ENTITY_U:r.attribValue+=a;continue}O(r),">"===a?R(r):r.state=T.ATTRIB;continue;case T.CLOSE_TAG:if(r.tagName)">"===a?L(r):g(h,a)?r.tagName+=a:r.script?(r.script+=""+r.tagName,r.tagName="",r.state=T.SCRIPT):(p(a)||k(r,"Invalid tagname in closing tag"),r.state=T.CLOSE_TAG_SAW_WHITE);else{if(p(a))continue;y(c,a)?r.script?(r.script+=""+a,r.state=T.SCRIPT):k(r,"Invalid tagname in closing tag."):r.tagName=a}continue;case T.CLOSE_TAG_SAW_WHITE:if(p(a))continue;">"===a?L(r):k(r,"Invalid characters in closing tag");continue;case T.TEXT_ENTITY:case T.ATTRIB_VALUE_ENTITY_Q:case T.ATTRIB_VALUE_ENTITY_U:var l,b;switch(r.state){case T.TEXT_ENTITY:l=T.TEXT,b="textNode";break;case T.ATTRIB_VALUE_ENTITY_Q:l=T.ATTRIB_VALUE_QUOTED,b="attribValue";break;case T.ATTRIB_VALUE_ENTITY_U:l=T.ATTRIB_VALUE_UNQUOTED,b="attribValue"}";"===a?(r[b]+=j(r),r.entity="",r.state=l):g(r.entity.length?f:d,a)?r.entity+=a:(k(r,"Invalid character in entity name"),r[b]+="&"+r.entity+a,r.entity="",r.state=l);continue;default:throw new Error(r,"Unknown state: "+r.state)}r.position>=r.bufferCheckPosition&&function(t){for(var r=Math.max(e.MAX_BUFFER_LENGTH,10),i=0,o=0,a=n.length;or)switch(n[o]){case"textNode":A(t);break;case"cdata":S(t,"oncdata",t.cdata),t.cdata="";break;case"script":S(t,"onscript",t.script),t.script="";break;default:C(t,"Max buffer length exceeded: "+n[o])}i=Math.max(i,s)}var u=e.MAX_BUFFER_LENGTH-i;t.bufferCheckPosition=u+t.position}(r);return r}
+var Iu=mt.exports,Cu=wt,Nu=Su.exports;function ku(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;nt}return!1}function yl(e,t,n,r,i,o){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o}var bl={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach((function(e){bl[e]=new yl(e,0,!1,e,null,!1)})),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach((function(e){var t=e[0];bl[t]=new yl(t,1,!1,e[1],null,!1)})),["contentEditable","draggable","spellCheck","value"].forEach((function(e){bl[e]=new yl(e,2,!1,e.toLowerCase(),null,!1)})),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach((function(e){bl[e]=new yl(e,2,!1,e,null,!1)})),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach((function(e){bl[e]=new yl(e,3,!1,e.toLowerCase(),null,!1)})),["checked","multiple","muted","selected"].forEach((function(e){bl[e]=new yl(e,3,!0,e,null,!1)})),["capture","download"].forEach((function(e){bl[e]=new yl(e,4,!1,e,null,!1)})),["cols","rows","size","span"].forEach((function(e){bl[e]=new yl(e,6,!1,e,null,!1)})),["rowSpan","start"].forEach((function(e){bl[e]=new yl(e,5,!1,e.toLowerCase(),null,!1)}));var xl=/[\-:]([a-z])/g;function _l(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach((function(e){var t=e.replace(xl,_l);bl[t]=new yl(t,1,!1,e,null,!1)})),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach((function(e){var t=e.replace(xl,_l);bl[t]=new yl(t,1,!1,e,"http://www.w3.org/1999/xlink",!1)})),["xml:base","xml:lang","xml:space"].forEach((function(e){var t=e.replace(xl,_l);bl[t]=new yl(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1)})),["tabIndex","crossOrigin"].forEach((function(e){bl[e]=new yl(e,1,!1,e.toLowerCase(),null,!1)})),bl.xlinkHref=new yl("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0),["src","href","action","formAction"].forEach((function(e){bl[e]=new yl(e,1,!1,e.toLowerCase(),null,!0)}));var wl=Iu.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function Tl(e,t,n,r){var i=bl.hasOwnProperty(t)?bl[t]:null;(null!==i?0===i.type:!r&&!(!(2=n.length))throw Error(ku(93));n=n[0]}t=n}null==t&&(t=""),n=t}e._wrapperState={initialValue:Vl(n)}}function ic(e,t){var n=Vl(t.value),r=Vl(t.defaultValue);null!=n&&((n=""+n)!==e.value&&(e.value=n),null==t.defaultValue&&e.defaultValue!==n&&(e.defaultValue=n)),null!=r&&(e.defaultValue=""+r)}function oc(e){var t=e.textContent;t===e._wrapperState.initialValue&&""!==t&&null!==t&&(e.value=t)}var ac="http://www.w3.org/1999/xhtml",sc="http://www.w3.org/2000/svg";function uc(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function lc(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?uc(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var cc,hc=function(e){return"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction((function(){return e(t,n)}))}:e}((function(e,t){if(e.namespaceURI!==sc||"innerHTML"in e)e.innerHTML=t;else{for((cc=cc||document.createElement("div")).innerHTML="",t=cc.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}}));function dc(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}function fc(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var pc={animationend:fc("Animation","AnimationEnd"),animationiteration:fc("Animation","AnimationIteration"),animationstart:fc("Animation","AnimationStart"),transitionend:fc("Transition","TransitionEnd")},vc={},mc={};function gc(e){if(vc[e])return vc[e];if(!pc[e])return e;var t,n=pc[e];for(t in n)if(n.hasOwnProperty(t)&&t in mc)return vc[e]=n[t];return e}Ku&&(mc=document.createElement("div").style,"AnimationEvent"in window||(delete pc.animationend.animation,delete pc.animationiteration.animation,delete pc.animationstart.animation),"TransitionEvent"in window||delete pc.transitionend.transition);var yc=gc("animationend"),bc=gc("animationiteration"),xc=gc("animationstart"),_c=gc("transitionend"),wc="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Tc=new("function"==typeof WeakMap?WeakMap:Map);function Mc(e){var t=Tc.get(e);return void 0===t&&(t=new Map,Tc.set(e,t)),t}function Ec(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{0!=(1026&(t=e).effectTag)&&(n=t.return),e=t.return}while(e)}return 3===t.tag?n:null}function Sc(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function Ac(e){if(Ec(e)!==e)throw Error(ku(188))}function Ic(e){if(e=function(e){var t=e.alternate;if(!t){if(null===(t=Ec(e)))throw Error(ku(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(null===i)break;var o=i.alternate;if(null===o){if(null!==(r=i.return)){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return Ac(i),e;if(o===r)return Ac(i),t;o=o.sibling}throw Error(ku(188))}if(n.return!==r.return)n=i,r=o;else{for(var a=!1,s=i.child;s;){if(s===n){a=!0,n=i,r=o;break}if(s===r){a=!0,r=i,n=o;break}s=s.sibling}if(!a){for(s=o.child;s;){if(s===n){a=!0,n=o,r=i;break}if(s===r){a=!0,r=o,n=i;break}s=s.sibling}if(!a)throw Error(ku(189))}}if(n.alternate!==r)throw Error(ku(190))}if(3!==n.tag)throw Error(ku(188));return n.stateNode.current===n?e:t}(e),!e)return null;for(var t=e;;){if(5===t.tag||6===t.tag)return t;if(t.child)t.child.return=t,t=t.child;else{if(t===e)break;for(;!t.sibling;){if(!t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}}return null}function Cc(e,t){if(null==t)throw Error(ku(30));return null==e?t:Array.isArray(e)?Array.isArray(t)?(e.push.apply(e,t),e):(e.push(t),e):Array.isArray(t)?[e].concat(t):[e,t]}function Nc(e,t,n){Array.isArray(e)?e.forEach(t,n):e&&t.call(n,e)}var kc=null;function Dc(e){if(e){var t=e._dispatchListeners,n=e._dispatchInstances;if(Array.isArray(t))for(var r=0;rLc.length&&Lc.push(e)}function Bc(e,t,n,r){if(Lc.length){var i=Lc.pop();return i.topLevelType=e,i.eventSystemFlags=r,i.nativeEvent=t,i.targetInst=n,i}return{topLevelType:e,eventSystemFlags:r,nativeEvent:t,targetInst:n,ancestors:[]}}function Uc(e){var t=e.targetInst,n=t;do{if(!n){e.ancestors.push(n);break}var r=n;if(3===r.tag)r=r.stateNode.containerInfo;else{for(;r.return;)r=r.return;r=3!==r.tag?null:r.stateNode.containerInfo}if(!r)break;5!==(t=n.tag)&&6!==t||e.ancestors.push(n),n=td(r)}while(n);for(n=0;n=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Lh(r)}}function Bh(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?Bh(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function Uh(){for(var e=window,t=Rh();t instanceof e.HTMLIFrameElement;){try{var n="string"==typeof t.contentWindow.location.href}catch(e){n=!1}if(!n)break;t=Rh((e=t.contentWindow).document)}return t}function Fh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}var zh="$?",Gh="$!",Hh=null,Vh=null;function Wh(e,t){switch(e){case"button":case"input":case"select":case"textarea":return!!t.autoFocus}return!1}function Yh(e,t){return"textarea"===e||"option"===e||"noscript"===e||"string"==typeof t.children||"number"==typeof t.children||"object"==_(t.dangerouslySetInnerHTML)&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var Xh="function"==typeof setTimeout?setTimeout:void 0,Qh="function"==typeof clearTimeout?clearTimeout:void 0;function Zh(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break}return e}function qh(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if("$"===n||n===Gh||n===zh){if(0===t)return e;t--}else"/$"===n&&t++}e=e.previousSibling}return null}var Jh=Math.random().toString(36).slice(2),Kh="__reactInternalInstance$"+Jh,$h="__reactEventHandlers$"+Jh,ed="__reactContainere$"+Jh;function td(e){var t=e[Kh];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ed]||n[Kh]){if(n=t.alternate,null!==t.child||null!==n&&null!==n.child)for(e=qh(e);null!==e;){if(n=e[Kh])return n;e=qh(e)}return t}n=(e=n).parentNode}return null}function nd(e){return!(e=e[Kh]||e[ed])||5!==e.tag&&6!==e.tag&&13!==e.tag&&3!==e.tag?null:e}function rd(e){if(5===e.tag||6===e.tag)return e.stateNode;throw Error(ku(33))}function id(e){return e[$h]||null}function od(e){do{e=e.return}while(e&&5!==e.tag);return e||null}function ad(e,t){var n=e.stateNode;if(!n)return null;var r=Uu(n);if(!r)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(r=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!r;break e;default:e=!1}if(e)return null;if(n&&"function"!=typeof n)throw Error(ku(231,t,_(n)));return n}function sd(e,t,n){(t=ad(e,n.dispatchConfig.phasedRegistrationNames[t]))&&(n._dispatchListeners=Cc(n._dispatchListeners,t),n._dispatchInstances=Cc(n._dispatchInstances,e))}function ud(e){if(e&&e.dispatchConfig.phasedRegistrationNames){for(var t=e._targetInst,n=[];t;)n.push(t),t=od(t);for(t=n.length;0this.eventPool.length&&this.eventPool.push(e)}function _d(e){e.eventPool=[],e.getPooled=bd,e.release=xd}Cu(yd.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=md)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=md)},persist:function(){this.isPersistent=md},isPersistent:gd,destructor:function(){var e,t=this.constructor.Interface;for(e in t)this[e]=null;this.nativeEvent=this._targetInst=this.dispatchConfig=null,this.isPropagationStopped=this.isDefaultPrevented=gd,this._dispatchInstances=this._dispatchListeners=null}}),yd.Interface={type:null,target:null,currentTarget:function(){return null},eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null},yd.extend=function(e){function t(){}function n(){return r.apply(this,arguments)}var r=this;t.prototype=r.prototype;var i=new t;return Cu(i,n.prototype),n.prototype=i,n.prototype.constructor=n,n.Interface=Cu({},r.Interface,e),n.extend=r.extend,_d(n),n},_d(yd);var wd=yd.extend({data:null}),Td=yd.extend({data:null}),Md=[9,13,27,32],Ed=Ku&&"CompositionEvent"in window,Sd=null;Ku&&"documentMode"in document&&(Sd=document.documentMode);var Ad=Ku&&"TextEvent"in window&&!Sd,Id=Ku&&(!Ed||Sd&&8=Sd),Cd=String.fromCharCode(32),Nd={beforeInput:{phasedRegistrationNames:{bubbled:"onBeforeInput",captured:"onBeforeInputCapture"},dependencies:["compositionend","keypress","textInput","paste"]},compositionEnd:{phasedRegistrationNames:{bubbled:"onCompositionEnd",captured:"onCompositionEndCapture"},dependencies:"blur compositionend keydown keypress keyup mousedown".split(" ")},compositionStart:{phasedRegistrationNames:{bubbled:"onCompositionStart",captured:"onCompositionStartCapture"},dependencies:"blur compositionstart keydown keypress keyup mousedown".split(" ")},compositionUpdate:{phasedRegistrationNames:{bubbled:"onCompositionUpdate",captured:"onCompositionUpdateCapture"},dependencies:"blur compositionupdate keydown keypress keyup mousedown".split(" ")}},kd=!1;function Dd(e,t){switch(e){case"keyup":return-1!==Md.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"blur":return!0;default:return!1}}function Pd(e){return"object"==_(e=e.detail)&&"data"in e?e.data:null}var Od=!1;var Rd={eventTypes:Nd,extractEvents:function(e,t,n,r){var i;if(Ed)e:{switch(e){case"compositionstart":var o=Nd.compositionStart;break e;case"compositionend":o=Nd.compositionEnd;break e;case"compositionupdate":o=Nd.compositionUpdate;break e}o=void 0}else Od?Dd(e,n)&&(o=Nd.compositionEnd):"keydown"===e&&229===n.keyCode&&(o=Nd.compositionStart);return o?(Id&&"ko"!==n.locale&&(Od||o!==Nd.compositionStart?o===Nd.compositionEnd&&Od&&(i=vd()):(fd="value"in(dd=r)?dd.value:dd.textContent,Od=!0)),o=wd.getPooled(o,t,n,r),i?o.data=i:null!==(i=Pd(n))&&(o.data=i),hd(o),i=o):i=null,(e=Ad?function(e,t){switch(e){case"compositionend":return Pd(t);case"keypress":return 32!==t.which?null:(kd=!0,Cd);case"textInput":return(e=t.data)===Cd&&kd?null:e;default:return null}}(e,n):function(e,t){if(Od)return"compositionend"===e||!Ed&&Dd(e,t)?(e=vd(),pd=fd=dd=null,Od=!1,e):null;switch(e){case"paste":default:return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=document.documentMode,mf={select:{phasedRegistrationNames:{bubbled:"onSelect",captured:"onSelectCapture"},dependencies:"blur contextmenu dragend focus keydown keyup mousedown mouseup selectionchange".split(" ")}},gf=null,yf=null,bf=null,xf=!1;function _f(e,t){var n=t.window===t?t.document:9===t.nodeType?t:t.ownerDocument;return xf||null==gf||gf!==Rh(n)?null:("selectionStart"in(n=gf)&&Fh(n)?n={start:n.selectionStart,end:n.selectionEnd}:n={anchorNode:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset},bf&&pf(bf,n)?null:(bf=n,(e=yd.getPooled(mf.select,yf,e,t)).type="select",e.target=gf,hd(e),e))}var wf={eventTypes:mf,extractEvents:function(e,t,n,r,i,o){if(!(o=!(i=o||(r.window===r?r.document:9===r.nodeType?r:r.ownerDocument)))){e:{i=Mc(i),o=qu.onSelect;for(var a=0;aLf||(e.current=Rf[Lf],Rf[Lf]=null,Lf--)}function Bf(e,t){Lf++,Rf[Lf]=e.current,e.current=t}var Uf={},Ff={current:Uf},zf={current:!1},Gf=Uf;function Hf(e,t){var n=e.type.contextTypes;if(!n)return Uf;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i,o={};for(i in n)o[i]=t[i];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function Vf(e){return null!=(e=e.childContextTypes)}function Wf(){jf(zf),jf(Ff)}function Yf(e,t,n){if(Ff.current!==Uf)throw Error(ku(168));Bf(Ff,t),Bf(zf,n)}function Xf(e,t,n){var r=e.stateNode;if(e=t.childContextTypes,"function"!=typeof r.getChildContext)return n;for(var i in r=r.getChildContext())if(!(i in e))throw Error(ku(108,Gl(t)||"Unknown",i));return Cu({},n,{},r)}function Qf(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Uf,Gf=Ff.current,Bf(Ff,e),Bf(zf,zf.current),!0}function Zf(e,t,n){var r=e.stateNode;if(!r)throw Error(ku(169));n?(e=Xf(e,t,Gf),r.__reactInternalMemoizedMergedChildContext=e,jf(zf),jf(Ff),Bf(Ff,e)):jf(zf),Bf(zf,n)}var qf=Nu.unstable_runWithPriority,Jf=Nu.unstable_scheduleCallback,Kf=Nu.unstable_cancelCallback,$f=Nu.unstable_requestPaint,ep=Nu.unstable_now,tp=Nu.unstable_getCurrentPriorityLevel,np=Nu.unstable_ImmediatePriority,rp=Nu.unstable_UserBlockingPriority,ip=Nu.unstable_NormalPriority,op=Nu.unstable_LowPriority,ap=Nu.unstable_IdlePriority,sp={},up=Nu.unstable_shouldYield,lp=void 0!==$f?$f:function(){},cp=null,hp=null,dp=!1,fp=ep(),pp=1e4>fp?ep:function(){return ep()-fp};function vp(){switch(tp()){case np:return 99;case rp:return 98;case ip:return 97;case op:return 96;case ap:return 95;default:throw Error(ku(332))}}function mp(e){switch(e){case 99:return np;case 98:return rp;case 97:return ip;case 96:return op;case 95:return ap;default:throw Error(ku(332))}}function gp(e,t){return e=mp(e),qf(e,t)}function yp(e,t,n){return e=mp(e),Jf(e,t,n)}function bp(e){return null===cp?(cp=[e],hp=Jf(np,_p)):cp.push(e),sp}function xp(){if(null!==hp){var e=hp;hp=null,Kf(e)}_p()}function _p(){if(!dp&&null!==cp){dp=!0;var e=0;try{var t=cp;gp(99,(function(){for(;e=t&&(im=!0),e.firstContext=null)}function Dp(e,t){if(Ap!==e&&!1!==t&&0!==t)if(("number"!=typeof t||1073741823===t)&&(Ap=e,t=1073741823),t={context:e,observedBits:t,next:null},null===Sp){if(null===Ep)throw Error(ku(308));Sp=t,Ep.dependencies={expirationTime:0,firstContext:t,responders:null}}else Sp=Sp.next=t;return e._currentValue}var Pp=!1;function Op(e){e.updateQueue={baseState:e.memoizedState,baseQueue:null,shared:{pending:null},effects:null}}function Rp(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,baseQueue:e.baseQueue,shared:e.shared,effects:e.effects})}function Lp(e,t){return(e={expirationTime:e,suspenseConfig:t,tag:0,payload:null,callback:null,next:null}).next=e}function jp(e,t){if(null!==(e=e.updateQueue)){var n=(e=e.shared).pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}}function Bp(e,t){var n=e.alternate;null!==n&&Rp(n,e),null===(n=(e=e.updateQueue).baseQueue)?(e.baseQueue=t.next=t,t.next=t):(t.next=n.next,n.next=t)}function Up(e,t,n,r){var i=e.updateQueue;Pp=!1;var o=i.baseQueue,a=i.shared.pending;if(null!==a){if(null!==o){var s=o.next;o.next=a.next,a.next=s}o=a,i.shared.pending=null,null!==(s=e.alternate)&&(null!==(s=s.updateQueue)&&(s.baseQueue=a))}if(null!==o){s=o.next;var u=i.baseState,l=0,c=null,h=null,d=null;if(null!==s)for(var f=s;;){if((a=f.expirationTime)l&&(l=a)}else{null!==d&&(d=d.next={expirationTime:1073741823,suspenseConfig:f.suspenseConfig,tag:f.tag,payload:f.payload,callback:f.callback,next:null}),jg(a,f.suspenseConfig);e:{var v=e,m=f;switch(a=t,p=n,m.tag){case 1:if("function"==typeof(v=m.payload)){u=v.call(p,u,a);break e}u=v;break e;case 3:v.effectTag=-4097&v.effectTag|64;case 0:if(null==(a="function"==typeof(v=m.payload)?v.call(p,u,a):v))break e;u=Cu({},u,a);break e;case 2:Pp=!0}}null!==f.callback&&(e.effectTag|=32,null===(a=i.effects)?i.effects=[f]:a.push(f))}if(null===(f=f.next)||f===s){if(null===(a=i.shared.pending))break;f=o.next=a.next,a.next=s,i.baseQueue=o=a,i.shared.pending=null}}null===d?c=u:d.next=h,i.baseState=c,i.baseQueue=d,Bg(l),e.expirationTime=l,e.memoizedState=u}}function Fp(e,t,n){if(e=t.effects,t.effects=null,null!==e)for(t=0;tv?(m=p,p=null):m=p.sibling;var g=d(i,p,s[v],u);if(null===g){null===p&&(p=m);break}e&&p&&null===g.alternate&&t(i,p),a=o(g,a,v),null===c?l=g:c.sibling=g,c=g,p=m}if(v===s.length)return n(i,p),l;if(null===p){for(;vv?(m=p,p=null):m=p.sibling;var y=d(i,p,g.value,u);if(null===y){null===p&&(p=m);break}e&&p&&null===y.alternate&&t(i,p),a=o(y,a,v),null===c?l=y:c.sibling=y,c=y,p=m}if(g.done)return n(i,p),l;if(null===p){for(;!g.done;v++,g=s.next())null!==(g=h(i,g.value,u))&&(a=o(g,a,v),null===c?l=g:c.sibling=g,c=g);return l}for(p=r(i,p);!g.done;v++,g=s.next())null!==(g=f(p,i,v,g.value,u))&&(e&&null!==g.alternate&&p.delete(null===g.key?v:g.key),a=o(g,a,v),null===c?l=g:c.sibling=g,c=g);return e&&p.forEach((function(e){return t(i,e)})),l}(s,u,l,c);if(v&&Jp(s,l),void 0===l&&!p)switch(s.tag){case 1:case 0:throw s=s.type,Error(ku(152,s.displayName||s.name||"Component"))}return n(s,u)}}var $p=Kp(!0),ev=Kp(!1),tv={},nv={current:tv},rv={current:tv},iv={current:tv};function ov(e){if(e===tv)throw Error(ku(174));return e}function av(e,t){switch(Bf(iv,t),Bf(rv,e),Bf(nv,tv),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:lc(null,"");break;default:t=lc(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}jf(nv),Bf(nv,t)}function sv(){jf(nv),jf(rv),jf(iv)}function uv(e){ov(iv.current);var t=ov(nv.current),n=lc(t,e.type);t!==n&&(Bf(rv,e),Bf(nv,n))}function lv(e){rv.current===e&&(jf(nv),jf(rv))}var cv={current:0};function hv(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||n.data===zh||n.data===Gh))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!=(64&t.effectTag))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}function dv(e,t){return{responder:e,props:t}}var fv=wl.ReactCurrentDispatcher,pv=wl.ReactCurrentBatchConfig,vv=0,mv=null,gv=null,yv=null,bv=!1;function xv(){throw Error(ku(321))}function _v(e,t){if(null===t)return!1;for(var n=0;no))throw Error(ku(301));o+=1,yv=gv=null,t.updateQueue=null,fv.current=Xv,e=n(r,i)}while(t.expirationTime===vv)}if(fv.current=Vv,t=null!==gv&&null!==gv.next,vv=0,yv=gv=mv=null,bv=!1,t)throw Error(ku(300));return e}function Tv(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===yv?mv.memoizedState=yv=e:yv=yv.next=e,yv}function Mv(){if(null===gv){var e=mv.alternate;e=null!==e?e.memoizedState:null}else e=gv.next;var t=null===yv?mv.memoizedState:yv.next;if(null!==t)yv=t,gv=e;else{if(null===e)throw Error(ku(310));e={memoizedState:(gv=e).memoizedState,baseState:gv.baseState,baseQueue:gv.baseQueue,queue:gv.queue,next:null},null===yv?mv.memoizedState=yv=e:yv=yv.next=e}return yv}function Ev(e,t){return"function"==typeof t?t(e):t}function Sv(e){var t=Mv(),n=t.queue;if(null===n)throw Error(ku(311));n.lastRenderedReducer=e;var r=gv,i=r.baseQueue,o=n.pending;if(null!==o){if(null!==i){var a=i.next;i.next=o.next,o.next=a}r.baseQueue=i=o,n.pending=null}if(null!==i){i=i.next,r=r.baseState;var s=a=o=null,u=i;do{var l=u.expirationTime;if(lmv.expirationTime&&(mv.expirationTime=l,Bg(l))}else null!==s&&(s=s.next={expirationTime:1073741823,suspenseConfig:u.suspenseConfig,action:u.action,eagerReducer:u.eagerReducer,eagerState:u.eagerState,next:null}),jg(l,u.suspenseConfig),r=u.eagerReducer===e?u.eagerState:e(r,u.action);u=u.next}while(null!==u&&u!==i);null===s?o=r:s.next=a,df(r,t.memoizedState)||(im=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=s,n.lastRenderedState=r}return[t.memoizedState,n.dispatch]}function Av(e){var t=Mv(),n=t.queue;if(null===n)throw Error(ku(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,o=t.memoizedState;if(null!==i){n.pending=null;var a=i=i.next;do{o=e(o,a.action),a=a.next}while(a!==i);df(o,t.memoizedState)||(im=!0),t.memoizedState=o,null===t.baseQueue&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Iv(e){var t=Tv();return"function"==typeof e&&(e=e()),t.memoizedState=t.baseState=e,e=(e=t.queue={pending:null,dispatch:null,lastRenderedReducer:Ev,lastRenderedState:e}).dispatch=Hv.bind(null,mv,e),[t.memoizedState,e]}function Cv(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},null===(t=mv.updateQueue)?(t={lastEffect:null},mv.updateQueue=t,t.lastEffect=e.next=e):null===(n=t.lastEffect)?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function Nv(){return Mv().memoizedState}function kv(e,t,n,r){var i=Tv();mv.effectTag|=e,i.memoizedState=Cv(1|t,n,void 0,void 0===r?null:r)}function Dv(e,t,n,r){var i=Mv();r=void 0===r?null:r;var o=void 0;if(null!==gv){var a=gv.memoizedState;if(o=a.destroy,null!==r&&_v(r,a.deps))return void Cv(t,n,o,r)}mv.effectTag|=e,i.memoizedState=Cv(1|t,n,o,r)}function Pv(e,t){return kv(516,4,e,t)}function Ov(e,t){return Dv(516,4,e,t)}function Rv(e,t){return Dv(4,2,e,t)}function Lv(e,t){return"function"==typeof t?(e=e(),t(e),function(){t(null)}):null!=t?(e=e(),t.current=e,function(){t.current=null}):void 0}function jv(e,t,n){return n=null!=n?n.concat([e]):null,Dv(4,2,Lv.bind(null,t,e),n)}function Bv(){}function Uv(e,t){return Tv().memoizedState=[e,void 0===t?null:t],e}function Fv(e,t){var n=Mv();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&_v(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function zv(e,t){var n=Mv();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&_v(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Gv(e,t,n){var r=vp();gp(98>r?98:r,(function(){e(!0)})),gp(97<\/script>",e=e.removeChild(e.firstChild)):"string"==typeof r.is?e=a.createElement(i,{is:r.is}):(e=a.createElement(i),"select"===i&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,i),e[Kh]=t,e[$h]=r,pm(e,t),t.stateNode=e,a=kh(i,r),i){case"iframe":case"object":case"embed":bh("load",e),s=r;break;case"video":case"audio":for(s=0;sr.tailExpiration&&1t)&&xg.set(e,t))}}function Ag(e,t){e.expirationTime=(e=n>(e=e.nextKnownPendingLevel)?n:e)&&t!==e?0:e}function Cg(e){if(0!==e.lastExpiredTime)e.callbackExpirationTime=1073741823,e.callbackPriority=99,e.callbackNode=bp(kg.bind(null,e));else{var t=Ig(e),n=e.callbackNode;if(0===t)null!==n&&(e.callbackNode=null,e.callbackExpirationTime=0,e.callbackPriority=90);else{var r=Mg();if(1073741823===t?r=99:1===t||2===t?r=95:r=0>=(r=10*(1073741821-t)-10*(1073741821-r))?99:250>=r?98:5250>=r?97:95,null!==n){var i=e.callbackPriority;if(e.callbackExpirationTime===t&&i>=r)return;n!==sp&&Kf(n)}e.callbackExpirationTime=t,e.callbackPriority=r,t=1073741823===t?bp(kg.bind(null,e)):yp(r,Ng.bind(null,e),{timeout:10*(1073741821-t)-pp()}),e.callbackNode=t}}}function Ng(e,t){if(Tg=0,t)return fy(e,t=Mg()),Cg(e),null;var n=Ig(e);if(0!==n){if(t=e.callbackNode,0!=(48&tg))throw Error(ku(327));if(Xg(),e===ng&&n===ig||Og(e,n),null!==rg){var r=tg;tg|=qm;for(var i=Lg();;)try{Fg();break}catch(t){Rg(e,t)}if(Ip(),tg=r,Qm.current=i,1===og)throw t=ag,Og(e,n),hy(e,n),Cg(e),t;if(null===rg)switch(i=e.finishedWork=e.current.alternate,e.finishedExpirationTime=n,r=og,ng=null,r){case Km:case 1:throw Error(ku(345));case 2:fy(e,2=n){e.lastPingedTime=n,Og(e,n);break}}if(0!==(o=Ig(e))&&o!==n)break;if(0!==r&&r!==n){e.lastPingedTime=r;break}e.timeoutHandle=Xh(Vg.bind(null,e),i);break}Vg(e);break;case eg:if(hy(e,n),n===(r=e.lastSuspendedTime)&&(e.nextKnownPendingLevel=Hg(i)),hg&&(0===(i=e.lastPingedTime)||i>=n)){e.lastPingedTime=n,Og(e,n);break}if(0!==(i=Ig(e))&&i!==n)break;if(0!==r&&r!==n){e.lastPingedTime=r;break}if(1073741823!==ug?r=10*(1073741821-ug)-pp():1073741823===sg?r=0:(r=10*(1073741821-sg)-5e3,0>(r=(i=pp())-r)&&(r=0),(n=10*(1073741821-n)-i)<(r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Xm(r/1960))-r)&&(r=n)),10=(r=0|a.busyMinDurationMs)?r=0:(i=0|a.busyDelayMs,r=(o=pp()-(10*(1073741821-o)-(0|a.timeoutMs||5e3)))<=i?0:i+r-o),10 component higher in the tree to provide a loading indicator or placeholder to display."+Hl(a))}5!==og&&(og=2),s=Sm(s,a),h=o;do{switch(h.tag){case 3:u=s,h.effectTag|=4096,h.expirationTime=t,Bp(h,Vm(h,u,t));break e;case 1:u=s;var x=h.type,w=h.stateNode;if(0==(64&h.effectTag)&&("function"==typeof x.getDerivedStateFromError||null!==w&&"function"==typeof w.componentDidCatch&&(null===mg||!mg.has(w)))){h.effectTag|=4096,h.expirationTime=t,Bp(h,Wm(h,u,t));break e}}h=h.return}while(null!==h)}rg=Gg(rg)}catch(e){t=e;continue}break}}function Lg(){var e=Qm.current;return Qm.current=Vv,null===e?Vv:e}function jg(e,t){ecg&&(cg=e)}function Ug(){for(;null!==rg;)rg=zg(rg)}function Fg(){for(;null!==rg&&!up();)rg=zg(rg)}function zg(e){var t=Ym(e.alternate,e,ig);return e.memoizedProps=e.pendingProps,null===t&&(t=Gg(e)),Zm.current=null,t}function Gg(e){rg=e;do{var t=rg.alternate;if(e=rg.return,0==(2048&rg.effectTag)){if(t=Mm(t,rg,ig),1===ig||1!==rg.childExpirationTime){for(var n=0,r=rg.child;null!==r;){var i=r.expirationTime,o=r.childExpirationTime;i>n&&(n=i),o>n&&(n=o),r=r.sibling}rg.childExpirationTime=n}if(null!==t)return t;null!==e&&0==(2048&e.effectTag)&&(null===e.firstEffect&&(e.firstEffect=rg.firstEffect),null!==rg.lastEffect&&(null!==e.lastEffect&&(e.lastEffect.nextEffect=rg.firstEffect),e.lastEffect=rg.lastEffect),1(e=e.childExpirationTime)?t:e}function Vg(e){var t=vp();return gp(99,Wg.bind(null,e,t)),null}function Wg(e,t){do{Xg()}while(null!==yg);if(0!=(48&tg))throw Error(ku(327));var n=e.finishedWork,r=e.finishedExpirationTime;if(null===n)return null;if(e.finishedWork=null,e.finishedExpirationTime=0,n===e.current)throw Error(ku(177));e.callbackNode=null,e.callbackExpirationTime=0,e.callbackPriority=90,e.nextKnownPendingLevel=0;var i=Hg(n);if(e.firstPendingTime=i,r<=e.lastSuspendedTime?e.firstSuspendedTime=e.lastSuspendedTime=e.nextKnownPendingLevel=0:r<=e.firstSuspendedTime&&(e.firstSuspendedTime=r-1),r<=e.lastPingedTime&&(e.lastPingedTime=0),r<=e.lastExpiredTime&&(e.lastExpiredTime=0),e===ng&&(rg=ng=null,ig=0),1s&&(l=s,s=a,a=l),l=jh(b,a),c=jh(b,s),l&&c&&(1!==_.rangeCount||_.anchorNode!==l.node||_.anchorOffset!==l.offset||_.focusNode!==c.node||_.focusOffset!==c.offset)&&((x=x.createRange()).setStart(l.node,l.offset),_.removeAllRanges(),a>s?(_.addRange(x),_.extend(c.node,c.offset)):(x.setEnd(c.node,c.offset),_.addRange(x))))),x=[],_=b);_=_.parentNode;)1===_.nodeType&&x.push({element:_,left:_.scrollLeft,top:_.scrollTop});for("function"==typeof b.focus&&b.focus(),b=0;b=n?ym(e,t,n):(Bf(cv,1&cv.current),null!==(t=wm(e,t,n))?t.sibling:null);Bf(cv,1&cv.current);break;case 19:if(r=t.childExpirationTime>=n,0!=(64&e.effectTag)){if(r)return _m(e,t,n);t.effectTag|=64}if(null!==(i=t.memoizedState)&&(i.rendering=null,i.tail=null),Bf(cv,cv.current),!r)return null}return wm(e,t,n)}im=!1}}else im=!1;switch(t.expirationTime=0,t.tag){case 2:if(r=t.type,null!==e&&(e.alternate=null,t.alternate=null,t.effectTag|=2),e=t.pendingProps,i=Hf(t,Ff.current),kp(t,n),i=wv(null,t,r,e,i,n),t.effectTag|=1,"object"==_(i)&&null!==i&&"function"==typeof i.render&&void 0===i.$$typeof){if(t.tag=1,t.memoizedState=null,t.updateQueue=null,Vf(r)){var o=!0;Qf(t)}else o=!1;t.memoizedState=null!==i.state&&void 0!==i.state?i.state:null,Op(t);var a=r.getDerivedStateFromProps;"function"==typeof a&&Hp(t,r,a,e),i.updater=Vp,t.stateNode=i,i._reactInternalFiber=t,Qp(t,r,e,n),t=dm(null,t,r,!0,o,n)}else t.tag=0,om(null,t,i,n),t=t.child;return t;case 16:e:{if(i=t.elementType,null!==e&&(e.alternate=null,t.alternate=null,t.effectTag|=2),e=t.pendingProps,function(e){if(-1===e._status){e._status=0;var t=e._ctor;t=t(),e._result=t,t.then((function(t){0===e._status&&(t=t.default,e._status=1,e._result=t)}),(function(t){0===e._status&&(e._status=2,e._result=t)}))}}(i),1!==i._status)throw i._result;switch(i=i._result,t.type=i,o=t.tag=function(e){if("function"==typeof e)return ry(e)?1:0;if(null!=e){if((e=e.$$typeof)===Ol)return 11;if(e===jl)return 14}return 2}(i),e=Tp(i,e),o){case 0:t=cm(null,t,i,e,n);break e;case 1:t=hm(null,t,i,e,n);break e;case 11:t=am(null,t,i,e,n);break e;case 14:t=sm(null,t,i,Tp(i.type,e),r,n);break e}throw Error(ku(306,i,""))}return t;case 0:return r=t.type,i=t.pendingProps,cm(e,t,r,i=t.elementType===r?i:Tp(r,i),n);case 1:return r=t.type,i=t.pendingProps,hm(e,t,r,i=t.elementType===r?i:Tp(r,i),n);case 3:if(fm(t),r=t.updateQueue,null===e||null===r)throw Error(ku(282));if(r=t.pendingProps,i=null!==(i=t.memoizedState)?i.element:null,Rp(e,t),Up(t,r,null,n),(r=t.memoizedState.element)===i)nm(),t=wm(e,t,n);else{if((i=t.stateNode.hydrate)&&(Zv=Zh(t.stateNode.containerInfo.firstChild),Qv=t,i=qv=!0),i)for(n=ev(t,null,r,n),t.child=n;n;)n.effectTag=-3&n.effectTag|1024,n=n.sibling;else om(e,t,r,n),nm();t=t.child}return t;case 5:return uv(t),null===e&&$v(t),r=t.type,i=t.pendingProps,o=null!==e?e.memoizedProps:null,a=i.children,Yh(r,i)?a=null:null!==o&&Yh(r,o)&&(t.effectTag|=16),lm(e,t),4&t.mode&&1!==n&&i.hidden?(t.expirationTime=t.childExpirationTime=1,t=null):(om(e,t,a,n),t=t.child),t;case 6:return null===e&&$v(t),null;case 13:return ym(e,t,n);case 4:return av(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=$p(t,null,r,n):om(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,am(e,t,r,i=t.elementType===r?i:Tp(r,i),n);case 7:return om(e,t,t.pendingProps,n),t.child;case 8:case 12:return om(e,t,t.pendingProps.children,n),t.child;case 10:e:{r=t.type._context,i=t.pendingProps,a=t.memoizedProps,o=i.value;var s=t.type._context;if(Bf(Mp,s._currentValue),s._currentValue=o,null!==a)if(s=a.value,0===(o=df(s,o)?0:0|("function"==typeof r._calculateChangedBits?r._calculateChangedBits(s,o):1073741823))){if(a.children===i.children&&!zf.current){t=wm(e,t,n);break e}}else for(null!==(s=t.child)&&(s.return=t);null!==s;){var u=s.dependencies;if(null!==u){a=s.child;for(var l=u.firstContext;null!==l;){if(l.context===r&&0!=(l.observedBits&o)){1===s.tag&&((l=Lp(n,null)).tag=2,jp(s,l)),s.expirationTime=t&&e<=t}function hy(e,t){var n=e.firstSuspendedTime,r=e.lastSuspendedTime;nt||0===n)&&(e.lastSuspendedTime=t),t<=e.lastPingedTime&&(e.lastPingedTime=0),t<=e.lastExpiredTime&&(e.lastExpiredTime=0)}function dy(e,t){t>e.firstPendingTime&&(e.firstPendingTime=t);var n=e.firstSuspendedTime;0!==n&&(t>=n?e.firstSuspendedTime=e.lastSuspendedTime=e.nextKnownPendingLevel=0:t>=e.lastSuspendedTime&&(e.lastSuspendedTime=t+1),t>e.nextKnownPendingLevel&&(e.nextKnownPendingLevel=t))}function fy(e,t){var n=e.lastExpiredTime;(0===n||n>t)&&(e.lastExpiredTime=t)}function py(e,t,n,r){var i=t.current,o=Mg(),a=zp.suspense;o=Eg(o,i,a);e:if(n){t:{if(Ec(n=n._reactInternalFiber)!==n||1!==n.tag)throw Error(ku(170));var s=n;do{switch(s.tag){case 3:s=s.stateNode.context;break t;case 1:if(Vf(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break t}}s=s.return}while(null!==s);throw Error(ku(171))}if(1===n.tag){var u=n.type;if(Vf(u)){n=Xf(n,u,s);break e}}n=s}else n=Uf;return null===t.context?t.context=n:t.pendingContext=n,(t=Lp(o,a)).payload={element:e},null!==(r=void 0===r?null:r)&&(t.callback=r),jp(i,t),Sg(i,o),o}function vy(e){return(e=e.current).child?(e.child.tag,e.child.stateNode):null}function my(e,t){null!==(e=e.memoizedState)&&null!==e.dehydrated&&e.retryTime=t||n<0||h&&e-l>=o}function m(){var e,n,r=rb();if(v(r))return g(r);s=setTimeout(m,(n=t-((e=r)-u),h?ob(n,o-(e-l)):n))}function g(e){return s=void 0,d&&r?f(e):(r=i=void 0,a)}function y(){var e=rb(),n=v(e);if(r=arguments,i=this,u=e,n){if(void 0===s)return p(u);if(h)return clearTimeout(s),s=setTimeout(m,t),f(u)}return void 0===s&&(s=setTimeout(m,t)),a}return t=nb(t)||0,Jy(n)&&(c=!!n.leading,o=(h="maxWait"in n)?ib(nb(n.maxWait)||0,t):o,d="trailing"in n?!!n.trailing:d),y.cancel=function(){void 0!==s&&clearTimeout(s),l=0,r=u=i=s=void 0},y.flush=function(){return void 0===s?a:g(rb())},y}var sb=function(e){s(n,e);var t=u(n);function n(e){var r;return y(this,n),(r=t.call(this,e)).seeking=!1,r.mobileSeeking=!1,r.track=null,r.hoverTime=null,r.offset=0,r.secondsPrefix="00:00:",r.minutesPrefix="00:",r.seekPause=!1,r.handleTouchSeeking=function(e){for(var t=0,n=0;nthis.state.trackWidth&&(e=this.state.trackWidth-this.hoverTime.offsetWidth))),{transform:"translateX(".concat(e,"px)")}}},{key:"secondsToTime",value:function(e){e=Math.round(e+this.offset);var t=Math.floor(e/3600),n=e%3600,r=Math.floor(n/60),i=Math.ceil(n%60);return{hh:t.toString(),mm:r<10?"0"+r:r.toString(),ss:i<10?"0"+i:i.toString()}}},{key:"getHoverTime",value:function(){var e=100*this.state.seekHoverPosition/this.state.trackWidth,t=Math.floor(+e*(this.props.total/100)),n=this.secondsToTime(t);return this.props.total+this.offset<60?this.secondsPrefix+n.ss:this.props.total+this.offset<3600?this.minutesPrefix+n.mm+":"+n.ss:n.hh+":"+n.mm+":"+n.ss}},{key:"isThumbActive",value:function(){return this.state.seekHoverPosition>0||this.seeking}},{key:"drawHoverTime",value:function(){var e=this;return this.props.hideHoverTime?null:ln.createElement("div",{className:this.isThumbActive()?"hover-time active":"hover-time",style:this.getHoverTimePosition(),ref:function(t){return e.hoverTime=t}},this.getHoverTime())}},{key:"render",value:function(){var e=this;return ln.createElement("div",{className:"seek-slider"},ln.createElement("div",{className:"track",ref:function(t){return e.track=t},onMouseMove:function(t){return e.handleTrackHover(!1,t)},onMouseLeave:function(t){return e.handleTrackHover(!0,t)},onMouseDown:this.onMouseDown,onTouchStart:function(t){e.setMobileSeeking(!0),e.onMouseDown(t)},onMouseUp:this.onMouseUp,onTouchEnd:this.onMouseUp},ln.createElement("div",{className:"main"},this.renderBufferProgress(),this.renderHoverProgress(),this.renderProgress())),this.drawHoverTime(),this.renderThumb())}}]),n}(mt.exports.Component),ub=function(e){s(n,e);var t=u(n);function n(e){var r;return y(this,n),(r=t.call(this,e)).stageVolume=0,r.updateVolumeTimer=0,r.onVolumeSeeking=!1,r.onClickOperationButton=function(){r.props.paused?r.props.play():r.props.pause()},r.operationButton=function(){return r.props.paused?ln.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNOCA1LjE0djE0bDExLTdsLTExLTd6IiBmaWxsPSIjZmZmIj48L3BhdGg+PC9zdmc+Cg=="}):ln.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMTQgMTloNFY1aC00TTYgMTloNFY1SDZ2MTR6IiBmaWxsPSIjZmZmIj48L3BhdGg+PC9zdmc+Cg=="})},r.operationVolumeButton=function(){return r.props.volume>.9?ln.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMTQgMy4yM3YyLjA2YzIuODkuODYgNSAzLjU0IDUgNi43MXMtMi4xMSA1Ljg0LTUgNi43djIuMDdjNC0uOTEgNy00LjQ5IDctOC43N2MwLTQuMjgtMy03Ljg2LTctOC43N00xNi41IDEyYzAtMS43Ny0xLTMuMjktMi41LTQuMDNWMTZjMS41LS43MSAyLjUtMi4yNCAyLjUtNE0zIDl2Nmg0bDUgNVY0TDcgOUgzeiIgZmlsbD0iI2ZmZiI+PC9wYXRoPjwvc3ZnPgo="}):0===r.props.volume?ln.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNNyA5djZoNGw1IDVWNGwtNSA1SDd6IiBmaWxsPSIjZmZmIj48L3BhdGg+PC9zdmc+Cg=="}):ln.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNNSA5djZoNGw1IDVWNEw5IDltOS41IDNjMC0xLjc3LTEtMy4yOS0yLjUtNC4wM1YxNmMxLjUtLjcxIDIuNS0yLjI0IDIuNS00eiIgZmlsbD0iI2ZmZiI+PC9wYXRoPjwvc3ZnPgo="})},r.handleClickVolume=function(){0===r.props.volume?0!==r.stageVolume?r.props.setVolume(r.stageVolume):r.props.setVolume(1):(r.stageVolume=r.props.volume,r.props.setVolume(0))},r.onChange=function(e){r.setState({currentTime:e}),e&&r.changeTime(e)},r.changeTime=ab((function(e){r.props.setCurrentTime(e)}),50),r.onVolumeChange=function(e){r.changeVolume(e),r.setState({seekVolume:e/100})},r.changeVolume=ab((function(e){r.props.setVolume(e/100)}),50),r.onVolumeSeekStart=function(){r.onVolumeSeeking=!0},r.onVolumeSeekEnd=ab((function(){r.onVolumeSeeking=!1}),500),r.onProgressSeekStart=function(){return r.setState({isPlayerSeeking:!0})},r.onProgressSeekEnd=ab((function(){r.setState({isPlayerSeeking:!1})}),500),r.state={isPlayerSeeking:!1,isVolumeHover:!1,seekVolume:1,visible:!0,currentTime:0},r.stageVolume=e.volume,r}return x(n,[{key:"componentDidMount",value:function(){var e=this;this.updateVolumeTimer=setInterval((function(){e.onVolumeSeeking||e.setState({seekVolume:e.props.volume}),e.state.isPlayerSeeking||e.setState({currentTime:e.props.currentTime})}),100)}},{key:"componentWillUnmount",value:function(){this.updateVolumeTimer&&clearInterval(this.updateVolumeTimer)}},{key:"render",value:function(){var e=this,t=this.props,n=t.duration,r=t.currentTime;return ln.createElement("div",{className:"player-controller",style:{opacity:this.props.visible?"1":"0"}},ln.createElement("div",{className:"player-controller-progress"},ln.createElement(sb,{total:n,current:this.state.currentTime,onChange:this.onChange,buffered:this.props.buffered,bufferColor:"rgba(255,255,255,0.3)",hideHoverTime:!0,limitTimeTooltipBySides:!0,onSeekStart:this.onProgressSeekStart,onSeekEnd:this.onProgressSeekEnd,play:this.props.play,pause:this.props.pause,paused:this.props.paused,scale:this.props.scale})),ln.createElement("div",{className:"player-controller-actions"},ln.createElement("div",{className:"player-controller-actions-left"},ln.createElement("div",{onClick:this.onClickOperationButton,className:"player-controller-play"},this.operationButton()),ln.createElement("div",{className:"player-volume-box",onMouseEnter:function(){return e.setState({isVolumeHover:!0})},onMouseLeave:function(){return e.setState({isVolumeHover:!1})}},ln.createElement("div",{onClick:this.handleClickVolume,className:"player-volume"},this.operationVolumeButton()),ln.createElement("div",{className:"player-volume-slider"},ln.createElement(sb,{total:100,current:100*this.state.seekVolume,onChange:this.onVolumeChange,onSeekStart:this.onVolumeSeekStart,onSeekEnd:this.onVolumeSeekEnd,scale:this.props.scale,limitTimeTooltipBySides:!0,hideHoverTime:!0})))),ln.createElement("div",{className:"player-mid-box-time"},lb(Math.floor(r/1e3))," /"," ",lb(Math.floor(n/1e3)))))}}]),n}(mt.exports.Component);function lb(e){var t=e%60,n=(e-t)/60;if(n>=60){var r=n%60;return"".concat(cb((n-r)/60),":").concat(cb(r),":").concat(cb(t))}return"".concat(cb(n),":").concat(cb(t))}function cb(e){return e<=9?"0".concat(e):"".concat(e)}var hb=function(e){s(n,e);var t=u(n);function n(){var e;return y(this,n),(e=t.apply(this,arguments)).putAttributes=function(t){var n=e.props.context,r=n.getAttributes()||{};for(var i in t)r[i]!==t[i]&&n.updateAttributes([i],t[i])},e}return x(n,[{key:"render",value:function(){var e=this.props.context,t=e.getRoom(),n=t?void 0:e.getDisplayer(),r=this.putAttributes;return ln.createElement(db,{room:t,player:n,context:e,plugin:{putAttributes:r}})}}]),n}(mt.exports.Component),db=function(e){s(n,e);var t=u(n);function n(e){var r;return y(this,n),(r=t.call(this,e)).alertMask=null,r.container=ln.createRef(),r.controllerHiddenTimer=0,r.syncPlayerTimer=0,r.retryCount=0,r.decreaseRetryTimer=0,r.noSoundSyncCount=0,r.showController=function(){r.setState({controllerVisible:!0}),r.debounceHidingController()},r.play=function(){var e,t=null==(e=r.props.room)?void 0:e.calibrationTimestamp;r.debug(">>> play",{paused:!1,hostTime:t}),r.isEnabled()&&r.props.plugin.putAttributes({paused:!1,hostTime:t})},r.pause=function(){var e=Ly(r.getAttributes(),r.props);r.debug(">>> pause",{paused:!0,currentTime:e}),r.isEnabled()&&r.props.plugin.putAttributes({paused:!0,currentTime:e})},r.setVolume=function(e){r.debug(">>> volume",{volume:e}),r.isEnabled()&&r.props.plugin.putAttributes({volume:e}),r.isEnabled()&&r.props.plugin.putAttributes({volume:e,muted:0===e})},r.setCurrentTime=function(e){var t,n=null==(t=r.props.room)?void 0:t.calibrationTimestamp;r.debug(">>> seek",{currentTime:e/1e3,hostTime:n}),r.isEnabled()&&r.props.plugin.putAttributes({currentTime:e/1e3,hostTime:n})},r.resetPlayer=function(){var e;null==(e=r.player)||e.autoplay(!1),r.state.NoSound||(r.debug(">>> ended",{paused:!0,currentTime:0}),r.isEnabled()&&r.props.plugin.putAttributes({paused:!0,currentTime:0}))},r.syncPlayerWithAttributes=function(){var e,t=r.getAttributes();if(t){var n=r.player;if(n&&(!r.state.NoSound||(r.noSoundSyncCount+=1)%8==0)){n.paused()!==t.paused&&(r.debug("<<< paused -> %o",t.paused),t.paused?n.pause():null==(e=n.play())||e.catch(r.catchPlayFail)),n.muted()!==t.muted&&(r.debug("<<< muted -> %o",t.muted),n.muted(t.muted)),n.volume()!==t.volume&&(r.debug("<<< volume -> %o",t.volume),n.volume(t.volume));var i=Ly(t,r.props),o=Ry.currentTimeMaxError;r.state.NoSound&&(o*=3),i>n.duration()?r.resetPlayer():Math.abs(n.currentTime()-i)>o&&(r.debug("<<< currentTime -> %o",i),n.currentTime(i))}}},r.debounceHidingController=function(){r.controllerHiddenTimer&&(clearTimeout(r.controllerHiddenTimer),r.controllerHiddenTimer=0),r.controllerHiddenTimer=setTimeout((function(){r.setState({controllerVisible:!1}),r.controllerHiddenTimer=0}),3e3)},r.decreaseRetryCount=function(){r.player&&r.retryCount>0&&(r.retryCount=r.retryCount-1)},r.catchPlayFail=function(e){var t,n,i=String(e);if(jy&&i.includes("NotAllowedError")||i.includes("interact"))null==(t=r.player)||t.autoplay("any"),r.setState({NoSound:!0});else{var o=null==(n=r.player)?void 0:n.error();o&&(r.retryCount<=3?(r.initPlayer(),r.retryCount=r.retryCount+1):(r.debug("catch videojs media error",o),r.setState({MediaError:!0}))),r.debug("catch error",e)}},r.fixPlayFail=function(){r.debug("try to fix play state"),r.setState({NoSound:!1});var e=r.getAttributes(),t=e.muted,n=e.volume;r.player&&(r.player.muted(t),r.player.volume(n))},r.initPlayer=g(regeneratorRuntime.mark((function e(){var t,n,i,o,a,s,u,l,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return null==(t=r.player)||t.dispose(),r.player=void 0,r.debug("creating elements ..."),n=r.getAttributes(),i=n.type,o=n.src,a=n.poster,(s=document.createElement("div")).setAttribute("data-vjs-player",""),(u=document.createElement("video")).className="video-js",a&&(u.poster=a),u.setAttribute("playsInline",""),u.setAttribute("webkit-playsinline",""),l=document.createElement("source"),new URL(o).pathname.endsWith(".m3u8")?l.type="application/x-mpegURL":u.src=o,l.src=o,i&&(l.type=i),u.appendChild(l),s.appendChild(u),r.container.current.appendChild(s),e.next=14,new Promise((function(e){return(window.requestAnimationFrame||window.setTimeout)(e)}));case 14:r.debug("initializing videojs() ..."),c=Z.default(u),r.player=c,window.player=c,c.one("loadedmetadata",r.gracefullyUpdate),c.on("ready",(function(){var e;null==(e=Ry.onPlayer)||e.call(Ry,c),c.on("timeupdate",r.gracefullyUpdate),c.on("volumechange",r.gracefullyUpdate),c.on("seeked",r.gracefullyUpdate),c.on("play",r.gracefullyUpdate),c.on("pause",r.gracefullyUpdate),c.on("ended",r.resetPlayer)})),c.on("error",r.catchPlayFail),r.setState({MediaError:!1});case 17:case"end":return e.stop()}}),e)}))),r.gracefullyUpdate=function(){return r.setState({updater:!r.state.updater})},r.setupAlert=function(e){e&&(e.addEventListener("touchstart",r.fixPlayFail),e.addEventListener("click",r.fixPlayFail)),r.alertMask=e},r.setupReload=function(e){e&&(e.addEventListener("touchstart",r.initPlayer),e.addEventListener("click",r.initPlayer))},r.state={NoSound:!1,MediaError:!1,updater:!1,controllerVisible:!1},e.room&&function(e){if(!e.calibrationTimestamp)throw new Error("@netless/app-media-player@0.1.0-alpha.5 requires white-web-sdk@^2.13.8 to work properly.")}(e.room),r}return x(n,[{key:"getAttributes",value:function(){var e=this.props.context.getAttributes();if(e){if(e=Dy(Dy({},Py),e),this.player){var t=Ly(e,this.props),n=this.player.duration();!e.paused&&t>n&&(r=Dy({},e),e=Sy(r,Ay({currentTime:0,paused:!0})),this.resetPlayer())}var r;return e}}},{key:"isShowingPoster",value:function(){var e=this.getAttributes();return!(null!=e&&e.src)||By.some((function(t){return e.src.endsWith(t)}))}},{key:"render",value:function(){var e,t;if(!this.props.room&&!this.props.player)return null;var n=this.getAttributes();if(!n)return null;var r=1e3*((null==(e=this.player)?void 0:e.duration())||1e3),i=(null==(t=this.player)?void 0:t.bufferedPercent())||0;return ln.createElement("div",{className:this.isEnabled()?"vjs-p":"vjs-p disabled",onMouseEnter:this.showController,onMouseMove:this.showController},ln.createElement("div",{className:"video-js-plugin-player",ref:this.container}),this.isShowingPoster()&&ln.createElement("div",{className:"video-js-plugin-poster"},n.poster&&ln.createElement("img",{src:n.poster,alt:"",draggable:!1})),ln.createElement(ub,{duration:r,volume:n.volume,setVolume:this.setVolume,paused:n.paused,play:this.play,pause:this.pause,currentTime:1e3*Ly(n,this.props),setCurrentTime:this.setCurrentTime,buffered:r*i,visible:!0}),this.state.NoSound&&ln.createElement("div",{ref:this.setupAlert,className:"videojs-plugin-muted-alert"}),this.state.MediaError&&ln.createElement("div",{className:"videojs-plugin-recovery-mode"},ln.createElement("button",{ref:this.setupReload},"Reload Player")))}},{key:"debug",value:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i0&&void 0!==arguments[0]?arguments[0]:B.AnimationMode.Immediately;if(this.inDisplaySceneDir){var t=this.attributes,n=t.width,r=void 0===n?1280:n,i=t.height,o=void 0===i?720:i,a=r?-r/2:0,s=o?-o/2:0;this.manager.moveCameraToContain({originX:a,originY:s,width:r,height:o,animationMode:e})}}},{key:"handleSetPage",value:function(e){if(!this.isReplay&&this.attributes.displaySceneDir){var t=e.payload,n=this.displayer,r=n.entireScenes()[this.attributes.displaySceneDir];if(!r||r.length!==t){var i=function(e,t){return new Array(e).fill(0).map((function(e,n){return t(n)}))}(t,(function(e){return{name:String(e+1)}}));n.putScenes(this.attributes.displaySceneDir,i),this.manager.setMainViewScenePath(this.attributes.displaySceneDir)}}}},{key:"listenIframe",value:function(t){var n=this;t.url&&this.iframe.src!==t.url&&(this.src_url_equal_anchor||(this.src_url_equal_anchor=document.createElement("a")),this.src_url_equal_anchor.href=t.url,this.src_url_equal_anchor.href!==this.iframe.src&&(this.iframe.src=t.url)),this.iframe.width="".concat(t.width,"px"),this.iframe.height="".concat(t.height,"px"),this.sideEffectManager.addEventListener(this.iframe,"load",(function(t){var r;n.postMessage({kind:"Init",payload:{attributes:n.attributes,roomState:null==(r=e.displayer)?void 0:r.state,currentPage:n.currentPage,observerId:n.displayer.observerId}}),e.emitter.emit("IframeLoad",t),n.sideEffectManager.addDisposer(e.emitter.on("Ready",(function(){var e;n.postMessage(null==(e=n.attributes.lastEvent)?void 0:e.payload)})),gb),n.computedStyleAndIframeDisplay()}),void 0,_b)}},{key:"listenDisplayerState",value:function(){var e=this;this.isReplay&&(this.displayer._phase===B.PlayerPhase.Playing&&this.computedStyleAndIframeDisplay(),this.sideEffectManager.add((function(){return e.displayer.callbacks.on("onPhaseChanged",e.onPhaseChangedListener),function(){return e.displayer.callbacks.off("onPhaseChanged",e.onPhaseChangedListener)}}),wb)),this.computedStyleAndIframeDisplay()}},{key:"computedStyleAndIframeDisplay",value:function(){this.computedStyle(this.displayer.state),this.computedIframeDisplay(this.displayer.state,this.attributes)}},{key:"listenDisplayerCallbacks",value:function(){this.displayer.callbacks.on(this.callbackName,this.stateChangeListener)}},{key:"computedStyle",value:function(e){var t=this.manager.cameraState,n=this.attributes.width||1280,r=this.attributes.height||720;if(this.iframe){var i=t.width,o=t.height,a=t.scale,s=t.centerX,u=t.centerY,l=this.rootRect||{x:0,y:0},c="".concat(i/2+l.x,"px"),h="".concat(o/2+l.y,"px"),d=-u*a+(o-r)/2*a,f=["position: absolute;","border: 0.1px solid rgba(0,0,0,0);","top: 0px;","left: 0px;","transform-origin: ".concat(c," ").concat(h,";"),"transform: translate(".concat(-s*a+(i-n)/2*a,"px,").concat(d,"px) scale(").concat(a,", ").concat(a,");")];this.cssList=f,this.computedZindex(),this.updateStyle()}}},{key:"computedIframeDisplay",value:function(t,n){this.inDisplaySceneDir?e.emitter.emit("DispayIframe"):e.emitter.emit("HideIframe")}},{key:"computedZindex",value:function(){var e="z-index: -1;",t=this.cssList.findIndex((function(t){return t===e}));-1!==t&&this.cssList.splice(t,1),(!this.isClicker()||this.isDisableInput)&&this.cssList.push(e)}},{key:"updateStyle",value:function(){this.iframe.style.cssText=this.cssList.join(" ")}},{key:"messageListener",value:function(e){if(tt("<<<",JSON.stringify(e.data)),e.origin===this.iframeOrigin){var t=e.data;switch(t.kind){case"SetAttributes":this.handleSetAttributes(t);break;case"RegisterMagixEvent":this.handleRegisterMagixEvent(t);break;case"RemoveMagixEvent":this.handleRemoveMagixEvent(t);break;case"DispatchMagixEvent":this.handleDispatchMagixEvent(t);break;case"RemoveAllMagixEvent":this.handleRemoveAllMagixEvent();break;case"NextPage":this.handleNextPage();break;case"PrevPage":this.handlePrevPage();break;case"SDKCreate":this.handleSDKCreate();break;case"SetPage":this.handleSetPage(t);break;case"GetAttributes":this.handleGetAttributes();break;case"PageTo":this.handlePageTo(t);break;default:tt("".concat(t.kind," not allow event."))}}}},{key:"handleSDKCreate",value:function(){this.postMessage({kind:"Init",payload:{attributes:this.attributes,roomState:this.displayer.state,currentPage:this.currentPage,observerId:this.displayer.observerId}})}},{key:"handleDispatchMagixEvent",value:function(e){var t=e.payload;this.appManager.safeDispatchMagixEvent(t.event,t.payload)}},{key:"handleSetAttributes",value:function(e){this.setAttributes(e.payload)}},{key:"handleRegisterMagixEvent",value:function(e){var t=this,n=e.payload,r=function(e){e.authorId!==t.displayer.observerId&&t.postMessage({kind:"ReciveMagixEvent",payload:e})};this.magixEventMap.set(n,r),this.displayer.addMagixEventListener(n,r)}},{key:"handleRemoveMagixEvent",value:function(e){var t=e.payload,n=this.magixEventMap.get(t);this.displayer.removeMagixEventListener(t,n)}},{key:"handleNextPage",value:function(){this.manager.canOperate&&(this.manager.nextPage(),this.dispatchMagixEvent("NextPage",{}))}},{key:"handlePrevPage",value:function(){this.manager.canOperate&&(this.manager.prevPage(),this.dispatchMagixEvent("PrevPage",{}))}},{key:"handlePageTo",value:function(e){if(this.manager.canOperate){var t=e.payload;if(!Number.isSafeInteger(t)||t<=0)return;this.manager.setMainViewSceneIndex(t-1),this.dispatchMagixEvent("PageTo",t-1)}}},{key:"handleRemoveAllMagixEvent",value:function(){var e=this;this.magixEventMap.forEach((function(t,n){e.displayer.removeMagixEventListener(n,t)})),this.magixEventMap.clear()}},{key:"handleGetAttributes",value:function(){this.postMessage({kind:"GetAttributes",payload:this.attributes})}},{key:"postMessage",value:function(e){var t;this.iframe&&(null==(t=this.iframe.contentWindow)||t.postMessage(JSON.parse(JSON.stringify(e)),"*"))}},{key:"dispatchMagixEvent",value:function(e,t){this.manager.canOperate&&(this.setAttributes({lastEvent:{name:e,payload:t}}),this.displayer.dispatchMagixEvent(e,t))}},{key:"isClicker",value:function(){if(this.readonly)return!1;var e=this.displayer.state.memberState.currentApplianceName;return this.allowAppliances.includes(e)}},{key:"attributes",get:function(){return this.appManager.store.getIframeBridge()}},{key:"isReplay",get:function(){return this.manager.isReplay}},{key:"callbackName",get:function(){return this.isReplay?"onPlayerStateChanged":"onRoomStateChanged"}},{key:"iframeOrigin",get:function(){if(this.iframe)try{return new URL(this.iframe.src).origin}catch(e){console.warn(e)}}},{key:"currentIndex",get:function(){return this.manager.mainViewSceneIndex}},{key:"currentPage",get:function(){return this.currentIndex+1}},{key:"totalPage",get:function(){return this.manager.mainViewScenesLength}},{key:"readonly",get:function(){return!this.displayer.isWritable}},{key:"inDisplaySceneDir",get:function(){return this.manager.mainViewSceneDir===this.attributes.displaySceneDir}},{key:"isDisableInput",get:function(){return!("disableDeviceInputs"in this.displayer)||this.displayer.disableDeviceInputs}}],[{key:"onCreate",value:function(t){e.emitter.emit("StartCreate"),e.emitter.emit("OnCreate",t),e.emitter.emit("created")}}]),e}(),Sb=Eb;Sb.kind="IframeBridge",Sb.hiddenClass="netless-iframe-brdige-hidden",Sb.emitter=new Q.default,Sb.displayer=null,Sb.alreadyCreate=!1;var Ab=new xo({emitter:ue}),Ib=function(e){s(b,e);var t,n,r,i,o,a,l,c,h,d,f,p,v,m=u(b);function b(e){var t;return y(this,b),(t=m.call(this,e)).version="0.4.65",t.dependencies={dependencies:{"@juggle/resize-observer":"^3.3.1","@netless/telebox-insider":"0.2.27",emittery:"^0.9.2",lodash:"^4.17.21","p-retry":"^4.6.1","side-effect-manager":"^0.1.5",uuid:"^7.0.3","video.js":">=7"},peerDependencies:{jspdf:"2.5.1","white-web-sdk":"^2.16.0"},devDependencies:{"@netless/app-docs-viewer":"^0.2.16","@netless/app-media-player":"0.1.0-beta.5","@rollup/plugin-commonjs":"^20.0.0","@rollup/plugin-node-resolve":"^13.0.4","@rollup/plugin-url":"^6.1.0","@sveltejs/vite-plugin-svelte":"^1.0.0-next.22","@tsconfig/svelte":"^2.0.1","@types/debug":"^4.1.7","@types/lodash":"^4.14.182","@types/lodash-es":"^4.17.4","@types/uuid":"^8.3.1","@typescript-eslint/eslint-plugin":"^4.30.0","@typescript-eslint/parser":"^4.30.0","@vitest/ui":"^0.14.1",cypress:"^8.7.0",dotenv:"^10.0.0",eslint:"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-svelte3":"^3.2.0",jsdom:"^19.0.0",jspdf:"^2.5.1",less:"^4.1.1",prettier:"^2.3.2","prettier-plugin-svelte":"^2.4.0","rollup-plugin-analyzer":"^4.0.0","rollup-plugin-styles":"^3.14.1",svelte:"^3.42.4",typescript:"^4.5.5",vite:"^2.5.3",vitest:"^0.14.1","white-web-sdk":"2.16.43"}},t.emitter=ae,t.viewMode=B.ViewMode.Broadcaster,t.isReplay=B.isPlayer(t.displayer),t.containerSizeRatio=b.containerSizeRatio,b.displayer=e.displayer,window.NETLESS_DEPS={dependencies:{"@juggle/resize-observer":"^3.3.1","@netless/telebox-insider":"0.2.27",emittery:"^0.9.2",lodash:"^4.17.21","p-retry":"^4.6.1","side-effect-manager":"^0.1.5",uuid:"^7.0.3","video.js":">=7"},peerDependencies:{jspdf:"2.5.1","white-web-sdk":"^2.16.0"},devDependencies:{"@netless/app-docs-viewer":"^0.2.16","@netless/app-media-player":"0.1.0-beta.5","@rollup/plugin-commonjs":"^20.0.0","@rollup/plugin-node-resolve":"^13.0.4","@rollup/plugin-url":"^6.1.0","@sveltejs/vite-plugin-svelte":"^1.0.0-next.22","@tsconfig/svelte":"^2.0.1","@types/debug":"^4.1.7","@types/lodash":"^4.14.182","@types/lodash-es":"^4.17.4","@types/uuid":"^8.3.1","@typescript-eslint/eslint-plugin":"^4.30.0","@typescript-eslint/parser":"^4.30.0","@vitest/ui":"^0.14.1",cypress:"^8.7.0",dotenv:"^10.0.0",eslint:"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-svelte3":"^3.2.0",jsdom:"^19.0.0",jspdf:"^2.5.1",less:"^4.1.1",prettier:"^2.3.2","prettier-plugin-svelte":"^2.4.0","rollup-plugin-analyzer":"^4.0.0","rollup-plugin-styles":"^3.14.1",svelte:"^3.42.4",typescript:"^4.5.5",vite:"^2.5.3",vitest:"^0.14.1","white-web-sdk":"2.16.43"}},t}return x(b,[{key:"bindContainer",value:function(e){var t,n,r,i,o,a;if(B.isRoom(this.displayer)&&this.room.phase!==B.RoomPhase.Connected)throw new Ge;if(b.isCreated&&b.container)b.container.firstChild&&e.appendChild(b.container.firstChild);else if(b.params){var s=b.params,u=b.initContainer(this,e,s);this.boxManager&&this.boxManager.destroy();var l=function(e,t,n,r,i){return new Ii({safeSetAttributes:function(t){return e.safeSetAttributes(t)},getMainView:function(){return e.mainView},updateAppState:function(){var t,n;return null==(n=e.appManager)?void 0:(t=n.store).updateAppState.apply(t,arguments)},canOperate:function(){return e.canOperate},notifyContainerRectUpdate:function(t){var n;return null==(n=e.appManager)?void 0:n.notifyContainerRectUpdate(t)},cleanFocus:function(){var t;return null==(t=e.appManager)?void 0:t.store.cleanFocus()},setAppFocus:function(t){var n;return null==(n=e.appManager)?void 0:n.store.setAppFocus(t,!0)},callbacks:t,emitter:n,boxEmitter:r},i)}(this,ae,ue,rt,{collectorContainer:s.collectorContainer,collectorStyles:s.collectorStyles,prefersColorScheme:s.prefersColorScheme});this.boxManager=l,null==(t=this.appManager)||t.setBoxManager(l),this.bindMainView(u,s.disableCameraTransform),b.wrapper&&(null==(n=this.cursorManager)||n.setupWrapper(b.wrapper))}ue.emit("updateManagerRect"),null==(r=this.appManager)||r.refresh(),null==(i=this.appManager)||i.resetMaximized(),null==(o=this.appManager)||o.resetMinimized(),null==(a=this.appManager)||a.displayerWritableListener(!this.room.isWritable),b.container=e}},{key:"bindCollectorContainer",value:function(e){b.isCreated&&this.boxManager?this.boxManager.setCollectorContainer(e):b.params&&(b.params.collectorContainer=e)}},{key:"addApp",value:(v=g(regeneratorRuntime.mark((function e(t){var n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.appManager){e.next=2;break}return e.abrupt("return",this.appManager.rootDirRemoving?new Promise((function(e,r){ue.once("rootDirRemoved").then(g(regeneratorRuntime.mark((function i(){var o;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.prev=0,i.next=3,n._addApp(t);case 3:o=i.sent,e(o),i.next=10;break;case 7:i.prev=7,i.t0=i.catch(0),r(i.t0.message);case 10:case"end":return i.stop()}}),i,null,[[0,7]])}))))})):this._addApp(t));case 2:throw new Le;case 3:case"end":return e.stop()}}),e,this)}))),function(e){return v.apply(this,arguments)})},{key:"_addApp",value:(p=g(regeneratorRuntime.mark((function e(t){var n,r,i,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.appManager){e.next=20;break}if(t.kind&&"string"==typeof t.kind){e.next=3;break}throw new Be;case 3:return e.next=5,null==(n=xe.appClasses.get(t.kind))?void 0:n();case 5:if(!((o=e.sent)&&(null==(r=o.config)?void 0:r.singleton)&&this.appManager.appProxies.has(t.kind))){e.next=8;break}throw new Oe;case 8:if(void 0!==(a=this.setupScenePath(t,this.appManager))){e.next=13;break}e.t0=void 0,e.next=17;break;case 13:return null!=(i=null==t?void 0:t.options)&&i.scenePath&&(t.options.scenePath=Ce(t.options.scenePath)),e.next=16,this.appManager.addApp(t,Boolean(a));case 16:e.t0=e.sent;case 17:return e.abrupt("return",e.t0);case 20:throw new Le;case 21:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"setupScenePath",value:function(e,t){var n=!1;if(e.options){var r=e.options,i=r.scenePath,o=r.scenes;if(i){if(!function(e){return e.startsWith("/")}(i))throw new Fe;for(var a=0,s=Object.keys(this.apps||{});a0&&(this.isDynamicPPT(o)?(n=!0,Se(this.displayer)[i]||Ae(this.room,i,o)):Se(this.displayer)[i]||Ae(this.room,i,[{name:o[0].name}])),i&&void 0===o&&Ae(this.room,i,[{}])}return n}},{key:"setMainViewScenePath",value:(f=g(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this.appManager,!e.t0){e.next=4;break}return e.next=4,this.appManager.setMainViewScenePath(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return f.apply(this,arguments)})},{key:"setMainViewSceneIndex",value:(d=g(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this.appManager,!e.t0){e.next=4;break}return e.next=4,this.appManager.setMainViewSceneIndex(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return d.apply(this,arguments)})},{key:"nextPage",value:(h=g(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.appManager){e.next=12;break}if(!((t=this.mainViewSceneIndex+1)>=this.mainViewScenesLength)){e.next=6;break}e.t0=(console.warn("[WindowManager]: current page is the last page"),!1),e.next=9;break;case 6:return e.next=8,this.appManager.setMainViewSceneIndex(t);case 8:e.t0=!0;case 9:return e.abrupt("return",e.t0);case 12:return e.abrupt("return",!1);case 13:case"end":return e.stop()}}),e,this)}))),function(){return h.apply(this,arguments)})},{key:"prevPage",value:(c=g(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.appManager){e.next=12;break}if(!((t=this.mainViewSceneIndex-1)<0)){e.next=6;break}e.t0=(console.warn("[WindowManager]: current page is the first page"),!1),e.next=9;break;case 6:return e.next=8,this.appManager.setMainViewSceneIndex(t);case 8:e.t0=!0;case 9:return e.abrupt("return",e.t0);case 12:return e.abrupt("return",!1);case 13:case"end":return e.stop()}}),e,this)}))),function(){return c.apply(this,arguments)})},{key:"jumpPage",value:(l=g(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.appManager){e.next=11;break}if(!(t<0||t>=this.pageState.length)){e.next=5;break}e.t1=(console.warn("[WindowManager]: index ".concat(t," out of range")),!1),e.next=8;break;case 5:return e.next=7,this.appManager.setMainViewSceneIndex(t);case 7:e.t1=!0;case 8:e.t0=e.t1,e.next=12;break;case 11:e.t0=!1;case 12:return e.abrupt("return",e.t0);case 13:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"addPage",value:(a=g(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.appManager&&(n=null==t?void 0:t.after,r=null==t?void 0:t.scene,n?(i=this.mainViewSceneIndex+1,this.room.putScenes(ie,[r||{}],i)):this.room.putScenes(ie,[r||{}]));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"removePage",value:(o=g(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.appManager){e.next=5;break}return n=void 0===t?this.pageState.index:t,e.abrupt("return",1===this.pageState.length?(console.warn("[WindowManager]: can not remove the last page"),!1):n<0||n>=this.pageState.length?(console.warn("[WindowManager]: index ".concat(t," out of range")),!1):this.appManager.removeSceneByIndex(n));case 5:return e.abrupt("return",!1);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"getMainViewScenePath",value:function(){var e;return null==(e=this.appManager)?void 0:e.store.getMainViewScenePath()}},{key:"getMainViewSceneIndex",value:function(){var e;return null==(e=this.appManager)?void 0:e.store.getMainViewSceneIndex()}},{key:"setReadonly",value:function(e){var t;this.readonly=e,null==(t=this.boxManager)||t.setReadonly(e),ue.emit("setReadonly",e)}},{key:"switchMainViewToWriter",value:function(){var e;return null==(e=this.appManager)?void 0:e.mainViewProxy.mainViewClickHandler()}},{key:"onAppDestroy",value:function(e,t){!function(e,t){ue.once(e).then(t)}("destroy-".concat(e),t)}},{key:"setViewMode",value:function(e){var t,n,r,i;(e===B.ViewMode.Broadcaster||e===B.ViewMode.Follower)&&(this.canOperate&&e===B.ViewMode.Broadcaster&&(null==(t=this.appManager)||t.mainViewProxy.setCameraAndSize()),null==(n=this.appManager)||n.mainViewProxy.start()),e===B.ViewMode.Freedom&&(null==(r=this.appManager)||r.mainViewProxy.stop()),this.viewMode=e,null==(i=this.appManager)||i.mainViewProxy.setViewMode(e)}},{key:"setBoxState",value:function(e){if(this.canOperate)switch(e){case"normal":this.setMaximized(!1),this.setMinimized(!1);break;case"maximized":this.setMaximized(!0),this.setMinimized(!1);break;case"minimized":this.setMinimized(!0)}}},{key:"setMaximized",value:function(e){var t;!this.canOperate||null==(t=this.boxManager)||t.setMaximized(e,!1)}},{key:"setMinimized",value:function(e){var t;!this.canOperate||null==(t=this.boxManager)||t.setMinimized(e,!1)}},{key:"setFullscreen",value:function(e){var t;this._fullscreen!==e&&(this._fullscreen=e,null==(t=b.sizer)||t.classList.toggle("netless-window-manager-fullscreen",e),ae.emit("fullscreenChange",e))}},{key:"queryAll",value:function(){var e;return Array.from((null==(e=this.appManager)?void 0:e.appProxies.values())||[])}},{key:"queryOne",value:function(e){var t;return null==(t=this.appManager)?void 0:t.appProxies.get(e)}},{key:"closeApp",value:(i=g(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",null==(n=this.appManager)?void 0:n.closeApp(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"focusApp",value:function(e){var t,n,r,i=null==(t=this.boxManager)?void 0:t.getBox(e);i&&(null==(n=this.boxManager)||n.focusBox({appId:e},!1),(null==(r=this.boxManager)?void 0:r.teleBoxManager).makeBoxTop(i,!1))}},{key:"moveCamera",value:function(e){var t,n=this,r=j.omit(e,["animationMode"]),i=P({},this.mainView.camera);j.isEqual(P(P({},i),r),i)||(this.mainView.moveCamera(e),null==(t=this.appManager)||t.dispatchInternalEvent(q.MoveCamera,e),setTimeout((function(){var e;null==(e=n.appManager)||e.mainViewProxy.setCameraAndSize()}),500))}},{key:"moveCameraToContain",value:function(e){var t,n=this;this.mainView.moveCameraToContain(e),null==(t=this.appManager)||t.dispatchInternalEvent(q.MoveCameraToContain,e),setTimeout((function(){var e;null==(e=n.appManager)||e.mainViewProxy.setCameraAndSize()}),500)}},{key:"convertToPointInWorld",value:function(e){return this.mainView.convertToPointInWorld(e)}},{key:"setCameraBound",value:function(e){this.mainView.setCameraBound(e)}},{key:"onDestroy",value:function(){this._destroy()}},{key:"destroy",value:function(){this._destroy()}},{key:"_destroy",value:function(){var e,t,n,r,i;null==(e=this.containerResizeObserver)||e.disconnect(),null==(t=this.appManager)||t.destroy(),null==(n=this.cursorManager)||n.destroy(),b.container=void 0,b.wrapper=void 0,b.sizer=void 0,b.isCreated=!1,b.playground&&(null==(r=b.playground.parentNode)||r.removeChild(b.playground)),b.params=void 0,null==(i=this._iframeBridge)||i.destroy(),this._iframeBridge=void 0,tt("Destroyed")}},{key:"bindMainView",value:function(e,t){var n;this.appManager&&(this.appManager.bindMainView(e,Boolean(t)),null==(n=this.cursorManager)||n.setMainViewDivElement(e))}},{key:"safeSetAttributes",value:function(e){this.canOperate&&this.setAttributes(e)}},{key:"safeUpdateAttributes",value:function(e,t){this.canOperate&&this.updateAttributes(e,t)}},{key:"setPrefersColorScheme",value:function(e){var t,n;null==(n=null==(t=this.appManager)?void 0:t.boxManager)||n.setPrefersColorScheme(e)}},{key:"cleanCurrentScene",value:function(){var e;tt("clean current scene"),null==(e=this.focusedView)||e.cleanCurrentScene()}},{key:"redo",value:function(){var e;return(null==(e=this.focusedView)?void 0:e.redo())||0}},{key:"undo",value:function(){var e;return(null==(e=this.focusedView)?void 0:e.undo())||0}},{key:"delete",value:function(){var e;null==(e=this.focusedView)||e.delete()}},{key:"copy",value:function(){var e;null==(e=this.focusedView)||e.copy()}},{key:"paste",value:function(){var e;null==(e=this.focusedView)||e.paste()}},{key:"duplicate",value:function(){var e;null==(e=this.focusedView)||e.duplicate()}},{key:"insertText",value:function(e,t,n){var r;return(null==(r=this.focusedView)?void 0:r.insertText(e,t,n))||""}},{key:"insertImage",value:function(e){var t;return null==(t=this.focusedView)?void 0:t.insertImage(e)}},{key:"completeImageUpload",value:function(e,t){var n;return null==(n=this.focusedView)?void 0:n.completeImageUpload(e,t)}},{key:"lockImage",value:function(e,t){var n;return null==(n=this.focusedView)?void 0:n.lockImage(e,t)}},{key:"lockImages",value:function(e){var t;return null==(t=this.focusedView)?void 0:t.lockImages(e)}},{key:"refresh",value:function(){var e;this._refresh(),null==(e=this.appManager)||e.dispatchInternalEvent(q.Refresh)}},{key:"_refresh",value:function(){var e,t,n;null==(e=this.appManager)||e.mainViewProxy.rebind(),b.container&&this.bindContainer(b.container),null==(n=null==(t=this.appManager)?void 0:t.refresher)||n.refresh()}},{key:"setContainerSizeRatio",value:function(e){if(!(j.isNumber(e)&&e>0))throw new Error("[WindowManager]: updateContainerSizeRatio error, ratio must be a positive number. but got ".concat(e));b.containerSizeRatio=e,this.containerSizeRatio=e,ue.emit("containerSizeRatioUpdate",e)}},{key:"isDynamicPPT",value:function(e){var t,n,r=null==(n=null==(t=e[0])?void 0:t.ppt)?void 0:n.src;return null==r?void 0:r.startsWith("pptx://")}},{key:"ensureAttributes",value:(r=g(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=j.isNull(this.attributes),!e.t0){e.next=4;break}return e.next=4,ke(50);case 4:j.isObject(this.attributes)&&(this.attributes[$e.Apps]||this.safeSetAttributes(w({},$e.Apps,{})),this.attributes[$e.Cursors]||this.safeSetAttributes(w({},$e.Cursors,{})),this.attributes._mainScenePath||this.safeSetAttributes({_mainScenePath:oe}),this.attributes._mainSceneIndex||this.safeSetAttributes({_mainSceneIndex:0}),this.attributes[$e.Registered]||this.safeSetAttributes(w({},$e.Registered,{})),this.attributes[$e.IframeBridge]||this.safeSetAttributes(w({},$e.IframeBridge,{})));case 5:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"getIframeBridge",value:function(){if(!this.appManager)throw new Error("[WindowManager]: should call getIframeBridge() after await mount()");return this._iframeBridge||(this._iframeBridge=new Sb(this,this.appManager)),this._iframeBridge}},{key:"mainView",get:function(){if(this.appManager)return this.appManager.mainViewProxy.view;throw new Le}},{key:"camera",get:function(){if(this.appManager)return this.appManager.mainViewProxy.view.camera;throw new Le}},{key:"cameraState",get:function(){if(this.appManager)return this.appManager.mainViewProxy.cameraState;throw new Le}},{key:"apps",get:function(){var e;return null==(e=this.appManager)?void 0:e.store.apps()}},{key:"boxState",get:function(){var e;if(this.appManager)return null==(e=this.appManager.boxManager)?void 0:e.boxState;throw new Le}},{key:"darkMode",get:function(){var e,t;return Boolean(null==(t=null==(e=this.appManager)?void 0:e.boxManager)?void 0:t.darkMode)}},{key:"prefersColorScheme",get:function(){var e;if(this.appManager)return null==(e=this.appManager.boxManager)?void 0:e.prefersColorScheme;throw new Le}},{key:"focused",get:function(){return this.attributes.focus}},{key:"focusedView",get:function(){var e,t;return(null==(t=null==(e=this.appManager)?void 0:e.focusApp)?void 0:t.view)||this.mainView}},{key:"mainViewSceneIndex",get:function(){var e;return(null==(e=this._pageState)?void 0:e.index)||0}},{key:"mainViewSceneDir",get:function(){var e;if(this.appManager)return null==(e=this.appManager)?void 0:e.getMainViewSceneDir();throw new Le}},{key:"topApp",get:function(){var e,t;return null==(t=null==(e=this.boxManager)?void 0:e.getTopBox())?void 0:t.id}},{key:"mainViewScenesLength",get:function(){var e;return(null==(e=this._pageState)?void 0:e.length)||0}},{key:"canRedoSteps",get:function(){var e;return(null==(e=this.focusedView)?void 0:e.canRedoSteps)||0}},{key:"canUndoSteps",get:function(){var e;return(null==(e=this.focusedView)?void 0:e.canUndoSteps)||0}},{key:"sceneState",get:function(){if(this.appManager)return this.appManager.sceneState;throw new Le}},{key:"pageState",get:function(){if(this._pageState)return this._pageState.toObject();throw new Le}},{key:"fullscreen",get:function(){return Boolean(this._fullscreen)}},{key:"canOperate",get:function(){return!!B.isRoom(this.displayer)&&(this.displayer.isWritable&&this.displayer.phase===B.RoomPhase.Connected)}},{key:"room",get:function(){return this.displayer}}],[{key:"mount",value:(n=g(regeneratorRuntime.mark((function e(t){var n,r,i,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.room,b.container=t.container,r=t.containerSizeRatio,i=t.debug,o=t.cursor,b.params=t,b.displayer=t.room,ht(),!B.isRoom(n)){e.next=11;break}if(n.phase===B.RoomPhase.Connected){e.next=7;break}throw new Error("[WindowManager]: Room only Connected can be mount");case 7:return n.phase===B.RoomPhase.Connected&&n.isWritable&&(n.disableSerialization=!1),e.next=10,this.initManager(n);case 10:a=e.sent;case 11:if(!b.isCreated){e.next=13;break}throw new Error("[WindowManager]: Already created cannot be created again");case 13:if(this.debug=Boolean(i),tt("Already insert room",a),!B.isRoom(this.displayer)){e.next=18;break}if(a){e.next=16;break}throw new Error("[WindowManager]: init InvisiblePlugin failed");case 16:e.next=20;break;case 18:return e.next=20,X.default(function(){var e=g(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.getInvisiblePlugin(b.kind);case 2:if(a=e.sent){e.next=5;break}throw tt("manager is empty. retrying ".concat(t)),new Error;case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),{retries:10,maxTimeout:5e3});case 20:if(a){e.next=22;break}throw new Error("[WindowManager]: create manager failed");case 22:return r&&(b.containerSizeRatio=r),e.next=25,a.ensureAttributes();case 25:return a._fullscreen=t.fullscreen,a.appManager=new ct(a),a._pageState=new bo(a.appManager),a.cursorManager=new yo(a.appManager,Boolean(o),t.applianceIcons),r&&(a.containerSizeRatio=r),t.container&&a.bindContainer(t.container),_o(n,a),ue.emit("onCreated"),b.isCreated=!0,e.prev=34,e.next=37,le();case 37:e.next=42;break;case 39:e.prev=39,e.t0=e.catch(34),console.warn("[WindowManager]: indexedDB open failed"),console.log(e.t0);case 42:return e.abrupt("return",a);case 43:case"end":return e.stop()}}),e,this,[[34,39]])}))),function(e){return n.apply(this,arguments)})},{key:"initManager",value:(t=g(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((n=t.getInvisiblePlugin(b.kind))||!B.isRoom(t)){e.next=24;break}if(!1!==t.isWritable){e.next=21;break}return e.prev=3,e.next=6,t.setWritable(!0);case 6:e.next=11;break;case 8:throw e.prev=8,e.t0=e.catch(3),new Error("[WindowManger]: room must be switched to be writable");case 11:return e.next=13,ft(t);case 13:return null==(n=e.sent)||n.ensureAttributes(),e.next=17,ke(500);case 17:return e.next=19,t.setWritable(!1);case 19:e.next=24;break;case 21:return e.next=23,ft(t);case 23:n=e.sent;case 24:return e.abrupt("return",n);case 25:case"end":return e.stop()}}),e,null,[[3,8]])}))),function(e){return t.apply(this,arguments)})},{key:"initContainer",value:function(e,t,n){var r=n.chessboard,i=n.overwriteStyles,o=n.fullscreen;b.container||(b.container=t);var a=function(e){var t=document.createElement("div");t.className="netless-window-manager-playground";var n=document.createElement("div");n.className="netless-window-manager-sizer";var r=document.createElement("div");r.className="netless-window-manager-wrapper";var i=document.createElement("div");return i.className="netless-window-manager-main-view",t.appendChild(n),n.appendChild(r),r.appendChild(i),e.appendChild(t),Cb.wrapper=r,{playground:t,wrapper:r,sizer:n,mainViewElement:i}}(t),s=a.playground,u=a.wrapper,l=a.sizer,c=a.mainViewElement;if(b.playground=s,r&&l.classList.add("netless-window-manager-chess-sizer"),o&&l.classList.add("netless-window-manager-fullscreen"),i){var h=document.createElement("style");h.textContent=i,s.appendChild(h)}return e.containerResizeObserver=vt.create(s,l,u,ue),b.wrapper=u,b.sizer=l,c}},{key:"register",value:function(e){return xe.register(e)}},{key:"unregister",value:function(e){return xe.unregister(e)}},{key:"registered",get:function(){return xe.registered}}]),b}(B.InvisiblePlugin),Cb=Ib;Cb.kind="WindowManager",Cb.debug=!1,Cb.containerSizeRatio=9/16,Cb.isCreated=!1,Cb.debug&&function(e){Ry=Dy(Dy({},Oy),e)}({verbose:!0}),Cb.register({kind:Tu.kind,src:Tu}),Cb.register({kind:fb.kind,src:fb}),t.AppCreateError=Oe,t.AppManagerNotInitError=Le,t.AppNotRegisterError=Re,t.BindContainerRoomPhaseInvalidError=Ge,t.BoxManagerNotFoundError=ze,t.BoxNotCreatedError=Ue,t.BuiltinApps=pb,t.DomEvents=mb,t.IframeBridge=Sb,t.IframeEvents=vb,t.InvalidScenePath=Fe,t.ParamsInvalidError=Be,t.WhiteWebSDKInvalidError=je,t.WindowManager=Cb,t.calculateNextIndex=nt,t.reconnectRefresher=Ab},6513:function(e,t,n){var r=n(49766).Buffer;function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})})),t}Object.defineProperty(t,"__esModule",{value:!0}),t.xml2json=t.xml2js=t.json2xml=t.js2xml=void 0;var a=void 0!==n.g?n.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},s=[],u=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,c=!1;function h(){c=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,n=e.length;t>18&63]+s[i>>12&63]+s[i>>6&63]+s[63&i]);return o.join("")}function f(e){var t;c||h();for(var n=e.length,r=n%3,i="",o=[],a=16383,u=0,l=n-r;ul?l:u+a));return 1===r?(t=e[n-1],i+=s[t>>2],i+=s[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=s[t>>10],i+=s[t>>4&63],i+=s[t<<2&63],i+="="),o.push(i),o.join("")}function p(e,t,n,r,i){var o,a,s=8*i-r-1,u=(1<>1,c=-7,h=n?i-1:0,d=n?-1:1,f=e[t+h];for(h+=d,o=f&(1<<-c)-1,f>>=-c,c+=s;c>0;o=256*o+e[t+h],h+=d,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=r;c>0;a=256*a+e[t+h],h+=d,c-=8);if(0===o)o=1-l;else{if(o===u)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),o-=l}return(f?-1:1)*a*Math.pow(2,o-r)}function v(e,t,n,r,i,o){var a,s,u,l=8*o-i-1,c=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,v=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+h>=1?d/u:d*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=c?(s=0,a=c):a+h>=1?(s=(t*u-1)*Math.pow(2,i),a+=h):(s=t*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;e[n+f]=255&s,f+=p,s/=256,i-=8);for(a=a<0;e[n+f]=255&a,f+=p,a/=256,l-=8);e[n+f-p]|=128*v}var m={}.toString,g=Array.isArray||function(e){return"[object Array]"==m.call(e)};function y(){return x.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function b(e,t){if(y()=y())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+y().toString(16)+" bytes");return 0|e}function S(e){return!(null==e||!e._isBuffer)}function A(e,t){if(S(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return ee(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return te(e).length;default:if(r)return ee(e).length;t=(""+t).toLowerCase(),r=!0}}function I(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return H(this,t,n);case"utf8":case"utf-8":return U(this,t,n);case"ascii":return z(this,t,n);case"latin1":case"binary":return G(this,t,n);case"base64":return B(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return V(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function C(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function N(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=x.from(t,r)),S(t))return 0===t.length?-1:k(e,t,n,r,i);if("number"==typeof t)return t&=255,x.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):k(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function k(e,t,n,r,i){var o,a=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,n/=2}function l(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var c=-1;for(o=n;os&&(n=s-u),o=n;o>=0;o--){for(var h=!0,d=0;di&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function B(e,t,n){return 0===t&&n===e.length?f(e):f(e.slice(t,n))}function U(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i239?4:l>223?3:l>191?2:1;if(i+h<=n)switch(h){case 1:l<128&&(c=l);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&l)<<6|63&o)>127&&(c=u);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(u=(15&l)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&l)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(c=u)}null===c?(c=65533,h=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=h}return function(e){var t=e.length;if(t<=F)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),""},x.prototype.compare=function(e,t,n,r,i){if(!S(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),s=Math.min(o,a),u=this.slice(r,i),l=e.slice(t,n),c=0;ci)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return D(this,e,t,n);case"utf8":case"utf-8":return P(this,e,t,n);case"ascii":return O(this,e,t,n);case"latin1":case"binary":return R(this,e,t,n);case"base64":return L(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},x.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var F=4096;function z(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;ir)&&(n=r);for(var i="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function Y(e,t,n,r,i,o){if(!S(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function X(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function Q(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function Z(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function q(e,t,n,r,i){return i||Z(e,0,n,4),v(e,t,n,r,23,4),n+4}function J(e,t,n,r,i){return i||Z(e,0,n,8),v(e,t,n,r,52,8),n+8}x.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(i*=256);)r+=this[e+--t]*i;return r},x.prototype.readUInt8=function(e,t){return t||W(e,1,this.length),this[e]},x.prototype.readUInt16LE=function(e,t){return t||W(e,2,this.length),this[e]|this[e+1]<<8},x.prototype.readUInt16BE=function(e,t){return t||W(e,2,this.length),this[e]<<8|this[e+1]},x.prototype.readUInt32LE=function(e,t){return t||W(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},x.prototype.readUInt32BE=function(e,t){return t||W(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},x.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||W(e,t,this.length);for(var r=this[e],i=1,o=0;++o=(i*=128)&&(r-=Math.pow(2,8*t)),r},x.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||W(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},x.prototype.readInt8=function(e,t){return t||W(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},x.prototype.readInt16LE=function(e,t){t||W(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},x.prototype.readInt16BE=function(e,t){t||W(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},x.prototype.readInt32LE=function(e,t){return t||W(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},x.prototype.readInt32BE=function(e,t){return t||W(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},x.prototype.readFloatLE=function(e,t){return t||W(e,4,this.length),p(this,e,!0,23,4)},x.prototype.readFloatBE=function(e,t){return t||W(e,4,this.length),p(this,e,!1,23,4)},x.prototype.readDoubleLE=function(e,t){return t||W(e,8,this.length),p(this,e,!0,52,8)},x.prototype.readDoubleBE=function(e,t){return t||W(e,8,this.length),p(this,e,!1,52,8)},x.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||Y(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+n},x.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||Y(this,e,t,1,255,0),x.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},x.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||Y(this,e,t,2,65535,0),x.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):X(this,e,t,!0),t+2},x.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||Y(this,e,t,2,65535,0),x.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):X(this,e,t,!1),t+2},x.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||Y(this,e,t,4,4294967295,0),x.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):Q(this,e,t,!0),t+4},x.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||Y(this,e,t,4,4294967295,0),x.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Q(this,e,t,!1),t+4},x.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);Y(this,e,t,n,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+n},x.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);Y(this,e,t,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},x.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||Y(this,e,t,1,127,-128),x.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},x.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||Y(this,e,t,2,32767,-32768),x.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):X(this,e,t,!0),t+2},x.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||Y(this,e,t,2,32767,-32768),x.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):X(this,e,t,!1),t+2},x.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||Y(this,e,t,4,2147483647,-2147483648),x.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):Q(this,e,t,!0),t+4},x.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||Y(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),x.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Q(this,e,t,!1),t+4},x.prototype.writeFloatLE=function(e,t,n){return q(this,e,t,!0,n)},x.prototype.writeFloatBE=function(e,t,n){return q(this,e,t,!1,n)},x.prototype.writeDoubleLE=function(e,t,n){return J(this,e,t,!0,n)},x.prototype.writeDoubleBE=function(e,t,n){return J(this,e,t,!1,n)},x.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(o<1e3||!x.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function te(e){return function(e){var t,n,r,i,o,a;c||h();var s=e.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===e[s-2]?2:"="===e[s-1]?1:0,a=new l(3*s/4-o),r=o>0?s-4:s;var d=0;for(t=0,n=0;t>16&255,a[d++]=i>>8&255,a[d++]=255&i;return 2===o?(i=u[e.charCodeAt(t)]<<2|u[e.charCodeAt(t+1)]>>4,a[d++]=255&i):1===o&&(i=u[e.charCodeAt(t)]<<10|u[e.charCodeAt(t+1)]<<4|u[e.charCodeAt(t+2)]>>2,a[d++]=i>>8&255,a[d++]=255&i),a}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(K,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function ne(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function re(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var ie={};function oe(){}function ae(){ae.init.call(this)}function se(e){return void 0===e._maxListeners?ae.defaultMaxListeners:e._maxListeners}function ue(e,t,n){if(t)e.call(n);else for(var r=e.length,i=me(e,r),o=0;o0&&a.length>i){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=a.length,s=u,"function"==typeof console.warn?console.warn(s):console.log(s)}}else a=o[t]=n,++e._eventsCount;return e}function pe(e,t,n){var r=!1;function i(){e.removeListener(t,i),r||(r=!0,n.apply(e,arguments))}return i.listener=n,i}function ve(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function me(e,t){for(var n=new Array(t);t--;)n[t]=e[t];return n}function ge(){throw new Error("setTimeout has not been defined")}function ye(){throw new Error("clearTimeout has not been defined")}oe.prototype=Object.create(null),ae.EventEmitter=ae,ae.usingDomains=!1,ae.prototype.domain=void 0,ae.prototype._events=void 0,ae.prototype._maxListeners=void 0,ae.defaultMaxListeners=10,ae.init=function(){this.domain=null,ae.usingDomains&&undefined.active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new oe,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},ae.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},ae.prototype.getMaxListeners=function(){return se(this)},ae.prototype.emit=function(e){var t,n,r,i,o,a,s,u="error"===e;if(a=this._events)u=u&&null==a.error;else if(!u)return!1;if(s=this.domain,u){if(t=arguments[1],!s){if(t instanceof Error)throw t;var l=new Error('Uncaught, unspecified "error" event. ('+t+")");throw l.context=t,l}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=s,t.domainThrown=!1,s.emit("error",t),!1}if(!(n=a[e]))return!1;var c="function"==typeof n;switch(r=arguments.length){case 1:ue(n,c,this);break;case 2:le(n,c,this,arguments[1]);break;case 3:ce(n,c,this,arguments[1],arguments[2]);break;case 4:he(n,c,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),o=1;o0;)if(n[o]===t||n[o].listener&&n[o].listener===t){a=n[o].listener,i=o;break}if(i<0)return this;if(1===n.length){if(n[0]=void 0,0==--this._eventsCount)return this._events=new oe,this;delete r[e]}else!function(e,t){for(var n=t,r=n+1,i=e.length;r0?Reflect.ownKeys(this._events):[]};var be=ge,xe=ye;function _e(e){if(be===setTimeout)return setTimeout(e,0);if((be===ge||!be)&&setTimeout)return be=setTimeout,setTimeout(e,0);try{return be(e,0)}catch(t){try{return be.call(null,e,0)}catch(t){return be.call(this,e,0)}}}"function"==typeof a.setTimeout&&(be=setTimeout),"function"==typeof a.clearTimeout&&(xe=clearTimeout);var we,Te=[],Me=!1,Ee=-1;function Se(){Me&&we&&(Me=!1,we.length?Te=we.concat(Te):Ee=-1,Te.length&&Ae())}function Ae(){if(!Me){var e=_e(Se);Me=!0;for(var t=Te.length;t;){for(we=Te,Te=[];++Ee1)for(var n=1;n=i)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}})),a=r[n];n=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),et(t)?n.showHidden=t:t&&ct(n,t),rt(n.showHidden)&&(n.showHidden=!1),rt(n.depth)&&(n.depth=2),rt(n.colors)&&(n.colors=!1),rt(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=Ze),Je(n,e,n.depth)}function Ze(e,t){var n=Qe.styles[t];return n?"["+Qe.colors[n][0]+"m"+e+"["+Qe.colors[n][1]+"m":e}function qe(e,t){return e}function Je(e,t,n){if(e.customInspect&&t&&ut(t.inspect)&&t.inspect!==Qe&&(!t.constructor||t.constructor.prototype!==t)){var r=t.inspect(n,e);return nt(r)||(r=Je(e,r,n)),r}var i=function(e,t){if(rt(t))return e.stylize("undefined","undefined");if(nt(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(r=t,"number"==typeof r)return e.stylize(""+t,"number");var r;if(et(t))return e.stylize(""+t,"boolean");if(tt(t))return e.stylize("null","null")}(e,t);if(i)return i;var o=Object.keys(t),a=function(e){var t={};return e.forEach((function(e,n){t[e]=!0})),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(t)),st(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return Ke(t);if(0===o.length){if(ut(t)){var s=t.name?": "+t.name:"";return e.stylize("[Function"+s+"]","special")}if(it(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(at(t))return e.stylize(Date.prototype.toString.call(t),"date");if(st(t))return Ke(t)}var u,l,c="",h=!1,d=["{","}"];(u=t,Array.isArray(u)&&(h=!0,d=["[","]"]),ut(t))&&(c=" [Function"+(t.name?": "+t.name:"")+"]");return it(t)&&(c=" "+RegExp.prototype.toString.call(t)),at(t)&&(c=" "+Date.prototype.toUTCString.call(t)),st(t)&&(c=" "+Ke(t)),0!==o.length||h&&0!=t.length?n<0?it(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),l=h?function(e,t,n,r,i){for(var o=[],a=0,s=t.length;a60)return n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1];return n[0]+t+" "+e.join(", ")+" "+n[1]}(l,c,d)):d[0]+c+d[1]}function Ke(e){return"["+Error.prototype.toString.call(e)+"]"}function $e(e,t,n,r,i,o){var a,s,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(s=e.stylize("[Setter]","special")),ht(r,i)||(a="["+i+"]"),s||(e.seen.indexOf(u.value)<0?(s=tt(n)?Je(e,u.value,null):Je(e,u.value,n-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+s.split("\n").map((function(e){return" "+e})).join("\n")):s=e.stylize("[Circular]","special")),rt(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function et(e){return"boolean"==typeof e}function tt(e){return null===e}function nt(e){return"string"==typeof e}function rt(e){return void 0===e}function it(e){return ot(e)&&"[object RegExp]"===lt(e)}function ot(e){return"object"===i(e)&&null!==e}function at(e){return ot(e)&&"[object Date]"===lt(e)}function st(e){return ot(e)&&("[object Error]"===lt(e)||e instanceof Error)}function ut(e){return"function"==typeof e}function lt(e){return Object.prototype.toString.call(e)}function ct(e,t){if(!t||!ot(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}function ht(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function dt(){this.head=null,this.tail=null,this.length=0}Qe.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},Qe.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},dt.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},dt.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},dt.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},dt.prototype.clear=function(){this.head=this.tail=null,this.length=0},dt.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},dt.prototype.concat=function(e){if(0===this.length)return x.alloc(0);if(1===this.length)return this.head.data;for(var t=x.allocUnsafe(e>>>0),n=this.head,r=0;n;)n.data.copy(t,r),r+=n.data.length,n=n.next;return t};var ft=x.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function pt(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),function(e){if(e&&!ft(e))throw new Error("Unknown encoding: "+e)}(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=mt;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=gt;break;default:return void(this.write=vt)}this.charBuffer=new x(6),this.charReceived=0,this.charLength=0}function vt(e){return e.toString(this.encoding)}function mt(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function gt(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}pt.prototype.write=function(e){for(var t="";this.charLength;){var n=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived=55296&&i<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var r=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,r),r-=this.charReceived);var i;r=(t+=e.toString(this.encoding,0,r)).length-1;if((i=t.charCodeAt(r))>=55296&&i<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),e.copy(this.charBuffer,0,0,o),t.substring(0,r)}return t},pt.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(t<=2&&n>>4==14){this.charLength=3;break}if(t<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=t},pt.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;t+=r.slice(0,n).toString(i)}return t};var yt=Object.freeze({__proto__:null,StringDecoder:pt});_t.ReadableState=xt;var bt=function(e){if(rt(Ye)&&(Ye=ze.env.NODE_DEBUG||""),e=e.toUpperCase(),!Xe[e])if(new RegExp("\\b"+e+"\\b","i").test(Ye)){Xe[e]=function(){var t=Ve.apply(null,arguments);console.error("%s %d: %s",e,0,t)}}else Xe[e]=function(){};return Xe[e]}("stream");function xt(e,t){e=e||{},this.objectMode=!!e.objectMode,t instanceof Zt&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var n=e.highWaterMark,r=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r,this.highWaterMark=~~this.highWaterMark,this.buffer=new dt,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(this.decoder=new pt(e.encoding),this.encoding=e.encoding)}function _t(e){if(!(this instanceof _t))return new _t(e);this._readableState=new xt(e,this),this.readable=!0,e&&"function"==typeof e.read&&(this._read=e.read),ae.call(this)}function wt(e,t,n,r,i){var o=function(e,t){var n=null;x.isBuffer(t)||"string"==typeof t||null==t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));return n}(t,n);if(o)e.emit("error",o);else if(null===n)t.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,Et(e)}(e,t);else if(t.objectMode||n&&n.length>0)if(t.ended&&!i){var a=new Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&i){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else{var u;!t.decoder||i||r||(n=t.decoder.write(n),u=!t.objectMode&&0===n.length),i||(t.reading=!1),u||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&Et(e))),function(e,t){t.readingMore||(t.readingMore=!0,Ie(At,e,t))}(e,t)}else i||(t.reading=!1);return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=Tt?e=Tt:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function Et(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(bt("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?Ie(St,e):St(e))}function St(e){bt("emit readable"),e.emit("readable"),Nt(e)}function At(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;eo.length?o.length:e;if(a===o.length?i+=o:i+=o.slice(0,e),0===(e-=a)){a===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(a));break}++r}return t.length-=r,i}(e,t):function(e,t){var n=x.allocUnsafe(e),r=t.head,i=1;r.data.copy(n),e-=r.data.length;for(;r=r.next;){var o=r.data,a=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,a),0===(e-=a)){a===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(a));break}++i}return t.length-=i,n}(e,t);return r}(e,t.buffer,t.decoder),n);var n}function Dt(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,Ie(Pt,t,e))}function Pt(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function Ot(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return bt("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?Dt(this):Et(this),null;if(0===(e=Mt(e,t))&&t.ended)return 0===t.length&&Dt(this),null;var r,i=t.needReadable;return bt("need readable",i),(0===t.length||t.length-e0?kt(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&Dt(this)),null!==r&&this.emit("data",r),r},_t.prototype._read=function(e){this.emit("error",new Error("not implemented"))},_t.prototype.pipe=function(e,t){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=e;break;case 1:r.pipes=[r.pipes,e];break;default:r.pipes.push(e)}r.pipesCount+=1,bt("pipe count=%d opts=%j",r.pipesCount,t);var i=!t||!1!==t.end?a:l;function o(e){bt("onunpipe"),e===n&&l()}function a(){bt("onend"),e.end()}r.endEmitted?Ie(i):n.once("end",i),e.on("unpipe",o);var s=function(e){return function(){var t=e._readableState;bt("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&e.listeners("data").length&&(t.flowing=!0,Nt(e))}}(n);e.on("drain",s);var u=!1;function l(){bt("cleanup"),e.removeListener("close",f),e.removeListener("finish",p),e.removeListener("drain",s),e.removeListener("error",d),e.removeListener("unpipe",o),n.removeListener("end",a),n.removeListener("end",l),n.removeListener("data",h),u=!0,!r.awaitDrain||e._writableState&&!e._writableState.needDrain||s()}var c=!1;function h(t){bt("ondata"),c=!1,!1!==e.write(t)||c||((1===r.pipesCount&&r.pipes===e||r.pipesCount>1&&-1!==Ot(r.pipes,e))&&!u&&(bt("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,c=!0),n.pause())}function d(t){var n;bt("onerror",t),v(),e.removeListener("error",d),0===(n="error",e.listeners(n).length)&&e.emit("error",t)}function f(){e.removeListener("finish",p),v()}function p(){bt("onfinish"),e.removeListener("close",f),v()}function v(){bt("unpipe"),n.unpipe(e)}return n.on("data",h),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",d),e.once("close",f),e.once("finish",p),e.emit("pipe",n),r.flowing||(bt("pipe resume"),n.resume()),e},_t.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this)),this;if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Bt.prototype._write=function(e,t,n){n(new Error("not implemented"))},Bt.prototype._writev=null,Bt.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,Vt(e,t),n&&(t.finished?Ie(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n)},Ge(Zt,_t);for(var Yt=Object.keys(Bt.prototype),Xt=0;Xt"===a?(S(r,"onsgmldeclaration",r.sgmlDecl),r.sgmlDecl="",r.state=T.TEXT):v(a)?(r.state=T.SGML_DECL_QUOTED,r.sgmlDecl+=a):r.sgmlDecl+=a;continue;case T.SGML_DECL_QUOTED:a===r.q&&(r.state=T.SGML_DECL,r.q=""),r.sgmlDecl+=a;continue;case T.DOCTYPE:">"===a?(r.state=T.TEXT,S(r,"ondoctype",r.doctype),r.doctype=!0):(r.doctype+=a,"["===a?r.state=T.DOCTYPE_DTD:v(a)&&(r.state=T.DOCTYPE_QUOTED,r.q=a));continue;case T.DOCTYPE_QUOTED:r.doctype+=a,a===r.q&&(r.q="",r.state=T.DOCTYPE);continue;case T.DOCTYPE_DTD:r.doctype+=a,"]"===a?r.state=T.DOCTYPE:v(a)&&(r.state=T.DOCTYPE_DTD_QUOTED,r.q=a);continue;case T.DOCTYPE_DTD_QUOTED:r.doctype+=a,a===r.q&&(r.state=T.DOCTYPE_DTD,r.q="");continue;case T.COMMENT:"-"===a?r.state=T.COMMENT_ENDING:r.comment+=a;continue;case T.COMMENT_ENDING:"-"===a?(r.state=T.COMMENT_ENDED,r.comment=I(r.opt,r.comment),r.comment&&S(r,"oncomment",r.comment),r.comment=""):(r.comment+="-"+a,r.state=T.COMMENT);continue;case T.COMMENT_ENDED:">"!==a?(k(r,"Malformed comment"),r.comment+="--"+a,r.state=T.COMMENT):r.state=T.TEXT;continue;case T.CDATA:"]"===a?r.state=T.CDATA_ENDING:r.cdata+=a;continue;case T.CDATA_ENDING:"]"===a?r.state=T.CDATA_ENDING_2:(r.cdata+="]"+a,r.state=T.CDATA);continue;case T.CDATA_ENDING_2:">"===a?(r.cdata&&S(r,"oncdata",r.cdata),S(r,"onclosecdata"),r.cdata="",r.state=T.TEXT):"]"===a?r.cdata+="]":(r.cdata+="]]"+a,r.state=T.CDATA);continue;case T.PROC_INST:"?"===a?r.state=T.PROC_INST_ENDING:p(a)?r.state=T.PROC_INST_BODY:r.procInstName+=a;continue;case T.PROC_INST_BODY:if(!r.procInstBody&&p(a))continue;"?"===a?r.state=T.PROC_INST_ENDING:r.procInstBody+=a;continue;case T.PROC_INST_ENDING:">"===a?(S(r,"onprocessinginstruction",{name:r.procInstName,body:r.procInstBody}),r.procInstName=r.procInstBody="",r.state=T.TEXT):(r.procInstBody+="?"+a,r.state=T.PROC_INST_BODY);continue;case T.OPEN_TAG:g(h,a)?r.tagName+=a:(D(r),">"===a?R(r):"/"===a?r.state=T.OPEN_TAG_SLASH:(p(a)||k(r,"Invalid character in tag name"),r.state=T.ATTRIB));continue;case T.OPEN_TAG_SLASH:">"===a?(R(r,!0),L(r)):(k(r,"Forward-slash in opening tag not followed by >"),r.state=T.ATTRIB);continue;case T.ATTRIB:if(p(a))continue;">"===a?R(r):"/"===a?r.state=T.OPEN_TAG_SLASH:g(c,a)?(r.attribName=a,r.attribValue="",r.state=T.ATTRIB_NAME):k(r,"Invalid attribute name");continue;case T.ATTRIB_NAME:"="===a?r.state=T.ATTRIB_VALUE:">"===a?(k(r,"Attribute without value"),r.attribValue=r.attribName,O(r),R(r)):p(a)?r.state=T.ATTRIB_NAME_SAW_WHITE:g(h,a)?r.attribName+=a:k(r,"Invalid attribute name");continue;case T.ATTRIB_NAME_SAW_WHITE:if("="===a)r.state=T.ATTRIB_VALUE;else{if(p(a))continue;k(r,"Attribute without value"),r.tag.attributes[r.attribName]="",r.attribValue="",S(r,"onattribute",{name:r.attribName,value:""}),r.attribName="",">"===a?R(r):g(c,a)?(r.attribName=a,r.state=T.ATTRIB_NAME):(k(r,"Invalid attribute name"),r.state=T.ATTRIB)}continue;case T.ATTRIB_VALUE:if(p(a))continue;v(a)?(r.q=a,r.state=T.ATTRIB_VALUE_QUOTED):(k(r,"Unquoted attribute value"),r.state=T.ATTRIB_VALUE_UNQUOTED,r.attribValue=a);continue;case T.ATTRIB_VALUE_QUOTED:if(a!==r.q){"&"===a?r.state=T.ATTRIB_VALUE_ENTITY_Q:r.attribValue+=a;continue}O(r),r.q="",r.state=T.ATTRIB_VALUE_CLOSED;continue;case T.ATTRIB_VALUE_CLOSED:p(a)?r.state=T.ATTRIB:">"===a?R(r):"/"===a?r.state=T.OPEN_TAG_SLASH:g(c,a)?(k(r,"No whitespace between attributes"),r.attribName=a,r.attribValue="",r.state=T.ATTRIB_NAME):k(r,"Invalid attribute name");continue;case T.ATTRIB_VALUE_UNQUOTED:if(!m(a)){"&"===a?r.state=T.ATTRIB_VALUE_ENTITY_U:r.attribValue+=a;continue}O(r),">"===a?R(r):r.state=T.ATTRIB;continue;case T.CLOSE_TAG:if(r.tagName)">"===a?L(r):g(h,a)?r.tagName+=a:r.script?(r.script+=""+r.tagName,r.tagName="",r.state=T.SCRIPT):(p(a)||k(r,"Invalid tagname in closing tag"),r.state=T.CLOSE_TAG_SAW_WHITE);else{if(p(a))continue;y(c,a)?r.script?(r.script+=""+a,r.state=T.SCRIPT):k(r,"Invalid tagname in closing tag."):r.tagName=a}continue;case T.CLOSE_TAG_SAW_WHITE:if(p(a))continue;">"===a?L(r):k(r,"Invalid characters in closing tag");continue;case T.TEXT_ENTITY:case T.ATTRIB_VALUE_ENTITY_Q:case T.ATTRIB_VALUE_ENTITY_U:var l,b;switch(r.state){case T.TEXT_ENTITY:l=T.TEXT,b="textNode";break;case T.ATTRIB_VALUE_ENTITY_Q:l=T.ATTRIB_VALUE_QUOTED,b="attribValue";break;case T.ATTRIB_VALUE_ENTITY_U:l=T.ATTRIB_VALUE_UNQUOTED,b="attribValue"}";"===a?(r[b]+=j(r),r.entity="",r.state=l):g(r.entity.length?f:d,a)?r.entity+=a:(k(r,"Invalid character in entity name"),r[b]+="&"+r.entity+a,r.entity="",r.state=l);continue;default:throw new Error(r,"Unknown state: "+r.state)}r.position>=r.bufferCheckPosition&&function(t){for(var r=Math.max(e.MAX_BUFFER_LENGTH,10),i=0,o=0,a=n.length;or)switch(n[o]){case"textNode":A(t);break;case"cdata":S(t,"oncdata",t.cdata),t.cdata="";break;case"script":S(t,"onscript",t.script),t.script="";break;default:C(t,"Max buffer length exceeded: "+n[o])}i=Math.max(i,s)}var u=e.MAX_BUFFER_LENGTH-i;t.bufferCheckPosition=u+t.position}(r);return r}
/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){var e;A(e=this),""!==e.cdata&&(S(e,"oncdata",e.cdata),e.cdata=""),""!==e.script&&(S(e,"onscript",e.script),e.script="")}};try{t=rn.Stream}catch(e){t=function(){}}var o=e.EVENTS.filter((function(e){return"error"!==e&&"end"!==e}));function a(e,n){if(!(this instanceof a))return new a(e,n);t.apply(this),this._parser=new r(e,n),this.writable=!0,this.readable=!0;var i=this;this._parser.onend=function(){i.emit("end")},this._parser.onerror=function(e){i.emit("error",e),i._parser.error=null},this._decoder=null,o.forEach((function(e){Object.defineProperty(i,"on"+e,{get:function(){return i._parser["on"+e]},set:function(t){if(!t)return i.removeAllListeners(e),i._parser["on"+e]=t,t;i.on(e,t)},enumerable:!0,configurable:!1})}))}a.prototype=Object.create(t.prototype,{constructor:{value:a}}),a.prototype.write=function(e){if("function"==typeof x.isBuffer&&x.isBuffer(e)){if(!this._decoder){var t=on.StringDecoder;this._decoder=new t("utf8")}e=this._decoder.write(e)}return this._parser.write(e.toString()),this.emit("data",e),!0},a.prototype.end=function(e){return e&&e.length&&this.write(e),this._parser.end(),!0},a.prototype.on=function(e,n){var r=this;return r._parser["on"+e]||-1===o.indexOf(e)||(r._parser["on"+e]=function(){var t=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);t.splice(0,0,e),r.emit.apply(r,t)}),t.prototype.on.call(r,e,n)};var s="http://www.w3.org/XML/1998/namespace",u="http://www.w3.org/2000/xmlns/",l={xml:s,xmlns:u},c=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,h=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,d=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,f=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function p(e){return" "===e||"\n"===e||"\r"===e||"\t"===e}function v(e){return'"'===e||"'"===e}function m(e){return">"===e||p(e)}function g(e,t){return e.test(t)}function y(e,t){return!g(e,t)}var b,_,w,T=0;for(var M in e.STATE={BEGIN:T++,BEGIN_WHITESPACE:T++,TEXT:T++,TEXT_ENTITY:T++,OPEN_WAKA:T++,SGML_DECL:T++,SGML_DECL_QUOTED:T++,DOCTYPE:T++,DOCTYPE_QUOTED:T++,DOCTYPE_DTD:T++,DOCTYPE_DTD_QUOTED:T++,COMMENT_STARTING:T++,COMMENT:T++,COMMENT_ENDING:T++,COMMENT_ENDED:T++,CDATA:T++,CDATA_ENDING:T++,CDATA_ENDING_2:T++,PROC_INST:T++,PROC_INST_BODY:T++,PROC_INST_ENDING:T++,OPEN_TAG:T++,OPEN_TAG_SLASH:T++,ATTRIB:T++,ATTRIB_NAME:T++,ATTRIB_NAME_SAW_WHITE:T++,ATTRIB_VALUE:T++,ATTRIB_VALUE_QUOTED:T++,ATTRIB_VALUE_CLOSED:T++,ATTRIB_VALUE_UNQUOTED:T++,ATTRIB_VALUE_ENTITY_Q:T++,ATTRIB_VALUE_ENTITY_U:T++,CLOSE_TAG:T++,CLOSE_TAG_SAW_WHITE:T++,SCRIPT:T++,SCRIPT_ENDING:T++},e.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},e.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(e.ENTITIES).forEach((function(t){var n=e.ENTITIES[t],r="number"==typeof n?String.fromCharCode(n):n;e.ENTITIES[t]=r})),e.STATE)e.STATE[e.STATE[M]]=M;function E(e,t,n){e[t]&&e[t](n)}function S(e,t,n){e.textNode&&A(e),E(e,t,n)}function A(e){e.textNode=I(e.opt,e.textNode),e.textNode&&E(e,"ontext",e.textNode),e.textNode=""}function I(e,t){return e.trim&&(t=t.trim()),e.normalize&&(t=t.replace(/\s+/g," ")),t}function C(e,t){return A(e),e.trackPosition&&(t+="\nLine: "+e.line+"\nColumn: "+e.column+"\nChar: "+e.c),t=new Error(t),e.error=t,E(e,"onerror",t),e}function N(e){return e.sawRoot&&!e.closedRoot&&k(e,"Unclosed root tag"),e.state!==T.BEGIN&&e.state!==T.BEGIN_WHITESPACE&&e.state!==T.TEXT&&C(e,"Unexpected end"),A(e),e.c="",e.closed=!0,E(e,"onend"),r.call(e,e.strict,e.opt),e}function k(e,t){if("object"!==i(e)||!(e instanceof r))throw new Error("bad call to strictFail");e.strict&&C(e,t)}function D(e){e.strict||(e.tagName=e.tagName[e.looseCase]());var t=e.tags[e.tags.length-1]||e,n=e.tag={name:e.tagName,attributes:{}};e.opt.xmlns&&(n.ns=t.ns),e.attribList.length=0,S(e,"onopentagstart",n)}function P(e,t){var n=e.indexOf(":")<0?["",e]:e.split(":"),r=n[0],i=n[1];return t&&"xmlns"===e&&(r="xmlns",i=""),{prefix:r,local:i}}function O(e){if(e.strict||(e.attribName=e.attribName[e.looseCase]()),-1!==e.attribList.indexOf(e.attribName)||e.tag.attributes.hasOwnProperty(e.attribName))e.attribName=e.attribValue="";else{if(e.opt.xmlns){var t=P(e.attribName,!0),n=t.prefix,r=t.local;if("xmlns"===n)if("xml"===r&&e.attribValue!==s)k(e,"xml: prefix must be bound to "+s+"\nActual: "+e.attribValue);else if("xmlns"===r&&e.attribValue!==u)k(e,"xmlns: prefix must be bound to "+u+"\nActual: "+e.attribValue);else{var i=e.tag,o=e.tags[e.tags.length-1]||e;i.ns===o.ns&&(i.ns=Object.create(o.ns)),i.ns[r]=e.attribValue}e.attribList.push([e.attribName,e.attribValue])}else e.tag.attributes[e.attribName]=e.attribValue,S(e,"onattribute",{name:e.attribName,value:e.attribValue});e.attribName=e.attribValue=""}}function R(e,t){if(e.opt.xmlns){var n=e.tag,r=P(e.tagName);n.prefix=r.prefix,n.local=r.local,n.uri=n.ns[r.prefix]||"",n.prefix&&!n.uri&&(k(e,"Unbound namespace prefix: "+JSON.stringify(e.tagName)),n.uri=r.prefix);var i=e.tags[e.tags.length-1]||e;n.ns&&i.ns!==n.ns&&Object.keys(n.ns).forEach((function(t){S(e,"onopennamespace",{prefix:t,uri:n.ns[t]})}));for(var o=0,a=e.attribList.length;o",void(e.state=T.TEXT);if(e.script){if("script"!==e.tagName)return e.script+=""+e.tagName+">",e.tagName="",void(e.state=T.SCRIPT);S(e,"onscript",e.script),e.script=""}var t=e.tags.length,n=e.tagName;e.strict||(n=n[e.looseCase]());for(var r=n;t--;){if(e.tags[t].name===r)break;k(e,"Unexpected close tag")}if(t<0)return k(e,"Unmatched closing tag: "+e.tagName),e.textNode+=""+e.tagName+">",void(e.state=T.TEXT);e.tagName=n;for(var i=e.tags.length;i-- >t;){var o=e.tag=e.tags.pop();e.tagName=e.tag.name,S(e,"onclosetag",e.tagName);var a={};for(var s in o.ns)a[s]=o.ns[s];var u=e.tags[e.tags.length-1]||e;e.opt.xmlns&&o.ns!==u.ns&&Object.keys(o.ns).forEach((function(t){var n=o.ns[t];S(e,"onclosenamespace",{prefix:t,uri:n})}))}0===t&&(e.closedRoot=!0),e.tagName=e.attribValue=e.attribName="",e.attribList.length=0,e.state=T.TEXT}function j(e){var t,n=e.entity,r=n.toLowerCase(),i="";return e.ENTITIES[n]?e.ENTITIES[n]:e.ENTITIES[r]?e.ENTITIES[r]:("#"===(n=r).charAt(0)&&("x"===n.charAt(1)?(n=n.slice(2),i=(t=parseInt(n,16)).toString(16)):(n=n.slice(1),i=(t=parseInt(n,10)).toString(10))),n=n.replace(/^0+/,""),isNaN(t)||i.toLowerCase()!==n?(k(e,"Invalid character entity"),"&"+e.entity+";"):String.fromCodePoint(t))}function B(e,t){"<"===t?(e.state=T.OPEN_WAKA,e.startTagPosition=e.position):p(t)||(k(e,"Non-whitespace before first tag."),e.textNode=t,e.state=T.TEXT)}function U(e,t){var n="";return t1114111||_(s)!==s)throw RangeError("Invalid code point: "+s);s<=65535?r.push(s):(e=55296+((s-=65536)>>10),t=s%1024+56320,r.push(e,t)),(i+1===o||r.length>n)&&(a+=b.apply(null,r),r.length=0)}return a},Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:w,configurable:!0,writable:!0}):String.fromCodePoint=w)}(e)}(ie);var an,sn,un=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===Object.prototype.toString.call(e)},ln=un,cn={copyOptions:function(e){var t,n={};for(t in e)e.hasOwnProperty(t)&&(n[t]=e[t]);return n},ensureFlagExists:function(e,t){e in t&&"boolean"==typeof t[e]||(t[e]=!1)},ensureSpacesExists:function(e){(!("spaces"in e)||"number"!=typeof e.spaces&&"string"!=typeof e.spaces)&&(e.spaces=0)},ensureAlwaysArrayExists:function(e){"alwaysArray"in e&&("boolean"==typeof e.alwaysArray||ln(e.alwaysArray))||(e.alwaysArray=!1)},ensureKeyExists:function(e,t){e+"Key"in t&&"string"==typeof t[e+"Key"]||(t[e+"Key"]=t.compact?"_"+e:e)},checkFnExists:function(e,t){return e+"Fn"in t}},hn=ie,dn=cn,fn=un;function pn(e){var t=Number(e);if(!isNaN(t))return t;var n=e.toLowerCase();return"true"===n||"false"!==n&&e}function vn(e,t){var n;if(an.compact){if(!sn[an[e+"Key"]]&&(fn(an.alwaysArray)?-1!==an.alwaysArray.indexOf(an[e+"Key"]):an.alwaysArray)&&(sn[an[e+"Key"]]=[]),sn[an[e+"Key"]]&&!fn(sn[an[e+"Key"]])&&(sn[an[e+"Key"]]=[sn[an[e+"Key"]]]),e+"Fn"in an&&"string"==typeof t&&(t=an[e+"Fn"](t,sn)),"instruction"===e&&("instructionFn"in an||"instructionNameFn"in an))for(n in t)if(t.hasOwnProperty(n))if("instructionFn"in an)t[n]=an.instructionFn(t[n],n,sn);else{var r=t[n];delete t[n],t[an.instructionNameFn(n,r,sn)]=r}fn(sn[an[e+"Key"]])?sn[an[e+"Key"]].push(t):sn[an[e+"Key"]]=t}else{sn[an.elementsKey]||(sn[an.elementsKey]=[]);var i={};if(i[an.typeKey]=e,"instruction"===e){for(n in t)if(t.hasOwnProperty(n))break;i[an.nameKey]="instructionNameFn"in an?an.instructionNameFn(n,t,sn):n,an.instructionHasAttributes?(i[an.attributesKey]=t[n][an.attributesKey],"instructionFn"in an&&(i[an.attributesKey]=an.instructionFn(i[an.attributesKey],n,sn))):("instructionFn"in an&&(t[n]=an.instructionFn(t[n],n,sn)),i[an.instructionKey]=t[n])}else e+"Fn"in an&&(t=an[e+"Fn"](t,sn)),i[an[e+"Key"]]=t;an.addParent&&(i[an.parentKey]=sn),sn[an.elementsKey].push(i)}}function mn(e){var t;if("attributesFn"in an&&e&&(e=an.attributesFn(e,sn)),(an.trim||"attributeValueFn"in an||"attributeNameFn"in an||an.nativeTypeAttributes)&&e)for(t in e)if(e.hasOwnProperty(t)&&(an.trim&&(e[t]=e[t].trim()),an.nativeTypeAttributes&&(e[t]=pn(e[t])),"attributeValueFn"in an&&(e[t]=an.attributeValueFn(e[t],t,sn)),"attributeNameFn"in an)){var n=e[t];delete e[t],e[an.attributeNameFn(t,e[t],sn)]=n}return e}function gn(e){var t={};if(e.body&&("xml"===e.name.toLowerCase()||an.instructionHasAttributes)){for(var n,r=/([\w:-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|(\w+))\s*/g;null!==(n=r.exec(e.body));)t[n[1]]=n[2]||n[3]||n[4];t=mn(t)}if("xml"===e.name.toLowerCase()){if(an.ignoreDeclaration)return;sn[an.declarationKey]={},Object.keys(t).length&&(sn[an.declarationKey][an.attributesKey]=t),an.addParent&&(sn[an.declarationKey][an.parentKey]=sn)}else{if(an.ignoreInstruction)return;an.trim&&(e.body=e.body.trim());var i={};an.instructionHasAttributes&&Object.keys(t).length?(i[e.name]={},i[e.name][an.attributesKey]=t):i[e.name]=e.body,vn("instruction",i)}}function yn(e,t){var n;if("object"===i(e)&&(t=e.attributes,e=e.name),t=mn(t),"elementNameFn"in an&&(e=an.elementNameFn(e,sn)),an.compact){var r;if(n={},!an.ignoreAttributes&&t&&Object.keys(t).length)for(r in n[an.attributesKey]={},t)t.hasOwnProperty(r)&&(n[an.attributesKey][r]=t[r]);!(e in sn)&&(fn(an.alwaysArray)?-1!==an.alwaysArray.indexOf(e):an.alwaysArray)&&(sn[e]=[]),sn[e]&&!fn(sn[e])&&(sn[e]=[sn[e]]),fn(sn[e])?sn[e].push(n):sn[e]=n}else sn[an.elementsKey]||(sn[an.elementsKey]=[]),(n={})[an.typeKey]="element",n[an.nameKey]=e,!an.ignoreAttributes&&t&&Object.keys(t).length&&(n[an.attributesKey]=t),an.alwaysChildren&&(n[an.elementsKey]=[]),sn[an.elementsKey].push(n);n[an.parentKey]=sn,sn=n}function bn(e){an.ignoreText||(e.trim()||an.captureSpacesBetweenElements)&&(an.trim&&(e=e.trim()),an.nativeType&&(e=pn(e)),an.sanitize&&(e=e.replace(/&/g,"&").replace(//g,">")),vn("text",e))}function xn(e){an.ignoreComment||(an.trim&&(e=e.trim()),vn("comment",e))}function _n(e){var t=sn[an.parentKey];an.addParent||delete sn[an.parentKey],sn=t}function wn(e){an.ignoreCdata||(an.trim&&(e=e.trim()),vn("cdata",e))}function Tn(e){an.ignoreDoctype||(e=e.replace(/^ /,""),an.trim&&(e=e.trim()),vn("doctype",e))}function Mn(e){e.note=e,"onErrorFn"in an&&an.onErrorFn(e)}var En=function(e,t){var n=hn.parser(!0,{}),r={};sn=r,an=function(e){return an=dn.copyOptions(e),dn.ensureFlagExists("ignoreDeclaration",an),dn.ensureFlagExists("ignoreInstruction",an),dn.ensureFlagExists("ignoreAttributes",an),dn.ensureFlagExists("ignoreText",an),dn.ensureFlagExists("ignoreComment",an),dn.ensureFlagExists("ignoreCdata",an),dn.ensureFlagExists("ignoreDoctype",an),dn.ensureFlagExists("compact",an),dn.ensureFlagExists("alwaysChildren",an),dn.ensureFlagExists("addParent",an),dn.ensureFlagExists("trim",an),dn.ensureFlagExists("nativeType",an),dn.ensureFlagExists("nativeTypeAttributes",an),dn.ensureFlagExists("sanitize",an),dn.ensureFlagExists("instructionHasAttributes",an),dn.ensureFlagExists("captureSpacesBetweenElements",an),dn.ensureAlwaysArrayExists(an),dn.ensureKeyExists("declaration",an),dn.ensureKeyExists("instruction",an),dn.ensureKeyExists("attributes",an),dn.ensureKeyExists("text",an),dn.ensureKeyExists("comment",an),dn.ensureKeyExists("cdata",an),dn.ensureKeyExists("doctype",an),dn.ensureKeyExists("type",an),dn.ensureKeyExists("name",an),dn.ensureKeyExists("elements",an),dn.ensureKeyExists("parent",an),an}(t),n.opt={strictEntities:!0},n.onopentag=yn,n.ontext=bn,n.oncomment=xn,n.onclosetag=_n,n.onerror=Mn,n.oncdata=wn,n.ondoctype=Tn,n.onprocessinginstruction=gn;try{n.write(e).close()}catch(e){}if(r[an.elementsKey]){var i=r[an.elementsKey];delete r[an.elementsKey],r[an.elementsKey]=i,delete r.text}return r};t.xml2js=En;var Sn=cn,An=En;t.xml2json=function(e,t){var n,r,i,o;return n=function(e){var t=Sn.copyOptions(e);return Sn.ensureSpacesExists(t),t}(t),r=An(e,n),o="compact"in n&&n.compact?"_parent":"parent",i="addParent"in n&&n.addParent?JSON.stringify(r,(function(e,t){return e===o?"_":t}),n.spaces):JSON.stringify(r,null,n.spaces),i.replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")};var In,Cn,Nn=cn,kn=un;function Dn(e,t,n){return(!n&&e.spaces?"\n":"")+Array(t+1).join(e.spaces)}function Pn(e,t,n){if(t.ignoreAttributes)return"";"attributesFn"in t&&(e=t.attributesFn(e,Cn,In));var r,i,o,a,s=[];for(r in e)e.hasOwnProperty(r)&&null!==e[r]&&void 0!==e[r]&&(a=t.noQuotesForNativeAttributes&&"string"!=typeof e[r]?"":'"',i=(i=""+e[r]).replace(/&/g,"&").replace(/"}function Rn(e,t,n){if(t.ignoreInstruction)return"";var r;for(r in e)if(e.hasOwnProperty(r))break;var o="instructionNameFn"in t?t.instructionNameFn(r,e[r],Cn,In):r;if("object"===i(e[r]))return In=e,Cn=o,""+o+Pn(e[r][t.attributesKey],t,n)+"?>";var a=e[r]?e[r]:"";return"instructionFn"in t&&(a=t.instructionFn(a,r,Cn,In)),""+o+(a?" "+a:"")+"?>"}function Ln(e,t){return t.ignoreComment?"":"\x3c!--"+("commentFn"in t?t.commentFn(e,Cn,In):e)+"--\x3e"}function jn(e,t){return t.ignoreCdata?"":"","]]]]>"))+"]]>"}function Bn(e,t){return t.ignoreDoctype?"":""}function Un(e,t){return t.ignoreText?"":(e=(e=(e=""+e).replace(/&/g,"&")).replace(/&/g,"&").replace(//g,">"),"textFn"in t?t.textFn(e,Cn,In):e)}function Fn(e,t,n,r){return e.reduce((function(e,i){var o=Dn(t,n,r&&!e);switch(i.type){case"element":return e+o+function(e,t,n){In=e,Cn=e.name;var r=[],i="elementNameFn"in t?t.elementNameFn(e.name,e):e.name;r.push("<"+i),e[t.attributesKey]&&r.push(Pn(e[t.attributesKey],t,n));var o=e[t.elementsKey]&&e[t.elementsKey].length||e[t.attributesKey]&&"preserve"===e[t.attributesKey]["xml:space"];return o||(o="fullTagEmptyElementFn"in t?t.fullTagEmptyElementFn(e.name,e):t.fullTagEmptyElement),o?(r.push(">"),e[t.elementsKey]&&e[t.elementsKey].length&&(r.push(Fn(e[t.elementsKey],t,n+1)),In=e,Cn=e.name),r.push(t.spaces&&function(e,t){var n;if(e.elements&&e.elements.length)for(n=0;n")):r.push("/>"),r.join("")}(i,t,n);case"comment":return e+o+Ln(i[t.commentKey],t);case"doctype":return e+o+Bn(i[t.doctypeKey],t);case"cdata":return e+(t.indentCdata?o:"")+jn(i[t.cdataKey],t);case"text":return e+(t.indentText?o:"")+Un(i[t.textKey],t);case"instruction":var a={};return a[i[t.nameKey]]=i[t.attributesKey]?i:i[t.instructionKey],e+(t.indentInstruction?o:"")+Rn(a,t,n)}}),"")}function zn(e,t,n){var r;for(r in e)if(e.hasOwnProperty(r))switch(r){case t.parentKey:case t.attributesKey:break;case t.textKey:if(t.indentText||n)return!0;break;case t.cdataKey:if(t.indentCdata||n)return!0;break;case t.instructionKey:if(t.indentInstruction||n)return!0;break;case t.doctypeKey:case t.commentKey:default:return!0}return!1}function Gn(e,t,n,r,o){In=e,Cn=t;var a="elementNameFn"in n?n.elementNameFn(t,e):t;if(null==e||""===e)return"fullTagEmptyElementFn"in n&&n.fullTagEmptyElementFn(t,e)||n.fullTagEmptyElement?"<"+a+">"+a+">":"<"+a+"/>";var s=[];if(t){if(s.push("<"+a),"object"!==i(e))return s.push(">"+Un(e,n)+""+a+">"),s.join("");e[n.attributesKey]&&s.push(Pn(e[n.attributesKey],n,r));var u=zn(e,n,!0)||e[n.attributesKey]&&"preserve"===e[n.attributesKey]["xml:space"];if(u||(u="fullTagEmptyElementFn"in n?n.fullTagEmptyElementFn(t,e):n.fullTagEmptyElement),!u)return s.push("/>"),s.join("");s.push(">")}return s.push(Hn(e,n,r+1,!1)),In=e,Cn=t,t&&s.push((o?Dn(n,r,!1):"")+""+a+">"),s.join("")}function Hn(e,t,n,r){var i,o,a,s=[];for(o in e)if(e.hasOwnProperty(o))for(a=kn(e[o])?e[o]:[e[o]],i=0;i