@netless/window-manager 1.0.11 → 1.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
13
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
14
  PERFORMANCE OF THIS SOFTWARE.
15
15
  ***************************************************************************** */var Te=function(){return Te=Object.assign||function(t){for(var i,n=1,r=arguments.length;n<r;n++){i=arguments[n];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(t[s]=i[s])}return t},Te.apply(this,arguments)};function cl(e,t){var i={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(i[n[r]]=e[n[r]]);return i}var Io=0,Kh=typeof window!="undefined"&&window.requestAnimationFrame!==void 0?function(e){return window.requestAnimationFrame(e)}:function(e){var t=Date.now(),i=Math.max(0,16.7-(t-Io));Io=t+i,setTimeout(function(){return e(Io)},i)},mm=function(e){var t=[],i=[],n=0,r=!1,s=0,o=new WeakSet,a=new WeakSet,l={cancel:function(u){var h=i.indexOf(u);o.add(u),h!==-1&&i.splice(h,1)},process:function(u){var h;if(r=!0,h=[i,t],t=h[0],i=h[1],i.length=0,n=t.length,n){var c;for(s=0;s<n;s++)c=t[s],c(u),a.has(c)===!0&&!o.has(c)&&(l.schedule(c),e(!0))}r=!1},schedule:function(u,h,c){h===void 0&&(h=!1),c===void 0&&(c=!1);var m=c&&r,v=m?t:i;o.delete(u),h&&a.add(u),v.indexOf(u)===-1&&(v.push(u),m&&(n=t.length))}};return l},vm=40,Fu=1/60*1e3,ts=!0,Xn=!1,ia=!1,kn={delta:0,timestamp:0},hl=["read","update","preRender","render","postRender"],wm=function(e){return Xn=e},qh=hl.reduce(function(e,t){return e[t]=mm(wm),e},{}),ym=hl.reduce(function(e,t){var i=qh[t];return e[t]=function(n,r,s){return r===void 0&&(r=!1),s===void 0&&(s=!1),Xn||Sm(),i.schedule(n,r,s),n},e},{}),xm=function(e){return qh[e].process(kn)},ed=function(e){Xn=!1,kn.delta=ts?Fu:Math.max(Math.min(e-kn.timestamp,vm),1),ts||(Fu=kn.delta),kn.timestamp=e,ia=!0,hl.forEach(xm),ia=!1,Xn&&(ts=!1,Kh(ed))},Sm=function(){Xn=!0,ts=!0,ia||Kh(ed)},td=function(e,t){return function(i){return Math.max(Math.min(i,t),e)}},is=function(e){return e%1?Number(e.toFixed(5)):e},id=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i,Xs={test:function(e){return typeof e=="number"},parse:parseFloat,transform:function(e){return e}},Ln=Te(Te({},Xs),{transform:td(0,1)}),Lr=Te(Te({},Xs),{default:1}),dl=function(e){return{test:function(t){return typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1},parse:parseFloat,transform:function(t){return""+t+e}}},ni=dl("deg"),Rn=dl("%"),$=dl("px"),Qu=Te(Te({},Rn),{parse:function(e){return Rn.parse(e)/100},transform:function(e){return Rn.transform(e*100)}}),Mm=function(e){return e.substring(e.indexOf("(")+1,e.lastIndexOf(")"))},Im=td(0,255),na=function(e){return e.red!==void 0},ra=function(e){return e.hue!==void 0};function Cm(e){return Mm(e).replace(/(,|\/)/g," ").split(/ \s*/)}var nd=function(e){return function(t){if(typeof t!="string")return t;for(var i={},n=Cm(t),r=0;r<4;r++)i[e[r]]=n[r]!==void 0?parseFloat(n[r]):1;return i}},bm=function(e){var t=e.red,i=e.green,n=e.blue,r=e.alpha,s=r===void 0?1:r;return"rgba("+t+", "+i+", "+n+", "+s+")"},Am=function(e){var t=e.hue,i=e.saturation,n=e.lightness,r=e.alpha,s=r===void 0?1:r;return"hsla("+t+", "+i+", "+n+", "+s+")"},Co=Te(Te({},Xs),{transform:function(e){return Math.round(Im(e))}});function fl(e,t){return e.startsWith(t)&&id.test(e)}var ns={test:function(e){return typeof e=="string"?fl(e,"rgb"):na(e)},parse:nd(["red","green","blue","alpha"]),transform:function(e){var t=e.red,i=e.green,n=e.blue,r=e.alpha,s=r===void 0?1:r;return bm({red:Co.transform(t),green:Co.transform(i),blue:Co.transform(n),alpha:is(Ln.transform(s))})}},bo={test:function(e){return typeof e=="string"?fl(e,"hsl"):ra(e)},parse:nd(["hue","saturation","lightness","alpha"]),transform:function(e){var t=e.hue,i=e.saturation,n=e.lightness,r=e.alpha,s=r===void 0?1:r;return Am({hue:Math.round(t),saturation:Rn.transform(is(i)),lightness:Rn.transform(is(n)),alpha:is(Ln.transform(s))})}},Zu=Te(Te({},ns),{test:function(e){return typeof e=="string"&&fl(e,"#")},parse:function(e){var t="",i="",n="";return e.length>4?(t=e.substr(1,2),i=e.substr(3,2),n=e.substr(5,2)):(t=e.substr(1,1),i=e.substr(2,1),n=e.substr(3,1),t+=t,i+=i,n+=n),{red:parseInt(t,16),green:parseInt(i,16),blue:parseInt(n,16),alpha:1}}}),rt={test:function(e){return typeof e=="string"&&id.test(e)||na(e)||ra(e)},parse:function(e){return ns.test(e)?ns.parse(e):bo.test(e)?bo.parse(e):Zu.test(e)?Zu.parse(e):e},transform:function(e){return na(e)?ns.transform(e):ra(e)?bo.transform(e):e}},pl=function(e){var t=e.onRead,i=e.onRender,n=e.uncachedValues,r=n===void 0?new Set:n,s=e.useCache,o=s===void 0?!0:s;return function(a){a===void 0&&(a={});var l=cl(a,[]),u={},h=[],c=!1;function m(w,x){w.startsWith("--")&&(l.hasCSSVariable=!0);var d=u[w];u[w]=x,u[w]!==d&&(h.indexOf(w)===-1&&h.push(w),c||(c=!0,ym.render(v.render)))}var v={get:function(w,x){x===void 0&&(x=!1);var d=!x&&o&&!r.has(w)&&u[w]!==void 0;return d?u[w]:t(w,l)},set:function(w,x){if(typeof w=="string")m(w,x);else for(var d in w)m(d,w[d]);return this},render:function(w){return w===void 0&&(w=!1),(c||w===!0)&&(i(u,l,h),c=!1,h.length=0),this}};return v}},Tm=/([a-z])([A-Z])/g,Em="$1-$2",Js=function(e){return e.replace(Tm,Em).toLowerCase()},rd=new Map,gl=new Map,sd=["Webkit","Moz","O","ms",""],Nm=sd.length,km=typeof document!="undefined",Ao,od=function(e,t){return gl.set(e,Js(t))},Pm=function(e){Ao=Ao||document.createElement("div");for(var t=0;t<Nm;t++){var i=sd[t],n=i==="",r=n?e:i+e.charAt(0).toUpperCase()+e.slice(1);if(r in Ao.style||n){if(n&&e==="clipPath"&&gl.has(e))return;rd.set(e,r),od(e,(n?"":"-")+Js(r))}}},Bm=function(e){return od(e,e)},ad=function(e,t){t===void 0&&(t=!1);var i=t?gl:rd;return i.has(e)||(km?Pm(e):Bm(e)),i.get(e)||e},zm=["","X","Y","Z"],Dm=["translate","scale","rotate","skew","transformPerspective"],sa=Dm.reduce(function(e,t){return zm.reduce(function(i,n){return i.push(t+n),i},e)},["x","y","z"]),Lm=sa.reduce(function(e,t){return e[t]=!0,e},{});function ml(e){return Lm[e]===!0}function Rm(e,t){return sa.indexOf(e)-sa.indexOf(t)}var jm=new Set(["originX","originY","originZ"]);function _m(e){return jm.has(e)}var Yu=Te(Te({},Xs),{transform:Math.round}),Vm={color:rt,backgroundColor:rt,outlineColor:rt,fill:rt,stroke:rt,borderColor:rt,borderTopColor:rt,borderRightColor:rt,borderBottomColor:rt,borderLeftColor:rt,borderWidth:$,borderTopWidth:$,borderRightWidth:$,borderBottomWidth:$,borderLeftWidth:$,borderRadius:$,radius:$,borderTopLeftRadius:$,borderTopRightRadius:$,borderBottomRightRadius:$,borderBottomLeftRadius:$,width:$,maxWidth:$,height:$,maxHeight:$,size:$,top:$,right:$,bottom:$,left:$,padding:$,paddingTop:$,paddingRight:$,paddingBottom:$,paddingLeft:$,margin:$,marginTop:$,marginRight:$,marginBottom:$,marginLeft:$,rotate:ni,rotateX:ni,rotateY:ni,rotateZ:ni,scale:Lr,scaleX:Lr,scaleY:Lr,scaleZ:Lr,skew:ni,skewX:ni,skewY:ni,distance:$,translateX:$,translateY:$,translateZ:$,x:$,y:$,z:$,perspective:$,opacity:Ln,originX:Qu,originY:Qu,originZ:$,zIndex:Yu,fillOpacity:Ln,strokeOpacity:Ln,numOctaves:Yu},vl=function(e){return Vm[e]},Om=function(e,t){return t&&typeof e=="number"?t.transform(e):e},jn="scrollLeft",_n="scrollTop",ld=new Set([jn,_n]),Um=new Set([jn,_n,"transform"]),$m={x:"translateX",y:"translateY",z:"translateZ"};function ud(e){return typeof e=="function"}function Wm(e,t,i,n,r,s){s===void 0&&(s=!0);var o="",a=!1;i.sort(Rm);for(var l=i.length,u=0;u<l;u++){var h=i[u];o+=($m[h]||h)+"("+t[h]+") ",a=h==="z"?!0:a}return!a&&r?o+="translateZ(0)":o=o.trim(),ud(e.transform)?o=e.transform(t,n?"":o):s&&n&&(o="none"),o}function Hm(e,t,i,n,r,s,o,a){t===void 0&&(t=!0),i===void 0&&(i={}),n===void 0&&(n={}),r===void 0&&(r={}),s===void 0&&(s=[]),o===void 0&&(o=!1),a===void 0&&(a=!0);var l=!0,u=!1,h=!1;for(var c in e){var m=e[c],v=vl(c),w=Om(m,v);ml(c)?(u=!0,n[c]=w,s.push(c),l&&(v.default&&m!==v.default||!v.default&&m!==0)&&(l=!1)):_m(c)?(r[c]=w,h=!0):(!Um.has(c)||!ud(w))&&(i[ad(c,o)]=w)}return(u||typeof e.transform=="function")&&(i.transform=Wm(e,n,s,l,t,a)),h&&(i.transformOrigin=(r.originX||"50%")+" "+(r.originY||"50%")+" "+(r.originZ||0)),i}function wl(e){var t=e===void 0?{}:e,i=t.enableHardwareAcceleration,n=i===void 0?!0:i,r=t.isDashCase,s=r===void 0?!0:r,o=t.allowTransformNone,a=o===void 0?!0:o,l={},u={},h={},c=[];return function(m){return c.length=0,Hm(m,n,l,u,h,c,s,a),l}}function Fm(e,t){var i=t.element,n=t.preparseOutput,r=vl(e);if(ml(e))return r&&r.default||0;if(ld.has(e))return i[e];var s=window.getComputedStyle(i,null).getPropertyValue(ad(e,!0))||0;return n&&r&&r.test(s)&&r.parse?r.parse(s):s}function Qm(e,t,i){var n=t.element,r=t.buildStyles,s=t.hasCSSVariable;if(Object.assign(n.style,r(e)),s)for(var o=i.length,a=0;a<o;a++){var l=i[a];l.startsWith("--")&&n.style.setProperty(l,e[l])}i.indexOf(jn)!==-1&&(n[jn]=e[jn]),i.indexOf(_n)!==-1&&(n[_n]=e[_n])}var Zm=pl({onRead:Fm,onRender:Qm,uncachedValues:ld});function Ym(e,t){t===void 0&&(t={});var i=t.enableHardwareAcceleration,n=t.allowTransformNone,r=cl(t,["enableHardwareAcceleration","allowTransformNone"]);return Zm(Te({element:e,buildStyles:wl({enableHardwareAcceleration:i,allowTransformNone:n}),preparseOutput:!0},r))}var cd=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues"]),Gu=.5,hd=function(){return{style:{}}},To=function(e,t){return $.transform(e*t)},Gm={x:0,y:0,width:0,height:0};function Xu(e,t,i){return typeof e=="string"?e:$.transform(t+i*e)}function Xm(e,t,i){return Xu(t,e.x,e.width)+" "+Xu(i,e.y,e.height)}var dd={enableHardwareAcceleration:!1,isDashCase:!1};function Jm(e,t,i,n,r,s){t===void 0&&(t=Gm),n===void 0&&(n=wl(dd)),r===void 0&&(r=hd()),s===void 0&&(s=!0);var o=e.attrX,a=e.attrY,l=e.originX,u=e.originY,h=e.pathLength,c=e.pathSpacing,m=c===void 0?1:c,v=e.pathOffset,w=v===void 0?0:v,x=cl(e,["attrX","attrY","originX","originY","pathLength","pathSpacing","pathOffset"]),d=n(x);for(var f in d)if(f==="transform")r.style.transform=d[f];else{var g=s&&!cd.has(f)?Js(f):f;r[g]=d[f]}return(l!==void 0||u!==void 0||d.transform)&&(r.style.transformOrigin=Xm(t,l!==void 0?l:Gu,u!==void 0?u:Gu)),o!==void 0&&(r.x=o),a!==void 0&&(r.y=a),i!==void 0&&h!==void 0&&(r[s?"stroke-dashoffset":"strokeDashoffset"]=To(-w,i),r[s?"stroke-dasharray":"strokeDasharray"]=To(h,i)+" "+To(m,i)),r}function Km(e,t,i){i===void 0&&(i=!0);var n=hd(),r=wl(dd);return function(s){return Jm(s,e,t,r,n,i)}}var qm=function(e){return typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()},ev=function(e){try{return qm(e)}catch{return{x:0,y:0,width:0,height:0}}},tv=function(e){return e.tagName==="path"},iv=pl({onRead:function(e,t){var i=t.element;if(e=cd.has(e)?e:Js(e),ml(e)){var n=vl(e);return n&&n.default||0}else return i.getAttribute(e)},onRender:function(e,t){var i=t.element,n=t.buildAttrs,r=n(e);for(var s in r)s==="style"?Object.assign(i.style,r.style):i.setAttribute(s,r[s])}}),nv=function(e){var t=ev(e),i=tv(e)&&e.getTotalLength?e.getTotalLength():void 0;return iv({element:e,buildAttrs:Km(t,i)})},rv=pl({useCache:!1,onRead:function(e){return e==="scrollTop"?window.pageYOffset:window.pageXOffset},onRender:function(e){var t=e.scrollTop,i=t===void 0?0:t,n=e.scrollLeft,r=n===void 0?0:n;return window.scrollTo(r,i)}}),oa=new WeakMap,sv=function(e){return e instanceof HTMLElement||typeof e.click=="function"},ov=function(e){return e instanceof SVGElement||"ownerSVGElement"in e},av=function(e,t){var i;return e===window?i=rv(e):sv(e)?i=Ym(e,t):ov(e)&&(i=nv(e)),oa.set(e,i),i},lv=function(e,t){return oa.has(e)?oa.get(e):av(e,t)};function uv(e,t){var i=typeof e=="string"?document.querySelector(e):e;return lv(i,t)}var ot=function(t,i,n,r){var s=n?n.call(r,t,i):void 0;if(s!==void 0)return!!s;if(t===i)return!0;if(typeof t!="object"||!t||typeof i!="object"||!i)return!1;var o=Object.keys(t),a=Object.keys(i);if(o.length!==a.length)return!1;for(var l=Object.prototype.hasOwnProperty.bind(i),u=0;u<o.length;u++){var h=o[u];if(!l(h))return!1;var c=t[h],m=i[h];if(s=n?n.call(r,c,m,h):void 0,s===!1||s===void 0&&c!==m)return!1}return!0};const fd="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",cv=fd.length,Ju=Array(20),wn=()=>{for(let e=0;e<20;e++)Ju[e]=fd.charAt(Math.random()*cv);return Ju.join("")};class ys{constructor(){this.disposers=new Map}add(t,i=wn()){return this.flush(i),this.disposers.set(i,t()),i}addDisposer(t,i=wn()){return this.flush(i),this.disposers.set(i,t),i}addEventListener(t,i,n,r,s=wn()){return this.add(()=>(t.addEventListener(i,n,r),()=>t.removeEventListener(i,n,r)),s),s}setTimeout(t,i,n=wn()){return this.add(()=>{const r=window.setTimeout(()=>{this.remove(n),t()},i);return()=>window.clearTimeout(r)},n)}setInterval(t,i,n=wn()){return this.add(()=>{const r=window.setInterval(t,i);return()=>window.clearInterval(r)},n)}remove(t){const i=this.disposers.get(t);return this.disposers.delete(t),i}flush(t){const i=this.remove(t);if(i)try{i()}catch(n){console.error(n)}}flushAll(){this.disposers.forEach(t=>{try{t()}catch(i){console.error(i)}}),this.disposers.clear()}}var hv=Object.defineProperty,Eo=(typeof require!="undefined"&&require,(e,t,i)=>(((n,r,s)=>{r in n?hv(n,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[r]=s})(e,typeof t!="symbol"?t+"":t,i),i));class dr{constructor(t,i){Eo(this,"_value"),Eo(this,"_beforeDestroys"),Eo(this,"_subscribers"),this._value=t,i&&(this.compare=i)}get value(){return this._value}setValue(t,i){if(!this.compare(t,this._value)){const n=this._value;this._value=t,this._subscribers&&this._subscribers.forEach(r=>r(t,n,i))}}reaction(t){return this._subscribers||(this._subscribers=new Set),this._subscribers.add(t),()=>{this._subscribers&&this._subscribers.delete(t)}}subscribe(t,i){const n=this.reaction(t);return t(this._value,void 0,i),n}derive(t,i,n){const r=new dr(t(this.value,void 0,n),i),s=this.reaction((o,a,l)=>{r.setValue(t(o,a,l))});return r.addBeforeDestroy(s),r}destroy(){this._beforeDestroys&&(this._beforeDestroys.forEach(t=>t()),this._beforeDestroys.clear()),this._subscribers&&this._subscribers.clear()}addBeforeDestroy(t){return this._beforeDestroys||(this._beforeDestroys=new Set),this._beforeDestroys.add(t),()=>{this._beforeDestroys&&this._beforeDestroys.delete(t)}}compare(t,i){return t===i}}function dv(e,t,i,n){let r=e.map(o=>o.value);const s=new dr(t(r,void 0,n),i);return e.forEach((o,a)=>{const l=o.reaction((u,h,c)=>{const m=r.slice();m[a]=u;const v=r;r=m,s.setValue(t(m,v,c),c)});s.addBeforeDestroy(l)}),s}function pd(e,t){Object.keys(t).forEach(i=>{fv(e,i,t[i])})}function fv(e,t,i){var n;return Object.defineProperties(e,{[t]:{get:()=>i.value},[`_${t}$`]:{value:i},[`set${n=t,n[0].toUpperCase()+n.slice(1)}`]:{value:(r,s)=>i.setValue(r,s)}}),e}function gd(e){const t=i=>{const n=e.addDisposer(()=>{i.destroy()});return i.addBeforeDestroy(()=>{e.remove(n)}),i};return{bindSideEffect:t,combine:(i,n,r,s)=>t(dv(i,n,r,s)),createVal:(i,n)=>t(new dr(i,n))}}var yl=(e=>(e.Light="light",e.Dark="dark",e.Auto="auto",e))(yl||{}),N=(e=>(e.Normal="normal",e.Minimized="minimized",e.Maximized="maximized",e))(N||{}),oe=(e=>(e.DarkMode="dark_mode",e.PrefersColorScheme="prefers_color_scheme",e.Close="close",e.Focus="focus",e.Blur="blur",e.Move="move",e.Resize="resize",e.IntrinsicMove="intrinsic_move",e.IntrinsicResize="intrinsic_resize",e.VisualResize="visual_resize",e.ZIndex="z_index",e.State="state",e.Minimized="minimized",e.Maximized="maximized",e.Readonly="readonly",e.Destroyed="destroyed",e.BoxStatus="box_status",e.LastNotMinimizedBoxStatus="last_not_minimized_box_status",e.ForceTop="force_top",e.ForceNormal="force_normal",e))(oe||{}),be=(e=>(e.Close="close",e.Maximize="maximize",e.Minimize="minimize",e))(be||{}),at=(e=>(e.North="n",e.South="s",e.West="w",e.East="e",e.NorthWest="nw",e.NorthEast="ne",e.SouthEast="se",e.SouthWest="sw",e))(at||{});const No="dh";function Pe(e,t,i){return Math.min(Math.max(e,t),i)}function Hi(e){e.stopPropagation(),e.cancelable&&e.preventDefault()}function Ku(e){return e.touches?e.touches[0]:e}function pv(){return Date.now().toString().slice(6)+Math.random().toString().slice(2,8)}let gv=1;function mv(){return`New Box ${gv++}`}function vv(e){return Boolean(e)}function Rr(e){return!e}class md{constructor({readonly:t=!1,title:i,buttons:n,onEvent:r,onDragStart:s,namespace:o="telebox",state:a=N.Normal,boxStatus:l,forceTop:u=!1,forceNormal:h=!1}={}){this.$btns=[],this.sideEffect=new ys,this.lastTitleBarClick={timestamp:0,clientX:-100,clientY:-100},this.handleTitleBarClick=c=>{var m;if(this.readonly||c.button!==0||(m=c.target.dataset)!=null&&m.teleTitleBarNoDblClick)return;Hi(c);const v=Date.now();v-this.lastTitleBarClick.timestamp<=500?Math.abs(c.clientX-this.lastTitleBarClick.clientX)<=5&&Math.abs(c.clientY-this.lastTitleBarClick.clientY)<=5&&this.onEvent&&this.onEvent({type:be.Maximize}):this.onDragStart&&this.onDragStart(c),this.lastTitleBarClick.timestamp=v,this.lastTitleBarClick.clientX=c.clientX,this.lastTitleBarClick.clientY=c.clientY},this.lastTitleBarTouch={timestamp:0,clientX:-100,clientY:-100},this.handleTitleBarTouch=c=>{var m;if(this.readonly||(m=c.target.dataset)!=null&&m.teleTitleBarNoDblClick)return;Hi(c);const v=Date.now(),{clientX:w=this.lastTitleBarTouch.clientX+100,clientY:x=this.lastTitleBarTouch.clientY+100}=c.touches[0]||{};v-this.lastTitleBarTouch.timestamp<=500?Math.abs(w-this.lastTitleBarTouch.clientX)<=10&&Math.abs(x-this.lastTitleBarTouch.clientY)<=10&&this.onEvent&&this.onEvent({type:be.Maximize}):this.onDragStart&&this.onDragStart(c),this.lastTitleBarTouch.timestamp=v,this.lastTitleBarTouch.clientX=w,this.lastTitleBarTouch.clientY=x},this.readonly=t,this.onEvent=r,this.onDragStart=s,this.namespace=o,this.title=i,this.state=a,this.boxStatus=l,this.forceTop=u,this.forceNormal=h,this.buttons=n||(h?[{type:be.Close,iconClassName:this.wrapClassName("titlebar-icon-close")}]:[{type:be.Minimize,iconClassName:this.wrapClassName("titlebar-icon-minimize")},{type:be.Maximize,iconClassName:this.wrapClassName("titlebar-icon-maximize"),isActive:c=>c===N.Maximized},{type:be.Close,iconClassName:this.wrapClassName("titlebar-icon-close")}]),this.$dragArea=this.renderDragArea()}setTitle(t){this.title=t,this.$title&&(this.$title.textContent=t,this.$title.title=t)}setState(t){this.state!==t&&(this.state=t,this.buttons.forEach((i,n)=>{i.isActive&&this.$btns[n].classList.toggle("is-active",i.isActive(t))}))}setBoxStatus(t){this.boxStatus!==t&&(this.boxStatus=t,t&&this.buttons.forEach((i,n)=>{i.isActive&&this.$btns[n].classList.toggle("is-active",i.isActive(t))}))}setReadonly(t){this.readonly!==t&&(this.readonly=t)}render(){if(!this.$titleBar){this.$titleBar=document.createElement("div"),this.$titleBar.className=this.wrapClassName("titlebar");const t=document.createElement("div");t.className=this.wrapClassName("title-area"),t.dataset.teleBoxHandle=No,this.$title=document.createElement("h1"),this.$title.className=this.wrapClassName("title"),this.$title.dataset.teleBoxHandle=No,this.title&&(this.$title.textContent=this.title,this.$title.title=this.title),t.appendChild(this.$title),t.appendChild(this.$dragArea);const i=document.createElement("div");i.className=this.wrapClassName("titlebar-btns"),this.buttons.forEach(({iconClassName:n,isActive:r},s)=>{const o=String(s),a=document.createElement("button");a.className=`${this.wrapClassName("titlebar-btn")} ${n}`,a.dataset.teleTitleBarBtnIndex=o,a.dataset.teleTitleBarNoDblClick="true",r&&a.classList.toggle("is-active",r(this.boxStatus||this.state)),this.$btns.push(a),i.appendChild(a)}),this.sideEffect.addEventListener(i,"click",n=>{var r;if(this.readonly)return;const s=n.target,o=Number((r=s.dataset)==null?void 0:r.teleTitleBarBtnIndex);if(!Number.isNaN(o)&&o<this.buttons.length){Hi(n);const a=this.buttons[o];this.onEvent&&this.onEvent({type:a.type,value:a.value})}}),this.$titleBar.appendChild(t),this.$titleBar.appendChild(i)}return this.$titleBar}renderDragArea(){const t=document.createElement("div");return t.className=this.wrapClassName("drag-area"),t.dataset.teleBoxHandle=No,this.sideEffect.addEventListener(t,"mousedown",this.handleTitleBarClick),this.sideEffect.addEventListener(t,"touchstart",this.handleTitleBarTouch,{passive:!0}),t}dragHandle(){return this.$titleBar}wrapClassName(t){return`${this.namespace}-${t}`}destroy(){this.sideEffect.flushAll(),this.$titleBar&&(this.$titleBar=void 0,this.$title=void 0,this.$btns.length=0,this.onDragStart=void 0,this.onEvent=void 0)}}class wv{constructor({id:t=pv(),title:i=mv(),prefersColorScheme:n=yl.Light,darkMode:r,visible:s=!0,width:o=.5,height:a=.5,minWidth:l=0,minHeight:u=0,x:h=.1,y:c=.1,minimized:m=!1,maximized:v=!1,readonly:w=!1,resizable:x=!0,draggable:d=!0,fence:f=!0,fixRatio:g=!1,focus:p=!1,zIndex:y=100,namespace:S="telebox",titleBar:T,content:k,footer:B,styles:z,containerRect:ee={x:0,y:0,width:window.innerWidth,height:window.innerHeight},collectorRect:C,boxStatus:M,lastNotMinimizedBoxStatus:_,forceTop:D=!1,forceNormal:Z=!1,isDragContent:te=!1}={}){this._renderSideEffect=new ys,this.handleTrackStart=P=>{var X;return(X=this._handleTrackStart)==null?void 0:X.call(this,P)},this._sideEffect=new ys,this._valSideEffectBinder=gd(this._sideEffect);const{combine:he,createVal:Y}=this._valSideEffectBinder;this.id=t,this.namespace=S,this.events=new ta,this._delegateEvents=new ta;const ke=Y(M),Ni=Y(_),ei=Y(n);ei.reaction((P,X,j)=>{j||this.events.emit(oe.PrefersColorScheme,P)});const kt=Y(Boolean(r));r==null&&ei.subscribe((P,X,j)=>{this._sideEffect.add(()=>{if(P==="auto"){const fe=window.matchMedia("(prefers-color-scheme: dark)");if(fe){kt.setValue(fe.matches,j);const Pi=Dr=>{kt.setValue(Dr.matches,j)};return fe.addListener(Pi),()=>fe.removeListener(Pi)}else return qu}else return kt.setValue(P==="dark",j),qu},"prefers-color-scheme")}),kt.reaction((P,X,j)=>{j||this.events.emit(oe.DarkMode,P)});const gn=Y(ee,ot),A=Y(C,ot),R=Y(D);R.reaction((P,X,j)=>{j||this.events.emit(oe.ForceTop,P||!1)});const H=Y(Z);H.reaction((P,X,j)=>{j||this.events.emit(oe.ForceNormal,P||!1)});const ie=Y(te),ne=Y(i);ne.reaction((P,X,j)=>{j||this.titleBar.setTitle(P)});const Je=Y(s);Je.reaction((P,X,j)=>{!j&&!P&&this.events.emit(oe.Close)});const Qe=Y(w);Qe.reaction((P,X,j)=>{j||this.events.emit(oe.Readonly,P)});const ti=Y(x),Pt=Y(d),Tg=Y(f),Eg=Y(g),Bu=Y(y);Bu.reaction((P,X,j)=>{j||this.events.emit(oe.ZIndex,P)});const zu=Y(p);zu.reaction((P,X,j)=>{j||this.events.emit(P?oe.Focus:oe.Blur)});const ki=Y(m);ki.reaction((P,X,j)=>{j||this.events.emit(oe.Minimized,P)});const ii=Y(v);ii.reaction((P,X,j)=>{j||this.events.emit(oe.Maximized,P)});const Du=he([ki,ii,ke],([P,X,j])=>P?N.Minimized:X?N.Maximized:j||N.Normal);Du.reaction((P,X,j)=>{j||this.events.emit(oe.State,P)});const Br=Y({width:Pe(l,0,1),height:Pe(u,0,1)},ot),mn=Y({width:Pe(o,Br.value.width,1),height:Pe(a,Br.value.height,1)},ot);Br.reaction((P,X,j)=>{mn.setValue({width:Pe(o,P.width,1),height:Pe(a,P.height,1)},j)}),mn.reaction((P,X,j)=>{j||this.events.emit(oe.IntrinsicResize,P)});const vn=he([mn,ii,ke],([P,X,j])=>X||j===N.Maximized?{width:1,height:1}:P,ot);vn.reaction((P,X,j)=>{j||this.events.emit(oe.Resize,P)});const Lu=he([vn,ki,gn,A,ke],([P,X,j,fe,Pi])=>(X||Pi===N.Minimized)&&fe?{width:fe.width/P.width/j.width,height:fe.height/P.height/j.height}:P,ot);Lu.reaction((P,X,j)=>{j||this.events.emit(oe.VisualResize,P)});const yo=Y({x:Pe(h,0,1),y:Pe(c,0,1)},ot);yo.reaction((P,X,j)=>{j||this.events.emit(oe.IntrinsicMove,P)});const zr=he([yo,mn,gn,A,ki,ii,ke,Ni],([P,X,j,fe,Pi,Dr,Ru,Bg])=>(Pi||Ru===N.Minimized)&&fe?Dr||Bg===N.Maximized?{x:(fe.x+fe.width/2)/j.width-1/2,y:(fe.y+fe.height/2)/j.height-1/2}:{x:(fe.x+fe.width/2)/j.width-X.width/2,y:(fe.y+fe.height/2)/j.height-X.height/2}:Dr||Ru===N.Maximized?{x:0,y:0}:P,ot);zr.reaction((P,X,j)=>{j||this.events.emit(oe.Move,P)}),this.titleBar=T||new md({readonly:Qe.value,title:ne.value,namespace:this.namespace,boxStatus:ke.value,forceTop:R.value,forceNormal:H.value,onDragStart:P=>{var X;return(X=this._handleTrackStart)==null?void 0:X.call(this,P)},onEvent:P=>{if(this._delegateEvents.listeners.length>0)this._delegateEvents.emit(P.type);else switch(P.type){case be.Maximize:{ke.value||ii.setValue(!ii.value);break}case be.Minimize:{ke.value||ki.setValue(!0);break}case be.Close:{Je.setValue(!1);break}default:{console.error("Unsupported titleBar event:",P);break}}}}),Qe.reaction(P=>{this.titleBar.setReadonly(P)}),ke.reaction(P=>{this.titleBar.setBoxStatus(P)});const Ng=Y(k),kg=Y(B),Pg=Y(z);pd(this,{prefersColorScheme:ei,darkMode:kt,containerRect:gn,collectorRect:A,title:ne,visible:Je,readonly:Qe,resizable:ti,draggable:Pt,fence:Tg,fixRatio:Eg,focus:zu,zIndex:Bu,minimized:ki,maximized:ii,$userContent:Ng,$userFooter:kg,$userStyles:Pg,forceTop:R,forceNormal:H,isDragContent:ie}),this._state$=Du,this._minSize$=Br,this._size$=vn,this._intrinsicSize$=mn,this._visualSize$=Lu,this._coord$=zr,this._intrinsicCoord$=yo,this._boxStatus$=ke,this._lastNotMinimizedBoxStatus$=Ni,this.fixRatio&&this.transform(zr.value.x,zr.value.y,vn.value.width,vn.value.height,!0),this.$box=this.render()}get boxStatus(){return this._boxStatus$.value}set boxStatus(t){this._boxStatus$.setValue(t)}get lastNotMinimizedBoxStatus(){return this._lastNotMinimizedBoxStatus$.value}get darkMode(){return this._darkMode$.value}get state(){return this._state$.value}setState(t,i=!1){switch(t){case N.Maximized:{this.setMinimized(!1,i),this.setMaximized(!0,i);break}case N.Minimized:{this.setMinimized(!0,i),this.setMaximized(!1,i);break}default:{this.setMinimized(!1,i),this.setMaximized(!1,i);break}}return this}setBoxStatus(t,i=!1){return t===N.Minimized?this._boxStatus$.value&&this._boxStatus$.value!==N.Minimized&&this.setLastNotMinimizedBoxStatus(this._boxStatus$.value,i):this.setLastNotMinimizedBoxStatus(void 0,i),this._boxStatus$.setValue(t,i),i||this.events.emit(oe.BoxStatus,{id:this.id,boxStatus:t}),this}setLastNotMinimizedBoxStatus(t,i=!1){return this._lastNotMinimizedBoxStatus$.setValue(t,i),i||this.events.emit(oe.LastNotMinimizedBoxStatus,{id:this.id,lastNotMinimizedBoxStatus:t}),this}get minWidth(){return this._minSize$.value.width}get minHeight(){return this._minSize$.value.height}setMinWidth(t,i=!1){return this._minSize$.setValue({width:t,height:this.minHeight},i),this}setMinHeight(t,i=!1){return this._minSize$.setValue({width:this.minWidth,height:t},i),this}get intrinsicWidth(){return this._intrinsicSize$.value.width}get intrinsicHeight(){return this._intrinsicSize$.value.height}resize(t,i,n=!1){return this._intrinsicSize$.setValue({width:t,height:i},n),this}get width(){return this._size$.value.width}get height(){return this._size$.value.height}get absoluteWidth(){return this.width*this.containerRect.width}get absoluteHeight(){return this.height*this.containerRect.height}get visualWidth(){return this._visualSize$.value.width}get visualHeight(){return this._visualSize$.value.height}get intrinsicX(){return this._intrinsicCoord$.value.x}get intrinsicY(){return this._intrinsicCoord$.value.y}move(t,i,n=!1){return this._intrinsicCoord$.setValue({x:t,y:i},n),this}get x(){return this._coord$.value.x}get y(){return this._coord$.value.y}transform(t,i,n,r,s=!1){if(this.fixRatio){const o=this.intrinsicHeight/this.intrinsicWidth*n;i!==this.intrinsicY&&(i-=o-r),r=o}return i<0&&(i=0,r>this.intrinsicHeight&&(r=this.intrinsicHeight)),this._intrinsicCoord$.setValue({x:n>=this.minWidth?t:this.intrinsicX,y:r>=this.minHeight?i:this.intrinsicY},s),this._intrinsicSize$.setValue({width:Pe(n,this.minWidth,1),height:Pe(r,this.minHeight,1)},s),this}mount(t){return t.appendChild(this.render()),this}unmount(){return this.$box&&this.$box.remove(),this}mountContent(t){return this.set$userContent(t),this}unmountContent(){return this.set$userContent(void 0),this}mountFooter(t){return this.set$userFooter(t),this}unmountFooter(){return this.set$userFooter(void 0),this}getUserStyles(){return this.$userStyles}mountStyles(t){let i;return typeof t=="string"?(i=document.createElement("style"),i.textContent=t):i=t,this.set$userStyles(i),this}unmountStyles(){return this.set$userStyles(void 0),this}render(t){if(t){if(t===this.$box)return this.$box;this.$box=t}else{if(this.$box)return this.$box;this.$box=document.createElement("div")}this._renderSideEffect.flushAll(),this.$box.classList.add(this.wrapClassName("box"));const i=(c,m,v,w=vv)=>this._renderSideEffect.add(()=>{const x=this.wrapClassName(v);return m.subscribe(d=>{c.classList.toggle(x,w(d))})});i(this.$box,this._readonly$,"readonly"),i(this.$box,this._draggable$,"no-drag",Rr),i(this.$box,this._resizable$,"no-resize",Rr),i(this.$box,this._focus$,"blur",Rr),i(this.$box,this._darkMode$,"color-scheme-dark"),i(this.$box,this._darkMode$,"color-scheme-light",Rr),this._renderSideEffect.add(()=>{const c=this.wrapClassName("minimized"),m=this.wrapClassName("maximized"),v="box-maximized-timer";return this._state$.subscribe(w=>{this.$box.classList.toggle(c,w===N.Minimized),w===N.Maximized?(this._renderSideEffect.flush(v),this.$box.classList.toggle(m,!0)):this._renderSideEffect.setTimeout(()=>{this.$box.classList.toggle(m,!1)},0,v)})}),this._renderSideEffect.add(()=>this._visible$.subscribe(c=>{c?this.$box.style.removeProperty("display"):this.$box.style.display="none"})),this._renderSideEffect.add(()=>this._zIndex$.subscribe(c=>{this.$box.style.zIndex=String(c)}));const n=uv(this.$box);this.$box.dataset.teleBoxID=this.id,this.$box.style.width=this.absoluteWidth+"px",this.$box.style.height=this.absoluteHeight+"px";const r=this.x*this.containerRect.width+this.containerRect.x,s=this.y*this.containerRect.height+this.containerRect.y;this.$box.style.transform=`translate(${r-10}px,${s-10}px)`,this._valSideEffectBinder.combine([this._coord$,this._size$,this._minimized$,this._containerRect$,this._collectorRect$,this._boxStatus$],([c,m,v,w,x,d])=>{const f=m.width*w.width,g=m.height*w.height;return{width:f+((v||d===N.Minimized)&&x?1:0),height:g+((v||d===N.Minimized)&&x?1:0),x:c.x*w.width,y:c.y*w.height,scaleX:(v||d===N.Minimized)&&x?x.width/f:1,scaleY:(v||d===N.Minimized)&&x?x.height/g:1}},ot).subscribe(c=>{n.set(c)}),n.set({x:r,y:s});const o=document.createElement("div");o.className=this.wrapClassName("box-main"),this.$box.appendChild(o);const a=document.createElement("div");a.className=this.wrapClassName("titlebar-wrap"),a.appendChild(this.titleBar.render()),this.$titleBar=a;const l=document.createElement("div");l.className=this.wrapClassName("content-wrap");const u=document.createElement("div");u.className=this.wrapClassName("content")+" tele-fancy-scrollbar",this.$content=u,this.isDragContent&&this.$content.appendChild(this.titleBar.$dragArea),this._renderSideEffect.add(()=>{let c;return this._$userStyles$.subscribe(m=>{c&&c.remove(),c=m,m&&l.appendChild(m)})}),this._renderSideEffect.add(()=>{let c;return this._$userContent$.subscribe(m=>{c&&c.remove(),c=m,m&&u.appendChild(m)})}),l.appendChild(u);const h=document.createElement("div");return h.className=this.wrapClassName("footer-wrap"),this.$footer=h,this._renderSideEffect.add(()=>{let c;return this._$userFooter$.subscribe(m=>{c&&c.remove(),c=m,m&&h.appendChild(m)})}),o.appendChild(a),o.appendChild(l),o.appendChild(h),this._renderResizeHandlers(),this.$box}_renderResizeHandlers(){const t=document.createElement("div");t.className=this.wrapClassName("resize-handles"),Object.values(at).forEach(x=>{const d=document.createElement("div");d.className=this.wrapClassName(x)+" "+this.wrapClassName("resize-handle"),d.dataset.teleBoxHandle=x,t.appendChild(d)}),this.$box.appendChild(t);const i="handle-tracking-listener",n=this.wrapClassName("transforming");let r,s=0,o=0,a=0,l=0,u=0,h=0,c;const m=x=>{if(this.state!==N.Normal)return;Hi(x);let{pageX:d,pageY:f}=Ku(x);f<0&&(f=0);const g=(d-u)/this.containerRect.width,p=(f-h)/this.containerRect.height;switch(c){case at.North:{this.transform(this.x,o+p,this.width,l-p);break}case at.South:{this.transform(this.x,this.y,this.width,l+p);break}case at.West:{this.transform(s+g,this.y,a-g,this.height);break}case at.East:{this.transform(this.x,this.y,a+g,this.height);break}case at.NorthWest:{this.transform(s+g,o+p,a-g,l-p);break}case at.NorthEast:{this.transform(this.x,o+p,a+g,l-p);break}case at.SouthEast:{this.transform(this.x,this.y,a+g,l+p);break}case at.SouthWest:{this.transform(s+g,this.y,a-g,l+p);break}default:{if(this.fence)this.move(Pe(s+g,0,1-this.width),Pe(o+p,0,1-this.height));else{const y=20/this.containerRect.width,S=20/this.containerRect.height;this.move(Pe(s+g,y-this.width,1-y),Pe(o+p,0,1-S))}break}}},v=x=>{c=void 0,r&&(Hi(x),this.$box.classList.toggle(n,!1),this._sideEffect.flush(i),r.remove())},w=x=>{var d;if(this.readonly||x.button!=null&&x.button!==0||!this.draggable||c||this.state!==N.Normal)return;const f=x.target;if((d=f.dataset)!=null&&d.teleBoxHandle){Hi(x),s=this.x,o=this.y,a=this.width,l=this.height,{pageX:u,pageY:h}=Ku(x),c=f.dataset.teleBoxHandle,r||(r=document.createElement("div"));const g=c?this.wrapClassName(`cursor-${c}`):"";r.className=this.wrapClassName(`track-mask${g?` ${g}`:""}`),this.$box.appendChild(r),this.$box.classList.add(n),this._sideEffect.add(()=>(window.addEventListener("mousemove",m),window.addEventListener("touchmove",m,{passive:!1}),window.addEventListener("mouseup",v),window.addEventListener("touchend",v,{passive:!1}),window.addEventListener("touchcancel",v,{passive:!1}),()=>{window.removeEventListener("mousemove",m),window.removeEventListener("touchmove",m),window.removeEventListener("mouseup",v),window.removeEventListener("touchend",v),window.removeEventListener("touchcancel",v)}),i)}};this._handleTrackStart=w,this._sideEffect.addEventListener(t,"mousedown",w,{},"box-resizeHandles-mousedown"),this._sideEffect.addEventListener(t,"touchstart",w,{passive:!1},"box-resizeHandles-touchstart")}destroy(){this.$box.remove(),this.events.emit(oe.Destroyed),this._sideEffect.flushAll(),this._renderSideEffect.flushAll(),this.events.removeAllListeners(),this._delegateEvents.removeAllListeners()}wrapClassName(t){return`${this.namespace}-${t}`}}function qu(){}var yv="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxOCAxNiI+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxwYXRoIHN0cm9rZT0iIzdCODhBMCIgc3Ryb2tlLXdpZHRoPSIxLjQiIGQ9Ik0uNyAxLjJoMTYuNnYxMy42SC43eiIgLz4KICAgICAgICA8cGF0aCBmaWxsPSIjN0I4OEEwIiBkPSJNNCA1LjVoNnYxLjRINHpNNCA5LjVoMTB2MS40SDR6IiAvPgogICAgPC9nPgo8L3N2Zz4K";class un{constructor({visible:t=!0,readonly:i=!1,darkMode:n=!1,namespace:r="telebox",styles:s={},onClick:o,getBoxesStatus:a}){this.$appMenuContainer=document.createElement("div"),this.handleCollectorClick=()=>{!this._readonly&&this.onClick&&this.onClick()},this._visible=t,this._readonly=i,this._darkMode=n,this.namespace=r,this.styles=s,this.onClick=o,this.getBoxesStatus=a}get boxesStatus(){var t;return(t=this.getBoxesStatus)==null?void 0:t.call(this)}get visible(){return this._visible}get readonly(){return this._readonly}get darkMode(){return this._darkMode}mount(t){return t.appendChild(this.render()),this}unmount(){return this.$collector&&this.$collector.remove(),this}hasMinimizedBox(){const t=this.boxesStatus;if(t){for(const i of t.values())if(i===N.Minimized)return!0}return!1}updateBoxesStatus(){const t=this.hasMinimizedBox();this.setVisible(t)}setVisible(t){return this._visible!==t&&(this._visible=t,this.$collector&&this.$collector.classList.toggle(this.wrapClassName("collector-visible"),t)),this}setReadonly(t){return this._readonly!==t&&(this._readonly=t,this.$collector&&this.$collector.classList.toggle(this.wrapClassName("collector-readonly"),t)),this}setDarkMode(t){return this._darkMode!==t&&(this._darkMode=t,this.$collector&&(this.$collector.classList.toggle(this.wrapClassName("color-scheme-dark"),t),this.$collector.classList.toggle(this.wrapClassName("color-scheme-light"),!t))),this}setStyles(t){if(Object.assign(this.styles,t),this.$collector){const i=this.$collector;Object.keys(t).forEach(n=>{const r=t[n];r!=null&&(i.style[n]=r)})}return this}render(){return this.$collector||(this.$collector=document.createElement("button"),this.$collector.className=this.wrapClassName("collector"),this.$collector.style.backgroundImage=`url('${yv}')`,this.$collector.addEventListener("click",this.handleCollectorClick),this._visible&&this.$collector.classList.add(this.wrapClassName("collector-visible")),this._readonly&&this.$collector.classList.add(this.wrapClassName("collector-readonly")),this.$collector.classList.add(this.wrapClassName(this._darkMode?"color-scheme-dark":"color-scheme-light")),this.$appMenuContainer.classList.add(this.wrapClassName("collector-shadow")),this.$collector.append(this.$appMenuContainer),this.setStyles(this.styles)),this.$collector}destroy(){this.$collector&&(this.$collector.removeEventListener("click",this.handleCollectorClick),this.$collector.remove(),this.$collector=void 0),this.onClick=void 0}wrapClassName(t){return`${this.namespace}-${t}`}}un.kind="TeleBoxCollector";var ce=(e=>(e.Focused="focused",e.Blurred="blurred",e.Created="created",e.Removed="removed",e.State="state",e.Maximized="maximized",e.Minimized="minimized",e.Move="move",e.Resize="resize",e.IntrinsicMove="intrinsic_move",e.IntrinsicResize="intrinsic_resize",e.VisualResize="visual_resize",e.ZIndex="z_index",e.PrefersColorScheme="prefers_color_scheme",e.DarkMode="dark_mode",e.BoxStatus="box_status",e.LastNotMinimizedBoxStatus="last_not_minimized_box_status",e))(ce||{});class xv extends md{constructor(t){super(t),this.boxes=t.boxes,this.focusedBox=t.focusedBox,this.containerRect=t.containerRect,this.darkMode=t.darkMode,this.getBoxesStatus=t.getBoxesStatus}get boxesStatus(){var t;return(t=this.getBoxesStatus)==null?void 0:t.call(this)}hasMaximizedBoxInStatus(){if(this.getBoxesStatus){const t=this.getBoxesStatus();if(t.size)return!![...t.values()].find(n=>n===N.Maximized)}return!1}get MaximizedBoxes(){if(this.getBoxesStatus){const t=this.getBoxesStatus();if(t)return this.boxes.filter(i=>t&&t.get(i.id)===N.Maximized&&!i.forceTop)}return[]}focusBox(t){var i,n;if(!(this.focusedBox&&this.focusedBox===t)){if(this.$titles){const{children:r}=this.$titles.firstElementChild;if(this.state===N.Maximized&&!this.hasMaximizedBoxInStatus())for(let s=r.length-1;s>=0;s-=1){const o=r[s],a=(i=o.dataset)==null?void 0:i.teleBoxID;a&&(t&&a===t.id?o.classList.toggle(this.wrapClassName("titles-tab-focus"),!0):this.focusedBox&&a===this.focusedBox.id&&o.classList.toggle(this.wrapClassName("titles-tab-focus"),!1))}else if(this.hasMaximizedBoxInStatus())for(let s=r.length-1;s>=0;s-=1){const o=r[s],a=(n=o.dataset)==null?void 0:n.teleBoxID;a&&(t&&a===t.id?o.classList.toggle(this.wrapClassName("titles-tab-focus"),!0):this.focusedBox&&a===this.focusedBox.id&&o.classList.toggle(this.wrapClassName("titles-tab-focus"),!1))}}this.focusedBox=t}}setContainerRect(t){if(this.containerRect=t,this.$titleBar){const{x:i,y:n,width:r}=t;this.$titleBar.style.transform=`translate(${i}px, ${n}px)`,this.$titleBar.style.width=r+"px"}}updateBoxesStatus(){this.hasMaximizedBoxInStatus()&&this.setBoxStatus(N.Maximized),this.$titleBar&&this.$titleBar.classList.toggle(this.wrapClassName("max-titlebar-maximized"),this.state===N.Maximized&&this.boxes.length>0||this.hasMaximizedBoxInStatus()),this.updateTitles()}setBoxes(t){this.boxes=t,this.$titleBar&&this.$titleBar.classList.toggle(this.wrapClassName("max-titlebar-maximized"),this.state===N.Maximized&&t.length>0||this.hasMaximizedBoxInStatus()),this.updateTitles()}setState(t){super.setState(t),this.$titleBar&&this.$titleBar.classList.toggle(this.wrapClassName("max-titlebar-maximized"),t===N.Maximized&&this.boxes.length>0||this.hasMaximizedBoxInStatus()),this.updateTitles()}setReadonly(t){super.setReadonly(t),this.$titleBar&&this.$titleBar.classList.toggle(this.wrapClassName("readonly"),this.readonly)}setDarkMode(t){t!==this.darkMode&&(this.darkMode=t,this.$titleBar&&(this.$titleBar.classList.toggle(this.wrapClassName("color-scheme-dark"),t),this.$titleBar.classList.toggle(this.wrapClassName("color-scheme-light"),!t)))}render(){const t=super.render(),{x:i,y:n,width:r}=this.containerRect;t.style.transform=`translate(${i}px, ${n}px)`,t.style.width=r+"px",t.classList.add(this.wrapClassName("max-titlebar")),t.classList.toggle(this.wrapClassName("max-titlebar-maximized"),this.state===N.Maximized&&this.boxes.length>0),t.classList.toggle(this.wrapClassName("readonly"),this.readonly),t.classList.add(this.wrapClassName(this.darkMode?"color-scheme-dark":"color-scheme-light"));const s=document.createElement("div");return s.classList.add(this.wrapClassName("titles-area")),t.insertBefore(s,t.firstElementChild),this.updateTitles(),t}destroy(){super.destroy(),this.$titles=void 0,this.boxes.length=0,this.focusedBox=void 0}updateTitles(){this.$titleBar&&(this.state===N.Maximized||this.hasMaximizedBoxInStatus())&&(this.$titleBar.classList.toggle(this.wrapClassName("max-titlebar-single-title"),this.boxes.length===1||this.hasMaximizedBoxInStatus()&&this.MaximizedBoxes.length===1),this.boxes.length===1||this.hasMaximizedBoxInStatus()&&this.MaximizedBoxes.length===1?this.setTitle(this.boxes[0].title):this.$titleBar.replaceChild(this.renderTitles(),this.$titleBar.firstElementChild))}renderTitles(){this.$titles=document.createElement("div"),this.$titles.className=this.wrapClassName("titles"),this.$titles.addEventListener("wheel",i=>{i.currentTarget.scrollBy({left:i.deltaY>0?250:-250,behavior:"smooth"})},{passive:!1});const t=document.createElement("div");return t.className=this.wrapClassName("titles-content"),this.$titles.appendChild(t),(this.hasMaximizedBoxInStatus()?this.MaximizedBoxes:this.boxes).forEach(i=>{const n=document.createElement("button");n.className=this.wrapClassName("titles-tab"),n.textContent=i.title,n.dataset.teleBoxID=i.id,n.dataset.teleTitleBarNoDblClick="true",this.focusedBox&&i.id===this.focusedBox.id&&n.classList.add(this.wrapClassName("titles-tab-focus")),t.appendChild(n)}),this.$titles}}class Sv{constructor(t){this.namespace="telebox-app-menu",this.badge=document.createElement("div"),this.menuView=document.createElement("div"),this.containerClickHandler=()=>{if(this.manager.readonly)return;getComputedStyle(this.menuView).display==="flex"?this.menuView.style.display="none":this.menuView.style.display="flex"},this.menuViewClickHandler=i=>{i.stopPropagation(),i.stopImmediatePropagation();const r=i.target.getAttribute(`data-${this.c("app-id")}`);if(r){const s=this.manager.getLastNotMinimizedBoxStatus(r)||N.Normal,o=(s===N.Maximized?this.manager.getMaxMaximizedBoxZIndex():this.manager.getMaxNormalBoxZIndex())+1;this.manager.setBox(r,{status:s,zIndex:o},!1,()=>{this.manager.focusBox(r)});return}},this.updatePrefersColorSchemeHandler=()=>{this.container.classList.remove(this.theme),this.theme=this.manager.prefersColorScheme,this.container.classList.add(this.theme)},this.appMenuChange=()=>{const i=this.manager.getMinimizedBoxesStatus();this.render(i)},this.container=t.container,this.manager=t.manager,this.theme=t.theme,this.getBoxesStatus=t.getBoxesStatus,this.init()}get boxesStatus(){var t;return((t=this.getBoxesStatus)==null?void 0:t.call(this))||new Map}get minimizedBoxesStatus(){const t=[];return this.boxesStatus.forEach(i=>{i===N.Minimized&&t.push(i)}),t}c(t){return`${this.namespace}-${t}`}setContainer(t){this.container&&this.container.remove(),this.container=t,this.init()}createDefaultAppMenu(){this.badge.classList.add(this.c("app-menu-badge")),this.menuView.classList.add(this.c("app-menu-tooltip")),this.container.classList.add(this.c("app-menu-container"),this.theme),this.menuView.addEventListener("click",this.menuViewClickHandler),this.container.append(this.badge,this.menuView)}async init(){this.createDefaultAppMenu(),this.appMenuChange()}createMinimizedItem(t){const i=document.createElement("div");i.classList.add(this.c("app-menu-item")),i.setAttribute(`data-${this.c("app-id")}`,t);const n=document.createElement("div");n.classList.add(this.c("app-menu-item-title"));const r=this.manager.getBox(t);return n.innerText=(r==null?void 0:r.title)||t,i.appendChild(n),i}renderMenuView(t){const i=[];t.forEach((n,r)=>{i.push(this.createMinimizedItem(r))}),this.menuView.append(...i)}render(t){this.menuView.style.display="none",this.badge.innerText="",this.menuView.innerHTML="",t.size===0?this.container.style.display="none":(this.badge.innerText=t.size.toString(),this.renderMenuView(t),this.container.style.display="block")}destroy(){this.badge.remove(),this.menuView.removeEventListener("click",this.menuViewClickHandler),this.menuView.remove(),this.container.remove()}}class fr{constructor({root:t=document.body,prefersColorScheme:i=yl.Light,minimized:n=!1,maximized:r=!1,fence:s=!0,containerRect:o={x:0,y:0,width:window.innerWidth,height:window.innerHeight},collector:a,namespace:l="telebox",readonly:u=!1,useBoxesStatus:h=!1}={}){this.events=new ta,this._sideEffect=new ys,this.useBoxesStatus=h;const{combine:c,createVal:m}=gd(this._sideEffect);this.root=t,this.namespace=l,this.boxes$=m([]),this.topBox$=this.boxes$.derive(C=>{if(C.length>0){let M;return C.reduce((D,Z)=>Z.forceTop||Z.boxStatus&&Z.boxStatus===N.Minimized?D:D?D.zIndex>Z.zIndex?D:Z:(D=Z,D),M)}}),this.boxesStatus$=new Map,this.lastNotMinimizedBoxesStatus$=new Map;const v=window.matchMedia("(prefers-color-scheme: dark)"),w=m(!1);v&&(w.setValue(v.matches),this._sideEffect.add(()=>{const C=M=>{w.setValue(M.matches)};return v.addListener(C),()=>v.removeListener(C)}));const x=m(i);x.reaction((C,M,_)=>{this.boxes.forEach(D=>D.setPrefersColorScheme(C,_)),_||this.events.emit(ce.PrefersColorScheme,C)}),this._darkMode$=c([w,x],([C,M])=>M==="auto"?C:M==="dark"),this._darkMode$.reaction((C,M,_)=>{this.boxes.forEach(D=>D.setDarkMode(C,_)),_||this.events.emit(ce.DarkMode,C)});const d=m(u);d.reaction((C,M,_)=>{this.boxes.forEach(D=>D.setReadonly(C,_))});const f=m(n),g=m(r);g.reaction((C,M,_)=>{this.boxes.forEach(D=>D.setMaximized(C,_)),_||this.events.emit(ce.Maximized,C)});const p=c([f,g],([C,M])=>C?N.Minimized:M?N.Maximized:N.Normal);p.reaction((C,M,_)=>{this.maxTitleBar.setState(C),_||this.events.emit(ce.State,C)});const y=m(s);y.subscribe((C,M,_)=>{this.boxes.forEach(D=>D.setFence(C,_))});const S=m(o,ot);S.reaction((C,M,_)=>{this.boxes.forEach(D=>D.setContainerRect(C,_)),this.maxTitleBar.setContainerRect(C)});const T=m(a===null?null:a||new un({visible:n,readonly:u,namespace:l}).mount(t));T.subscribe(C=>{C&&(C.setVisible(f.value),C.setReadonly(d.value),C.setDarkMode(this._darkMode$.value),this.useBoxesStatus&&this.appMenu&&this.appMenu.setContainer(C.$appMenuContainer),this._sideEffect.add(()=>(C.getBoxesStatus=()=>this.boxesStatus$,C.onClick=()=>{d.value||(this.useBoxesStatus?this.useBoxesStatus&&this.appMenu&&this.appMenu.containerClickHandler():f.setValue(!1))},()=>C.destroy()),"collect-onClick"))}),d.subscribe(C=>{var M;return(M=T.value)==null?void 0:M.setReadonly(C)}),this._darkMode$.subscribe(C=>{var M;(M=T.value)==null||M.setDarkMode(C)}),this._calcCollectorRect=()=>{var C;if((C=T.value)!=null&&C.$collector){const{x:M,y:_,width:D,height:Z}=T.value.$collector.getBoundingClientRect(),te=this.root.getBoundingClientRect();return{x:M-te.x,y:_-te.y,width:D,height:Z}}},this._setCollectorRect=C=>{var M;(M=T.value)!=null&&M.$collector&&k.setValue(C)};const k=m(f.value?this._calcCollectorRect():void 0);k.subscribe((C,M,_)=>{this.boxes.forEach(D=>{D.setCollectorRect(C,_)})}),f.subscribe((C,M,_)=>{var D;(D=T.value)==null||D.setVisible(C),C&&this._setCollectorRect(this._calcCollectorRect()),this.boxes.forEach(Z=>Z.setMinimized(C,_)),_||this.events.emit(ce.Minimized,C)});const B=this.wrapClassName("titlebar-icon-close"),z=C=>{var M;if(d.value)return;const _=C.target;if(!!_.tagName)for(let D=_;D;D=D.parentElement){if(D.classList&&D.classList.contains(B))return;const Z=(M=D.dataset)==null?void 0:M.teleBoxID;if(Z){const te=this.getBox(Z);if(te){if(!this.useBoxesStatus)this.makeBoxTop(te);else if(te.boxStatus&&te.boxStatus===N.Normal){const he=this.getMaxNormalBoxZIndex();he>te.zIndex&&this.setBox(te,{zIndex:he+1},!1)}else if(te.boxStatus&&te.boxStatus===N.Maximized){const he=this.getMaxMaximizedBoxZIndex();he>te.zIndex&&this.setBox(te,{zIndex:he+1},!1),this.makeMaximizedTopBoxFocus()}this.focusBox(te);return}}}};this._sideEffect.addEventListener(window,"mousedown",z,!0),this._sideEffect.addEventListener(window,"touchstart",z,!0),this.maxTitleBar=new xv({darkMode:this.darkMode,readonly:d.value,namespace:this.namespace,state:p.value,boxes:this.boxes$.value,containerRect:S.value,getBoxesStatus:()=>this.boxesStatus$,onEvent:C=>{switch(C.type){case be.Maximize:{if(this.hasBoxesStatus()){let M=this.maxTitleBar.focusedBox;if(M||(M=this.getMaximizedTopBox()),M!=null&&M.id){const _=this.getBox(M.id);_&&this.setBox(_,{status:N.Normal,zIndex:this.getMaxNormalBoxZIndex()+1},!1,()=>{this.makeMaximizedTopBoxFocus()})}}else g.setValue(!g.value);break}case be.Minimize:{if(this.hasBoxesStatus()){let M=this.maxTitleBar.focusedBox;if(M||(M=this.getMaximizedTopBox()),M!=null&&M.id){const _=this.getBox(M.id);if(_){let D=!1;_.focus&&(this.blurBox(_),D=!0),this.setBox(_,{status:N.Minimized,zIndex:-1},!1),D?this.focusTopBox():this.makeMaximizedTopBoxFocus()}}}else f.setValue(!0);break}case oe.Close:{if(this.hasBoxesStatus()){let M=this.maxTitleBar.focusedBox;if(M||(M=this.getMaximizedTopBox()),M!=null&&M.id){const _=this.getBox(M.id);if(_){let D=!1;_.focus&&(this.blurBox(_),D=!0),this.remove(_,!1),D?this.focusTopBox():this.makeMaximizedTopBoxFocus()}}}else this.removeTopBox(),this.focusTopBox();break}}}}),d.subscribe(C=>this.maxTitleBar.setReadonly(C)),this._darkMode$.subscribe(C=>{this.maxTitleBar.setDarkMode(C)}),this.boxes$.reaction(C=>{this.maxTitleBar.setBoxes(C)}),pd(this,{prefersColorScheme:x,containerRect:S,collector:T,collectorRect:k,readonly:d,fence:y,minimized:f,maximized:g}),this._state$=p,this.root.appendChild(this.maxTitleBar.render()),h&&(this.appMenu=this.createMinimizedAppMenu())}get boxes(){return this.boxes$.value}get topBox(){return this.topBox$.value}get forceTopBoxes(){return this.boxes.find(t=>t.forceTop)}get maxForceTopBox(){return this.boxes.reduce((t,i)=>{var n;return i.forceTop&&i.zIndex>((n=t==null?void 0:t.zIndex)!=null?n:0)?i:t},void 0)}get forceNormalBoxes(){return this.boxes.find(t=>t.forceNormal)}get darkMode(){return this._darkMode$.value}get state(){return this._state$.value}setState(t,i=!1){switch(t){case N.Maximized:{this.setMinimized(!1,i),this.setMaximized(!0,i);break}case N.Minimized:{this.setMinimized(!0,i),this.setMaximized(!1,i);break}default:{this.setMinimized(!1,i),this.setMaximized(!1,i);break}}return this}setBoxStatus(t,i,n=!1){if(i){const r=this.boxesStatus$.get(t);this.boxesStatus$.set(t,i),i===N.Minimized&&r!==N.Minimized?this.setLastNotMinimizedBoxStatus(t,r,n):r===N.Minimized&&i!==N.Minimized&&this.setLastNotMinimizedBoxStatus(t,void 0,n)}else this.boxesStatus$.delete(t),this.setLastNotMinimizedBoxStatus(t,void 0,n);n||this.events.emit(ce.BoxStatus,{id:t,boxStatus:i})}getBoxStatus(t){return this.boxesStatus$.get(t)}get boxesStatus(){return this.boxesStatus$}get lastNotMinimizedBoxesStatus(){return this.lastNotMinimizedBoxesStatus$}setBoxesStatus(t,i=!1){this.boxesStatus$=t,this.effectBoxesStatusChange(i)}getBoxesStatus(){return this.boxesStatus$}effectBoxStatusChange(){!this.useBoxesStatus||(this.collector&&(this.collector.updateBoxesStatus(),this.hasMinimizedBox()&&this._setCollectorRect(this._calcCollectorRect())),this.appMenu&&this.appMenu.appMenuChange(),this.maxTitleBar&&this.maxTitleBar.updateBoxesStatus())}effectBoxesStatusTimerFunc(t){if(!this.useBoxesStatus)return;let i;const n=this.topBox;this.boxes.forEach(r=>{var s;const o=this.boxesStatus$.get(r.id);o&&(o!==N.Minimized&&!this.isForceTop(r)&&r.zIndex>((s=i==null?void 0:i.zIndex)!=null?s:0)&&(i=r),r.setBoxStatus(o,t))}),this.effectBoxStatusChange(),i&&n!==i&&this.topBox$.setValue(i),!i&&n&&this.topBox$.setValue(void 0)}async effectBoxesStatusChange(t=!1){var i,n;if(!this.useBoxesStatus){this.effectBoxesStatusTimer&&this.effectBoxesStatusTimer.timer&&(clearTimeout(this.effectBoxesStatusTimer.timer),this.effectBoxesStatusTimer.resolve&&this.effectBoxesStatusTimer.resolve(!!((i=this.effectBoxesStatusTimer)!=null&&i.skipUpdate))),this.effectBoxesStatusTimer=void 0;return}if(this.effectBoxesStatusTimer&&this.effectBoxesStatusTimer.timer)if(this.effectBoxesStatusTimer.skipUpdate!==t)clearTimeout(this.effectBoxesStatusTimer.timer),this.effectBoxesStatusTimer.resolve&&this.effectBoxesStatusTimer.resolve(!!((n=this.effectBoxesStatusTimer)!=null&&n.skipUpdate)),this.effectBoxesStatusTimer.skipUpdate=t;else return;if(this.effectBoxesStatusTimer||(this.effectBoxesStatusTimer={skipUpdate:t,timer:void 0,resolve:void 0}),this.effectBoxesStatusTimer){const r=await new Promise(s=>{this.effectBoxesStatusTimer.resolve=s,this.effectBoxesStatusTimer.timer=setTimeout(()=>{this.effectBoxesStatusTimer&&this.effectBoxesStatusTimer.resolve&&this.effectBoxesStatusTimer.resolve(this.effectBoxesStatusTimer.skipUpdate)},100)});this.effectBoxesStatusTimerFunc(r),this.effectBoxesStatusTimer=void 0}}hasBoxesStatus(){return this.useBoxesStatus?this.boxesStatus$.size>0:!1}hasMinimizedBox(){return this.useBoxesStatus?this.boxes.some(t=>t.boxStatus&&t.boxStatus===N.Minimized):!1}getMinimizedBoxesStatus(){const t=new Map;return this.boxesStatus$.forEach((i,n)=>{i===N.Minimized&&t.set(n,i)}),t}getNotMinimizedBoxesStatus(){const t=new Map;return this.boxesStatus$.forEach((i,n)=>{i!==N.Minimized&&t.set(n,i)}),t}getAllMaximizedBoxesStatus(){const t=new Map;return this.boxesStatus$.forEach((i,n)=>{i===N.Maximized&&t.set(n,i)}),t}getAllNormalBoxesStatus(){const t=new Map;return this.boxesStatus$.forEach((i,n)=>{i===N.Normal&&t.set(n,i)}),t}getLastNotMinimizedBoxStatus(t){return this.lastNotMinimizedBoxesStatus$.get(t)}setLastNotMinimizedBoxStatus(t,i,n=!1){i?this.lastNotMinimizedBoxesStatus$.set(t,i):this.lastNotMinimizedBoxesStatus$.delete(t),n||this.events.emit(ce.LastNotMinimizedBoxStatus,{id:t,boxStatus:i})}setLastNotMinimizedBoxesStatus(t,i=!1){this.lastNotMinimizedBoxesStatus$=t,this.effectLastNotMinimizedBoxStatusChange(i)}async effectLastNotMinimizedBoxStatusChange(t=!1){var i,n;if(!this.useBoxesStatus){this.effectLastNotMinimizedBoxStatusTimer&&this.effectLastNotMinimizedBoxStatusTimer.timer&&(clearTimeout(this.effectLastNotMinimizedBoxStatusTimer.timer),this.effectLastNotMinimizedBoxStatusTimer.resolve&&this.effectLastNotMinimizedBoxStatusTimer.resolve(!!((i=this.effectLastNotMinimizedBoxStatusTimer)!=null&&i.skipUpdate))),this.effectLastNotMinimizedBoxStatusTimer=void 0;return}if(this.effectLastNotMinimizedBoxStatusTimer&&this.effectLastNotMinimizedBoxStatusTimer.timer)if(clearTimeout(this.effectLastNotMinimizedBoxStatusTimer.timer),this.effectLastNotMinimizedBoxStatusTimer.skipUpdate!==t)this.effectLastNotMinimizedBoxStatusTimer.resolve&&this.effectLastNotMinimizedBoxStatusTimer.resolve(!!((n=this.effectLastNotMinimizedBoxStatusTimer)!=null&&n.skipUpdate)),this.effectLastNotMinimizedBoxStatusTimer.skipUpdate=t;else return;if(this.effectLastNotMinimizedBoxStatusTimer||(this.effectLastNotMinimizedBoxStatusTimer={skipUpdate:t,timer:void 0,resolve:void 0}),this.effectLastNotMinimizedBoxStatusTimer){const r=await new Promise(s=>{this.effectLastNotMinimizedBoxStatusTimer.resolve=s,this.effectLastNotMinimizedBoxStatusTimer.timer=setTimeout(()=>{this.effectLastNotMinimizedBoxStatusTimer&&this.effectLastNotMinimizedBoxStatusTimer.resolve&&this.effectLastNotMinimizedBoxStatusTimer.resolve(this.effectLastNotMinimizedBoxStatusTimer.skipUpdate)},100)});this.effectLastNotMinimizedBoxStatusFunc(r),this.effectLastNotMinimizedBoxStatusTimer=void 0}}effectLastNotMinimizedBoxStatusFunc(t=!1){!this.useBoxesStatus||this.boxes.forEach(i=>{const n=this.lastNotMinimizedBoxesStatus$.get(i.id);n&&i.setLastNotMinimizedBoxStatus(n,t)})}getUnabledBoxesStatusZIndex(){return this.topBox?this.topBox.zIndex:99}getMaxMaximizedBoxZIndex(){return this.useBoxesStatus?this.boxes.reduce((t,i)=>i.boxStatus&&i.boxStatus===N.Maximized&&!this.isForceTop(i)?Math.max(t,i.zIndex):t,99):this.getUnabledBoxesStatusZIndex()}getMaxNormalBoxZIndex(){return this.useBoxesStatus?this.boxes.reduce((t,i)=>i.boxStatus&&i.boxStatus===N.Normal&&!this.isForceTop(i)?Math.max(t,i.zIndex):t,299):this.getUnabledBoxesStatusZIndex()}getMaxForceTopBoxZIndex(){return this.useBoxesStatus?this.boxes.reduce((t,i)=>i.boxStatus&&this.isForceTop(i)?Math.max(t,i.zIndex):t,699):this.getUnabledBoxesStatusZIndex()}isForceNormal(t){return t._forceNormal$.value}isForceTop(t){return t._forceTop$.value}create(t={},i=!0){const n=new wv({zIndex:t.forceTop?this.getMaxForceTopBoxZIndex()+1:this.getMaxNormalBoxZIndex()+1,...i?this.smartPosition(t):t,darkMode:this.darkMode,prefersColorScheme:this.prefersColorScheme,maximized:this.maximized,minimized:this.minimized,fence:this.fence,namespace:this.namespace,containerRect:this.containerRect,readonly:this.readonly,collectorRect:this.collectorRect});return n.mount(this.root),this.boxes$.setValue([...this.boxes,n]),n.boxStatus&&this.useBoxesStatus&&this.setBox(n,{status:n.boxStatus,lastNotMinimizedBoxStatus:n._lastNotMinimizedBoxStatus$.value},!0),n.focus&&(this.focusBox(n),i&&this.makeBoxTop(n)),n._delegateEvents.on(be.Maximize,()=>{if(this.useBoxesStatus&&n.boxStatus){if(n._forceNormal$.value)return;n.boxStatus===N.Maximized?this.setBox(n.id,{status:N.Normal,zIndex:this.getMaxNormalBoxZIndex()+1},!1):([...this.boxes].filter(r=>r.boxStatus===N.Normal&&!this.isForceNormal(r)).sort((r,s)=>r.zIndex-s.zIndex).forEach(r=>{r.boxStatus===N.Normal&&this.setBox(r.id,{status:N.Maximized,zIndex:this.getMaxMaximizedBoxZIndex()+1},!1)}),this.makeMaximizedTopBoxFocus())}else this.setMaximized(!this.maximized)}),n._delegateEvents.on(be.Minimize,()=>{if(n.boxStatus&&this.useBoxesStatus){if(n._forceNormal$.value)return;n.focus&&this.blurBox(n),this.setBox(n,{status:N.Minimized,zIndex:-1},!1,()=>{this.focusTopBox()})}else this.setMinimized(!0)}),n._delegateEvents.on(be.Close,()=>{this.useBoxesStatus&&n.focus&&this.blurBox(n),this.remove(n),this.focusTopBox()}),n._coord$.reaction((r,s,o)=>{o||this.events.emit(ce.Move,n)}),n._size$.reaction((r,s,o)=>{o||this.events.emit(ce.Resize,n)}),n._intrinsicCoord$.reaction((r,s,o)=>{o||this.events.emit(ce.IntrinsicMove,n)}),n._intrinsicSize$.reaction((r,s,o)=>{o||this.events.emit(ce.IntrinsicResize,n)}),n._visualSize$.reaction((r,s,o)=>{o||this.events.emit(ce.VisualResize,n)}),n._zIndex$.reaction((r,s,o)=>{if(this.boxes.length>0){let a;const l=this.boxes.reduce((u,h)=>this.isForceTop(h)||h.boxStatus&&h.boxStatus===N.Minimized?u:u?u.zIndex>h.zIndex?u:h:(u=h,u),a);this.topBox$.setValue(l)}o||this.events.emit(ce.ZIndex,n)}),this.events.emit(ce.Created,n),n}query(t){return t?this.boxes.filter(this.teleBoxMatcher(t)):[...this.boxes]}queryOne(t){return t?this.boxes.find(this.teleBoxMatcher(t)):this.boxes[0]}update(t,i,n=!1){const r=this.boxes.find(s=>s.id===t);if(r)return this.updateBox(r,i,n)}updateAll(t,i=!1){this.boxes.forEach(n=>{this.updateBox(n,t,i)})}setBox(t,i,n=!1,r){const s=this.getBox(t);if(s){const{status:o,zIndex:a,lastNotMinimizedBoxStatus:l}=i;o&&(this.setBoxStatus(s.id,o,n),s.setBoxStatus(o,n),this.effectBoxStatusChange()),a&&s.setZIndex(a,n),l&&(this.setLastNotMinimizedBoxStatus(s.id,l,n),s.setLastNotMinimizedBoxStatus(l,n)),r&&r()}}remove(t,i=!1,n){const r=this.getBox(t),s=this.getBoxIndex(t);if(s>=0){const o=this.boxes.slice(),a=o.splice(s,1);return this.boxes$.setValue(o),a.forEach(l=>l.destroy()),r&&this.useBoxesStatus&&(this.setBoxStatus(r.id,void 0,i),this.setLastNotMinimizedBoxStatus(r.id,void 0,i),this.effectBoxStatusChange(),n&&n()),i||(this.boxes.length<=0&&(this.setMaximized(!1),this.setMinimized(!1)),this.events.emit(ce.Removed,a)),a[0]}}removeTopBox(){if(this.topBox)return this.remove(this.topBox)}removeAll(t=!1){const i=this.boxes$.value;return this.boxes$.setValue([]),i.forEach(n=>n.destroy()),this.boxesStatus$.clear(),this.lastNotMinimizedBoxesStatus$.clear(),t||(this.boxes.length<=0&&(this.setMaximized(!1),this.setMinimized(!1)),this.events.emit(ce.Removed,i)),i}destroy(t=!1){this.events.removeAllListeners(),this._sideEffect.flushAll(),this.removeAll(t),Object.keys(this).forEach(i=>{const n=this[i];n instanceof dr&&n.destroy()})}wrapClassName(t){return`${this.namespace}-${t}`}focusBox(t,i=!1){const n=this.getBox(t);n&&(this.boxes.forEach(r=>{if(n===r){let s=!1;n.focus||(s=!0,n.setFocus(!0,i)),s&&!i&&this.events.emit(ce.Focused,n)}else r.focus&&this.blurBox(r,i)}),this.useBoxesStatus?this.useBoxesStatus&&this.maxTitleBar.hasMaximizedBoxInStatus()&&this.makeMaximizedTopBoxFocus():this.maxTitleBar.focusBox(n))}focusTopBox(){if(this.topBox&&!this.topBox.focus)return this.focusBox(this.topBox)}blurBox(t,i=!1){const n=this.getBox(t);n&&(n.focus&&(n.setFocus(!1,i),i||this.events.emit(ce.Blurred,n)),this.maxTitleBar.focusedBox===n&&this.maxTitleBar.focusBox())}blurAll(t=!1){this.boxes.forEach(i=>{i.focus&&(i.setFocus(!1,t),t||this.events.emit(ce.Blurred,i))}),this.maxTitleBar.focusedBox&&this.maxTitleBar.focusBox()}teleBoxMatcher(t){const i=Object.keys(t);return n=>i.every(r=>t[r]===n[r])}updateBox(t,i,n=!1){(i.x!=null||i.y!=null)&&t.move(i.x==null?t.intrinsicX:i.x,i.y==null?t.intrinsicY:i.y,n),(i.width!=null||i.height!=null)&&t.resize(i.width==null?t.intrinsicWidth:i.width,i.height==null?t.intrinsicHeight:i.height,n),i.title!=null&&(t.setTitle(i.title),this.maxTitleBar.updateTitles()),i.visible!=null&&t.setVisible(i.visible,n),i.minHeight!=null&&t.setMinHeight(i.minHeight,n),i.minWidth!=null&&t.setMinWidth(i.minWidth,n),i.resizable!=null&&t.setResizable(i.resizable,n),i.draggable!=null&&t.setDraggable(i.draggable,n),i.fixRatio!=null&&t.setFixRatio(i.fixRatio,n),i.zIndex!=null&&t.setZIndex(i.zIndex,n),i.content!=null&&t.mountContent(i.content),i.footer!=null&&t.mountFooter(i.footer),this.useBoxesStatus&&(i.boxStatus||i.lastNotMinimizedBoxStatus)&&this.setBox(t,{status:i.boxStatus,lastNotMinimizedBoxStatus:i.lastNotMinimizedBoxStatus},n),i.forceTop!=null&&t.setForceTop(i.forceTop,n),i.forceNormal!=null&&t.setForceNormal(i.forceNormal,n)}smartPosition(t={}){let{x:i,y:n}=t;const{width:r=.5,height:s=.5}=t;if(i==null){let o=20;if(t.forceTop){const a=this.maxForceTopBox||this.topBox;a&&(o=a.intrinsicX*this.containerRect.width+20,o>this.containerRect.width-r*this.containerRect.width&&(o=20))}else this.topBox?(o=this.topBox.intrinsicX*this.containerRect.width+20,o>this.containerRect.width-r*this.containerRect.width&&(o=20)):this.hasMinimizedBox()&&(o=[...this.boxes].filter(a=>a.boxStatus&&a.boxStatus===N.Minimized&&a.lastNotMinimizedBoxStatus&&a.lastNotMinimizedBoxStatus===N.Normal).reduce((a,l)=>Math.max(a,l.intrinsicX*this.containerRect.width+20),o));i=o/this.containerRect.width}if(n==null){let o=20;if(t.forceTop){const a=this.maxForceTopBox||this.topBox;a&&(o=a.intrinsicY*this.containerRect.height+20,o>this.containerRect.height-s*this.containerRect.height&&(o=20))}else this.topBox?(o=this.topBox.intrinsicY*this.containerRect.height+20,o>this.containerRect.height-s*this.containerRect.height&&(o=20)):this.hasMinimizedBox()&&(o=[...this.boxes].filter(a=>a.boxStatus&&a.boxStatus===N.Minimized&&a.lastNotMinimizedBoxStatus&&a.lastNotMinimizedBoxStatus===N.Normal).reduce((a,l)=>Math.max(a,l.intrinsicY*this.containerRect.height+20),o));n=o/this.containerRect.height}return{...t,x:i,y:n,width:r,height:s}}makeBoxTop(t,i=!1){!this.useBoxesStatus&&this.topBox?t!==this.topBox&&t.setZIndex(this.topBox.zIndex+1,i):this.useBoxesStatus}getMaximizedTopBox(){if(!this.useBoxesStatus)return;let t;return this.maxTitleBar.hasMaximizedBoxInStatus()&&(t=this.maxTitleBar.MaximizedBoxes.reduce((i,n)=>i&&i.zIndex>n.zIndex?i:n)),t}makeMaximizedTopBoxFocus(){if(!this.useBoxesStatus)return;const t=this.getMaximizedTopBox();this.maxTitleBar.focusBox(t)}getBoxIndex(t){return typeof t=="string"?this.boxes.findIndex(i=>i.id===t):this.boxes.findIndex(i=>i===t)}getBox(t){return typeof t=="string"?this.boxes.find(i=>i.id===t):t}createMinimizedAppMenu(){var t,i;if((t=this.collector)!=null&&t.$appMenuContainer)return new Sv({manager:this,container:(i=this.collector)==null?void 0:i.$appMenuContainer,theme:this.prefersColorScheme?"dark":"light",getBoxesStatus:()=>this.boxesStatus$})}}fr.kind="TeleBoxManager";const Mv=(e,t,i,n,r)=>{const s=Tt(pr,Q.extendClass);return new s({safeSetAttributes:o=>e.safeSetAttributes(o),getMainView:()=>e.mainView,updateAppState:(...o)=>{var a;return(a=e.appManager)==null?void 0:a.store.updateAppState(...o)},setBoxStatus:(o,a)=>{var l;return(l=e.appManager)==null?void 0:l.store.setBoxStatus(o,a)},setLastNotMinimizedBoxStatus:(o,a)=>{var l;return(l=e.appManager)==null?void 0:l.store.setLastNotMinimizedBoxStatus(o,a)},canOperate:()=>e.canOperate,notifyContainerRectUpdate:o=>{var a;return(a=e.appManager)==null?void 0:a.notifyContainerRectUpdate(o)},cleanFocus:()=>{var o;return(o=e.appManager)==null?void 0:o.store.cleanFocus()},setAppFocus:o=>{var a;return(a=e.appManager)==null?void 0:a.store.setAppFocus(o,!0)},callbacks:t,emitter:i,boxEmitter:n},r)};class pr{constructor(t,i){this.context=t,this.createTeleBoxManagerConfig=i;const{emitter:n,callbacks:r,boxEmitter:s}=t;this.teleBoxManager=this.setupBoxManager(i),this.teleBoxManager._state$.reaction(o=>{r.emit("boxStateChange",o),n.emit("boxStateChange",o)}),this.teleBoxManager._darkMode$.reaction(o=>{r.emit("darkModeChange",o)}),this.teleBoxManager._prefersColorScheme$.reaction(o=>{r.emit("prefersColorSchemeChange",o)}),this.teleBoxManager._minimized$.reaction(o=>{o||setTimeout(()=>{const a=.001*(Math.random()>.5?1:-1);this.teleBoxManager.boxes.forEach(l=>{l.resize(l.intrinsicWidth+a,l.intrinsicHeight+a,!0)})},400)}),this.teleBoxManager.events.on("minimized",o=>{if(this.context.safeSetAttributes({minimized:o}),o)this.context.cleanFocus(),this.blurAllBox();else{const a=this.getTopBox();a&&(this.context.setAppFocus(a.id),this.focusBox({appId:a.id},!1))}}),this.teleBoxManager.events.on("maximized",o=>{this.context.safeSetAttributes({maximized:o})}),this.teleBoxManager.events.on("removed",o=>{o.forEach(a=>{s.emit("close",{appId:a.id})})}),this.teleBoxManager.events.on("intrinsic_move",E.debounce(o=>{s.emit("move",{appId:o.id,x:o.intrinsicX,y:o.intrinsicY})},50)),this.teleBoxManager.events.on("intrinsic_resize",E.debounce(o=>{s.emit("resize",{appId:o.id,width:o.intrinsicWidth,height:o.intrinsicHeight})},200)),this.teleBoxManager.events.on("focused",o=>{o&&(this.canOperate?s.emit("focus",{appId:o.id}):this.teleBoxManager.blurBox(o.id))}),this.teleBoxManager.events.on("blurred",o=>{o&&this.canOperate&&s.emit("blurred",{appId:o.id})}),this.teleBoxManager.events.on("z_index",o=>{this.context.updateAppState(o.id,Be.ZIndex,o.zIndex)}),this.teleBoxManager.events.on("box_status",o=>{this.canOperate&&this.context.setBoxStatus(o.id,o.boxStatus)}),this.teleBoxManager.events.on("last_not_minimized_box_status",o=>{this.canOperate&&this.context.setLastNotMinimizedBoxStatus(o.id,o.boxStatus)}),n.on("playgroundSizeChange",()=>this.updateManagerRect()),n.on("updateManagerRect",()=>this.updateManagerRect())}get mainView(){return this.context.getMainView()}get canOperate(){return this.context.canOperate()}get boxState(){return this.teleBoxManager.state}get maximized(){return this.teleBoxManager.maximized}get minimized(){return this.teleBoxManager.minimized}get darkMode(){return this.teleBoxManager.darkMode}get prefersColorScheme(){return this.teleBoxManager.prefersColorScheme}get boxSize(){return this.teleBoxManager.boxes.length}createBox(t){var u,h,c;if(!this.teleBoxManager)return;let{minwidth:i=Vg,minheight:n=Og}=(u=t.app.config)!=null?u:{};const{width:r,height:s}=(h=t.app.config)!=null?h:{},o=((c=t.options)==null?void 0:c.title)||t.appId,a=this.teleBoxManager.containerRect;i>1&&(i=i/a.width),n>1&&(n=n/a.height);const l={title:o,minWidth:i,minHeight:n,width:r,height:s,id:t.appId,boxStatus:t.boxStatus,forceTop:t.forceTop,forceNormal:t.forceNormal,isDragContent:t.isDragContent};this.teleBoxManager.create(l,t.smartPosition),this.context.emitter.emit(`${t.appId}${se.WindowCreated}`)}setBoxInitState(t){const i=this.teleBoxManager.queryOne({id:t});i&&i.state===N.Maximized&&this.context.boxEmitter.emit("resize",{appId:t,x:i.x,y:i.y,width:i.intrinsicWidth,height:i.intrinsicHeight})}setBoxesStatus(t){const i=new Map(Object.entries(t!=null?t:{}));this.teleBoxManager.setBoxesStatus(i,!0),this.context.callbacks.emit("onBoxesStatusChange",i),this.context.emitter.emit("boxesStatusChange",i)}setLastNotMinimizedBoxesStatus(t){const i=new Map(Object.entries(t!=null?t:{}));this.teleBoxManager.setLastNotMinimizedBoxesStatus(i,!0),this.context.callbacks.emit("onLastNotMinimizedBoxesStatusChange",i),this.context.emitter.emit("lastNotMinimizedBoxesStatusChange",i)}setupBoxManager(t){const i=Q.wrapper?Q.wrapper:document.body,n=i.getBoundingClientRect(),r={root:i,containerRect:{x:0,y:0,width:n.width,height:n.height},fence:!1,prefersColorScheme:t==null?void 0:t.prefersColorScheme,useBoxesStatus:(t==null?void 0:t.useBoxesStatus)||!1},s=Tt(fr,Q.extendClass),o=new s(r);this.teleBoxManager&&this.teleBoxManager.destroy(),this.teleBoxManager=o;const a=(t==null?void 0:t.collectorContainer)||Q.wrapper;return a&&this.setCollectorContainer(a),o}setCollectorContainer(t){var r;const i=Tt(un,Q.extendClass),n=new i({styles:(r=this.createTeleBoxManagerConfig)==null?void 0:r.collectorStyles}).mount(t);this.teleBoxManager.setCollector(n)}getBox(t){return this.teleBoxManager.queryOne({id:t})}closeBox(t,i=!1){return this.teleBoxManager.remove(t,i)}boxIsFocus(t){const i=this.getBox(t);return i==null?void 0:i.focus}getFocusBox(){return this.teleBoxManager.query({focus:!0})[0]}getTopBox(){return this.teleBoxManager.topBox}updateBoxState(t){if(!t)return;const i=this.getBox(t.id);i&&(this.teleBoxManager.update(i.id,{x:t.x,y:t.y,width:t.width||.5,height:t.height||.5,zIndex:t.zIndex,boxStatus:t.boxStatus,lastNotMinimizedBoxStatus:t.lastNotMinimizedBoxStatus,forceTop:t.forceTop,forceNormal:t.forceNormal,isDragContent:t.isDragContent},!0),setTimeout(()=>{t.focus&&this.teleBoxManager.focusBox(i.id,!0),t.maximized!=null&&this.teleBoxManager.setMaximized(Boolean(t.maximized),!0),t.minimized!=null&&this.teleBoxManager.setMinimized(Boolean(t.minimized),!0)},50),t.boxStatus||this.context.callbacks.emit("boxStateChange",this.teleBoxManager.state))}updateManagerRect(){var i;const t=(i=this.mainView.divElement)==null?void 0:i.getBoundingClientRect();if(t&&t.width>0&&t.height>0){const n={x:0,y:0,width:t.width,height:t.height};this.teleBoxManager.setContainerRect(n),this.context.notifyContainerRectUpdate(this.teleBoxManager.containerRect)}}moveBox({appId:t,x:i,y:n}){this.teleBoxManager.update(t,{x:i,y:n},!0)}focusBox({appId:t},i=!0){this.teleBoxManager.focusBox(t,i)}resizeBox({appId:t,width:i,height:n,skipUpdate:r}){this.teleBoxManager.update(t,{width:i,height:n},r)}setBoxMinSize(t){this.teleBoxManager.update(t.appId,{minWidth:t.minWidth,minHeight:t.minHeight},!0)}setBoxTitle(t){this.teleBoxManager.update(t.appId,{title:t.title},!0)}blurAllBox(){this.teleBoxManager.blurAll()}updateAll(t){this.teleBoxManager.updateAll(t)}setMaximized(t,i=!0){t!==this.maximized&&this.teleBoxManager.setMaximized(t,i)}setMinimized(t,i=!0){this.teleBoxManager.setMinimized(t,i)}focusTopBox(){if(this.teleBoxManager.query().length>=1){const i=this.getTopBox();i&&this.focusBox({appId:i.id},!1)}}updateBox(t,i,n=!0){this.teleBoxManager.update(t,i,n)}setReadonly(t){this.teleBoxManager.setReadonly(t)}setPrefersColorScheme(t){this.teleBoxManager.setPrefersColorScheme(t)}setZIndex(t,i,n=!0){this.teleBoxManager.update(t,{zIndex:i},n)}destroy(){this.teleBoxManager.destroy()}}pr.kind="BoxManager";const et=(...e)=>{Q.debug&&console.log("[WindowManager]:",...e)},Iv=e=>{const t=document.createElement("div");t.className="netless-window-manager-playground";const i=document.createElement("div");i.className="netless-window-manager-sizer";const n=document.createElement("div");n.className="netless-window-manager-wrapper";const r=document.createElement("div");return r.className="netless-window-manager-main-view",t.appendChild(i),i.appendChild(n),n.appendChild(r),e.appendChild(t),Q.wrapper=n,{playground:t,wrapper:n,sizer:i,mainViewElement:r}},Cv=()=>{if(Uu(b.WhiteVersion)<Uu(_u))throw new Wh(_u)},aa=(e,t)=>{var s;const i=(e==null?void 0:e.state.roomMembers)||[];let n=-1,r;for(const o of i)((s=o.payload)==null?void 0:s.uid)===t&&n<o.memberId&&(n=o.memberId,r=o);return r},bv=async e=>{let t=e.getInvisiblePlugin(Q.kind);if(t)return t;let i;const n=new Promise(u=>{Q._resolve=i=u});let r=!1;const s=Av(e);!e.isWritable&&s&&(r=!0,await jh.default(async u=>{et(`switching to writable (x${u})`),await e.setWritable(!0)},{retries:10,maxTimeout:5e3})),e.isWritable?(et("creating InvisiblePlugin..."),e.createInvisiblePlugin(Q,{}).catch(console.warn)):(s&&console.warn("[WindowManager]: failed to switch to writable"),console.warn("[WindowManager]: waiting for others to create the plugin..."));const o=setTimeout(()=>{console.warn("[WindowManager]: no one called createInvisiblePlugin() after 20 seconds")},2e4),a=setTimeout(()=>{throw new Error("[WindowManager]: no one called createInvisiblePlugin() after 60 seconds")},6e4),l=setInterval(()=>{t=e.getInvisiblePlugin(Q.kind),t&&(clearTimeout(a),clearTimeout(o),clearInterval(l),i(t),r&&e.isWritable&&setTimeout(()=>e.setWritable(!1).catch(console.warn),500))},200);return n},Av=e=>{try{const t=atob(e.roomToken.slice(12)),i=t.indexOf("&role=");return+t[i+6]<2}catch(t){return console.error(t),!1}};function Jn(){}function vd(e){return e()}function ec(){return Object.create(null)}function Ks(e){e.forEach(vd)}function wd(e){return typeof e=="function"}function Tv(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}let jr;function xs(e,t){return jr||(jr=document.createElement("a")),jr.href=t,e===jr.href}function Ev(e){return Object.keys(e).length===0}function Mt(e,t){e.appendChild(t)}function qs(e,t,i){e.insertBefore(t,i||null)}function gr(e){e.parentNode&&e.parentNode.removeChild(e)}function Vt(e){return document.createElement(e)}function xl(e){return document.createTextNode(e)}function la(){return xl(" ")}function le(e,t,i){i==null?e.removeAttribute(t):e.getAttribute(t)!==i&&e.setAttribute(t,i)}function Nv(e){return Array.from(e.childNodes)}function yd(e,t){t=""+t,e.data!==t&&(e.data=t)}function ye(e,t,i,n){i==null?e.style.removeProperty(t):e.style.setProperty(t,i,n?"important":"")}let Sl;function Vn(e){Sl=e}const Li=[],tc=[];let Fi=[];const ic=[],kv=Promise.resolve();let ua=!1;function Pv(){ua||(ua=!0,kv.then(xd))}function ca(e){Fi.push(e)}const ko=new Set;let Bi=0;function xd(){if(Bi!==0)return;const e=Sl;do{try{for(;Bi<Li.length;){const t=Li[Bi];Bi++,Vn(t),Bv(t.$$)}}catch(t){throw Li.length=0,Bi=0,t}for(Vn(null),Li.length=0,Bi=0;tc.length;)tc.pop()();for(let t=0;t<Fi.length;t+=1){const i=Fi[t];ko.has(i)||(ko.add(i),i())}Fi.length=0}while(Li.length);for(;ic.length;)ic.pop()();ua=!1,ko.clear(),Vn(e)}function Bv(e){if(e.fragment!==null){e.update(),Ks(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(ca)}}function zv(e){const t=[],i=[];Fi.forEach(n=>e.indexOf(n)===-1?t.push(n):i.push(n)),i.forEach(n=>n()),Fi=t}const Dv=new Set;function Lv(e,t){e&&e.i&&(Dv.delete(e),e.i(t))}function Rv(e,t,i,n){const{fragment:r,after_update:s}=e.$$;r&&r.m(t,i),n||ca(()=>{const o=e.$$.on_mount.map(vd).filter(wd);e.$$.on_destroy?e.$$.on_destroy.push(...o):Ks(o),e.$$.on_mount=[]}),s.forEach(ca)}function jv(e,t){const i=e.$$;i.fragment!==null&&(zv(i.after_update),Ks(i.on_destroy),i.fragment&&i.fragment.d(t),i.on_destroy=i.fragment=null,i.ctx=[])}function _v(e,t){e.$$.dirty[0]===-1&&(Li.push(e),Pv(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function Vv(e,t,i,n,r,s,o,a=[-1]){const l=Sl;Vn(e);const u=e.$$={fragment:null,ctx:[],props:s,update:Jn,not_equal:r,bound:ec(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(l?l.$$.context:[])),callbacks:ec(),dirty:a,skip_bound:!1,root:t.target||l.$$.root};o&&o(u.root);let h=!1;if(u.ctx=i?i(e,t.props||{},(c,m,...v)=>{const w=v.length?v[0]:m;return u.ctx&&r(u.ctx[c],u.ctx[c]=w)&&(!u.skip_bound&&u.bound[c]&&u.bound[c](w),h&&_v(e,c)),m}):[],u.update(),h=!0,Ks(u.before_update),u.fragment=n?n(u.ctx):!1,t.target){if(t.hydrate){const c=Nv(t.target);u.fragment&&u.fragment.l(c),c.forEach(gr)}else u.fragment&&u.fragment.c();t.intro&&Lv(e.$$.fragment),Rv(e,t.target,t.anchor,t.customElement),xd()}Vn(l)}class Ov{$destroy(){jv(this,1),this.$destroy=Jn}$on(t,i){if(!wd(i))return Jn;const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(i),()=>{const r=n.indexOf(i);r!==-1&&n.splice(r,1)}}$set(t){this.$$set&&!Ev(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}function nc(e){let t,i,n,r,s,o,a,l=e[18]&&rc(e),u=e[19]&&sc(e);return{c(){t=Vt("div"),i=Vt("div"),l&&l.c(),n=la(),r=Vt("span"),s=xl(e[1]),o=la(),u&&u.c(),ye(r,"overflow","hidden"),ye(r,"white-space","nowrap"),ye(r,"text-overflow","ellipsis"),ye(r,"max-width","80px"),le(i,"class",e[9]),ye(i,"background-color",e[3]),ye(i,"color",e[10]),ye(i,"opacity",e[12]),le(t,"class",a="netless-window-manager-cursor-name "+e[16]+" "+e[15])},m(h,c){qs(h,t,c),Mt(t,i),l&&l.m(i,null),Mt(i,n),Mt(i,r),Mt(r,s),Mt(i,o),u&&u.m(i,null)},p(h,c){h[18]?l?l.p(h,c):(l=rc(h),l.c(),l.m(i,n)):l&&(l.d(1),l=null),c&2&&yd(s,h[1]),h[19]?u?u.p(h,c):(u=sc(h),u.c(),u.m(i,null)):u&&(u.d(1),u=null),c&512&&le(i,"class",h[9]),c&8&&ye(i,"background-color",h[3]),c&1024&&ye(i,"color",h[10]),c&4096&&ye(i,"opacity",h[12]),c&98304&&a!==(a="netless-window-manager-cursor-name "+h[16]+" "+h[15])&&le(t,"class",a)},d(h){h&&gr(t),l&&l.d(),u&&u.d()}}}function rc(e){let t,i;return{c(){t=Vt("img"),le(t,"class","netless-window-manager-cursor-selector-avatar"),le(t,"style",e[20]()),xs(t.src,i=e[8])||le(t,"src",i),le(t,"alt","avatar")},m(n,r){qs(n,t,r)},p(n,r){r&256&&!xs(t.src,i=n[8])&&le(t,"src",i)},d(n){n&&gr(t)}}}function sc(e){let t,i;return{c(){t=Vt("span"),i=xl(e[2]),le(t,"class","netless-window-manager-cursor-tag-name"),ye(t,"background-color",e[11])},m(n,r){qs(n,t,r),Mt(t,i)},p(n,r){r&4&&yd(i,n[2]),r&2048&&ye(t,"background-color",n[11])},d(n){n&&gr(t)}}}function Uv(e){let t,i,n,r,s,o,a,l=!e[14]&&nc(e);return{c(){t=Vt("div"),l&&l.c(),i=la(),n=Vt("div"),r=Vt("img"),le(r,"class",s="netless-window-manager-cursor-"+e[4]+"-image "+e[15]),xs(r.src,o=e[7])||le(r,"src",o),le(r,"alt",e[4]),le(n,"class","cursor-image-wrapper"),le(t,"class",a="netless-window-manager-cursor-mid"+(e[13]?" netless-window-manager-cursor-custom":"")),ye(t,"transform","translateX("+e[5]+"px) translateY("+e[6]+"px)"),ye(t,"display",e[17]),le(t,"data-cursor-uid",e[0])},m(u,h){qs(u,t,h),l&&l.m(t,null),Mt(t,i),Mt(t,n),Mt(n,r)},p(u,[h]){u[14]?l&&(l.d(1),l=null):l?l.p(u,h):(l=nc(u),l.c(),l.m(t,i)),h&32784&&s!==(s="netless-window-manager-cursor-"+u[4]+"-image "+u[15])&&le(r,"class",s),h&128&&!xs(r.src,o=u[7])&&le(r,"src",o),h&16&&le(r,"alt",u[4]),h&8192&&a!==(a="netless-window-manager-cursor-mid"+(u[13]?" netless-window-manager-cursor-custom":""))&&le(t,"class",a),h&96&&ye(t,"transform","translateX("+u[5]+"px) translateY("+u[6]+"px)"),h&131072&&ye(t,"display",u[17]),h&1&&le(t,"data-cursor-uid",u[0])},i:Jn,o:Jn,d(u){u&&gr(t),l&&l.d()}}}function $v(e,t,i){let n,r,s,o,a,l,u,h,{uid:c}=t,{cursorName:m}=t,{tagName:v}=t,{backgroundColor:w}=t,{appliance:x}=t,{x:d}=t,{y:f}=t,{src:g}=t,{visible:p}=t,{avatar:y}=t,{theme:S}=t,{color:T}=t,{cursorTagBackgroundColor:k}=t,{opacity:B}=t,{pencilEraserSize:z}=t,{custom:ee}=t;const C=()=>Object.entries({width:(n?19:28)+"px",height:(n?19:28)+"px",position:n?"initial":"absolute","border-color":n?"white":w,"margin-right":(n?4:0)+"px"}).map(([M,_])=>`${M}: ${_}`).join(";");return e.$$set=M=>{"uid"in M&&i(0,c=M.uid),"cursorName"in M&&i(1,m=M.cursorName),"tagName"in M&&i(2,v=M.tagName),"backgroundColor"in M&&i(3,w=M.backgroundColor),"appliance"in M&&i(4,x=M.appliance),"x"in M&&i(5,d=M.x),"y"in M&&i(6,f=M.y),"src"in M&&i(7,g=M.src),"visible"in M&&i(21,p=M.visible),"avatar"in M&&i(8,y=M.avatar),"theme"in M&&i(9,S=M.theme),"color"in M&&i(10,T=M.color),"cursorTagBackgroundColor"in M&&i(11,k=M.cursorTagBackgroundColor),"opacity"in M&&i(12,B=M.opacity),"pencilEraserSize"in M&&i(22,z=M.pencilEraserSize),"custom"in M&&i(13,ee=M.custom)},e.$$.update=()=>{e.$$.dirty&2&&(n=!E.isEmpty(m)),e.$$.dirty&4&&i(19,r=!E.isEmpty(v)),e.$$.dirty&256&&i(18,s=!E.isEmpty(y)),e.$$.dirty&2097152&&i(17,o=p?"":"none"),e.$$.dirty&16&&i(14,a=x===b.ApplianceNames.laserPointer),e.$$.dirty&16400&&i(23,l=a||x===b.ApplianceNames.pencilEraser),e.$$.dirty&8388608&&i(16,u=l?"netless-window-manager-laserPointer-pencilEraser-offset":""),e.$$.dirty&4194304&&i(15,h=z===3?"netless-window-manager-pencilEraser-3-offset":"")},[c,m,v,w,x,d,f,g,y,S,T,k,B,ee,a,h,u,o,s,r,C,p,z,l]}class Wv extends Ov{constructor(t){super(),Vv(this,t,$v,Uv,Tv,{uid:0,cursorName:1,tagName:2,backgroundColor:3,appliance:4,x:5,y:6,src:7,visible:21,avatar:8,theme:9,color:10,cursorTagBackgroundColor:11,opacity:12,pencilEraserSize:22,custom:13})}}const Sd="data:image/svg+xml,%3Csvg width='24' height='24' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Ccircle cx='12' cy='12' r='2.5' stroke='%23000' stroke-linejoin='square'/%3E%3Ccircle cx='12' cy='12' r='3.5' stroke='%23FFF'/%3E%3C/g%3E%3C/svg%3E";function Md(e){return`data:image/svg+xml,%3Csvg width='24' height='24' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Ccircle cx='12' cy='12' r='2.5' stroke='%23${e}' stroke-linejoin='square'/%3E%3Ccircle cx='12' cy='12' r='3.5' stroke='%23${e}'/%3E%3C/g%3E%3C/svg%3E`}function Ri(e){return`data:image/svg+xml,%3Csvg width='24' height='24' xmlns='http://www.w3.org/2000/svg' fill='none'%3E%3Cpath d='M5 12H19' stroke='%23${e}' stroke-linejoin='round'/%3E%3Cpath d='M12 5V19' stroke='%23${e}' stroke-linejoin='round'/%3E%3C/svg%3E`}function ri(e){return`url("${e}") 12 12, auto`}function Hv(e){let t="";for(const i in e)t+=`.netless-whiteboard.${i} {cursor: ${e[i]}}
16
- `;return t}const _r=document.createElement("style");function Fv(e){const[t,i,n]=e.strokeColor,r=((1<<24)+(t<<16)+(i<<8)+n).toString(16).slice(1);return _r.textContent=Hv({"cursor-pencil":ri(Md(r)),"cursor-eraser":ri(Sd),"cursor-rectangle":ri(Ri(r)),"cursor-ellipse":ri(Ri(r)),"cursor-straight":ri(Ri(r)),"cursor-arrow":ri(Ri(r)),"cursor-shape":ri(Ri(r))}),document.head.appendChild(_r),()=>{_r.parentNode!=null&&document.head.removeChild(_r)}}const Qv=new Set([b.ApplianceNames.rectangle,b.ApplianceNames.ellipse,b.ApplianceNames.straight,b.ApplianceNames.arrow,b.ApplianceNames.shape]);function oc(e,t){if(e===b.ApplianceNames.pencil)return Md(t);if(e===b.ApplianceNames.eraser)return Sd;if(Qv.has(e))return Ri(t)}class Zv{constructor(t,i,n,r){this.manager=t,this.memberId=i,this.cursorManager=n,this.wrapper=r,this.style="default",this.move=s=>{var o;if(s.type==="main"){const a=this.cursorManager.wrapperRect;this.component&&a&&(this.autoHidden(),this.moveCursor(s,a,this.manager.mainView))}else{const a=this.cursorManager.focusView,l=(o=a==null?void 0:a.divElement)==null?void 0:o.getBoundingClientRect(),u=a==null?void 0:a.camera;a&&l&&u&&this.component&&(this.autoHidden(),this.moveCursor(s,l,a))}},this.setStyle=s=>{this.style=s,this.component&&this.component.$set({src:this.getIcon(),custom:this.isCustomIcon()})},this.leave=()=>{this.hide()},this.updateMember(),this.createCursor(),this.autoHidden(),this.setStyle(n.style)}moveCursor(t,i,n){var l,u;const{x:r,y:s,type:o}=t,a=n==null?void 0:n.screen.convertPointToScreen(r,s);if(a){let h=a.x-2,c=a.y-18;if(this.isCustomIcon()&&(h-=11,c+=4),o==="app"){const m=this.cursorManager.wrapperRect;m&&(h=h+i.x-m.x,c=c+i.y-m.y)}a.x<0||a.x>i.width||a.y<0||a.y>i.height?(l=this.component)==null||l.$set({visible:!1,x:h,y:c}):(u=this.component)==null||u.$set({visible:!0,x:h,y:c})}}get memberApplianceName(){var t,i;return(i=(t=this.member)==null?void 0:t.memberState)==null?void 0:i.currentApplianceName}get memberColor(){var i,n;return`rgb(${(n=(i=this.member)==null?void 0:i.memberState)==null?void 0:n.strokeColor.join(",")})`}get memberColorHex(){var r,s;const[t,i,n]=((s=(r=this.member)==null?void 0:r.memberState)==null?void 0:s.strokeColor)||[236,52,85];return((1<<24)+(t<<16)+(i<<8)+n).toString(16).slice(1)}get payload(){var t;return(t=this.member)==null?void 0:t.payload}get memberCursorName(){var t,i;return((t=this.payload)==null?void 0:t.nickName)||((i=this.payload)==null?void 0:i.cursorName)||this.memberId}get memberTheme(){var t;return(t=this.payload)!=null&&t.theme?"netless-window-manager-cursor-inner-mellow":"netless-window-manager-cursor-inner"}get memberCursorTextColor(){var t;return((t=this.payload)==null?void 0:t.cursorTextColor)||"#FFFFFF"}get memberCursorTagBackgroundColor(){var t;return((t=this.payload)==null?void 0:t.cursorTagBackgroundColor)||this.memberColor}get memberAvatar(){var t;return(t=this.payload)==null?void 0:t.avatar}get memberOpacity(){return!this.memberCursorName&&!this.memberAvatar?0:1}get memberTagName(){var t;return(t=this.payload)==null?void 0:t.cursorTagName}autoHidden(){this.timer&&clearTimeout(this.timer),this.timer=window.setTimeout(()=>{this.hide()},1e3*10)}async createCursor(){this.member&&this.wrapper&&(this.component=new Wv({target:this.wrapper,props:this.initProps()}))}initProps(){var t;return{uid:this.memberId,x:0,y:0,appliance:this.memberApplianceName,avatar:this.memberAvatar,src:this.getIcon(),custom:this.isCustomIcon(),visible:!1,backgroundColor:this.memberColor,cursorName:this.memberCursorName,theme:this.memberTheme,color:this.memberCursorTextColor,cursorTagBackgroundColor:this.memberCursorTagBackgroundColor,opacity:this.memberOpacity,tagName:this.memberTagName,pencilEraserSize:(t=this.member)==null?void 0:t.memberState.pencilEraserSize}}getIcon(){var l;if(!this.member)return;const{memberApplianceName:t,memberColorHex:i}=this,{userApplianceIcons:n,applianceIcons:r}=this.cursorManager;let s=this.memberApplianceName;s===b.ApplianceNames.pencilEraser&&(s=`${s}${((l=this.member)==null?void 0:l.memberState.pencilEraserSize)||1}`);const o=s&&n[s];if(o)return o;if(this.style==="custom"&&t){const u=oc(t,i);if(u)return u}return r[s||b.ApplianceNames.shape]||r[b.ApplianceNames.shape]}isCustomIcon(){var o;if(!this.member)return!1;const{memberApplianceName:t,memberColorHex:i}=this,{userApplianceIcons:n}=this.cursorManager;let r=this.memberApplianceName;return r===b.ApplianceNames.pencilEraser&&(r=`${r}${((o=this.member)==null?void 0:o.memberState.pencilEraserSize)||1}`),r&&n[r]?!1:!!(this.style==="custom"&&t&&oc(t,i))}updateMember(){return this.member=aa(this.manager.room,this.memberId),this.updateComponent(),this.member}updateComponent(){var t;(t=this.component)==null||t.$set(E.omit(this.initProps(),["x","y"]))}destroy(){this.component&&this.component.$destroy(),this.cursorManager.cursorInstances.delete(this.memberId),this.timer&&clearTimeout(this.timer)}hide(){this.component&&(this.component.$set({visible:!1}),this.destroy())}}var Yv="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAYAAADFeBvrAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAYISURBVHgB7ZpNSCtXFIBPEuvz+dMGpYUKD/sWFX+Qti6kK7Hqpm6e9q0rIoIUFUShPLV10VZx4+JZqa9v20LBhdq9fyBUCtKNPH8qYl2IOw3G38Rkek4y15y5uTOZJDOWggcOSSYzN/ebc+45554JwIM8iBCPyTEP+86T4vyMfsRN4b+nQTKIJp0vzuGvlpID7os8EQNEIBD4oKio6Bm9DwaDv/v9/n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plianceNames.eraser]:Xv,[b.ApplianceNames.shape]:Jv,[b.ApplianceNames.text]:Kv,[b.ApplianceNames.laserPointer]:qv,pencilEraser1:ew,pencilEraser2:tw,pencilEraser3:iw},ac="local-cursor";class mr{constructor(t,i,n,r){var a;this.manager=t,this.enableCursor=i,this.cursorInstances=new Map,this.userApplianceIcons={},this.sideEffectManager=new cr,this.store=this.manager.store,this.leaveFlag=!0,this._style="default",this.onCursorMove=l=>{const u=this.initCursorInstance(l.uid);if(l.state===Ko.Leave)u.leave();else{const h=u.updateMember();this.canMoveCursor(h)&&u.move(l.position)}},this.initCursorInstance=l=>{let u=this.cursorInstances.get(l);return u||(u=new Zv(this.manager,l,this,Q.wrapper),this.cursorInstances.set(l,u)),u},this.mouseMoveListener_=(l,u)=>{const h=this.getType(l);this.updateCursor(h,l.clientX,l.clientY),u&&this.showPencilEraserIfNeeded(h,l.clientX,l.clientY)},this.mouseMoveTimer=0,this.mouseMoveListener=l=>{const u=l.pointerType==="touch";if(u&&!l.isPrimary)return;const h=Date.now();if(h-this.mouseMoveTimer>48){if(this.mouseMoveTimer=h,Q.supportAppliancePlugin&&b.isRoom(Q.displayer)&&Q.displayer.disableDeviceInputs){this.leaveFlag&&(this.manager.dispatchInternalEvent(se.CursorMove,{uid:this.manager.uid,state:Ko.Leave}),this.leaveFlag=!1);return}this.mouseMoveListener_(l,u),this.leaveFlag=!0}},this.mouseLeaveListener=()=>{this.hideCursor(this.manager.uid)},this.getPoint=(l,u,h)=>{var m;const c=(m=l==null?void 0:l.divElement)==null?void 0:m.getBoundingClientRect();if(c)return l==null?void 0:l.convertToPointInWorld({x:u-c.x,y:h-c.y})},this.getType=l=>{var c;const u=l.target,h=this.manager.focusApp;switch(u.parentElement){case this.mainViewElement:return{type:"main"};case((c=h==null?void 0:h.view)==null?void 0:c.divElement):return{type:"app"};default:return{type:"main"}}},this.roomMembers=(a=this.manager.room)==null?void 0:a.state.roomMembers;const s=Q.wrapper;s&&this.setupWrapper(s),this.sideEffectManager.add(()=>V.on("cursorMove",this.onCursorMove)),this.sideEffectManager.add(()=>V.on("playgroundSizeChange",()=>this.updateContainerRect()));const o=this.manager.room;o&&this.sideEffectManager.add(()=>{const l=u=>{this.style==="custom"&&u.memberState&&this.enableCustomCursor()};return o.callbacks.on("onRoomStateChanged",l),()=>o.callbacks.off("onRoomStateChanged",l)}),r&&(this.userApplianceIcons=r),this.style=(n==null?void 0:n.style)||"default"}get applianceIcons(){return{...nw,...this.userApplianceIcons}}get style(){return this._style}set style(t){this._style!==t&&(this._style=t,this.cursorInstances.forEach(i=>{i.setStyle(t)}),t==="custom"?this.enableCustomCursor():this.sideEffectManager.flush(ac))}enableCustomCursor(){this.sideEffectManager.add(()=>Fv(this.manager.getMemberState()),ac)}canMoveCursor(t){const i=(t==null?void 0:t.memberState.currentApplianceName)===b.ApplianceNames.laserPointer;return this.enableCursor||i}setupWrapper(t){this.sideEffectManager.add(()=>(t.addEventListener("pointerenter",this.mouseMoveListener),t.addEventListener("pointermove",this.mouseMoveListener),t.addEventListener("pointerleave",this.mouseLeaveListener),()=>{t.removeEventListener("pointerenter",this.mouseMoveListener),t.removeEventListener("pointermove",this.mouseMoveListener),t.removeEventListener("pointerleave",this.mouseLeaveListener)})),this.wrapperRect=t.getBoundingClientRect()}setMainViewDivElement(t){this.mainViewElement=t}get boxState(){return this.store.getBoxState()}get focusView(){var t;return(t=this.manager.focusApp)==null?void 0:t.view}showPencilEraserIfNeeded(t,i,n){const r=aa(this.manager.room,this.manager.uid),s=(r==null?void 0:r.memberState.currentApplianceName)===b.ApplianceNames.pencilEraser;if(this.wrapperRect&&this.manager.canOperate&&this.canMoveCursor(r)&&s){const o=t.type==="main"?this.manager.mainView:this.focusView,a=this.getPoint(o,i,n);a&&this.onCursorMove({uid:this.manager.uid,position:{x:a.x,y:a.y,type:t.type}})}}updateCursor(t,i,n){const r=aa(this.manager.room,this.manager.uid);if(this.wrapperRect&&this.manager.canOperate&&this.canMoveCursor(r)){const s=t.type==="main"?this.manager.mainView:this.focusView,o=this.getPoint(s,i,n);o&&this.manager.dispatchInternalEvent(se.CursorMove,{uid:this.manager.uid,position:{x:o.x,y:o.y,type:t.type}})}}updateContainerRect(){var t,i;this.containerRect=(t=Q.container)==null?void 0:t.getBoundingClientRect(),this.wrapperRect=(i=Q.wrapper)==null?void 0:i.getBoundingClientRect()}deleteCursor(t){this.store.cleanCursor(t);const i=this.cursorInstances.get(t);i&&i.destroy()}hideCursor(t){const i=this.cursorInstances.get(t);i&&i.hide()}destroy(){this.sideEffectManager.flushAll(),this.cursorInstances.size&&(this.cursorInstances.forEach(t=>{t.destroy()}),this.cursorInstances.clear())}}mr.kind="CursorManager";function Tt(e,t){if(e.kind&&t&&Object.keys(t).includes(e.kind))switch(e.kind){case"AppManager":return(t==null?void 0:t.AppManager)||yr;case"BoxManager":return(t==null?void 0:t.BoxManager)||pr;case"AttributesDelegate":return(t==null?void 0:t.AttributesDelegate)||vr;case"CursorManager":return(t==null?void 0:t.CursorManager)||mr;case"AppProxy":return(t==null?void 0:t.AppProxy)||wr;case"AppContext":return(t==null?void 0:t.AppContext)||hr;case"TeleBoxManager":return(t==null?void 0:t.TeleBoxManager)||fr;case"TeleBoxCollector":return(t==null?void 0:t.TeleBoxCollector)||un;default:return e}return e}var xe=(e=>(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.BoxesStatus="boxesStatus",e.LastNotMinimizedBoxesStatus="lastNotMinimizedBoxesStatus",e))(xe||{});class vr{constructor(t){this.context=t,this.setAppFocus=(i,n)=>{n?this.context.safeSetAttributes({focus:i}):this.context.safeSetAttributes({focus:void 0})}}setContext(t){this.context=t}get attributes(){return this.context.getAttributes()}apps(){return E.get(this.attributes,["apps"])}get focus(){return E.get(this.attributes,["focus"])}getAppAttributes(t){return E.get(this.apps(),[t])}getAppState(t){return E.get(this.apps(),[t,"state"])}getMaximized(){return E.get(this.attributes,["maximized"])}getMinimized(){return E.get(this.attributes,["minimized"])}getBoxesStatus(){return E.get(this.attributes,["boxesStatus"])}getBoxStatus(t){return E.get(this.attributes,["boxesStatus",t])}setBoxStatus(t,i){this.attributes.boxesStatus||this.context.safeSetAttributes({boxesStatus:{}}),this.getBoxStatus(t)!==i&&this.context.safeUpdateAttributes(["boxesStatus",t],i)}getLastNotMinimizedBoxesStatus(){return E.get(this.attributes,["lastNotMinimizedBoxesStatus"])}getLastNotMinimizedBoxStatus(t){return E.get(this.attributes,["lastNotMinimizedBoxesStatus",t])}setLastNotMinimizedBoxStatus(t,i){this.attributes.lastNotMinimizedBoxesStatus||this.context.safeSetAttributes({lastNotMinimizedBoxesStatus:{}}),this.getLastNotMinimizedBoxStatus(t)!==i&&this.context.safeUpdateAttributes(["lastNotMinimizedBoxesStatus",t],i)}setupAppAttributes(t,i,n){this.attributes.apps||this.context.safeSetAttributes({apps:{}});const s=["scenePath","title"];n||s.push("scenes");const o=E.pick(t.options,s),a={kind:t.kind,options:o,isDynamicPPT:n,forceTop:t.forceTop,forceNormal:t.forceNormal,isDragContent:t.isDragContent};typeof t.src=="string"&&(a.src=t.src),a.createdAt=Date.now(),this.context.safeUpdateAttributes(["apps",i],a),this.context.safeUpdateAttributes(["apps",i,"state"],{[Be.Size]:{},[Be.Position]:{},[Be.SceneIndex]:0})}updateAppState(t,i,n){E.get(this.attributes,["apps",t,"state"])&&this.context.safeUpdateAttributes(["apps",t,"state",i],n)}cleanAppAttributes(t){this.context.safeUpdateAttributes(["apps",t],void 0),this.context.safeSetAttributes({[t]:void 0}),this.attributes.focus===t&&this.cleanFocus()}cleanFocus(){this.context.safeSetAttributes({focus:void 0})}getAppSceneIndex(t){var i;return(i=this.getAppState(t))==null?void 0:i[Be.SceneIndex]}getAppScenePath(t){var i,n;return(n=(i=this.getAppAttributes(t))==null?void 0:i.options)==null?void 0:n.scenePath}getMainViewScenePath(){return this.attributes._mainScenePath}getMainViewSceneIndex(){return this.attributes._mainSceneIndex}getBoxState(){return this.attributes.boxState}setMainViewScenePath(t){this.context.safeSetAttributes({_mainScenePath:t})}setMainViewSceneIndex(t){this.context.safeSetAttributes({_mainSceneIndex:t})}getMainViewCamera(){return E.get(this.attributes,["mainViewCamera"])}getMainViewSize(){return E.get(this.attributes,["mainViewSize"])}setMainViewCamera(t){this.context.safeSetAttributes({mainViewCamera:{...t}})}setMainViewSize(t){t.width===0||t.height===0||this.context.safeSetAttributes({mainViewSize:{...t}})}setMainViewCameraAndSize(t,i){i.width===0||i.height===0||this.context.safeSetAttributes({mainViewCamera:{...t},mainViewSize:{...i}})}updateCursor(t,i){E.get(this.attributes,["cursors"])||this.context.safeUpdateAttributes(["cursors"],{}),E.get(this.attributes,["cursors",t])||this.context.safeUpdateAttributes(["cursors",t],{}),this.context.safeUpdateAttributes(["cursors",t,"position"],i)}updateCursorState(t,i){E.get(this.attributes,["cursors",t])||this.context.safeUpdateAttributes(["cursors",t],{}),this.context.safeUpdateAttributes(["cursors",t,"cursorState"],i)}getCursorState(t){return E.get(this.attributes,["cursors",t,"cursorState"])}cleanCursor(t){this.context.safeUpdateAttributes(["cursors",t],void 0)}setMainViewFocusPath(t){const i=this.getMainViewScenePath();i&&yi(t,i)}getIframeBridge(){return E.get(this.attributes,["iframeBridge"])}setIframeBridge(t){if(E.isObject(t)){const i=this.getIframeBridge();for(const n in t){const r=t[n];i[n]!==r&&this.context.safeUpdateAttributes(["iframeBridge",n],r)}}}}vr.kind="AttributesDelegate";const rw=(e,t={getAttributes:()=>{throw new Error("getAttributes not implemented")},safeSetAttributes:()=>{throw new Error("safeSetAttributes not implemented")},safeUpdateAttributes:()=>{throw new Error("safeUpdateAttributes not implemented")}})=>{const i=Tt(vr,e);return new i(t)},Ml=(e,t)=>{let i=0;const n=t.length-1;return e===t.index?e===n?i=e-1:i=t.index+1:i=t.index,i},lt=new bi.default,Id=class{constructor(e,t,i,n){var r;this.params=e,this.manager=t,this.boxManager=this.manager.boxManager,this.appProxies=this.manager.appProxies,this.viewManager=this.manager.viewManager,this.store=this.manager.store,this.status="normal",this.getAppInitState=s=>{var y,S,T,k;const o=this.store.getAppState(s);if(!o)return;const a=o==null?void 0:o[Be.Position],l=this.store.focus,u=o==null?void 0:o[Be.Size],h=o==null?void 0:o[Be.SceneIndex],c=(y=this.attributes)==null?void 0:y.maximized,m=(S=this.attributes)==null?void 0:S.minimized,v=(T=this.store.getBoxStatus(s))!=null?T:void 0,w=(k=this.store.getLastNotMinimizedBoxStatus(s))!=null?k:void 0,{forceTop:x,forceNormal:d,isDragContent:f}=this.store.getAppAttributes(s),g=o==null?void 0:o.zIndex;let p={maximized:c,minimized:m,zIndex:g};return a&&(p={...p,id:s,x:a.x,y:a.y}),l===s&&(p={...p,focus:!0}),u&&(p={...p,width:u.width,height:u.height}),h&&(p={...p,sceneIndex:h}),v&&(p={...p,boxStatus:v}),w&&(p={...p,lastNotMinimizedBoxStatus:w}),x&&(p={...p,forceTop:x}),d&&(p={...p,forceNormal:d}),f&&(p={...p,isDragContent:f}),p},this.appAttributesUpdateListener=s=>{this.manager.refresher.add(s,()=>b.autorun(()=>{const o=this.manager.attributes[s];o&&this.appEmitter.emit("attributesUpdate",o)})),this.manager.refresher.add(this.stateKey,()=>b.autorun(()=>{var a,l,u,h;const o=(a=this.appAttributes)==null?void 0:a.state;(o==null?void 0:o.zIndex)>0&&o.zIndex!==((l=this.box)==null?void 0:l.zIndex)&&((u=this.boxManager)==null||u.setZIndex(s,o.zIndex),(h=this.boxManager)==null||h.focusBox({appId:s}))})),this.manager.refresher.add(`${s}-fullPath`,()=>b.autorun(()=>{var a;const o=(a=this.appAttributes)==null?void 0:a.fullPath;this.setFocusScenePathHandler(o),this._prevFullPath!==o&&(this.notifyPageStateChange(),this._prevFullPath=o)}))},this.setFocusScenePathHandler=E.debounce(s=>{var o;this.view&&s&&s!==((o=this.view)==null?void 0:o.focusScenePath)&&(yi(this.view,s),G.emit("onAppScenePathChange",{appId:this.id,view:this.view}))},50),this.notifyPageStateChange=E.debounce(()=>{this.appEmitter.emit("pageStateChange",this.pageState)},50),this.notifyBoxStatusChange=s=>{this.appEmitter.emit("boxStatusChange",{appId:this.id,status:s})},this.kind=e.kind,this.id=i,this.stateKey=`${this.id}_state`,this.appProxies.set(this.id,this),this.appEmitter=new bi.default,this.appListener=this.makeAppEventListener(this.id),this.isAddApp=n,this.initScenes(),(r=this.params.options)!=null&&r.scenePath&&this.createView(),this._pageState=new gm({displayer:this.manager.displayer,scenePath:this.scenePath,view:this.view,notifyPageStateChange:this.notifyPageStateChange})}initScenes(){var t;const e=this.params.options;e&&(this.scenePath=e.scenePath,((t=this.appAttributes)==null?void 0:t.isDynamicPPT)&&this.scenePath?this.scenes=qi(this.manager.displayer)[this.scenePath]:this.scenes=e.scenes)}get view(){return this.manager.viewManager.getView(this.id)}get viewIndex(){var e;return(e=this.view)==null?void 0:e.focusSceneIndex}get isWritable(){var e;return this.manager.canOperate&&!((e=this.box)!=null&&e.readonly)}get attributes(){return this.manager.attributes[this.id]}get appAttributes(){return this.store.getAppAttributes(this.id)}getFullScenePath(){if(this.scenePath)return E.get(this.appAttributes,[xe.FullPath])||this.getFullScenePathFromScenes()}getFullScenePathFromScenes(){const e=E.get(this.appAttributes,["state","SceneIndex"],0),t=rm(this.manager.room,this.scenePath,e);return t&&this.setFullPath(t),t}setFullPath(e){this.manager.safeUpdateAttributes(["apps",this.id,xe.FullPath],e)}async baseInsertApp(e=!1,t=N.Normal){var s;const i=this.params;if(!i.kind)throw new Error("[WindowManager]: kind require");const n=await((s=Ae.appClasses.get(i.kind))==null?void 0:s()),r=Ae.registered.get(i.kind);if(n)await this.setupApp(this.id,e,n,i.options,r==null?void 0:r.appOptions,this.manager.useBoxesStatus?t:void 0,i.forceTop,i.forceNormal,i.isDragContent);else throw new Error(`[WindowManager]: app load failed ${i.kind} ${i.src}`);return V.emit("updateManagerRect"),{appId:this.id,app:n}}get box(){var e;return(e=this.boxManager)==null?void 0:e.getBox(this.id)}async setupApp(e,t,i,n,r,s,o,a,l){var c;if(et("setupApp",e,i,n,s,o,a,l),!this.boxManager)throw new Zh;const u=Tt(hr,Q.extendClass),h=new u(this.manager,this.boxManager,e,this,r);this.appContext=h;try{V.once(`${e}${se.WindowCreated}`).then(async()=>{var w;let m;t||(m=this.getAppInitState(e),(w=this.boxManager)==null||w.updateBoxState(m)),this.appEmitter.onAny(this.appListener),this.appAttributesUpdateListener(e),this.setViewFocusScenePath();let v;this.manager.isReplay&&(v=this.manager.mainView.scenePath),setTimeout(async()=>{console.log("setup app",i);const x=await i.setup(h);this.appResult=x,Ae.notifyApp(this.kind,"created",{appId:e,result:x}),this.afterSetupApp(m),this.fixMobileSize(),v&&this.manager.mainViewProxy.setFocusScenePath(v),G.emit("onAppSetup",e)},Oh)}),(c=this.boxManager)==null||c.createBox({appId:e,app:i,options:n,canOperate:this.manager.canOperate,smartPosition:this.isAddApp,boxStatus:s,forceTop:o,forceNormal:a,isDragContent:l}),this.isAddApp&&this.box&&(s&&this.store.setBoxStatus(e,s),this.store.updateAppState(e,Be.ZIndex,this.box.zIndex),this.store.updateAppState(e,Be.Size,{width:this.box.intrinsicWidth,height:this.box.intrinsicHeight}),this.boxManager.focusBox({appId:e},!1))}catch(m){throw console.error(m),new Error(`[WindowManager]: app setup error: ${m.message}`)}}fixMobileSize(){var t,i;const e=(t=this.boxManager)==null?void 0:t.getBox(this.id);e&&((i=this.boxManager)==null||i.resizeBox({appId:this.id,width:e.intrinsicWidth+.001,height:e.intrinsicHeight+.001,skipUpdate:!0}))}afterSetupApp(e){var t;e&&(!(e!=null&&e.x)||!e.y)&&((t=this.boxManager)==null||t.setBoxInitState(this.id))}async onSeek(e){var i;this.appEmitter.emit("seek",e).catch(n=>{console.log(`[WindowManager]: emit seek error: ${n.message}`)});const t=this.getAppInitState(this.id);(i=this.boxManager)==null||i.updateBoxState(t)}async onReconnected(){var s;if(!Boolean(this.manager.attributes.apps[this.id])){await this.destroy(!0,!1,!0);return}this.appEmitter.emit("reconnected",void 0);const t=this.getAppInitState(this.id);await this.destroy(!0,!1,!0);const i=this.params,n=Tt(Id,Q.extendClass);await new n(i,this.manager,this.id,this.isAddApp).baseInsertApp(!0,t==null?void 0:t.boxStatus),(s=this.boxManager)==null||s.updateBoxState(t)}async onRemoveScene(e){if(this.scenePath&&e.startsWith(this.scenePath+"/")){let t=this.pageState.index,i=this._pageState.getFullPath(t);i||(t=0,i=this._pageState.getFullPath(t)),i&&this.setFullPath(i),this.setViewFocusScenePath(),this.view&&(this.view.focusSceneIndex=t)}}emitAppSceneStateChange(e){this.appEmitter.emit("sceneStateChange",e)}emitAppIsWritableChange(){this.appEmitter.emit("writableChange",this.isWritable)}makeAppEventListener(e){return(t,i)=>{var n,r,s,o;if(!!this.manager.canOperate)switch(t){case"setBoxSize":{(n=this.boxManager)==null||n.resizeBox({appId:e,width:i.width,height:i.height,skipUpdate:!1});break}case"setBoxMinSize":{(r=this.boxManager)==null||r.setBoxMinSize({appId:e,minWidth:i.minwidth,minHeight:i.minheight});break}case"setBoxTitle":{(s=this.boxManager)==null||s.setBoxTitle({appId:e,title:i.title});break}case _h.destroy:{if(this.status==="destroyed")return;this.destroy(!0,!1,!0,i==null?void 0:i.error),i!=null&&i.error&&console.error(i==null?void 0:i.error);break}case"focus":{(o=this.boxManager)==null||o.focusBox({appId:this.id}),lt.emit("focus",{appId:this.id});break}}}}setScenePath(){if(!this.manager.canOperate)return;const e=this.getFullScenePath();this.manager.room&&e&&this.view&&qo(this.manager.room,e)}setViewFocusScenePath(){const e=this.getFullScenePath();return e&&this.view&&yi(this.view,e),e}async createView(){const e=await this.viewManager.createView(this.id);return this.setViewFocusScenePath(),e}get pageState(){return this._pageState.toObject()}async removeSceneByIndex(e){const t=this._pageState.getFullPath(e);if(t){const i=Ml(e,this.pageState);return this.setSceneIndexWithoutSync(i),this.manager.dispatchInternalEvent(se.SetAppFocusIndex,{type:"app",appID:this.id,index:i}),setTimeout(()=>{ea(this.manager.room,t,e)},100),!0}else return!1}setSceneIndexWithoutSync(e){this.view&&(this.view.focusSceneIndex=e)}setSceneIndex(e){if(this.view){this.view.focusSceneIndex=e;const t=this._pageState.getFullPath(e);t&&this.setFullPath(t)}}async destroy(e,t,i,n){var r;if(this.status!=="destroyed"){this.status="destroyed";try{await Ae.notifyApp(this.kind,"destroy",{appId:this.id}),await this.appEmitter.emit("destroy",{error:n})}catch(s){console.error("[WindowManager]: notifyApp error",s.message,s.stack)}this.appEmitter.clearListeners(),V.emit(`destroy-${this.id}`,{error:n}),e&&((r=this.boxManager)==null||r.closeBox(this.id,i)),t&&(this.store.cleanAppAttributes(this.id),this.scenePath&&ea(this.manager.room,this.scenePath)),this.appProxies.delete(this.id),this._pageState.destroy(),this.viewManager.destroyView(this.id),this.manager.appStatus.delete(this.id),this.manager.refresher.remove(this.id),this.manager.refresher.remove(this.stateKey),this.manager.refresher.remove(`${this.id}-fullPath`),this._prevFullPath=void 0}}close(){return this.destroy(!0,!0,!1)}};let wr=Id;wr.kind="AppProxy";class sw{constructor(t){this.displayer=t,this.views=new Map}createView(t){const i=Cd(this.displayer);return this.views.set(t,i),i}getView(t){return this.views.get(t)}destroyView(t){const i=this.views.get(t);if(i){try{i.release()}catch{}this.views.delete(t)}}setViewScenePath(t,i){const n=this.views.get(t);n&&(n.focusScenePath=i)}destroy(){this.views.forEach(t=>{try{t.release()}catch{}}),this.views.clear()}}const Cd=e=>{const t=e.views.createView();return ow(t),t},ow=e=>{e.setCameraBound({maxContentMode:()=>10,minContentMode:()=>.1})};class aw{constructor(t){this.manager=t,this.polling=!1,this.started=!1,this.mainViewIsAddListener=!1,this.store=this.manager.store,this.viewMode=this.manager.windowManger.viewMode,this.sideEffectManager=new cr,this.syncCamera=()=>{if(!this.polling||this.viewMode!==b.ViewMode.Broadcaster)return;const{mainViewCamera:n}=this;n&&n.id!==this.manager.uid&&this.moveCameraSizeByAttributes()},this.startListenWritableChange=()=>{this.sideEffectManager.add(()=>V.on("writableChange",n=>{n&&this.ensureCameraAndSize(),this.manager.room&&this.syncMainView(this.manager.room)}))},this.addCameraReaction=()=>{this.manager.refresher.add(xe.MainViewCamera,this.cameraReaction)},this.cameraReaction=()=>b.reaction(()=>this.mainViewCamera,n=>{n&&n.id!==this.manager.uid&&(this.moveCameraToContian(this.mainViewSize),this.moveCamera(n))},{fireImmediately:!0}),this.sizeChangeHandler=E.debounce(n=>{n&&(this.moveCameraToContian(n),this.moveCamera(this.mainViewCamera)),this.ensureMainViewSize()},30),this.onUpdateContainerSizeRatio=()=>{const n=this.store.getMainViewSize();this.sizeChangeHandler(n)},this.onCameraUpdatedByDevice=n=>{this.viewMode!==b.ViewMode.Follower&&(this.store.setMainViewCamera({...n,id:this.manager.uid}),E.isEqual(this.mainViewSize,{...this.mainView.size,id:this.manager.uid})||this.setMainViewSize(this.view.size))},this.mainViewClickListener=()=>{this.mainViewClickHandler()},this.setMainViewSize=E.debounce(n=>{this.store.setMainViewSize({...n,id:this.manager.uid})},50),this._syncMainViewTimer=0,this.onCameraOrSizeUpdated=()=>{G.emit("cameraStateChange",this.cameraState),this.manager.room&&this.manager.room.syncMainView&&(clearTimeout(this._syncMainViewTimer),this._syncMainViewTimer=setTimeout(this.syncMainView,100,this.manager.room)),this.ensureMainViewSize()},this.syncMainView=n=>{n.isWritable&&n.syncMainView(this.mainView)},this.setViewMode=n=>{this.viewMode=n},this.mainView=this.createMainView(),this.moveCameraSizeByAttributes(),V.once("mainViewMounted").then(()=>{this.addMainViewListener(),this.start(),this.ensureCameraAndSize(),this.startListenWritableChange()});const i=()=>{this.sizeChangeHandler(this.mainViewSize)};this.sideEffectManager.add(()=>V.on("playgroundSizeChange",i)),this.sideEffectManager.add(()=>V.on("containerSizeRatioUpdate",this.onUpdateContainerSizeRatio)),this.sideEffectManager.add(()=>V.on("startReconnect",()=>{this.didRelease||this.mainView.release()})),this.sideEffectManager.setInterval(this.syncCamera,1500)}ensureCameraAndSize(){this.viewMode===b.ViewMode.Broadcaster&&(!this.mainViewCamera||!this.mainViewSize)&&(this.manager.dispatchInternalEvent(se.InitMainViewCamera),this.setCameraAndSize())}get mainViewCamera(){return this.store.getMainViewCamera()}get mainViewSize(){return this.store.getMainViewSize()}get didRelease(){return E.get(this.view,["didRelease"])}moveCameraSizeByAttributes(){this.moveCameraToContian(this.mainViewSize),this.moveCamera(this.mainViewCamera)}start(){this.sizeChangeHandler(this.mainViewSize),!this.started&&(this.addCameraListener(),this.addCameraReaction(),this.manager.room&&this.syncMainView(this.manager.room),this.started=!0)}setCameraAndSize(){const t={...this.mainView.camera,id:this.manager.uid},i={...this.mainView.size,id:this.manager.uid};this.store.setMainViewCameraAndSize(t,i)}get view(){return this.mainView}get cameraState(){return{...this.view.camera,...this.view.size}}createMainView(){const t=Cd(this.manager.displayer),i=this.store.getMainViewScenePath();return i&&yi(t,i),t}onReconnect(){if(this.didRelease)this.rebind();else{const t=this.store.getMainViewScenePath();this.setFocusScenePath(t)}}setFocusScenePath(t){if(t)return yi(this.view,t)}rebind(){const t=this.mainView.divElement,i=this.mainView.disableCameraTransform;this.stop(),this.didRelease||this.mainView.release(),this.removeMainViewListener(),this.mainView=this.createMainView(),this.mainView.disableCameraTransform=i,this.mainView.divElement=t,this.addMainViewListener(),this.start(),G.emit("onMainViewRebind",this.mainView)}addMainViewListener(){this.mainViewIsAddListener||this.view.divElement&&(this.view.divElement.addEventListener("click",this.mainViewClickListener),this.view.divElement.addEventListener("touchend",this.mainViewClickListener),this.mainViewIsAddListener=!0)}removeMainViewListener(){this.view.divElement&&(this.view.divElement.removeEventListener("click",this.mainViewClickListener),this.view.divElement.removeEventListener("touchend",this.mainViewClickListener)),this.mainViewIsAddListener=!1}async mainViewClickHandler(){var t;!this.manager.canOperate||(this.store.cleanFocus(),(t=this.manager.boxManager)==null||t.blurAllBox())}addCameraListener(){this.view.callbacks.on("onCameraUpdatedByDevice",this.onCameraUpdatedByDevice),this.view.callbacks.on("onCameraUpdated",this.onCameraOrSizeUpdated),this.view.callbacks.on("onSizeUpdated",this.onCameraOrSizeUpdated)}removeCameraListener(){this.view.callbacks.off("onCameraUpdatedByDevice",this.onCameraUpdatedByDevice),this.view.callbacks.off("onCameraUpdated",this.onCameraOrSizeUpdated),this.view.callbacks.off("onSizeUpdated",this.onCameraOrSizeUpdated)}ensureMainViewSize(){(!this.mainViewSize||this.mainViewSize.width===0||this.mainViewSize.height===0)&&this.mainView.size.width>0&&this.mainView.size.height>0&&this.setMainViewSize(this.mainView.size)}moveCameraToContian(t){E.isEmpty(t)||(this.view.moveCameraToContain({width:t.width,height:t.height,originX:-t.width/2,originY:-t.height/2,animationMode:b.AnimationMode.Immediately}),this.scale=this.view.camera.scale)}moveCamera(t){if(!E.isEmpty(t)){if(E.isEqual(t,this.view.camera))return;const{centerX:i,centerY:n,scale:r}=t,s=r*(this.scale||1);this.view.moveCamera({centerX:i,centerY:n,scale:s,animationMode:b.AnimationMode.Immediately})}}stop(){this.removeCameraListener(),this.manager.refresher.remove(xe.MainViewCamera),this.manager.refresher.remove(xe.MainViewSize),this.started=!1}destroy(){this.removeMainViewListener(),this.stop(),this.sideEffectManager.flushAll()}}class lw{constructor(t){this.context=t,this.addRedoUndoListeners=i=>{if(i===void 0)this.addViewCallbacks(this.context.mainView(),this.onCanRedoStepsUpdate,this.onCanUndoStepsUpdate);else{const n=this.context.getAppProxy(i);n&&n.view&&this.addViewCallbacks(n.view,this.onCanRedoStepsUpdate,this.onCanUndoStepsUpdate)}},this.addViewCallbacks=(i,n,r)=>{n(i.canRedoSteps),r(i.canUndoSteps),i.callbacks.on("onCanRedoStepsUpdate",n),i.callbacks.on("onCanUndoStepsUpdate",r)},this.disposeViewCallbacks=i=>{i.callbacks.off("onCanRedoStepsUpdate",this.onCanRedoStepsUpdate),i.callbacks.off("onCanUndoStepsUpdate",this.onCanUndoStepsUpdate)},this.onCanRedoStepsUpdate=i=>{G.emit("canRedoStepsChange",i)},this.onCanUndoStepsUpdate=i=>{G.emit("canUndoStepsChange",i)},this.disposePrevFocusViewRedoUndoListeners=i=>{let n;if(i===void 0)n=this.context.mainView();else{const r=this.context.getAppProxy(i);r&&r.view&&(n=r.view)}n&&this.disposeViewCallbacks(n)},V.on("focusedChange",i=>{this.disposePrevFocusViewRedoUndoListeners(i.prev),setTimeout(()=>{this.addRedoUndoListeners(i.focused)},0)}),V.on("rootDirRemoved",()=>{this.disposePrevFocusViewRedoUndoListeners(t.focus()),this.addRedoUndoListeners(t.focus())}),this.addRedoUndoListeners(t.focus())}destroy(){this.disposePrevFocusViewRedoUndoListeners(this.context.focus())}}class yr{constructor(t){this.windowManger=t,this.appProxies=new Map,this.appStatus=new Map,this.isReplay=this.windowManger.isReplay,this.mainViewScenesLength=0,this.callbacksNode=null,this.appCreateQueue=new $g,this.sideEffectManager=new cr,this.sceneState=null,this.rootDirRemoving=!1,this._useBoxesStatus=!1,this.onRemoveScenes=async i=>{var r,s;const{scenePath:n}=i;if(n===Ue){await this.onRootDirRemoved(),this.dispatchInternalEvent(se.RootDirRemoved);return}if(um(n)){let o=this.mainView.focusSceneIndex||0,a=(r=this.callbacksNode)==null?void 0:r.scenes[o];a||(o=0,a=(s=this.callbacksNode)==null?void 0:s.scenes[o]),a&&this.setMainViewScenePath(`${Ue}${a}`),await this.setMainViewSceneIndex(o)}else this.appProxies.forEach(o=>{o.onRemoveScene(n)})},this.onReadonlyChanged=()=>{this.appProxies.forEach(i=>{i.emitAppIsWritableChange()})},this.onPlayerSeekStart=async()=>{await this.closeAll()},this.onPlayerSeekDone=async i=>{await this._attributesUpdateCallback(this.attributes.apps),this.appProxies.forEach(n=>{n.onSeek(i)})},this.createRootDirScenesCallback=()=>{let i=!1;this.callbacksNode&&(this.callbacksNode.dispose(),i=!0),this.callbacksNode=this.displayer.createScenesCallback(Ue,{onAddScene:this.onSceneChange,onRemoveScene:async(n,r)=>{await this.onSceneChange(n),V.emit("rootDirSceneRemoved",r)}}),this.callbacksNode&&(this.updateSceneState(this.callbacksNode),this.mainViewScenesLength=this.callbacksNode.scenes.length,i&&this.emitMainViewScenesChange(this.callbacksNode.scenes.length))},this.removeSceneByIndex=async i=>{var s;const n=Ml(i,this.windowManger.pageState);this.setSceneIndexWithoutSync(n),this.dispatchInternalEvent(se.SetAppFocusIndex,{type:"main",index:n});const r=(s=this.callbacksNode)==null?void 0:s.scenes[i];return setTimeout(()=>{r&&ea(this.room,`${Ue}${r}`,i)},100),new Promise((o,a)=>{V.once("rootDirSceneRemoved").then(l=>{l===r&&o(!0)}).catch(l=>{console.log(`[WindowManager]: removePage error: ${l}`),a(!1)})})},this.setSceneIndexWithoutSync=i=>{var r;const n=(r=this.callbacksNode)==null?void 0:r.scenes[i];n&&this.mainViewProxy.setFocusScenePath(`${Ue}${n}`)},this.onSceneChange=i=>(this.mainViewScenesLength=i.scenes.length,this.updateSceneState(i),this.emitMainViewScenesChange(this.mainViewScenesLength)),this.emitMainViewScenesChange=i=>Promise.all([G.emit("mainViewScenesLengthChange",i),V.emit("changePageState")]),this.updateSceneState=i=>{const n=this.store.getMainViewSceneIndex()||0;let r=i.scenes[n];r||(r=i.scenes[this.mainView.focusSceneIndex||0]),this.sceneState={scenePath:`${Ue}${r}`,contextPath:i.path,index:n,scenes:i.scenes.map(s=>({name:s})),sceneName:r},G.emit("sceneStateChange",this.sceneState)},this.onBoxMove=i=>{this.dispatchInternalEvent(se.AppMove,i),this.store.updateAppState(i.appId,Be.Position,{x:i.x,y:i.y}),G.emit("onBoxMove",i)},this.onBoxResize=i=>{i.width&&i.height&&(this.dispatchInternalEvent(se.AppResize,i),this.store.updateAppState(i.appId,Be.Size,{width:i.width,height:i.height}),G.emit("onBoxResize",i))},this.onBoxFocus=i=>{this.windowManger.safeSetAttributes({focus:i.appId}),G.emit("onBoxFocus",i)},this.onBoxBlurred=i=>{this.attributes.focus===i.appId&&(this.windowManger.safeSetAttributes({focus:void 0}),G.emit("onBoxBlurred",i))},this.onBoxClose=i=>{const n=this.appProxies.get(i.appId);n&&n.destroy(!1,!0,!0,i.error),G.emit("onBoxClose",i)},this.onBoxStateChange=i=>{this.dispatchInternalEvent(se.AppBoxStateChange,i),G.emit("onBoxStateChange",i)},this.notifyBoxesStatusChange=E.debounce(()=>{var n;(n=this.boxManager)==null||n.setBoxesStatus(this.attributes.boxesStatus);const i=Object.entries(this.attributes.boxesStatus);i.length>0&&i.forEach(([r,s])=>{const o=this.appProxies.get(r);o&&o.notifyBoxStatusChange(s)})},100),this.addBoxesStatusChangeListener=()=>{this.refresher.add("boxesStatus",()=>Nn(()=>this.attributes.boxesStatus,()=>{this.notifyBoxesStatusChange()})),this.refresher.add("lastNotMinimizedBoxesStatus",()=>Nn(()=>this.attributes.lastNotMinimizedBoxesStatus,()=>{var i;(i=this.boxManager)==null||i.setLastNotMinimizedBoxesStatus(this.attributes.lastNotMinimizedBoxesStatus)}))},this.addAppsChangeListener=()=>{this.refresher.add("apps",()=>Nn(()=>this.attributes.apps,()=>{this.attributesUpdateCallback(this.attributes.apps)}))},this.addAppCloseListener=()=>{this.refresher.add("appsClose",()=>Nn(()=>this.attributes.apps,i=>{i.some(n=>n.kind===b.UpdateEventKind.Removed)&&this.onAppDelete(this.attributes.apps)}))},this.onMainViewIndexChange=i=>{i!==void 0&&this._prevSceneIndex!==i&&(G.emit("mainViewSceneIndexChange",i),V.emit("changePageState"),this.callbacksNode&&this.updateSceneState(this.callbacksNode),this._prevSceneIndex=i)},this.onFocusChange=i=>{var n;this._prevFocused!==i&&(G.emit("focusedChange",i),V.emit("focusedChange",{focused:i,prev:this._prevFocused}),this._prevFocused=i,i!==void 0&&((n=this.boxManager)==null||n.focusBox({appId:i}),setTimeout(()=>{const r=this.appProxies.get(i);r&&Ae.notifyApp(r.kind,"focus",{appId:i})},0)))},this.attributesUpdateCallback=E.debounce(i=>this._attributesUpdateCallback(i),100),this._appIds=[],this.onRegisteredChange=i=>{!i||Object.entries(i).forEach(([n,r])=>{Ae.appClasses.has(n)||Ae.register({kind:n,src:r.src,name:r.name})})},this.onMinimized=i=>{var n,r;((n=this.boxManager)==null?void 0:n.minimized)!==i&&(i===!0&&((r=this.boxManager)==null||r.blurAllBox()),setTimeout(()=>{var s;(s=this.boxManager)==null||s.setMinimized(Boolean(i))},0))},this.onAppDelete=async i=>{const n=Object.keys(i);for(const[r,s]of this.appProxies.entries())n.includes(r)||await s.destroy(!0,!1,!0)},this.closeAll=async()=>{for(const[i,n]of this.appProxies.entries())await n.destroy(!0,!1,!0)},this.displayerStateListener=i=>{this.appProxies.forEach(n=>{n.appEmitter.emit("roomStateChange",i)}),V.emit("observerIdChange",this.displayer.observerId)},this.displayerWritableListener=i=>{var s,o;const n=!i,r=this.windowManger.readonly===void 0||this.windowManger.readonly===!1;this.windowManger.readonly===void 0?(s=this.boxManager)==null||s.setReadonly(i):(o=this.boxManager)==null||o.setReadonly(!(n&&r)),this.appProxies.forEach(a=>{a.emitAppIsWritableChange()}),V.emit("writableChange",n)},this.updateSceneIndex=()=>{const i=this.store.getMainViewScenePath(),n=So(i),r=qi(this.displayer)[n];if(r.length){const s=i.replace(n,"").replace("/",""),o=r.findIndex(a=>a.name===s);E.isInteger(o)&&o>=0&&this.safeSetAttributes({_mainSceneIndex:o})}},this.updateRootDirRemoving=i=>{this.rootDirRemoving=i},this.displayer=t.displayer,this.store=rw(Q.extendClass,{getAttributes:()=>this.attributes,safeSetAttributes:i=>this.safeSetAttributes(i),safeUpdateAttributes:(i,n)=>this.safeUpdateAttributes(i,n)}),this.mainViewProxy=new aw(this),this.viewManager=new sw(this.displayer),this.appListeners=new cm(this),this.displayer.callbacks.on(this.eventName,this.displayerStateListener),this.appListeners.addListeners(),this.refresher=Ag,this.refresher.setRoom(this.room),this.refresher.setContext({emitter:V}),this.sideEffectManager.addDisposer(()=>{var i,n;this.appCreateQueue.destroy(),this.mainViewProxy.destroy(),this.refresher.destroy(),this.viewManager.destroy(),(i=this.boxManager)==null||i.destroy(),(n=this.callbacksNode)==null||n.dispose()}),V.once("onCreated").then(()=>this.onCreated()),V.on("onReconnected",()=>this.onReconnected()),b.isPlayer(this.displayer)&&(V.on("seekStart",this.onPlayerSeekStart),V.on("seek",this.onPlayerSeekDone)),V.on("removeScenes",this.onRemoveScenes),V.on("setReadonly",this.onReadonlyChanged),this.createRootDirScenesCallback(),Ae.setSyncRegisterApp(i=>{this.safeUpdateAttributes([xe.Registered,i.kind],i)})}get useBoxesStatus(){return this._useBoxesStatus}set useBoxesStatus(t){this._useBoxesStatus=t}getMemberState(){var t;return((t=this.room)==null?void 0:t.state.memberState)||{strokeColor:[0,0,0]}}async onRootDirRemoved(t=!0){this.setMainViewScenePath(Vh),this.createRootDirScenesCallback();for(const[i,n]of this.appProxies.entries())n.view&&await this.closeApp(i,t);this.mainViewProxy.rebind(),V.emit("rootDirRemoved"),this.updateRootDirRemoving(!1)}get eventName(){return b.isRoom(this.displayer)?"onRoomStateChanged":"onPlayerStateChanged"}get attributes(){return this.windowManger.attributes}get canOperate(){return this.windowManger.canOperate}get room(){return b.isRoom(this.displayer)?this.displayer:void 0}get mainView(){return this.mainViewProxy.view}get polling(){return this.mainViewProxy.polling}set polling(t){this.mainViewProxy.polling=t}get focusApp(){if(this.store.focus)return this.appProxies.get(this.store.focus)}get uid(){var t;return((t=this.room)==null?void 0:t.uid)||""}getMainViewSceneDir(){const t=this.store.getMainViewScenePath();if(t)return So(t);throw new Error("[WindowManager]: mainViewSceneDir not found")}async onCreated(){var t;if(Object.keys(this.attributes.apps).length&&this.store.focus&&(this._focusAppId=this.store.focus,await new Promise(i=>{this._focusAppCreatedResolve=i,this._resolveTimer=setTimeout(()=>{i(this.appProxies.get(this._focusAppId||""))},500)}).then(()=>{this._resolveTimer=void 0,this._focusAppCreatedResolve=void 0,this.focusByAttributes(this.attributes.apps)})),await this._attributesUpdateCallback(this.attributes.apps),V.emit("updateManagerRect"),lt.on("move",this.onBoxMove),lt.on("resize",this.onBoxResize),lt.on("focus",this.onBoxFocus),lt.on("close",this.onBoxClose),lt.on("boxStateChange",this.onBoxStateChange),lt.on("blurred",this.onBoxBlurred),this.addAppsChangeListener(),this.addAppCloseListener(),this.addBoxesStatusChangeListener(),this.refresher.add("maximized",()=>b.autorun(()=>{var n;const i=this.attributes.maximized;(n=this.boxManager)==null||n.setMaximized(Boolean(i))})),this.refresher.add("minimized",()=>b.autorun(()=>{const i=this.attributes.minimized;this.onMinimized(i)})),this.refresher.add("mainViewIndex",()=>b.autorun(()=>{const i=E.get(this.attributes,"_mainSceneIndex");this.onMainViewIndexChange(i)})),this.refresher.add("focusedChange",()=>b.autorun(()=>{const i=E.get(this.attributes,"focus");this.onFocusChange(i)})),this.refresher.add("registeredChange",()=>b.autorun(()=>{const i=E.get(this.attributes,xe.Registered);this.onRegisteredChange(i)})),!this.attributes.apps||Object.keys(this.attributes.apps).length===0){const i=this.store.getMainViewScenePath();if(!i)return;this.resetScenePath(i)}this.displayerWritableListener(!((t=this.room)!=null&&t.isWritable)),this.displayer.callbacks.on("onEnableWriteNowChanged",this.displayerWritableListener),this.focusByAttributes(this.attributes.apps),this._prevFocused=this.attributes.focus,Q.supportAppliancePlugin||this.sideEffectManager.add(()=>{const i=new lw({mainView:()=>this.mainViewProxy.view,focus:()=>this.attributes.focus,getAppProxy:n=>this.appProxies.get(n)});return()=>i.destroy()})}notifyAppsChange(t){(this._appIds.length!==t.length||!this._appIds.every(i=>t.includes(i)))&&(this._appIds=t,G.emit("appsChange",t))}async _attributesUpdateCallback(t){if(t&&Q.container){const i=Object.keys(t);i.length===0&&this.appCreateQueue.emitReady();const r=E.orderBy(i.map(s=>({id:s,createdAt:t[s].createdAt})),"createdAt","asc").map(({id:s})=>s);this.notifyAppsChange(r);for(const s of r)if(!this.appProxies.has(s)&&!this.appStatus.has(s)){const o=t[s];try{if(!this.attributes[s])throw new Error("appAttributes is undefined");this.appCreateQueue.push(async()=>{this.appStatus.set(s,Jo.StartCreate);const l=await this.baseInsertApp({kind:o.kind,options:o.options,isDynamicPPT:o.isDynamicPPT,forceNormal:o.forceNormal,forceTop:o.forceTop,isDragContent:o.isDragContent},s,!1);return l&&this._focusAppId===s&&this._focusAppCreatedResolve&&(this._resolveTimer&&clearTimeout(this._resolveTimer),this._focusAppCreatedResolve(l)),l}),this.focusByAttributes(t)}catch(a){console.warn("[WindowManager]: Insert App Error",a)}}}}refresh(){this.attributesUpdateCallback(this.attributes.apps)}setBoxManager(t){this.boxManager=t}resetMaximized(){var t;(t=this.boxManager)==null||t.setMaximized(Boolean(this.store.getMaximized()))}resetMinimized(){var t;(t=this.boxManager)==null||t.setMinimized(Boolean(this.store.getMinimized()))}bindMainView(t,i){const n=this.mainViewProxy.view;n.disableCameraTransform=i,n.divElement=t,n.focusScenePath||this.setMainViewFocusPath(),V.emit("mainViewMounted"),G.emit("onMainViewMounted",n)}setMainViewFocusPath(t){var n;const i=t||this.store.getMainViewScenePath();if(i)return yi(this.mainView,i),((n=this.mainView)==null?void 0:n.focusScenePath)===i}resetScenePath(t){this.displayer.state.sceneState.scenePath!==t&&qo(this.room,t)}async addApp(t,i){et("addApp",t);const{appId:n,needFocus:r}=await this.beforeAddApp(t,i),s=await this.baseInsertApp(t,n,!0,r);return this.afterAddApp(s),s==null?void 0:s.id}async beforeAddApp(t,i){var o,a;const n=await nm(t.kind);this.appStatus.set(n,Jo.StartCreate);const r=(o=t.attributes)!=null?o:{};this.safeUpdateAttributes([n],r),this.store.setupAppAttributes(t,n,i);const s=!((a=this.boxManager)!=null&&a.minimized);return s&&this.store.setAppFocus(n,!0),{appId:n,needFocus:s}}afterAddApp(t){var i,n;if(t&&t.box){const r=t.box;lt.emit("move",{appId:t.id,x:r==null?void 0:r.intrinsicX,y:r==null?void 0:r.intrinsicY}),this.store.updateAppState(t.id,Be.ZIndex,r.zIndex)}(i=this.boxManager)!=null&&i.minimized&&((n=this.boxManager)==null||n.setMinimized(!1,!1))}async closeApp(t,i=!0){const n=this.appProxies.get(t);n&&n.destroy(!0,i,!1)}async baseInsertApp(t,i,n,r){if(this.appProxies.has(i)){console.warn("[WindowManager]: app duplicate exists and cannot be created again");return}const s=Tt(wr,Q.extendClass),o=new s(t,this,i,n);if(o)return await o.baseInsertApp(r),this.appStatus.delete(i),o;throw this.appStatus.delete(i),new Error("[WindowManger]: initialize AppProxy failed")}safeSetAttributes(t){this.windowManger.safeSetAttributes(t)}safeUpdateAttributes(t,i){this.windowManger.safeUpdateAttributes(t,i)}async setMainViewScenePath(t){if(this.room){const i=this.displayer.scenePathType(t);if(So(t)!==Ue)throw new Error('[WindowManager]: main view scenePath must in root dir "/"');if(i===b.ScenePathType.None)throw new Error(`[WindowManager]: ${t} not valid scene`);if(i===b.ScenePathType.Page)await this._setMainViewScenePath(t);else if(i===b.ScenePathType.Dir){const r=om(this.displayer,t);r&&await this._setMainViewScenePath(r)}}}async _setMainViewScenePath(t){this.setMainViewFocusPath(t)&&(this.safeSetAttributes({_mainScenePath:t}),this.store.setMainViewFocusPath(this.mainView),this.updateSceneIndex(),this.dispatchSetMainViewScenePath(t))}async setMainViewSceneIndex(t){var i;if(this.room){if(this.store.getMainViewSceneIndex()===t)return;const n=(i=this.callbacksNode)==null?void 0:i.scenes[t],r=`${Ue}${n}`;if(n)this.setMainViewFocusPath(r)&&(this.store.setMainViewScenePath(r),this.store.setMainViewSceneIndex(t),this.dispatchSetMainViewScenePath(r));else throw new Error(`[WindowManager]: ${t} not valid index`)}}dispatchSetMainViewScenePath(t){this.dispatchInternalEvent(se.SetMainViewScenePath,{nextScenePath:t}),G.emit("mainViewScenePathChange",t),qo(this.room,t)}getAppInitPath(t){var n;const i=this.store.getAppAttributes(t);if(i)return(n=i==null?void 0:i.options)==null?void 0:n.scenePath}safeDispatchMagixEvent(t,i){this.canOperate&&this.displayer.dispatchMagixEvent(t,i)}focusByAttributes(t){var i;if(t&&Object.keys(t).length===((i=this.boxManager)==null?void 0:i.boxSize)){const n=this.store.focus;n&&this.boxManager.focusBox({appId:n})}}async onReconnected(){await this._attributesUpdateCallback(this.attributes.apps);const i=Array.from(this.appProxies.values()).map(n=>n.onReconnected());this.mainViewProxy.onReconnect(),await Promise.all(i),this.callbacksNode&&this.onSceneChange(this.callbacksNode)}notifyContainerRectUpdate(t){this.appProxies.forEach(i=>{i.appEmitter.emit("containerRectUpdate",t)})}dispatchInternalEvent(t,i){this.safeDispatchMagixEvent(Xo,{eventName:t,payload:i})}destroy(){this.displayer.callbacks.off(this.eventName,this.displayerStateListener),this.displayer.callbacks.off("onEnableWriteNowChanged",this.displayerWritableListener),this.appListeners.removeListeners(),lt.clearListeners(),V.clearListeners(),this.appProxies.size&&this.appProxies.forEach(t=>{t.destroy(!0,!1,!0)}),G.clearListeners(),this.sideEffectManager.flushAll(),this._prevFocused=void 0,this._prevSceneIndex=void 0,this._resolveTimer&&clearTimeout(this._resolveTimer),this._focusAppCreatedResolve=void 0,this._resolveTimer=void 0}}yr.kind="AppManager";const uw=window.ResizeObserver||Rg.ResizeObserver;class Il{constructor(t){this.emitter=t}static create(t,i,n,r){const s=new Il(r);return s.observePlaygroundSize(t,i,n),s}observePlaygroundSize(t,i,n){this.updateSizer(t.getBoundingClientRect(),i,n),this.containerResizeObserver=new uw(r=>{var o;const s=(o=r[0])==null?void 0:o.contentRect;s&&(this.updateSizer(s,i,n),this.emitter.emit("playgroundSizeChange",s))}),this.disposer=this.emitter.on("containerSizeRatioUpdate",()=>{const r=t.getBoundingClientRect();this.updateSizer(r,i,n),this.emitter.emit("playgroundSizeChange",r)}),this.containerResizeObserver.observe(t)}updateSizer({width:t,height:i},n,r){t&&i&&(i/t>Q.containerSizeRatio?(i=t*Q.containerSizeRatio,n.classList.toggle("netless-window-manager-sizer-horizontal",!0)):(t=i/Q.containerSizeRatio,n.classList.toggle("netless-window-manager-sizer-horizontal",!1)),r.style.width=`${t}px`,r.style.height=`${i}px`)}disconnect(){var t;(t=this.containerResizeObserver)==null||t.disconnect(),E.isFunction(this.disposer)&&(this.disposer(),this.disposer=void 0)}}class cw{constructor(t){this.manager=t,V.on("changePageState",()=>{G.emit("pageStateChange",this.toObject())})}get index(){return this.manager.store.getMainViewSceneIndex()||0}get length(){return this.manager.mainViewScenesLength||0}toObject(){return{index:this.index>=this.length?this.length-1:this.index,length:this.length}}}class hw{constructor(t){this.ctx=t,this.reactors=new Map,this.disposers=new Map,this.onPhaseChanged=async i=>{var n,r;i===b.RoomPhase.Reconnecting&&this.ctx.emitter.emit("startReconnect"),i===b.RoomPhase.Connected&&this.phase===b.RoomPhase.Reconnecting&&((n=this.room)!=null&&n.isWritable?(r=this.room)==null||r.dispatchMagixEvent(xo,{}):(await Uh(500),this.onReconnected())),this.phase=i},this.onReconnected=E.debounce(()=>{this._onReconnected()},1e3),this._onReconnected=()=>{et("onReconnected refresh reactors"),this.releaseDisposers(),this.reactors.forEach((i,n)=>{E.isFunction(i)&&this.disposers.set(n,i())}),this.ctx.emitter.emit("onReconnected")}}setRoom(t){this.room=t,this.phase=t==null?void 0:t.phase,t&&(t.callbacks.off("onPhaseChanged",this.onPhaseChanged),t.callbacks.on("onPhaseChanged",this.onPhaseChanged),t.addMagixEventListener(xo,i=>{i.authorId===t.observerId&&this.onReconnected()},{fireSelfEventAfterCommit:!0}))}setContext(t){this.ctx=t}releaseDisposers(){this.disposers.forEach(t=>{E.isFunction(t)&&t()}),this.disposers.clear()}refresh(){this._onReconnected()}add(t,i){const n=this.disposers.get(t);n&&E.isFunction(n)&&n(),E.isFunction(i)&&(this.reactors.set(t,i),this.disposers.set(t,i()))}remove(t){this.reactors.has(t)&&this.reactors.delete(t);const i=this.disposers.get(t);i&&(E.isFunction(i)&&i(),this.disposers.delete(t))}hasReactor(t){return this.reactors.has(t)}destroy(){var t,i;(t=this.room)==null||t.callbacks.off("onPhaseChanged",this.onPhaseChanged),(i=this.room)==null||i.removeMagixEventListener(xo,this.onReconnected),this.releaseDisposers()}}const dw=(e,t)=>{if(b.isPlayer(e))pw(e);else{if(e=e,Object.getOwnPropertyDescriptor(e,"disableCameraTransform"))return;Object.defineProperty(e,"disableCameraTransform",{get(){return t.mainView.disableCameraTransform},set(n){t.mainView.disableCameraTransform=n}}),Object.defineProperty(e,"canUndoSteps",{get(){return t.canUndoSteps}}),Object.defineProperty(e,"canRedoSteps",{get(){return t.canRedoSteps}}),e.moveCamera=n=>t.moveCamera(n),e.moveCameraToContain=(...n)=>t.moveCameraToContain(...n),e.convertToPointInWorld=(...n)=>t.mainView.convertToPointInWorld(...n),e.setCameraBound=(...n)=>t.mainView.setCameraBound(...n),e.scenePreview=(...n)=>t.mainView.scenePreview(...n),e.fillSceneSnapshot=(...n)=>t.mainView.fillSceneSnapshot(...n),e.generateScreenshot=(...n)=>t.mainView.generateScreenshot(...n),e.setMemberState=(...n)=>t.mainView.setMemberState(...n),e.redo=()=>t.redo(),e.undo=()=>t.undo(),e.cleanCurrentScene=()=>t.cleanCurrentScene(),e.delete=()=>t.delete(),e.copy=()=>t.copy(),e.paste=()=>t.paste(),e.duplicate=()=>t.duplicate(),e.insertImage=(...n)=>t.insertImage(...n),e.completeImageUpload=(...n)=>t.completeImageUpload(...n),e.insertText=(...n)=>t.insertText(...n),e.lockImage=(...n)=>t.lockImage(...n),e.lockImages=(...n)=>t.lockImages(...n),fw(e,t)}},fw=(e,t)=>{const i=e.removeScenes;e.removeScenes=(n,r)=>{var o;n===Ue&&((o=t.appManager)==null||o.updateRootDirRemoving(!0));const s=i.call(e,n);return V.emit("removeScenes",{scenePath:n,index:r}),s}},pw=e=>{const t=e.seekToProgressTime;async function i(n){await V.emit("seekStart");const r=await t.call(e,n);return V.emit("seek",n),r}e.seekToProgressTime=i};var gw=`.netless-app-docs-viewer-content{position:relative;height:100%;overflow:hidden}.netless-app-docs-viewer-preview-mask{display:none;position:absolute;z-index:200;top:0;left:0;width:100%;height:100%}.netless-app-docs-viewer-preview{display:flex;flex-direction:column;align-items:center;position:absolute;z-index:300;top:0;left:0;width:33%;max-width:200px;height:100%;padding-top:10px;transform:translate(-100%);background:rgba(237,237,240,.9);box-shadow:inset -1px 0 #0000001c;transition:transform .4s}.netless-app-docs-viewer-preview-active .netless-app-docs-viewer-preview-mask{display:block}.netless-app-docs-viewer-preview-active .netless-app-docs-viewer-preview{transform:translate(0)}.netless-app-docs-viewer-preview-page{position:relative;display:block;width:55%;margin-bottom:10px;font-size:0;color:transparent;outline:none;border:7px solid transparent;border-radius:4px;transition:border-color .3s;user-select:none}.netless-app-docs-viewer-preview-page:hover,.netless-app-docs-viewer-preview-page.netless-app-docs-viewer-preview-page-active{border-color:#444e601a}.netless-app-docs-viewer-preview-page>img{width:100%;height:auto;box-sizing:border-box;border:1px solid rgba(0,0,0,.5);border-radius:1px;background-color:#fff;box-shadow:0 2px 8px #0000004d}.netless-app-docs-viewer-preview-page-name{position:absolute;top:1px;left:-10px;transform:translate(-100%);text-align:right;font-size:12px;color:#5f5f5f;user-select:none}.netless-app-docs-viewer-footer{box-sizing:border-box;height:26px;display:flex;align-items:center;padding:0 16px;border-top:1px solid #eeeef7;color:#191919}.netless-app-docs-viewer-float-footer{width:100%;min-height:26px;position:absolute;left:0;bottom:0;z-index:2000;background:rgba(249,249,252,.9);transition:opacity .4s}.netless-app-docs-viewer-footer-btn{box-sizing:border-box;width:26px;height:26px;font-size:0;margin:0;padding:3px;border:none;border-radius:1px;outline:none;color:currentColor;background:transparent;transition:background .4s;cursor:pointer;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.netless-app-docs-viewer-footer-btn:hover{background:rgba(237,237,240,.9)}@media (hover: none){.netless-app-docs-viewer-footer-btn:hover{background:transparent!important}}.netless-app-docs-viewer-footer-btn>svg{width:100%;height:100%}.netless-app-docs-viewer-footer-btn>svg:nth-of-type(2){display:none}.netless-app-docs-viewer-footer-btn.netless-app-docs-viewer-footer-btn-playing>svg:nth-of-type(1){display:none}.netless-app-docs-viewer-footer-btn.netless-app-docs-viewer-footer-btn-playing>svg:nth-of-type(2){display:initial}.netless-app-docs-viewer-footer-btn~.netless-app-docs-viewer-footer-btn{margin-left:15px}.netless-app-docs-viewer-page-jumps{flex:1;display:flex;justify-content:center;align-items:center}.netless-app-docs-viewer-page-number{margin-left:auto;font-size:13px;user-select:none;white-space:nowrap;word-break:keep-all}.netless-app-docs-viewer-page-number-input{border:none;outline:none;width:3em;margin:0;padding:0 2px;text-align:right;font-size:13px;line-height:1;font-weight:400;font-family:inherit;border-radius:2px;color:currentColor;background:transparent;transition:background .4s;user-select:text;-webkit-tap-highlight-color:rgba(0,0,0,0)}.netless-app-docs-viewer-page-number-input:hover,.netless-app-docs-viewer-page-number-input:focus,.netless-app-docs-viewer-page-number-input:active{background:#fff;box-shadow:#63636333 0 2px 8px}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-footer-btn{cursor:not-allowed}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-footer-btn:hover{background:transparent}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input{cursor:not-allowed}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input:hover,.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input:focus,.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input:active{background:transparent;box-shadow:none}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input:disabled{color:inherit}.netless-app-docs-viewer-readonly.netless-app-docs-viewer-float-footer{display:none}.telebox-color-scheme-dark .netless-app-docs-viewer-page-number-input{color:#a6a6a8}.telebox-color-scheme-dark .netless-app-docs-viewer-page-number-input:active,.telebox-color-scheme-dark .netless-app-docs-viewer-page-number-input:focus,.telebox-color-scheme-dark .netless-app-docs-viewer-page-number-input:hover{color:#222}.telebox-color-scheme-dark .netless-app-docs-viewer-footer{color:#a6a6a8;background:#2d2d33;border-top:none}.telebox-color-scheme-dark .netless-app-docs-viewer-footer-btn:hover{background:#212126}.telebox-color-scheme-dark .netless-app-docs-viewer-preview{background:rgba(50,50,50,.9)}.netless-app-docs-viewer-static-scrollbar{position:absolute;top:0;right:0;z-index:2147483647;width:8px;min-height:30px;margin:0;padding:0;border:none;outline:none;border-radius:4px;background:rgba(68,78,96,.4);box-shadow:1px 1px 8px #ffffffb3;opacity:0;transition:background .4s,opacity .4s 3s,transform .2s;user-select:none}.netless-app-docs-viewer-static-scrollbar.netless-app-docs-viewer-static-scrollbar-dragging{background:rgba(68,78,96,.6);opacity:1;transition:background .4s,opacity .4s 3s!important}.netless-app-docs-viewer-static-scrollbar:hover,.netless-app-docs-viewer-static-scrollbar:focus{background:rgba(68,78,96,.5)}.netless-app-docs-viewer-static-scrollbar:active{background:rgba(68,78,96,.6)}.netless-app-docs-viewer-content:hover .netless-app-docs-viewer-static-scrollbar{opacity:1;transition:background .4s,opacity .4s,transform .2s}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-static-scrollbar{display:none}.netless-app-docs-viewer-static-pages:hover .netless-app-docs-viewer-static-scrollbar{opacity:1;transition:background .4s,opacity .4s,transform .2s}.page-renderer-pages-container{position:relative;overflow:hidden}.page-renderer-page{position:absolute;top:0;left:0;background-position:center;background-size:cover;background-repeat:no-repeat}.page-renderer-pages-container.is-hwa .page-renderer-page{will-change:transform}.page-renderer-page-img{display:block;width:100%;height:auto;user-select:none}.netless-app-docs-viewer-static-pages{overflow:hidden;position:relative;height:100%;user-select:none}.netless-app-docs-viewer-static-page{display:block;width:100%;height:auto;user-select:none}.netless-app-docs-viewer-static-wb-view,.netless-app-docs-viewer-dynamic-wb-view{position:absolute;top:0;left:0;width:100%;height:100%;z-index:100;overflow:hidden}.netless-app-docs-viewer-dynamic-wb-view .cursor-clicker .ppt-event-source{cursor:pointer}
16
+ `;return t}const _r=document.createElement("style");function Fv(e){const[t,i,n]=e.strokeColor,r=((1<<24)+(t<<16)+(i<<8)+n).toString(16).slice(1);return _r.textContent=Hv({"cursor-pencil":ri(Md(r)),"cursor-eraser":ri(Sd),"cursor-rectangle":ri(Ri(r)),"cursor-ellipse":ri(Ri(r)),"cursor-straight":ri(Ri(r)),"cursor-arrow":ri(Ri(r)),"cursor-shape":ri(Ri(r))}),document.head.appendChild(_r),()=>{_r.parentNode!=null&&document.head.removeChild(_r)}}const Qv=new Set([b.ApplianceNames.rectangle,b.ApplianceNames.ellipse,b.ApplianceNames.straight,b.ApplianceNames.arrow,b.ApplianceNames.shape]);function oc(e,t){if(e===b.ApplianceNames.pencil)return Md(t);if(e===b.ApplianceNames.eraser)return Sd;if(Qv.has(e))return Ri(t)}class Zv{constructor(t,i,n,r){this.manager=t,this.memberId=i,this.cursorManager=n,this.wrapper=r,this.style="default",this.move=s=>{var o;if(s.type==="main"){const a=this.cursorManager.wrapperRect;this.component&&a&&(this.autoHidden(),this.moveCursor(s,a,this.manager.mainView))}else{const a=this.cursorManager.focusView,l=(o=a==null?void 0:a.divElement)==null?void 0:o.getBoundingClientRect(),u=a==null?void 0:a.camera;a&&l&&u&&this.component&&(this.autoHidden(),this.moveCursor(s,l,a))}},this.setStyle=s=>{this.style=s,this.component&&this.component.$set({src:this.getIcon(),custom:this.isCustomIcon()})},this.leave=()=>{this.hide()},this.updateMember(),this.createCursor(),this.autoHidden(),this.setStyle(n.style)}moveCursor(t,i,n){var l,u;const{x:r,y:s,type:o}=t,a=n==null?void 0:n.screen.convertPointToScreen(r,s);if(a){let h=a.x-2,c=a.y-18;if(this.isCustomIcon()&&(h-=11,c+=4),o==="app"){const m=this.cursorManager.wrapperRect;m&&(h=h+i.x-m.x,c=c+i.y-m.y)}a.x<0||a.x>i.width||a.y<0||a.y>i.height?(l=this.component)==null||l.$set({visible:!1,x:h,y:c}):(u=this.component)==null||u.$set({visible:!0,x:h,y:c})}}get memberApplianceName(){var t,i;return(i=(t=this.member)==null?void 0:t.memberState)==null?void 0:i.currentApplianceName}get memberColor(){var i,n;return`rgb(${(n=(i=this.member)==null?void 0:i.memberState)==null?void 0:n.strokeColor.join(",")})`}get memberColorHex(){var r,s;const[t,i,n]=((s=(r=this.member)==null?void 0:r.memberState)==null?void 0:s.strokeColor)||[236,52,85];return((1<<24)+(t<<16)+(i<<8)+n).toString(16).slice(1)}get payload(){var t;return(t=this.member)==null?void 0:t.payload}get memberCursorName(){var t,i;return((t=this.payload)==null?void 0:t.nickName)||((i=this.payload)==null?void 0:i.cursorName)||this.memberId}get memberTheme(){var t;return(t=this.payload)!=null&&t.theme?"netless-window-manager-cursor-inner-mellow":"netless-window-manager-cursor-inner"}get memberCursorTextColor(){var t;return((t=this.payload)==null?void 0:t.cursorTextColor)||"#FFFFFF"}get memberCursorTagBackgroundColor(){var t;return((t=this.payload)==null?void 0:t.cursorTagBackgroundColor)||this.memberColor}get memberAvatar(){var t;return(t=this.payload)==null?void 0:t.avatar}get memberOpacity(){return!this.memberCursorName&&!this.memberAvatar?0:1}get memberTagName(){var t;return(t=this.payload)==null?void 0:t.cursorTagName}autoHidden(){this.timer&&clearTimeout(this.timer),this.timer=window.setTimeout(()=>{this.hide()},1e3*10)}async createCursor(){this.member&&this.wrapper&&(this.component=new Wv({target:this.wrapper,props:this.initProps()}))}initProps(){var t;return{uid:this.memberId,x:0,y:0,appliance:this.memberApplianceName,avatar:this.memberAvatar,src:this.getIcon(),custom:this.isCustomIcon(),visible:!1,backgroundColor:this.memberColor,cursorName:this.memberCursorName,theme:this.memberTheme,color:this.memberCursorTextColor,cursorTagBackgroundColor:this.memberCursorTagBackgroundColor,opacity:this.memberOpacity,tagName:this.memberTagName,pencilEraserSize:(t=this.member)==null?void 0:t.memberState.pencilEraserSize}}getIcon(){var l;if(!this.member)return;const{memberApplianceName:t,memberColorHex:i}=this,{userApplianceIcons:n,applianceIcons:r}=this.cursorManager;let s=this.memberApplianceName;s===b.ApplianceNames.pencilEraser&&(s=`${s}${((l=this.member)==null?void 0:l.memberState.pencilEraserSize)||1}`);const o=s&&n[s];if(o)return o;if(this.style==="custom"&&t){const u=oc(t,i);if(u)return u}return r[s||b.ApplianceNames.shape]||r[b.ApplianceNames.shape]}isCustomIcon(){var o;if(!this.member)return!1;const{memberApplianceName:t,memberColorHex:i}=this,{userApplianceIcons:n}=this.cursorManager;let r=this.memberApplianceName;return r===b.ApplianceNames.pencilEraser&&(r=`${r}${((o=this.member)==null?void 0:o.memberState.pencilEraserSize)||1}`),r&&n[r]?!1:!!(this.style==="custom"&&t&&oc(t,i))}updateMember(){return this.member=aa(this.manager.room,this.memberId),this.updateComponent(),this.member}updateComponent(){var t;(t=this.component)==null||t.$set(E.omit(this.initProps(),["x","y"]))}destroy(){this.component&&this.component.$destroy(),this.cursorManager.cursorInstances.delete(this.memberId),this.timer&&clearTimeout(this.timer)}hide(){this.component&&(this.component.$set({visible:!1}),this.destroy())}}var Yv="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAYAAADFeBvrAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAYISURBVHgB7ZpNSCtXFIBPEuvz+dMGpYUKD/sWFX+Qti6kK7Hqpm6e9q0rIoIUFUShPLV10VZx4+JZqa9v20LBhdq9fyBUCtKNPH8qYl2IOw3G38Rkek4y15y5uTOZJDOWggcOSSYzN/ebc+45554JwIM8iBCPyTEP+86T4vyMfsRN4b+nQTKIJp0vzuGvlpID7os8EQNEIBD4oKio6Bm9DwaDv/v9/n/076JgbtWUYPchwrW8qD7UnOvr6wFNkpubm+/wu7f0c7y6mrnlvQufxB0Iau7V1dX3BDA/P6/V1dVpzc3N2uLiIofK1c8VYHys/wRKBUN3/hGHqaysNOjc3FwMis6hc0FtLTHuvYLxCCZgci8uLn4wg5Gh6Fy8Jk+/NkcCAlAAuUkoW4g0B+d5tLS05O/r67O8eGxsDNra2uDy8nKsoKCAwCIQDxQa0yTxgrvCYXyTk5Ml+Orf2dlJeeHIyAigFSE/P38ELfUNqNdSkjgF5FF89jL1TU1NlQwODl5gZPujp6cHWltbUw7Koc7Pz8mkZpHPFeFrJuZeqLnoMoPoZqe0JjDP/IZgnyLUG/o8NDRkuo5Ua2pjY6MC4oFCFf1cA0oKzRSOp6enRfTaGh0d/QxBt+1CUVgnOTs7+xrHfQzGyOcKkK3QTJMnQffZ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hlaWdodD0iMzQiIHZpZXdCb3g9IjAgMCAyNiAzNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3QgeD0iMC41IiB5PSIwLjUiIHdpZHRoPSIyNSIgaGVpZ2h0PSIzMyIgcng9IjMuNSIgZmlsbD0iYmxhY2siIGZpbGwtb3BhY2l0eT0iMC4zNSIgc3Ryb2tlPSJ3aGl0ZSIvPgo8L3N2Zz4K",iw="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzQiIGhlaWdodD0iNTAiIHZpZXdCb3g9IjAgMCAzNCA1MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3QgeD0iMC41IiB5PSIwLjUiIHdpZHRoPSIzMyIgaGVpZ2h0PSI0OSIgcng9IjMuNSIgZmlsbD0iYmxhY2siIGZpbGwtb3BhY2l0eT0iMC4zNSIgc3Ryb2tlPSJ3aGl0ZSIvPgo8L3N2Zz4K";const nw={[b.ApplianceNames.pencil]:Yv,[b.ApplianceNames.selector]:Gv,[b.ApplianceNames.eraser]:Xv,[b.ApplianceNames.shape]:Jv,[b.ApplianceNames.text]:Kv,[b.ApplianceNames.laserPointer]:qv,pencilEraser1:ew,pencilEraser2:tw,pencilEraser3:iw},ac="local-cursor";class mr{constructor(t,i,n,r){var a;this.manager=t,this.enableCursor=i,this.cursorInstances=new Map,this.userApplianceIcons={},this.sideEffectManager=new cr,this.store=this.manager.store,this.leaveFlag=!0,this._style="default",this.onCursorMove=l=>{const u=this.initCursorInstance(l.uid);if(l.state===Ko.Leave)u.leave();else{const h=u.updateMember();this.canMoveCursor(h)&&u.move(l.position)}},this.initCursorInstance=l=>{let u=this.cursorInstances.get(l);return u||(u=new Zv(this.manager,l,this,Q.wrapper),this.cursorInstances.set(l,u)),u},this.mouseMoveListener_=(l,u)=>{const h=this.getType(l);this.updateCursor(h,l.clientX,l.clientY),u&&this.showPencilEraserIfNeeded(h,l.clientX,l.clientY)},this.mouseMoveTimer=0,this.mouseMoveListener=l=>{const u=l.pointerType==="touch";if(u&&!l.isPrimary)return;const h=Date.now();if(h-this.mouseMoveTimer>48){if(this.mouseMoveTimer=h,Q.supportAppliancePlugin&&b.isRoom(Q.displayer)&&Q.displayer.disableDeviceInputs){this.leaveFlag&&(this.manager.dispatchInternalEvent(se.CursorMove,{uid:this.manager.uid,state:Ko.Leave}),this.leaveFlag=!1);return}this.mouseMoveListener_(l,u),this.leaveFlag=!0}},this.mouseLeaveListener=()=>{this.hideCursor(this.manager.uid)},this.getPoint=(l,u,h)=>{var m;const c=(m=l==null?void 0:l.divElement)==null?void 0:m.getBoundingClientRect();if(c)return l==null?void 0:l.convertToPointInWorld({x:u-c.x,y:h-c.y})},this.getType=l=>{var c;const u=l.target,h=this.manager.focusApp;switch(u.parentElement){case this.mainViewElement:return{type:"main"};case((c=h==null?void 0:h.view)==null?void 0:c.divElement):return{type:"app"};default:return{type:"main"}}},this.roomMembers=(a=this.manager.room)==null?void 0:a.state.roomMembers;const s=Q.wrapper;s&&this.setupWrapper(s),this.sideEffectManager.add(()=>V.on("cursorMove",this.onCursorMove)),this.sideEffectManager.add(()=>V.on("playgroundSizeChange",()=>this.updateContainerRect()));const o=this.manager.room;o&&this.sideEffectManager.add(()=>{const l=u=>{this.style==="custom"&&u.memberState&&this.enableCustomCursor()};return o.callbacks.on("onRoomStateChanged",l),()=>o.callbacks.off("onRoomStateChanged",l)}),r&&(this.userApplianceIcons=r),this.style=(n==null?void 0:n.style)||"default"}get applianceIcons(){return{...nw,...this.userApplianceIcons}}get style(){return this._style}set style(t){this._style!==t&&(this._style=t,this.cursorInstances.forEach(i=>{i.setStyle(t)}),t==="custom"?this.enableCustomCursor():this.sideEffectManager.flush(ac))}enableCustomCursor(){this.sideEffectManager.add(()=>Fv(this.manager.getMemberState()),ac)}canMoveCursor(t){const i=(t==null?void 0:t.memberState.currentApplianceName)===b.ApplianceNames.laserPointer;return this.enableCursor||i}setupWrapper(t){this.sideEffectManager.add(()=>(t.addEventListener("pointerenter",this.mouseMoveListener),t.addEventListener("pointermove",this.mouseMoveListener),t.addEventListener("pointerleave",this.mouseLeaveListener),()=>{t.removeEventListener("pointerenter",this.mouseMoveListener),t.removeEventListener("pointermove",this.mouseMoveListener),t.removeEventListener("pointerleave",this.mouseLeaveListener)})),this.wrapperRect=t.getBoundingClientRect()}setMainViewDivElement(t){this.mainViewElement=t}get boxState(){return this.store.getBoxState()}get focusView(){var t;return(t=this.manager.focusApp)==null?void 0:t.view}showPencilEraserIfNeeded(t,i,n){const r=aa(this.manager.room,this.manager.uid),s=(r==null?void 0:r.memberState.currentApplianceName)===b.ApplianceNames.pencilEraser;if(this.wrapperRect&&this.manager.canOperate&&this.canMoveCursor(r)&&s){const o=t.type==="main"?this.manager.mainView:this.focusView,a=this.getPoint(o,i,n);a&&this.onCursorMove({uid:this.manager.uid,position:{x:a.x,y:a.y,type:t.type}})}}updateCursor(t,i,n){const r=aa(this.manager.room,this.manager.uid);if(this.wrapperRect&&this.manager.canOperate&&this.canMoveCursor(r)){const s=t.type==="main"?this.manager.mainView:this.focusView,o=this.getPoint(s,i,n);o&&this.manager.dispatchInternalEvent(se.CursorMove,{uid:this.manager.uid,position:{x:o.x,y:o.y,type:t.type}})}}updateContainerRect(){var t,i;this.containerRect=(t=Q.container)==null?void 0:t.getBoundingClientRect(),this.wrapperRect=(i=Q.wrapper)==null?void 0:i.getBoundingClientRect()}deleteCursor(t){this.store.cleanCursor(t);const i=this.cursorInstances.get(t);i&&i.destroy()}hideCursor(t){const i=this.cursorInstances.get(t);i&&i.hide()}destroy(){this.sideEffectManager.flushAll(),this.cursorInstances.size&&(this.cursorInstances.forEach(t=>{t.destroy()}),this.cursorInstances.clear())}}mr.kind="CursorManager";function Tt(e,t){if(e.kind&&t&&Object.keys(t).includes(e.kind))switch(e.kind){case"AppManager":return(t==null?void 0:t.AppManager)||yr;case"BoxManager":return(t==null?void 0:t.BoxManager)||pr;case"AttributesDelegate":return(t==null?void 0:t.AttributesDelegate)||vr;case"CursorManager":return(t==null?void 0:t.CursorManager)||mr;case"AppProxy":return(t==null?void 0:t.AppProxy)||wr;case"AppContext":return(t==null?void 0:t.AppContext)||hr;case"TeleBoxManager":return(t==null?void 0:t.TeleBoxManager)||fr;case"TeleBoxCollector":return(t==null?void 0:t.TeleBoxCollector)||un;default:return e}return e}var xe=(e=>(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.BoxesStatus="boxesStatus",e.LastNotMinimizedBoxesStatus="lastNotMinimizedBoxesStatus",e))(xe||{});class vr{constructor(t){this.context=t,this.setAppFocus=(i,n)=>{n?this.context.safeSetAttributes({focus:i}):this.context.safeSetAttributes({focus:void 0})}}setContext(t){this.context=t}get attributes(){return this.context.getAttributes()}apps(){return E.get(this.attributes,["apps"])}get focus(){return E.get(this.attributes,["focus"])}getAppAttributes(t){return E.get(this.apps(),[t])}getAppState(t){return E.get(this.apps(),[t,"state"])}getMaximized(){return E.get(this.attributes,["maximized"])}getMinimized(){return E.get(this.attributes,["minimized"])}getBoxesStatus(){return E.get(this.attributes,["boxesStatus"])}getBoxStatus(t){return E.get(this.attributes,["boxesStatus",t])}setBoxStatus(t,i){this.attributes.boxesStatus||this.context.safeSetAttributes({boxesStatus:{}}),this.getBoxStatus(t)!==i&&this.context.safeUpdateAttributes(["boxesStatus",t],i)}getLastNotMinimizedBoxesStatus(){return E.get(this.attributes,["lastNotMinimizedBoxesStatus"])}getLastNotMinimizedBoxStatus(t){return E.get(this.attributes,["lastNotMinimizedBoxesStatus",t])}setLastNotMinimizedBoxStatus(t,i){this.attributes.lastNotMinimizedBoxesStatus||this.context.safeSetAttributes({lastNotMinimizedBoxesStatus:{}}),this.getLastNotMinimizedBoxStatus(t)!==i&&this.context.safeUpdateAttributes(["lastNotMinimizedBoxesStatus",t],i)}setupAppAttributes(t,i,n){this.attributes.apps||this.context.safeSetAttributes({apps:{}});const s=["scenePath","title"];n||s.push("scenes");const o=E.pick(t.options,s),a={kind:t.kind,options:o,isDynamicPPT:n,forceTop:t.forceTop,forceNormal:t.forceNormal,isDragContent:t.isDragContent};typeof t.src=="string"&&(a.src=t.src),a.createdAt=Date.now(),this.context.safeUpdateAttributes(["apps",i],a),this.context.safeUpdateAttributes(["apps",i,"state"],{[Be.Size]:{},[Be.Position]:{},[Be.SceneIndex]:0})}updateAppState(t,i,n){E.get(this.attributes,["apps",t,"state"])&&this.context.safeUpdateAttributes(["apps",t,"state",i],n)}cleanAppAttributes(t){this.context.safeUpdateAttributes(["apps",t],void 0),this.context.safeSetAttributes({[t]:void 0}),this.attributes.focus===t&&this.cleanFocus()}cleanFocus(){this.context.safeSetAttributes({focus:void 0})}getAppSceneIndex(t){var i;return(i=this.getAppState(t))==null?void 0:i[Be.SceneIndex]}getAppScenePath(t){var i,n;return(n=(i=this.getAppAttributes(t))==null?void 0:i.options)==null?void 0:n.scenePath}getMainViewScenePath(){return this.attributes._mainScenePath}getMainViewSceneIndex(){return this.attributes._mainSceneIndex}getBoxState(){return this.attributes.boxState}setMainViewScenePath(t){this.context.safeSetAttributes({_mainScenePath:t})}setMainViewSceneIndex(t){this.context.safeSetAttributes({_mainSceneIndex:t})}getMainViewCamera(){return E.get(this.attributes,["mainViewCamera"])}getMainViewSize(){return E.get(this.attributes,["mainViewSize"])}setMainViewCamera(t){this.context.safeSetAttributes({mainViewCamera:{...t}})}setMainViewSize(t){t.width===0||t.height===0||this.context.safeSetAttributes({mainViewSize:{...t}})}setMainViewCameraAndSize(t,i){i.width===0||i.height===0||this.context.safeSetAttributes({mainViewCamera:{...t},mainViewSize:{...i}})}updateCursor(t,i){E.get(this.attributes,["cursors"])||this.context.safeUpdateAttributes(["cursors"],{}),E.get(this.attributes,["cursors",t])||this.context.safeUpdateAttributes(["cursors",t],{}),this.context.safeUpdateAttributes(["cursors",t,"position"],i)}updateCursorState(t,i){E.get(this.attributes,["cursors",t])||this.context.safeUpdateAttributes(["cursors",t],{}),this.context.safeUpdateAttributes(["cursors",t,"cursorState"],i)}getCursorState(t){return E.get(this.attributes,["cursors",t,"cursorState"])}cleanCursor(t){this.context.safeUpdateAttributes(["cursors",t],void 0)}setMainViewFocusPath(t){const i=this.getMainViewScenePath();i&&yi(t,i)}getIframeBridge(){return E.get(this.attributes,["iframeBridge"])}setIframeBridge(t){if(E.isObject(t)){const i=this.getIframeBridge();for(const n in t){const r=t[n];i[n]!==r&&this.context.safeUpdateAttributes(["iframeBridge",n],r)}}}}vr.kind="AttributesDelegate";const rw=(e,t={getAttributes:()=>{throw new Error("getAttributes not implemented")},safeSetAttributes:()=>{throw new Error("safeSetAttributes not implemented")},safeUpdateAttributes:()=>{throw new Error("safeUpdateAttributes not implemented")}})=>{const i=Tt(vr,e);return new i(t)},Ml=(e,t)=>{let i=0;const n=t.length-1;return e===t.index?e===n?i=e-1:i=t.index+1:i=t.index,i},lt=new bi.default,Id=class{constructor(e,t,i,n){var r;this.params=e,this.manager=t,this.boxManager=this.manager.boxManager,this.appProxies=this.manager.appProxies,this.viewManager=this.manager.viewManager,this.store=this.manager.store,this.status="normal",this.getAppInitState=s=>{var y,S,T,k;const o=this.store.getAppState(s);if(!o)return;const a=o==null?void 0:o[Be.Position],l=this.store.focus,u=o==null?void 0:o[Be.Size],h=o==null?void 0:o[Be.SceneIndex],c=(y=this.attributes)==null?void 0:y.maximized,m=(S=this.attributes)==null?void 0:S.minimized,v=(T=this.store.getBoxStatus(s))!=null?T:void 0,w=(k=this.store.getLastNotMinimizedBoxStatus(s))!=null?k:void 0,{forceTop:x,forceNormal:d,isDragContent:f}=this.store.getAppAttributes(s),g=o==null?void 0:o.zIndex;let p={maximized:c,minimized:m,zIndex:g};return a&&(p={...p,id:s,x:a.x,y:a.y}),l===s&&(p={...p,focus:!0}),u&&(p={...p,width:u.width,height:u.height}),h&&(p={...p,sceneIndex:h}),v&&(p={...p,boxStatus:v}),w&&(p={...p,lastNotMinimizedBoxStatus:w}),x&&(p={...p,forceTop:x}),d&&(p={...p,forceNormal:d}),f&&(p={...p,isDragContent:f}),p},this.appAttributesUpdateListener=s=>{this.manager.refresher.add(s,()=>b.autorun(()=>{const o=this.manager.attributes[s];o&&this.appEmitter.emit("attributesUpdate",o)})),this.manager.refresher.add(this.stateKey,()=>b.autorun(()=>{var a,l,u,h;const o=(a=this.appAttributes)==null?void 0:a.state;(o==null?void 0:o.zIndex)>0&&o.zIndex!==((l=this.box)==null?void 0:l.zIndex)&&((u=this.boxManager)==null||u.setZIndex(s,o.zIndex),(h=this.boxManager)==null||h.focusBox({appId:s}))})),this.manager.refresher.add(`${s}-fullPath`,()=>b.autorun(()=>{var a;const o=(a=this.appAttributes)==null?void 0:a.fullPath;this.setFocusScenePathHandler(o),this._prevFullPath!==o&&(this.notifyPageStateChange(),this._prevFullPath=o)}))},this.setFocusScenePathHandler=E.debounce(s=>{var o;this.view&&s&&s!==((o=this.view)==null?void 0:o.focusScenePath)&&(yi(this.view,s),G.emit("onAppScenePathChange",{appId:this.id,view:this.view}))},50),this.notifyPageStateChange=E.debounce(()=>{this.appEmitter.emit("pageStateChange",this.pageState)},50),this.notifyBoxStatusChange=s=>{this.appEmitter.emit("boxStatusChange",{appId:this.id,status:s})},this.kind=e.kind,this.id=i,this.stateKey=`${this.id}_state`,this.appProxies.set(this.id,this),this.appEmitter=new bi.default,this.appListener=this.makeAppEventListener(this.id),this.isAddApp=n,this.initScenes(),(r=this.params.options)!=null&&r.scenePath&&this.createView(),this._pageState=new gm({displayer:this.manager.displayer,scenePath:this.scenePath,view:this.view,notifyPageStateChange:this.notifyPageStateChange})}initScenes(){var t;const e=this.params.options;e&&(this.scenePath=e.scenePath,((t=this.appAttributes)==null?void 0:t.isDynamicPPT)&&this.scenePath?this.scenes=qi(this.manager.displayer)[this.scenePath]:this.scenes=e.scenes)}get view(){return this.manager.viewManager.getView(this.id)}get viewIndex(){var e;return(e=this.view)==null?void 0:e.focusSceneIndex}get isWritable(){var e;return this.manager.canOperate&&!((e=this.box)!=null&&e.readonly)}get attributes(){return this.manager.attributes[this.id]}get appAttributes(){return this.store.getAppAttributes(this.id)}getFullScenePath(){if(this.scenePath)return E.get(this.appAttributes,[xe.FullPath])||this.getFullScenePathFromScenes()}getFullScenePathFromScenes(){const e=E.get(this.appAttributes,["state","SceneIndex"],0),t=rm(this.manager.room,this.scenePath,e);return t&&this.setFullPath(t),t}setFullPath(e){this.manager.safeUpdateAttributes(["apps",this.id,xe.FullPath],e)}async baseInsertApp(e=!1,t=N.Normal){var s;const i=this.params;if(!i.kind)throw new Error("[WindowManager]: kind require");const n=await((s=Ae.appClasses.get(i.kind))==null?void 0:s()),r=Ae.registered.get(i.kind);if(n)await this.setupApp(this.id,e,n,i.options,r==null?void 0:r.appOptions,this.manager.useBoxesStatus?t:void 0,i.forceTop,i.forceNormal,i.isDragContent);else throw new Error(`[WindowManager]: app load failed ${i.kind} ${i.src}`);return V.emit("updateManagerRect"),{appId:this.id,app:n}}get box(){var e;return(e=this.boxManager)==null?void 0:e.getBox(this.id)}async setupApp(e,t,i,n,r,s,o,a,l){var c;if(et("setupApp",e,i,n,s,o,a,l),!this.boxManager)throw new Zh;const u=Tt(hr,Q.extendClass),h=new u(this.manager,this.boxManager,e,this,r);this.appContext=h;try{V.once(`${e}${se.WindowCreated}`).then(async()=>{var w;let m;t||(m=this.getAppInitState(e),(w=this.boxManager)==null||w.updateBoxState(m)),this.appEmitter.onAny(this.appListener),this.appAttributesUpdateListener(e),this.setViewFocusScenePath();let v;this.manager.isReplay&&(v=this.manager.mainView.scenePath),setTimeout(async()=>{console.log("setup app",i);const x=await i.setup(h);this.appResult=x,Ae.notifyApp(this.kind,"created",{appId:e,result:x}),this.afterSetupApp(m),this.fixMobileSize(),v&&this.manager.mainViewProxy.setFocusScenePath(v),G.emit("onAppSetup",e)},Oh)}),(c=this.boxManager)==null||c.createBox({appId:e,app:i,options:n,canOperate:this.manager.canOperate,smartPosition:this.isAddApp,boxStatus:s,forceTop:o,forceNormal:a,isDragContent:l}),this.isAddApp&&this.box&&(s&&this.store.setBoxStatus(e,s),this.store.updateAppState(e,Be.ZIndex,this.box.zIndex),this.store.updateAppState(e,Be.Size,{width:this.box.intrinsicWidth,height:this.box.intrinsicHeight}),this.boxManager.focusBox({appId:e},!1))}catch(m){throw console.error(m),new Error(`[WindowManager]: app setup error: ${m.message}`)}}fixMobileSize(){var t,i;const e=(t=this.boxManager)==null?void 0:t.getBox(this.id);e&&((i=this.boxManager)==null||i.resizeBox({appId:this.id,width:e.intrinsicWidth+.001,height:e.intrinsicHeight+.001,skipUpdate:!0}))}afterSetupApp(e){var t;e&&(!(e!=null&&e.x)||!e.y)&&((t=this.boxManager)==null||t.setBoxInitState(this.id))}async onSeek(e){var i;this.appEmitter.emit("seek",e).catch(n=>{console.log(`[WindowManager]: emit seek error: ${n.message}`)});const t=this.getAppInitState(this.id);(i=this.boxManager)==null||i.updateBoxState(t)}async onReconnected(){var s;if(!Boolean(this.manager.attributes.apps[this.id])){await this.destroy(!0,!1,!0);return}this.appEmitter.emit("reconnected",void 0);const t=this.getAppInitState(this.id);await this.destroy(!0,!1,!0);const i=this.params,n=Tt(Id,Q.extendClass);await new n(i,this.manager,this.id,this.isAddApp).baseInsertApp(!0,t==null?void 0:t.boxStatus),(s=this.boxManager)==null||s.updateBoxState(t)}async onRemoveScene(e){if(this.scenePath&&e.startsWith(this.scenePath+"/")){let t=this.pageState.index,i=this._pageState.getFullPath(t);i||(t=0,i=this._pageState.getFullPath(t)),i&&this.setFullPath(i),this.setViewFocusScenePath(),this.view&&(this.view.focusSceneIndex=t)}}emitAppSceneStateChange(e){this.appEmitter.emit("sceneStateChange",e)}emitAppIsWritableChange(){this.appEmitter.emit("writableChange",this.isWritable)}makeAppEventListener(e){return(t,i)=>{var n,r,s,o;if(!!this.manager.canOperate)switch(t){case"setBoxSize":{(n=this.boxManager)==null||n.resizeBox({appId:e,width:i.width,height:i.height,skipUpdate:!1});break}case"setBoxMinSize":{(r=this.boxManager)==null||r.setBoxMinSize({appId:e,minWidth:i.minwidth,minHeight:i.minheight});break}case"setBoxTitle":{(s=this.boxManager)==null||s.setBoxTitle({appId:e,title:i.title});break}case _h.destroy:{if(this.status==="destroyed")return;this.destroy(!0,!1,!0,i==null?void 0:i.error),i!=null&&i.error&&console.error(i==null?void 0:i.error);break}case"focus":{(o=this.boxManager)==null||o.focusBox({appId:this.id}),lt.emit("focus",{appId:this.id});break}}}}setScenePath(){if(!this.manager.canOperate)return;const e=this.getFullScenePath();this.manager.room&&e&&this.view&&qo(this.manager.room,e)}setViewFocusScenePath(){const e=this.getFullScenePath();return e&&this.view&&yi(this.view,e),e}async createView(){const e=await this.viewManager.createView(this.id);return this.setViewFocusScenePath(),e}get pageState(){return this._pageState.toObject()}async removeSceneByIndex(e){const t=this._pageState.getFullPath(e);if(t){const i=Ml(e,this.pageState);return this.setSceneIndexWithoutSync(i),this.manager.dispatchInternalEvent(se.SetAppFocusIndex,{type:"app",appID:this.id,index:i}),setTimeout(()=>{ea(this.manager.room,t,e)},100),!0}else return!1}setSceneIndexWithoutSync(e){this.view&&(this.view.focusSceneIndex=e)}setSceneIndex(e){if(this.view){this.view.focusSceneIndex=e;const t=this._pageState.getFullPath(e);t&&this.setFullPath(t)}}async destroy(e,t,i,n){var r;if(this.status!=="destroyed"){this.status="destroyed";try{await Ae.notifyApp(this.kind,"destroy",{appId:this.id}),await this.appEmitter.emit("destroy",{error:n})}catch(s){console.error("[WindowManager]: notifyApp error",s.message,s.stack)}this.appEmitter.clearListeners(),V.emit(`destroy-${this.id}`,{error:n}),e&&((r=this.boxManager)==null||r.closeBox(this.id,i)),t&&(this.store.cleanAppAttributes(this.id),this.scenePath&&ea(this.manager.room,this.scenePath)),this.appProxies.delete(this.id),this._pageState.destroy(),this.viewManager.destroyView(this.id),this.manager.appStatus.delete(this.id),this.manager.refresher.remove(this.id),this.manager.refresher.remove(this.stateKey),this.manager.refresher.remove(`${this.id}-fullPath`),this._prevFullPath=void 0}}close(){return this.destroy(!0,!0,!1)}};let wr=Id;wr.kind="AppProxy";class sw{constructor(t){this.displayer=t,this.views=new Map}createView(t){const i=Cd(this.displayer);return this.views.set(t,i),i}getView(t){return this.views.get(t)}destroyView(t){const i=this.views.get(t);if(i){try{i.release()}catch{}this.views.delete(t)}}setViewScenePath(t,i){const n=this.views.get(t);n&&(n.focusScenePath=i)}destroy(){this.views.forEach(t=>{try{t.release()}catch{}}),this.views.clear()}}const Cd=e=>{const t=e.views.createView();return ow(t),t},ow=e=>{e.setCameraBound({maxContentMode:()=>10,minContentMode:()=>.1})};class aw{constructor(t){this.manager=t,this.polling=!1,this.started=!1,this.mainViewIsAddListener=!1,this.store=this.manager.store,this.viewMode=this.manager.windowManger.viewMode,this.sideEffectManager=new cr,this.syncCamera=()=>{if(!this.polling||this.viewMode!==b.ViewMode.Broadcaster)return;const{mainViewCamera:n}=this;n&&n.id!==this.manager.uid&&this.moveCameraSizeByAttributes()},this.startListenWritableChange=()=>{this.sideEffectManager.add(()=>V.on("writableChange",n=>{n&&this.ensureCameraAndSize(),this.manager.room&&this.syncMainView(this.manager.room)}))},this.addCameraReaction=()=>{this.manager.refresher.add(xe.MainViewCamera,this.cameraReaction)},this.cameraReaction=()=>b.reaction(()=>this.mainViewCamera,n=>{n&&n.id!==this.manager.uid&&(this.moveCameraToContian(this.mainViewSize),this.moveCamera(n))},{fireImmediately:!0}),this.sizeChangeHandler=E.debounce(n=>{n&&(this.moveCameraToContian(n),this.moveCamera(this.mainViewCamera)),this.ensureMainViewSize()},30),this.onUpdateContainerSizeRatio=()=>{const n=this.store.getMainViewSize();this.sizeChangeHandler(n)},this.onCameraUpdatedByDevice=n=>{this.viewMode!==b.ViewMode.Follower&&(this.store.setMainViewCamera({...n,id:this.manager.uid}),E.isEqual(this.mainViewSize,{...this.mainView.size,id:this.manager.uid})||this.setMainViewSize(this.view.size))},this.mainViewClickListener=()=>{this.mainViewClickHandler()},this.setMainViewSize=E.debounce(n=>{this.store.setMainViewSize({...n,id:this.manager.uid})},50),this._syncMainViewTimer=0,this.onCameraOrSizeUpdated=()=>{G.emit("cameraStateChange",this.cameraState),this.manager.room&&this.manager.room.syncMainView&&(clearTimeout(this._syncMainViewTimer),this._syncMainViewTimer=setTimeout(this.syncMainView,100,this.manager.room)),this.ensureMainViewSize()},this.syncMainView=n=>{n.isWritable&&n.syncMainView(this.mainView)},this.setViewMode=n=>{this.viewMode=n},this.mainView=this.createMainView(),this.moveCameraSizeByAttributes(),V.once("mainViewMounted").then(()=>{this.addMainViewListener(),this.start(),this.ensureCameraAndSize(),this.startListenWritableChange()});const i=()=>{this.sizeChangeHandler(this.mainViewSize)};this.sideEffectManager.add(()=>V.on("playgroundSizeChange",i)),this.sideEffectManager.add(()=>V.on("containerSizeRatioUpdate",this.onUpdateContainerSizeRatio)),this.sideEffectManager.add(()=>V.on("startReconnect",()=>{this.didRelease||this.mainView.release()})),this.sideEffectManager.setInterval(this.syncCamera,1500)}ensureCameraAndSize(){this.viewMode===b.ViewMode.Broadcaster&&(!this.mainViewCamera||!this.mainViewSize)&&(this.manager.dispatchInternalEvent(se.InitMainViewCamera),this.setCameraAndSize())}get mainViewCamera(){return this.store.getMainViewCamera()}get mainViewSize(){return this.store.getMainViewSize()}get didRelease(){return E.get(this.view,["didRelease"])}moveCameraSizeByAttributes(){this.moveCameraToContian(this.mainViewSize),this.moveCamera(this.mainViewCamera)}start(){this.sizeChangeHandler(this.mainViewSize),!this.started&&(this.addCameraListener(),this.addCameraReaction(),this.manager.room&&this.syncMainView(this.manager.room),this.started=!0)}setCameraAndSize(){const t={...this.mainView.camera,id:this.manager.uid},i={...this.mainView.size,id:this.manager.uid};this.store.setMainViewCameraAndSize(t,i)}get view(){return this.mainView}get cameraState(){return{...this.view.camera,...this.view.size}}createMainView(){const t=Cd(this.manager.displayer),i=this.store.getMainViewScenePath();return i&&yi(t,i),t}onReconnect(){if(this.didRelease)this.rebind();else{const t=this.store.getMainViewScenePath();this.setFocusScenePath(t)}}setFocusScenePath(t){if(t)return yi(this.view,t)}rebind(){const t=this.mainView.divElement,i=this.mainView.disableCameraTransform;this.stop(),this.didRelease||this.mainView.release(),this.removeMainViewListener(),this.mainView=this.createMainView(),this.mainView.disableCameraTransform=i,this.mainView.divElement=t,this.addMainViewListener(),this.start(),G.emit("onMainViewRebind",this.mainView)}addMainViewListener(){this.mainViewIsAddListener||this.view.divElement&&(this.view.divElement.addEventListener("click",this.mainViewClickListener),this.view.divElement.addEventListener("touchend",this.mainViewClickListener),this.mainViewIsAddListener=!0)}removeMainViewListener(){this.view.divElement&&(this.view.divElement.removeEventListener("click",this.mainViewClickListener),this.view.divElement.removeEventListener("touchend",this.mainViewClickListener)),this.mainViewIsAddListener=!1}async mainViewClickHandler(){var t;!this.manager.canOperate||(this.store.cleanFocus(),(t=this.manager.boxManager)==null||t.blurAllBox())}addCameraListener(){this.view.callbacks.on("onCameraUpdatedByDevice",this.onCameraUpdatedByDevice),this.view.callbacks.on("onCameraUpdated",this.onCameraOrSizeUpdated),this.view.callbacks.on("onSizeUpdated",this.onCameraOrSizeUpdated)}removeCameraListener(){this.view.callbacks.off("onCameraUpdatedByDevice",this.onCameraUpdatedByDevice),this.view.callbacks.off("onCameraUpdated",this.onCameraOrSizeUpdated),this.view.callbacks.off("onSizeUpdated",this.onCameraOrSizeUpdated)}ensureMainViewSize(){(!this.mainViewSize||this.mainViewSize.width===0||this.mainViewSize.height===0)&&this.mainView.size.width>0&&this.mainView.size.height>0&&this.setMainViewSize(this.mainView.size)}moveCameraToContian(t){E.isEmpty(t)||(this.view.moveCameraToContain({width:t.width,height:t.height,originX:-t.width/2,originY:-t.height/2,animationMode:b.AnimationMode.Immediately}),this.scale=this.view.camera.scale)}moveCamera(t){if(!E.isEmpty(t)){if(E.isEqual(t,this.view.camera))return;const{centerX:i,centerY:n,scale:r}=t,s=r*(this.scale||1);this.view.moveCamera({centerX:i,centerY:n,scale:s,animationMode:b.AnimationMode.Immediately})}}stop(){this.removeCameraListener(),this.manager.refresher.remove(xe.MainViewCamera),this.manager.refresher.remove(xe.MainViewSize),this.started=!1}destroy(){this.removeMainViewListener(),this.stop(),this.sideEffectManager.flushAll()}}class lw{constructor(t){this.context=t,this.addRedoUndoListeners=i=>{if(i===void 0)this.addViewCallbacks(this.context.mainView(),this.onCanRedoStepsUpdate,this.onCanUndoStepsUpdate);else{const n=this.context.getAppProxy(i);n&&n.view&&this.addViewCallbacks(n.view,this.onCanRedoStepsUpdate,this.onCanUndoStepsUpdate)}},this.addViewCallbacks=(i,n,r)=>{n(i.canRedoSteps),r(i.canUndoSteps),i.callbacks.on("onCanRedoStepsUpdate",n),i.callbacks.on("onCanUndoStepsUpdate",r)},this.disposeViewCallbacks=i=>{i.callbacks.off("onCanRedoStepsUpdate",this.onCanRedoStepsUpdate),i.callbacks.off("onCanUndoStepsUpdate",this.onCanUndoStepsUpdate)},this.onCanRedoStepsUpdate=i=>{G.emit("canRedoStepsChange",i)},this.onCanUndoStepsUpdate=i=>{G.emit("canUndoStepsChange",i)},this.disposePrevFocusViewRedoUndoListeners=i=>{let n;if(i===void 0)n=this.context.mainView();else{const r=this.context.getAppProxy(i);r&&r.view&&(n=r.view)}n&&this.disposeViewCallbacks(n)},V.on("focusedChange",i=>{this.disposePrevFocusViewRedoUndoListeners(i.prev),setTimeout(()=>{this.addRedoUndoListeners(i.focused)},0)}),V.on("rootDirRemoved",()=>{this.disposePrevFocusViewRedoUndoListeners(t.focus()),this.addRedoUndoListeners(t.focus())}),this.addRedoUndoListeners(t.focus())}destroy(){this.disposePrevFocusViewRedoUndoListeners(this.context.focus())}}class yr{constructor(t){this.windowManger=t,this.appProxies=new Map,this.appStatus=new Map,this.isReplay=this.windowManger.isReplay,this.mainViewScenesLength=0,this.callbacksNode=null,this.appCreateQueue=new $g,this.sideEffectManager=new cr,this.sceneState=null,this.rootDirRemoving=!1,this._useBoxesStatus=!1,this.onRemoveScenes=async i=>{var r,s;const{scenePath:n}=i;if(n===Ue){await this.onRootDirRemoved(),this.dispatchInternalEvent(se.RootDirRemoved);return}if(um(n)){let o=this.mainView.focusSceneIndex||0,a=(r=this.callbacksNode)==null?void 0:r.scenes[o];a||(o=0,a=(s=this.callbacksNode)==null?void 0:s.scenes[o]),a&&this.setMainViewScenePath(`${Ue}${a}`),await this.setMainViewSceneIndex(o)}else this.appProxies.forEach(o=>{o.onRemoveScene(n)})},this.onReadonlyChanged=()=>{this.appProxies.forEach(i=>{i.emitAppIsWritableChange()})},this.onPlayerSeekStart=async()=>{await this.closeAll()},this.onPlayerSeekDone=async i=>{await this._attributesUpdateCallback(this.attributes.apps),this.appProxies.forEach(n=>{n.onSeek(i)})},this.createRootDirScenesCallback=()=>{let i=!1;this.callbacksNode&&(this.callbacksNode.dispose(),i=!0),this.callbacksNode=this.displayer.createScenesCallback(Ue,{onAddScene:this.onSceneChange,onRemoveScene:async(n,r)=>{await this.onSceneChange(n),V.emit("rootDirSceneRemoved",r)}}),this.callbacksNode&&(this.updateSceneState(this.callbacksNode),this.mainViewScenesLength=this.callbacksNode.scenes.length,i&&this.emitMainViewScenesChange(this.callbacksNode.scenes.length))},this.removeSceneByIndex=async i=>{var s;const n=Ml(i,this.windowManger.pageState);this.setSceneIndexWithoutSync(n),this.dispatchInternalEvent(se.SetAppFocusIndex,{type:"main",index:n});const r=(s=this.callbacksNode)==null?void 0:s.scenes[i];return setTimeout(()=>{r&&ea(this.room,`${Ue}${r}`,i)},100),new Promise((o,a)=>{V.once("rootDirSceneRemoved").then(l=>{l===r&&o(!0)}).catch(l=>{console.log(`[WindowManager]: removePage error: ${l}`),a(!1)})})},this.setSceneIndexWithoutSync=i=>{var r;const n=(r=this.callbacksNode)==null?void 0:r.scenes[i];n&&this.mainViewProxy.setFocusScenePath(`${Ue}${n}`)},this.onSceneChange=i=>(this.mainViewScenesLength=i.scenes.length,this.updateSceneState(i),this.emitMainViewScenesChange(this.mainViewScenesLength)),this.emitMainViewScenesChange=i=>Promise.all([G.emit("mainViewScenesLengthChange",i),V.emit("changePageState")]),this.updateSceneState=i=>{const n=this.store.getMainViewSceneIndex()||0;let r=i.scenes[n];r||(r=i.scenes[this.mainView.focusSceneIndex||0]),this.sceneState={scenePath:`${Ue}${r}`,contextPath:i.path,index:n,scenes:i.scenes.map(s=>({name:s})),sceneName:r},G.emit("sceneStateChange",this.sceneState)},this.onBoxMove=i=>{this.dispatchInternalEvent(se.AppMove,i),this.store.updateAppState(i.appId,Be.Position,{x:i.x,y:i.y}),G.emit("onBoxMove",i)},this.onBoxResize=i=>{i.width&&i.height&&(this.dispatchInternalEvent(se.AppResize,i),this.store.updateAppState(i.appId,Be.Size,{width:i.width,height:i.height}),G.emit("onBoxResize",i))},this.onBoxFocus=i=>{this.windowManger.safeSetAttributes({focus:i.appId}),G.emit("onBoxFocus",i)},this.onBoxBlurred=i=>{this.attributes.focus===i.appId&&(this.windowManger.safeSetAttributes({focus:void 0}),G.emit("onBoxBlurred",i))},this.onBoxClose=i=>{const n=this.appProxies.get(i.appId);n&&n.destroy(!1,!0,!0,i.error),G.emit("onBoxClose",i)},this.onBoxStateChange=i=>{this.dispatchInternalEvent(se.AppBoxStateChange,i),G.emit("onBoxStateChange",i)},this.notifyBoxesStatusChange=E.debounce(()=>{var n;(n=this.boxManager)==null||n.setBoxesStatus(this.attributes.boxesStatus);const i=Object.entries(this.attributes.boxesStatus);i.length>0&&i.forEach(([r,s])=>{const o=this.appProxies.get(r);o&&o.notifyBoxStatusChange(s)})},100),this.addBoxesStatusChangeListener=()=>{this.refresher.add("boxesStatus",()=>Nn(()=>this.attributes.boxesStatus,()=>{this.notifyBoxesStatusChange()})),this.refresher.add("lastNotMinimizedBoxesStatus",()=>Nn(()=>this.attributes.lastNotMinimizedBoxesStatus,()=>{var i;(i=this.boxManager)==null||i.setLastNotMinimizedBoxesStatus(this.attributes.lastNotMinimizedBoxesStatus)}))},this.addAppsChangeListener=()=>{this.refresher.add("apps",()=>Nn(()=>this.attributes.apps,()=>{this.attributesUpdateCallback(this.attributes.apps)}))},this.addAppCloseListener=()=>{this.refresher.add("appsClose",()=>Nn(()=>this.attributes.apps,i=>{i.some(n=>n.kind===b.UpdateEventKind.Removed)&&this.onAppDelete(this.attributes.apps)}))},this.onMainViewIndexChange=i=>{i!==void 0&&this._prevSceneIndex!==i&&(G.emit("mainViewSceneIndexChange",i),V.emit("changePageState"),this.callbacksNode&&this.updateSceneState(this.callbacksNode),this._prevSceneIndex=i)},this.onFocusChange=i=>{var n;this._prevFocused!==i&&(G.emit("focusedChange",i),V.emit("focusedChange",{focused:i,prev:this._prevFocused}),this._prevFocused=i,i!==void 0&&((n=this.boxManager)==null||n.focusBox({appId:i}),setTimeout(()=>{const r=this.appProxies.get(i);r&&Ae.notifyApp(r.kind,"focus",{appId:i})},0)))},this.attributesUpdateCallback=E.debounce(i=>this._attributesUpdateCallback(i),100),this._appIds=[],this.onRegisteredChange=i=>{!i||Object.entries(i).forEach(([n,r])=>{Ae.appClasses.has(n)||Ae.register({kind:n,src:r.src,name:r.name})})},this.onMinimized=i=>{var n,r;((n=this.boxManager)==null?void 0:n.minimized)!==i&&(i===!0&&((r=this.boxManager)==null||r.blurAllBox()),setTimeout(()=>{var s;(s=this.boxManager)==null||s.setMinimized(Boolean(i))},0))},this.onAppDelete=async i=>{const n=Object.keys(i);for(const[r,s]of this.appProxies.entries())n.includes(r)||await s.destroy(!0,!1,!0)},this.closeAll=async()=>{for(const[i,n]of this.appProxies.entries())await n.destroy(!0,!1,!0)},this.displayerStateListener=i=>{this.appProxies.forEach(n=>{n.appEmitter.emit("roomStateChange",i)}),V.emit("observerIdChange",this.displayer.observerId)},this.displayerWritableListener=i=>{var s,o;const n=!i,r=this.windowManger.readonly===void 0||this.windowManger.readonly===!1;this.windowManger.readonly===void 0?(s=this.boxManager)==null||s.setReadonly(i):(o=this.boxManager)==null||o.setReadonly(!(n&&r)),this.appProxies.forEach(a=>{a.emitAppIsWritableChange()}),V.emit("writableChange",n)},this.updateSceneIndex=()=>{const i=this.store.getMainViewScenePath(),n=So(i),r=qi(this.displayer)[n];if(r.length){const s=i.replace(n,"").replace("/",""),o=r.findIndex(a=>a.name===s);E.isInteger(o)&&o>=0&&this.safeSetAttributes({_mainSceneIndex:o})}},this.updateRootDirRemoving=i=>{this.rootDirRemoving=i},this.displayer=t.displayer,this.store=rw(Q.extendClass,{getAttributes:()=>this.attributes,safeSetAttributes:i=>this.safeSetAttributes(i),safeUpdateAttributes:(i,n)=>this.safeUpdateAttributes(i,n)}),this.mainViewProxy=new aw(this),this.viewManager=new sw(this.displayer),this.appListeners=new cm(this),this.displayer.callbacks.on(this.eventName,this.displayerStateListener),this.appListeners.addListeners(),this.refresher=Ag,this.refresher.setRoom(this.room),this.refresher.setContext({emitter:V}),this.sideEffectManager.addDisposer(()=>{var i,n;this.appCreateQueue.destroy(),this.mainViewProxy.destroy(),this.refresher.destroy(),this.viewManager.destroy(),(i=this.boxManager)==null||i.destroy(),(n=this.callbacksNode)==null||n.dispose()}),V.once("onCreated").then(()=>this.onCreated()),V.on("onReconnected",()=>this.onReconnected()),b.isPlayer(this.displayer)&&(V.on("seekStart",this.onPlayerSeekStart),V.on("seek",this.onPlayerSeekDone)),V.on("removeScenes",this.onRemoveScenes),V.on("setReadonly",this.onReadonlyChanged),this.createRootDirScenesCallback(),Ae.setSyncRegisterApp(i=>{this.safeUpdateAttributes([xe.Registered,i.kind],i)})}get useBoxesStatus(){return this._useBoxesStatus}set useBoxesStatus(t){this._useBoxesStatus=t}getMemberState(){var t;return((t=this.room)==null?void 0:t.state.memberState)||{strokeColor:[0,0,0]}}async onRootDirRemoved(t=!0){this.setMainViewScenePath(Vh),this.createRootDirScenesCallback();for(const[i,n]of this.appProxies.entries())n.view&&await this.closeApp(i,t);this.mainViewProxy.rebind(),V.emit("rootDirRemoved"),this.updateRootDirRemoving(!1)}get eventName(){return b.isRoom(this.displayer)?"onRoomStateChanged":"onPlayerStateChanged"}get attributes(){return this.windowManger.attributes}get canOperate(){return this.windowManger.canOperate}get room(){return b.isRoom(this.displayer)?this.displayer:void 0}get mainView(){return this.mainViewProxy.view}get polling(){return this.mainViewProxy.polling}set polling(t){this.mainViewProxy.polling=t}get focusApp(){if(this.store.focus)return this.appProxies.get(this.store.focus)}get uid(){var t;return((t=this.room)==null?void 0:t.uid)||""}getMainViewSceneDir(){const t=this.store.getMainViewScenePath();if(t)return So(t);throw new Error("[WindowManager]: mainViewSceneDir not found")}async onCreated(){var t;if(Object.keys(this.attributes.apps).length&&this.store.focus&&(this._focusAppId=this.store.focus,await new Promise(i=>{this._focusAppCreatedResolve=i,this._resolveTimer=setTimeout(()=>{i(this.appProxies.get(this._focusAppId||""))},500)}).then(()=>{this._resolveTimer=void 0,this._focusAppCreatedResolve=void 0,this.focusByAttributes(this.attributes.apps)})),await this._attributesUpdateCallback(this.attributes.apps),V.emit("updateManagerRect"),lt.on("move",this.onBoxMove),lt.on("resize",this.onBoxResize),lt.on("focus",this.onBoxFocus),lt.on("close",this.onBoxClose),lt.on("boxStateChange",this.onBoxStateChange),lt.on("blurred",this.onBoxBlurred),this.addAppsChangeListener(),this.addAppCloseListener(),this.addBoxesStatusChangeListener(),this.refresher.add("maximized",()=>b.autorun(()=>{var n;const i=this.attributes.maximized;(n=this.boxManager)==null||n.setMaximized(Boolean(i))})),this.refresher.add("minimized",()=>b.autorun(()=>{const i=this.attributes.minimized;this.onMinimized(i)})),this.refresher.add("mainViewIndex",()=>b.autorun(()=>{const i=E.get(this.attributes,"_mainSceneIndex");this.onMainViewIndexChange(i)})),this.refresher.add("focusedChange",()=>b.autorun(()=>{const i=E.get(this.attributes,"focus");this.onFocusChange(i)})),this.refresher.add("registeredChange",()=>b.autorun(()=>{const i=E.get(this.attributes,xe.Registered);this.onRegisteredChange(i)})),!this.attributes.apps||Object.keys(this.attributes.apps).length===0){const i=this.store.getMainViewScenePath();if(!i)return;this.resetScenePath(i)}this.displayerWritableListener(!((t=this.room)!=null&&t.isWritable)),this.displayer.callbacks.on("onEnableWriteNowChanged",this.displayerWritableListener),this.focusByAttributes(this.attributes.apps),this._prevFocused=this.attributes.focus,Q.supportAppliancePlugin||this.sideEffectManager.add(()=>{const i=new lw({mainView:()=>this.mainViewProxy.view,focus:()=>this.attributes.focus,getAppProxy:n=>this.appProxies.get(n)});return()=>i.destroy()})}notifyAppsChange(t){(this._appIds.length!==t.length||!this._appIds.every(i=>t.includes(i)))&&(this._appIds=t,G.emit("appsChange",t))}async _attributesUpdateCallback(t){if(t&&Q.container){const i=Object.keys(t);i.length===0&&this.appCreateQueue.emitReady();const r=E.orderBy(i.map(s=>({id:s,createdAt:t[s].createdAt})),"createdAt","asc").map(({id:s})=>s);this.notifyAppsChange(r);for(const s of r)if(!this.appProxies.has(s)&&!this.appStatus.has(s)){const o=t[s];try{if(!this.attributes[s])throw new Error("appAttributes is undefined");this.appCreateQueue.push(async()=>{this.appStatus.set(s,Jo.StartCreate);const l=await this.baseInsertApp({kind:o.kind,options:o.options,isDynamicPPT:o.isDynamicPPT,forceNormal:o.forceNormal,forceTop:o.forceTop,isDragContent:o.isDragContent},s,!1);return l&&this._focusAppId===s&&this._focusAppCreatedResolve&&(this._resolveTimer&&clearTimeout(this._resolveTimer),this._focusAppCreatedResolve(l)),l}),this.focusByAttributes(t)}catch(a){console.warn("[WindowManager]: Insert App Error",a)}}}}refresh(){this.attributesUpdateCallback(this.attributes.apps)}setBoxManager(t){this.boxManager=t}resetMaximized(){var t;(t=this.boxManager)==null||t.setMaximized(Boolean(this.store.getMaximized()))}resetMinimized(){var t;(t=this.boxManager)==null||t.setMinimized(Boolean(this.store.getMinimized()))}bindMainView(t,i){const n=this.mainViewProxy.view;n.disableCameraTransform=i,n.divElement=t,n.focusScenePath||this.setMainViewFocusPath(),V.emit("mainViewMounted"),G.emit("onMainViewMounted",n)}setMainViewFocusPath(t){var n;const i=t||this.store.getMainViewScenePath();if(i)return yi(this.mainView,i),((n=this.mainView)==null?void 0:n.focusScenePath)===i}resetScenePath(t){this.displayer.state.sceneState.scenePath!==t&&qo(this.room,t)}async addApp(t,i){et("addApp",t);const{appId:n,needFocus:r}=await this.beforeAddApp(t,i),s=await this.baseInsertApp(t,n,!0,r);return this.afterAddApp(s),s==null?void 0:s.id}async beforeAddApp(t,i){var o,a;const n=await nm(t.kind);this.appStatus.set(n,Jo.StartCreate);const r=(o=t.attributes)!=null?o:{};this.safeUpdateAttributes([n],r),this.store.setupAppAttributes(t,n,i);const s=!((a=this.boxManager)!=null&&a.minimized);return s&&this.store.setAppFocus(n,!0),{appId:n,needFocus:s}}afterAddApp(t){var i,n;if(t&&t.box){const r=t.box;lt.emit("move",{appId:t.id,x:r==null?void 0:r.intrinsicX,y:r==null?void 0:r.intrinsicY}),this.store.updateAppState(t.id,Be.ZIndex,r.zIndex)}(i=this.boxManager)!=null&&i.minimized&&((n=this.boxManager)==null||n.setMinimized(!1,!1))}async closeApp(t,i=!0){const n=this.appProxies.get(t);n&&await n.destroy(!0,i,!1)}async baseInsertApp(t,i,n,r){if(this.appProxies.has(i)){console.warn("[WindowManager]: app duplicate exists and cannot be created again");return}const s=Tt(wr,Q.extendClass),o=new s(t,this,i,n);if(o)return await o.baseInsertApp(r),this.appStatus.delete(i),o;throw this.appStatus.delete(i),new Error("[WindowManger]: initialize AppProxy failed")}safeSetAttributes(t){this.windowManger.safeSetAttributes(t)}safeUpdateAttributes(t,i){this.windowManger.safeUpdateAttributes(t,i)}async setMainViewScenePath(t){if(this.room){const i=this.displayer.scenePathType(t);if(So(t)!==Ue)throw new Error('[WindowManager]: main view scenePath must in root dir "/"');if(i===b.ScenePathType.None)throw new Error(`[WindowManager]: ${t} not valid scene`);if(i===b.ScenePathType.Page)await this._setMainViewScenePath(t);else if(i===b.ScenePathType.Dir){const r=om(this.displayer,t);r&&await this._setMainViewScenePath(r)}}}async _setMainViewScenePath(t){this.setMainViewFocusPath(t)&&(this.safeSetAttributes({_mainScenePath:t}),this.store.setMainViewFocusPath(this.mainView),this.updateSceneIndex(),this.dispatchSetMainViewScenePath(t))}async setMainViewSceneIndex(t){var i;if(this.room){if(this.store.getMainViewSceneIndex()===t)return;const n=(i=this.callbacksNode)==null?void 0:i.scenes[t],r=`${Ue}${n}`;if(n)this.setMainViewFocusPath(r)&&(this.store.setMainViewScenePath(r),this.store.setMainViewSceneIndex(t),this.dispatchSetMainViewScenePath(r));else throw new Error(`[WindowManager]: ${t} not valid index`)}}dispatchSetMainViewScenePath(t){this.dispatchInternalEvent(se.SetMainViewScenePath,{nextScenePath:t}),G.emit("mainViewScenePathChange",t),qo(this.room,t)}getAppInitPath(t){var n;const i=this.store.getAppAttributes(t);if(i)return(n=i==null?void 0:i.options)==null?void 0:n.scenePath}safeDispatchMagixEvent(t,i){this.canOperate&&this.displayer.dispatchMagixEvent(t,i)}focusByAttributes(t){var i;if(t&&Object.keys(t).length===((i=this.boxManager)==null?void 0:i.boxSize)){const n=this.store.focus;n&&this.boxManager.focusBox({appId:n})}}async onReconnected(){await this._attributesUpdateCallback(this.attributes.apps);const i=Array.from(this.appProxies.values()).map(n=>n.onReconnected());this.mainViewProxy.onReconnect(),await Promise.all(i),this.callbacksNode&&this.onSceneChange(this.callbacksNode)}notifyContainerRectUpdate(t){this.appProxies.forEach(i=>{i.appEmitter.emit("containerRectUpdate",t)})}dispatchInternalEvent(t,i){this.safeDispatchMagixEvent(Xo,{eventName:t,payload:i})}destroy(){this.displayer.callbacks.off(this.eventName,this.displayerStateListener),this.displayer.callbacks.off("onEnableWriteNowChanged",this.displayerWritableListener),this.appListeners.removeListeners(),lt.clearListeners(),V.clearListeners(),this.appProxies.size&&this.appProxies.forEach(t=>{t.destroy(!0,!1,!0)}),G.clearListeners(),this.sideEffectManager.flushAll(),this._prevFocused=void 0,this._prevSceneIndex=void 0,this._resolveTimer&&clearTimeout(this._resolveTimer),this._focusAppCreatedResolve=void 0,this._resolveTimer=void 0}}yr.kind="AppManager";const uw=window.ResizeObserver||Rg.ResizeObserver;class Il{constructor(t){this.emitter=t}static create(t,i,n,r){const s=new Il(r);return s.observePlaygroundSize(t,i,n),s}observePlaygroundSize(t,i,n){this.updateSizer(t.getBoundingClientRect(),i,n),this.containerResizeObserver=new uw(r=>{var o;const s=(o=r[0])==null?void 0:o.contentRect;s&&(this.updateSizer(s,i,n),this.emitter.emit("playgroundSizeChange",s))}),this.disposer=this.emitter.on("containerSizeRatioUpdate",()=>{const r=t.getBoundingClientRect();this.updateSizer(r,i,n),this.emitter.emit("playgroundSizeChange",r)}),this.containerResizeObserver.observe(t)}updateSizer({width:t,height:i},n,r){t&&i&&(i/t>Q.containerSizeRatio?(i=t*Q.containerSizeRatio,n.classList.toggle("netless-window-manager-sizer-horizontal",!0)):(t=i/Q.containerSizeRatio,n.classList.toggle("netless-window-manager-sizer-horizontal",!1)),r.style.width=`${t}px`,r.style.height=`${i}px`)}disconnect(){var t;(t=this.containerResizeObserver)==null||t.disconnect(),E.isFunction(this.disposer)&&(this.disposer(),this.disposer=void 0)}}class cw{constructor(t){this.manager=t,V.on("changePageState",()=>{G.emit("pageStateChange",this.toObject())})}get index(){return this.manager.store.getMainViewSceneIndex()||0}get length(){return this.manager.mainViewScenesLength||0}toObject(){return{index:this.index>=this.length?this.length-1:this.index,length:this.length}}}class hw{constructor(t){this.ctx=t,this.reactors=new Map,this.disposers=new Map,this.onPhaseChanged=async i=>{var n,r;i===b.RoomPhase.Reconnecting&&this.ctx.emitter.emit("startReconnect"),i===b.RoomPhase.Connected&&this.phase===b.RoomPhase.Reconnecting&&((n=this.room)!=null&&n.isWritable?(r=this.room)==null||r.dispatchMagixEvent(xo,{}):(await Uh(500),this.onReconnected())),this.phase=i},this.onReconnected=E.debounce(()=>{this._onReconnected()},1e3),this._onReconnected=()=>{et("onReconnected refresh reactors"),this.releaseDisposers(),this.reactors.forEach((i,n)=>{E.isFunction(i)&&this.disposers.set(n,i())}),this.ctx.emitter.emit("onReconnected")}}setRoom(t){this.room=t,this.phase=t==null?void 0:t.phase,t&&(t.callbacks.off("onPhaseChanged",this.onPhaseChanged),t.callbacks.on("onPhaseChanged",this.onPhaseChanged),t.addMagixEventListener(xo,i=>{i.authorId===t.observerId&&this.onReconnected()},{fireSelfEventAfterCommit:!0}))}setContext(t){this.ctx=t}releaseDisposers(){this.disposers.forEach(t=>{E.isFunction(t)&&t()}),this.disposers.clear()}refresh(){this._onReconnected()}add(t,i){const n=this.disposers.get(t);n&&E.isFunction(n)&&n(),E.isFunction(i)&&(this.reactors.set(t,i),this.disposers.set(t,i()))}remove(t){this.reactors.has(t)&&this.reactors.delete(t);const i=this.disposers.get(t);i&&(E.isFunction(i)&&i(),this.disposers.delete(t))}hasReactor(t){return this.reactors.has(t)}destroy(){var t,i;(t=this.room)==null||t.callbacks.off("onPhaseChanged",this.onPhaseChanged),(i=this.room)==null||i.removeMagixEventListener(xo,this.onReconnected),this.releaseDisposers()}}const dw=(e,t)=>{if(b.isPlayer(e))pw(e);else{if(e=e,Object.getOwnPropertyDescriptor(e,"disableCameraTransform"))return;Object.defineProperty(e,"disableCameraTransform",{get(){return t.mainView.disableCameraTransform},set(n){t.mainView.disableCameraTransform=n}}),Object.defineProperty(e,"canUndoSteps",{get(){return t.canUndoSteps}}),Object.defineProperty(e,"canRedoSteps",{get(){return t.canRedoSteps}}),e.moveCamera=n=>t.moveCamera(n),e.moveCameraToContain=(...n)=>t.moveCameraToContain(...n),e.convertToPointInWorld=(...n)=>t.mainView.convertToPointInWorld(...n),e.setCameraBound=(...n)=>t.mainView.setCameraBound(...n),e.scenePreview=(...n)=>t.mainView.scenePreview(...n),e.fillSceneSnapshot=(...n)=>t.mainView.fillSceneSnapshot(...n),e.generateScreenshot=(...n)=>t.mainView.generateScreenshot(...n),e.setMemberState=(...n)=>t.mainView.setMemberState(...n),e.redo=()=>t.redo(),e.undo=()=>t.undo(),e.cleanCurrentScene=()=>t.cleanCurrentScene(),e.delete=()=>t.delete(),e.copy=()=>t.copy(),e.paste=()=>t.paste(),e.duplicate=()=>t.duplicate(),e.insertImage=(...n)=>t.insertImage(...n),e.completeImageUpload=(...n)=>t.completeImageUpload(...n),e.insertText=(...n)=>t.insertText(...n),e.lockImage=(...n)=>t.lockImage(...n),e.lockImages=(...n)=>t.lockImages(...n),fw(e,t)}},fw=(e,t)=>{const i=e.removeScenes;e.removeScenes=(n,r)=>{var o;n===Ue&&((o=t.appManager)==null||o.updateRootDirRemoving(!0));const s=i.call(e,n);return V.emit("removeScenes",{scenePath:n,index:r}),s}},pw=e=>{const t=e.seekToProgressTime;async function i(n){await V.emit("seekStart");const r=await t.call(e,n);return V.emit("seek",n),r}e.seekToProgressTime=i};var gw=`.netless-app-docs-viewer-content{position:relative;height:100%;overflow:hidden}.netless-app-docs-viewer-preview-mask{display:none;position:absolute;z-index:200;top:0;left:0;width:100%;height:100%}.netless-app-docs-viewer-preview{display:flex;flex-direction:column;align-items:center;position:absolute;z-index:300;top:0;left:0;width:33%;max-width:200px;height:100%;padding-top:10px;transform:translate(-100%);background:rgba(237,237,240,.9);box-shadow:inset -1px 0 #0000001c;transition:transform .4s}.netless-app-docs-viewer-preview-active .netless-app-docs-viewer-preview-mask{display:block}.netless-app-docs-viewer-preview-active .netless-app-docs-viewer-preview{transform:translate(0)}.netless-app-docs-viewer-preview-page{position:relative;display:block;width:55%;margin-bottom:10px;font-size:0;color:transparent;outline:none;border:7px solid transparent;border-radius:4px;transition:border-color .3s;user-select:none}.netless-app-docs-viewer-preview-page:hover,.netless-app-docs-viewer-preview-page.netless-app-docs-viewer-preview-page-active{border-color:#444e601a}.netless-app-docs-viewer-preview-page>img{width:100%;height:auto;box-sizing:border-box;border:1px solid rgba(0,0,0,.5);border-radius:1px;background-color:#fff;box-shadow:0 2px 8px #0000004d}.netless-app-docs-viewer-preview-page-name{position:absolute;top:1px;left:-10px;transform:translate(-100%);text-align:right;font-size:12px;color:#5f5f5f;user-select:none}.netless-app-docs-viewer-footer{box-sizing:border-box;height:26px;display:flex;align-items:center;padding:0 16px;border-top:1px solid #eeeef7;color:#191919}.netless-app-docs-viewer-float-footer{width:100%;min-height:26px;position:absolute;left:0;bottom:0;z-index:2000;background:rgba(249,249,252,.9);transition:opacity .4s}.netless-app-docs-viewer-footer-btn{box-sizing:border-box;width:26px;height:26px;font-size:0;margin:0;padding:3px;border:none;border-radius:1px;outline:none;color:currentColor;background:transparent;transition:background .4s;cursor:pointer;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.netless-app-docs-viewer-footer-btn:hover{background:rgba(237,237,240,.9)}@media (hover: none){.netless-app-docs-viewer-footer-btn:hover{background:transparent!important}}.netless-app-docs-viewer-footer-btn>svg{width:100%;height:100%}.netless-app-docs-viewer-footer-btn>svg:nth-of-type(2){display:none}.netless-app-docs-viewer-footer-btn.netless-app-docs-viewer-footer-btn-playing>svg:nth-of-type(1){display:none}.netless-app-docs-viewer-footer-btn.netless-app-docs-viewer-footer-btn-playing>svg:nth-of-type(2){display:initial}.netless-app-docs-viewer-footer-btn~.netless-app-docs-viewer-footer-btn{margin-left:15px}.netless-app-docs-viewer-page-jumps{flex:1;display:flex;justify-content:center;align-items:center}.netless-app-docs-viewer-page-number{margin-left:auto;font-size:13px;user-select:none;white-space:nowrap;word-break:keep-all}.netless-app-docs-viewer-page-number-input{border:none;outline:none;width:3em;margin:0;padding:0 2px;text-align:right;font-size:13px;line-height:1;font-weight:400;font-family:inherit;border-radius:2px;color:currentColor;background:transparent;transition:background .4s;user-select:text;-webkit-tap-highlight-color:rgba(0,0,0,0)}.netless-app-docs-viewer-page-number-input:hover,.netless-app-docs-viewer-page-number-input:focus,.netless-app-docs-viewer-page-number-input:active{background:#fff;box-shadow:#63636333 0 2px 8px}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-footer-btn{cursor:not-allowed}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-footer-btn:hover{background:transparent}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input{cursor:not-allowed}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input:hover,.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input:focus,.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input:active{background:transparent;box-shadow:none}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input:disabled{color:inherit}.netless-app-docs-viewer-readonly.netless-app-docs-viewer-float-footer{display:none}.telebox-color-scheme-dark .netless-app-docs-viewer-page-number-input{color:#a6a6a8}.telebox-color-scheme-dark .netless-app-docs-viewer-page-number-input:active,.telebox-color-scheme-dark .netless-app-docs-viewer-page-number-input:focus,.telebox-color-scheme-dark .netless-app-docs-viewer-page-number-input:hover{color:#222}.telebox-color-scheme-dark .netless-app-docs-viewer-footer{color:#a6a6a8;background:#2d2d33;border-top:none}.telebox-color-scheme-dark .netless-app-docs-viewer-footer-btn:hover{background:#212126}.telebox-color-scheme-dark .netless-app-docs-viewer-preview{background:rgba(50,50,50,.9)}.netless-app-docs-viewer-static-scrollbar{position:absolute;top:0;right:0;z-index:2147483647;width:8px;min-height:30px;margin:0;padding:0;border:none;outline:none;border-radius:4px;background:rgba(68,78,96,.4);box-shadow:1px 1px 8px #ffffffb3;opacity:0;transition:background .4s,opacity .4s 3s,transform .2s;user-select:none}.netless-app-docs-viewer-static-scrollbar.netless-app-docs-viewer-static-scrollbar-dragging{background:rgba(68,78,96,.6);opacity:1;transition:background .4s,opacity .4s 3s!important}.netless-app-docs-viewer-static-scrollbar:hover,.netless-app-docs-viewer-static-scrollbar:focus{background:rgba(68,78,96,.5)}.netless-app-docs-viewer-static-scrollbar:active{background:rgba(68,78,96,.6)}.netless-app-docs-viewer-content:hover .netless-app-docs-viewer-static-scrollbar{opacity:1;transition:background .4s,opacity .4s,transform .2s}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-static-scrollbar{display:none}.netless-app-docs-viewer-static-pages:hover .netless-app-docs-viewer-static-scrollbar{opacity:1;transition:background .4s,opacity .4s,transform .2s}.page-renderer-pages-container{position:relative;overflow:hidden}.page-renderer-page{position:absolute;top:0;left:0;background-position:center;background-size:cover;background-repeat:no-repeat}.page-renderer-pages-container.is-hwa .page-renderer-page{will-change:transform}.page-renderer-page-img{display:block;width:100%;height:auto;user-select:none}.netless-app-docs-viewer-static-pages{overflow:hidden;position:relative;height:100%;user-select:none}.netless-app-docs-viewer-static-page{display:block;width:100%;height:auto;user-select:none}.netless-app-docs-viewer-static-wb-view,.netless-app-docs-viewer-dynamic-wb-view{position:absolute;top:0;left:0;width:100%;height:100%;z-index:100;overflow:hidden}.netless-app-docs-viewer-dynamic-wb-view .cursor-clicker .ppt-event-source{cursor:pointer}
17
17
  `;const mw=(e,t,i,n)=>{if(i==="length"||i==="prototype"||i==="arguments"||i==="caller")return;const r=Object.getOwnPropertyDescriptor(e,i),s=Object.getOwnPropertyDescriptor(t,i);!vw(r,s)&&n||Object.defineProperty(e,i,s)},vw=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},ww=(e,t)=>{const i=Object.getPrototypeOf(t);i!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,i)},yw=(e,t)=>`/* Wrapped ${e}*/
18
18
  ${t}`,xw=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Sw=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Mw=(e,t,i)=>{const n=i===""?"":`with ${i.trim()}() `,r=yw.bind(null,n,t.toString());Object.defineProperty(r,"name",Sw),Object.defineProperty(e,"toString",{...xw,value:r})};function Iw(e,t,{ignoreNonConfigurable:i=!1}={}){const{name:n}=e;for(const r of Reflect.ownKeys(t))mw(e,t,r,i);return ww(e,t),Mw(e,t,n),e}const Cw=(e,t={})=>{if(typeof e!="function")throw new TypeError(`Expected the first argument to be a function, got \`${typeof e}\``);const{wait:i=0,maxWait:n=Number.POSITIVE_INFINITY,before:r=!1,after:s=!0}=t;if(!r&&!s)throw new Error("Both `before` and `after` are false, function wouldn't be called.");let o,a,l;const u=function(...h){const c=this,m=()=>{o=void 0,a&&(clearTimeout(a),a=void 0),s&&(l=e.apply(c,h))},v=()=>{a=void 0,o&&(clearTimeout(o),o=void 0),s&&(l=e.apply(c,h))},w=r&&!o;return clearTimeout(o),o=setTimeout(m,i),n>0&&n!==Number.POSITIVE_INFINITY&&!a&&(a=setTimeout(v,n)),w&&(l=e.apply(c,h)),l};return Iw(u,e),u.cancel=()=>{o&&(clearTimeout(o),o=void 0),a&&(clearTimeout(a),a=void 0)},u};var bw="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",Aw=87,Tw=20,lc=[],Ew=()=>{for(let e=0;e<Tw;e++)lc[e]=bw.charAt(Math.random()*Aw);return lc.join("")};function bd(e){try{return e()}catch(t){console.error(t)}}var eo=class{constructor(){this.push=this.addDisposer,this.disposers=new Map}addDisposer(e,t=this.genUID()){return this.flush(t),this.disposers.set(t,Array.isArray(e)?Nw(e):e),t}add(e,t=this.genUID()){const i=e();return i?this.addDisposer(i,t):t}addEventListener(e,t,i,n,r=this.genUID()){return e.addEventListener(t,i,n),this.addDisposer(()=>e.removeEventListener(t,i,n),r),r}setTimeout(e,t,i=this.genUID()){const n=window.setTimeout(()=>{this.remove(i),e()},t);return this.addDisposer(()=>window.clearTimeout(n),i)}setInterval(e,t,i=this.genUID()){const n=window.setInterval(e,t);return this.addDisposer(()=>window.clearInterval(n),i)}remove(e){const t=this.disposers.get(e);return this.disposers.delete(e),t}flush(e){const t=this.remove(e);t&&t()}flushAll(){this.disposers.forEach(bd),this.disposers.clear()}genUID(){let e;do e=Ew();while(this.disposers.has(e));return e}};function Nw(e){return()=>e.forEach(bd)}var di=[],kw=function(){return di.some(function(e){return e.activeTargets.length>0})},Pw=function(){return di.some(function(e){return e.skippedTargets.length>0})},uc="ResizeObserver loop completed with undelivered notifications.",Bw=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:uc}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=uc),window.dispatchEvent(e)},Kn;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Kn||(Kn={}));var fi=function(e){return Object.freeze(e)},zw=function(){function e(t,i){this.inlineSize=t,this.blockSize=i,fi(this)}return e}(),Ad=function(){function e(t,i,n,r){return this.x=t,this.y=i,this.width=n,this.height=r,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,fi(this)}return e.prototype.toJSON=function(){var t=this,i=t.x,n=t.y,r=t.top,s=t.right,o=t.bottom,a=t.left,l=t.width,u=t.height;return{x:i,y:n,top:r,right:s,bottom:o,left:a,width:l,height:u}},e.fromRect=function(t){return new e(t.x,t.y,t.width,t.height)},e}(),Cl=function(e){return e instanceof SVGElement&&"getBBox"in e},Td=function(e){if(Cl(e)){var t=e.getBBox(),i=t.width,n=t.height;return!i&&!n}var r=e,s=r.offsetWidth,o=r.offsetHeight;return!(s||o||e.getClientRects().length)},cc=function(e){var t;if(e instanceof Element)return!0;var i=(t=e==null?void 0:e.ownerDocument)===null||t===void 0?void 0:t.defaultView;return!!(i&&e instanceof i.Element)},Dw=function(e){switch(e.tagName){case"INPUT":if(e.type!=="image")break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1},On=typeof window!="undefined"?window:{},Vr=new WeakMap,hc=/auto|scroll/,Lw=/^tb|vertical/,Rw=/msie|trident/i.test(On.navigator&&On.navigator.userAgent),st=function(e){return parseFloat(e||"0")},Qi=function(e,t,i){return e===void 0&&(e=0),t===void 0&&(t=0),i===void 0&&(i=!1),new zw((i?t:e)||0,(i?e:t)||0)},dc=fi({devicePixelContentBoxSize:Qi(),borderBoxSize:Qi(),contentBoxSize:Qi(),contentRect:new Ad(0,0,0,0)}),Ed=function(e,t){if(t===void 0&&(t=!1),Vr.has(e)&&!t)return Vr.get(e);if(Td(e))return Vr.set(e,dc),dc;var i=getComputedStyle(e),n=Cl(e)&&e.ownerSVGElement&&e.getBBox(),r=!Rw&&i.boxSizing==="border-box",s=Lw.test(i.writingMode||""),o=!n&&hc.test(i.overflowY||""),a=!n&&hc.test(i.overflowX||""),l=n?0:st(i.paddingTop),u=n?0:st(i.paddingRight),h=n?0:st(i.paddingBottom),c=n?0:st(i.paddingLeft),m=n?0:st(i.borderTopWidth),v=n?0:st(i.borderRightWidth),w=n?0:st(i.borderBottomWidth),x=n?0:st(i.borderLeftWidth),d=c+u,f=l+h,g=x+v,p=m+w,y=a?e.offsetHeight-p-e.clientHeight:0,S=o?e.offsetWidth-g-e.clientWidth:0,T=r?d+g:0,k=r?f+p:0,B=n?n.width:st(i.width)-T-S,z=n?n.height:st(i.height)-k-y,ee=B+d+S+g,C=z+f+y+p,M=fi({devicePixelContentBoxSize:Qi(Math.round(B*devicePixelRatio),Math.round(z*devicePixelRatio),s),borderBoxSize:Qi(ee,C,s),contentBoxSize:Qi(B,z,s),contentRect:new Ad(c,l,B,z)});return Vr.set(e,M),M},Nd=function(e,t,i){var n=Ed(e,i),r=n.borderBoxSize,s=n.contentBoxSize,o=n.devicePixelContentBoxSize;switch(t){case Kn.DEVICE_PIXEL_CONTENT_BOX:return o;case Kn.BORDER_BOX:return r;default:return s}},jw=function(){function e(t){var i=Ed(t);this.target=t,this.contentRect=i.contentRect,this.borderBoxSize=fi([i.borderBoxSize]),this.contentBoxSize=fi([i.contentBoxSize]),this.devicePixelContentBoxSize=fi([i.devicePixelContentBoxSize])}return e}(),kd=function(e){if(Td(e))return 1/0;for(var t=0,i=e.parentNode;i;)t+=1,i=i.parentNode;return t},_w=function(){var e=1/0,t=[];di.forEach(function(o){if(o.activeTargets.length!==0){var a=[];o.activeTargets.forEach(function(u){var h=new jw(u.target),c=kd(u.target);a.push(h),u.lastReportedSize=Nd(u.target,u.observedBox),c<e&&(e=c)}),t.push(function(){o.callback.call(o.observer,a,o.observer)}),o.activeTargets.splice(0,o.activeTargets.length)}});for(var i=0,n=t;i<n.length;i++){var r=n[i];r()}return e},fc=function(e){di.forEach(function(i){i.activeTargets.splice(0,i.activeTargets.length),i.skippedTargets.splice(0,i.skippedTargets.length),i.observationTargets.forEach(function(r){r.isActive()&&(kd(r.target)>e?i.activeTargets.push(r):i.skippedTargets.push(r))})})},Vw=function(){var e=0;for(fc(e);kw();)e=_w(),fc(e);return Pw()&&Bw(),e>0},Po,Pd=[],Ow=function(){return Pd.splice(0).forEach(function(e){return e()})},Uw=function(e){if(!Po){var t=0,i=document.createTextNode(""),n={characterData:!0};new MutationObserver(function(){return Ow()}).observe(i,n),Po=function(){i.textContent="".concat(t?t--:t++)}}Pd.push(e),Po()},$w=function(e){Uw(function(){requestAnimationFrame(e)})},rs=0,Ww=function(){return!!rs},Hw=250,Fw={attributes:!0,characterData:!0,childList:!0,subtree:!0},pc=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],gc=function(e){return e===void 0&&(e=0),Date.now()+e},Bo=!1,Qw=function(){function e(){var t=this;this.stopped=!0,this.listener=function(){return t.schedule()}}return e.prototype.run=function(t){var i=this;if(t===void 0&&(t=Hw),!Bo){Bo=!0;var n=gc(t);$w(function(){var r=!1;try{r=Vw()}finally{if(Bo=!1,t=n-gc(),!Ww())return;r?i.run(1e3):t>0?i.run(t):i.start()}})}},e.prototype.schedule=function(){this.stop(),this.run()},e.prototype.observe=function(){var t=this,i=function(){return t.observer&&t.observer.observe(document.body,Fw)};document.body?i():On.addEventListener("DOMContentLoaded",i)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),pc.forEach(function(i){return On.addEventListener(i,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),pc.forEach(function(i){return On.removeEventListener(i,t.listener,!0)}),this.stopped=!0)},e}(),ha=new Qw,mc=function(e){!rs&&e>0&&ha.start(),rs+=e,!rs&&ha.stop()},Zw=function(e){return!Cl(e)&&!Dw(e)&&getComputedStyle(e).display==="inline"},Yw=function(){function e(t,i){this.target=t,this.observedBox=i||Kn.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=Nd(this.target,this.observedBox,!0);return Zw(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),Gw=function(){function e(t,i){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=i}return e}(),Or=new WeakMap,vc=function(e,t){for(var i=0;i<e.length;i+=1)if(e[i].target===t)return i;return-1},Ur=function(){function e(){}return e.connect=function(t,i){var n=new Gw(t,i);Or.set(t,n)},e.observe=function(t,i,n){var r=Or.get(t),s=r.observationTargets.length===0;vc(r.observationTargets,i)<0&&(s&&di.push(r),r.observationTargets.push(new Yw(i,n&&n.box)),mc(1),ha.schedule())},e.unobserve=function(t,i){var n=Or.get(t),r=vc(n.observationTargets,i),s=n.observationTargets.length===1;r>=0&&(s&&di.splice(di.indexOf(n),1),n.observationTargets.splice(r,1),mc(-1))},e.disconnect=function(t){var i=this,n=Or.get(t);n.observationTargets.slice().forEach(function(r){return i.unobserve(t,r.target)}),n.activeTargets.splice(0,n.activeTargets.length)},e}(),Xw=function(){function e(t){if(arguments.length===0)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if(typeof t!="function")throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");Ur.connect(this,t)}return e.prototype.observe=function(t,i){if(arguments.length===0)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!cc(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");Ur.observe(this,t,i)},e.prototype.unobserve=function(t){if(arguments.length===0)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!cc(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");Ur.unobserve(this,t)},e.prototype.disconnect=function(){Ur.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}();function Jw(e){const t="http://www.w3.org/2000/svg",i=document.createElementNS(t,"svg");i.setAttribute("class",`${e}-footer-icon-sidebar`),i.setAttribute("viewBox","0 0 64 64");const n=document.createElementNS(t,"path");return n.setAttribute("fill","currentColor"),n.setAttribute("d","M50 8H14c-3.309 0-6 2.691-6 6v36c0 3.309 2.691 6 6 6h36c3.309 0 6-2.691 6-6V14c0-3.309-2.691-6-6-6zM12 50V14c0-1.103.897-2 2-2h8v40h-8c-1.103 0-2-.897-2-2zm40 0c0 1.103-.897 2-2 2H26V12h24c1.103 0 2 .897 2 2z"),i.appendChild(n),i}function Kw(e){const t="http://www.w3.org/2000/svg",i=document.createElementNS(t,"svg");i.setAttribute("class",`${e}-footer-icon-arrow-left`),i.setAttribute("viewBox","0 0 500 500");const n=document.createElementNS(t,"path");return n.setAttribute("fill","currentColor"),n.setAttribute("d","M177.81 249.959L337.473 90.295c2.722-2.865 2.651-7.378-.143-10.1-2.793-2.65-7.163-2.65-9.956 0l-164.75 164.75c-2.793 2.793-2.793 7.306 0 10.1l164.75 164.75c2.865 2.722 7.378 2.65 10.099-.143 2.651-2.794 2.651-7.163 0-9.957L177.809 249.959z"),i.appendChild(n),i}function qw(e){const t="http://www.w3.org/2000/svg",i=document.createElementNS(t,"svg");i.setAttribute("class",`${e}-footer-icon-arrow-right`),i.setAttribute("viewBox","0 0 500 500");const n=document.createElementNS(t,"path");return n.setAttribute("fill","currentColor"),n.setAttribute("d","M322.19 250.041L162.527 409.705c-2.722 2.865-2.651 7.378.143 10.1 2.793 2.65 7.163 2.65 9.956 0l164.75-164.75c2.793-2.793 2.793-7.306 0-10.1l-164.75-164.75c-2.865-2.722-7.378-2.65-10.099.143-2.651 2.794-2.651 7.163 0 9.957l159.664 159.736z"),i.appendChild(n),i}function ey(e){const t="http://www.w3.org/2000/svg",i=document.createElementNS(t,"svg");i.setAttribute("class",`${e}-footer-icon-play`),i.setAttribute("viewBox","0 0 500 500");const n=document.createElementNS(t,"path");return n.setAttribute("fill","currentColor"),n.setAttribute("d","M418.158 257.419L174.663 413.33c-6.017 3.919-15.708 3.772-21.291-.29-2.791-2.018-4.295-4.483-4.295-7.084V94.109c0-5.65 6.883-10.289 15.271-10.289 4.298 0 8.391 1.307 11.181 3.332l242.629 155.484c6.016 3.917 6.451 10.292.649 14.491-.216.154-.432.154-.649.292zM170.621 391.288l223.116-141.301L170.71 107.753l-.089 283.535z"),i.appendChild(n),i}function ty(e){const t="http://www.w3.org/2000/svg",i=document.createElementNS(t,"svg");i.setAttribute("class",`${e}-footer-icon-pause`),i.setAttribute("viewBox","0 0 500 500");const n=document.createElementNS(t,"path");return n.setAttribute("fill","currentColor"),n.setAttribute("d","M312.491 78.261c0-6.159 4.893-11.213 11.04-11.213 6.158 0 11.211 5.054 11.211 11.213v343.478c0 6.159-5.053 11.213-11.211 11.213-6.147 0-11.04-5.054-11.04-11.213V78.261zM165.257 78.261c0-6.159 4.893-11.213 11.04-11.213 6.158 0 11.211 5.054 11.211 11.213v343.478c0 6.159-5.053 11.213-11.211 11.213-6.147 0-11.04-5.054-11.04-11.213V78.261z"),i.appendChild(n),i}const Jt=typeof window!="undefined",Bd=Jt&&!("onscroll"in window)||typeof navigator!="undefined"&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),zd=Jt&&"IntersectionObserver"in window,Dd=Jt&&"classList"in document.createElement("p"),Ld=Jt&&window.devicePixelRatio>1,iy={elements_selector:".lazy",container:Bd||Jt?document:null,threshold:300,thresholds:null,data_src:"src",data_srcset:"srcset",data_sizes:"sizes",data_bg:"bg",data_bg_hidpi:"bg-hidpi",data_bg_multi:"bg-multi",data_bg_multi_hidpi:"bg-multi-hidpi",data_bg_set:"bg-set",data_poster:"poster",class_applied:"applied",class_loading:"loading",class_loaded:"loaded",class_error:"error",class_entered:"entered",class_exited:"exited",unobserve_completed:!0,unobserve_entered:!1,cancel_on_exit:!0,callback_enter:null,callback_exit:null,callback_applied:null,callback_loading:null,callback_loaded:null,callback_error:null,callback_finish:null,callback_cancel:null,use_native:!1,restore_on_error:!1},Rd=e=>Object.assign({},iy,e),wc=function(e,t){let i;const n="LazyLoad::Initialized",r=new e(t);try{i=new CustomEvent(n,{detail:{instance:r}})}catch{i=document.createEvent("CustomEvent"),i.initCustomEvent(n,!1,!1,{instance:r})}window.dispatchEvent(i)},ny=(e,t)=>{if(!!t)if(!t.length)wc(e,t);else for(let i=0,n;n=t[i];i+=1)wc(e,n)},Et="src",bl="srcset",Al="sizes",jd="poster",xr="llOriginalAttrs",_d="data",Tl="loading",Vd="loaded",Od="applied",ry="entered",El="error",Ud="native",$d="data-",Wd="ll-status",ze=(e,t)=>e.getAttribute($d+t),sy=(e,t,i)=>{const n=$d+t;if(i===null){e.removeAttribute(n);return}e.setAttribute(n,i)},Sr=e=>ze(e,Wd),Ai=(e,t)=>sy(e,Wd,t),to=e=>Ai(e,null),Nl=e=>Sr(e)===null,oy=e=>Sr(e)===Tl,ay=e=>Sr(e)===El,kl=e=>Sr(e)===Ud,ly=[Tl,Vd,Od,El],uy=e=>ly.indexOf(Sr(e))>=0,Kt=(e,t,i,n)=>{if(!(!e||typeof e!="function")){if(n!==void 0){e(t,i,n);return}if(i!==void 0){e(t,i);return}e(t)}},cn=(e,t)=>{if(t!==""){if(Dd){e.classList.add(t);return}e.className+=(e.className?" ":"")+t}},ut=(e,t)=>{if(t!==""){if(Dd){e.classList.remove(t);return}e.className=e.className.replace(new RegExp("(^|\\s+)"+t+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")}},cy=e=>{e.llTempImage=document.createElement("IMG")},hy=e=>{delete e.llTempImage},Hd=e=>e.llTempImage,io=(e,t)=>{if(!t)return;const i=t._observer;!i||i.unobserve(e)},dy=e=>{e.disconnect()},fy=(e,t,i)=>{t.unobserve_entered&&io(e,i)},Pl=(e,t)=>{!e||(e.loadingCount+=t)},py=e=>{!e||(e.toLoadCount-=1)},Fd=(e,t)=>{!e||(e.toLoadCount=t)},gy=e=>e.loadingCount>0,my=e=>e.toLoadCount>0,Qd=e=>{let t=[];for(let i=0,n;n=e.children[i];i+=1)n.tagName==="SOURCE"&&t.push(n);return t},Bl=(e,t)=>{const i=e.parentNode;if(!i||i.tagName!=="PICTURE")return;Qd(i).forEach(t)},Zd=(e,t)=>{Qd(e).forEach(t)},no=[Et],Yd=[Et,jd],qn=[Et,bl,Al],Gd=[_d],ro=e=>!!e[xr],Xd=e=>e[xr],Jd=e=>delete e[xr],en=(e,t)=>{if(ro(e))return;const i={};t.forEach(n=>{i[n]=e.getAttribute(n)}),e[xr]=i},vy=e=>{ro(e)||(e[xr]={backgroundImage:e.style.backgroundImage})},wy=(e,t,i)=>{if(!i){e.removeAttribute(t);return}e.setAttribute(t,i)},xi=(e,t)=>{if(!ro(e))return;const i=Xd(e);t.forEach(n=>{wy(e,n,i[n])})},yy=e=>{if(!ro(e))return;const t=Xd(e);e.style.backgroundImage=t.backgroundImage},Kd=(e,t,i)=>{cn(e,t.class_applied),Ai(e,Od),i&&(t.unobserve_completed&&io(e,t),Kt(t.callback_applied,e,i))},qd=(e,t,i)=>{cn(e,t.class_loading),Ai(e,Tl),i&&(Pl(i,1),Kt(t.callback_loading,e,i))},Ot=(e,t,i)=>{!i||e.setAttribute(t,i)},yc=(e,t)=>{Ot(e,Al,ze(e,t.data_sizes)),Ot(e,bl,ze(e,t.data_srcset)),Ot(e,Et,ze(e,t.data_src))},xy=(e,t)=>{Bl(e,i=>{en(i,qn),yc(i,t)}),en(e,qn),yc(e,t)},Sy=(e,t)=>{en(e,no),Ot(e,Et,ze(e,t.data_src))},My=(e,t)=>{Zd(e,i=>{en(i,no),Ot(i,Et,ze(i,t.data_src))}),en(e,Yd),Ot(e,jd,ze(e,t.data_poster)),Ot(e,Et,ze(e,t.data_src)),e.load()},Iy=(e,t)=>{en(e,Gd),Ot(e,_d,ze(e,t.data_src))},Cy=(e,t,i)=>{const n=ze(e,t.data_bg),r=ze(e,t.data_bg_hidpi),s=Ld&&r?r:n;!s||(e.style.backgroundImage=`url("${s}")`,Hd(e).setAttribute(Et,s),qd(e,t,i))},by=(e,t,i)=>{const n=ze(e,t.data_bg_multi),r=ze(e,t.data_bg_multi_hidpi),s=Ld&&r?r:n;!s||(e.style.backgroundImage=s,Kd(e,t,i))},Ay=(e,t,i)=>{const n=ze(e,t.data_bg_set);if(!n)return;const r=n.split("|");let s=r.map(o=>`image-set(${o})`);e.style.backgroundImage=s.join(),e.style.backgroundImage===""&&(s=r.map(o=>`-webkit-image-set(${o})`),e.style.backgroundImage=s.join()),Kd(e,t,i)},ef={IMG:xy,IFRAME:Sy,VIDEO:My,OBJECT:Iy},Ty=(e,t)=>{const i=ef[e.tagName];!i||i(e,t)},Ey=(e,t,i)=>{const n=ef[e.tagName];!n||(n(e,t),qd(e,t,i))},Ny=["IMG","IFRAME","VIDEO","OBJECT"],ky=e=>Ny.indexOf(e.tagName)>-1,tf=(e,t)=>{t&&!gy(t)&&!my(t)&&Kt(e.callback_finish,t)},xc=(e,t,i)=>{e.addEventListener(t,i),e.llEvLisnrs[t]=i},Py=(e,t,i)=>{e.removeEventListener(t,i)},zl=e=>!!e.llEvLisnrs,By=(e,t,i)=>{zl(e)||(e.llEvLisnrs={});const n=e.tagName==="VIDEO"?"loadeddata":"load";xc(e,n,t),xc(e,"error",i)},da=e=>{if(!zl(e))return;const t=e.llEvLisnrs;for(let i in t){const n=t[i];Py(e,i,n)}delete e.llEvLisnrs},nf=(e,t,i)=>{hy(e),Pl(i,-1),py(i),ut(e,t.class_loading),t.unobserve_completed&&io(e,i)},zy=(e,t,i,n)=>{const r=kl(t);nf(t,i,n),cn(t,i.class_loaded),Ai(t,Vd),Kt(i.callback_loaded,t,n),r||tf(i,n)},Dy=(e,t,i,n)=>{const r=kl(t);nf(t,i,n),cn(t,i.class_error),Ai(t,El),Kt(i.callback_error,t,n),i.restore_on_error&&xi(t,qn),r||tf(i,n)},Dl=(e,t,i)=>{const n=Hd(e)||e;if(zl(n))return;By(n,o=>{zy(o,e,t,i),da(n)},o=>{Dy(o,e,t,i),da(n)})},Ly=(e,t,i)=>{cy(e),Dl(e,t,i),vy(e),Cy(e,t,i),by(e,t,i),Ay(e,t,i)},Ry=(e,t,i)=>{Dl(e,t,i),Ey(e,t,i)},Ll=(e,t,i)=>{ky(e)?Ry(e,t,i):Ly(e,t,i)},jy=(e,t,i)=>{e.setAttribute("loading","lazy"),Dl(e,t,i),Ty(e,t),Ai(e,Ud)},Sc=e=>{e.removeAttribute(Et),e.removeAttribute(bl),e.removeAttribute(Al)},_y=e=>{Bl(e,t=>{Sc(t)}),Sc(e)},rf=e=>{Bl(e,t=>{xi(t,qn)}),xi(e,qn)},Vy=e=>{Zd(e,t=>{xi(t,no)}),xi(e,Yd),e.load()},Oy=e=>{xi(e,no)},Uy=e=>{xi(e,Gd)},$y={IMG:rf,IFRAME:Oy,VIDEO:Vy,OBJECT:Uy},Wy=e=>{const t=$y[e.tagName];if(!t){yy(e);return}t(e)},Hy=(e,t)=>{Nl(e)||kl(e)||(ut(e,t.class_entered),ut(e,t.class_exited),ut(e,t.class_applied),ut(e,t.class_loading),ut(e,t.class_loaded),ut(e,t.class_error))},Fy=(e,t)=>{Wy(e),Hy(e,t),to(e),Jd(e)},Qy=(e,t,i,n)=>{!i.cancel_on_exit||!oy(e)||e.tagName==="IMG"&&(da(e),_y(e),rf(e),ut(e,i.class_loading),Pl(n,-1),to(e),Kt(i.callback_cancel,e,t,n))},Zy=(e,t,i,n)=>{const r=uy(e);Ai(e,ry),cn(e,i.class_entered),ut(e,i.class_exited),fy(e,i,n),Kt(i.callback_enter,e,t,n),!r&&Ll(e,i,n)},Yy=(e,t,i,n)=>{Nl(e)||(cn(e,i.class_exited),Qy(e,t,i,n),Kt(i.callback_exit,e,t,n))},Gy=["IMG","IFRAME","VIDEO"],sf=e=>e.use_native&&"loading"in HTMLImageElement.prototype,Xy=(e,t,i)=>{e.forEach(n=>{Gy.indexOf(n.tagName)!==-1&&jy(n,t,i)}),Fd(i,0)},Jy=e=>e.isIntersecting||e.intersectionRatio>0,Ky=e=>({root:e.container===document?null:e.container,rootMargin:e.thresholds||e.threshold+"px"}),qy=(e,t,i)=>{e.forEach(n=>Jy(n)?Zy(n.target,n,t,i):Yy(n.target,n,t,i))},ex=(e,t)=>{t.forEach(i=>{e.observe(i)})},tx=(e,t)=>{dy(e),ex(e,t)},ix=(e,t)=>{!zd||sf(e)||(t._observer=new IntersectionObserver(i=>{qy(i,e,t)},Ky(e)))},of=e=>Array.prototype.slice.call(e),Ss=e=>e.container.querySelectorAll(e.elements_selector),nx=e=>of(e).filter(Nl),rx=e=>ay(e),sx=e=>of(e).filter(rx),Mc=(e,t)=>nx(e||Ss(t)),ox=(e,t)=>{sx(Ss(e)).forEach(n=>{ut(n,e.class_error),to(n)}),t.update()},ax=(e,t)=>{!Jt||(t._onlineHandler=()=>{ox(e,t)},window.addEventListener("online",t._onlineHandler))},lx=e=>{!Jt||window.removeEventListener("online",e._onlineHandler)},Mr=function(e,t){const i=Rd(e);this._settings=i,this.loadingCount=0,ix(i,this),ax(i,this),this.update(t)};Mr.prototype={update:function(e){const t=this._settings,i=Mc(e,t);if(Fd(this,i.length),Bd||!zd){this.loadAll(i);return}if(sf(t)){Xy(i,t,this);return}tx(this._observer,i)},destroy:function(){this._observer&&this._observer.disconnect(),lx(this),Ss(this._settings).forEach(e=>{Jd(e)}),delete this._observer,delete this._settings,delete this._onlineHandler,delete this.loadingCount,delete this.toLoadCount},loadAll:function(e){const t=this._settings;Mc(e,t).forEach(n=>{io(n,this),Ll(n,t,this)})},restoreAll:function(){const e=this._settings;Ss(e).forEach(t=>{Fy(t,e)})}};Mr.load=(e,t)=>{const i=Rd(t);Ll(e,i)};Mr.resetStatus=e=>{to(e)};Jt&&ny(Mr,window.lazyLoadOptions);class af{constructor({readonly:t,box:i,pages:n,onNewPageIndex:r,onPlay:s}){if(this.pageIndex=0,this.namespace="netless-app-docs-viewer",this.isShowPreview=!1,this.isSmallBox=!1,this.sideEffect=new eo,n.length<=0)throw new Error("[DocsViewer] Empty pages.");this.readonly=t,this.box=i,this.pages=n,this.onNewPageIndex=r,this.onPlay=s,this.onPageIndexChanged=()=>{},this.render()}mount(){this.box.mountContent(this.$content),this.box.mountFooter(this.$footer),this.sideEffect.add(()=>{const t=new Mr({container:this.$preview,elements_selector:`.${this.wrapClassName("preview-page>img")}`});return()=>t.destroy()},"preview-lazyload")}unmount(){this.$content.remove(),this.$footer.remove()}setReadonly(t){this.readonly!==t&&(this.readonly=t,this.$content.classList.toggle(this.wrapClassName("readonly"),t),this.$footer.classList.toggle(this.wrapClassName("readonly"),t),this.$pageNumberInput.disabled=t)}destroy(){this.sideEffect.flushAll(),this.unmount()}setPageIndex(t){Number.isNaN(t)||(this.pageIndex=t,this.$pageNumberInput.value=String(t+1),this.onPageIndexChanged(t))}setSmallBox(t){this.isSmallBox!==t&&(this.isSmallBox=t,this.$footer.classList.toggle(this.wrapClassName("float-footer"),t))}render(){return this.renderContent(),this.renderFooter(),this.$content}renderContent(){if(!this.$content){const t=document.createElement("div");t.className=this.wrapClassName("content"),this.$content=t,this.readonly&&t.classList.add(this.wrapClassName("readonly")),t.appendChild(this.renderPreviewMask()),t.appendChild(this.renderPreview())}return this.$content}renderPreview(){if(!this.$preview){const t=document.createElement("div");t.className=this.wrapClassName("preview")+" tele-fancy-scrollbar",this.$preview=t;const i=this.wrapClassName("preview-page"),n=this.wrapClassName("preview-page-name");this.pages.forEach((r,s)=>{var o;const a=(o=r.thumbnail)!=null?o:r.src.startsWith("ppt")?void 0:r.src;if(!a)return;const l=String(s),u=document.createElement("a");u.className=i+" "+this.wrapClassName(`preview-page-${s}`),u.setAttribute("href","#"),u.dataset.pageIndex=l;const h=document.createElement("span");h.className=n,h.textContent=String(s+1),h.dataset.pageIndex=l;const c=document.createElement("img");c.width=r.width,c.height=r.height,c.dataset.src=a,c.dataset.pageIndex=l,u.appendChild(c),u.appendChild(h),t.appendChild(u)}),this.sideEffect.addEventListener(t,"click",r=>{var s;if(this.readonly)return;const o=(s=r.target.dataset)==null?void 0:s.pageIndex;o&&(r.preventDefault(),r.stopPropagation(),r.stopImmediatePropagation(),this.onNewPageIndex(Number(o)),this.togglePreview(!1))})}return this.$preview}renderPreviewMask(){return this.$previewMask||(this.$previewMask=document.createElement("div"),this.$previewMask.className=this.wrapClassName("preview-mask"),this.sideEffect.addEventListener(this.$previewMask,"click",t=>{this.readonly||t.target===this.$previewMask&&this.togglePreview(!1)})),this.$previewMask}renderFooter(){if(!this.$footer){const t=document.createElement("div");if(t.className=this.wrapClassName("footer"),this.$footer=t,this.readonly&&t.classList.add(this.wrapClassName("readonly")),this.isSmallBox&&t.classList.add(this.wrapClassName("float-footer")),this.pages.some(l=>l.thumbnail||!l.src.startsWith("ppt"))){const l=this.renderFooterBtn("btn-sidebar",Jw(this.namespace));this.sideEffect.addEventListener(l,"click",()=>{this.readonly||this.togglePreview()}),this.$footer.appendChild(l)}const i=document.createElement("div");i.className=this.wrapClassName("page-jumps");const n=this.renderFooterBtn("btn-page-back",Kw(this.namespace));if(this.sideEffect.addEventListener(n,"click",()=>{this.readonly||this.onNewPageIndex(this.pageIndex-1)}),i.appendChild(n),this.onPlay){const l=this.renderFooterBtn("btn-page-play",ey(this.namespace),ty(this.namespace)),u=()=>{this.sideEffect.setTimeout(()=>{l.classList.toggle(this.wrapClassName("footer-btn-playing"),!1)},500,"returnPlay")};this.sideEffect.addEventListener(l,"click",()=>{this.readonly||(l.classList.toggle(this.wrapClassName("footer-btn-playing"),!0),this.onPlay&&this.onPlay(),u())}),i.appendChild(l)}const r=this.renderFooterBtn("btn-page-next",qw(this.namespace));this.sideEffect.addEventListener(r,"click",()=>{this.readonly||this.onNewPageIndex(this.pageIndex+1)}),i.appendChild(r);const s=document.createElement("div");s.className=this.wrapClassName("page-number");const o=document.createElement("input");o.className=this.wrapClassName("page-number-input"),o.value=String(this.pageIndex+1),this.readonly&&(o.disabled=!0),this.$pageNumberInput=o,this.sideEffect.addEventListener(o,"focus",()=>{o.select()}),this.sideEffect.addEventListener(o,"change",()=>{this.readonly||o.value&&this.onNewPageIndex(Number(o.value)-1)});const a=document.createElement("span");a.textContent=" / "+this.pages.length,s.appendChild(o),s.appendChild(a),this.$footer.appendChild(i),this.$footer.appendChild(s)}return this.$footer}renderFooterBtn(t,i,n){const r=document.createElement("button");return r.className=this.wrapClassName("footer-btn")+" "+this.wrapClassName(t),r.appendChild(i),n&&r.appendChild(n),r}togglePreview(t){if(this.isShowPreview=t!=null?t:!this.isShowPreview,this.$content.classList.toggle(this.wrapClassName("preview-active"),this.isShowPreview),this.isShowPreview){const i=this.$preview.querySelector("."+this.wrapClassName(`preview-page-${this.pageIndex}`));i&&this.$preview.scrollTo({top:i.offsetTop-16})}}wrapClassName(t){return`${this.namespace}-${t}`}}function tn(e,t,i){return Math.min(Math.max(e,t),i)}function Ic(e){return e.touches?e.touches[0]:e}function lf(e){e.stopPropagation(),e.cancelable&&e.preventDefault()}function uf(e){if(!e)return!1;const t=e.tagName;return t==="INPUT"||t==="TEXTAREA"||t==="SELECT"}class ux{constructor(t){var i,n,r;this.velocity=0,this.paused=!0,this._animationFrameID=null,this._loopTimestamp=0,this.looper=s=>{if(this.paused)return;let o=Math.floor((s-this._loopTimestamp)/1e3*60)+1;for(this._loopTimestamp=s;o-- >0;)this.stepper();this.onStep(this.current,this),!this.paused&&this.current!==this.target&&window.requestAnimationFrame(this.looper)},this.current=(i=t.start)!=null?i:0,this.target=this.current,this.stiffness=(n=t.stiffness)!=null?n:170,this.damping=(r=t.damping)!=null?r:26,this.onStep=t.onStep}stepTo(t,i){this.paused&&i!=null&&(this.current=i),this.paused=!1,this.target=t,this.onStep(this.current,this),this._loopTimestamp=Date.now(),window.requestAnimationFrame(this.looper)}pause(){this.paused=!0}destroy(){this.pause()}stepper(){const t=-this.stiffness*(this.current-this.target),i=-this.damping*this.velocity,n=this.velocity+(t+i)/60,r=this.current+n/60;Math.abs(n-0)<.01&&Math.abs(r-this.target)<.01?(this.current=this.target,this.velocity=0):(this.current=r,this.velocity=n)}}class cx{constructor(t,i,n,r){this.scale=1,this.lastVisit=Date.now(),this.pageOffsetY=0,this.pageOffsetX=0,this.visible=!0,this.index=t,this.page=i,this.scale=n,this.pageOffsetX=(r-i.width)/2;const s=document.createElement("div");s.className="page-renderer-page",s.dataset.index=`${t}`,s.style.width=`${i.width*n}px`,s.style.height=`${i.height*n}px`,i.thumbnail&&(s.style.backgroundImage=`url("${i.thumbnail}")`);const o=document.createElement("img");o.className="page-renderer-page-img",o.width=i.width,o.height=i.height,o.src=i.src,s.appendChild(o),this.$page=s}translateY(t){Math.abs(t-this.pageOffsetY)>=.001&&(this.pageOffsetY=t,this.$page.style.transform=`translate(${this.pageOffsetX*this.scale}px, ${this.pageOffsetY*this.scale}px)`)}setScale(t){Math.abs(t-this.scale)>=.001&&(this.scale=t,this.$page.style.width=`${this.page.width*this.scale}px`,this.$page.style.height=`${this.page.height*this.scale}px`,this.$page.style.transform=`translate(${this.pageOffsetX*this.scale}px, ${this.pageOffsetY*this.scale}px)`)}setVisible(t){t!==this.visible&&(this.visible=t,this.$page.style.opacity=t?"1":"0")}}const hx=window.requestIdleCallback||(e=>window.setTimeout(e,5e3)),dx=window.cancelIdleCallback||window.clearTimeout;class fx{constructor(t,i,n){this.pages=t,this.pagesIntrinsicWidth=i,this.scale=n,this.els=new Map,this.maxElCount=200,this.gcTimer=null,this.gc=()=>{if(this.gcTimer=null,this.els.size>this.maxElCount){const r=[...this.els.values()].sort((s,o)=>o.lastVisit-s.lastVisit);for(let s=Math.floor(this.maxElCount/4);s<r.length;s++)this.els.delete(r[s].index)}}}getEl(t){let i=this.els.get(t);return i||(i=new cx(t,this.pages[t],this.scale,this.pagesIntrinsicWidth),this.els.set(t,i)),i.lastVisit=Date.now(),this.els.size>this.maxElCount&&this.gcTimer===null&&(this.gcTimer=hx(this.gc)),i}setScale(t){t!==this.scale&&(this.scale=t,this.els.forEach(i=>i.setScale(t)))}destroy(){this.els.clear(),this.gcTimer!==null&&(dx(this.gcTimer),this.gcTimer=null)}}class px{constructor(t){this._hwaTimeout=NaN,this._turnOffHWA=()=>{window.clearTimeout(this._hwaTimeout),this._hwaTimeout=NaN,this.$pages.classList.toggle("is-hwa",!1)},this.pagesScrollTop=t.pagesScrollTop||0,this.containerWidth=t.containerWidth||1,this.containerHeight=t.containerHeight||1,this.pages=t.pages.map(s=>{if(s.thumbnail)return s;try{const o=new URL(s.src);return o.searchParams.set("x-oss-process","image/resize,l_50"),{...s,thumbnail:o.toString()}}catch(o){return console.error(o),s}});const i=Array(this.pages.length);let n=1/0,r=0;this.pagesIntrinsicHeight=this.pages.reduce((s,o,a)=>(i[a]=s,o.width>r&&(r=o.width),o.height<=n&&(n=o.height),s+o.height),0),this.pagesIntrinsicWidth=r,this.pagesMinHeight=n,this.pagesIntrinsicYs=i,this.scale=this._calcScale(),this.threshold=this._calcThreshold(),this.onPageIndexChanged=t.onPageIndexChanged,this.pageScrollIndex=0,this.pagesScrollTop!==0&&(this.pageScrollIndex=this.findScrollPageIndex(),this.onPageIndexChanged&&this.pageScrollIndex>0&&this.onPageIndexChanged(this.pageScrollIndex)),this.pageElManager=new fx(this.pages,r,this.scale),this.$pages=this.renderPages()}setContainerSize(t,i){t>0&&i>0&&(t!==this.containerWidth||i!==this.containerHeight)&&(this.containerWidth=t,this.containerHeight=i,this.$pages.style.width=`${this.containerWidth}px`,this.$pages.style.height=`${this.containerHeight}px`,this.scale=this._calcScale(),this.threshold=this._calcThreshold(),this.pageElManager.setScale(this.scale),this.$pages.parentElement&&this.pagesScrollTo(this.pagesScrollTop,!0))}renderPages(){const t=document.createElement("div");return t.className="page-renderer-pages-container",t.style.width=`${this.containerWidth}px`,t.style.height=`${this.containerHeight}px`,t}pagesScrollTo(t,i){if(t=tn(t,0,this.pagesIntrinsicHeight-this.containerHeight/this.scale),i||Math.abs(t-this.pagesScrollTop)>=.001){this._turnOnHWA(),this.pagesScrollTop=t;const n=this.findScrollPageIndex(),r=Math.max(n-this.threshold,0),s=Math.min(n+this.threshold,this.pages.length-1);for(let o=0;o<this.$pages.children.length;o++){const a=this.$pages.children[o],l=Number(a.dataset.index);l>=r&&l<=s||(a.remove(),o--)}for(let o=r;o<=s;o++){const a=this.pageElManager.getEl(o);a.$page.parentElement!==this.$pages&&this.$pages.appendChild(a.$page),a.translateY(this.pagesIntrinsicYs[o]-this.pagesScrollTop)}n!==this.pageScrollIndex&&(this.pageScrollIndex=n,this.onPageIndexChanged&&this.onPageIndexChanged(n))}}findScrollPageIndex(){for(let t=0;t<this.pagesIntrinsicYs.length;t++)if(this.pagesIntrinsicYs[t]+this.pages[t].height-this.pagesScrollTop>=.001)return t;return this.pagesIntrinsicYs.length-1}mount(t){t.appendChild(this.$pages),this.pagesScrollTo(this.pagesScrollTop,!0)}unmount(){this.$pages.remove()}destroy(){this.unmount(),this.onPageIndexChanged=void 0,this.pageElManager.destroy(),this._hwaTimeout&&(window.clearTimeout(this._hwaTimeout),this._hwaTimeout=NaN)}_calcScale(){return this.containerWidth/this.pagesIntrinsicWidth||1}_calcThreshold(){return tn(Math.ceil(this.containerHeight/this.scale/this.pagesMinHeight/2),1,this.pages.length)}_turnOnHWA(){this._hwaTimeout?window.clearTimeout(this._hwaTimeout):this.$pages.classList.toggle("is-hwa",!0),this._hwaTimeout=window.setTimeout(this._turnOffHWA,1e3)}}const gx=30;class mx{constructor(t){this.sideEffect=new eo,this.pagesScrollTop=t.pagesScrollTop||0,this.containerWidth=t.containerWidth||1,this.containerHeight=t.containerHeight||1,this.pagesWidth=t.pagesWidth||1,this.pagesHeight=t.pagesHeight||1,this.scale=this._calcScale(),this.scrollbarMinHeight=t.scrollbarMinHeight||gx,this.scrollbarHeight=this._calcScrollbarHeight(),this.readonly=t.readonly,this.wrapClassName=t.wrapClassName,this.onDragScroll=t.onDragScroll,this.$scrollbar=this.renderScrollbar()}mount(t){t.appendChild(this.$scrollbar),this.pagesScrollTo(this.pagesScrollTop,!0)}unmount(){this.$scrollbar.remove()}setReadonly(t){this.readonly=t}setContainerSize(t,i){t>0&&i>0&&(t!==this.containerWidth||i!==this.containerHeight)&&(this.containerWidth=t,this.containerHeight=i,this.scale=this._calcScale(),this._updateScrollbarHeight(),this.$scrollbar.parentElement&&this.pagesScrollTo(this.pagesScrollTop,!0))}pagesScrollTo(t,i){if(t=tn(t,0,this.pagesHeight-this.containerHeight/this.scale),i||Math.abs(t-this.pagesScrollTop)>=.001){this.pagesScrollTop=t;const n=this.pagesScrollTop*this.scale,r=this.pagesHeight*this.scale,s=n/(r-this.containerHeight)*(this.containerHeight-this.scrollbarHeight);window.requestAnimationFrame?window.requestAnimationFrame(()=>{this.$scrollbar.style.transform=`translateY(${s}px)`}):this.$scrollbar.style.transform=`translateY(${s}px)`}}destroy(){this.unmount(),this.onDragScroll=void 0,this.sideEffect.flushAll()}renderScrollbar(){const t=document.createElement("button");t.className=this.wrapClassName("scrollbar"),t.style.minHeight=`${this.scrollbarMinHeight}px`,t.style.height=`${this.scrollbarHeight}px`;const i=n=>{if(this.readonly||n.button!=null&&n.button!==0)return;lf(n);const r=this.wrapClassName("scrollbar-dragging");t.classList.toggle(r,!0);const s=this.pagesScrollTop,{clientY:o}=Ic(n),a=u=>{if(this.readonly)return;const{clientY:h}=Ic(u),c=(h-o)/this.scale;Math.abs(c)>0&&this.onDragScroll&&this.onDragScroll(s+c*(this.pagesHeight*this.scale/this.containerHeight))},l=()=>{t.classList.toggle(r,!1),window.removeEventListener("mousemove",a,!0),window.removeEventListener("touchmove",a,!0),window.removeEventListener("mouseup",l,!0),window.removeEventListener("touchend",l,!0),window.removeEventListener("touchcancel",l,!0)};window.addEventListener("mousemove",a,!0),window.addEventListener("touchmove",a,!0),window.addEventListener("mouseup",l,!0),window.addEventListener("touchend",l,!0),window.addEventListener("touchcancel",l,!0)};return this.sideEffect.addEventListener(t,"mousedown",i),this.sideEffect.addEventListener(t,"touchstart",i),t}_calcScale(){return this.containerWidth/this.pagesWidth||1}_calcScrollbarHeight(){return tn(this.containerHeight/(this.pagesHeight*this.scale)*this.containerHeight,this.scrollbarMinHeight,this.containerHeight)}_updateScrollbarHeight(){const t=this._calcScrollbarHeight();Math.abs(t-this.scrollbarHeight)>.001&&(this.scrollbarHeight=t,this.$scrollbar.style.height=`${t}px`)}}const vx=window.ResizeObserver||Xw,yn=640;class wx{constructor({context:t,whiteboardView:i,readonly:n,box:r,pages:s,pageScrollTop:o=0,mountWhiteboard:a,onUserScroll:l,baseScenePath:u,appId:h}){this.sideEffect=new eo,this.userScrolling=!1,this.docsViewReadonly=!1,this.onNewPageIndex=w=>{this.scrollToPage(w)},this.toPdf=async()=>{const w=document.createElement("canvas"),x=w.getContext("2d");if(!x||!this.baseScenePath){this.reportProgress(100,null);return}const d=this.whiteboardView.focusScenePath||`${this.baseScenePath}/1`,f=this.pages[0],{jsPDF:g}=await Promise.resolve().then(function(){return _g(require("jspdf"))}),p=new g({format:[f.width,f.height],orientation:f.width>f.height?"l":"p",compress:!0});for(const[S,T]of this.pages.entries()){const{width:k,height:B,src:z}=T;w.width=k,w.height=B;const ee=k>B?"l":"p";S>0&&p.addPage([k,B],ee);const C=await this.getBase64FromUrl(z),M=document.createElement("img");M.src=C,await new Promise(Y=>M.onload=Y),x.drawImage(M,0,0);const _=w.toDataURL("image/jpeg",.6);x.clearRect(0,0,k,B);const D={centerX:k/2,centerY:B/2+S*B,scale:1},Z=this.context.manager.windowManger;Z._appliancePlugin?await Z._appliancePlugin.screenshotToCanvasAsync(x,d,k,B,D):this.whiteboardView.screenshotToCanvas(x,d,k,B,D);const te=w.toDataURL("image/png");p.addImage(_,"JPEG",0,0,k,B,"","FAST"),p.addImage(te,"PNG",0,0,k,B,"","FAST"),x.clearRect(0,0,k,B),Math.ceil((S+1)/this.pages.length*100)<100&&this.reportProgress(Math.ceil((S+1)/this.pages.length*100),null)}const y=p.output("arraybuffer");this.reportProgress(100,{pdf:y,title:this.box.title})},this.context=t,this.whiteboardView=i,this.readonly=n,this.box=r,this.pages=s,this.baseScenePath=u,this.appId=h,this.mountWhiteboard=a,this._onUserScroll=l;const c=this.debounce(()=>{this.userScrolling=!1,this._onUserScroll&&this._onUserScroll(this.pageRenderer.pagesScrollTop)},{wait:80},"debounce-updateUserScroll");this.updateUserScroll=()=>{this.userScrolling=!0,c()},this.viewer=new af({readonly:n,box:r,pages:s,onNewPageIndex:this.onNewPageIndex});const{width:m,height:v}=this.whiteboardView.size;this.pageRenderer=new px({pagesScrollTop:o,pages:this.pages,containerWidth:m,containerHeight:v,onPageIndexChanged:this.viewer.setPageIndex.bind(this.viewer)}),this.scrollbar=new mx({pagesScrollTop:this.pageRenderer.pagesScrollTop,containerWidth:m,containerHeight:v,pagesWidth:this.pageRenderer.pagesIntrinsicWidth,pagesHeight:this.pageRenderer.pagesIntrinsicHeight,readonly:this.readonly,wrapClassName:this.wrapClassName.bind(this),onDragScroll:w=>{this.pageScrollTo(w),this.updateUserScroll()}}),this.pageScrollStepper=new ux({start:this.pageRenderer.pagesScrollTop,onStep:w=>{this.pageScrollTo(w)}}),this.render()}setDocsViewReadonly(t){this.docsViewReadonly=t}mount(){this.viewer.mount(),this.setupScrollListener();const t=this.debounce(this.renderRatioHeight.bind(this),{wait:80});return this.sideEffect.add(()=>{const i=new vx(t);return i.observe(this.viewer.$content),()=>i.disconnect()}),this.sideEffect.setTimeout(()=>{this.userScrolling||this.pageScrollTo(this.pageRenderer.pagesScrollTop)},100),this.sideEffect.add(()=>{const i=n=>{n.data.type==="@netless/_request_save_pdf_"&&n.data.appId===this.appId&&this.toPdf().catch(()=>this.reportProgress(100,null))};return window.addEventListener("message",i),()=>{window.removeEventListener("message",i)}}),this}unmount(){return this.viewer.unmount(),this}setReadonly(t){this.readonly!==t&&(this.readonly=t,this.viewer.setReadonly(t),this.scrollbar.setReadonly(t))}destroy(){this.sideEffect.flushAll(),this.pageScrollStepper.destroy(),this._onUserScroll=void 0,this.unmount(),this.viewer.destroy(),this.pageRenderer.destroy(),this.scrollbar.destroy()}syncPageScrollTop(t){!this.userScrolling&&t>=0&&Math.abs(this.pageRenderer.pagesScrollTop-t)>.01&&this.pageScrollStepper.stepTo(t,this.pageRenderer.pagesScrollTop)}render(){this.pageRenderer.mount(this.viewer.$content),this.viewer.$content.appendChild(this.renderWhiteboardView()),this.scrollbar.mount(this.viewer.$content),this.renderRatioHeight()}renderRatioHeight(){const t=this.box.absoluteHeight,i=t<=yn;if(this.viewer.setSmallBox(i),i){const n=26/yn,r=26/t,s=26/yn,o=0,a=Math.max((n+s-(r+o))/2,0);if(this.box.$titleBar){const l=r+a;this.box.$titleBar.style.height=`${l*100}%`}if(this.box.$footer){const l=o+a;this.box.$footer.style.height=`${l*100}%`}}else{if(this.box.$titleBar){const n=Math.max(26/yn,26/t);this.box.$titleBar.style.height=`${n*100}%`}if(this.box.$footer){const n=Math.max(26/yn,26/t);this.box.$footer.style.height=`${n*100}%`}}}renderWhiteboardView(){return this.$whiteboardView||(this.$whiteboardView=document.createElement("div"),this.$whiteboardView.className=this.wrapClassName("wb-view"),this.mountWhiteboard(this.$whiteboardView),this.sideEffect.addEventListener(this.$whiteboardView,"wheel",t=>{lf(t),this.readonly||(this.pageScrollTo(this.pageRenderer.pagesScrollTop+t.deltaY),this.updateUserScroll())},{passive:!1,capture:!0}),this.sideEffect.addEventListener(this.$whiteboardView,"touchmove",t=>{this.readonly||t.touches.length<=1||this.updateUserScroll()},{passive:!0,capture:!0})),this.$whiteboardView}scrollTopPageToEl(t){return t*this.pageRenderer.scale}scrollTopElToPage(t){return t/this.pageRenderer.scale}elScrollTo(t){this.pageScrollTo(this.scrollTopElToPage(t))}pageScrollTo(t){const i=this.scrollTopElToPage(this.whiteboardView.size.height/2);this.whiteboardView.moveCamera({centerY:tn(t+i,i,this.pageRenderer.pagesIntrinsicHeight-i),animationMode:"immediately"})}scrollToPage(t){if(!this.readonly&&!Number.isNaN(t)){const i=this.pageRenderer.pagesIntrinsicYs[t];i>=0&&(this.pageScrollTo(i+5/this.pageRenderer.scale),this.updateUserScroll())}}setupScrollListener(){this.sideEffect.add(()=>{const t=i=>{const{width:n,height:r}=this.whiteboardView.size;if(n<=0||r<=0)return;const s=i.centerY-this.pageRenderer.containerHeight/this.pageRenderer.scale/2;this.pageRenderer.pagesScrollTo(s),this.scrollbar.pagesScrollTo(s)};return this.whiteboardView.callbacks.on("onCameraUpdated",t),()=>this.whiteboardView.callbacks.off("onCameraUpdated",t)}),this.sideEffect.add(()=>{const{updateUserScroll:t}=this;return this.whiteboardView.callbacks.on("onCameraUpdatedByDevice",t),()=>this.whiteboardView.callbacks.off("onCameraUpdatedByDevice",t)}),this.sideEffect.add(()=>{const t=({width:i,height:n})=>{if(i<=0||n<=0)return;this.pageRenderer.setContainerSize(i,n),this.scrollbar.setContainerSize(i,n);const{pagesIntrinsicWidth:r,pagesIntrinsicHeight:s}=this.pageRenderer;this.whiteboardView.moveCameraToContain({originX:0,originY:this.pageRenderer.pagesScrollTop,width:r,height:n/this.pageRenderer.scale,animationMode:"immediately"}),this.whiteboardView.setCameraBound({damping:1,maxContentMode:()=>this.pageRenderer.scale,minContentMode:()=>this.pageRenderer.scale,centerX:r/2,centerY:s/2,width:r,height:s})};return this.whiteboardView.callbacks.on("onSizeUpdated",t),()=>{this.whiteboardView.callbacks.off("onSizeUpdated",t)}},"whiteboard-size-update"),this.sideEffect.addEventListener(window,"keyup",t=>{if(this.readonly||!this.box.focus||this.box.minimized||uf(t.target)||this.docsViewReadonly)return;let i=null;switch(t.key){case"PageDown":{i=this.pageRenderer.pagesScrollTop+this.pageRenderer.containerHeight/this.pageRenderer.scale;break}case"PageUp":{i=this.pageRenderer.pagesScrollTop-this.pageRenderer.containerHeight/this.pageRenderer.scale;break}case"ArrowDown":{i=this.pageRenderer.pagesScrollTop+this.pageRenderer.containerHeight/4/this.pageRenderer.scale;break}case"ArrowUp":{i=this.pageRenderer.pagesScrollTop-this.pageRenderer.containerHeight/4/this.pageRenderer.scale;break}}i!==null&&(this._onUserScroll?this._onUserScroll(i):(this.pageScrollTo(i),this.updateUserScroll()))},{capture:!0})}debounce(t,i,n){const r=Cw(t,i);return this.sideEffect.addDisposer(()=>r.cancel(),n),r}wrapClassName(t){return"netless-app-docs-viewer-static-"+t}async getBase64FromUrl(t){const n=await(await fetch(this._invalidate(t))).blob();return new Promise(r=>{const s=new FileReader;s.readAsDataURL(n),s.onloadend=()=>{const o=s.result;r(o)}})}_invalidate(t){try{const i=new URL(t);return i.searchParams.set("t",Date.now().toString()),i.toString()}catch{return t}}reportProgress(t,i){window.postMessage({type:"@netless/_result_save_pdf_",appId:this.appId,progress:t,result:i})}}class yx{constructor({context:t,whiteboardView:i,box:n,pages:r}){this.sideEffect=new eo,this.docsViewReadonly=!1,this.onPlayPPT=()=>{const s=this.context.getRoom();s&&s.pptNextStep()},this._scaleDocsToFitImpl=()=>{const s=this.pages[this.getPageIndex()];s&&(this.whiteboardView.moveCameraToContain({originX:-s.width/2,originY:-s.height/2,width:s.width,height:s.height,animationMode:"immediately"}),this.whiteboardView.setCameraBound({damping:1,maxContentMode:()=>this.whiteboardView.camera.scale,minContentMode:()=>this.whiteboardView.camera.scale,centerX:0,centerY:0,width:s.width,height:s.height}))},this._scaleDocsToFitDebounced=()=>{this.sideEffect.setTimeout(this._scaleDocsToFitImpl,1e3,"_scaleDocsToFitDebounced")},this.scaleDocsToFit=()=>{this._scaleDocsToFitImpl(),this._scaleDocsToFitDebounced()},this.onNewPageIndex=s=>{this.jumpToPage(s,!0)},this.context=t,this.whiteboardView=i,this.box=n,this.pages=r,this.displayer=t.getDisplayer(),this.viewer=new af({readonly:!t.getIsWritable(),box:n,pages:r,onNewPageIndex:this.onNewPageIndex,onPlay:this.onPlayPPT}),this.render(),this.sideEffect.add(()=>{const s=o=>{this.viewer.setReadonly(!o)};return this.context.emitter.on("writableChange",s),()=>this.context.emitter.off("writableChange",s)}),this.sideEffect.add(()=>{const s=o=>{this.jumpToPage(o.index)};return this.context.emitter.on("sceneStateChange",s),()=>this.context.emitter.off("sceneStateChange",s)})}setDocsViewReadonly(t){this.docsViewReadonly=t}mount(){this.viewer.mount();const t=this.getPageIndex();return t!==0&&this.jumpToPage(t),this.scaleDocsToFit(),this.sideEffect.add(()=>(this.whiteboardView.callbacks.on("onSizeUpdated",this.scaleDocsToFit),()=>{this.whiteboardView.callbacks.off("onSizeUpdated",this.scaleDocsToFit)})),this}unmount(){return this.viewer.unmount(),this}destroy(){this.sideEffect.flushAll(),this.unmount(),this.viewer.destroy()}getPageIndex(){return this.displayer.state.sceneState.index}jumpToPage(t,i){var n,r;if(t=tn(t,0,this.pages.length-1),t!==this.getPageIndex()&&this.context.getIsWritable()){const s=this.context.getInitScenePath(),o=(r=(n=this.context.getScenes())==null?void 0:n[t])==null?void 0:r.name;s&&o&&this.context.setScenePath(`${s}/${o}`),this.scaleDocsToFit()}if(t!==this.viewer.pageIndex&&this.viewer.setPageIndex(t),i){const s=this.context.getRoom();if(s){const o=s.state.globalState.__pptState;s.setGlobalState({__pptState:o&&{uuid:o.uuid,pageIndex:t,disableAutoPlay:o.disableAutoPlay}})}}}render(){this.viewer.$content.appendChild(this.renderMask()),this.viewer.$content.appendChild(this.renderWhiteboardView()),this.sideEffect.addEventListener(window,"keydown",t=>{var i;if(!this.docsViewReadonly&&this.box.focus&&!uf(t.target))switch(t.key){case"ArrowUp":case"ArrowLeft":{this.jumpToPage(this.getPageIndex()-1,!0);break}case"ArrowRight":case"ArrowDown":{(i=this.context.getRoom())==null||i.pptNextStep();break}}})}renderMask(){if(!this.$mask){const t=document.createElement("div");t.className=this.wrapClassName("mask"),this.$mask=t;const i=document.createElement("button");i.className=this.wrapClassName("back");const n=document.createElement("button");n.className=this.wrapClassName("next")}return this.$mask}renderWhiteboardView(){return this.$whiteboardView||(this.$whiteboardView=document.createElement("div"),this.$whiteboardView.className=this.wrapClassName("wb-view"),this.sideEffect.addEventListener(this.$whiteboardView,"click",t=>{var i;const n=this.context.getRoom();if(n&&n.state.memberState.currentApplianceName==="clicker"){for(let r=t.target;r;r=r.parentElement)if((i=r.classList)!=null&&i.contains("ppt-event-source"))return;n.pptNextStep()}}),this.context.mountView(this.$whiteboardView)),this.$whiteboardView}wrapClassName(t){return"netless-app-docs-viewer-dynamic-"+t}}const xx="DocsViewer",fa={kind:xx,setup(e){const t=e.getBox(),i=e.getScenes();if(!i)throw new Error("[Docs Viewer]: scenes not found.");const n=e.getView();if(!n)throw new Error("[Docs Viewer]: no whiteboard view.");const r=i.map(({ppt:a})=>a?{width:a.width,height:a.height,src:a.src,thumbnail:a.previewURL}:null).filter(a=>Boolean(a));if(r.length<=0)throw new Error("[Docs Viewer]: empty scenes.");t.mountStyles(gw);let s=null;return r[0].src.startsWith("ppt")?s=Mx(e,n,t,r):s=Sx(e,n,t,r),(e.getAppOptions()||{}).justDocsViewReadonly&&s.setDocsViewReadonly(!0),{setDocsViewReadonly:a=>{s==null||s.setDocsViewReadonly(a)}}}};function Sx(e,t,i,n){var r;t.disableCameraTransform=!e.getIsWritable();const s=new wx({context:e,whiteboardView:t,readonly:!e.getIsWritable(),box:i,pages:n,pageScrollTop:(r=e.getAttributes())==null?void 0:r.pageScrollTop,mountWhiteboard:e.mountView.bind(e),onUserScroll:o=>{var a;((a=e.getAttributes())==null?void 0:a.pageScrollTop)!==o&&!i.readonly&&e.updateAttributes(["pageScrollTop"],o)},baseScenePath:e.getInitScenePath(),appId:e.appId}).mount();return s.viewer.onPageIndexChanged=o=>{e.dispatchAppEvent("pageStateChange",{index:o,length:n.length})},e.dispatchAppEvent("pageStateChange",{index:s.viewer.pageIndex,length:n.length}),e.emitter.on("attributesUpdate",o=>{o&&o.pageScrollTop!=null&&s.syncPageScrollTop(o.pageScrollTop)}),e.emitter.on("writableChange",o=>{s.setReadonly(!o),t.disableCameraTransform=!o}),s}function Mx(e,t,i,n){t.disableCameraTransform=!0;const r=new yx({context:e,whiteboardView:t,box:i,pages:n}).mount();return r.viewer.onPageIndexChanged=s=>{e.dispatchAppEvent("pageStateChange",{index:s,length:n.length})},e.dispatchAppEvent("pageStateChange",{index:r.getPageIndex(),length:n.length}),e.mountView(r.$whiteboardView),e.isAddApp&&t.callbacks.once("onSizeUpdated",({width:s,height:o})=>{if(n.length>0&&i.state!=="maximized"){const{width:a,height:l}=n[0],h=l/a*s-o;h!==0&&e.getIsWritable()&&e.emitter.emit("setBoxSize",{width:i.width,height:i.height+h/i.containerRect.height})}}),r}var Ti={exports:{}},J={};/*
19
19
  object-assign
@@ -44,6 +44,6 @@ object-assign
44
44
  in `+(n||"Unknown")+s}t+=i,e=e.return}while(e);return t}function Yt(e){switch(typeof e){case"boolean":case"number":case"object":case"string":case"undefined":return e;default:return""}}function _f(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function qx(e){var t=_f(e)?"checked":"value",i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof i!="undefined"&&typeof i.get=="function"&&typeof i.set=="function"){var r=i.get,s=i.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(o){n=""+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Wr(e){e._valueTracker||(e._valueTracker=qx(e))}function Vf(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),n="";return e&&(n=_f(e)?e.checked?"true":"false":e.value),e=n,e!==i?(t.setValue(e),!0):!1}function Sa(e,t){var i=t.checked;return Ee({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:i!=null?i:e._wrapperState.initialChecked})}function zc(e,t){var i=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;i=Yt(t.value!=null?t.value:i),e._wrapperState={initialChecked:n,initialValue:i,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Of(e,t){t=t.checked,t!=null&&Yl(e,"checked",t,!1)}function Ma(e,t){Of(e,t);var i=Yt(t.value),n=t.type;if(i!=null)n==="number"?(i===0&&e.value===""||e.value!=i)&&(e.value=""+i):e.value!==""+i&&(e.value=""+i);else if(n==="submit"||n==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Ia(e,t.type,i):t.hasOwnProperty("defaultValue")&&Ia(e,t.type,Yt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Dc(e,t,i){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,i||t===e.value||(e.value=t),e.defaultValue=t}i=e.name,i!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,i!==""&&(e.name=i)}function Ia(e,t,i){(t!=="number"||e.ownerDocument.activeElement!==e)&&(i==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+i&&(e.defaultValue=""+i))}function e0(e){var t="";return so.Children.forEach(e,function(i){i!=null&&(t+=i)}),t}function Ca(e,t){return e=Ee({children:void 0},t),(t=e0(t.children))&&(e.children=t),e}function Gi(e,t,i,n){if(e=e.options,t){t={};for(var r=0;r<i.length;r++)t["$"+i[r]]=!0;for(i=0;i<e.length;i++)r=t.hasOwnProperty("$"+e[i].value),e[i].selected!==r&&(e[i].selected=r),r&&n&&(e[i].defaultSelected=!0)}else{for(i=""+Yt(i),t=null,r=0;r<e.length;r++){if(e[r].value===i){e[r].selected=!0,n&&(e[r].defaultSelected=!0);return}t!==null||e[r].disabled||(t=e[r])}t!==null&&(t.selected=!0)}}function ba(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(I(91));return Ee({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Lc(e,t){var i=t.value;if(i==null){if(i=t.children,t=t.defaultValue,i!=null){if(t!=null)throw Error(I(92));if(Array.isArray(i)){if(!(1>=i.length))throw Error(I(93));i=i[0]}t=i}t==null&&(t=""),i=t}e._wrapperState={initialValue:Yt(i)}}function Uf(e,t){var i=Yt(t.value),n=Yt(t.defaultValue);i!=null&&(i=""+i,i!==e.value&&(e.value=i),t.defaultValue==null&&e.defaultValue!==i&&(e.defaultValue=i)),n!=null&&(e.defaultValue=""+n)}function Rc(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}var $f={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};function Wf(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 Aa(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Wf(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Hr,Hf=function(e){return typeof MSApp!="undefined"&&MSApp.execUnsafeLocalFunction?function(t,i,n,r){MSApp.execUnsafeLocalFunction(function(){return e(t,i,n,r)})}:e}(function(e,t){if(e.namespaceURI!==$f.svg||"innerHTML"in e)e.innerHTML=t;else{for(Hr=Hr||document.createElement("div"),Hr.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Hr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function er(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=t;return}}e.textContent=t}function Fr(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var Vi={animationend:Fr("Animation","AnimationEnd"),animationiteration:Fr("Animation","AnimationIteration"),animationstart:Fr("Animation","AnimationStart"),transitionend:Fr("Transition","TransitionEnd")},Lo={},Ff={};qt&&(Ff=document.createElement("div").style,"AnimationEvent"in window||(delete Vi.animationend.animation,delete Vi.animationiteration.animation,delete Vi.animationstart.animation),"TransitionEvent"in window||delete Vi.transitionend.transition);function oo(e){if(Lo[e])return Lo[e];if(!Vi[e])return e;var t=Vi[e],i;for(i in t)if(t.hasOwnProperty(i)&&i in Ff)return Lo[e]=t[i];return e}var Qf=oo("animationend"),Zf=oo("animationiteration"),Yf=oo("animationstart"),Gf=oo("transitionend"),Pn="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),jc=new(typeof WeakMap=="function"?WeakMap:Map);function Kl(e){var t=jc.get(e);return t===void 0&&(t=new Map,jc.set(e,t)),t}function Ei(e){var t=e,i=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.effectTag&1026)!==0&&(i=t.return),e=t.return;while(e)}return t.tag===3?i:null}function Xf(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function _c(e){if(Ei(e)!==e)throw Error(I(188))}function t0(e){var t=e.alternate;if(!t){if(t=Ei(e),t===null)throw Error(I(188));return t!==e?null:e}for(var i=e,n=t;;){var r=i.return;if(r===null)break;var s=r.alternate;if(s===null){if(n=r.return,n!==null){i=n;continue}break}if(r.child===s.child){for(s=r.child;s;){if(s===i)return _c(r),e;if(s===n)return _c(r),t;s=s.sibling}throw Error(I(188))}if(i.return!==n.return)i=r,n=s;else{for(var o=!1,a=r.child;a;){if(a===i){o=!0,i=r,n=s;break}if(a===n){o=!0,n=r,i=s;break}a=a.sibling}if(!o){for(a=s.child;a;){if(a===i){o=!0,i=s,n=r;break}if(a===n){o=!0,n=s,i=r;break}a=a.sibling}if(!o)throw Error(I(189))}}if(i.alternate!==n)throw Error(I(190))}if(i.tag!==3)throw Error(I(188));return i.stateNode.current===i?e:t}function Jf(e){if(e=t0(e),!e)return null;for(var t=e;;){if(t.tag===5||t.tag===6)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 rn(e,t){if(t==null)throw Error(I(30));return e==null?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 ql(e,t,i){Array.isArray(e)?e.forEach(t,i):e&&t.call(i,e)}var Sn=null;function i0(e){if(e){var t=e._dispatchListeners,i=e._dispatchInstances;if(Array.isArray(t))for(var n=0;n<t.length&&!e.isPropagationStopped();n++)Ac(e,t[n],i[n]);else t&&Ac(e,t,i);e._dispatchListeners=null,e._dispatchInstances=null,e.isPersistent()||e.constructor.release(e)}}function ao(e){if(e!==null&&(Sn=rn(Sn,e)),e=Sn,Sn=null,e){if(ql(e,i0),Sn)throw Error(I(95));if(Cs)throw e=va,Cs=!1,va=null,e}}function eu(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}function Kf(e){if(!qt)return!1;e="on"+e;var t=e in document;return t||(t=document.createElement("div"),t.setAttribute(e,"return;"),t=typeof t[e]=="function"),t}var Ts=[];function qf(e){e.topLevelType=null,e.nativeEvent=null,e.targetInst=null,e.ancestors.length=0,10>Ts.length&&Ts.push(e)}function ep(e,t,i,n){if(Ts.length){var r=Ts.pop();return r.topLevelType=e,r.eventSystemFlags=n,r.nativeEvent=t,r.targetInst=i,r}return{topLevelType:e,eventSystemFlags:n,nativeEvent:t,targetInst:i,ancestors:[]}}function tp(e){var t=e.targetInst,i=t;do{if(!i){e.ancestors.push(i);break}var n=i;if(n.tag===3)n=n.stateNode.containerInfo;else{for(;n.return;)n=n.return;n=n.tag!==3?null:n.stateNode.containerInfo}if(!n)break;t=i.tag,t!==5&&t!==6||e.ancestors.push(i),i=Ar(n)}while(i);for(i=0;i<e.ancestors.length;i++){t=e.ancestors[i];var r=eu(e.nativeEvent);n=e.topLevelType;var s=e.nativeEvent,o=e.eventSystemFlags;i===0&&(o|=64);for(var a=null,l=0;l<As.length;l++){var u=As[l];u&&(u=u.extractEvents(n,t,s,r,o))&&(a=rn(a,u))}ao(a)}}function Ta(e,t,i){if(!i.has(e)){switch(e){case"scroll":Bn(t,"scroll",!0);break;case"focus":case"blur":Bn(t,"focus",!0),Bn(t,"blur",!0),i.set("blur",null),i.set("focus",null);break;case"cancel":case"close":Kf(e)&&Bn(t,e,!0);break;case"invalid":case"submit":case"reset":break;default:Pn.indexOf(e)===-1&&re(e,t)}i.set(e,null)}}var ip,tu,np,Ea=!1,ct=[],Ut=null,$t=null,Wt=null,tr=new Map,ir=new Map,Mn=[],Na="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput close cancel copy cut paste click change contextmenu reset submit".split(" "),n0="focus blur dragenter dragleave mouseover mouseout pointerover pointerout gotpointercapture lostpointercapture".split(" ");function r0(e,t){var i=Kl(t);Na.forEach(function(n){Ta(n,t,i)}),n0.forEach(function(n){Ta(n,t,i)})}function ka(e,t,i,n,r){return{blockedOn:e,topLevelType:t,eventSystemFlags:i|32,nativeEvent:r,container:n}}function Vc(e,t){switch(e){case"focus":case"blur":Ut=null;break;case"dragenter":case"dragleave":$t=null;break;case"mouseover":case"mouseout":Wt=null;break;case"pointerover":case"pointerout":tr.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ir.delete(t.pointerId)}}function In(e,t,i,n,r,s){return e===null||e.nativeEvent!==s?(e=ka(t,i,n,r,s),t!==null&&(t=Tr(t),t!==null&&tu(t)),e):(e.eventSystemFlags|=n,e)}function s0(e,t,i,n,r){switch(t){case"focus":return Ut=In(Ut,e,t,i,n,r),!0;case"dragenter":return $t=In($t,e,t,i,n,r),!0;case"mouseover":return Wt=In(Wt,e,t,i,n,r),!0;case"pointerover":var s=r.pointerId;return tr.set(s,In(tr.get(s)||null,e,t,i,n,r)),!0;case"gotpointercapture":return s=r.pointerId,ir.set(s,In(ir.get(s)||null,e,t,i,n,r)),!0}return!1}function o0(e){var t=Ar(e.target);if(t!==null){var i=Ei(t);if(i!==null){if(t=i.tag,t===13){if(t=Xf(i),t!==null){e.blockedOn=t,ve.unstable_runWithPriority(e.priority,function(){np(i)});return}}else if(t===3&&i.stateNode.hydrate){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function as(e){if(e.blockedOn!==null)return!1;var t=ru(e.topLevelType,e.eventSystemFlags,e.container,e.nativeEvent);if(t!==null){var i=Tr(t);return i!==null&&tu(i),e.blockedOn=t,!1}return!0}function Oc(e,t,i){as(e)&&i.delete(t)}function a0(){for(Ea=!1;0<ct.length;){var e=ct[0];if(e.blockedOn!==null){e=Tr(e.blockedOn),e!==null&&ip(e);break}var t=ru(e.topLevelType,e.eventSystemFlags,e.container,e.nativeEvent);t!==null?e.blockedOn=t:ct.shift()}Ut!==null&&as(Ut)&&(Ut=null),$t!==null&&as($t)&&($t=null),Wt!==null&&as(Wt)&&(Wt=null),tr.forEach(Oc),ir.forEach(Oc)}function Cn(e,t){e.blockedOn===t&&(e.blockedOn=null,Ea||(Ea=!0,ve.unstable_scheduleCallback(ve.unstable_NormalPriority,a0)))}function rp(e){function t(r){return Cn(r,e)}if(0<ct.length){Cn(ct[0],e);for(var i=1;i<ct.length;i++){var n=ct[i];n.blockedOn===e&&(n.blockedOn=null)}}for(Ut!==null&&Cn(Ut,e),$t!==null&&Cn($t,e),Wt!==null&&Cn(Wt,e),tr.forEach(t),ir.forEach(t),i=0;i<Mn.length;i++)n=Mn[i],n.blockedOn===e&&(n.blockedOn=null);for(;0<Mn.length&&(i=Mn[0],i.blockedOn===null);)o0(i),i.blockedOn===null&&Mn.shift()}var sp={},op=new Map,iu=new Map,l0=["abort","abort",Qf,"animationEnd",Zf,"animationIteration",Yf,"animationStart","canplay","canPlay","canplaythrough","canPlayThrough","durationchange","durationChange","emptied","emptied","encrypted","encrypted","ended","ended","error","error","gotpointercapture","gotPointerCapture","load","load","loadeddata","loadedData","loadedmetadata","loadedMetadata","loadstart","loadStart","lostpointercapture","lostPointerCapture","playing","playing","progress","progress","seeking","seeking","stalled","stalled","suspend","suspend","timeupdate","timeUpdate",Gf,"transitionEnd","waiting","waiting"];function nu(e,t){for(var i=0;i<e.length;i+=2){var n=e[i],r=e[i+1],s="on"+(r[0].toUpperCase()+r.slice(1));s={phasedRegistrationNames:{bubbled:s,captured:s+"Capture"},dependencies:[n],eventPriority:t},iu.set(n,t),op.set(n,s),sp[r]=s}}nu("blur blur cancel cancel click click close close contextmenu contextMenu copy copy cut cut auxclick auxClick dblclick doubleClick dragend dragEnd dragstart dragStart drop drop focus focus input input invalid invalid keydown keyDown keypress keyPress keyup keyUp mousedown mouseDown mouseup mouseUp paste paste pause pause play play pointercancel pointerCancel pointerdown pointerDown pointerup pointerUp ratechange rateChange reset reset seeked seeked submit submit touchcancel touchCancel touchend touchEnd touchstart touchStart volumechange volumeChange".split(" "),0);nu("drag drag dragenter dragEnter dragexit dragExit dragleave dragLeave dragover dragOver mousemove mouseMove mouseout mouseOut mouseover mouseOver pointermove pointerMove pointerout pointerOut pointerover pointerOver scroll scroll toggle toggle touchmove touchMove wheel wheel".split(" "),1);nu(l0,2);for(var Uc="change selectionchange textInput compositionstart compositionend compositionupdate".split(" "),Ro=0;Ro<Uc.length;Ro++)iu.set(Uc[Ro],0);var u0=ve.unstable_UserBlockingPriority,c0=ve.unstable_runWithPriority,ls=!0;function re(e,t){Bn(t,e,!1)}function Bn(e,t,i){var n=iu.get(t);switch(n===void 0?2:n){case 0:n=h0.bind(null,t,1,e);break;case 1:n=d0.bind(null,t,1,e);break;default:n=lo.bind(null,t,1,e)}i?e.addEventListener(t,n,!0):e.addEventListener(t,n,!1)}function h0(e,t,i,n){ai||Hl();var r=lo,s=ai;ai=!0;try{kf(r,e,t,i,n)}finally{(ai=s)||Fl()}}function d0(e,t,i,n){c0(u0,lo.bind(null,e,t,i,n))}function lo(e,t,i,n){if(ls)if(0<ct.length&&-1<Na.indexOf(e))e=ka(null,e,t,i,n),ct.push(e);else{var r=ru(e,t,i,n);if(r===null)Vc(e,n);else if(-1<Na.indexOf(e))e=ka(r,e,t,i,n),ct.push(e);else if(!s0(r,e,t,i,n)){Vc(e,n),e=ep(e,n,null,t);try{Bf(tp,e)}finally{qf(e)}}}}function ru(e,t,i,n){if(i=eu(n),i=Ar(i),i!==null){var r=Ei(i);if(r===null)i=null;else{var s=r.tag;if(s===13){if(i=Xf(r),i!==null)return i;i=null}else if(s===3){if(r.stateNode.hydrate)return r.tag===3?r.stateNode.containerInfo:null;i=null}else r!==i&&(i=null)}}e=ep(e,n,i,t);try{Bf(tp,e)}finally{qf(e)}return null}var $n={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},f0=["Webkit","ms","Moz","O"];Object.keys($n).forEach(function(e){f0.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),$n[t]=$n[e]})});function ap(e,t,i){return t==null||typeof t=="boolean"||t===""?"":i||typeof t!="number"||t===0||$n.hasOwnProperty(e)&&$n[e]?(""+t).trim():t+"px"}function lp(e,t){e=e.style;for(var i in t)if(t.hasOwnProperty(i)){var n=i.indexOf("--")===0,r=ap(i,t[i],n);i==="float"&&(i="cssFloat"),n?e.setProperty(i,r):e[i]=r}}var p0=Ee({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Pa(e,t){if(t){if(p0[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(I(137,e,""));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(I(60));if(!(typeof t.dangerouslySetInnerHTML=="object"&&"__html"in t.dangerouslySetInnerHTML))throw Error(I(61))}if(t.style!=null&&typeof t.style!="object")throw Error(I(62,""))}}function Ba(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var $c=$f.html;function wt(e,t){e=e.nodeType===9||e.nodeType===11?e:e.ownerDocument;var i=Kl(e);t=$l[t];for(var n=0;n<t.length;n++)Ta(t[n],e,i)}function Es(){}function za(e){if(e=e||(typeof document!="undefined"?document:void 0),typeof e=="undefined")return null;try{return e.activeElement||e.body}catch{return e.body}}function Wc(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Hc(e,t){var i=Wc(e);e=0;for(var n;i;){if(i.nodeType===3){if(n=e+i.textContent.length,e<=t&&n>=t)return{node:i,offset:t-e};e=n}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=Wc(i)}}function up(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?up(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Fc(){for(var e=window,t=za();t instanceof e.HTMLIFrameElement;){try{var i=typeof t.contentWindow.location.href=="string"}catch{i=!1}if(i)e=t.contentWindow;else break;t=za(e.document)}return t}function Da(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var cp="$",hp="/$",su="$?",ou="$!",jo=null,_o=null;function dp(e,t){switch(e){case"button":case"input":case"select":case"textarea":return!!t.autoFocus}return!1}function La(e,t){return e==="textarea"||e==="option"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Vo=typeof setTimeout=="function"?setTimeout:void 0,g0=typeof clearTimeout=="function"?clearTimeout:void 0;function Xi(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break}return e}function Qc(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i===cp||i===ou||i===su){if(t===0)return e;t--}else i===hp&&t++}e=e.previousSibling}return null}var au=Math.random().toString(36).slice(2),Dt="__reactInternalInstance$"+au,Ns="__reactEventHandlers$"+au,br="__reactContainere$"+au;function Ar(e){var t=e[Dt];if(t)return t;for(var i=e.parentNode;i;){if(t=i[br]||i[Dt]){if(i=t.alternate,t.child!==null||i!==null&&i.child!==null)for(e=Qc(e);e!==null;){if(i=e[Dt])return i;e=Qc(e)}return t}e=i,i=e.parentNode}return null}function Tr(e){return e=e[Dt]||e[br],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Si(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(I(33))}function lu(e){return e[Ns]||null}function yt(e){do e=e.return;while(e&&e.tag!==5);return e||null}function fp(e,t){var i=e.stateNode;if(!i)return null;var n=Ul(i);if(!n)return null;i=n[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":(n=!n.disabled)||(e=e.type,n=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!n;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(I(231,t,typeof i));return i}function Zc(e,t,i){(t=fp(e,i.dispatchConfig.phasedRegistrationNames[t]))&&(i._dispatchListeners=rn(i._dispatchListeners,t),i._dispatchInstances=rn(i._dispatchInstances,e))}function m0(e){if(e&&e.dispatchConfig.phasedRegistrationNames){for(var t=e._targetInst,i=[];t;)i.push(t),t=yt(t);for(t=i.length;0<t--;)Zc(i[t],"captured",e);for(t=0;t<i.length;t++)Zc(i[t],"bubbled",e)}}function Ra(e,t,i){e&&i&&i.dispatchConfig.registrationName&&(t=fp(e,i.dispatchConfig.registrationName))&&(i._dispatchListeners=rn(i._dispatchListeners,t),i._dispatchInstances=rn(i._dispatchInstances,e))}function v0(e){e&&e.dispatchConfig.registrationName&&Ra(e._targetInst,null,e)}function sn(e){ql(e,m0)}var Lt=null,uu=null,us=null;function pp(){if(us)return us;var e,t=uu,i=t.length,n,r="value"in Lt?Lt.value:Lt.textContent,s=r.length;for(e=0;e<i&&t[e]===r[e];e++);var o=i-e;for(n=1;n<=o&&t[i-n]===r[s-n];n++);return us=r.slice(e,1<n?1-n:void 0)}function cs(){return!0}function ks(){return!1}function Fe(e,t,i,n){this.dispatchConfig=e,this._targetInst=t,this.nativeEvent=i,e=this.constructor.Interface;for(var r in e)e.hasOwnProperty(r)&&((t=e[r])?this[r]=t(i):r==="target"?this.target=n:this[r]=i[r]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?cs:ks,this.isPropagationStopped=ks,this}Ee(Fe.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!="unknown"&&(e.returnValue=!1),this.isDefaultPrevented=cs)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!="unknown"&&(e.cancelBubble=!0),this.isPropagationStopped=cs)},persist:function(){this.isPersistent=cs},isPersistent:ks,destructor:function(){var e=this.constructor.Interface,t;for(t in e)this[t]=null;this.nativeEvent=this._targetInst=this.dispatchConfig=null,this.isPropagationStopped=this.isDefaultPrevented=ks,this._dispatchInstances=this._dispatchListeners=null}});Fe.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};Fe.extend=function(e){function t(){}function i(){return n.apply(this,arguments)}var n=this;t.prototype=n.prototype;var r=new t;return Ee(r,i.prototype),i.prototype=r,i.prototype.constructor=i,i.Interface=Ee({},n.Interface,e),i.extend=n.extend,gp(i),i};gp(Fe);function w0(e,t,i,n){if(this.eventPool.length){var r=this.eventPool.pop();return this.call(r,e,t,i,n),r}return new this(e,t,i,n)}function y0(e){if(!(e instanceof this))throw Error(I(279));e.destructor(),10>this.eventPool.length&&this.eventPool.push(e)}function gp(e){e.eventPool=[],e.getPooled=w0,e.release=y0}var x0=Fe.extend({data:null}),S0=Fe.extend({data:null}),M0=[9,13,27,32],cu=qt&&"CompositionEvent"in window,Wn=null;qt&&"documentMode"in document&&(Wn=document.documentMode);var I0=qt&&"TextEvent"in window&&!Wn,mp=qt&&(!cu||Wn&&8<Wn&&11>=Wn),Yc=String.fromCharCode(32),vt={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(" ")}},Gc=!1;function vp(e,t){switch(e){case"keyup":return M0.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"blur":return!0;default:return!1}}function wp(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Oi=!1;function C0(e,t){switch(e){case"compositionend":return wp(t);case"keypress":return t.which!==32?null:(Gc=!0,Yc);case"textInput":return e=t.data,e===Yc&&Gc?null:e;default:return null}}function b0(e,t){if(Oi)return e==="compositionend"||!cu&&vp(e,t)?(e=pp(),us=uu=Lt=null,Oi=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return mp&&t.locale!=="ko"?null:t.data;default:return null}}var A0={eventTypes:vt,extractEvents:function(e,t,i,n){var r;if(cu)e:{switch(e){case"compositionstart":var s=vt.compositionStart;break e;case"compositionend":s=vt.compositionEnd;break e;case"compositionupdate":s=vt.compositionUpdate;break e}s=void 0}else Oi?vp(e,i)&&(s=vt.compositionEnd):e==="keydown"&&i.keyCode===229&&(s=vt.compositionStart);return s?(mp&&i.locale!=="ko"&&(Oi||s!==vt.compositionStart?s===vt.compositionEnd&&Oi&&(r=pp()):(Lt=n,uu="value"in Lt?Lt.value:Lt.textContent,Oi=!0)),s=x0.getPooled(s,t,i,n),r?s.data=r:(r=wp(i),r!==null&&(s.data=r)),sn(s),r=s):r=null,(e=I0?C0(e,i):b0(e,i))?(t=S0.getPooled(vt.beforeInput,t,i,n),t.data=e,sn(t)):t=null,r===null?t:t===null?r:[r,t]}},T0={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function yp(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!T0[e.type]:t==="textarea"}var xp={change:{phasedRegistrationNames:{bubbled:"onChange",captured:"onChangeCapture"},dependencies:"blur change click focus input keydown keyup selectionchange".split(" ")}};function Sp(e,t,i){return e=Fe.getPooled(xp.change,e,t,i),e.type="change",Ef(i),sn(e),e}var Hn=null,nr=null;function E0(e){ao(e)}function uo(e){var t=Si(e);if(Vf(t))return e}function N0(e,t){if(e==="change")return t}var ja=!1;qt&&(ja=Kf("input")&&(!document.documentMode||9<document.documentMode));function Xc(){Hn&&(Hn.detachEvent("onpropertychange",Mp),nr=Hn=null)}function Mp(e){if(e.propertyName==="value"&&uo(nr))if(e=Sp(nr,e,eu(e)),ai)ao(e);else{ai=!0;try{Wl(E0,e)}finally{ai=!1,Fl()}}}function k0(e,t,i){e==="focus"?(Xc(),Hn=t,nr=i,Hn.attachEvent("onpropertychange",Mp)):e==="blur"&&Xc()}function P0(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return uo(nr)}function B0(e,t){if(e==="click")return uo(t)}function z0(e,t){if(e==="input"||e==="change")return uo(t)}var D0={eventTypes:xp,_isInputEventSupported:ja,extractEvents:function(e,t,i,n){var r=t?Si(t):window,s=r.nodeName&&r.nodeName.toLowerCase();if(s==="select"||s==="input"&&r.type==="file")var o=N0;else if(yp(r))if(ja)o=z0;else{o=P0;var a=k0}else(s=r.nodeName)&&s.toLowerCase()==="input"&&(r.type==="checkbox"||r.type==="radio")&&(o=B0);if(o&&(o=o(e,t)))return Sp(o,i,n);a&&a(e,r,t),e==="blur"&&(e=r._wrapperState)&&e.controlled&&r.type==="number"&&Ia(r,"number",r.value)}},Er=Fe.extend({view:null,detail:null}),L0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function R0(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=L0[e])?!!t[e]:!1}function hu(){return R0}var Jc=0,Kc=0,qc=!1,eh=!1,Nr=Er.extend({screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:hu,button:null,buttons:null,relatedTarget:function(e){return e.relatedTarget||(e.fromElement===e.srcElement?e.toElement:e.fromElement)},movementX:function(e){if("movementX"in e)return e.movementX;var t=Jc;return Jc=e.screenX,qc?e.type==="mousemove"?e.screenX-t:0:(qc=!0,0)},movementY:function(e){if("movementY"in e)return e.movementY;var t=Kc;return Kc=e.screenY,eh?e.type==="mousemove"?e.screenY-t:0:(eh=!0,0)}}),Ip=Nr.extend({pointerId:null,width:null,height:null,pressure:null,tangentialPressure:null,tiltX:null,tiltY:null,twist:null,pointerType:null,isPrimary:null}),bn={mouseEnter:{registrationName:"onMouseEnter",dependencies:["mouseout","mouseover"]},mouseLeave:{registrationName:"onMouseLeave",dependencies:["mouseout","mouseover"]},pointerEnter:{registrationName:"onPointerEnter",dependencies:["pointerout","pointerover"]},pointerLeave:{registrationName:"onPointerLeave",dependencies:["pointerout","pointerover"]}},j0={eventTypes:bn,extractEvents:function(e,t,i,n,r){var s=e==="mouseover"||e==="pointerover",o=e==="mouseout"||e==="pointerout";if(s&&(r&32)===0&&(i.relatedTarget||i.fromElement)||!o&&!s)return null;if(s=n.window===n?n:(s=n.ownerDocument)?s.defaultView||s.parentWindow:window,o){if(o=t,t=(t=i.relatedTarget||i.toElement)?Ar(t):null,t!==null){var a=Ei(t);(t!==a||t.tag!==5&&t.tag!==6)&&(t=null)}}else o=null;if(o===t)return null;if(e==="mouseout"||e==="mouseover")var l=Nr,u=bn.mouseLeave,h=bn.mouseEnter,c="mouse";else(e==="pointerout"||e==="pointerover")&&(l=Ip,u=bn.pointerLeave,h=bn.pointerEnter,c="pointer");if(e=o==null?s:Si(o),s=t==null?s:Si(t),u=l.getPooled(u,o,i,n),u.type=c+"leave",u.target=e,u.relatedTarget=s,i=l.getPooled(h,t,i,n),i.type=c+"enter",i.target=s,i.relatedTarget=e,n=o,c=t,n&&c)e:{for(l=n,h=c,o=0,e=l;e;e=yt(e))o++;for(e=0,t=h;t;t=yt(t))e++;for(;0<o-e;)l=yt(l),o--;for(;0<e-o;)h=yt(h),e--;for(;o--;){if(l===h||l===h.alternate)break e;l=yt(l),h=yt(h)}l=null}else l=null;for(h=l,l=[];n&&n!==h&&(o=n.alternate,!(o!==null&&o===h));)l.push(n),n=yt(n);for(n=[];c&&c!==h&&(o=c.alternate,!(o!==null&&o===h));)n.push(c),c=yt(c);for(c=0;c<l.length;c++)Ra(l[c],"bubbled",u);for(c=n.length;0<c--;)Ra(n[c],"captured",i);return(r&64)===0?[u]:[u,i]}};function _0(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Mi=typeof Object.is=="function"?Object.is:_0,V0=Object.prototype.hasOwnProperty;function rr(e,t){if(Mi(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var i=Object.keys(e),n=Object.keys(t);if(i.length!==n.length)return!1;for(n=0;n<i.length;n++)if(!V0.call(t,i[n])||!Mi(e[i[n]],t[i[n]]))return!1;return!0}var O0=qt&&"documentMode"in document&&11>=document.documentMode,Cp={select:{phasedRegistrationNames:{bubbled:"onSelect",captured:"onSelectCapture"},dependencies:"blur contextmenu dragend focus keydown keyup mousedown mouseup selectionchange".split(" ")}},Ui=null,_a=null,Fn=null,Va=!1;function th(e,t){var i=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;return Va||Ui==null||Ui!==za(i)?null:(i=Ui,"selectionStart"in i&&Da(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),Fn&&rr(Fn,i)?null:(Fn=i,e=Fe.getPooled(Cp.select,_a,e,t),e.type="select",e.target=Ui,sn(e),e))}var U0={eventTypes:Cp,extractEvents:function(e,t,i,n,r,s){if(r=s||(n.window===n?n.document:n.nodeType===9?n:n.ownerDocument),!(s=!r)){e:{r=Kl(r),s=$l.onSelect;for(var o=0;o<s.length;o++)if(!r.has(s[o])){r=!1;break e}r=!0}s=!r}if(s)return null;switch(r=t?Si(t):window,e){case"focus":(yp(r)||r.contentEditable==="true")&&(Ui=r,_a=t,Fn=null);break;case"blur":Fn=_a=Ui=null;break;case"mousedown":Va=!0;break;case"contextmenu":case"mouseup":case"dragend":return Va=!1,th(i,n);case"selectionchange":if(O0)break;case"keydown":case"keyup":return th(i,n)}return null}},$0=Fe.extend({animationName:null,elapsedTime:null,pseudoElement:null}),W0=Fe.extend({clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),H0=Er.extend({relatedTarget:null});function hs(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}var F0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Q0={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Z0=Er.extend({key:function(e){if(e.key){var t=F0[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=hs(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Q0[e.keyCode]||"Unidentified":""},location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:hu,charCode:function(e){return e.type==="keypress"?hs(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?hs(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Y0=Nr.extend({dataTransfer:null}),G0=Er.extend({touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:hu}),X0=Fe.extend({propertyName:null,elapsedTime:null,pseudoElement:null}),J0=Nr.extend({deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:null,deltaMode:null}),K0={eventTypes:sp,extractEvents:function(e,t,i,n){var r=op.get(e);if(!r)return null;switch(e){case"keypress":if(hs(i)===0)return null;case"keydown":case"keyup":e=Z0;break;case"blur":case"focus":e=H0;break;case"click":if(i.button===2)return null;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":e=Nr;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":e=Y0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":e=G0;break;case Qf:case Zf:case Yf:e=$0;break;case Gf:e=X0;break;case"scroll":e=Er;break;case"wheel":e=J0;break;case"copy":case"cut":case"paste":e=W0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":e=Ip;break;default:e=Fe}return t=e.getPooled(r,t,i,n),sn(t),t}};if(bs)throw Error(I(101));bs=Array.prototype.slice.call("ResponderEventPlugin SimpleEventPlugin EnterLeaveEventPlugin ChangeEventPlugin SelectEventPlugin BeforeInputEventPlugin".split(" "));Af();var q0=Tr;Ul=lu;Cf=q0;bf=Si;Tf({SimpleEventPlugin:K0,EnterLeaveEventPlugin:j0,ChangeEventPlugin:D0,SelectEventPlugin:U0,BeforeInputEventPlugin:A0});var Oa=[],$i=-1;function q(e){0>$i||(e.current=Oa[$i],Oa[$i]=null,$i--)}function ue(e,t){$i++,Oa[$i]=e.current,e.current=t}var Gt={},Ie={current:Gt},De={current:!1},Ii=Gt;function on(e,t){var i=e.type.contextTypes;if(!i)return Gt;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var r={},s;for(s in i)r[s]=t[s];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=r),r}function Le(e){return e=e.childContextTypes,e!=null}function Ps(){q(De),q(Ie)}function ih(e,t,i){if(Ie.current!==Gt)throw Error(I(168));ue(Ie,t),ue(De,i)}function bp(e,t,i){var n=e.stateNode;if(e=t.childContextTypes,typeof n.getChildContext!="function")return i;n=n.getChildContext();for(var r in n)if(!(r in e))throw Error(I(108,At(t)||"Unknown",r));return Ee({},i,{},n)}function ds(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Gt,Ii=Ie.current,ue(Ie,e),ue(De,De.current),!0}function nh(e,t,i){var n=e.stateNode;if(!n)throw Error(I(169));i?(e=bp(e,t,Ii),n.__reactInternalMemoizedMergedChildContext=e,q(De),q(Ie),ue(Ie,e)):q(De),ue(De,i)}var eS=ve.unstable_runWithPriority,du=ve.unstable_scheduleCallback,Ap=ve.unstable_cancelCallback,rh=ve.unstable_requestPaint,Ua=ve.unstable_now,tS=ve.unstable_getCurrentPriorityLevel,co=ve.unstable_ImmediatePriority,Tp=ve.unstable_UserBlockingPriority,Ep=ve.unstable_NormalPriority,Np=ve.unstable_LowPriority,kp=ve.unstable_IdlePriority,Pp={},iS=ve.unstable_shouldYield,nS=rh!==void 0?rh:function(){},St=null,fs=null,Oo=!1,sh=Ua(),Ze=1e4>sh?Ua:function(){return Ua()-sh};function ho(){switch(tS()){case co:return 99;case Tp:return 98;case Ep:return 97;case Np:return 96;case kp:return 95;default:throw Error(I(332))}}function Bp(e){switch(e){case 99:return co;case 98:return Tp;case 97:return Ep;case 96:return Np;case 95:return kp;default:throw Error(I(332))}}function Xt(e,t){return e=Bp(e),eS(e,t)}function zp(e,t,i){return e=Bp(e),du(e,t,i)}function oh(e){return St===null?(St=[e],fs=du(co,Dp)):St.push(e),Pp}function mt(){if(fs!==null){var e=fs;fs=null,Ap(e)}Dp()}function Dp(){if(!Oo&&St!==null){Oo=!0;var e=0;try{var t=St;Xt(99,function(){for(;e<t.length;e++){var i=t[e];do i=i(!0);while(i!==null)}}),St=null}catch(i){throw St!==null&&(St=St.slice(e+1)),du(co,mt),i}finally{Oo=!1}}}function ps(e,t,i){return i/=10,1073741821-(((1073741821-e+t/10)/i|0)+1)*i}function qe(e,t){if(e&&e.defaultProps){t=Ee({},t),e=e.defaultProps;for(var i in e)t[i]===void 0&&(t[i]=e[i])}return t}var Bs={current:null},zs=null,Wi=null,Ds=null;function fu(){Ds=Wi=zs=null}function pu(e){var t=Bs.current;q(Bs),e.type._context._currentValue=t}function Lp(e,t){for(;e!==null;){var i=e.alternate;if(e.childExpirationTime<t)e.childExpirationTime=t,i!==null&&i.childExpirationTime<t&&(i.childExpirationTime=t);else if(i!==null&&i.childExpirationTime<t)i.childExpirationTime=t;else break;e=e.return}}function Ji(e,t){zs=e,Ds=Wi=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.expirationTime>=t&&(ht=!0),e.firstContext=null)}function Ge(e,t){if(Ds!==e&&t!==!1&&t!==0)if((typeof t!="number"||t===1073741823)&&(Ds=e,t=1073741823),t={context:e,observedBits:t,next:null},Wi===null){if(zs===null)throw Error(I(308));Wi=t,zs.dependencies={expirationTime:0,firstContext:t,responders:null}}else Wi=Wi.next=t;return e._currentValue}var zt=!1;function gu(e){e.updateQueue={baseState:e.memoizedState,baseQueue:null,shared:{pending:null},effects:null}}function mu(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,baseQueue:e.baseQueue,shared:e.shared,effects:e.effects})}function Ht(e,t){return e={expirationTime:e,suspenseConfig:t,tag:0,payload:null,callback:null,next:null},e.next=e}function Ft(e,t){if(e=e.updateQueue,e!==null){e=e.shared;var i=e.pending;i===null?t.next=t:(t.next=i.next,i.next=t),e.pending=t}}function ah(e,t){var i=e.alternate;i!==null&&mu(i,e),e=e.updateQueue,i=e.baseQueue,i===null?(e.baseQueue=t.next=t,t.next=t):(t.next=i.next,i.next=t)}function sr(e,t,i,n){var r=e.updateQueue;zt=!1;var s=r.baseQueue,o=r.shared.pending;if(o!==null){if(s!==null){var a=s.next;s.next=o.next,o.next=a}s=o,r.shared.pending=null,a=e.alternate,a!==null&&(a=a.updateQueue,a!==null&&(a.baseQueue=o))}if(s!==null){a=s.next;var l=r.baseState,u=0,h=null,c=null,m=null;if(a!==null){var v=a;do{if(o=v.expirationTime,o<n){var w={expirationTime:v.expirationTime,suspenseConfig:v.suspenseConfig,tag:v.tag,payload:v.payload,callback:v.callback,next:null};m===null?(c=m=w,h=l):m=m.next=w,o>u&&(u=o)}else{m!==null&&(m=m.next={expirationTime:1073741823,suspenseConfig:v.suspenseConfig,tag:v.tag,payload:v.payload,callback:v.callback,next:null}),hg(o,v.suspenseConfig);e:{var x=e,d=v;switch(o=t,w=i,d.tag){case 1:if(x=d.payload,typeof x=="function"){l=x.call(w,l,o);break e}l=x;break e;case 3:x.effectTag=x.effectTag&-4097|64;case 0:if(x=d.payload,o=typeof x=="function"?x.call(w,l,o):x,o==null)break e;l=Ee({},l,o);break e;case 2:zt=!0}}v.callback!==null&&(e.effectTag|=32,o=r.effects,o===null?r.effects=[v]:o.push(v))}if(v=v.next,v===null||v===a){if(o=r.shared.pending,o===null)break;v=s.next=o.next,o.next=a,r.baseQueue=s=o,r.shared.pending=null}}while(1)}m===null?h=l:m.next=c,r.baseState=h,r.baseQueue=m,vo(u),e.expirationTime=u,e.memoizedState=l}}function lh(e,t,i){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var n=e[t],r=n.callback;if(r!==null){if(n.callback=null,n=r,r=i,typeof n!="function")throw Error(I(191,n));n.call(r)}}}var Qn=tt.ReactCurrentBatchConfig,Rp=new so.Component().refs;function Ls(e,t,i,n){t=e.memoizedState,i=i(n,t),i=i==null?t:Ee({},t,i),e.memoizedState=i,e.expirationTime===0&&(e.updateQueue.baseState=i)}var fo={isMounted:function(e){return(e=e._reactInternalFiber)?Ei(e)===e:!1},enqueueSetState:function(e,t,i){e=e._reactInternalFiber;var n=pt(),r=Qn.suspense;n=vi(n,e,r),r=Ht(n,r),r.payload=t,i!=null&&(r.callback=i),Ft(e,r),Zt(e,n)},enqueueReplaceState:function(e,t,i){e=e._reactInternalFiber;var n=pt(),r=Qn.suspense;n=vi(n,e,r),r=Ht(n,r),r.tag=1,r.payload=t,i!=null&&(r.callback=i),Ft(e,r),Zt(e,n)},enqueueForceUpdate:function(e,t){e=e._reactInternalFiber;var i=pt(),n=Qn.suspense;i=vi(i,e,n),n=Ht(i,n),n.tag=2,t!=null&&(n.callback=t),Ft(e,n),Zt(e,i)}};function uh(e,t,i,n,r,s,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(n,s,o):t.prototype&&t.prototype.isPureReactComponent?!rr(i,n)||!rr(r,s):!0}function jp(e,t,i){var n=!1,r=Gt,s=t.contextType;return typeof s=="object"&&s!==null?s=Ge(s):(r=Le(t)?Ii:Ie.current,n=t.contextTypes,s=(n=n!=null)?on(e,r):Gt),t=new t(i,s),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=fo,e.stateNode=t,t._reactInternalFiber=e,n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=r,e.__reactInternalMemoizedMaskedChildContext=s),t}function ch(e,t,i,n){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(i,n),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(i,n),t.state!==e&&fo.enqueueReplaceState(t,t.state,null)}function $a(e,t,i,n){var r=e.stateNode;r.props=i,r.state=e.memoizedState,r.refs=Rp,gu(e);var s=t.contextType;typeof s=="object"&&s!==null?r.context=Ge(s):(s=Le(t)?Ii:Ie.current,r.context=on(e,s)),sr(e,i,r,n),r.state=e.memoizedState,s=t.getDerivedStateFromProps,typeof s=="function"&&(Ls(e,t,s,i),r.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof r.getSnapshotBeforeUpdate=="function"||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(t=r.state,typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount(),t!==r.state&&fo.enqueueReplaceState(r,r.state,null),sr(e,i,r,n),r.state=e.memoizedState),typeof r.componentDidMount=="function"&&(e.effectTag|=4)}var Qr=Array.isArray;function An(e,t,i){if(e=i.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(i._owner){if(i=i._owner,i){if(i.tag!==1)throw Error(I(309));var n=i.stateNode}if(!n)throw Error(I(147,e));var r=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===r?t.ref:(t=function(s){var o=n.refs;o===Rp&&(o=n.refs={}),s===null?delete o[r]:o[r]=s},t._stringRef=r,t)}if(typeof e!="string")throw Error(I(284));if(!i._owner)throw Error(I(290,e))}return e}function Zr(e,t){if(e.type!=="textarea")throw Error(I(31,Object.prototype.toString.call(t)==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":t,""))}function _p(e){function t(d,f){if(e){var g=d.lastEffect;g!==null?(g.nextEffect=f,d.lastEffect=f):d.firstEffect=d.lastEffect=f,f.nextEffect=null,f.effectTag=8}}function i(d,f){if(!e)return null;for(;f!==null;)t(d,f),f=f.sibling;return null}function n(d,f){for(d=new Map;f!==null;)f.key!==null?d.set(f.key,f):d.set(f.index,f),f=f.sibling;return d}function r(d,f){return d=Ci(d,f),d.index=0,d.sibling=null,d}function s(d,f,g){return d.index=g,e?(g=d.alternate,g!==null?(g=g.index,g<f?(d.effectTag=2,f):g):(d.effectTag=2,f)):f}function o(d){return e&&d.alternate===null&&(d.effectTag=2),d}function a(d,f,g,p){return f===null||f.tag!==6?(f=Qo(g,d.mode,p),f.return=d,f):(f=r(f,g),f.return=d,f)}function l(d,f,g,p){return f!==null&&f.elementType===g.type?(p=r(f,g.props),p.ref=An(d,f,g),p.return=d,p):(p=ws(g.type,g.key,g.props,null,d.mode,p),p.ref=An(d,f,g),p.return=d,p)}function u(d,f,g,p){return f===null||f.tag!==4||f.stateNode.containerInfo!==g.containerInfo||f.stateNode.implementation!==g.implementation?(f=Zo(g,d.mode,p),f.return=d,f):(f=r(f,g.children||[]),f.return=d,f)}function h(d,f,g,p,y){return f===null||f.tag!==7?(f=_t(g,d.mode,p,y),f.return=d,f):(f=r(f,g),f.return=d,f)}function c(d,f,g){if(typeof f=="string"||typeof f=="number")return f=Qo(""+f,d.mode,g),f.return=d,f;if(typeof f=="object"&&f!==null){switch(f.$$typeof){case $r:return g=ws(f.type,f.key,f.props,null,d.mode,g),g.ref=An(d,null,f),g.return=d,g;case _i:return f=Zo(f,d.mode,g),f.return=d,f}if(Qr(f)||xn(f))return f=_t(f,d.mode,g,null),f.return=d,f;Zr(d,f)}return null}function m(d,f,g,p){var y=f!==null?f.key:null;if(typeof g=="string"||typeof g=="number")return y!==null?null:a(d,f,""+g,p);if(typeof g=="object"&&g!==null){switch(g.$$typeof){case $r:return g.key===y?g.type===oi?h(d,f,g.props.children,p,y):l(d,f,g,p):null;case _i:return g.key===y?u(d,f,g,p):null}if(Qr(g)||xn(g))return y!==null?null:h(d,f,g,p,null);Zr(d,g)}return null}function v(d,f,g,p,y){if(typeof p=="string"||typeof p=="number")return d=d.get(g)||null,a(f,d,""+p,y);if(typeof p=="object"&&p!==null){switch(p.$$typeof){case $r:return d=d.get(p.key===null?g:p.key)||null,p.type===oi?h(f,d,p.props.children,y,p.key):l(f,d,p,y);case _i:return d=d.get(p.key===null?g:p.key)||null,u(f,d,p,y)}if(Qr(p)||xn(p))return d=d.get(g)||null,h(f,d,p,y,null);Zr(f,p)}return null}function w(d,f,g,p){for(var y=null,S=null,T=f,k=f=0,B=null;T!==null&&k<g.length;k++){T.index>k?(B=T,T=null):B=T.sibling;var z=m(d,T,g[k],p);if(z===null){T===null&&(T=B);break}e&&T&&z.alternate===null&&t(d,T),f=s(z,f,k),S===null?y=z:S.sibling=z,S=z,T=B}if(k===g.length)return i(d,T),y;if(T===null){for(;k<g.length;k++)T=c(d,g[k],p),T!==null&&(f=s(T,f,k),S===null?y=T:S.sibling=T,S=T);return y}for(T=n(d,T);k<g.length;k++)B=v(T,d,k,g[k],p),B!==null&&(e&&B.alternate!==null&&T.delete(B.key===null?k:B.key),f=s(B,f,k),S===null?y=B:S.sibling=B,S=B);return e&&T.forEach(function(ee){return t(d,ee)}),y}function x(d,f,g,p){var y=xn(g);if(typeof y!="function")throw Error(I(150));if(g=y.call(g),g==null)throw Error(I(151));for(var S=y=null,T=f,k=f=0,B=null,z=g.next();T!==null&&!z.done;k++,z=g.next()){T.index>k?(B=T,T=null):B=T.sibling;var ee=m(d,T,z.value,p);if(ee===null){T===null&&(T=B);break}e&&T&&ee.alternate===null&&t(d,T),f=s(ee,f,k),S===null?y=ee:S.sibling=ee,S=ee,T=B}if(z.done)return i(d,T),y;if(T===null){for(;!z.done;k++,z=g.next())z=c(d,z.value,p),z!==null&&(f=s(z,f,k),S===null?y=z:S.sibling=z,S=z);return y}for(T=n(d,T);!z.done;k++,z=g.next())z=v(T,d,k,z.value,p),z!==null&&(e&&z.alternate!==null&&T.delete(z.key===null?k:z.key),f=s(z,f,k),S===null?y=z:S.sibling=z,S=z);return e&&T.forEach(function(C){return t(d,C)}),y}return function(d,f,g,p){var y=typeof g=="object"&&g!==null&&g.type===oi&&g.key===null;y&&(g=g.props.children);var S=typeof g=="object"&&g!==null;if(S)switch(g.$$typeof){case $r:e:{for(S=g.key,y=f;y!==null;){if(y.key===S){switch(y.tag){case 7:if(g.type===oi){i(d,y.sibling),f=r(y,g.props.children),f.return=d,d=f;break e}break;default:if(y.elementType===g.type){i(d,y.sibling),f=r(y,g.props),f.ref=An(d,y,g),f.return=d,d=f;break e}}i(d,y);break}else t(d,y);y=y.sibling}g.type===oi?(f=_t(g.props.children,d.mode,p,g.key),f.return=d,d=f):(p=ws(g.type,g.key,g.props,null,d.mode,p),p.ref=An(d,f,g),p.return=d,d=p)}return o(d);case _i:e:{for(y=g.key;f!==null;){if(f.key===y)if(f.tag===4&&f.stateNode.containerInfo===g.containerInfo&&f.stateNode.implementation===g.implementation){i(d,f.sibling),f=r(f,g.children||[]),f.return=d,d=f;break e}else{i(d,f);break}else t(d,f);f=f.sibling}f=Zo(g,d.mode,p),f.return=d,d=f}return o(d)}if(typeof g=="string"||typeof g=="number")return g=""+g,f!==null&&f.tag===6?(i(d,f.sibling),f=r(f,g),f.return=d,d=f):(i(d,f),f=Qo(g,d.mode,p),f.return=d,d=f),o(d);if(Qr(g))return w(d,f,g,p);if(xn(g))return x(d,f,g,p);if(S&&Zr(d,g),typeof g=="undefined"&&!y)switch(d.tag){case 1:case 0:throw d=d.type,Error(I(152,d.displayName||d.name||"Component"))}return i(d,f)}}var an=_p(!0),vu=_p(!1),kr={},ft={current:kr},or={current:kr},ar={current:kr};function li(e){if(e===kr)throw Error(I(174));return e}function Wa(e,t){switch(ue(ar,t),ue(or,e),ue(ft,kr),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Aa(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Aa(t,e)}q(ft),ue(ft,t)}function ln(){q(ft),q(or),q(ar)}function hh(e){li(ar.current);var t=li(ft.current),i=Aa(t,e.type);t!==i&&(ue(or,e),ue(ft,i))}function wu(e){or.current===e&&(q(ft),q(or))}var ae={current:0};function Rs(e){for(var t=e;t!==null;){if(t.tag===13){var i=t.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||i.data===su||i.data===ou))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if((t.effectTag&64)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}function yu(e,t){return{responder:e,props:t}}var gs=tt.ReactCurrentDispatcher,Ye=tt.ReactCurrentBatchConfig,Rt=0,de=null,Se=null,Me=null,js=!1;function _e(){throw Error(I(321))}function xu(e,t){if(t===null)return!1;for(var i=0;i<t.length&&i<e.length;i++)if(!Mi(e[i],t[i]))return!1;return!0}function Su(e,t,i,n,r,s){if(Rt=s,de=t,t.memoizedState=null,t.updateQueue=null,t.expirationTime=0,gs.current=e===null||e.memoizedState===null?rS:sS,e=i(n,r),t.expirationTime===Rt){s=0;do{if(t.expirationTime=0,!(25>s))throw Error(I(301));s+=1,Me=Se=null,t.updateQueue=null,gs.current=oS,e=i(n,r)}while(t.expirationTime===Rt)}if(gs.current=Os,t=Se!==null&&Se.next!==null,Rt=0,Me=Se=de=null,js=!1,t)throw Error(I(300));return e}function Ki(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Me===null?de.memoizedState=Me=e:Me=Me.next=e,Me}function dn(){if(Se===null){var e=de.alternate;e=e!==null?e.memoizedState:null}else e=Se.next;var t=Me===null?de.memoizedState:Me.next;if(t!==null)Me=t,Se=e;else{if(e===null)throw Error(I(310));Se=e,e={memoizedState:Se.memoizedState,baseState:Se.baseState,baseQueue:Se.baseQueue,queue:Se.queue,next:null},Me===null?de.memoizedState=Me=e:Me=Me.next=e}return Me}function pi(e,t){return typeof t=="function"?t(e):t}function Yr(e){var t=dn(),i=t.queue;if(i===null)throw Error(I(311));i.lastRenderedReducer=e;var n=Se,r=n.baseQueue,s=i.pending;if(s!==null){if(r!==null){var o=r.next;r.next=s.next,s.next=o}n.baseQueue=r=s,i.pending=null}if(r!==null){r=r.next,n=n.baseState;var a=o=s=null,l=r;do{var u=l.expirationTime;if(u<Rt){var h={expirationTime:l.expirationTime,suspenseConfig:l.suspenseConfig,action:l.action,eagerReducer:l.eagerReducer,eagerState:l.eagerState,next:null};a===null?(o=a=h,s=n):a=a.next=h,u>de.expirationTime&&(de.expirationTime=u,vo(u))}else a!==null&&(a=a.next={expirationTime:1073741823,suspenseConfig:l.suspenseConfig,action:l.action,eagerReducer:l.eagerReducer,eagerState:l.eagerState,next:null}),hg(u,l.suspenseConfig),n=l.eagerReducer===e?l.eagerState:e(n,l.action);l=l.next}while(l!==null&&l!==r);a===null?s=n:a.next=o,Mi(n,t.memoizedState)||(ht=!0),t.memoizedState=n,t.baseState=s,t.baseQueue=a,i.lastRenderedState=n}return[t.memoizedState,i.dispatch]}function Gr(e){var t=dn(),i=t.queue;if(i===null)throw Error(I(311));i.lastRenderedReducer=e;var n=i.dispatch,r=i.pending,s=t.memoizedState;if(r!==null){i.pending=null;var o=r=r.next;do s=e(s,o.action),o=o.next;while(o!==r);Mi(s,t.memoizedState)||(ht=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),i.lastRenderedState=s}return[s,n]}function Uo(e){var t=Ki();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e=t.queue={pending:null,dispatch:null,lastRenderedReducer:pi,lastRenderedState:e},e=e.dispatch=Hp.bind(null,de,e),[t.memoizedState,e]}function Ha(e,t,i,n){return e={tag:e,create:t,destroy:i,deps:n,next:null},t=de.updateQueue,t===null?(t={lastEffect:null},de.updateQueue=t,t.lastEffect=e.next=e):(i=t.lastEffect,i===null?t.lastEffect=e.next=e:(n=i.next,i.next=e,e.next=n,t.lastEffect=e)),e}function Vp(){return dn().memoizedState}function Fa(e,t,i,n){var r=Ki();de.effectTag|=e,r.memoizedState=Ha(1|t,i,void 0,n===void 0?null:n)}function Mu(e,t,i,n){var r=dn();n=n===void 0?null:n;var s=void 0;if(Se!==null){var o=Se.memoizedState;if(s=o.destroy,n!==null&&xu(n,o.deps)){Ha(t,i,s,n);return}}de.effectTag|=e,r.memoizedState=Ha(1|t,i,s,n)}function dh(e,t){return Fa(516,4,e,t)}function _s(e,t){return Mu(516,4,e,t)}function Op(e,t){return Mu(4,2,e,t)}function Up(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function $p(e,t,i){return i=i!=null?i.concat([e]):null,Mu(4,2,Up.bind(null,t,e),i)}function Iu(){}function fh(e,t){return Ki().memoizedState=[e,t===void 0?null:t],e}function Vs(e,t){var i=dn();t=t===void 0?null:t;var n=i.memoizedState;return n!==null&&t!==null&&xu(t,n[1])?n[0]:(i.memoizedState=[e,t],e)}function Wp(e,t){var i=dn();t=t===void 0?null:t;var n=i.memoizedState;return n!==null&&t!==null&&xu(t,n[1])?n[0]:(e=e(),i.memoizedState=[e,t],e)}function Cu(e,t,i){var n=ho();Xt(98>n?98:n,function(){e(!0)}),Xt(97<n?97:n,function(){var r=Ye.suspense;Ye.suspense=t===void 0?null:t;try{e(!1),i()}finally{Ye.suspense=r}})}function Hp(e,t,i){var n=pt(),r=Qn.suspense;n=vi(n,e,r),r={expirationTime:n,suspenseConfig:r,action:i,eagerReducer:null,eagerState:null,next:null};var s=t.pending;if(s===null?r.next=r:(r.next=s.next,s.next=r),t.pending=r,s=e.alternate,e===de||s!==null&&s===de)js=!0,r.expirationTime=Rt,de.expirationTime=Rt;else{if(e.expirationTime===0&&(s===null||s.expirationTime===0)&&(s=t.lastRenderedReducer,s!==null))try{var o=t.lastRenderedState,a=s(o,i);if(r.eagerReducer=s,r.eagerState=a,Mi(a,o))return}catch{}finally{}Zt(e,n)}}var Os={readContext:Ge,useCallback:_e,useContext:_e,useEffect:_e,useImperativeHandle:_e,useLayoutEffect:_e,useMemo:_e,useReducer:_e,useRef:_e,useState:_e,useDebugValue:_e,useResponder:_e,useDeferredValue:_e,useTransition:_e},rS={readContext:Ge,useCallback:fh,useContext:Ge,useEffect:dh,useImperativeHandle:function(e,t,i){return i=i!=null?i.concat([e]):null,Fa(4,2,Up.bind(null,t,e),i)},useLayoutEffect:function(e,t){return Fa(4,2,e,t)},useMemo:function(e,t){var i=Ki();return t=t===void 0?null:t,e=e(),i.memoizedState=[e,t],e},useReducer:function(e,t,i){var n=Ki();return t=i!==void 0?i(t):t,n.memoizedState=n.baseState=t,e=n.queue={pending:null,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},e=e.dispatch=Hp.bind(null,de,e),[n.memoizedState,e]},useRef:function(e){var t=Ki();return e={current:e},t.memoizedState=e},useState:Uo,useDebugValue:Iu,useResponder:yu,useDeferredValue:function(e,t){var i=Uo(e),n=i[0],r=i[1];return dh(function(){var s=Ye.suspense;Ye.suspense=t===void 0?null:t;try{r(e)}finally{Ye.suspense=s}},[e,t]),n},useTransition:function(e){var t=Uo(!1),i=t[0];return t=t[1],[fh(Cu.bind(null,t,e),[t,e]),i]}},sS={readContext:Ge,useCallback:Vs,useContext:Ge,useEffect:_s,useImperativeHandle:$p,useLayoutEffect:Op,useMemo:Wp,useReducer:Yr,useRef:Vp,useState:function(){return Yr(pi)},useDebugValue:Iu,useResponder:yu,useDeferredValue:function(e,t){var i=Yr(pi),n=i[0],r=i[1];return _s(function(){var s=Ye.suspense;Ye.suspense=t===void 0?null:t;try{r(e)}finally{Ye.suspense=s}},[e,t]),n},useTransition:function(e){var t=Yr(pi),i=t[0];return t=t[1],[Vs(Cu.bind(null,t,e),[t,e]),i]}},oS={readContext:Ge,useCallback:Vs,useContext:Ge,useEffect:_s,useImperativeHandle:$p,useLayoutEffect:Op,useMemo:Wp,useReducer:Gr,useRef:Vp,useState:function(){return Gr(pi)},useDebugValue:Iu,useResponder:yu,useDeferredValue:function(e,t){var i=Gr(pi),n=i[0],r=i[1];return _s(function(){var s=Ye.suspense;Ye.suspense=t===void 0?null:t;try{r(e)}finally{Ye.suspense=s}},[e,t]),n},useTransition:function(e){var t=Gr(pi),i=t[0];return t=t[1],[Vs(Cu.bind(null,t,e),[t,e]),i]}},Ct=null,jt=null,gi=!1;function Fp(e,t){var i=dt(5,null,null,0);i.elementType="DELETED",i.type="DELETED",i.stateNode=t,i.return=e,i.effectTag=8,e.lastEffect!==null?(e.lastEffect.nextEffect=i,e.lastEffect=i):e.firstEffect=e.lastEffect=i}function ph(e,t){switch(e.tag){case 5:var i=e.type;return t=t.nodeType!==1||i.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,!0):!1;case 13:return!1;default:return!1}}function Qa(e){if(gi){var t=jt;if(t){var i=t;if(!ph(e,t)){if(t=Xi(i.nextSibling),!t||!ph(e,t)){e.effectTag=e.effectTag&-1025|2,gi=!1,Ct=e;return}Fp(Ct,i)}Ct=e,jt=Xi(t.firstChild)}else e.effectTag=e.effectTag&-1025|2,gi=!1,Ct=e}}function gh(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Ct=e}function Xr(e){if(e!==Ct)return!1;if(!gi)return gh(e),gi=!0,!1;var t=e.type;if(e.tag!==5||t!=="head"&&t!=="body"&&!La(t,e.memoizedProps))for(t=jt;t;)Fp(e,t),t=Xi(t.nextSibling);if(gh(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(I(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var i=e.data;if(i===hp){if(t===0){jt=Xi(e.nextSibling);break e}t--}else i!==cp&&i!==ou&&i!==su||t++}e=e.nextSibling}jt=null}}else jt=Ct?Xi(e.stateNode.nextSibling):null;return!0}function $o(){jt=Ct=null,gi=!1}var aS=tt.ReactCurrentOwner,ht=!1;function Oe(e,t,i,n){t.child=e===null?vu(t,null,i,n):an(t,e.child,i,n)}function mh(e,t,i,n,r){i=i.render;var s=t.ref;return Ji(t,r),n=Su(e,t,i,n,s,r),e!==null&&!ht?(t.updateQueue=e.updateQueue,t.effectTag&=-517,e.expirationTime<=r&&(e.expirationTime=0),bt(e,t,r)):(t.effectTag|=1,Oe(e,t,n,r),t.child)}function vh(e,t,i,n,r,s){if(e===null){var o=i.type;return typeof o=="function"&&!Nu(o)&&o.defaultProps===void 0&&i.compare===null&&i.defaultProps===void 0?(t.tag=15,t.type=o,Qp(e,t,o,n,r,s)):(e=ws(i.type,null,n,null,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}return o=e.child,r<s&&(r=o.memoizedProps,i=i.compare,i=i!==null?i:rr,i(r,n)&&e.ref===t.ref)?bt(e,t,s):(t.effectTag|=1,e=Ci(o,n),e.ref=t.ref,e.return=t,t.child=e)}function Qp(e,t,i,n,r,s){return e!==null&&rr(e.memoizedProps,n)&&e.ref===t.ref&&(ht=!1,r<s)?(t.expirationTime=e.expirationTime,bt(e,t,s)):Za(e,t,i,n,s)}function Zp(e,t){var i=t.ref;(e===null&&i!==null||e!==null&&e.ref!==i)&&(t.effectTag|=128)}function Za(e,t,i,n,r){var s=Le(i)?Ii:Ie.current;return s=on(t,s),Ji(t,r),i=Su(e,t,i,n,s,r),e!==null&&!ht?(t.updateQueue=e.updateQueue,t.effectTag&=-517,e.expirationTime<=r&&(e.expirationTime=0),bt(e,t,r)):(t.effectTag|=1,Oe(e,t,i,r),t.child)}function wh(e,t,i,n,r){if(Le(i)){var s=!0;ds(t)}else s=!1;if(Ji(t,r),t.stateNode===null)e!==null&&(e.alternate=null,t.alternate=null,t.effectTag|=2),jp(t,i,n),$a(t,i,n,r),n=!0;else if(e===null){var o=t.stateNode,a=t.memoizedProps;o.props=a;var l=o.context,u=i.contextType;typeof u=="object"&&u!==null?u=Ge(u):(u=Le(i)?Ii:Ie.current,u=on(t,u));var h=i.getDerivedStateFromProps,c=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function";c||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==n||l!==u)&&ch(t,o,n,u),zt=!1;var m=t.memoizedState;o.state=m,sr(t,n,o,r),l=t.memoizedState,a!==n||m!==l||De.current||zt?(typeof h=="function"&&(Ls(t,i,h,n),l=t.memoizedState),(a=zt||uh(t,i,a,n,m,l,u))?(c||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.effectTag|=4)):(typeof o.componentDidMount=="function"&&(t.effectTag|=4),t.memoizedProps=n,t.memoizedState=l),o.props=n,o.state=l,o.context=u,n=a):(typeof o.componentDidMount=="function"&&(t.effectTag|=4),n=!1)}else o=t.stateNode,mu(e,t),a=t.memoizedProps,o.props=t.type===t.elementType?a:qe(t.type,a),l=o.context,u=i.contextType,typeof u=="object"&&u!==null?u=Ge(u):(u=Le(i)?Ii:Ie.current,u=on(t,u)),h=i.getDerivedStateFromProps,(c=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==n||l!==u)&&ch(t,o,n,u),zt=!1,l=t.memoizedState,o.state=l,sr(t,n,o,r),m=t.memoizedState,a!==n||l!==m||De.current||zt?(typeof h=="function"&&(Ls(t,i,h,n),m=t.memoizedState),(h=zt||uh(t,i,a,n,l,m,u))?(c||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(n,m,u),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(n,m,u)),typeof o.componentDidUpdate=="function"&&(t.effectTag|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.effectTag|=256)):(typeof o.componentDidUpdate!="function"||a===e.memoizedProps&&l===e.memoizedState||(t.effectTag|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&l===e.memoizedState||(t.effectTag|=256),t.memoizedProps=n,t.memoizedState=m),o.props=n,o.state=m,o.context=u,n=h):(typeof o.componentDidUpdate!="function"||a===e.memoizedProps&&l===e.memoizedState||(t.effectTag|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&l===e.memoizedState||(t.effectTag|=256),n=!1);return Ya(e,t,i,n,s,r)}function Ya(e,t,i,n,r,s){Zp(e,t);var o=(t.effectTag&64)!==0;if(!n&&!o)return r&&nh(t,i,!1),bt(e,t,s);n=t.stateNode,aS.current=t;var a=o&&typeof i.getDerivedStateFromError!="function"?null:n.render();return t.effectTag|=1,e!==null&&o?(t.child=an(t,e.child,null,s),t.child=an(t,null,a,s)):Oe(e,t,a,s),t.memoizedState=n.state,r&&nh(t,i,!0),t.child}function yh(e){var t=e.stateNode;t.pendingContext?ih(e,t.pendingContext,t.pendingContext!==t.context):t.context&&ih(e,t.context,!1),Wa(e,t.containerInfo)}var Wo={dehydrated:null,retryTime:0};function xh(e,t,i){var n=t.mode,r=t.pendingProps,s=ae.current,o=!1,a;if((a=(t.effectTag&64)!==0)||(a=(s&2)!==0&&(e===null||e.memoizedState!==null)),a?(o=!0,t.effectTag&=-65):e!==null&&e.memoizedState===null||r.fallback===void 0||r.unstable_avoidThisFallback===!0||(s|=1),ue(ae,s&1),e===null){if(r.fallback!==void 0&&Qa(t),o){if(o=r.fallback,r=_t(null,n,0,null),r.return=t,(t.mode&2)===0)for(e=t.memoizedState!==null?t.child.child:t.child,r.child=e;e!==null;)e.return=r,e=e.sibling;return i=_t(o,n,i,null),i.return=t,r.sibling=i,t.memoizedState=Wo,t.child=r,i}return n=r.children,t.memoizedState=null,t.child=vu(t,null,n,i)}if(e.memoizedState!==null){if(e=e.child,n=e.sibling,o){if(r=r.fallback,i=Ci(e,e.pendingProps),i.return=t,(t.mode&2)===0&&(o=t.memoizedState!==null?t.child.child:t.child,o!==e.child))for(i.child=o;o!==null;)o.return=i,o=o.sibling;return n=Ci(n,r),n.return=t,i.sibling=n,i.childExpirationTime=0,t.memoizedState=Wo,t.child=i,n}return i=an(t,e.child,r.children,i),t.memoizedState=null,t.child=i}if(e=e.child,o){if(o=r.fallback,r=_t(null,n,0,null),r.return=t,r.child=e,e!==null&&(e.return=r),(t.mode&2)===0)for(e=t.memoizedState!==null?t.child.child:t.child,r.child=e;e!==null;)e.return=r,e=e.sibling;return i=_t(o,n,i,null),i.return=t,r.sibling=i,i.effectTag|=2,r.childExpirationTime=0,t.memoizedState=Wo,t.child=r,i}return t.memoizedState=null,t.child=an(t,e,r.children,i)}function Sh(e,t){e.expirationTime<t&&(e.expirationTime=t);var i=e.alternate;i!==null&&i.expirationTime<t&&(i.expirationTime=t),Lp(e.return,t)}function Ho(e,t,i,n,r,s){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:i,tailExpiration:0,tailMode:r,lastEffect:s}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=n,o.tail=i,o.tailExpiration=0,o.tailMode=r,o.lastEffect=s)}function Mh(e,t,i){var n=t.pendingProps,r=n.revealOrder,s=n.tail;if(Oe(e,t,n.children,i),n=ae.current,(n&2)!==0)n=n&1|2,t.effectTag|=64;else{if(e!==null&&(e.effectTag&64)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Sh(e,i);else if(e.tag===19)Sh(e,i);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}n&=1}if(ue(ae,n),(t.mode&2)===0)t.memoizedState=null;else switch(r){case"forwards":for(i=t.child,r=null;i!==null;)e=i.alternate,e!==null&&Rs(e)===null&&(r=i),i=i.sibling;i=r,i===null?(r=t.child,t.child=null):(r=i.sibling,i.sibling=null),Ho(t,!1,r,i,s,t.lastEffect);break;case"backwards":for(i=null,r=t.child,t.child=null;r!==null;){if(e=r.alternate,e!==null&&Rs(e)===null){t.child=r;break}e=r.sibling,r.sibling=i,i=r,r=e}Ho(t,!0,i,null,s,t.lastEffect);break;case"together":Ho(t,!1,null,null,void 0,t.lastEffect);break;default:t.memoizedState=null}return t.child}function bt(e,t,i){e!==null&&(t.dependencies=e.dependencies);var n=t.expirationTime;if(n!==0&&vo(n),t.childExpirationTime<i)return null;if(e!==null&&t.child!==e.child)throw Error(I(153));if(t.child!==null){for(e=t.child,i=Ci(e,e.pendingProps),t.child=i,i.return=t;e.sibling!==null;)e=e.sibling,i=i.sibling=Ci(e,e.pendingProps),i.return=t;i.sibling=null}return t.child}var Yp,Ga,Gp,Xp;Yp=function(e,t){for(var i=t.child;i!==null;){if(i.tag===5||i.tag===6)e.appendChild(i.stateNode);else if(i.tag!==4&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break;for(;i.sibling===null;){if(i.return===null||i.return===t)return;i=i.return}i.sibling.return=i.return,i=i.sibling}};Ga=function(){};Gp=function(e,t,i,n,r){var s=e.memoizedProps;if(s!==n){var o=t.stateNode;switch(li(ft.current),e=null,i){case"input":s=Sa(o,s),n=Sa(o,n),e=[];break;case"option":s=Ca(o,s),n=Ca(o,n),e=[];break;case"select":s=Ee({},s,{value:void 0}),n=Ee({},n,{value:void 0}),e=[];break;case"textarea":s=ba(o,s),n=ba(o,n),e=[];break;default:typeof s.onClick!="function"&&typeof n.onClick=="function"&&(o.onclick=Es)}Pa(i,n);var a,l;i=null;for(a in s)if(!n.hasOwnProperty(a)&&s.hasOwnProperty(a)&&s[a]!=null)if(a==="style")for(l in o=s[a],o)o.hasOwnProperty(l)&&(i||(i={}),i[l]="");else a!=="dangerouslySetInnerHTML"&&a!=="children"&&a!=="suppressContentEditableWarning"&&a!=="suppressHydrationWarning"&&a!=="autoFocus"&&(nn.hasOwnProperty(a)?e||(e=[]):(e=e||[]).push(a,null));for(a in n){var u=n[a];if(o=s!=null?s[a]:void 0,n.hasOwnProperty(a)&&u!==o&&(u!=null||o!=null))if(a==="style")if(o){for(l in o)!o.hasOwnProperty(l)||u&&u.hasOwnProperty(l)||(i||(i={}),i[l]="");for(l in u)u.hasOwnProperty(l)&&o[l]!==u[l]&&(i||(i={}),i[l]=u[l])}else i||(e||(e=[]),e.push(a,i)),i=u;else a==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,o=o?o.__html:void 0,u!=null&&o!==u&&(e=e||[]).push(a,u)):a==="children"?o===u||typeof u!="string"&&typeof u!="number"||(e=e||[]).push(a,""+u):a!=="suppressContentEditableWarning"&&a!=="suppressHydrationWarning"&&(nn.hasOwnProperty(a)?(u!=null&&wt(r,a),e||o===u||(e=[])):(e=e||[]).push(a,u))}i&&(e=e||[]).push("style",i),r=e,(t.updateQueue=r)&&(t.effectTag|=4)}};Xp=function(e,t,i,n){i!==n&&(t.effectTag|=4)};function Jr(e,t){switch(e.tailMode){case"hidden":t=e.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var n=null;i!==null;)i.alternate!==null&&(n=i),i=i.sibling;n===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:n.sibling=null}}function lS(e,t,i){var n=t.pendingProps;switch(t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return null;case 1:return Le(t.type)&&Ps(),null;case 3:return ln(),q(De),q(Ie),i=t.stateNode,i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),e!==null&&e.child!==null||!Xr(t)||(t.effectTag|=4),Ga(t),null;case 5:wu(t),i=li(ar.current);var r=t.type;if(e!==null&&t.stateNode!=null)Gp(e,t,r,n,i),e.ref!==t.ref&&(t.effectTag|=128);else{if(!n){if(t.stateNode===null)throw Error(I(166));return null}if(e=li(ft.current),Xr(t)){n=t.stateNode,r=t.type;var s=t.memoizedProps;switch(n[Dt]=t,n[Ns]=s,r){case"iframe":case"object":case"embed":re("load",n);break;case"video":case"audio":for(e=0;e<Pn.length;e++)re(Pn[e],n);break;case"source":re("error",n);break;case"img":case"image":case"link":re("error",n),re("load",n);break;case"form":re("reset",n),re("submit",n);break;case"details":re("toggle",n);break;case"input":zc(n,s),re("invalid",n),wt(i,"onChange");break;case"select":n._wrapperState={wasMultiple:!!s.multiple},re("invalid",n),wt(i,"onChange");break;case"textarea":Lc(n,s),re("invalid",n),wt(i,"onChange")}Pa(r,s),e=null;for(var o in s)if(s.hasOwnProperty(o)){var a=s[o];o==="children"?typeof a=="string"?n.textContent!==a&&(e=["children",a]):typeof a=="number"&&n.textContent!==""+a&&(e=["children",""+a]):nn.hasOwnProperty(o)&&a!=null&&wt(i,o)}switch(r){case"input":Wr(n),Dc(n,s,!0);break;case"textarea":Wr(n),Rc(n);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(n.onclick=Es)}i=e,t.updateQueue=i,i!==null&&(t.effectTag|=4)}else{switch(o=i.nodeType===9?i:i.ownerDocument,e===$c&&(e=Wf(r)),e===$c?r==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof n.is=="string"?e=o.createElement(r,{is:n.is}):(e=o.createElement(r),r==="select"&&(o=e,n.multiple?o.multiple=!0:n.size&&(o.size=n.size))):e=o.createElementNS(e,r),e[Dt]=t,e[Ns]=n,Yp(e,t,!1,!1),t.stateNode=e,o=Ba(r,n),r){case"iframe":case"object":case"embed":re("load",e),a=n;break;case"video":case"audio":for(a=0;a<Pn.length;a++)re(Pn[a],e);a=n;break;case"source":re("error",e),a=n;break;case"img":case"image":case"link":re("error",e),re("load",e),a=n;break;case"form":re("reset",e),re("submit",e),a=n;break;case"details":re("toggle",e),a=n;break;case"input":zc(e,n),a=Sa(e,n),re("invalid",e),wt(i,"onChange");break;case"option":a=Ca(e,n);break;case"select":e._wrapperState={wasMultiple:!!n.multiple},a=Ee({},n,{value:void 0}),re("invalid",e),wt(i,"onChange");break;case"textarea":Lc(e,n),a=ba(e,n),re("invalid",e),wt(i,"onChange");break;default:a=n}Pa(r,a);var l=a;for(s in l)if(l.hasOwnProperty(s)){var u=l[s];s==="style"?lp(e,u):s==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&Hf(e,u)):s==="children"?typeof u=="string"?(r!=="textarea"||u!=="")&&er(e,u):typeof u=="number"&&er(e,""+u):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(nn.hasOwnProperty(s)?u!=null&&wt(i,s):u!=null&&Yl(e,s,u,o))}switch(r){case"input":Wr(e),Dc(e,n,!1);break;case"textarea":Wr(e),Rc(e);break;case"option":n.value!=null&&e.setAttribute("value",""+Yt(n.value));break;case"select":e.multiple=!!n.multiple,i=n.value,i!=null?Gi(e,!!n.multiple,i,!1):n.defaultValue!=null&&Gi(e,!!n.multiple,n.defaultValue,!0);break;default:typeof a.onClick=="function"&&(e.onclick=Es)}dp(r,n)&&(t.effectTag|=4)}t.ref!==null&&(t.effectTag|=128)}return null;case 6:if(e&&t.stateNode!=null)Xp(e,t,e.memoizedProps,n);else{if(typeof n!="string"&&t.stateNode===null)throw Error(I(166));i=li(ar.current),li(ft.current),Xr(t)?(i=t.stateNode,n=t.memoizedProps,i[Dt]=t,i.nodeValue!==n&&(t.effectTag|=4)):(i=(i.nodeType===9?i:i.ownerDocument).createTextNode(n),i[Dt]=t,t.stateNode=i)}return null;case 13:return q(ae),n=t.memoizedState,(t.effectTag&64)!==0?(t.expirationTime=i,t):(i=n!==null,n=!1,e===null?t.memoizedProps.fallback!==void 0&&Xr(t):(r=e.memoizedState,n=r!==null,i||r===null||(r=e.child.sibling,r!==null&&(s=t.firstEffect,s!==null?(t.firstEffect=r,r.nextEffect=s):(t.firstEffect=t.lastEffect=r,r.nextEffect=null),r.effectTag=8))),i&&!n&&(t.mode&2)!==0&&(e===null&&t.memoizedProps.unstable_avoidThisFallback!==!0||(ae.current&1)!==0?ge===mi&&(ge=Ws):((ge===mi||ge===Ws)&&(ge=po),ur!==0&&We!==null&&(hi(We,Re),mg(We,ur)))),(i||n)&&(t.effectTag|=4),null);case 4:return ln(),Ga(t),null;case 10:return pu(t),null;case 17:return Le(t.type)&&Ps(),null;case 19:if(q(ae),n=t.memoizedState,n===null)return null;if(r=(t.effectTag&64)!==0,s=n.rendering,s===null){if(r)Jr(n,!1);else if(ge!==mi||e!==null&&(e.effectTag&64)!==0)for(s=t.child;s!==null;){if(e=Rs(s),e!==null){for(t.effectTag|=64,Jr(n,!1),r=e.updateQueue,r!==null&&(t.updateQueue=r,t.effectTag|=4),n.lastEffect===null&&(t.firstEffect=null),t.lastEffect=n.lastEffect,n=t.child;n!==null;)r=n,s=i,r.effectTag&=2,r.nextEffect=null,r.firstEffect=null,r.lastEffect=null,e=r.alternate,e===null?(r.childExpirationTime=0,r.expirationTime=s,r.child=null,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null):(r.childExpirationTime=e.childExpirationTime,r.expirationTime=e.expirationTime,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,s=e.dependencies,r.dependencies=s===null?null:{expirationTime:s.expirationTime,firstContext:s.firstContext,responders:s.responders}),n=n.sibling;return ue(ae,ae.current&1|2),t.child}s=s.sibling}}else{if(!r)if(e=Rs(s),e!==null){if(t.effectTag|=64,r=!0,i=e.updateQueue,i!==null&&(t.updateQueue=i,t.effectTag|=4),Jr(n,!0),n.tail===null&&n.tailMode==="hidden"&&!s.alternate)return t=t.lastEffect=n.lastEffect,t!==null&&(t.nextEffect=null),null}else 2*Ze()-n.renderingStartTime>n.tailExpiration&&1<i&&(t.effectTag|=64,r=!0,Jr(n,!1),t.expirationTime=t.childExpirationTime=i-1);n.isBackwards?(s.sibling=t.child,t.child=s):(i=n.last,i!==null?i.sibling=s:t.child=s,n.last=s)}return n.tail!==null?(n.tailExpiration===0&&(n.tailExpiration=Ze()+500),i=n.tail,n.rendering=i,n.tail=i.sibling,n.lastEffect=t.lastEffect,n.renderingStartTime=Ze(),i.sibling=null,t=ae.current,ue(ae,r?t&1|2:t&1),i):null}throw Error(I(156,t.tag))}function uS(e){switch(e.tag){case 1:Le(e.type)&&Ps();var t=e.effectTag;return t&4096?(e.effectTag=t&-4097|64,e):null;case 3:if(ln(),q(De),q(Ie),t=e.effectTag,(t&64)!==0)throw Error(I(285));return e.effectTag=t&-4097|64,e;case 5:return wu(e),null;case 13:return q(ae),t=e.effectTag,t&4096?(e.effectTag=t&-4097|64,e):null;case 19:return q(ae),null;case 4:return ln(),null;case 10:return pu(e),null;default:return null}}function bu(e,t){return{value:e,source:t,stack:Jl(t)}}var cS=typeof WeakSet=="function"?WeakSet:Set;function Xa(e,t){var i=t.source,n=t.stack;n===null&&i!==null&&(n=Jl(i)),i!==null&&At(i.type),t=t.value,e!==null&&e.tag===1&&At(e.type);try{console.error(t)}catch(r){setTimeout(function(){throw r})}}function hS(e,t){try{t.props=e.memoizedProps,t.state=e.memoizedState,t.componentWillUnmount()}catch(i){wi(e,i)}}function Ih(e){var t=e.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(i){wi(e,i)}else t.current=null}function dS(e,t){switch(t.tag){case 0:case 11:case 15:case 22:return;case 1:if(t.effectTag&256&&e!==null){var i=e.memoizedProps,n=e.memoizedState;e=t.stateNode,t=e.getSnapshotBeforeUpdate(t.elementType===t.type?i:qe(t.type,i),n),e.__reactInternalSnapshotBeforeUpdate=t}return;case 3:case 5:case 6:case 4:case 17:return}throw Error(I(163))}function Jp(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var i=t=t.next;do{if((i.tag&e)===e){var n=i.destroy;i.destroy=void 0,n!==void 0&&n()}i=i.next}while(i!==t)}}function Kp(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var i=t=t.next;do{if((i.tag&e)===e){var n=i.create;i.destroy=n()}i=i.next}while(i!==t)}}function fS(e,t,i){switch(i.tag){case 0:case 11:case 15:case 22:Kp(3,i);return;case 1:if(e=i.stateNode,i.effectTag&4)if(t===null)e.componentDidMount();else{var n=i.elementType===i.type?t.memoizedProps:qe(i.type,t.memoizedProps);e.componentDidUpdate(n,t.memoizedState,e.__reactInternalSnapshotBeforeUpdate)}t=i.updateQueue,t!==null&&lh(i,t,e);return;case 3:if(t=i.updateQueue,t!==null){if(e=null,i.child!==null)switch(i.child.tag){case 5:e=i.child.stateNode;break;case 1:e=i.child.stateNode}lh(i,t,e)}return;case 5:e=i.stateNode,t===null&&i.effectTag&4&&dp(i.type,i.memoizedProps)&&e.focus();return;case 6:return;case 4:return;case 12:return;case 13:i.memoizedState===null&&(i=i.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&rp(i))));return;case 19:case 17:case 20:case 21:return}throw Error(I(163))}function Ch(e,t,i){switch(typeof rl=="function"&&rl(t),t.tag){case 0:case 11:case 14:case 15:case 22:if(e=t.updateQueue,e!==null&&(e=e.lastEffect,e!==null)){var n=e.next;Xt(97<i?97:i,function(){var r=n;do{var s=r.destroy;if(s!==void 0){var o=t;try{s()}catch(a){wi(o,a)}}r=r.next}while(r!==n)})}break;case 1:Ih(t),i=t.stateNode,typeof i.componentWillUnmount=="function"&&hS(t,i);break;case 5:Ih(t);break;case 4:eg(e,t,i)}}function qp(e){var t=e.alternate;e.return=null,e.child=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.alternate=null,e.firstEffect=null,e.lastEffect=null,e.pendingProps=null,e.memoizedProps=null,e.stateNode=null,t!==null&&qp(t)}function bh(e){return e.tag===5||e.tag===3||e.tag===4}function Ah(e){e:{for(var t=e.return;t!==null;){if(bh(t)){var i=t;break e}t=t.return}throw Error(I(160))}switch(t=i.stateNode,i.tag){case 5:var n=!1;break;case 3:t=t.containerInfo,n=!0;break;case 4:t=t.containerInfo,n=!0;break;default:throw Error(I(161))}i.effectTag&16&&(er(t,""),i.effectTag&=-17);e:t:for(i=e;;){for(;i.sibling===null;){if(i.return===null||bh(i.return)){i=null;break e}i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.effectTag&2||i.child===null||i.tag===4)continue t;i.child.return=i,i=i.child}if(!(i.effectTag&2)){i=i.stateNode;break e}}n?Ja(e,i,t):Ka(e,i,t)}function Ja(e,t,i){var n=e.tag,r=n===5||n===6;if(r)e=r?e.stateNode:e.stateNode.instance,t?i.nodeType===8?i.parentNode.insertBefore(e,t):i.insertBefore(e,t):(i.nodeType===8?(t=i.parentNode,t.insertBefore(e,i)):(t=i,t.appendChild(e)),i=i._reactRootContainer,i!=null||t.onclick!==null||(t.onclick=Es));else if(n!==4&&(e=e.child,e!==null))for(Ja(e,t,i),e=e.sibling;e!==null;)Ja(e,t,i),e=e.sibling}function Ka(e,t,i){var n=e.tag,r=n===5||n===6;if(r)e=r?e.stateNode:e.stateNode.instance,t?i.insertBefore(e,t):i.appendChild(e);else if(n!==4&&(e=e.child,e!==null))for(Ka(e,t,i),e=e.sibling;e!==null;)Ka(e,t,i),e=e.sibling}function eg(e,t,i){for(var n=t,r=!1,s,o;;){if(!r){r=n.return;e:for(;;){if(r===null)throw Error(I(160));switch(s=r.stateNode,r.tag){case 5:o=!1;break e;case 3:s=s.containerInfo,o=!0;break e;case 4:s=s.containerInfo,o=!0;break e}r=r.return}r=!0}if(n.tag===5||n.tag===6){e:for(var a=e,l=n,u=i,h=l;;)if(Ch(a,h,u),h.child!==null&&h.tag!==4)h.child.return=h,h=h.child;else{if(h===l)break e;for(;h.sibling===null;){if(h.return===null||h.return===l)break e;h=h.return}h.sibling.return=h.return,h=h.sibling}o?(a=s,l=n.stateNode,a.nodeType===8?a.parentNode.removeChild(l):a.removeChild(l)):s.removeChild(n.stateNode)}else if(n.tag===4){if(n.child!==null){s=n.stateNode.containerInfo,o=!0,n.child.return=n,n=n.child;continue}}else if(Ch(e,n,i),n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return,n.tag===4&&(r=!1)}n.sibling.return=n.return,n=n.sibling}}function Fo(e,t){switch(t.tag){case 0:case 11:case 14:case 15:case 22:Jp(3,t);return;case 1:return;case 5:var i=t.stateNode;if(i!=null){var n=t.memoizedProps,r=e!==null?e.memoizedProps:n;e=t.type;var s=t.updateQueue;if(t.updateQueue=null,s!==null){for(i[Ns]=n,e==="input"&&n.type==="radio"&&n.name!=null&&Of(i,n),Ba(e,r),t=Ba(e,n),r=0;r<s.length;r+=2){var o=s[r],a=s[r+1];o==="style"?lp(i,a):o==="dangerouslySetInnerHTML"?Hf(i,a):o==="children"?er(i,a):Yl(i,o,a,t)}switch(e){case"input":Ma(i,n);break;case"textarea":Uf(i,n);break;case"select":t=i._wrapperState.wasMultiple,i._wrapperState.wasMultiple=!!n.multiple,e=n.value,e!=null?Gi(i,!!n.multiple,e,!1):t!==!!n.multiple&&(n.defaultValue!=null?Gi(i,!!n.multiple,n.defaultValue,!0):Gi(i,!!n.multiple,n.multiple?[]:"",!1))}}}return;case 6:if(t.stateNode===null)throw Error(I(162));t.stateNode.nodeValue=t.memoizedProps;return;case 3:t=t.stateNode,t.hydrate&&(t.hydrate=!1,rp(t.containerInfo));return;case 12:return;case 13:if(i=t,t.memoizedState===null?n=!1:(n=!0,i=t.child,Eu=Ze()),i!==null)e:for(e=i;;){if(e.tag===5)s=e.stateNode,n?(s=s.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(s=e.stateNode,r=e.memoizedProps.style,r=r!=null&&r.hasOwnProperty("display")?r.display:null,s.style.display=ap("display",r));else if(e.tag===6)e.stateNode.nodeValue=n?"":e.memoizedProps;else if(e.tag===13&&e.memoizedState!==null&&e.memoizedState.dehydrated===null){s=e.child.sibling,s.return=e,e=s;continue}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===i)break;for(;e.sibling===null;){if(e.return===null||e.return===i)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}Th(t);return;case 19:Th(t);return;case 17:return}throw Error(I(163))}function Th(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var i=e.stateNode;i===null&&(i=e.stateNode=new cS),t.forEach(function(n){var r=IS.bind(null,e,n);i.has(n)||(i.add(n),n.then(r,r))})}}var pS=typeof WeakMap=="function"?WeakMap:Map;function tg(e,t,i){i=Ht(i,null),i.tag=3,i.payload={element:null};var n=t.value;return i.callback=function(){Qs||(Qs=!0,qa=n),Xa(e,t)},i}function ig(e,t,i){i=Ht(i,null),i.tag=3;var n=e.type.getDerivedStateFromError;if(typeof n=="function"){var r=t.value;i.payload=function(){return Xa(e,t),n(r)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(i.callback=function(){typeof n!="function"&&(Qt===null?Qt=new Set([this]):Qt.add(this),Xa(e,t));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),i}var gS=Math.ceil,Us=tt.ReactCurrentDispatcher,ng=tt.ReactCurrentOwner,me=0,Au=8,it=16,gt=32,mi=0,$s=1,rg=2,Ws=3,po=4,Tu=5,U=me,We=null,W=null,Re=0,ge=mi,go=null,It=1073741823,lr=1073741823,Hs=null,ur=0,Fs=!1,Eu=0,sg=500,L=null,Qs=!1,qa=null,Qt=null,Zs=!1,Zn=null,zn=90,ui=null,Yn=0,el=null,ms=0;function pt(){return(U&(it|gt))!==me?1073741821-(Ze()/10|0):ms!==0?ms:ms=1073741821-(Ze()/10|0)}function vi(e,t,i){if(t=t.mode,(t&2)===0)return 1073741823;var n=ho();if((t&4)===0)return n===99?1073741823:1073741822;if((U&it)!==me)return Re;if(i!==null)e=ps(e,i.timeoutMs|0||5e3,250);else switch(n){case 99:e=1073741823;break;case 98:e=ps(e,150,100);break;case 97:case 96:e=ps(e,5e3,250);break;case 95:e=2;break;default:throw Error(I(326))}return We!==null&&e===Re&&--e,e}function Zt(e,t){if(50<Yn)throw Yn=0,el=null,Error(I(185));if(e=mo(e,t),e!==null){var i=ho();t===1073741823?(U&Au)!==me&&(U&(it|gt))===me?tl(e):(He(e),U===me&&mt()):He(e),(U&4)===me||i!==98&&i!==99||(ui===null?ui=new Map([[e,t]]):(i=ui.get(e),(i===void 0||i>t)&&ui.set(e,t)))}}function mo(e,t){e.expirationTime<t&&(e.expirationTime=t);var i=e.alternate;i!==null&&i.expirationTime<t&&(i.expirationTime=t);var n=e.return,r=null;if(n===null&&e.tag===3)r=e.stateNode;else for(;n!==null;){if(i=n.alternate,n.childExpirationTime<t&&(n.childExpirationTime=t),i!==null&&i.childExpirationTime<t&&(i.childExpirationTime=t),n.return===null&&n.tag===3){r=n.stateNode;break}n=n.return}return r!==null&&(We===r&&(vo(t),ge===po&&hi(r,Re)),mg(r,t)),r}function vs(e){var t=e.lastExpiredTime;if(t!==0||(t=e.firstPendingTime,!gg(e,t)))return t;var i=e.lastPingedTime;return e=e.nextKnownPendingLevel,e=i>e?i:e,2>=e&&t!==e?0:e}function He(e){if(e.lastExpiredTime!==0)e.callbackExpirationTime=1073741823,e.callbackPriority=99,e.callbackNode=oh(tl.bind(null,e));else{var t=vs(e),i=e.callbackNode;if(t===0)i!==null&&(e.callbackNode=null,e.callbackExpirationTime=0,e.callbackPriority=90);else{var n=pt();if(t===1073741823?n=99:t===1||t===2?n=95:(n=10*(1073741821-t)-10*(1073741821-n),n=0>=n?99:250>=n?98:5250>=n?97:95),i!==null){var r=e.callbackPriority;if(e.callbackExpirationTime===t&&r>=n)return;i!==Pp&&Ap(i)}e.callbackExpirationTime=t,e.callbackPriority=n,t=t===1073741823?oh(tl.bind(null,e)):zp(n,og.bind(null,e),{timeout:10*(1073741821-t)-Ze()}),e.callbackNode=t}}}function og(e,t){if(ms=0,t)return t=pt(),sl(e,t),He(e),null;var i=vs(e);if(i!==0){if(t=e.callbackNode,(U&(it|gt))!==me)throw Error(I(327));if(fn(),e===We&&i===Re||ci(e,i),W!==null){var n=U;U|=it;var r=cg();do try{wS();break}catch(a){ug(e,a)}while(1);if(fu(),U=n,Us.current=r,ge===$s)throw t=go,ci(e,i),hi(e,i),He(e),t;if(W===null)switch(r=e.finishedWork=e.current.alternate,e.finishedExpirationTime=i,n=ge,We=null,n){case mi:case $s:throw Error(I(345));case rg:sl(e,2<i?2:i);break;case Ws:if(hi(e,i),n=e.lastSuspendedTime,i===n&&(e.nextKnownPendingLevel=il(r)),It===1073741823&&(r=Eu+sg-Ze(),10<r)){if(Fs){var s=e.lastPingedTime;if(s===0||s>=i){e.lastPingedTime=i,ci(e,i);break}}if(s=vs(e),s!==0&&s!==i)break;if(n!==0&&n!==i){e.lastPingedTime=n;break}e.timeoutHandle=Vo(si.bind(null,e),r);break}si(e);break;case po:if(hi(e,i),n=e.lastSuspendedTime,i===n&&(e.nextKnownPendingLevel=il(r)),Fs&&(r=e.lastPingedTime,r===0||r>=i)){e.lastPingedTime=i,ci(e,i);break}if(r=vs(e),r!==0&&r!==i)break;if(n!==0&&n!==i){e.lastPingedTime=n;break}if(lr!==1073741823?n=10*(1073741821-lr)-Ze():It===1073741823?n=0:(n=10*(1073741821-It)-5e3,r=Ze(),i=10*(1073741821-i)-r,n=r-n,0>n&&(n=0),n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*gS(n/1960))-n,i<n&&(n=i)),10<n){e.timeoutHandle=Vo(si.bind(null,e),n);break}si(e);break;case Tu:if(It!==1073741823&&Hs!==null){s=It;var o=Hs;if(n=o.busyMinDurationMs|0,0>=n?n=0:(r=o.busyDelayMs|0,s=Ze()-(10*(1073741821-s)-(o.timeoutMs|0||5e3)),n=s<=r?0:r+n-s),10<n){hi(e,i),e.timeoutHandle=Vo(si.bind(null,e),n);break}}si(e);break;default:throw Error(I(329))}if(He(e),e.callbackNode===t)return og.bind(null,e)}}return null}function tl(e){var t=e.lastExpiredTime;if(t=t!==0?t:1073741823,(U&(it|gt))!==me)throw Error(I(327));if(fn(),e===We&&t===Re||ci(e,t),W!==null){var i=U;U|=it;var n=cg();do try{vS();break}catch(r){ug(e,r)}while(1);if(fu(),U=i,Us.current=n,ge===$s)throw i=go,ci(e,t),hi(e,t),He(e),i;if(W!==null)throw Error(I(261));e.finishedWork=e.current.alternate,e.finishedExpirationTime=t,We=null,si(e),He(e)}return null}function mS(){if(ui!==null){var e=ui;ui=null,e.forEach(function(t,i){sl(i,t),He(i)}),mt()}}function ag(e,t){var i=U;U|=1;try{return e(t)}finally{U=i,U===me&&mt()}}function lg(e,t){var i=U;U&=-2,U|=Au;try{return e(t)}finally{U=i,U===me&&mt()}}function ci(e,t){e.finishedWork=null,e.finishedExpirationTime=0;var i=e.timeoutHandle;if(i!==-1&&(e.timeoutHandle=-1,g0(i)),W!==null)for(i=W.return;i!==null;){var n=i;switch(n.tag){case 1:n=n.type.childContextTypes,n!=null&&Ps();break;case 3:ln(),q(De),q(Ie);break;case 5:wu(n);break;case 4:ln();break;case 13:q(ae);break;case 19:q(ae);break;case 10:pu(n)}i=i.return}We=e,W=Ci(e.current,null),Re=t,ge=mi,go=null,lr=It=1073741823,Hs=null,ur=0,Fs=!1}function ug(e,t){do{try{if(fu(),gs.current=Os,js)for(var i=de.memoizedState;i!==null;){var n=i.queue;n!==null&&(n.pending=null),i=i.next}if(Rt=0,Me=Se=de=null,js=!1,W===null||W.return===null)return ge=$s,go=t,W=null;e:{var r=e,s=W.return,o=W,a=t;if(t=Re,o.effectTag|=2048,o.firstEffect=o.lastEffect=null,a!==null&&typeof a=="object"&&typeof a.then=="function"){var l=a;if((o.mode&2)===0){var u=o.alternate;u?(o.updateQueue=u.updateQueue,o.memoizedState=u.memoizedState,o.expirationTime=u.expirationTime):(o.updateQueue=null,o.memoizedState=null)}var h=(ae.current&1)!==0,c=s;do{var m;if(m=c.tag===13){var v=c.memoizedState;if(v!==null)m=v.dehydrated!==null;else{var w=c.memoizedProps;m=w.fallback===void 0?!1:w.unstable_avoidThisFallback!==!0?!0:!h}}if(m){var x=c.updateQueue;if(x===null){var d=new Set;d.add(l),c.updateQueue=d}else x.add(l);if((c.mode&2)===0){if(c.effectTag|=64,o.effectTag&=-2981,o.tag===1)if(o.alternate===null)o.tag=17;else{var f=Ht(1073741823,null);f.tag=2,Ft(o,f)}o.expirationTime=1073741823;break e}a=void 0,o=t;var g=r.pingCache;if(g===null?(g=r.pingCache=new pS,a=new Set,g.set(l,a)):(a=g.get(l),a===void 0&&(a=new Set,g.set(l,a))),!a.has(o)){a.add(o);var p=MS.bind(null,r,l,o);l.then(p,p)}c.effectTag|=4096,c.expirationTime=t;break e}c=c.return}while(c!==null);a=Error((At(o.type)||"A React component")+` suspended while rendering, but no fallback UI was specified.
45
45
 
46
46
  Add a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display.`+Jl(o))}ge!==Tu&&(ge=rg),a=bu(a,o),c=s;do{switch(c.tag){case 3:l=a,c.effectTag|=4096,c.expirationTime=t;var y=tg(c,l,t);ah(c,y);break e;case 1:l=a;var S=c.type,T=c.stateNode;if((c.effectTag&64)===0&&(typeof S.getDerivedStateFromError=="function"||T!==null&&typeof T.componentDidCatch=="function"&&(Qt===null||!Qt.has(T)))){c.effectTag|=4096,c.expirationTime=t;var k=ig(c,l,t);ah(c,k);break e}}c=c.return}while(c!==null)}W=fg(W)}catch(B){t=B;continue}break}while(1)}function cg(){var e=Us.current;return Us.current=Os,e===null?Os:e}function hg(e,t){e<It&&2<e&&(It=e),t!==null&&e<lr&&2<e&&(lr=e,Hs=t)}function vo(e){e>ur&&(ur=e)}function vS(){for(;W!==null;)W=dg(W)}function wS(){for(;W!==null&&!iS();)W=dg(W)}function dg(e){var t=pg(e.alternate,e,Re);return e.memoizedProps=e.pendingProps,t===null&&(t=fg(e)),ng.current=null,t}function fg(e){W=e;do{var t=W.alternate;if(e=W.return,(W.effectTag&2048)===0){if(t=lS(t,W,Re),Re===1||W.childExpirationTime!==1){for(var i=0,n=W.child;n!==null;){var r=n.expirationTime,s=n.childExpirationTime;r>i&&(i=r),s>i&&(i=s),n=n.sibling}W.childExpirationTime=i}if(t!==null)return t;e!==null&&(e.effectTag&2048)===0&&(e.firstEffect===null&&(e.firstEffect=W.firstEffect),W.lastEffect!==null&&(e.lastEffect!==null&&(e.lastEffect.nextEffect=W.firstEffect),e.lastEffect=W.lastEffect),1<W.effectTag&&(e.lastEffect!==null?e.lastEffect.nextEffect=W:e.firstEffect=W,e.lastEffect=W))}else{if(t=uS(W),t!==null)return t.effectTag&=2047,t;e!==null&&(e.firstEffect=e.lastEffect=null,e.effectTag|=2048)}if(t=W.sibling,t!==null)return t;W=e}while(W!==null);return ge===mi&&(ge=Tu),null}function il(e){var t=e.expirationTime;return e=e.childExpirationTime,t>e?t:e}function si(e){var t=ho();return Xt(99,yS.bind(null,e,t)),null}function yS(e,t){do fn();while(Zn!==null);if((U&(it|gt))!==me)throw Error(I(327));var i=e.finishedWork,n=e.finishedExpirationTime;if(i===null)return null;if(e.finishedWork=null,e.finishedExpirationTime=0,i===e.current)throw Error(I(177));e.callbackNode=null,e.callbackExpirationTime=0,e.callbackPriority=90,e.nextKnownPendingLevel=0;var r=il(i);if(e.firstPendingTime=r,n<=e.lastSuspendedTime?e.firstSuspendedTime=e.lastSuspendedTime=e.nextKnownPendingLevel=0:n<=e.firstSuspendedTime&&(e.firstSuspendedTime=n-1),n<=e.lastPingedTime&&(e.lastPingedTime=0),n<=e.lastExpiredTime&&(e.lastExpiredTime=0),e===We&&(W=We=null,Re=0),1<i.effectTag?i.lastEffect!==null?(i.lastEffect.nextEffect=i,r=i.firstEffect):r=i:r=i.firstEffect,r!==null){var s=U;U|=gt,ng.current=null,jo=ls;var o=Fc();if(Da(o)){if("selectionStart"in o)var a={start:o.selectionStart,end:o.selectionEnd};else e:{a=(a=o.ownerDocument)&&a.defaultView||window;var l=a.getSelection&&a.getSelection();if(l&&l.rangeCount!==0){a=l.anchorNode;var u=l.anchorOffset,h=l.focusNode;l=l.focusOffset;try{a.nodeType,h.nodeType}catch{a=null;break e}var c=0,m=-1,v=-1,w=0,x=0,d=o,f=null;t:for(;;){for(var g;d!==a||u!==0&&d.nodeType!==3||(m=c+u),d!==h||l!==0&&d.nodeType!==3||(v=c+l),d.nodeType===3&&(c+=d.nodeValue.length),(g=d.firstChild)!==null;)f=d,d=g;for(;;){if(d===o)break t;if(f===a&&++w===u&&(m=c),f===h&&++x===l&&(v=c),(g=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=g}a=m===-1||v===-1?null:{start:m,end:v}}else a=null}a=a||{start:0,end:0}}else a=null;_o={activeElementDetached:null,focusedElem:o,selectionRange:a},ls=!1,L=r;do try{xS()}catch(z){if(L===null)throw Error(I(330));wi(L,z),L=L.nextEffect}while(L!==null);L=r;do try{for(o=e,a=t;L!==null;){var p=L.effectTag;if(p&16&&er(L.stateNode,""),p&128){var y=L.alternate;if(y!==null){var S=y.ref;S!==null&&(typeof S=="function"?S(null):S.current=null)}}switch(p&1038){case 2:Ah(L),L.effectTag&=-3;break;case 6:Ah(L),L.effectTag&=-3,Fo(L.alternate,L);break;case 1024:L.effectTag&=-1025;break;case 1028:L.effectTag&=-1025,Fo(L.alternate,L);break;case 4:Fo(L.alternate,L);break;case 8:u=L,eg(o,u,a),qp(u)}L=L.nextEffect}}catch(z){if(L===null)throw Error(I(330));wi(L,z),L=L.nextEffect}while(L!==null);if(S=_o,y=Fc(),p=S.focusedElem,a=S.selectionRange,y!==p&&p&&p.ownerDocument&&up(p.ownerDocument.documentElement,p)){for(a!==null&&Da(p)&&(y=a.start,S=a.end,S===void 0&&(S=y),"selectionStart"in p?(p.selectionStart=y,p.selectionEnd=Math.min(S,p.value.length)):(S=(y=p.ownerDocument||document)&&y.defaultView||window,S.getSelection&&(S=S.getSelection(),u=p.textContent.length,o=Math.min(a.start,u),a=a.end===void 0?o:Math.min(a.end,u),!S.extend&&o>a&&(u=a,a=o,o=u),u=Hc(p,o),h=Hc(p,a),u&&h&&(S.rangeCount!==1||S.anchorNode!==u.node||S.anchorOffset!==u.offset||S.focusNode!==h.node||S.focusOffset!==h.offset)&&(y=y.createRange(),y.setStart(u.node,u.offset),S.removeAllRanges(),o>a?(S.addRange(y),S.extend(h.node,h.offset)):(y.setEnd(h.node,h.offset),S.addRange(y)))))),y=[],S=p;S=S.parentNode;)S.nodeType===1&&y.push({element:S,left:S.scrollLeft,top:S.scrollTop});for(typeof p.focus=="function"&&p.focus(),p=0;p<y.length;p++)S=y[p],S.element.scrollLeft=S.left,S.element.scrollTop=S.top}ls=!!jo,_o=jo=null,e.current=i,L=r;do try{for(p=e;L!==null;){var T=L.effectTag;if(T&36&&fS(p,L.alternate,L),T&128){y=void 0;var k=L.ref;if(k!==null){var B=L.stateNode;switch(L.tag){case 5:y=B;break;default:y=B}typeof k=="function"?k(y):k.current=y}}L=L.nextEffect}}catch(z){if(L===null)throw Error(I(330));wi(L,z),L=L.nextEffect}while(L!==null);L=null,nS(),U=s}else e.current=i;if(Zs)Zs=!1,Zn=e,zn=t;else for(L=r;L!==null;)t=L.nextEffect,L.nextEffect=null,L=t;if(t=e.firstPendingTime,t===0&&(Qt=null),t===1073741823?e===el?Yn++:(Yn=0,el=e):Yn=0,typeof nl=="function"&&nl(i.stateNode,n),He(e),Qs)throw Qs=!1,e=qa,qa=null,e;return(U&Au)!==me||mt(),null}function xS(){for(;L!==null;){var e=L.effectTag;(e&256)!==0&&dS(L.alternate,L),(e&512)===0||Zs||(Zs=!0,zp(97,function(){return fn(),null})),L=L.nextEffect}}function fn(){if(zn!==90){var e=97<zn?97:zn;return zn=90,Xt(e,SS)}}function SS(){if(Zn===null)return!1;var e=Zn;if(Zn=null,(U&(it|gt))!==me)throw Error(I(331));var t=U;for(U|=gt,e=e.current.firstEffect;e!==null;){try{var i=e;if((i.effectTag&512)!==0)switch(i.tag){case 0:case 11:case 15:case 22:Jp(5,i),Kp(5,i)}}catch(n){if(e===null)throw Error(I(330));wi(e,n)}i=e.nextEffect,e.nextEffect=null,e=i}return U=t,mt(),!0}function Eh(e,t,i){t=bu(i,t),t=tg(e,t,1073741823),Ft(e,t),e=mo(e,1073741823),e!==null&&He(e)}function wi(e,t){if(e.tag===3)Eh(e,e,t);else for(var i=e.return;i!==null;){if(i.tag===3){Eh(i,e,t);break}else if(i.tag===1){var n=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(Qt===null||!Qt.has(n))){e=bu(t,e),e=ig(i,e,1073741823),Ft(i,e),i=mo(i,1073741823),i!==null&&He(i);break}}i=i.return}}function MS(e,t,i){var n=e.pingCache;n!==null&&n.delete(t),We===e&&Re===i?ge===po||ge===Ws&&It===1073741823&&Ze()-Eu<sg?ci(e,Re):Fs=!0:gg(e,i)&&(t=e.lastPingedTime,t!==0&&t<i||(e.lastPingedTime=i,He(e)))}function IS(e,t){var i=e.stateNode;i!==null&&i.delete(t),t=0,t===0&&(t=pt(),t=vi(t,e,null)),e=mo(e,t),e!==null&&He(e)}var pg;pg=function(e,t,i){var n=t.expirationTime;if(e!==null){var r=t.pendingProps;if(e.memoizedProps!==r||De.current)ht=!0;else{if(n<i){switch(ht=!1,t.tag){case 3:yh(t),$o();break;case 5:if(hh(t),t.mode&4&&i!==1&&r.hidden)return t.expirationTime=t.childExpirationTime=1,null;break;case 1:Le(t.type)&&ds(t);break;case 4:Wa(t,t.stateNode.containerInfo);break;case 10:n=t.memoizedProps.value,r=t.type._context,ue(Bs,r._currentValue),r._currentValue=n;break;case 13:if(t.memoizedState!==null)return n=t.child.childExpirationTime,n!==0&&n>=i?xh(e,t,i):(ue(ae,ae.current&1),t=bt(e,t,i),t!==null?t.sibling:null);ue(ae,ae.current&1);break;case 19:if(n=t.childExpirationTime>=i,(e.effectTag&64)!==0){if(n)return Mh(e,t,i);t.effectTag|=64}if(r=t.memoizedState,r!==null&&(r.rendering=null,r.tail=null),ue(ae,ae.current),!n)return null}return bt(e,t,i)}ht=!1}}else ht=!1;switch(t.expirationTime=0,t.tag){case 2:if(n=t.type,e!==null&&(e.alternate=null,t.alternate=null,t.effectTag|=2),e=t.pendingProps,r=on(t,Ie.current),Ji(t,i),r=Su(null,t,n,e,r,i),t.effectTag|=1,typeof r=="object"&&r!==null&&typeof r.render=="function"&&r.$$typeof===void 0){if(t.tag=1,t.memoizedState=null,t.updateQueue=null,Le(n)){var s=!0;ds(t)}else s=!1;t.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,gu(t);var o=n.getDerivedStateFromProps;typeof o=="function"&&Ls(t,n,o,e),r.updater=fo,t.stateNode=r,r._reactInternalFiber=t,$a(t,n,e,i),t=Ya(null,t,n,!0,s,i)}else t.tag=0,Oe(null,t,r,i),t=t.child;return t;case 16:e:{if(r=t.elementType,e!==null&&(e.alternate=null,t.alternate=null,t.effectTag|=2),e=t.pendingProps,Kx(r),r._status!==1)throw r._result;switch(r=r._result,t.type=r,s=t.tag=AS(r),e=qe(r,e),s){case 0:t=Za(null,t,r,e,i);break e;case 1:t=wh(null,t,r,e,i);break e;case 11:t=mh(null,t,r,e,i);break e;case 14:t=vh(null,t,r,qe(r.type,e),n,i);break e}throw Error(I(306,r,""))}return t;case 0:return n=t.type,r=t.pendingProps,r=t.elementType===n?r:qe(n,r),Za(e,t,n,r,i);case 1:return n=t.type,r=t.pendingProps,r=t.elementType===n?r:qe(n,r),wh(e,t,n,r,i);case 3:if(yh(t),n=t.updateQueue,e===null||n===null)throw Error(I(282));if(n=t.pendingProps,r=t.memoizedState,r=r!==null?r.element:null,mu(e,t),sr(t,n,null,i),n=t.memoizedState.element,n===r)$o(),t=bt(e,t,i);else{if((r=t.stateNode.hydrate)&&(jt=Xi(t.stateNode.containerInfo.firstChild),Ct=t,r=gi=!0),r)for(i=vu(t,null,n,i),t.child=i;i;)i.effectTag=i.effectTag&-3|1024,i=i.sibling;else Oe(e,t,n,i),$o();t=t.child}return t;case 5:return hh(t),e===null&&Qa(t),n=t.type,r=t.pendingProps,s=e!==null?e.memoizedProps:null,o=r.children,La(n,r)?o=null:s!==null&&La(n,s)&&(t.effectTag|=16),Zp(e,t),t.mode&4&&i!==1&&r.hidden?(t.expirationTime=t.childExpirationTime=1,t=null):(Oe(e,t,o,i),t=t.child),t;case 6:return e===null&&Qa(t),null;case 13:return xh(e,t,i);case 4:return Wa(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=an(t,null,n,i):Oe(e,t,n,i),t.child;case 11:return n=t.type,r=t.pendingProps,r=t.elementType===n?r:qe(n,r),mh(e,t,n,r,i);case 7:return Oe(e,t,t.pendingProps,i),t.child;case 8:return Oe(e,t,t.pendingProps.children,i),t.child;case 12:return Oe(e,t,t.pendingProps.children,i),t.child;case 10:e:{n=t.type._context,r=t.pendingProps,o=t.memoizedProps,s=r.value;var a=t.type._context;if(ue(Bs,a._currentValue),a._currentValue=s,o!==null)if(a=o.value,s=Mi(a,s)?0:(typeof n._calculateChangedBits=="function"?n._calculateChangedBits(a,s):1073741823)|0,s===0){if(o.children===r.children&&!De.current){t=bt(e,t,i);break e}}else for(a=t.child,a!==null&&(a.return=t);a!==null;){var l=a.dependencies;if(l!==null){o=a.child;for(var u=l.firstContext;u!==null;){if(u.context===n&&(u.observedBits&s)!==0){a.tag===1&&(u=Ht(i,null),u.tag=2,Ft(a,u)),a.expirationTime<i&&(a.expirationTime=i),u=a.alternate,u!==null&&u.expirationTime<i&&(u.expirationTime=i),Lp(a.return,i),l.expirationTime<i&&(l.expirationTime=i);break}u=u.next}}else o=a.tag===10&&a.type===t.type?null:a.child;if(o!==null)o.return=a;else for(o=a;o!==null;){if(o===t){o=null;break}if(a=o.sibling,a!==null){a.return=o.return,o=a;break}o=o.return}a=o}Oe(e,t,r.children,i),t=t.child}return t;case 9:return r=t.type,s=t.pendingProps,n=s.children,Ji(t,i),r=Ge(r,s.unstable_observedBits),n=n(r),t.effectTag|=1,Oe(e,t,n,i),t.child;case 14:return r=t.type,s=qe(r,t.pendingProps),s=qe(r.type,s),vh(e,t,r,s,n,i);case 15:return Qp(e,t,t.type,t.pendingProps,n,i);case 17:return n=t.type,r=t.pendingProps,r=t.elementType===n?r:qe(n,r),e!==null&&(e.alternate=null,t.alternate=null,t.effectTag|=2),t.tag=1,Le(n)?(e=!0,ds(t)):e=!1,Ji(t,i),jp(t,n,r),$a(t,n,r,i),Ya(null,t,n,!0,e,i);case 19:return Mh(e,t,i)}throw Error(I(156,t.tag))};var nl=null,rl=null;function CS(e){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__=="undefined")return!1;var t=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t.isDisabled||!t.supportsFiber)return!0;try{var i=t.inject(e);nl=function(n){try{t.onCommitFiberRoot(i,n,void 0,(n.current.effectTag&64)===64)}catch{}},rl=function(n){try{t.onCommitFiberUnmount(i,n)}catch{}}}catch{}return!0}function bS(e,t,i,n){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.effectTag=0,this.lastEffect=this.firstEffect=this.nextEffect=null,this.childExpirationTime=this.expirationTime=0,this.alternate=null}function dt(e,t,i,n){return new bS(e,t,i,n)}function Nu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function AS(e){if(typeof e=="function")return Nu(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Gl)return 11;if(e===Xl)return 14}return 2}function Ci(e,t){var i=e.alternate;return i===null?(i=dt(e.tag,t,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=t,i.effectTag=0,i.nextEffect=null,i.firstEffect=null,i.lastEffect=null),i.childExpirationTime=e.childExpirationTime,i.expirationTime=e.expirationTime,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,t=e.dependencies,i.dependencies=t===null?null:{expirationTime:t.expirationTime,firstContext:t.firstContext,responders:t.responders},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i}function ws(e,t,i,n,r,s){var o=2;if(n=e,typeof e=="function")Nu(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case oi:return _t(i.children,r,s,t);case Jx:o=8,r|=7;break;case zf:o=8,r|=1;break;case ss:return e=dt(12,i,t,r|8),e.elementType=ss,e.type=ss,e.expirationTime=s,e;case os:return e=dt(13,i,t,r),e.type=os,e.elementType=os,e.expirationTime=s,e;case xa:return e=dt(19,i,t,r),e.elementType=xa,e.expirationTime=s,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Df:o=10;break e;case Lf:o=9;break e;case Gl:o=11;break e;case Xl:o=14;break e;case Rf:o=16,n=null;break e;case jf:o=22;break e}throw Error(I(130,e==null?e:typeof e,""))}return t=dt(o,i,t,r),t.elementType=e,t.type=n,t.expirationTime=s,t}function _t(e,t,i,n){return e=dt(7,e,n,t),e.expirationTime=i,e}function Qo(e,t,i){return e=dt(6,e,null,t),e.expirationTime=i,e}function Zo(e,t,i){return t=dt(4,e.children!==null?e.children:[],e.key,t),t.expirationTime=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function TS(e,t,i){this.tag=t,this.current=null,this.containerInfo=e,this.pingCache=this.pendingChildren=null,this.finishedExpirationTime=0,this.finishedWork=null,this.timeoutHandle=-1,this.pendingContext=this.context=null,this.hydrate=i,this.callbackNode=null,this.callbackPriority=90,this.lastExpiredTime=this.lastPingedTime=this.nextKnownPendingLevel=this.lastSuspendedTime=this.firstSuspendedTime=this.firstPendingTime=0}function gg(e,t){var i=e.firstSuspendedTime;return e=e.lastSuspendedTime,i!==0&&i>=t&&e<=t}function hi(e,t){var i=e.firstSuspendedTime,n=e.lastSuspendedTime;i<t&&(e.firstSuspendedTime=t),(n>t||i===0)&&(e.lastSuspendedTime=t),t<=e.lastPingedTime&&(e.lastPingedTime=0),t<=e.lastExpiredTime&&(e.lastExpiredTime=0)}function mg(e,t){t>e.firstPendingTime&&(e.firstPendingTime=t);var i=e.firstSuspendedTime;i!==0&&(t>=i?e.firstSuspendedTime=e.lastSuspendedTime=e.nextKnownPendingLevel=0:t>=e.lastSuspendedTime&&(e.lastSuspendedTime=t+1),t>e.nextKnownPendingLevel&&(e.nextKnownPendingLevel=t))}function sl(e,t){var i=e.lastExpiredTime;(i===0||i>t)&&(e.lastExpiredTime=t)}function Ys(e,t,i,n){var r=t.current,s=pt(),o=Qn.suspense;s=vi(s,r,o);e:if(i){i=i._reactInternalFiber;t:{if(Ei(i)!==i||i.tag!==1)throw Error(I(170));var a=i;do{switch(a.tag){case 3:a=a.stateNode.context;break t;case 1:if(Le(a.type)){a=a.stateNode.__reactInternalMemoizedMergedChildContext;break t}}a=a.return}while(a!==null);throw Error(I(171))}if(i.tag===1){var l=i.type;if(Le(l)){i=bp(i,l,a);break e}}i=a}else i=Gt;return t.context===null?t.context=i:t.pendingContext=i,t=Ht(s,o),t.payload={element:e},n=n===void 0?null:n,n!==null&&(t.callback=n),Ft(r,t),Zt(r,s),s}function Yo(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function Nh(e,t){e=e.memoizedState,e!==null&&e.dehydrated!==null&&e.retryTime<t&&(e.retryTime=t)}function ku(e,t){Nh(e,t),(e=e.alternate)&&Nh(e,t)}function Pu(e,t,i){i=i!=null&&i.hydrate===!0;var n=new TS(e,t,i),r=dt(3,null,null,t===2?7:t===1?3:0);n.current=r,r.stateNode=n,gu(r),e[br]=n.current,i&&t!==0&&r0(e,e.nodeType===9?e:e.ownerDocument),this._internalRoot=n}Pu.prototype.render=function(e){Ys(e,this._internalRoot,null,null)};Pu.prototype.unmount=function(){var e=this._internalRoot,t=e.containerInfo;Ys(null,e,null,function(){t[br]=null})};function Pr(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function ES(e,t){if(t||(t=e?e.nodeType===9?e.documentElement:e.firstChild:null,t=!(!t||t.nodeType!==1||!t.hasAttribute("data-reactroot"))),!t)for(var i;i=e.lastChild;)e.removeChild(i);return new Pu(e,0,t?{hydrate:!0}:void 0)}function wo(e,t,i,n,r){var s=i._reactRootContainer;if(s){var o=s._internalRoot;if(typeof r=="function"){var a=r;r=function(){var u=Yo(o);a.call(u)}}Ys(t,o,e,r)}else{if(s=i._reactRootContainer=ES(i,n),o=s._internalRoot,typeof r=="function"){var l=r;r=function(){var u=Yo(o);l.call(u)}}lg(function(){Ys(t,o,e,r)})}return Yo(o)}function NS(e,t,i){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:_i,key:n==null?null:""+n,children:e,containerInfo:t,implementation:i}}ip=function(e){if(e.tag===13){var t=ps(pt(),150,100);Zt(e,t),ku(e,t)}};tu=function(e){e.tag===13&&(Zt(e,3),ku(e,3))};np=function(e){if(e.tag===13){var t=pt();t=vi(t,e,null),Zt(e,t),ku(e,t)}};ya=function(e,t,i){switch(t){case"input":if(Ma(e,i),t=i.name,i.type==="radio"&&t!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<i.length;t++){var n=i[t];if(n!==e&&n.form===e.form){var r=lu(n);if(!r)throw Error(I(90));Vf(n),Ma(n,r)}}}break;case"textarea":Uf(e,i);break;case"select":t=i.value,t!=null&&Gi(e,!!i.multiple,t,!1)}};Wl=ag;kf=function(e,t,i,n,r){var s=U;U|=4;try{return Xt(98,e.bind(null,t,i,n,r))}finally{U=s,U===me&&mt()}};Hl=function(){(U&(1|it|gt))===me&&(mS(),fn())};Pf=function(e,t){var i=U;U|=2;try{return e(t)}finally{U=i,U===me&&mt()}};function vg(e,t){var i=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Pr(t))throw Error(I(200));return NS(e,t,null,i)}var kS={Events:[Tr,Si,lu,Tf,wa,sn,function(e){ql(e,v0)},Ef,Nf,lo,ao,fn,{current:!1}]};(function(e){var t=e.findFiberByHostInstance;return CS(Ee({},e,{overrideHookState:null,overrideProps:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:tt.ReactCurrentDispatcher,findHostInstanceByFiber:function(i){return i=Jf(i),i===null?null:i.stateNode},findFiberByHostInstance:function(i){return t?t(i):null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null}))})({findFiberByHostInstance:Ar,bundleType:0,version:"16.14.0",rendererPackageName:"react-dom"});Xe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=kS;Xe.createPortal=vg;Xe.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternalFiber;if(t===void 0)throw typeof e.render=="function"?Error(I(188)):Error(I(268,Object.keys(e)));return e=Jf(t),e=e===null?null:e.stateNode,e};Xe.flushSync=function(e,t){if((U&(it|gt))!==me)throw Error(I(187));var i=U;U|=1;try{return Xt(99,e.bind(null,t))}finally{U=i,mt()}};Xe.hydrate=function(e,t,i){if(!Pr(t))throw Error(I(200));return wo(null,e,t,!0,i)};Xe.render=function(e,t,i){if(!Pr(t))throw Error(I(200));return wo(null,e,t,!1,i)};Xe.unmountComponentAtNode=function(e){if(!Pr(e))throw Error(I(40));return e._reactRootContainer?(lg(function(){wo(null,null,e,!1,function(){e._reactRootContainer=null,e[br]=null})}),!0):!1};Xe.unstable_batchedUpdates=ag;Xe.unstable_createPortal=function(e,t){return vg(e,t,2<arguments.length&&arguments[2]!==void 0?arguments[2]:null)};Xe.unstable_renderSubtreeIntoContainer=function(e,t,i,n){if(!Pr(i))throw Error(I(200));if(e==null||e._reactInternalFiber===void 0)throw Error(I(38));return wo(e,t,i,!1,n)};Xe.version="16.14.0";function wg(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__=="undefined"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(wg)}catch(e){console.error(e)}}wg(),Sf.exports=Xe;var Kr=Sf.exports,PS=Object.defineProperty,BS=Object.defineProperties,zS=Object.getOwnPropertyDescriptors,kh=Object.getOwnPropertySymbols,DS=Object.prototype.hasOwnProperty,LS=Object.prototype.propertyIsEnumerable,Ph=(e,t,i)=>t in e?PS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,$e=(e,t)=>{for(var i in t||(t={}))DS.call(t,i)&&Ph(e,i,t[i]);if(kh)for(var i of kh(t))LS.call(t,i)&&Ph(e,i,t[i]);return e};const yg={src:"",currentTime:0,hostTime:0,muted:!1,paused:!0,volume:1},xg={currentTimeMaxError:1,syncInterval:1e3,retryInterval:15e3,verbose:!1,log:console.log.bind(console)};let xt=xg;function Sg(e){xt=$e($e({},xg),e)}function qr(e,t){if(e.paused)return e.currentTime;const i=function(n){if(n.player)return n.player.beginTimestamp+n.player.progressTime;if(n.room)return n.room.calibrationTimestamp}(t);return i?e.currentTime+(i-e.hostTime)/1e3:e.currentTime}const RS=navigator.userAgent.includes("Safari"),jS=navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPad"),Mg=[".aac",".mid",".midi",".mp3",".ogg",".oga",".wav",".weba"];var _S=typeof global=="object"&&global&&global.Object===Object&&global,VS=typeof self=="object"&&self&&self.Object===Object&&self,Ig=_S||VS||Function("return this")(),Gs=Ig.Symbol,Cg=Object.prototype,OS=Cg.hasOwnProperty,US=Cg.toString,Tn=Gs?Gs.toStringTag:void 0,$S=Object.prototype.toString,Bh=Gs?Gs.toStringTag:void 0;function WS(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Bh&&Bh in Object(e)?function(t){var i=OS.call(t,Tn),n=t[Tn];try{t[Tn]=void 0;var r=!0}catch{}var s=US.call(t);return r&&(i?t[Tn]=n:delete t[Tn]),s}(e):function(t){return $S.call(t)}(e)}var HS=/\s/,FS=/^\s+/;function QS(e){return e&&e.slice(0,function(t){for(var i=t.length;i--&&HS.test(t.charAt(i)););return i}(e)+1).replace(FS,"")}function ol(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var ZS=/^[-+]0x[0-9a-f]+$/i,YS=/^0b[01]+$/i,GS=/^0o[0-7]+$/i,XS=parseInt;function zh(e){if(typeof e=="number")return e;if(function(n){return typeof n=="symbol"||function(r){return r!=null&&typeof r=="object"}(n)&&WS(n)=="[object Symbol]"}(e))return NaN;if(ol(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=ol(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=QS(e);var i=YS.test(e);return i||GS.test(e)?XS(e.slice(2),i?2:8):ZS.test(e)?NaN:+e}var Go=function(){return Ig.Date.now()},JS=Math.max,KS=Math.min;function es(e,t,i){var n,r,s,o,a,l,u=0,h=!1,c=!1,m=!0;if(typeof e!="function")throw new TypeError("Expected a function");function v(p){var y=n,S=r;return n=r=void 0,u=p,o=e.apply(S,y)}function w(p){return u=p,a=setTimeout(d,t),h?v(p):o}function x(p){var y=p-l;return l===void 0||y>=t||y<0||c&&p-u>=s}function d(){var p=Go();if(x(p))return f(p);a=setTimeout(d,function(y){var S=t-(y-l);return c?KS(S,s-(y-u)):S}(p))}function f(p){return a=void 0,m&&n?v(p):(n=r=void 0,o)}function g(){var p=Go(),y=x(p);if(n=arguments,r=this,l=p,y){if(a===void 0)return w(l);if(c)return clearTimeout(a),a=setTimeout(d,t),v(l)}return a===void 0&&(a=setTimeout(d,t)),o}return t=zh(t)||0,ol(i)&&(h=!!i.leading,s=(c="maxWait"in i)?JS(zh(i.maxWait)||0,t):s,m="trailing"in i?!!i.trailing:m),g.cancel=function(){a!==void 0&&clearTimeout(a),u=0,n=l=r=a=void 0},g.flush=function(){return a===void 0?o:f(Go())},g}class Dh extends Ti.exports.Component{constructor(t){super(t),this.seeking=!1,this.mobileSeeking=!1,this.track=null,this.hoverTime=null,this.offset=0,this.secondsPrefix="00:00:",this.minutesPrefix="00:",this.seekPause=!1,this.handleTouchSeeking=i=>{let n=0;for(let r=0;r<i.changedTouches.length;r++)n=i.changedTouches[r].pageX;n=n<0?0:n,this.mobileSeeking&&this.changeCurrentTimePosition(n)},this.handleSeeking=i=>{this.seeking&&this.changeCurrentTimePosition(i.pageX)},this.setTrackWidthState=()=>{this.track&&this.setState({trackWidth:this.track.offsetWidth})},this.handleTrackHover=(i,n)=>{if(this.track){const r=this.props.scale||1;let s;s=i?0:(n.pageX-this.track.getBoundingClientRect().left)/r,this.setState({seekHoverPosition:s,trackWidth:this.track.offsetWidth})}},this.mouseSeekingHandler=i=>{this.setSeeking(!1,i),this.onMouseUp()},this.setSeeking=(i,n)=>{n.preventDefault(),this.handleSeeking(n),this.seeking=i,this.setState({seekHoverPosition:i?this.state.seekHoverPosition:0})},this.mobileTouchSeekingHandler=()=>{this.setMobileSeeking(!1)},this.setMobileSeeking=i=>{this.mobileSeeking=i,this.setState({seekHoverPosition:i?this.state.seekHoverPosition:0})},this.renderBufferProgress=()=>{if(this.props.buffered){const i=$e($e({},this.getPositionStyle(this.props.buffered)),this.props.bufferColor&&{backgroundColor:this.props.bufferColor});return F.createElement("div",{className:"buffered",style:i})}return null},this.renderProgress=()=>{const i=$e($e({},this.getPositionStyle(this.props.current)),this.props.sliderColor&&{backgroundColor:this.props.sliderColor});return F.createElement("div",{className:"connect",style:i})},this.renderHoverProgress=()=>{const i=$e($e({},this.getSeekHoverPosition()),this.props.sliderHoverColor&&{backgroundColor:this.props.sliderHoverColor});return F.createElement("div",{className:"seek-hover",style:i})},this.renderThumb=()=>F.createElement("div",{className:this.isThumbActive()?"thumb active":"thumb",style:this.getThumbHandlerPosition()},F.createElement("div",{style:{backgroundColor:this.props.thumbColor},className:"handler"})),this.onMouseDown=i=>{var n,r;this.props.pause&&!this.props.paused&&(this.props.pause(),this.seekPause=!0),this.setSeeking(!0,i),(r=(n=this.props).onSeekStart)==null||r.call(n)},this.onMouseUp=()=>{var i,n;this.props.play&&this.seekPause&&(this.props.play(),this.seekPause=!1),(n=(i=this.props).onSeekEnd)==null||n.call(i)},this.props.secondsPrefix&&(this.secondsPrefix=this.props.secondsPrefix),this.props.minutesPrefix&&(this.minutesPrefix=this.props.minutesPrefix),this.state={ready:!1,trackWidth:0,seekHoverPosition:0}}componentDidMount(){this.setTrackWidthState(),window.addEventListener("resize",this.setTrackWidthState),window.addEventListener("mousemove",this.handleSeeking),window.addEventListener("mouseup",this.mouseSeekingHandler),window.addEventListener("touchmove",this.handleTouchSeeking),window.addEventListener("touchend",this.mobileTouchSeekingHandler)}componentWillUnmount(){window.removeEventListener("resize",this.setTrackWidthState),window.removeEventListener("mousemove",this.handleSeeking),window.removeEventListener("mouseup",this.mouseSeekingHandler),window.removeEventListener("touchmove",this.handleTouchSeeking),window.removeEventListener("touchend",this.mobileTouchSeekingHandler)}changeCurrentTimePosition(t){if(this.track){const i=this.props.scale||1;let n=(t-this.track.getBoundingClientRect().left)/i;n=Math.min(this.state.trackWidth,Math.max(0,n)),this.setState({seekHoverPosition:n});const r=+(n/this.state.trackWidth*this.props.total).toFixed(0);this.props.onChange(r)}}getPositionStyle(t){return{transform:`scaleX(${100*t/this.props.total/100})`}}getThumbHandlerPosition(){return{transform:`translateX(${this.state.trackWidth/(this.props.total/this.props.current)}px)`}}getSeekHoverPosition(){return{transform:`scaleX(${100*this.state.seekHoverPosition/this.state.trackWidth/100})`}}getHoverTimePosition(){let t=0;return this.hoverTime&&(t=this.state.seekHoverPosition-this.hoverTime.offsetWidth/2,this.props.limitTimeTooltipBySides&&(t<0?t=0:t+this.hoverTime.offsetWidth>this.state.trackWidth&&(t=this.state.trackWidth-this.hoverTime.offsetWidth))),{transform:`translateX(${t}px)`}}secondsToTime(t){t=Math.round(t+this.offset);const i=Math.floor(t/3600),n=t%3600,r=Math.floor(n/60),s=Math.ceil(n%60);return{hh:i.toString(),mm:r<10?"0"+r:r.toString(),ss:s<10?"0"+s:s.toString()}}getHoverTime(){const t=100*this.state.seekHoverPosition/this.state.trackWidth,i=Math.floor(+t*(this.props.total/100)),n=this.secondsToTime(i);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}isThumbActive(){return this.state.seekHoverPosition>0||this.seeking}drawHoverTime(){return this.props.hideHoverTime?null:F.createElement("div",{className:this.isThumbActive()?"hover-time active":"hover-time",style:this.getHoverTimePosition(),ref:t=>this.hoverTime=t},this.getHoverTime())}render(){return F.createElement("div",{className:"seek-slider"},F.createElement("div",{className:"track",ref:t=>this.track=t,onMouseMove:t=>this.handleTrackHover(!1,t),onMouseLeave:t=>this.handleTrackHover(!0,t),onMouseDown:this.onMouseDown,onTouchStart:t=>{this.setMobileSeeking(!0),this.onMouseDown(t)},onMouseUp:this.onMouseUp,onTouchEnd:this.onMouseUp},F.createElement("div",{className:"main"},this.renderBufferProgress(),this.renderHoverProgress(),this.renderProgress())),this.drawHoverTime(),this.renderThumb())}}class qS extends Ti.exports.Component{constructor(t){super(t),this.stageVolume=0,this.updateVolumeTimer=0,this.onVolumeSeeking=!1,this.onClickOperationButton=()=>{const{paused:i}=this.props;i?this.props.play():this.props.pause()},this.operationButton=()=>{const{paused:i}=this.props;return i?F.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNOCA1LjE0djE0bDExLTdsLTExLTd6IiBmaWxsPSIjZmZmIj48L3BhdGg+PC9zdmc+Cg=="}):F.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMTQgMTloNFY1aC00TTYgMTloNFY1SDZ2MTR6IiBmaWxsPSIjZmZmIj48L3BhdGg+PC9zdmc+Cg=="})},this.operationVolumeButton=()=>this.props.volume>.9?F.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMTQgMy4yM3YyLjA2YzIuODkuODYgNSAzLjU0IDUgNi43MXMtMi4xMSA1Ljg0LTUgNi43djIuMDdjNC0uOTEgNy00LjQ5IDctOC43N2MwLTQuMjgtMy03Ljg2LTctOC43N00xNi41IDEyYzAtMS43Ny0xLTMuMjktMi41LTQuMDNWMTZjMS41LS43MSAyLjUtMi4yNCAyLjUtNE0zIDl2Nmg0bDUgNVY0TDcgOUgzeiIgZmlsbD0iI2ZmZiI+PC9wYXRoPjwvc3ZnPgo="}):this.props.volume===0?F.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNNyA5djZoNGw1IDVWNGwtNSA1SDd6IiBmaWxsPSIjZmZmIj48L3BhdGg+PC9zdmc+Cg=="}):F.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNNSA5djZoNGw1IDVWNEw5IDltOS41IDNjMC0xLjc3LTEtMy4yOS0yLjUtNC4wM1YxNmMxLjUtLjcxIDIuNS0yLjI0IDIuNS00eiIgZmlsbD0iI2ZmZiI+PC9wYXRoPjwvc3ZnPgo="}),this.handleClickVolume=()=>{this.props.volume===0?this.stageVolume!==0?this.props.setVolume(this.stageVolume):this.props.setVolume(1):(this.stageVolume=this.props.volume,this.props.setVolume(0))},this.onChange=i=>{this.setState({currentTime:i}),i&&this.changeTime(i)},this.changeTime=es(i=>{this.props.setCurrentTime(i)},50),this.onVolumeChange=i=>{this.changeVolume(i),this.setState({seekVolume:i/100})},this.changeVolume=es(i=>{this.props.setVolume(i/100)},50),this.onVolumeSeekStart=()=>{this.onVolumeSeeking=!0},this.onVolumeSeekEnd=es(()=>{this.onVolumeSeeking=!1},500),this.onProgressSeekStart=()=>this.setState({isPlayerSeeking:!0}),this.onProgressSeekEnd=es(()=>{this.setState({isPlayerSeeking:!1})},500),this.state={isPlayerSeeking:!1,isVolumeHover:!1,seekVolume:1,visible:!0,currentTime:0},this.stageVolume=t.volume}componentDidMount(){this.updateVolumeTimer=setInterval(()=>{this.onVolumeSeeking||this.setState({seekVolume:this.props.volume}),this.state.isPlayerSeeking||this.setState({currentTime:this.props.currentTime})},100)}componentWillUnmount(){this.updateVolumeTimer&&clearInterval(this.updateVolumeTimer)}render(){const{duration:t,currentTime:i}=this.props;return F.createElement("div",{className:"player-controller",style:{opacity:this.props.visible?"1":"0"}},F.createElement("div",{className:"player-controller-progress"},F.createElement(Dh,{total:t,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})),F.createElement("div",{className:"player-controller-actions"},F.createElement("div",{className:"player-controller-actions-left"},F.createElement("div",{onClick:this.onClickOperationButton,className:"player-controller-play"},this.operationButton()),F.createElement("div",{className:"player-volume-box",onMouseEnter:()=>this.setState({isVolumeHover:!0}),onMouseLeave:()=>this.setState({isVolumeHover:!1})},F.createElement("div",{onClick:this.handleClickVolume,className:"player-volume"},this.operationVolumeButton()),F.createElement("div",{className:"player-volume-slider"},F.createElement(Dh,{total:100,current:100*this.state.seekVolume,onChange:this.onVolumeChange,onSeekStart:this.onVolumeSeekStart,onSeekEnd:this.onVolumeSeekEnd,scale:this.props.scale,limitTimeTooltipBySides:!0,hideHoverTime:!0})))),F.createElement("div",{className:"player-mid-box-time"},Lh(Math.floor(i/1e3))," /"," ",Lh(Math.floor(t/1e3)))))}}function Lh(e){const t=e%60,i=(e-t)/60;if(i>=60){const n=i%60;return`${En((i-n)/60)}:${En(n)}:${En(t)}`}return`${En(i)}:${En(t)}`}function En(e){return e<=9?`0${e}`:`${e}`}let eM=99999;var al,zi;(zi=al||(al={}))[zi.Idle=0]="Idle",zi[zi.Playing=1]="Playing",zi[zi.Paused=2]="Paused";let Ce={};function pe(e,...t){xt.verbose&&console.log(`[RTCEffect] ${e}`,...t)}function tM(e,t,i){function n(s){Ce[s].playState===0?(e.playEffect(s,i,0,1,0,100,!1,0).then(()=>{pe(">>> Play Success",{playingId:s})}),Ce[s].playState=1):pe(">>> Skip Play",{playingId:s,state:Ce[s].playState})}function r(s){Ce[s].playState=0,Ce[s].previousVideoJSAdvance=0,Ce[s].previousSeekTargetTime=0,Ce[s].previousBeginSeekTime=0}t.one("ready",()=>{var s;const o=((s=t==null?void 0:t.tagAttributes)==null?void 0:s.src)||"";Mg.includes("."+o.split(".").pop()||"")||(pe(">>> Mute js player",{src:o}),t.muted(!0),t.muted=l=>!1);const a=function(){const l=eM--,u={playState:al.Idle,previousVideoJSAdvance:0,previousSeekTargetTime:0,previousBeginSeekTime:0};return Ce[l]=u,l}();pe(">>> Setup",{playingId:a,src:o}),e.addListener("error",l=>{pe(">>> Error",{soundId:l}),r(l)}),e.addListener("effectFinished",l=>{pe(">>> Finished",{soundId:l}),r(l)}),t.on("play",()=>{switch(Ce[a].playState){case 0:pe(">>> Start play",{playingId:a}),n(a);break;case 2:pe(">>> Resume play",{playingId:a}),e.resumeEffect(a),Ce[a].playState=1}}),t.on("pause",()=>{const l=Ce[a].playState;switch(l){case 1:pe(">>> Pause play",{playingId:a}),e.pauseEffect(a),Ce[a].playState=2;break;default:pe(">>> Skip Pause",{playingId:a,currenState:l})}}),t.on("timeupdate",()=>{e.getEffectCurrentPosition(a).then(l=>{const u=Ce[a],h=l/1e3,c=t.currentTime(),m=u.previousSeekTargetTime!==0&&u.previousBeginSeekTime!==0;if(pe(`>>> EffectSecond rtc: ${h} js: ${c} seeking: ${m}`,{playingId:a}),u.playState==0)return void(t.paused()||(pe(">>> Play effect due to time update.",{playingId:a}),n(a)));if(m&&h<u.previousSeekTargetTime)return;if(u.playState!==1)return void pe(">>> Skip timupdate",{playingId:a,state:u.playState,jsTime:t.currentTime(),rtcEffectTime:h});function v(x,d){e.setEffectPosition(d,1e3*x),u.previousBeginSeekTime=Date.now()/1e3,u.previousSeekTargetTime=x}const w=u.previousBeginSeekTime;if(l>0){const x=c-h,d=Math.abs(x),f=.5;if(d>f)if(m){const g=u.previousSeekTargetTime-h,p=Date.now()/1e3-w,y=p+(x>0?x:0),S=c+y;v(S,a),pe(">>> Start seeking after seeking lag",{jsPlayerTime:c,rtcEffectTime:h,jsPlayerTimerAdvance:x,lastSeekingCost:p,estimatedRTCLag:y,targetRTCSeekTime:S,previousBeginSeekTime:w,timeElapse:g})}else if(d>10)v(c,a),pe(">>> DirectSeek",{time:c,rtcEffectTime:h,jsPlayerTimerAdvance:x});else{const g=u.previousVideoJSAdvance,p=0,y=c+p;u.previousVideoJSAdvance=p,v(y,a),pe(">>> Start seeking with lag",{jsPlayerTime:c,rtcEffectTime:h,jsPlayerTimerAdvance:x,previousAdvance:g,estimatedRTCLag:p,targetRTCSeekTime:y})}else m&&(pe(">>> SeekingFinish no lag",{jsPlayerTime:c,rtcEffectTime:h,jsPlayerTimerAdvance:x,previousBeginSeekTime:w,rtcLagTolerance:f}),u.previousBeginSeekTime=0,u.previousSeekTargetTime=0)}})}),t.on("dispose",()=>{Ce[a].playState&&(e.stopEffect(a),delete Ce[a],pe(">>> Dispose",{playingId:a}))})})}class Rh extends Ti.exports.Component{constructor(){super(...arguments),this.putAttributes=t=>{const{context:i}=this.props,n=i.getAttributes()||{};for(const r in t)n[r]!==t[r]&&i.updateAttributes([r],t[r])}}render(){const{context:t}=this.props,i=t.getRoom(),n=i?void 0:t.getDisplayer(),r=this.putAttributes;return F.createElement(iM,{room:i,player:n,context:t,plugin:{putAttributes:r}})}}class iM extends Ti.exports.Component{constructor(t){super(t),this.alertMask=null,this.container=F.createRef(),this.controllerHiddenTimer=0,this.syncPlayerTimer=0,this.retryCount=0,this.decreaseRetryTimer=0,this.noSoundSyncCount=0,this.everPlayed=!1,this.showController=()=>{this.setState({controllerVisible:!0}),this.debounceHidingController()},this.play=()=>{var i;const n=(i=this.props.room)==null?void 0:i.calibrationTimestamp;this.debug(">>> play",{paused:!1,hostTime:n}),this.isEnabled()&&this.props.plugin.putAttributes({paused:!1,hostTime:n})},this.pause=()=>{const i=qr(this.getAttributes(),this.props);this.debug(">>> pause",{paused:!0,currentTime:i}),this.isEnabled()&&this.props.plugin.putAttributes({paused:!0,currentTime:i})},this.setVolume=i=>{this.debug(">>> volume",{volume:i}),this.isEnabled()&&this.props.plugin.putAttributes({volume:i}),this.isEnabled()&&this.props.plugin.putAttributes({volume:i,muted:i===0})},this.setCurrentTime=i=>{var n;const r=(n=this.props.room)==null?void 0:n.calibrationTimestamp;this.debug(">>> seek",{currentTime:i/1e3,hostTime:r}),this.isEnabled()&&this.props.plugin.putAttributes({currentTime:i/1e3,hostTime:r})},this.resetPlayer=()=>{var i;(i=this.player)==null||i.autoplay(!1),this.state.NoSound||(this.debug(">>> ended",{paused:!0,currentTime:0}),this.isEnabled()&&this.props.plugin.putAttributes({paused:!0,currentTime:0}))},this.syncPlayerWithAttributes=()=>{var i;const n=this.getAttributes();if(!n)return;const r=this.player;if(!r||this.state.NoSound&&(this.noSoundSyncCount+=1)%8!=0)return;r.paused()!==n.paused&&(this.debug("<<< paused -> %o",n.paused),n.paused?r.pause():((i=r.play())==null||i.catch(this.catchPlayFail),this.everPlayed=!0)),r.muted()!==n.muted&&(this.debug("<<< muted -> %o",n.muted),r.muted(n.muted)),r.volume()!==n.volume&&(this.debug("<<< volume -> %o",n.volume),r.volume(n.volume));const s=qr(n,this.props);let o=xt.currentTimeMaxError;if(this.state.NoSound&&(o*=3),s>r.duration())this.resetPlayer();else if(Math.abs(r.currentTime()-s)>o){if(this.debug("<<< currentTime -> %o",s),jS)return void(this.everPlayed?r.currentTime(s):this.debug("<<< ignore iOS idle time update. -> %o (ignored)",s));r.currentTime(s)}},this.debounceHidingController=()=>{this.controllerHiddenTimer&&(clearTimeout(this.controllerHiddenTimer),this.controllerHiddenTimer=0),this.controllerHiddenTimer=setTimeout(()=>{this.setState({controllerVisible:!1}),this.controllerHiddenTimer=0},3e3)},this.decreaseRetryCount=()=>{this.player&&this.retryCount>0&&(this.retryCount=this.retryCount-1)},this.catchPlayFail=i=>{var n,r;const s=String(i);if(RS&&s.includes("NotAllowedError")||s.includes("interact"))(n=this.player)==null||n.autoplay("any"),this.setState({NoSound:!0});else{const o=(r=this.player)==null?void 0:r.error();o&&(this.retryCount<=3?(this.initPlayer(),this.retryCount=this.retryCount+1):(this.debug("catch videojs media error",o),this.setState({MediaError:!0}))),this.debug("catch error",i)}},this.fixPlayFail=()=>{this.debug("try to fix play state"),this.setState({NoSound:!1});const{muted:i,volume:n}=this.getAttributes();this.player&&(this.player.muted(i),this.player.volume(n))},this.initPlayer=async()=>{var i;(i=this.player)==null||i.dispose(),this.player=void 0,this.debug("creating elements ...");const{type:n,src:r,poster:s}=this.getAttributes(),o=document.createElement("div");o.setAttribute("data-vjs-player","");const a=document.createElement("video");a.className="video-js",a.crossOrigin="anonymous",s&&(a.poster=s),a.setAttribute("playsInline",""),a.setAttribute("webkit-playsinline","");const l=document.createElement("source");new URL(r).pathname.endsWith(".m3u8")?l.type="application/x-mpegURL":a.src=r,l.src=r,n&&(l.type=n),a.appendChild(l),o.appendChild(a),this.container.current.appendChild(o),await new Promise(m=>(window.requestAnimationFrame||window.setTimeout)(m)),this.debug("initializing videojs() ...");const u=ju.default(a);this.player=u,window.player=u,u.one("loadedmetadata",this.gracefullyUpdate);const h=window.__mediaPlayerAudioEffectClient;h!==void 0&&tM(h,u,r);const c=window.__pcmProxy;c!==void 0&&(u.one("play",()=>{const m=c.connect(a);this.audioSource=m,this.debug("Connect to PCMProxy ",r)}),u.one("dispose",()=>{this.audioSource&&(this.audioSource.disconnect(),this.audioSource=void 0,this.debug("Disconnect from PCMProxy",r))})),u.on("ready",()=>{var m;(m=xt.onPlayer)==null||m.call(xt,u),u.on("timeupdate",this.gracefullyUpdate),u.on("volumechange",this.gracefullyUpdate),u.on("seeked",this.gracefullyUpdate),u.on("play",this.gracefullyUpdate),u.on("pause",this.gracefullyUpdate),u.on("ended",this.resetPlayer)}),u.on("error",this.catchPlayFail),this.setState({MediaError:!1})},this.gracefullyUpdate=()=>this.setState({updater:!this.state.updater}),this.setupAlert=i=>{i&&(i.addEventListener("touchstart",this.fixPlayFail),i.addEventListener("click",this.fixPlayFail)),this.alertMask=i},this.setupReload=i=>{i&&(i.addEventListener("touchstart",this.initPlayer),i.addEventListener("click",this.initPlayer))},this.state={NoSound:!1,MediaError:!1,updater:!1,controllerVisible:!1},t.room&&function(i){if(!i.calibrationTimestamp)throw new Error("@netless/app-media-player@0.1.0-alpha.5 requires white-web-sdk@^2.13.8 to work properly.")}(t.room)}getAttributes(){const{context:t}=this.props;let i=t.getAttributes();if(i){if(i=$e($e({},yg),i),this.player){let r=qr(i,this.props),s=this.player.duration();!i.paused&&r>s&&(n=$e({},i),i=BS(n,zS({currentTime:0,paused:!0})),this.resetPlayer())}var n;return i}}isShowingPoster(){const t=this.getAttributes();return!(t!=null&&t.src)||Mg.some(i=>t.src.endsWith(i))}render(){var t,i;if(!this.props.room&&!this.props.player)return null;const n=this.getAttributes();if(!n)return null;const r=1e3*(((t=this.player)==null?void 0:t.duration())||1e3),s=((i=this.player)==null?void 0:i.bufferedPercent())||0;return F.createElement("div",{className:this.isEnabled()?"vjs-p":"vjs-p disabled",onMouseEnter:this.showController,onMouseMove:this.showController},F.createElement("div",{className:"video-js-plugin-player",ref:this.container}),this.isShowingPoster()&&F.createElement("div",{className:"video-js-plugin-poster"},n.poster&&F.createElement("img",{src:n.poster,alt:"",draggable:!1})),F.createElement(qS,{duration:r,volume:n.volume,setVolume:this.setVolume,paused:n.paused,play:this.play,pause:this.pause,currentTime:1e3*qr(n,this.props),setCurrentTime:this.setCurrentTime,buffered:r*s,visible:!0}),this.state.NoSound&&F.createElement("div",{ref:this.setupAlert,className:"videojs-plugin-muted-alert"}),this.state.MediaError&&F.createElement("div",{className:"videojs-plugin-recovery-mode"},F.createElement("button",{ref:this.setupReload},"Reload Player")))}debug(t,...i){xt.verbose&&xt.log(`[MediaPlayer] ${t}`,...i)}componentDidMount(){this.debug("app version =","0.1.0-alpha.5"),this.debug("video.js version =",ju.default.VERSION),this.initPlayer(),this.props.context.emitter.on("attributesUpdate",this.syncPlayerWithAttributes),this.syncPlayerTimer=setInterval(this.syncPlayerWithAttributes,xt.syncInterval),this.decreaseRetryTimer=setInterval(this.decreaseRetryCount,xt.retryInterval)}componentWillUnmount(){var t;this.debug("unmount"),this.props.context.emitter.off("attributesUpdate",this.syncPlayerWithAttributes),(t=this.player)==null||t.dispose(),clearInterval(this.syncPlayerTimer),clearInterval(this.decreaseRetryTimer)}isEnabled(){return this.props.context.getIsWritable()}}const ll={kind:"MediaPlayer",setup(e){let t=e.getAttributes();if(!t||!t.src)return e.emitter.emit("destroy",{error:new Error("[MediaPlayer]: Missing 'attributes'.'src'.")});t=$e($e({},yg),t);const i=e.getBox();i.mountStyles(`.vjs-p{display:flex;flex-grow:1}.vjs-p *{pointer-events:auto}.vjs-p.disabled *{pointer-events:none}.vjs-p .video-js-plugin-poster{position:absolute;top:0;left:0;right:0;bottom:0;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgQAAACACAYAAAB0vHFxAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAACBKADAAQAAAABAAAAgAAAAACE3oPTAAAKXUlEQVR4Ae3dYW4ktxEG0LW9Fw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SlDIJECBAgMBIAQeCkbrGJkCAAAECRQQcCIoEpUwCBAgQIDBSwG8ZjNQ19nABnzIeTjx0AvkN5R0+ePb8stc3PKAnJ9AheBLM7QQIECBAYEUBHYIVU91oTf49+9phy09+IwXsr+d0dQie83I3AQIECBBYUkCHYMlY8yxq9DO80ePnkYypZLTv6PFj1PaZNXt+2evLtlN0CLIloh4CBAgQIBAg4EAQgG5KAgQIECCQTcCBIFsi6iFAgAABAgEC/wdVfx9UuC8B6AAAAABJRU5ErkJggg==);background-repeat:repeat-x;background-position:0 50%;display:flex;align-items:center;justify-content:center}.vjs-p .video-js-plugin-poster img{box-shadow:0 0 5px 10px #0006}.vjs-p .player-controller,.vjs-p .videojs-plugin-muted-alert{pointer-events:auto}.vjs-p.disabled .videojs-plugin-close-icon,.vjs-p.disabled .player-controller{pointer-events:none}.vjs-p .video-js-plugin-player{position:absolute;top:0;left:0;right:0;bottom:0}.video-js,[data-vjs-player]{width:100%;height:100%}.vjs-p .videojs-plugin-muted-alert{pointer-events:auto;cursor:pointer;position:absolute;top:0;left:0;right:0;bottom:0;z-index:43}.vjs-p .videojs-plugin-muted-alert:before{pointer-events:auto;cursor:pointer;position:absolute;top:0;left:0;right:0;bottom:0;z-index:43;content:"\\f104";background:rgba(0,0,0,.3);font-family:VideoJS;font-size:2em;display:flex;align-items:center;justify-content:center;color:#fff}.vjs-p .videojs-plugin-recovery-mode{pointer-events:auto;cursor:pointer;position:absolute;top:0;left:0;right:0;bottom:0;z-index:44}.vjs-p .videojs-plugin-recovery-mode button{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.vjs-p .seek-slider{position:relative;width:100%}.vjs-p .seek-slider:focus{outline:none}.vjs-p .seek-slider .track{padding:10px 0;cursor:pointer;outline:none}.vjs-p .seek-slider .track:focus{border:0;outline:none}.vjs-p .seek-slider .track .main{width:100%;height:3px;background-color:#ffffff4d;border-radius:30px;position:absolute;left:0;top:8.5px;transition:transform .4s;outline:none}.vjs-p .seek-slider .track .main:focus{border:0;outline:none}.vjs-p .seek-slider .track .main .buffered{position:absolute;background-color:#ffffff4d;width:100%;height:100%;transform:scaleX(.8);z-index:2;transform-origin:0 0}.vjs-p .seek-slider .track .main .seek-hover{position:absolute;background-color:#ffffff80;width:100%;height:100%;z-index:1;transform:scaleX(.6);transform-origin:0 0;opacity:0;transition:opacity .4s}.vjs-p .seek-slider .track .main .connect{position:absolute;background-color:#fff;width:100%;height:100%;z-index:3;left:0;transform:scaleX(.13);transform-origin:0 0}.vjs-p .seek-slider .track.active .main{transform:scaleY(2)}.vjs-p .seek-slider .thumb{pointer-events:none;position:absolute;width:12px;height:12px;left:-6px;top:4px;z-index:4;transform:translate(100px)}.vjs-p .seek-slider .thumb .handler{border-radius:100%;width:100%;height:100%;background-color:#fff;opacity:0;transform:scale(.4);cursor:pointer;transition:transform .2s;pointer-events:none}.vjs-p .seek-slider .thumb.active .handler{opacity:1;transform:scale(1)}.vjs-p .seek-slider .hover-time{position:absolute;background-color:#0000004d;line-height:18px;font-size:16px;color:#ddd;top:-25px;left:0;padding:5px 10px;border-radius:5px;box-shadow:0 0 5px #0000004d;opacity:0;transform:translate(150px);pointer-events:none}.vjs-p .seek-slider .hover-time.active{opacity:1}.vjs-p .seek-slider:hover .track .main .seek-hover{opacity:1}.vjs-p .player-controller{position:absolute;z-index:100;bottom:0px;left:0;width:100%;display:flex;flex-direction:column;justify-content:center;align-items:stretch;height:64px;background-image:linear-gradient(0deg,#000,transparent);transition:opacity .2s;color:#fff}.vjs-p .player-menu-box{display:flex;align-items:center;justify-content:center;flex-direction:column;margin-bottom:40px}.vjs-p .player-menu-cell{width:100%;text-align:center;font-size:12px;color:#7a7b7c}.vjs-p .player-multiple-play{width:64px;height:120px}.vjs-p .player-controller-actions-left{display:flex;justify-content:center;align-items:center;flex-shrink:0}.vjs-p .player-right-box{font-size:14px;color:#7a7b7c;cursor:pointer;margin-right:12px}.vjs-p .player-controller-actions{display:flex;flex-direction:row;justify-content:space-between;align-items:center;padding-left:8px;padding-right:8px;margin-top:2px}.vjs-p .player-mid-box-time{font-size:9px;display:flex;justify-content:center;align-items:center;color:#fff;flex-shrink:0;margin-right:8px;font-family:monospace}.vjs-p .player-controller-play{display:flex;align-items:center;justify-content:center;cursor:pointer;padding-right:4px}.vjs-p .player-controller-progress{width:calc(100% - 28px);margin-left:14px;display:flex;align-items:center;justify-content:center;margin-top:8px}.vjs-p .player-volume{display:flex;align-items:center;justify-content:center;cursor:pointer;margin-right:16px;margin-left:8px}.vjs-p .player-volume-slider{width:60px;margin-right:12px;display:flex;align-items:center}.vjs-p .player-volume-box{display:flex;flex-direction:row}.netless-app-media-player-container{display:flex;position:relative;height:100%}
47
- `);const n=document.createElement("div");if(n.classList.add("netless-app-media-player-container"),Kr.render(F.createElement(Rh,{context:e}),n),i.mountContent(n),e.emitter.on("destroy",()=>{console.log("[MediaPlayer]: destroy"),Kr.unmountComponentAtNode(n)}),window.__pcmProxy){const r=()=>{document.visibilityState==="hidden"?(console.log("[MediaPlayer]: visibilitychange -> hidden. unmount for pcmproxy"),Kr.unmountComponentAtNode(n)):(console.log("[MediaPlayer]: visibilitychange -> visible. mount for pcmproxy"),Kr.render(F.createElement(Rh,{context:e}),n))};document.addEventListener("visibilitychange",r),e.emitter.on("destroy",()=>{document.removeEventListener("visibilitychange",r)})}}},nM=()=>{Q.debug&&Sg({verbose:!0}),Q.register({kind:fa.kind,src:fa}),Q.register({kind:ll.kind,src:ll})},rM={DocsViewer:fa.kind,MediaPlayer:ll.kind};const Bt={Ready:"Ready",RootRect:"ReplayRootRect",Message:"message",ComputeStyle:"computeStyle",Load:"load",DisplayerState:"displayerState",Show:"show",Hide:"hide"},sM=(e,t)=>new Array(e).fill(0).map((i,n)=>t(n)),K=class{constructor(e,t){this.manager=e,this.appManager=t,this.magixEventMap=new Map,this.cssList=[],this.allowAppliances=["clicker"],this.bridgeDisposer=E.noop,this.rootRect=null,this.sideEffectManager=new cr,this.execListenIframe=E.debounce(i=>{this.listenIframe(i)},50),this.onPhaseChangedListener=i=>{i===b.PlayerPhase.Playing&&this.computedStyleAndIframeDisplay()},this.stateChangeListener=i=>{i={...i},i.cameraState=this.manager.cameraState,this.postMessage({kind:"RoomStateChanged",payload:i}),i.cameraState&&(K.emitter.emit("GetRootRect"),this.computedStyle(i)),i.memberState&&(this.computedZindex(),this.updateStyle()),i.sceneState&&this.computedIframeDisplay(i,this.attributes)},this.displayer=K.displayer=t.displayer,this.iframe=this._createIframe(),this.sideEffectManager.addDisposer(K.emitter.on("ReplayRootRect",i=>{this.rootRect=i}),Bt.RootRect),this.sideEffectManager.addDisposer(K.emitter.on("HideIframe",()=>{this.iframe.className=K.hiddenClass}),Bt.Hide),this.sideEffectManager.addDisposer(K.emitter.on("DispayIframe",()=>{this.iframe.className=""}),Bt.Show),this.sideEffectManager.addDisposer(K.emitter.on("created",()=>{this.bridgeDisposer(),this.bridgeDisposer=b.autorun(()=>{var n;const i=this.attributes;if(i.url){const r=(n=this.iframe)==null?void 0:n.src;r&&r!==i.url&&this.execListenIframe(i)}i.displaySceneDir&&this.computedIframeDisplay(this.displayer.state,i),(i.width||i.height)&&this.iframe&&(this.iframe.width=`${i.width}px`,this.iframe.height=`${i.height}px`),this.postMessage({kind:"AttributesUpdate",payload:i})})})),this.sideEffectManager.addDisposer(e.emitter.on("cameraStateChange",()=>{this.computedStyle(this.displayer.state)})),K.onCreate(this)}static onCreate(e){K.emitter.emit("StartCreate"),K.emitter.emit("OnCreate",e),K.emitter.emit("created")}insert(e){const t={url:e.url,width:e.width,height:e.height,displaySceneDir:e.displaySceneDir,useClicker:e.useClicker||!1,useSelector:e.useSelector};this.setAttributes(t);const i=()=>{this.getIframe(),this.listenIframe(this.attributes),this.listenDisplayerState(),K.emitter.emit("GetRootRect")};if(this.getIframe())i();else{const n=this.sideEffectManager.addDisposer(K.emitter.on("WrapperDidMount",()=>{i(),this.sideEffectManager.flush(n)})),r=this.sideEffectManager.addDisposer(K.emitter.on("WrapperDidUpdate",()=>{i(),this.sideEffectManager.flush(r)}))}return this.attributes.useSelector&&this.allowAppliances.push("selector"),this.computedStyle(this.displayer.state),this.listenDisplayerCallbacks(),this.getComputedIframeStyle(),this.sideEffectManager.addEventListener(window,"message",this.messageListener.bind(this),void 0,Bt.Message),K.alreadyCreate=!0,this}getComputedIframeStyle(){this.sideEffectManager.setTimeout(()=>{this.iframe&&getComputedStyle(this.iframe)},200,Bt.ComputeStyle)}destroy(){this.sideEffectManager.flushAll(),K.emitter.emit("Destory"),K.alreadyCreate=!1,K.emitter.clearListeners()}getIframe(){return this.iframe||(this.iframe=this._createIframe()),this.iframe}setIframeSize(e){this.iframe&&(this.iframe.width=`${e.width}px`,this.iframe.height=`${e.height}px`,this.setAttributes({width:e.width,height:e.height}))}get attributes(){return this.appManager.store.getIframeBridge()}setAttributes(e){this.appManager.store.setIframeBridge(e)}_createIframe(){const e=document.createElement("iframe");return e.id="IframeBridge",e.className=K.hiddenClass,this.appManager.mainView.divElement&&this.appManager.mainView.divElement.appendChild(e),e}scaleIframeToFit(e=b.AnimationMode.Immediately){if(!this.inDisplaySceneDir)return;const{width:t=1280,height:i=720}=this.attributes,n=t?-t/2:0,r=i?-i/2:0;this.manager.moveCameraToContain({originX:n,originY:r,width:t,height:i,animationMode:e})}get isReplay(){return this.manager.isReplay}handleSetPage(e){if(this.isReplay||!this.attributes.displaySceneDir)return;const t=e.payload,i=this.displayer,n=i.entireScenes()[this.attributes.displaySceneDir];if(!n||n.length!==t){const r=sM(t,s=>({name:String(s+1)}));i.putScenes(this.attributes.displaySceneDir,r),this.manager.setMainViewScenePath(this.attributes.displaySceneDir)}}listenIframe(e){const t=i=>{var n;this.postMessage({kind:"Init",payload:{attributes:this.attributes,roomState:(n=K.displayer)==null?void 0:n.state,currentPage:this.currentPage,observerId:this.displayer.observerId}}),K.emitter.emit("IframeLoad",i),this.sideEffectManager.addDisposer(K.emitter.on("Ready",()=>{var r;this.postMessage((r=this.attributes.lastEvent)==null?void 0:r.payload)}),Bt.Ready),this.computedStyleAndIframeDisplay()};e.url&&this.iframe.src!==e.url&&(this.src_url_equal_anchor||(this.src_url_equal_anchor=document.createElement("a")),this.src_url_equal_anchor.href=e.url,this.src_url_equal_anchor.href!==this.iframe.src&&(this.iframe.src=e.url)),this.iframe.width=`${e.width}px`,this.iframe.height=`${e.height}px`,this.sideEffectManager.addEventListener(this.iframe,"load",t,void 0,Bt.Load)}listenDisplayerState(){this.isReplay&&(this.displayer._phase===b.PlayerPhase.Playing&&this.computedStyleAndIframeDisplay(),this.sideEffectManager.add(()=>(this.displayer.callbacks.on("onPhaseChanged",this.onPhaseChangedListener),()=>this.displayer.callbacks.off("onPhaseChanged",this.onPhaseChangedListener)),Bt.DisplayerState)),this.computedStyleAndIframeDisplay()}computedStyleAndIframeDisplay(){this.computedStyle(this.displayer.state),this.computedIframeDisplay(this.displayer.state,this.attributes)}listenDisplayerCallbacks(){this.displayer.callbacks.on(this.callbackName,this.stateChangeListener)}get callbackName(){return this.isReplay?"onPlayerStateChanged":"onRoomStateChanged"}computedStyle(e){const t=this.manager.cameraState,i=this.attributes.width||1280,n=this.attributes.height||720;if(this.iframe){const{width:r,height:s,scale:o,centerX:a,centerY:l}=t,u=this.rootRect||{x:0,y:0},h=`${r/2+u.x}px`,c=`${s/2+u.y}px`,m=`transform-origin: ${h} ${c};`,v=(r-i)/2*o,w=(s-n)/2*o,x=-(a*o)+v,d=-(l*o)+w,f=`transform: translate(${x}px,${d}px) scale(${o}, ${o});`,T=["position: absolute;","border: 0.1px solid rgba(0,0,0,0);","top: 0px;","left: 0px;",m,f];this.cssList=T,this.computedZindex(),this.updateStyle()}}computedIframeDisplay(e,t){this.inDisplaySceneDir?K.emitter.emit("DispayIframe"):K.emitter.emit("HideIframe")}computedZindex(){const e="z-index: -1;",t=this.cssList.findIndex(i=>i===e);t!==-1&&this.cssList.splice(t,1),(!this.isClicker()||this.isDisableInput)&&this.cssList.push(e)}updateStyle(){this.iframe.style.cssText=this.cssList.join(" ")}get iframeOrigin(){if(this.iframe)try{return new URL(this.iframe.src).origin}catch(e){console.warn(e)}}messageListener(e){if(et("<<<",JSON.stringify(e.data)),e.origin!==this.iframeOrigin)return;const 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:{et(`${t.kind} not allow event.`);break}}}handleSDKCreate(){this.postMessage({kind:"Init",payload:{attributes:this.attributes,roomState:this.displayer.state,currentPage:this.currentPage,observerId:this.displayer.observerId}})}handleDispatchMagixEvent(e){const t=e.payload;this.appManager.safeDispatchMagixEvent(t.event,t.payload)}handleSetAttributes(e){this.setAttributes(e.payload)}handleRegisterMagixEvent(e){const t=e.payload,i=n=>{n.authorId!==this.displayer.observerId&&this.postMessage({kind:"ReciveMagixEvent",payload:n})};this.magixEventMap.set(t,i),this.displayer.addMagixEventListener(t,i)}handleRemoveMagixEvent(e){const t=e.payload,i=this.magixEventMap.get(t);this.displayer.removeMagixEventListener(t,i)}handleNextPage(){this.manager.canOperate&&(this.manager.nextPage(),this.dispatchMagixEvent("NextPage",{}))}handlePrevPage(){this.manager.canOperate&&(this.manager.prevPage(),this.dispatchMagixEvent("PrevPage",{}))}handlePageTo(e){if(this.manager.canOperate){const t=e.payload;if(!Number.isSafeInteger(t)||t<=0)return;this.manager.setMainViewSceneIndex(t-1),this.dispatchMagixEvent("PageTo",t-1)}}handleRemoveAllMagixEvent(){this.magixEventMap.forEach((e,t)=>{this.displayer.removeMagixEventListener(t,e)}),this.magixEventMap.clear()}handleGetAttributes(){this.postMessage({kind:"GetAttributes",payload:this.attributes})}postMessage(e){var t;this.iframe&&((t=this.iframe.contentWindow)==null||t.postMessage(JSON.parse(JSON.stringify(e)),"*"))}dispatchMagixEvent(e,t){this.manager.canOperate&&(this.setAttributes({lastEvent:{name:e,payload:t}}),this.displayer.dispatchMagixEvent(e,t))}get currentIndex(){return this.manager.mainViewSceneIndex}get currentPage(){return this.currentIndex+1}get totalPage(){return this.manager.mainViewScenesLength}get readonly(){return!this.displayer.isWritable}get inDisplaySceneDir(){return this.manager.mainViewSceneDir===this.attributes.displaySceneDir}isClicker(){if(this.readonly)return!1;const e=this.displayer.state.memberState.currentApplianceName;return this.allowAppliances.includes(e)}get isDisableInput(){return"disableDeviceInputs"in this.displayer?this.displayer.disableDeviceInputs:!0}};let pn=K;pn.kind="IframeBridge";pn.hiddenClass="netless-iframe-brdige-hidden";pn.emitter=new bi.default;pn.displayer=null;pn.alreadyCreate=!1;class oM extends bi.default{_inject(t){this.context=t}}class bg{constructor(t){this.extends=new Map,this.context={manager:this,windowManager:t.windowManager,internalEmitter:t.internalEmitter},t.container&&this.refreshContainer(t.container)}refreshContainer(t){this.context.windowManagerContainer=t,this.extends.forEach(i=>{i._inject(this.context)})}hasRegister(t){return Ae.appClasses.has(t)}use(t){this.extends.set(t.kind,t),t._inject(this.context),t.onCreate()}destroy(){this.extends.forEach(t=>{this.extends.delete(t.kind),t.onDestroy()})}}function aM(e,t){if(e.kind&&t&&Object.keys(t).includes(e.kind))switch(e.kind){case"AppManager":return(t==null?void 0:t.AppManager)||yr;case"BoxManager":return(t==null?void 0:t.BoxManager)||pr;case"AttributesDelegate":return(t==null?void 0:t.AttributesDelegate)||vr;case"CursorManager":return(t==null?void 0:t.CursorManager)||mr;case"AppProxy":return(t==null?void 0:t.AppProxy)||wr;case"AppContext":return(t==null?void 0:t.AppContext)||hr;case"TeleBoxManager":return(t==null?void 0:t.TeleBoxManager)||fr;case"TeleBoxCollector":return(t==null?void 0:t.TeleBoxCollector)||un;default:return e}return e}const Ag=new hw({emitter:V}),O=class extends b.InvisiblePlugin{constructor(e){super(e),this.version="1.0.11",this.dependencies={dependencies:{"@juggle/resize-observer":"^3.3.1","@netless/telebox-insider":"0.3.0",emittery:"^0.9.2",lodash:"^4.17.21","p-retry":"^4.6.1",uuid:"^7.0.3","video.js":">=7"},peerDependencies:{jspdf:"2.5.1","white-web-sdk":"^2.16.52"},devDependencies:{"@hyrious/dts":"^0.2.2","@netless/app-docs-viewer":"^0.2.19","@netless/app-media-player":"0.1.4","@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.30","@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","side-effect-manager":"0.1.5",svelte:"^3.42.4",typescript:"^4.5.5",vite:"^2.9.9",vitest:"^0.14.1","white-web-sdk":"^2.16.52"}},this.emitter=G,this.viewMode=b.ViewMode.Broadcaster,this.isReplay=b.isPlayer(this.displayer),this._cursorUIDs=[],this.containerSizeRatio=O.containerSizeRatio,O.displayer=e.displayer,window.NETLESS_DEPS={dependencies:{"@juggle/resize-observer":"^3.3.1","@netless/telebox-insider":"0.3.0",emittery:"^0.9.2",lodash:"^4.17.21","p-retry":"^4.6.1",uuid:"^7.0.3","video.js":">=7"},peerDependencies:{jspdf:"2.5.1","white-web-sdk":"^2.16.52"},devDependencies:{"@hyrious/dts":"^0.2.2","@netless/app-docs-viewer":"^0.2.19","@netless/app-media-player":"0.1.4","@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.30","@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","side-effect-manager":"0.1.5",svelte:"^3.42.4",typescript:"^4.5.5",vite:"^2.9.9",vitest:"^0.14.1","white-web-sdk":"^2.16.52"}}}static onCreate(e){O._resolve(e)}static async mount(e,t){const i=e.room;O.container=e.container,O.supportAppliancePlugin=e.supportAppliancePlugin;const n=e.containerSizeRatio,r=e.debug,s=e.cursor;O.params=e,O.extendClass=t,O.displayer=e.room,Cv();let o;if(b.isRoom(i)){if(i.phase!==b.RoomPhase.Connected)throw new Error("[WindowManager]: Room only Connected can be mount");i.phase===b.RoomPhase.Connected&&i.isWritable&&(i.disableSerialization=!1),o=await this.initManager(i)}if(O.isCreated)throw new Error("[WindowManager]: Already created cannot be created again");if(this.debug=Boolean(r),this.debug&&Sg({verbose:!0}),et("Already insert room",o),b.isRoom(this.displayer)){if(!o)throw new Error("[WindowManager]: init InvisiblePlugin failed")}else await jh.default(async u=>{if(o=i.getInvisiblePlugin(O.kind),!o)throw et(`manager is empty. retrying ${u}`),new Error},{retries:10,maxTimeout:5e3});if(!o)throw new Error("[WindowManager]: create manager failed");n&&(O.containerSizeRatio=n),await o.ensureAttributes();const a=Tt(yr,O.extendClass),l=Tt(mr,O.extendClass);o._fullscreen=e.fullscreen,o.appManager=new a(o),o.appManager.polling=e.polling||!1,o._pageState=new cw(o.appManager),o.cursorManager=new l(o.appManager,Boolean(s),e.cursorOptions,e.applianceIcons),o.extendPluginManager=new bg({internalEmitter:V,windowManager:o}),n&&(o.containerSizeRatio=n),e.container&&o.bindContainer(e.container),dw(i,o),V.emit("onCreated"),O.isCreated=!0;try{await Hg()}catch(u){console.warn("[WindowManager]: indexedDB open failed"),console.log(u)}return o}static initManager(e){return bv(e)}static initContainer(e,t,i){const{chessboard:n,overwriteStyles:r,fullscreen:s}=i;O.container||(O.container=t);const{playground:o,wrapper:a,sizer:l,mainViewElement:u}=Iv(t);if(O.playground=o,n&&l.classList.add("netless-window-manager-chess-sizer"),s&&l.classList.add("netless-window-manager-fullscreen"),r){const h=document.createElement("style");h.textContent=r,o.appendChild(h)}return e.containerResizeObserver=Il.create(o,l,a,V),O.wrapper=a,O.sizer=l,u}static get registered(){return Ae.registered}bindContainer(e){var t,i,n,r,s,o;if(b.isRoom(this.displayer)&&this.room.phase!==b.RoomPhase.Connected)throw new Yh;if(O.isCreated&&O.container)O.container.firstChild&&e.appendChild(O.container.firstChild);else if(O.params){const a=O.params,l=O.initContainer(this,e,a);this.boxManager&&this.boxManager.destroy();const u=Mv(this,G,V,lt,{collectorContainer:a.collectorContainer,collectorStyles:a.collectorStyles,prefersColorScheme:a.prefersColorScheme,useBoxesStatus:a.useBoxesStatus});this.boxManager=u,this.appManager&&(this.appManager.useBoxesStatus=a.useBoxesStatus||!1,this.appManager.setBoxManager(u)),this.bindMainView(l,a.disableCameraTransform),O.wrapper&&((t=this.cursorManager)==null||t.setupWrapper(O.wrapper))}V.emit("updateManagerRect"),(i=this.appManager)==null||i.refresh(),(n=this.appManager)==null||n.resetMaximized(),(r=this.appManager)==null||r.resetMinimized(),(s=this.appManager)==null||s.displayerWritableListener(!this.room.isWritable),O.container=e,(o=this.extendPluginManager)==null||o.refreshContainer(e)}bindCollectorContainer(e){O.isCreated&&this.boxManager?this.boxManager.setCollectorContainer(e):O.params&&(O.params.collectorContainer=e)}static register(e){return Ae.register(e)}static unregister(e){return Ae.unregister(e)}async addApp(e){if(this.appManager)return this.appManager.rootDirRemoving?new Promise((t,i)=>{V.once("rootDirRemoved").then(async()=>{try{const n=await this._addApp(e);t(n)}catch(n){i(n.message)}})}):this._addApp(e);throw new Ve}async _addApp(e){var t,i,n;if(this.appManager){if(!e.kind||typeof e.kind!="string")throw new Hh;e.src&&typeof e.src=="string"&&Ae.register({kind:e.kind,src:e.src});const r=await((t=Ae.appClasses.get(e.kind))==null?void 0:t());if(r&&((i=r.config)==null?void 0:i.singleton)&&this.appManager.appProxies.has(e.kind))throw new $h;const s=this.setupScenePath(e,this.appManager);return s===void 0?void 0:((n=e==null?void 0:e.options)!=null&&n.scenePath&&(e.options.scenePath=lm(e.options.scenePath)),await this.appManager.addApp(e,Boolean(s)))}else throw new Ve}setupScenePath(e,t){let i=!1;if(e.options){const{scenePath:n,scenes:r}=e.options;if(n){if(!am(n))throw new Qh;const s=Object.keys(this.apps||{});for(const o of s){const a=t.store.getAppScenePath(o);if(a&&a===n){if(console.warn(`[WindowManager]: ScenePath "${n}" already opened`),this.boxManager){const l=this.boxManager.getTopBox();l&&(this.boxManager.setZIndex(o,l.zIndex+1,!1),this.boxManager.focusBox({appId:o},!1))}return}}}n&&r&&r.length>0&&(this.isDynamicPPT(r)?(i=!0,qi(this.displayer)[n]||Dn(this.room,n,r)):qi(this.displayer)[n]||Dn(this.room,n,[{name:r[0].name}])),n&&r===void 0&&Dn(this.room,n,[{}])}return i}async setMainViewScenePath(e){this.appManager&&await this.appManager.setMainViewScenePath(e)}async setMainViewSceneIndex(e){this.appManager&&await this.appManager.setMainViewSceneIndex(e)}async nextPage(){if(this.appManager){const e=this.mainViewSceneIndex+1;return e>=this.mainViewScenesLength?(console.warn("[WindowManager]: current page is the last page"),!1):(await this.appManager.setMainViewSceneIndex(e),!0)}else return!1}async prevPage(){if(this.appManager){const e=this.mainViewSceneIndex-1;return e<0?(console.warn("[WindowManager]: current page is the first page"),!1):(await this.appManager.setMainViewSceneIndex(e),!0)}else return!1}async jumpPage(e){return this.appManager?e<0||e>=this.pageState.length?(console.warn(`[WindowManager]: index ${e} out of range`),!1):(await this.appManager.setMainViewSceneIndex(e),!0):!1}async addPage(e){if(this.appManager){const t=e==null?void 0:e.after,i=e==null?void 0:e.scene;if(t){const n=this.mainViewSceneIndex+1;this.room.putScenes(Ue,[i||{}],n)}else this.room.putScenes(Ue,[i||{}])}}async removePage(e){if(this.appManager){const t=e===void 0?this.pageState.index:e;return this.pageState.length===1?(console.warn("[WindowManager]: can not remove the last page"),!1):t<0||t>=this.pageState.length?(console.warn(`[WindowManager]: index ${e} out of range`),!1):this.appManager.removeSceneByIndex(t)}else return!1}getMainViewScenePath(){var e;return(e=this.appManager)==null?void 0:e.store.getMainViewScenePath()}getMainViewSceneIndex(){var e;return(e=this.appManager)==null?void 0:e.store.getMainViewSceneIndex()}setReadonly(e){var t;this.readonly=e,(t=this.boxManager)==null||t.setReadonly(e),V.emit("setReadonly",e)}switchMainViewToWriter(){var e;return(e=this.appManager)==null?void 0:e.mainViewProxy.mainViewClickHandler()}onAppDestroy(e,t){sm(`destroy-${e}`,t)}onAppEvent(e,t){return V.on(`custom-${e}`,t)}setViewMode(e){var t,i,n,r;(e===b.ViewMode.Broadcaster||e===b.ViewMode.Follower)&&(this.canOperate&&e===b.ViewMode.Broadcaster&&((t=this.appManager)==null||t.mainViewProxy.setCameraAndSize()),(i=this.appManager)==null||i.mainViewProxy.start()),e===b.ViewMode.Freedom&&((n=this.appManager)==null||n.mainViewProxy.stop()),this.viewMode=e,(r=this.appManager)==null||r.mainViewProxy.setViewMode(e)}setBoxState(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);break}}setMaximized(e){var t;!this.canOperate||(t=this.boxManager)==null||t.setMaximized(e,!1)}setMinimized(e){var t;!this.canOperate||(t=this.boxManager)==null||t.setMinimized(e,!1)}setBoxStatus(e,t){var i;!this.canOperate||(i=this.appManager)==null||i.store.setBoxStatus(e,t)}setLastNotMinimizedBoxStatus(e,t){var i;!this.canOperate||(i=this.appManager)==null||i.store.setLastNotMinimizedBoxStatus(e,t)}setFullscreen(e){var t;this._fullscreen!==e&&(this._fullscreen=e,(t=O.sizer)==null||t.classList.toggle("netless-window-manager-fullscreen",e),G.emit("fullscreenChange",e))}get cursorUIDs(){return this._cursorUIDs}setCursorUIDs(e){var t,i;if(this._cursorUIDs=e||[],this._cursorUIDs.length===0)(t=this._cursorUIDsStyleDOM)==null||t.remove();else{this._cursorUIDsStyleDOM||(this._cursorUIDsStyleDOM=document.createElement("style")),(i=O.playground)==null||i.appendChild(this._cursorUIDsStyleDOM);let n="[data-cursor-uid] { display: none }";for(const r of this._cursorUIDs)n+=`
47
+ `);const n=document.createElement("div");if(n.classList.add("netless-app-media-player-container"),Kr.render(F.createElement(Rh,{context:e}),n),i.mountContent(n),e.emitter.on("destroy",()=>{console.log("[MediaPlayer]: destroy"),Kr.unmountComponentAtNode(n)}),window.__pcmProxy){const r=()=>{document.visibilityState==="hidden"?(console.log("[MediaPlayer]: visibilitychange -> hidden. unmount for pcmproxy"),Kr.unmountComponentAtNode(n)):(console.log("[MediaPlayer]: visibilitychange -> visible. mount for pcmproxy"),Kr.render(F.createElement(Rh,{context:e}),n))};document.addEventListener("visibilitychange",r),e.emitter.on("destroy",()=>{document.removeEventListener("visibilitychange",r)})}}},nM=()=>{Q.debug&&Sg({verbose:!0}),Q.register({kind:fa.kind,src:fa}),Q.register({kind:ll.kind,src:ll})},rM={DocsViewer:fa.kind,MediaPlayer:ll.kind};const Bt={Ready:"Ready",RootRect:"ReplayRootRect",Message:"message",ComputeStyle:"computeStyle",Load:"load",DisplayerState:"displayerState",Show:"show",Hide:"hide"},sM=(e,t)=>new Array(e).fill(0).map((i,n)=>t(n)),K=class{constructor(e,t){this.manager=e,this.appManager=t,this.magixEventMap=new Map,this.cssList=[],this.allowAppliances=["clicker"],this.bridgeDisposer=E.noop,this.rootRect=null,this.sideEffectManager=new cr,this.execListenIframe=E.debounce(i=>{this.listenIframe(i)},50),this.onPhaseChangedListener=i=>{i===b.PlayerPhase.Playing&&this.computedStyleAndIframeDisplay()},this.stateChangeListener=i=>{i={...i},i.cameraState=this.manager.cameraState,this.postMessage({kind:"RoomStateChanged",payload:i}),i.cameraState&&(K.emitter.emit("GetRootRect"),this.computedStyle(i)),i.memberState&&(this.computedZindex(),this.updateStyle()),i.sceneState&&this.computedIframeDisplay(i,this.attributes)},this.displayer=K.displayer=t.displayer,this.iframe=this._createIframe(),this.sideEffectManager.addDisposer(K.emitter.on("ReplayRootRect",i=>{this.rootRect=i}),Bt.RootRect),this.sideEffectManager.addDisposer(K.emitter.on("HideIframe",()=>{this.iframe.className=K.hiddenClass}),Bt.Hide),this.sideEffectManager.addDisposer(K.emitter.on("DispayIframe",()=>{this.iframe.className=""}),Bt.Show),this.sideEffectManager.addDisposer(K.emitter.on("created",()=>{this.bridgeDisposer(),this.bridgeDisposer=b.autorun(()=>{var n;const i=this.attributes;if(i.url){const r=(n=this.iframe)==null?void 0:n.src;r&&r!==i.url&&this.execListenIframe(i)}i.displaySceneDir&&this.computedIframeDisplay(this.displayer.state,i),(i.width||i.height)&&this.iframe&&(this.iframe.width=`${i.width}px`,this.iframe.height=`${i.height}px`),this.postMessage({kind:"AttributesUpdate",payload:i})})})),this.sideEffectManager.addDisposer(e.emitter.on("cameraStateChange",()=>{this.computedStyle(this.displayer.state)})),K.onCreate(this)}static onCreate(e){K.emitter.emit("StartCreate"),K.emitter.emit("OnCreate",e),K.emitter.emit("created")}insert(e){const t={url:e.url,width:e.width,height:e.height,displaySceneDir:e.displaySceneDir,useClicker:e.useClicker||!1,useSelector:e.useSelector};this.setAttributes(t);const i=()=>{this.getIframe(),this.listenIframe(this.attributes),this.listenDisplayerState(),K.emitter.emit("GetRootRect")};if(this.getIframe())i();else{const n=this.sideEffectManager.addDisposer(K.emitter.on("WrapperDidMount",()=>{i(),this.sideEffectManager.flush(n)})),r=this.sideEffectManager.addDisposer(K.emitter.on("WrapperDidUpdate",()=>{i(),this.sideEffectManager.flush(r)}))}return this.attributes.useSelector&&this.allowAppliances.push("selector"),this.computedStyle(this.displayer.state),this.listenDisplayerCallbacks(),this.getComputedIframeStyle(),this.sideEffectManager.addEventListener(window,"message",this.messageListener.bind(this),void 0,Bt.Message),K.alreadyCreate=!0,this}getComputedIframeStyle(){this.sideEffectManager.setTimeout(()=>{this.iframe&&getComputedStyle(this.iframe)},200,Bt.ComputeStyle)}destroy(){this.sideEffectManager.flushAll(),K.emitter.emit("Destory"),K.alreadyCreate=!1,K.emitter.clearListeners()}getIframe(){return this.iframe||(this.iframe=this._createIframe()),this.iframe}setIframeSize(e){this.iframe&&(this.iframe.width=`${e.width}px`,this.iframe.height=`${e.height}px`,this.setAttributes({width:e.width,height:e.height}))}get attributes(){return this.appManager.store.getIframeBridge()}setAttributes(e){this.appManager.store.setIframeBridge(e)}_createIframe(){const e=document.createElement("iframe");return e.id="IframeBridge",e.className=K.hiddenClass,this.appManager.mainView.divElement&&this.appManager.mainView.divElement.appendChild(e),e}scaleIframeToFit(e=b.AnimationMode.Immediately){if(!this.inDisplaySceneDir)return;const{width:t=1280,height:i=720}=this.attributes,n=t?-t/2:0,r=i?-i/2:0;this.manager.moveCameraToContain({originX:n,originY:r,width:t,height:i,animationMode:e})}get isReplay(){return this.manager.isReplay}handleSetPage(e){if(this.isReplay||!this.attributes.displaySceneDir)return;const t=e.payload,i=this.displayer,n=i.entireScenes()[this.attributes.displaySceneDir];if(!n||n.length!==t){const r=sM(t,s=>({name:String(s+1)}));i.putScenes(this.attributes.displaySceneDir,r),this.manager.setMainViewScenePath(this.attributes.displaySceneDir)}}listenIframe(e){const t=i=>{var n;this.postMessage({kind:"Init",payload:{attributes:this.attributes,roomState:(n=K.displayer)==null?void 0:n.state,currentPage:this.currentPage,observerId:this.displayer.observerId}}),K.emitter.emit("IframeLoad",i),this.sideEffectManager.addDisposer(K.emitter.on("Ready",()=>{var r;this.postMessage((r=this.attributes.lastEvent)==null?void 0:r.payload)}),Bt.Ready),this.computedStyleAndIframeDisplay()};e.url&&this.iframe.src!==e.url&&(this.src_url_equal_anchor||(this.src_url_equal_anchor=document.createElement("a")),this.src_url_equal_anchor.href=e.url,this.src_url_equal_anchor.href!==this.iframe.src&&(this.iframe.src=e.url)),this.iframe.width=`${e.width}px`,this.iframe.height=`${e.height}px`,this.sideEffectManager.addEventListener(this.iframe,"load",t,void 0,Bt.Load)}listenDisplayerState(){this.isReplay&&(this.displayer._phase===b.PlayerPhase.Playing&&this.computedStyleAndIframeDisplay(),this.sideEffectManager.add(()=>(this.displayer.callbacks.on("onPhaseChanged",this.onPhaseChangedListener),()=>this.displayer.callbacks.off("onPhaseChanged",this.onPhaseChangedListener)),Bt.DisplayerState)),this.computedStyleAndIframeDisplay()}computedStyleAndIframeDisplay(){this.computedStyle(this.displayer.state),this.computedIframeDisplay(this.displayer.state,this.attributes)}listenDisplayerCallbacks(){this.displayer.callbacks.on(this.callbackName,this.stateChangeListener)}get callbackName(){return this.isReplay?"onPlayerStateChanged":"onRoomStateChanged"}computedStyle(e){const t=this.manager.cameraState,i=this.attributes.width||1280,n=this.attributes.height||720;if(this.iframe){const{width:r,height:s,scale:o,centerX:a,centerY:l}=t,u=this.rootRect||{x:0,y:0},h=`${r/2+u.x}px`,c=`${s/2+u.y}px`,m=`transform-origin: ${h} ${c};`,v=(r-i)/2*o,w=(s-n)/2*o,x=-(a*o)+v,d=-(l*o)+w,f=`transform: translate(${x}px,${d}px) scale(${o}, ${o});`,T=["position: absolute;","border: 0.1px solid rgba(0,0,0,0);","top: 0px;","left: 0px;",m,f];this.cssList=T,this.computedZindex(),this.updateStyle()}}computedIframeDisplay(e,t){this.inDisplaySceneDir?K.emitter.emit("DispayIframe"):K.emitter.emit("HideIframe")}computedZindex(){const e="z-index: -1;",t=this.cssList.findIndex(i=>i===e);t!==-1&&this.cssList.splice(t,1),(!this.isClicker()||this.isDisableInput)&&this.cssList.push(e)}updateStyle(){this.iframe.style.cssText=this.cssList.join(" ")}get iframeOrigin(){if(this.iframe)try{return new URL(this.iframe.src).origin}catch(e){console.warn(e)}}messageListener(e){if(et("<<<",JSON.stringify(e.data)),e.origin!==this.iframeOrigin)return;const 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:{et(`${t.kind} not allow event.`);break}}}handleSDKCreate(){this.postMessage({kind:"Init",payload:{attributes:this.attributes,roomState:this.displayer.state,currentPage:this.currentPage,observerId:this.displayer.observerId}})}handleDispatchMagixEvent(e){const t=e.payload;this.appManager.safeDispatchMagixEvent(t.event,t.payload)}handleSetAttributes(e){this.setAttributes(e.payload)}handleRegisterMagixEvent(e){const t=e.payload,i=n=>{n.authorId!==this.displayer.observerId&&this.postMessage({kind:"ReciveMagixEvent",payload:n})};this.magixEventMap.set(t,i),this.displayer.addMagixEventListener(t,i)}handleRemoveMagixEvent(e){const t=e.payload,i=this.magixEventMap.get(t);this.displayer.removeMagixEventListener(t,i)}handleNextPage(){this.manager.canOperate&&(this.manager.nextPage(),this.dispatchMagixEvent("NextPage",{}))}handlePrevPage(){this.manager.canOperate&&(this.manager.prevPage(),this.dispatchMagixEvent("PrevPage",{}))}handlePageTo(e){if(this.manager.canOperate){const t=e.payload;if(!Number.isSafeInteger(t)||t<=0)return;this.manager.setMainViewSceneIndex(t-1),this.dispatchMagixEvent("PageTo",t-1)}}handleRemoveAllMagixEvent(){this.magixEventMap.forEach((e,t)=>{this.displayer.removeMagixEventListener(t,e)}),this.magixEventMap.clear()}handleGetAttributes(){this.postMessage({kind:"GetAttributes",payload:this.attributes})}postMessage(e){var t;this.iframe&&((t=this.iframe.contentWindow)==null||t.postMessage(JSON.parse(JSON.stringify(e)),"*"))}dispatchMagixEvent(e,t){this.manager.canOperate&&(this.setAttributes({lastEvent:{name:e,payload:t}}),this.displayer.dispatchMagixEvent(e,t))}get currentIndex(){return this.manager.mainViewSceneIndex}get currentPage(){return this.currentIndex+1}get totalPage(){return this.manager.mainViewScenesLength}get readonly(){return!this.displayer.isWritable}get inDisplaySceneDir(){return this.manager.mainViewSceneDir===this.attributes.displaySceneDir}isClicker(){if(this.readonly)return!1;const e=this.displayer.state.memberState.currentApplianceName;return this.allowAppliances.includes(e)}get isDisableInput(){return"disableDeviceInputs"in this.displayer?this.displayer.disableDeviceInputs:!0}};let pn=K;pn.kind="IframeBridge";pn.hiddenClass="netless-iframe-brdige-hidden";pn.emitter=new bi.default;pn.displayer=null;pn.alreadyCreate=!1;class oM extends bi.default{_inject(t){this.context=t}}class bg{constructor(t){this.extends=new Map,this.context={manager:this,windowManager:t.windowManager,internalEmitter:t.internalEmitter},t.container&&this.refreshContainer(t.container)}refreshContainer(t){this.context.windowManagerContainer=t,this.extends.forEach(i=>{i._inject(this.context)})}hasRegister(t){return Ae.appClasses.has(t)}use(t){this.extends.set(t.kind,t),t._inject(this.context),t.onCreate()}destroy(){this.extends.forEach(t=>{this.extends.delete(t.kind),t.onDestroy()})}}function aM(e,t){if(e.kind&&t&&Object.keys(t).includes(e.kind))switch(e.kind){case"AppManager":return(t==null?void 0:t.AppManager)||yr;case"BoxManager":return(t==null?void 0:t.BoxManager)||pr;case"AttributesDelegate":return(t==null?void 0:t.AttributesDelegate)||vr;case"CursorManager":return(t==null?void 0:t.CursorManager)||mr;case"AppProxy":return(t==null?void 0:t.AppProxy)||wr;case"AppContext":return(t==null?void 0:t.AppContext)||hr;case"TeleBoxManager":return(t==null?void 0:t.TeleBoxManager)||fr;case"TeleBoxCollector":return(t==null?void 0:t.TeleBoxCollector)||un;default:return e}return e}const Ag=new hw({emitter:V}),O=class extends b.InvisiblePlugin{constructor(e){super(e),this.version="1.0.12",this.dependencies={dependencies:{"@juggle/resize-observer":"^3.3.1","@netless/telebox-insider":"0.3.0",emittery:"^0.9.2",lodash:"^4.17.21","p-retry":"^4.6.1",uuid:"^7.0.3","video.js":">=7"},peerDependencies:{jspdf:"2.5.1","white-web-sdk":"^2.16.52"},devDependencies:{"@hyrious/dts":"^0.2.2","@netless/app-docs-viewer":"^0.2.19","@netless/app-media-player":"0.1.4","@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.30","@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","side-effect-manager":"0.1.5",svelte:"^3.42.4",typescript:"^4.5.5",vite:"^2.9.9",vitest:"^0.14.1","white-web-sdk":"^2.16.52"}},this.emitter=G,this.viewMode=b.ViewMode.Broadcaster,this.isReplay=b.isPlayer(this.displayer),this._cursorUIDs=[],this.containerSizeRatio=O.containerSizeRatio,O.displayer=e.displayer,window.NETLESS_DEPS={dependencies:{"@juggle/resize-observer":"^3.3.1","@netless/telebox-insider":"0.3.0",emittery:"^0.9.2",lodash:"^4.17.21","p-retry":"^4.6.1",uuid:"^7.0.3","video.js":">=7"},peerDependencies:{jspdf:"2.5.1","white-web-sdk":"^2.16.52"},devDependencies:{"@hyrious/dts":"^0.2.2","@netless/app-docs-viewer":"^0.2.19","@netless/app-media-player":"0.1.4","@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.30","@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","side-effect-manager":"0.1.5",svelte:"^3.42.4",typescript:"^4.5.5",vite:"^2.9.9",vitest:"^0.14.1","white-web-sdk":"^2.16.52"}}}static onCreate(e){O._resolve(e)}static async mount(e,t){const i=e.room;O.container=e.container,O.supportAppliancePlugin=e.supportAppliancePlugin;const n=e.containerSizeRatio,r=e.debug,s=e.cursor;O.params=e,O.extendClass=t,O.displayer=e.room,Cv();let o;if(b.isRoom(i)){if(i.phase!==b.RoomPhase.Connected)throw new Error("[WindowManager]: Room only Connected can be mount");i.phase===b.RoomPhase.Connected&&i.isWritable&&(i.disableSerialization=!1),o=await this.initManager(i)}if(O.isCreated)throw new Error("[WindowManager]: Already created cannot be created again");if(this.debug=Boolean(r),this.debug&&Sg({verbose:!0}),et("Already insert room",o),b.isRoom(this.displayer)){if(!o)throw new Error("[WindowManager]: init InvisiblePlugin failed")}else await jh.default(async u=>{if(o=i.getInvisiblePlugin(O.kind),!o)throw et(`manager is empty. retrying ${u}`),new Error},{retries:10,maxTimeout:5e3});if(!o)throw new Error("[WindowManager]: create manager failed");n&&(O.containerSizeRatio=n),await o.ensureAttributes();const a=Tt(yr,O.extendClass),l=Tt(mr,O.extendClass);o._fullscreen=e.fullscreen,o.appManager=new a(o),o.appManager.polling=e.polling||!1,o._pageState=new cw(o.appManager),o.cursorManager=new l(o.appManager,Boolean(s),e.cursorOptions,e.applianceIcons),o.extendPluginManager=new bg({internalEmitter:V,windowManager:o}),n&&(o.containerSizeRatio=n),e.container&&o.bindContainer(e.container),dw(i,o),V.emit("onCreated"),O.isCreated=!0;try{await Hg()}catch(u){console.warn("[WindowManager]: indexedDB open failed"),console.log(u)}return o}static initManager(e){return bv(e)}static initContainer(e,t,i){const{chessboard:n,overwriteStyles:r,fullscreen:s}=i;O.container||(O.container=t);const{playground:o,wrapper:a,sizer:l,mainViewElement:u}=Iv(t);if(O.playground=o,n&&l.classList.add("netless-window-manager-chess-sizer"),s&&l.classList.add("netless-window-manager-fullscreen"),r){const h=document.createElement("style");h.textContent=r,o.appendChild(h)}return e.containerResizeObserver=Il.create(o,l,a,V),O.wrapper=a,O.sizer=l,u}static get registered(){return Ae.registered}bindContainer(e){var t,i,n,r,s,o;if(b.isRoom(this.displayer)&&this.room.phase!==b.RoomPhase.Connected)throw new Yh;if(O.isCreated&&O.container)O.container.firstChild&&e.appendChild(O.container.firstChild);else if(O.params){const a=O.params,l=O.initContainer(this,e,a);this.boxManager&&this.boxManager.destroy();const u=Mv(this,G,V,lt,{collectorContainer:a.collectorContainer,collectorStyles:a.collectorStyles,prefersColorScheme:a.prefersColorScheme,useBoxesStatus:a.useBoxesStatus});this.boxManager=u,this.appManager&&(this.appManager.useBoxesStatus=a.useBoxesStatus||!1,this.appManager.setBoxManager(u)),this.bindMainView(l,a.disableCameraTransform),O.wrapper&&((t=this.cursorManager)==null||t.setupWrapper(O.wrapper))}V.emit("updateManagerRect"),(i=this.appManager)==null||i.refresh(),(n=this.appManager)==null||n.resetMaximized(),(r=this.appManager)==null||r.resetMinimized(),(s=this.appManager)==null||s.displayerWritableListener(!this.room.isWritable),O.container=e,(o=this.extendPluginManager)==null||o.refreshContainer(e)}bindCollectorContainer(e){O.isCreated&&this.boxManager?this.boxManager.setCollectorContainer(e):O.params&&(O.params.collectorContainer=e)}static register(e){return Ae.register(e)}static unregister(e){return Ae.unregister(e)}async addApp(e){if(this.appManager)return this.appManager.rootDirRemoving?new Promise((t,i)=>{V.once("rootDirRemoved").then(async()=>{try{const n=await this._addApp(e);t(n)}catch(n){i(n.message)}})}):this._addApp(e);throw new Ve}async _addApp(e){var t,i,n;if(this.appManager){if(!e.kind||typeof e.kind!="string")throw new Hh;e.src&&typeof e.src=="string"&&Ae.register({kind:e.kind,src:e.src});const r=await((t=Ae.appClasses.get(e.kind))==null?void 0:t());if(r&&((i=r.config)==null?void 0:i.singleton)&&this.appManager.appProxies.has(e.kind))throw new $h;const s=this.setupScenePath(e,this.appManager);return s===void 0?void 0:((n=e==null?void 0:e.options)!=null&&n.scenePath&&(e.options.scenePath=lm(e.options.scenePath)),await this.appManager.addApp(e,Boolean(s)))}else throw new Ve}setupScenePath(e,t){let i=!1;if(e.options){const{scenePath:n,scenes:r}=e.options;if(n){if(!am(n))throw new Qh;const s=Object.keys(this.apps||{});for(const o of s){const a=t.store.getAppScenePath(o);if(a&&a===n){if(console.warn(`[WindowManager]: ScenePath "${n}" already opened`),this.boxManager){const l=this.boxManager.getTopBox();l&&(this.boxManager.setZIndex(o,l.zIndex+1,!1),this.boxManager.focusBox({appId:o},!1))}return}}}n&&r&&r.length>0&&(this.isDynamicPPT(r)?(i=!0,qi(this.displayer)[n]||Dn(this.room,n,r)):qi(this.displayer)[n]||Dn(this.room,n,[{name:r[0].name}])),n&&r===void 0&&Dn(this.room,n,[{}])}return i}async setMainViewScenePath(e){this.appManager&&await this.appManager.setMainViewScenePath(e)}async setMainViewSceneIndex(e){this.appManager&&await this.appManager.setMainViewSceneIndex(e)}async nextPage(){if(this.appManager){const e=this.mainViewSceneIndex+1;return e>=this.mainViewScenesLength?(console.warn("[WindowManager]: current page is the last page"),!1):(await this.appManager.setMainViewSceneIndex(e),!0)}else return!1}async prevPage(){if(this.appManager){const e=this.mainViewSceneIndex-1;return e<0?(console.warn("[WindowManager]: current page is the first page"),!1):(await this.appManager.setMainViewSceneIndex(e),!0)}else return!1}async jumpPage(e){return this.appManager?e<0||e>=this.pageState.length?(console.warn(`[WindowManager]: index ${e} out of range`),!1):(await this.appManager.setMainViewSceneIndex(e),!0):!1}async addPage(e){if(this.appManager){const t=e==null?void 0:e.after,i=e==null?void 0:e.scene;if(t){const n=this.mainViewSceneIndex+1;this.room.putScenes(Ue,[i||{}],n)}else this.room.putScenes(Ue,[i||{}])}}async removePage(e){if(this.appManager){const t=e===void 0?this.pageState.index:e;return this.pageState.length===1?(console.warn("[WindowManager]: can not remove the last page"),!1):t<0||t>=this.pageState.length?(console.warn(`[WindowManager]: index ${e} out of range`),!1):this.appManager.removeSceneByIndex(t)}else return!1}getMainViewScenePath(){var e;return(e=this.appManager)==null?void 0:e.store.getMainViewScenePath()}getMainViewSceneIndex(){var e;return(e=this.appManager)==null?void 0:e.store.getMainViewSceneIndex()}setReadonly(e){var t;this.readonly=e,(t=this.boxManager)==null||t.setReadonly(e),V.emit("setReadonly",e)}switchMainViewToWriter(){var e;return(e=this.appManager)==null?void 0:e.mainViewProxy.mainViewClickHandler()}onAppDestroy(e,t){sm(`destroy-${e}`,t)}onAppEvent(e,t){return V.on(`custom-${e}`,t)}setViewMode(e){var t,i,n,r;(e===b.ViewMode.Broadcaster||e===b.ViewMode.Follower)&&(this.canOperate&&e===b.ViewMode.Broadcaster&&((t=this.appManager)==null||t.mainViewProxy.setCameraAndSize()),(i=this.appManager)==null||i.mainViewProxy.start()),e===b.ViewMode.Freedom&&((n=this.appManager)==null||n.mainViewProxy.stop()),this.viewMode=e,(r=this.appManager)==null||r.mainViewProxy.setViewMode(e)}setBoxState(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);break}}setMaximized(e){var t;!this.canOperate||(t=this.boxManager)==null||t.setMaximized(e,!1)}setMinimized(e){var t;!this.canOperate||(t=this.boxManager)==null||t.setMinimized(e,!1)}setBoxStatus(e,t){var i;!this.canOperate||(i=this.appManager)==null||i.store.setBoxStatus(e,t)}setLastNotMinimizedBoxStatus(e,t){var i;!this.canOperate||(i=this.appManager)==null||i.store.setLastNotMinimizedBoxStatus(e,t)}setFullscreen(e){var t;this._fullscreen!==e&&(this._fullscreen=e,(t=O.sizer)==null||t.classList.toggle("netless-window-manager-fullscreen",e),G.emit("fullscreenChange",e))}get cursorUIDs(){return this._cursorUIDs}setCursorUIDs(e){var t,i;if(this._cursorUIDs=e||[],this._cursorUIDs.length===0)(t=this._cursorUIDsStyleDOM)==null||t.remove();else{this._cursorUIDsStyleDOM||(this._cursorUIDsStyleDOM=document.createElement("style")),(i=O.playground)==null||i.appendChild(this._cursorUIDsStyleDOM);let n="[data-cursor-uid] { display: none }";for(const r of this._cursorUIDs)n+=`
48
48
  [data-cursor-uid="${r}"] { display: flex }`;this._cursorUIDsStyleDOM.textContent=n}}get mainView(){if(this.appManager)return this.appManager.mainViewProxy.view;throw new Ve}get camera(){if(this.appManager)return this.appManager.mainViewProxy.view.camera;throw new Ve}get cameraState(){if(this.appManager)return this.appManager.mainViewProxy.cameraState;throw new Ve}get apps(){var e;return(e=this.appManager)==null?void 0:e.store.apps()}get boxState(){var e;if(this.appManager)return(e=this.appManager.boxManager)==null?void 0:e.boxState;throw new Ve}get boxStatus(){if(this.appManager)return this.appManager.store.getBoxesStatus();throw new Ve}get lastNotMinimizedBoxStatus(){if(this.appManager)return this.appManager.store.getLastNotMinimizedBoxesStatus();throw new Ve}get darkMode(){var e,t;return Boolean((t=(e=this.appManager)==null?void 0:e.boxManager)==null?void 0:t.darkMode)}get prefersColorScheme(){var e;if(this.appManager)return(e=this.appManager.boxManager)==null?void 0:e.prefersColorScheme;throw new Ve}get focused(){return this.attributes.focus}get focusedView(){var e,t;return((t=(e=this.appManager)==null?void 0:e.focusApp)==null?void 0:t.view)||this.mainView}get polling(){var e;return((e=this.appManager)==null?void 0:e.polling)||!1}set polling(e){this.appManager&&(this.appManager.polling=e)}get cursorStyle(){var e;return((e=this.cursorManager)==null?void 0:e.style)||"default"}set cursorStyle(e){if(!this.cursorManager)throw new Error("[WindowManager]: cursor is not enabled, please set { cursor: true }.");this.cursorManager.style=e}get mainViewSceneIndex(){var e;return((e=this._pageState)==null?void 0:e.index)||0}get mainViewSceneDir(){var e;if(this.appManager)return(e=this.appManager)==null?void 0:e.getMainViewSceneDir();throw new Ve}get topApp(){var e,t;return(t=(e=this.boxManager)==null?void 0:e.getTopBox())==null?void 0:t.id}get mainViewScenesLength(){var e;return((e=this._pageState)==null?void 0:e.length)||0}get canRedoSteps(){var e;return((e=this.focusedView)==null?void 0:e.canRedoSteps)||0}get canUndoSteps(){var e;return((e=this.focusedView)==null?void 0:e.canUndoSteps)||0}get sceneState(){if(this.appManager)return this.appManager.sceneState;throw new Ve}get pageState(){if(this._pageState)return this._pageState.toObject();throw new Ve}get fullscreen(){return Boolean(this._fullscreen)}queryAll(){var e;return Array.from(((e=this.appManager)==null?void 0:e.appProxies.values())||[])}queryOne(e){var t;return(t=this.appManager)==null?void 0:t.appProxies.get(e)}async closeApp(e){var t;return(t=this.appManager)==null?void 0:t.closeApp(e)}focusApp(e){var i,n,r;const t=(i=this.boxManager)==null?void 0:i.getBox(e);t&&((n=this.boxManager)==null||n.focusBox({appId:e},!1),((r=this.boxManager)==null?void 0:r.teleBoxManager).makeBoxTop(t,!1))}moveCamera(e){const t=E.omit(e,["animationMode"]),i={...this.mainView.camera};E.isEqual({...i,...t},i)||(this.mainView.moveCamera(e),setTimeout(()=>{var n;(n=this.appManager)==null||n.mainViewProxy.setCameraAndSize()},500))}moveCameraToContain(e){this.mainView.moveCameraToContain(e),setTimeout(()=>{var t;(t=this.appManager)==null||t.mainViewProxy.setCameraAndSize()},500)}convertToPointInWorld(e){return this.mainView.convertToPointInWorld(e)}setCameraBound(e){this.mainView.setCameraBound(e)}onDestroy(){this._destroy()}destroy(){this._destroy()}_destroy(){var e,t,i,n,r,s;(e=this.containerResizeObserver)==null||e.disconnect(),(t=this.appManager)==null||t.destroy(),(i=this.cursorManager)==null||i.destroy(),(n=this.extendPluginManager)==null||n.destroy(),O.container=void 0,O.wrapper=void 0,O.sizer=void 0,O.isCreated=!1,O.playground&&((r=O.playground.parentNode)==null||r.removeChild(O.playground)),O.params=void 0,(s=this._iframeBridge)==null||s.destroy(),this._iframeBridge=void 0,et("Destroyed")}bindMainView(e,t){var i;this.appManager&&(this.appManager.bindMainView(e,Boolean(t)),(i=this.cursorManager)==null||i.setMainViewDivElement(e))}get canOperate(){return b.isRoom(this.displayer)?this.displayer.isWritable&&this.displayer.phase===b.RoomPhase.Connected:!1}get room(){return this.displayer}safeSetAttributes(e){this.canOperate&&this.setAttributes(e)}safeUpdateAttributes(e,t){this.canOperate&&this.updateAttributes(e,t)}setPrefersColorScheme(e){var t,i;(i=(t=this.appManager)==null?void 0:t.boxManager)==null||i.setPrefersColorScheme(e)}cleanCurrentScene(){var e;et("clean current scene"),(e=this.focusedView)==null||e.cleanCurrentScene()}redo(){var e;return((e=this.focusedView)==null?void 0:e.redo())||0}undo(){var e;return((e=this.focusedView)==null?void 0:e.undo())||0}delete(){var e;(e=this.focusedView)==null||e.delete()}copy(){var e;(e=this.focusedView)==null||e.copy()}paste(){var e;(e=this.focusedView)==null||e.paste()}duplicate(){var e;(e=this.focusedView)==null||e.duplicate()}insertText(e,t,i){var n;return((n=this.focusedView)==null?void 0:n.insertText(e,t,i))||""}insertImage(e){var t;return(t=this.focusedView)==null?void 0:t.insertImage(e)}completeImageUpload(e,t){var i;return(i=this.focusedView)==null?void 0:i.completeImageUpload(e,t)}lockImage(e,t){var i;return(i=this.focusedView)==null?void 0:i.lockImage(e,t)}lockImages(e){var t;return(t=this.focusedView)==null?void 0:t.lockImages(e)}refresh(){var e;this._refresh(),(e=this.appManager)==null||e.dispatchInternalEvent(se.Refresh)}_refresh(){var e,t;(e=this.appManager)==null||e.mainViewProxy.rebind(),O.container&&this.bindContainer(O.container),(t=this.appManager)==null||t.refresher.refresh()}setContainerSizeRatio(e){if(!E.isNumber(e)||!(e>0))throw new Error(`[WindowManager]: updateContainerSizeRatio error, ratio must be a positive number. but got ${e}`);O.containerSizeRatio=e,this.containerSizeRatio=e,V.emit("containerSizeRatioUpdate",e)}isDynamicPPT(e){var i,n;const t=(n=(i=e[0])==null?void 0:i.ppt)==null?void 0:n.src;return t==null?void 0:t.startsWith("pptx://")}async ensureAttributes(){E.isNull(this.attributes)&&await Uh(50),E.isObject(this.attributes)&&(this.attributes[xe.Apps]||this.safeSetAttributes({[xe.Apps]:{}}),this.attributes[xe.Cursors]||this.safeSetAttributes({[xe.Cursors]:{}}),this.attributes._mainScenePath||this.safeSetAttributes({_mainScenePath:Vh}),this.attributes._mainSceneIndex||this.safeSetAttributes({_mainSceneIndex:0}),this.attributes[xe.Registered]||this.safeSetAttributes({[xe.Registered]:{}}),this.attributes[xe.IframeBridge]||this.safeSetAttributes({[xe.IframeBridge]:{}}))}getIframeBridge(){if(!this.appManager)throw new Error("[WindowManager]: should call getIframeBridge() after await mount()");return this._iframeBridge||(this._iframeBridge=new pn(this,this.appManager)),this._iframeBridge}useExtendPlugin(e){var t;(t=this.extendPluginManager)==null||t.use(e)}};let Q=O;Q.kind="WindowManager";Q.debug=!1;Q.containerSizeRatio=Ug;Q.isCreated=!1;Q._resolve=e=>{};nM();exports.AppContext=hr;exports.AppCreateError=$h;exports.AppManager=yr;exports.AppManagerNotInitError=Ve;exports.AppNotRegisterError=hm;exports.AppProxy=wr;exports.AttributesDelegate=vr;exports.BindContainerRoomPhaseInvalidError=Yh;exports.BoxManager=pr;exports.BoxManagerNotFoundError=Zh;exports.BoxNotCreatedError=Fh;exports.BuiltinApps=rM;exports.CursorManager=mr;exports.ExtendPlugin=oM;exports.ExtendPluginManager=bg;exports.InvalidScenePath=Qh;exports.ParamsInvalidError=Hh;exports.TeleBoxCollector=un;exports.TeleBoxManager=fr;exports.WhiteWebSDKInvalidError=Wh;exports.WindowManager=Q;exports.calculateNextIndex=Ml;exports.getExtendClass=aM;exports.reconnectRefresher=Ag;
49
49
  //# sourceMappingURL=index.js.map