livedesk 0.1.201 → 0.1.202

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.
@@ -0,0 +1,15 @@
1
+ import{r as zb,a as m,K as _b,S as $g,m as Nm,H as po,U as Ob,N as rv,F as ov,b as Bb,R as Du,L as lm,c as bu,C as qg,d as Am,A as Hb,e as Fb,f as cv,M as _a,g as Sa,h as du,T as Ib,i as wu,j as bo,X as Su,k as im,l as Ub,B as $b,n as fu,o as sm,p as mu,q as go,s as rm,t as xo,D as Ef,u as qb,v as Df,w as Gb,x as Rf,y as Pb,E as Yb,z as Gg,W as Vb,G as Pg,I as Vs,J as Qb,O as Kb,V as Yg,P as uv,Q as Vg,Y as Xb}from"./icons-CdoyEPi7.js";import{r as dv}from"./react-DyAxfjRM.js";import{c as Zb}from"./supabase-C7qjtLN3.js";(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))r(c);new MutationObserver(c=>{for(const d of c)if(d.type==="childList")for(const h of d.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&r(h)}).observe(document,{childList:!0,subtree:!0});function s(c){const d={};return c.integrity&&(d.integrity=c.integrity),c.referrerPolicy&&(d.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?d.credentials="include":c.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function r(c){if(c.ep)return;c.ep=!0;const d=s(c);fetch(c.href,d)}})();var Lf={exports:{}},co={};var Qg;function Wb(){if(Qg)return co;Qg=1;var a=Symbol.for("react.transitional.element"),l=Symbol.for("react.fragment");function s(r,c,d){var h=null;if(d!==void 0&&(h=""+d),c.key!==void 0&&(h=""+c.key),"key"in c){d={};for(var p in c)p!=="key"&&(d[p]=c[p])}else d=c;return c=d.ref,{$$typeof:a,type:r,key:h,ref:c!==void 0?c:null,props:d}}return co.Fragment=l,co.jsx=s,co.jsxs=s,co}var Kg;function Jb(){return Kg||(Kg=1,Lf.exports=Wb()),Lf.exports}var o=Jb(),zf={exports:{}},uo={},_f={exports:{}},Of={};var Xg;function e0(){return Xg||(Xg=1,(function(a){function l(I,Z){var ee=I.length;I.push(Z);e:for(;0<ee;){var _=ee-1>>>1,ae=I[_];if(0<c(ae,Z))I[_]=Z,I[ee]=ae,ee=_;else break e}}function s(I){return I.length===0?null:I[0]}function r(I){if(I.length===0)return null;var Z=I[0],ee=I.pop();if(ee!==Z){I[0]=ee;e:for(var _=0,ae=I.length,me=ae>>>1;_<me;){var z=2*(_+1)-1,ge=I[z],be=z+1,Me=I[be];if(0>c(ge,ee))be<ae&&0>c(Me,ge)?(I[_]=Me,I[be]=ee,_=be):(I[_]=ge,I[z]=ee,_=z);else if(be<ae&&0>c(Me,ee))I[_]=Me,I[be]=ee,_=be;else break e}}return Z}function c(I,Z){var ee=I.sortIndex-Z.sortIndex;return ee!==0?ee:I.id-Z.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;a.unstable_now=function(){return d.now()}}else{var h=Date,p=h.now();a.unstable_now=function(){return h.now()-p}}var g=[],x=[],y=1,v=null,w=3,M=!1,C=!1,j=!1,k=!1,T=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,L=typeof setImmediate<"u"?setImmediate:null;function q(I){for(var Z=s(x);Z!==null;){if(Z.callback===null)r(x);else if(Z.startTime<=I)r(x),Z.sortIndex=Z.expirationTime,l(g,Z);else break;Z=s(x)}}function U(I){if(j=!1,q(I),!C)if(s(g)!==null)C=!0,X||(X=!0,G());else{var Z=s(x);Z!==null&&fe(U,Z.startTime-I)}}var X=!1,E=-1,P=5,te=-1;function B(){return k?!0:!(a.unstable_now()-te<P)}function ue(){if(k=!1,X){var I=a.unstable_now();te=I;var Z=!0;try{e:{C=!1,j&&(j=!1,A(E),E=-1),M=!0;var ee=w;try{t:{for(q(I),v=s(g);v!==null&&!(v.expirationTime>I&&B());){var _=v.callback;if(typeof _=="function"){v.callback=null,w=v.priorityLevel;var ae=_(v.expirationTime<=I);if(I=a.unstable_now(),typeof ae=="function"){v.callback=ae,q(I),Z=!0;break t}v===s(g)&&r(g),q(I)}else r(g);v=s(g)}if(v!==null)Z=!0;else{var me=s(x);me!==null&&fe(U,me.startTime-I),Z=!1}}break e}finally{v=null,w=ee,M=!1}Z=void 0}}finally{Z?G():X=!1}}}var G;if(typeof L=="function")G=function(){L(ue)};else if(typeof MessageChannel<"u"){var de=new MessageChannel,re=de.port2;de.port1.onmessage=ue,G=function(){re.postMessage(null)}}else G=function(){T(ue,0)};function fe(I,Z){E=T(function(){I(a.unstable_now())},Z)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(I){I.callback=null},a.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P=0<I?Math.floor(1e3/I):5},a.unstable_getCurrentPriorityLevel=function(){return w},a.unstable_next=function(I){switch(w){case 1:case 2:case 3:var Z=3;break;default:Z=w}var ee=w;w=Z;try{return I()}finally{w=ee}},a.unstable_requestPaint=function(){k=!0},a.unstable_runWithPriority=function(I,Z){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var ee=w;w=I;try{return Z()}finally{w=ee}},a.unstable_scheduleCallback=function(I,Z,ee){var _=a.unstable_now();switch(typeof ee=="object"&&ee!==null?(ee=ee.delay,ee=typeof ee=="number"&&0<ee?_+ee:_):ee=_,I){case 1:var ae=-1;break;case 2:ae=250;break;case 5:ae=1073741823;break;case 4:ae=1e4;break;default:ae=5e3}return ae=ee+ae,I={id:y++,callback:Z,priorityLevel:I,startTime:ee,expirationTime:ae,sortIndex:-1},ee>_?(I.sortIndex=ee,l(x,I),s(g)===null&&I===s(x)&&(j?(A(E),E=-1):j=!0,fe(U,ee-_))):(I.sortIndex=ae,l(g,I),C||M||(C=!0,X||(X=!0,G()))),I},a.unstable_shouldYield=B,a.unstable_wrapCallback=function(I){var Z=w;return function(){var ee=w;w=Z;try{return I.apply(this,arguments)}finally{w=ee}}}})(Of)),Of}var Zg;function t0(){return Zg||(Zg=1,_f.exports=e0()),_f.exports}var Wg;function n0(){if(Wg)return uo;Wg=1;var a=t0(),l=zb(),s=dv();function r(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function d(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function h(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 p(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function g(e){if(d(e)!==e)throw Error(r(188))}function x(e){var t=e.alternate;if(!t){if(t=d(e),t===null)throw Error(r(188));return t!==e?null:e}for(var n=e,i=t;;){var u=n.return;if(u===null)break;var f=u.alternate;if(f===null){if(i=u.return,i!==null){n=i;continue}break}if(u.child===f.child){for(f=u.child;f;){if(f===n)return g(u),e;if(f===i)return g(u),t;f=f.sibling}throw Error(r(188))}if(n.return!==i.return)n=u,i=f;else{for(var b=!1,N=u.child;N;){if(N===n){b=!0,n=u,i=f;break}if(N===i){b=!0,i=u,n=f;break}N=N.sibling}if(!b){for(N=f.child;N;){if(N===n){b=!0,n=f,i=u;break}if(N===i){b=!0,i=f,n=u;break}N=N.sibling}if(!b)throw Error(r(189))}}if(n.alternate!==i)throw Error(r(190))}if(n.tag!==3)throw Error(r(188));return n.stateNode.current===n?e:t}function y(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=y(e),t!==null)return t;e=e.sibling}return null}var v=Object.assign,w=Symbol.for("react.element"),M=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),L=Symbol.for("react.context"),q=Symbol.for("react.forward_ref"),U=Symbol.for("react.suspense"),X=Symbol.for("react.suspense_list"),E=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),te=Symbol.for("react.activity"),B=Symbol.for("react.memo_cache_sentinel"),ue=Symbol.iterator;function G(e){return e===null||typeof e!="object"?null:(e=ue&&e[ue]||e["@@iterator"],typeof e=="function"?e:null)}var de=Symbol.for("react.client.reference");function re(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===de?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case j:return"Fragment";case T:return"Profiler";case k:return"StrictMode";case U:return"Suspense";case X:return"SuspenseList";case te:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case C:return"Portal";case L:return e.displayName||"Context";case A:return(e._context.displayName||"Context")+".Consumer";case q:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case E:return t=e.displayName||null,t!==null?t:re(e.type)||"Memo";case P:t=e._payload,e=e._init;try{return re(e(t))}catch{}}return null}var fe=Array.isArray,I=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee={pending:!1,data:null,method:null,action:null},_=[],ae=-1;function me(e){return{current:e}}function z(e){0>ae||(e.current=_[ae],_[ae]=null,ae--)}function ge(e,t){ae++,_[ae]=e.current,e.current=t}var be=me(null),Me=me(null),Fe=me(null),Ve=me(null);function Le(e,t){switch(ge(Fe,t),ge(Me,e),ge(be,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?dg(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=dg(t),e=fg(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}z(be),ge(be,e)}function Ee(){z(be),z(Me),z(Fe)}function qe(e){e.memoizedState!==null&&ge(Ve,e);var t=be.current,n=fg(t,e.type);t!==n&&(ge(Me,e),ge(be,n))}function ke(e){Me.current===e&&(z(be),z(Me)),Ve.current===e&&(z(Ve),io._currentValue=ee)}var gt,ie;function ve(e){if(gt===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);gt=t&&t[1]||"",ie=-1<n.stack.indexOf(`
2
+ at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
3
+ `+gt+e+ie}var Te=!1;function De(e,t){if(!e||Te)return"";Te=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(t){var ce=function(){throw Error()};if(Object.defineProperty(ce.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ce,[])}catch(J){var W=J}Reflect.construct(e,[],ce)}else{try{ce.call()}catch(J){W=J}e.call(ce.prototype)}}else{try{throw Error()}catch(J){W=J}(ce=e())&&typeof ce.catch=="function"&&ce.catch(function(){})}}catch(J){if(J&&W&&typeof J.stack=="string")return[J.stack,W.stack]}return[null,null]}};i.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(i.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(i.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var f=i.DetermineComponentFrameRoot(),b=f[0],N=f[1];if(b&&N){var R=b.split(`
4
+ `),K=N.split(`
5
+ `);for(u=i=0;i<R.length&&!R[i].includes("DetermineComponentFrameRoot");)i++;for(;u<K.length&&!K[u].includes("DetermineComponentFrameRoot");)u++;if(i===R.length||u===K.length)for(i=R.length-1,u=K.length-1;1<=i&&0<=u&&R[i]!==K[u];)u--;for(;1<=i&&0<=u;i--,u--)if(R[i]!==K[u]){if(i!==1||u!==1)do if(i--,u--,0>u||R[i]!==K[u]){var le=`
6
+ `+R[i].replace(" at new "," at ");return e.displayName&&le.includes("<anonymous>")&&(le=le.replace("<anonymous>",e.displayName)),le}while(1<=i&&0<=u);break}}}finally{Te=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?ve(n):""}function se(e,t){switch(e.tag){case 26:case 27:case 5:return ve(e.type);case 16:return ve("Lazy");case 13:return e.child!==t&&t!==null?ve("Suspense Fallback"):ve("Suspense");case 19:return ve("SuspenseList");case 0:case 15:return De(e.type,!1);case 11:return De(e.type.render,!1);case 1:return De(e.type,!0);case 31:return ve("Activity");default:return""}}function et(e){try{var t="",n=null;do t+=se(e,n),n=e,e=e.return;while(e);return t}catch(i){return`
7
+ Error generating stack: `+i.message+`
8
+ `+i.stack}}var Ce=Object.prototype.hasOwnProperty,It=a.unstable_scheduleCallback,Rt=a.unstable_cancelCallback,xe=a.unstable_shouldYield,He=a.unstable_requestPaint,ze=a.unstable_now,lt=a.unstable_getCurrentPriorityLevel,Mn=a.unstable_ImmediatePriority,it=a.unstable_UserBlockingPriority,Nn=a.unstable_NormalPriority,ja=a.unstable_LowPriority,Na=a.unstable_IdlePriority,An=a.log,el=a.unstable_setDisableYieldValue,Qn=null,ut=null;function hn(e){if(typeof An=="function"&&el(e),ut&&typeof ut.setStrictMode=="function")try{ut.setStrictMode(Qn,e)}catch{}}var Ot=Math.clz32?Math.clz32:Wi,Rl=Math.log,ir=Math.LN2;function Wi(e){return e>>>=0,e===0?32:31-(Rl(e)/ir|0)|0}var Ha=256,sa=262144,pn=4194304;function Tn(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function kn(e,t,n){var i=e.pendingLanes;if(i===0)return 0;var u=0,f=e.suspendedLanes,b=e.pingedLanes;e=e.warmLanes;var N=i&134217727;return N!==0?(i=N&~f,i!==0?u=Tn(i):(b&=N,b!==0?u=Tn(b):n||(n=N&~e,n!==0&&(u=Tn(n))))):(N=i&~f,N!==0?u=Tn(N):b!==0?u=Tn(b):n||(n=i&~e,n!==0&&(u=Tn(n)))),u===0?0:t!==0&&t!==u&&(t&f)===0&&(f=u&-u,n=t&-t,f>=n||f===32&&(n&4194048)!==0)?t:u}function ra(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function tl(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ll(){var e=pn;return pn<<=1,(pn&62914560)===0&&(pn=4194304),e}function Aa(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function oa(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function nl(e,t,n,i,u,f){var b=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var N=e.entanglements,R=e.expirationTimes,K=e.hiddenUpdates;for(n=b&~n;0<n;){var le=31-Ot(n),ce=1<<le;N[le]=0,R[le]=-1;var W=K[le];if(W!==null)for(K[le]=null,le=0;le<W.length;le++){var J=W[le];J!==null&&(J.lane&=-536870913)}n&=~ce}i!==0&&al(e,i,0),f!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=f&~(b&~t))}function al(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var i=31-Ot(t);e.entangledLanes|=t,e.entanglements[i]=e.entanglements[i]|1073741824|n&261930}function Kn(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var i=31-Ot(n),u=1<<i;u&t|e[i]&t&&(e[i]|=t),n&=~u}}function ll(e,t){var n=t&-t;return n=(n&42)!==0?1:En(n),(n&(e.suspendedLanes|t))!==0?0:n}function En(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Dn(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function gn(){var e=Z.p;return e!==0?e:(e=window.event,e===void 0?32:_g(e.type))}function wi(e,t){var n=Z.p;try{return Z.p=e,t()}finally{Z.p=n}}var Rn=Math.random().toString(36).slice(2),Y="__reactFiber$"+Rn,he="__reactProps$"+Rn,Se="__reactContainer$"+Rn,$e="__reactEvents$"+Rn,dt="__reactListeners$"+Rn,ft="__reactHandles$"+Rn,_e="__reactResources$"+Rn,st="__reactMarker$"+Rn;function ln(e){delete e[Y],delete e[he],delete e[$e],delete e[dt],delete e[ft]}function Ut(e){var t=e[Y];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Se]||n[Y]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=yg(e);e!==null;){if(n=e[Y])return n;e=yg(e)}return t}e=n,n=e.parentNode}return null}function Jt(e){if(e=e[Y]||e[Se]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function wt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(r(33))}function $t(e){var t=e[_e];return t||(t=e[_e]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Mt(e){e[st]=!0}var il=new Set,Ta={};function qt(e,t){Tt(e,t),Tt(e+"Capture",t)}function Tt(e,t){for(Ta[e]=t,e=0;e<t.length;e++)il.add(t[e])}var ca=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),ka={},zl={};function zo(e){return Ce.call(zl,e)?!0:Ce.call(ka,e)?!1:ca.test(e)?zl[e]=!0:(ka[e]=!0,!1)}function Fa(e,t,n){if(zo(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var i=t.toLowerCase().slice(0,5);if(i!=="data-"&&i!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+n)}}function Si(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+n)}}function ua(e,t,n,i){if(i===null)e.removeAttribute(n);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+i)}}function Oe(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function mt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function sr(e,t,n){var i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var u=i.get,f=i.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return u.call(this)},set:function(b){n=""+b,f.call(this,b)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return n},setValue:function(b){n=""+b},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function da(e){if(!e._valueTracker){var t=mt(e)?"checked":"value";e._valueTracker=sr(e,t,""+e[t])}}function We(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),i="";return e&&(i=mt(e)?e.checked?"true":"false":e.value),e=i,e!==n?(t.setValue(e),!0):!1}function Mi(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Iu=/[\n"\\]/g;function kt(e){return e.replace(Iu,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function sl(e,t,n,i,u,f,b,N){e.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.type=b:e.removeAttribute("type"),t!=null?b==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Oe(t)):e.value!==""+Oe(t)&&(e.value=""+Oe(t)):b!=="submit"&&b!=="reset"||e.removeAttribute("value"),t!=null?_l(e,b,Oe(t)):n!=null?_l(e,b,Oe(n)):i!=null&&e.removeAttribute("value"),u==null&&f!=null&&(e.defaultChecked=!!f),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?e.name=""+Oe(N):e.removeAttribute("name")}function Ji(e,t,n,i,u,f,b,N){if(f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(e.type=f),t!=null||n!=null){if(!(f!=="submit"&&f!=="reset"||t!=null)){da(e);return}n=n!=null?""+Oe(n):"",t=t!=null?""+Oe(t):n,N||t===e.value||(e.value=t),e.defaultValue=t}i=i??u,i=typeof i!="function"&&typeof i!="symbol"&&!!i,e.checked=N?e.checked:!!i,e.defaultChecked=!!i,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(e.name=b),da(e)}function _l(e,t,n){t==="number"&&Mi(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Xn(e,t,n,i){if(e=e.options,t){t={};for(var u=0;u<n.length;u++)t["$"+n[u]]=!0;for(n=0;n<e.length;n++)u=t.hasOwnProperty("$"+e[n].value),e[n].selected!==u&&(e[n].selected=u),u&&i&&(e[n].defaultSelected=!0)}else{for(n=""+Oe(n),t=null,u=0;u<e.length;u++){if(e[u].value===n){e[u].selected=!0,i&&(e[u].defaultSelected=!0);return}t!==null||e[u].disabled||(t=e[u])}t!==null&&(t.selected=!0)}}function fa(e,t,n){if(t!=null&&(t=""+Oe(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Oe(n):""}function rr(e,t,n,i){if(t==null){if(i!=null){if(n!=null)throw Error(r(92));if(fe(i)){if(1<i.length)throw Error(r(93));i=i[0]}n=i}n==null&&(n=""),t=n}n=Oe(t),e.defaultValue=n,i=e.textContent,i===n&&i!==""&&i!==null&&(e.value=i),da(e)}function Ln(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var _o=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function we(e,t,n){var i=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?i?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":i?e.setProperty(t,n):typeof n!="number"||n===0||_o.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function or(e,t,n){if(t!=null&&typeof t!="object")throw Error(r(62));if(e=e.style,n!=null){for(var i in n)!n.hasOwnProperty(i)||t!=null&&t.hasOwnProperty(i)||(i.indexOf("--")===0?e.setProperty(i,""):i==="float"?e.cssFloat="":e[i]="");for(var u in t)i=t[u],t.hasOwnProperty(u)&&n[u]!==i&&we(e,u,i)}else for(var f in t)t.hasOwnProperty(f)&&we(e,f,t[f])}function cr(e){if(e.indexOf("-")===-1)return!1;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 ma=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Uu=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Ol(e){return Uu.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function tt(){}var es=null;function ts(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Bl=null,St=null;function rl(e){var t=Jt(e);if(t&&(e=t.stateNode)){var n=e[he]||null;e:switch(e=t.stateNode,t.type){case"input":if(sl(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+kt(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var i=n[t];if(i!==e&&i.form===e.form){var u=i[he]||null;if(!u)throw Error(r(90));sl(i,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(t=0;t<n.length;t++)i=n[t],i.form===e.form&&We(i)}break e;case"textarea":fa(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&Xn(e,!!n.multiple,t,!1)}}}var ur=!1;function dr(e,t,n){if(ur)return e(t,n);ur=!0;try{var i=e(t);return i}finally{if(ur=!1,(Bl!==null||St!==null)&&(Dc(),Bl&&(t=Bl,e=St,St=Bl=null,rl(t),e)))for(t=0;t<e.length;t++)rl(e[t])}}function zn(e,t){var n=e.stateNode;if(n===null)return null;var i=n[he]||null;if(i===null)return null;n=i[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":(i=!i.disabled)||(e=e.type,i=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!i;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(r(231,t,typeof n));return n}var ha=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Hl=!1;if(ha)try{var pa={};Object.defineProperty(pa,"passive",{get:function(){Hl=!0}}),window.addEventListener("test",pa,pa),window.removeEventListener("test",pa,pa)}catch{Hl=!1}var Et=null,Ia=null,ns=null;function xn(){if(ns)return ns;var e,t=Ia,n=t.length,i,u="value"in Et?Et.value:Et.textContent,f=u.length;for(e=0;e<n&&t[e]===u[e];e++);var b=n-e;for(i=1;i<=b&&t[n-i]===u[f-i];i++);return ns=u.slice(e,1<i?1-i:void 0)}function as(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}function ls(){return!0}function Ci(){return!1}function Kt(e){function t(n,i,u,f,b){this._reactName=n,this._targetInst=u,this.type=i,this.nativeEvent=f,this.target=b,this.currentTarget=null;for(var N in e)e.hasOwnProperty(N)&&(n=e[N],this[N]=n?n(f):f[N]);return this.isDefaultPrevented=(f.defaultPrevented!=null?f.defaultPrevented:f.returnValue===!1)?ls:Ci,this.isPropagationStopped=Ci,this}return v(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=ls)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=ls)},persist:function(){},isPersistent:ls}),t}var Ua={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ea=Kt(Ua),Fl=v({},Ua,{view:0,detail:0}),Oo=Kt(Fl),fr,$a,ji,Ni=v({},Fl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:gr,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==ji&&(ji&&e.type==="mousemove"?(fr=e.screenX-ji.screenX,$a=e.screenY-ji.screenY):$a=fr=0,ji=e),fr)},movementY:function(e){return"movementY"in e?e.movementY:$a}}),Bo=Kt(Ni),$u=v({},Ni,{dataTransfer:0}),qu=Kt($u),Ho=v({},Fl,{relatedTarget:0}),ol=Kt(Ho),qa=v({},Ua,{animationName:0,elapsedTime:0,pseudoElement:0}),is=Kt(qa),Il=v({},Ua,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),cl=Kt(Il),mr=v({},Ua,{data:0}),Fo=Kt(mr),Io={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},hr={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"},pr={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Uo(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=pr[e])?!!t[e]:!1}function gr(){return Uo}var ss=v({},Fl,{key:function(e){if(e.key){var t=Io[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=as(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?hr[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:gr,charCode:function(e){return e.type==="keypress"?as(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?as(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),rs=Kt(ss),xr=v({},Ni,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),os=Kt(xr),cs=v({},Fl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:gr}),us=Kt(cs),Ai=v({},Ua,{propertyName:0,elapsedTime:0,pseudoElement:0}),ga=Kt(Ai),$o=v({},Ni,{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:0,deltaMode:0}),qo=Kt($o),vr=v({},Ua,{newState:0,oldState:0}),ds=Kt(vr),Gu=[9,13,27,32],Ga=ha&&"CompositionEvent"in window,Ti=null;ha&&"documentMode"in document&&(Ti=document.documentMode);var Ul=ha&&"TextEvent"in window&&!Ti,yr=ha&&(!Ga||Ti&&8<Ti&&11>=Ti),br=" ",$l=!1;function wr(e,t){switch(e){case"keyup":return Gu.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function fs(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ul=!1;function Pu(e,t){switch(e){case"compositionend":return fs(t);case"keypress":return t.which!==32?null:($l=!0,br);case"textInput":return e=t.data,e===br&&$l?null:e;default:return null}}function Sr(e,t){if(ul)return e==="compositionend"||!Ga&&wr(e,t)?(e=xn(),ns=Ia=Et=null,ul=!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 yr&&t.locale!=="ko"?null:t.data;default:return null}}var Yu={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 Mr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Yu[e.type]:t==="textarea"}function Cr(e,t,n,i){Bl?St?St.push(i):St=[i]:Bl=i,t=Hc(t,"onChange"),0<t.length&&(n=new Ea("onChange","change",null,n,i),e.push({event:n,listeners:t}))}var ql=null,ki=null;function ms(e){ig(e,0)}function Zn(e){var t=wt(e);if(We(t))return e}function Ei(e,t){if(e==="change")return t}var Go=!1;if(ha){var Di;if(ha){var Ri="oninput"in document;if(!Ri){var ye=document.createElement("div");ye.setAttribute("oninput","return;"),Ri=typeof ye.oninput=="function"}Di=Ri}else Di=!1;Go=Di&&(!document.documentMode||9<document.documentMode)}function Li(){ql&&(ql.detachEvent("onpropertychange",jr),ki=ql=null)}function jr(e){if(e.propertyName==="value"&&Zn(ki)){var t=[];Cr(t,ki,e,ts(e)),dr(ms,t)}}function Vu(e,t,n){e==="focusin"?(Li(),ql=t,ki=n,ql.attachEvent("onpropertychange",jr)):e==="focusout"&&Li()}function Vm(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Zn(ki)}function Nr(e,t){if(e==="click")return Zn(t)}function Qu(e,t){if(e==="input"||e==="change")return Zn(t)}function hs(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var rt=typeof Object.is=="function"?Object.is:hs;function Xt(e,t){if(rt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(i=0;i<n.length;i++){var u=n[i];if(!Ce.call(t,u)||!rt(e[u],t[u]))return!1}return!0}function Ye(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Po(e,t){var n=Ye(e);e=0;for(var i;n;){if(n.nodeType===3){if(i=e+n.textContent.length,e<=t&&i>=t)return{node:n,offset:t-e};e=i}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Ye(n)}}function Yo(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Yo(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Vo(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Mi(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Mi(e.document)}return t}function Ar(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 Ku=ha&&"documentMode"in document&&11>=document.documentMode,Gl=null,Tr=null,zi=null,kr=!1;function Qo(e,t,n){var i=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;kr||Gl==null||Gl!==Mi(i)||(i=Gl,"selectionStart"in i&&Ar(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}),zi&&Xt(zi,i)||(zi=i,i=Hc(Tr,"onSelect"),0<i.length&&(t=new Ea("onSelect","select",null,t,n),e.push({event:t,listeners:i}),t.target=Gl)))}function dl(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Pl={animationend:dl("Animation","AnimationEnd"),animationiteration:dl("Animation","AnimationIteration"),animationstart:dl("Animation","AnimationStart"),transitionrun:dl("Transition","TransitionRun"),transitionstart:dl("Transition","TransitionStart"),transitioncancel:dl("Transition","TransitionCancel"),transitionend:dl("Transition","TransitionEnd")},Er={},Ko={};ha&&(Ko=document.createElement("div").style,"AnimationEvent"in window||(delete Pl.animationend.animation,delete Pl.animationiteration.animation,delete Pl.animationstart.animation),"TransitionEvent"in window||delete Pl.transitionend.transition);function fl(e){if(Er[e])return Er[e];if(!Pl[e])return e;var t=Pl[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Ko)return Er[e]=t[n];return e}var Xo=fl("animationend"),ps=fl("animationiteration"),gs=fl("animationstart"),Xu=fl("transitionrun"),Zu=fl("transitionstart"),Wu=fl("transitioncancel"),Zo=fl("transitionend"),Wo=new Map,Dr="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Dr.push("scrollEnd");function Wn(e,t){Wo.set(e,t),qt(t,[e])}var xs=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Zt=[],ml=0,_i=0;function vs(){for(var e=ml,t=_i=ml=0;t<e;){var n=Zt[t];Zt[t++]=null;var i=Zt[t];Zt[t++]=null;var u=Zt[t];Zt[t++]=null;var f=Zt[t];if(Zt[t++]=null,i!==null&&u!==null){var b=i.pending;b===null?u.next=u:(u.next=b.next,b.next=u),i.pending=u}f!==0&&Jo(n,u,f)}}function ys(e,t,n,i){Zt[ml++]=e,Zt[ml++]=t,Zt[ml++]=n,Zt[ml++]=i,_i|=i,e.lanes|=i,e=e.alternate,e!==null&&(e.lanes|=i)}function bs(e,t,n,i){return ys(e,t,n,i),ws(e)}function xa(e,t){return ys(e,null,null,t),ws(e)}function Jo(e,t,n){e.lanes|=n;var i=e.alternate;i!==null&&(i.lanes|=n);for(var u=!1,f=e.return;f!==null;)f.childLanes|=n,i=f.alternate,i!==null&&(i.childLanes|=n),f.tag===22&&(e=f.stateNode,e===null||e._visibility&1||(u=!0)),e=f,f=f.return;return e.tag===3?(f=e.stateNode,u&&t!==null&&(u=31-Ot(n),e=f.hiddenUpdates,i=e[u],i===null?e[u]=[t]:i.push(t),t.lane=n|536870912),f):null}function ws(e){if(50<Wr)throw Wr=0,Jd=null,Error(r(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Lt={};function Ss(e,t,n,i){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function vn(e,t,n,i){return new Ss(e,t,n,i)}function Rr(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Pa(e,t){var n=e.alternate;return n===null?(n=vn(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function ec(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Ms(e,t,n,i,u,f){var b=0;if(i=e,typeof e=="function")Rr(e)&&(b=1);else if(typeof e=="string")b=Sb(e,n,be.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case te:return e=vn(31,n,t,u),e.elementType=te,e.lanes=f,e;case j:return Ya(n.children,u,f,t);case k:b=8,u|=24;break;case T:return e=vn(12,n,t,u|2),e.elementType=T,e.lanes=f,e;case U:return e=vn(13,n,t,u),e.elementType=U,e.lanes=f,e;case X:return e=vn(19,n,t,u),e.elementType=X,e.lanes=f,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case L:b=10;break e;case A:b=9;break e;case q:b=11;break e;case E:b=14;break e;case P:b=16,i=null;break e}b=29,n=Error(r(130,e===null?"null":typeof e,"")),i=null}return t=vn(b,n,t,u),t.elementType=e,t.type=i,t.lanes=f,t}function Ya(e,t,n,i){return e=vn(7,e,i,t),e.lanes=n,e}function Yl(e,t,n){return e=vn(6,e,null,t),e.lanes=n,e}function Vl(e){var t=vn(18,null,null,0);return t.stateNode=e,t}function Cs(e,t,n){return t=vn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var tc=new WeakMap;function _n(e,t){if(typeof e=="object"&&e!==null){var n=tc.get(e);return n!==void 0?n:(t={value:e,source:t,stack:et(t)},tc.set(e,t),t)}return{value:e,source:t,stack:et(t)}}var Ql=[],Kl=0,js=null,Oi=0,On=[],Ct=0,Va=null,va=1,sn="";function Da(e,t){Ql[Kl++]=Oi,Ql[Kl++]=js,js=e,Oi=t}function nc(e,t,n){On[Ct++]=va,On[Ct++]=sn,On[Ct++]=Va,Va=e;var i=va;e=sn;var u=32-Ot(i)-1;i&=~(1<<u),n+=1;var f=32-Ot(t)+u;if(30<f){var b=u-u%5;f=(i&(1<<b)-1).toString(32),i>>=b,u-=b,va=1<<32-Ot(t)+u|n<<u|i,sn=f+e}else va=1<<f|n<<u|i,sn=e}function S(e){e.return!==null&&(Da(e,1),nc(e,1,0))}function D(e){for(;e===js;)js=Ql[--Kl],Ql[Kl]=null,Oi=Ql[--Kl],Ql[Kl]=null;for(;e===Va;)Va=On[--Ct],On[Ct]=null,sn=On[--Ct],On[Ct]=null,va=On[--Ct],On[Ct]=null}function V(e,t){On[Ct++]=va,On[Ct++]=sn,On[Ct++]=Va,va=t.id,sn=t.overflow,Va=e}var H=null,F=null,ne=!1,pe=null,je=!1,Je=Error(r(519));function Ie(e){var t=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ra(_n(t,e)),Je}function Nt(e){var t=e.stateNode,n=e.type,i=e.memoizedProps;switch(t[Y]=e,t[he]=i,n){case"dialog":Ke("cancel",t),Ke("close",t);break;case"iframe":case"object":case"embed":Ke("load",t);break;case"video":case"audio":for(n=0;n<eo.length;n++)Ke(eo[n],t);break;case"source":Ke("error",t);break;case"img":case"image":case"link":Ke("error",t),Ke("load",t);break;case"details":Ke("toggle",t);break;case"input":Ke("invalid",t),Ji(t,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":Ke("invalid",t);break;case"textarea":Ke("invalid",t),rr(t,i.value,i.defaultValue,i.children)}n=i.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||i.suppressHydrationWarning===!0||cg(t.textContent,n)?(i.popover!=null&&(Ke("beforetoggle",t),Ke("toggle",t)),i.onScroll!=null&&Ke("scroll",t),i.onScrollEnd!=null&&Ke("scrollend",t),i.onClick!=null&&(t.onclick=tt),t=!0):t=!1,t||Ie(e,!0)}function rn(e){for(H=e.return;H;)switch(H.tag){case 5:case 31:case 13:je=!1;return;case 27:case 3:je=!0;return;default:H=H.return}}function Cn(e){if(e!==H)return!1;if(!ne)return rn(e),ne=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||pf(e.type,e.memoizedProps)),n=!n),n&&F&&Ie(e),rn(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));F=vg(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));F=vg(e)}else t===27?(t=F,ui(e.type)?(e=bf,bf=null,F=e):F=t):F=H?ba(e.stateNode.nextSibling):null;return!0}function on(){F=H=null,ne=!1}function hl(){var e=pe;return e!==null&&(In===null?In=e:In.push.apply(In,e),pe=null),e}function Ra(e){pe===null?pe=[e]:pe.push(e)}var Xl=me(null),pl=null,gl=null;function Zl(e,t,n){ge(Xl,t._currentValue),t._currentValue=n}function xl(e){e._currentValue=Xl.current,z(Xl)}function Ju(e,t,n){for(;e!==null;){var i=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,i!==null&&(i.childLanes|=t)):i!==null&&(i.childLanes&t)!==t&&(i.childLanes|=t),e===n)break;e=e.return}}function ed(e,t,n,i){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var f=u.dependencies;if(f!==null){var b=u.child;f=f.firstContext;e:for(;f!==null;){var N=f;f=u;for(var R=0;R<t.length;R++)if(N.context===t[R]){f.lanes|=n,N=f.alternate,N!==null&&(N.lanes|=n),Ju(f.return,n,e),i||(b=null);break e}f=N.next}}else if(u.tag===18){if(b=u.return,b===null)throw Error(r(341));b.lanes|=n,f=b.alternate,f!==null&&(f.lanes|=n),Ju(b,n,e),b=null}else b=u.child;if(b!==null)b.return=u;else for(b=u;b!==null;){if(b===e){b=null;break}if(u=b.sibling,u!==null){u.return=b.return,b=u;break}b=b.return}u=b}}function Ns(e,t,n,i){e=null;for(var u=t,f=!1;u!==null;){if(!f){if((u.flags&524288)!==0)f=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var b=u.alternate;if(b===null)throw Error(r(387));if(b=b.memoizedProps,b!==null){var N=u.type;rt(u.pendingProps.value,b.value)||(e!==null?e.push(N):e=[N])}}else if(u===Ve.current){if(b=u.alternate,b===null)throw Error(r(387));b.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(io):e=[io])}u=u.return}e!==null&&ed(t,e,n,i),t.flags|=262144}function ac(e){for(e=e.firstContext;e!==null;){if(!rt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Bi(e){pl=e,gl=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function cn(e){return Qm(pl,e)}function lc(e,t){return pl===null&&Bi(e),Qm(e,t)}function Qm(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},gl===null){if(e===null)throw Error(r(308));gl=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else gl=gl.next=t;return n}var vy=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,i){e.push(i)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},yy=a.unstable_scheduleCallback,by=a.unstable_NormalPriority,Gt={$$typeof:L,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function td(){return{controller:new vy,data:new Map,refCount:0}}function Lr(e){e.refCount--,e.refCount===0&&yy(by,function(){e.controller.abort()})}var zr=null,nd=0,As=0,Ts=null;function wy(e,t){if(zr===null){var n=zr=[];nd=0,As=sf(),Ts={status:"pending",value:void 0,then:function(i){n.push(i)}}}return nd++,t.then(Km,Km),t}function Km(){if(--nd===0&&zr!==null){Ts!==null&&(Ts.status="fulfilled");var e=zr;zr=null,As=0,Ts=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Sy(e,t){var n=[],i={status:"pending",value:null,reason:null,then:function(u){n.push(u)}};return e.then(function(){i.status="fulfilled",i.value=t;for(var u=0;u<n.length;u++)(0,n[u])(t)},function(u){for(i.status="rejected",i.reason=u,u=0;u<n.length;u++)(0,n[u])(void 0)}),i}var Xm=I.S;I.S=function(e,t){Lp=ze(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&wy(e,t),Xm!==null&&Xm(e,t)};var Hi=me(null);function ad(){var e=Hi.current;return e!==null?e:bt.pooledCache}function ic(e,t){t===null?ge(Hi,Hi.current):ge(Hi,t.pool)}function Zm(){var e=ad();return e===null?null:{parent:Gt._currentValue,pool:e}}var ks=Error(r(460)),ld=Error(r(474)),sc=Error(r(542)),rc={then:function(){}};function Wm(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Jm(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(tt,tt),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,th(e),e;default:if(typeof t.status=="string")t.then(tt,tt);else{if(e=bt,e!==null&&100<e.shellSuspendCounter)throw Error(r(482));e=t,e.status="pending",e.then(function(i){if(t.status==="pending"){var u=t;u.status="fulfilled",u.value=i}},function(i){if(t.status==="pending"){var u=t;u.status="rejected",u.reason=i}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,th(e),e}throw Ii=t,ks}}function Fi(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Ii=n,ks):n}}var Ii=null;function eh(){if(Ii===null)throw Error(r(459));var e=Ii;return Ii=null,e}function th(e){if(e===ks||e===sc)throw Error(r(483))}var Es=null,_r=0;function oc(e){var t=_r;return _r+=1,Es===null&&(Es=[]),Jm(Es,e,t)}function Or(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function cc(e,t){throw t.$$typeof===w?Error(r(525)):(e=Object.prototype.toString.call(t),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function nh(e){function t($,O){if(e){var Q=$.deletions;Q===null?($.deletions=[O],$.flags|=16):Q.push(O)}}function n($,O){if(!e)return null;for(;O!==null;)t($,O),O=O.sibling;return null}function i($){for(var O=new Map;$!==null;)$.key!==null?O.set($.key,$):O.set($.index,$),$=$.sibling;return O}function u($,O){return $=Pa($,O),$.index=0,$.sibling=null,$}function f($,O,Q){return $.index=Q,e?(Q=$.alternate,Q!==null?(Q=Q.index,Q<O?($.flags|=67108866,O):Q):($.flags|=67108866,O)):($.flags|=1048576,O)}function b($){return e&&$.alternate===null&&($.flags|=67108866),$}function N($,O,Q,oe){return O===null||O.tag!==6?(O=Yl(Q,$.mode,oe),O.return=$,O):(O=u(O,Q),O.return=$,O)}function R($,O,Q,oe){var Re=Q.type;return Re===j?le($,O,Q.props.children,oe,Q.key):O!==null&&(O.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===P&&Fi(Re)===O.type)?(O=u(O,Q.props),Or(O,Q),O.return=$,O):(O=Ms(Q.type,Q.key,Q.props,null,$.mode,oe),Or(O,Q),O.return=$,O)}function K($,O,Q,oe){return O===null||O.tag!==4||O.stateNode.containerInfo!==Q.containerInfo||O.stateNode.implementation!==Q.implementation?(O=Cs(Q,$.mode,oe),O.return=$,O):(O=u(O,Q.children||[]),O.return=$,O)}function le($,O,Q,oe,Re){return O===null||O.tag!==7?(O=Ya(Q,$.mode,oe,Re),O.return=$,O):(O=u(O,Q),O.return=$,O)}function ce($,O,Q){if(typeof O=="string"&&O!==""||typeof O=="number"||typeof O=="bigint")return O=Yl(""+O,$.mode,Q),O.return=$,O;if(typeof O=="object"&&O!==null){switch(O.$$typeof){case M:return Q=Ms(O.type,O.key,O.props,null,$.mode,Q),Or(Q,O),Q.return=$,Q;case C:return O=Cs(O,$.mode,Q),O.return=$,O;case P:return O=Fi(O),ce($,O,Q)}if(fe(O)||G(O))return O=Ya(O,$.mode,Q,null),O.return=$,O;if(typeof O.then=="function")return ce($,oc(O),Q);if(O.$$typeof===L)return ce($,lc($,O),Q);cc($,O)}return null}function W($,O,Q,oe){var Re=O!==null?O.key:null;if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return Re!==null?null:N($,O,""+Q,oe);if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case M:return Q.key===Re?R($,O,Q,oe):null;case C:return Q.key===Re?K($,O,Q,oe):null;case P:return Q=Fi(Q),W($,O,Q,oe)}if(fe(Q)||G(Q))return Re!==null?null:le($,O,Q,oe,null);if(typeof Q.then=="function")return W($,O,oc(Q),oe);if(Q.$$typeof===L)return W($,O,lc($,Q),oe);cc($,Q)}return null}function J($,O,Q,oe,Re){if(typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint")return $=$.get(Q)||null,N(O,$,""+oe,Re);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case M:return $=$.get(oe.key===null?Q:oe.key)||null,R(O,$,oe,Re);case C:return $=$.get(oe.key===null?Q:oe.key)||null,K(O,$,oe,Re);case P:return oe=Fi(oe),J($,O,Q,oe,Re)}if(fe(oe)||G(oe))return $=$.get(Q)||null,le(O,$,oe,Re,null);if(typeof oe.then=="function")return J($,O,Q,oc(oe),Re);if(oe.$$typeof===L)return J($,O,Q,lc(O,oe),Re);cc(O,oe)}return null}function Ne($,O,Q,oe){for(var Re=null,nt=null,Ae=O,Pe=O=0,Ze=null;Ae!==null&&Pe<Q.length;Pe++){Ae.index>Pe?(Ze=Ae,Ae=null):Ze=Ae.sibling;var at=W($,Ae,Q[Pe],oe);if(at===null){Ae===null&&(Ae=Ze);break}e&&Ae&&at.alternate===null&&t($,Ae),O=f(at,O,Pe),nt===null?Re=at:nt.sibling=at,nt=at,Ae=Ze}if(Pe===Q.length)return n($,Ae),ne&&Da($,Pe),Re;if(Ae===null){for(;Pe<Q.length;Pe++)Ae=ce($,Q[Pe],oe),Ae!==null&&(O=f(Ae,O,Pe),nt===null?Re=Ae:nt.sibling=Ae,nt=Ae);return ne&&Da($,Pe),Re}for(Ae=i(Ae);Pe<Q.length;Pe++)Ze=J(Ae,$,Pe,Q[Pe],oe),Ze!==null&&(e&&Ze.alternate!==null&&Ae.delete(Ze.key===null?Pe:Ze.key),O=f(Ze,O,Pe),nt===null?Re=Ze:nt.sibling=Ze,nt=Ze);return e&&Ae.forEach(function(pi){return t($,pi)}),ne&&Da($,Pe),Re}function Be($,O,Q,oe){if(Q==null)throw Error(r(151));for(var Re=null,nt=null,Ae=O,Pe=O=0,Ze=null,at=Q.next();Ae!==null&&!at.done;Pe++,at=Q.next()){Ae.index>Pe?(Ze=Ae,Ae=null):Ze=Ae.sibling;var pi=W($,Ae,at.value,oe);if(pi===null){Ae===null&&(Ae=Ze);break}e&&Ae&&pi.alternate===null&&t($,Ae),O=f(pi,O,Pe),nt===null?Re=pi:nt.sibling=pi,nt=pi,Ae=Ze}if(at.done)return n($,Ae),ne&&Da($,Pe),Re;if(Ae===null){for(;!at.done;Pe++,at=Q.next())at=ce($,at.value,oe),at!==null&&(O=f(at,O,Pe),nt===null?Re=at:nt.sibling=at,nt=at);return ne&&Da($,Pe),Re}for(Ae=i(Ae);!at.done;Pe++,at=Q.next())at=J(Ae,$,Pe,at.value,oe),at!==null&&(e&&at.alternate!==null&&Ae.delete(at.key===null?Pe:at.key),O=f(at,O,Pe),nt===null?Re=at:nt.sibling=at,nt=at);return e&&Ae.forEach(function(Lb){return t($,Lb)}),ne&&Da($,Pe),Re}function yt($,O,Q,oe){if(typeof Q=="object"&&Q!==null&&Q.type===j&&Q.key===null&&(Q=Q.props.children),typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case M:e:{for(var Re=Q.key;O!==null;){if(O.key===Re){if(Re=Q.type,Re===j){if(O.tag===7){n($,O.sibling),oe=u(O,Q.props.children),oe.return=$,$=oe;break e}}else if(O.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===P&&Fi(Re)===O.type){n($,O.sibling),oe=u(O,Q.props),Or(oe,Q),oe.return=$,$=oe;break e}n($,O);break}else t($,O);O=O.sibling}Q.type===j?(oe=Ya(Q.props.children,$.mode,oe,Q.key),oe.return=$,$=oe):(oe=Ms(Q.type,Q.key,Q.props,null,$.mode,oe),Or(oe,Q),oe.return=$,$=oe)}return b($);case C:e:{for(Re=Q.key;O!==null;){if(O.key===Re)if(O.tag===4&&O.stateNode.containerInfo===Q.containerInfo&&O.stateNode.implementation===Q.implementation){n($,O.sibling),oe=u(O,Q.children||[]),oe.return=$,$=oe;break e}else{n($,O);break}else t($,O);O=O.sibling}oe=Cs(Q,$.mode,oe),oe.return=$,$=oe}return b($);case P:return Q=Fi(Q),yt($,O,Q,oe)}if(fe(Q))return Ne($,O,Q,oe);if(G(Q)){if(Re=G(Q),typeof Re!="function")throw Error(r(150));return Q=Re.call(Q),Be($,O,Q,oe)}if(typeof Q.then=="function")return yt($,O,oc(Q),oe);if(Q.$$typeof===L)return yt($,O,lc($,Q),oe);cc($,Q)}return typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint"?(Q=""+Q,O!==null&&O.tag===6?(n($,O.sibling),oe=u(O,Q),oe.return=$,$=oe):(n($,O),oe=Yl(Q,$.mode,oe),oe.return=$,$=oe),b($)):n($,O)}return function($,O,Q,oe){try{_r=0;var Re=yt($,O,Q,oe);return Es=null,Re}catch(Ae){if(Ae===ks||Ae===sc)throw Ae;var nt=vn(29,Ae,null,$.mode);return nt.lanes=oe,nt.return=$,nt}}}var Ui=nh(!0),ah=nh(!1),Wl=!1;function id(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function sd(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Jl(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ei(e,t,n){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,(ot&2)!==0){var u=i.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),i.pending=t,t=ws(e),Jo(e,null,n),t}return ys(e,i,t,n),ws(e)}function Br(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var i=t.lanes;i&=e.pendingLanes,n|=i,t.lanes=n,Kn(e,n)}}function rd(e,t){var n=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,n===i)){var u=null,f=null;if(n=n.firstBaseUpdate,n!==null){do{var b={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};f===null?u=f=b:f=f.next=b,n=n.next}while(n!==null);f===null?u=f=t:f=f.next=t}else u=f=t;n={baseState:i.baseState,firstBaseUpdate:u,lastBaseUpdate:f,shared:i.shared,callbacks:i.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var od=!1;function Hr(){if(od){var e=Ts;if(e!==null)throw e}}function Fr(e,t,n,i){od=!1;var u=e.updateQueue;Wl=!1;var f=u.firstBaseUpdate,b=u.lastBaseUpdate,N=u.shared.pending;if(N!==null){u.shared.pending=null;var R=N,K=R.next;R.next=null,b===null?f=K:b.next=K,b=R;var le=e.alternate;le!==null&&(le=le.updateQueue,N=le.lastBaseUpdate,N!==b&&(N===null?le.firstBaseUpdate=K:N.next=K,le.lastBaseUpdate=R))}if(f!==null){var ce=u.baseState;b=0,le=K=R=null,N=f;do{var W=N.lane&-536870913,J=W!==N.lane;if(J?(Xe&W)===W:(i&W)===W){W!==0&&W===As&&(od=!0),le!==null&&(le=le.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var Ne=e,Be=N;W=t;var yt=n;switch(Be.tag){case 1:if(Ne=Be.payload,typeof Ne=="function"){ce=Ne.call(yt,ce,W);break e}ce=Ne;break e;case 3:Ne.flags=Ne.flags&-65537|128;case 0:if(Ne=Be.payload,W=typeof Ne=="function"?Ne.call(yt,ce,W):Ne,W==null)break e;ce=v({},ce,W);break e;case 2:Wl=!0}}W=N.callback,W!==null&&(e.flags|=64,J&&(e.flags|=8192),J=u.callbacks,J===null?u.callbacks=[W]:J.push(W))}else J={lane:W,tag:N.tag,payload:N.payload,callback:N.callback,next:null},le===null?(K=le=J,R=ce):le=le.next=J,b|=W;if(N=N.next,N===null){if(N=u.shared.pending,N===null)break;J=N,N=J.next,J.next=null,u.lastBaseUpdate=J,u.shared.pending=null}}while(!0);le===null&&(R=ce),u.baseState=R,u.firstBaseUpdate=K,u.lastBaseUpdate=le,f===null&&(u.shared.lanes=0),ii|=b,e.lanes=b,e.memoizedState=ce}}function lh(e,t){if(typeof e!="function")throw Error(r(191,e));e.call(t)}function ih(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)lh(n[e],t)}var Ds=me(null),uc=me(0);function sh(e,t){e=Nl,ge(uc,e),ge(Ds,t),Nl=e|t.baseLanes}function cd(){ge(uc,Nl),ge(Ds,Ds.current)}function ud(){Nl=uc.current,z(Ds),z(uc)}var Jn=me(null),ya=null;function ti(e){var t=e.alternate;ge(Bt,Bt.current&1),ge(Jn,e),ya===null&&(t===null||Ds.current!==null||t.memoizedState!==null)&&(ya=e)}function dd(e){ge(Bt,Bt.current),ge(Jn,e),ya===null&&(ya=e)}function rh(e){e.tag===22?(ge(Bt,Bt.current),ge(Jn,e),ya===null&&(ya=e)):ni()}function ni(){ge(Bt,Bt.current),ge(Jn,Jn.current)}function ea(e){z(Jn),ya===e&&(ya=null),z(Bt)}var Bt=me(0);function dc(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||vf(n)||yf(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==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}var vl=0,Ge=null,xt=null,Pt=null,fc=!1,Rs=!1,$i=!1,mc=0,Ir=0,Ls=null,My=0;function zt(){throw Error(r(321))}function fd(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!rt(e[n],t[n]))return!1;return!0}function md(e,t,n,i,u,f){return vl=f,Ge=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,I.H=e===null||e.memoizedState===null?Gh:Td,$i=!1,f=n(i,u),$i=!1,Rs&&(f=ch(t,n,i,u)),oh(e),f}function oh(e){I.H=qr;var t=xt!==null&&xt.next!==null;if(vl=0,Pt=xt=Ge=null,fc=!1,Ir=0,Ls=null,t)throw Error(r(300));e===null||Yt||(e=e.dependencies,e!==null&&ac(e)&&(Yt=!0))}function ch(e,t,n,i){Ge=e;var u=0;do{if(Rs&&(Ls=null),Ir=0,Rs=!1,25<=u)throw Error(r(301));if(u+=1,Pt=xt=null,e.updateQueue!=null){var f=e.updateQueue;f.lastEffect=null,f.events=null,f.stores=null,f.memoCache!=null&&(f.memoCache.index=0)}I.H=Ph,f=t(n,i)}while(Rs);return f}function Cy(){var e=I.H,t=e.useState()[0];return t=typeof t.then=="function"?Ur(t):t,e=e.useState()[0],(xt!==null?xt.memoizedState:null)!==e&&(Ge.flags|=1024),t}function hd(){var e=mc!==0;return mc=0,e}function pd(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function gd(e){if(fc){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}fc=!1}vl=0,Pt=xt=Ge=null,Rs=!1,Ir=mc=0,Ls=null}function jn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Pt===null?Ge.memoizedState=Pt=e:Pt=Pt.next=e,Pt}function Ht(){if(xt===null){var e=Ge.alternate;e=e!==null?e.memoizedState:null}else e=xt.next;var t=Pt===null?Ge.memoizedState:Pt.next;if(t!==null)Pt=t,xt=e;else{if(e===null)throw Ge.alternate===null?Error(r(467)):Error(r(310));xt=e,e={memoizedState:xt.memoizedState,baseState:xt.baseState,baseQueue:xt.baseQueue,queue:xt.queue,next:null},Pt===null?Ge.memoizedState=Pt=e:Pt=Pt.next=e}return Pt}function hc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ur(e){var t=Ir;return Ir+=1,Ls===null&&(Ls=[]),e=Jm(Ls,e,t),t=Ge,(Pt===null?t.memoizedState:Pt.next)===null&&(t=t.alternate,I.H=t===null||t.memoizedState===null?Gh:Td),e}function pc(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Ur(e);if(e.$$typeof===L)return cn(e)}throw Error(r(438,String(e)))}function xd(e){var t=null,n=Ge.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var i=Ge.alternate;i!==null&&(i=i.updateQueue,i!==null&&(i=i.memoCache,i!=null&&(t={data:i.data.map(function(u){return u.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=hc(),Ge.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),i=0;i<e;i++)n[i]=B;return t.index++,n}function yl(e,t){return typeof t=="function"?t(e):t}function gc(e){var t=Ht();return vd(t,xt,e)}function vd(e,t,n){var i=e.queue;if(i===null)throw Error(r(311));i.lastRenderedReducer=n;var u=e.baseQueue,f=i.pending;if(f!==null){if(u!==null){var b=u.next;u.next=f.next,f.next=b}t.baseQueue=u=f,i.pending=null}if(f=e.baseState,u===null)e.memoizedState=f;else{t=u.next;var N=b=null,R=null,K=t,le=!1;do{var ce=K.lane&-536870913;if(ce!==K.lane?(Xe&ce)===ce:(vl&ce)===ce){var W=K.revertLane;if(W===0)R!==null&&(R=R.next={lane:0,revertLane:0,gesture:null,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null}),ce===As&&(le=!0);else if((vl&W)===W){K=K.next,W===As&&(le=!0);continue}else ce={lane:0,revertLane:K.revertLane,gesture:null,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null},R===null?(N=R=ce,b=f):R=R.next=ce,Ge.lanes|=W,ii|=W;ce=K.action,$i&&n(f,ce),f=K.hasEagerState?K.eagerState:n(f,ce)}else W={lane:ce,revertLane:K.revertLane,gesture:K.gesture,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null},R===null?(N=R=W,b=f):R=R.next=W,Ge.lanes|=ce,ii|=ce;K=K.next}while(K!==null&&K!==t);if(R===null?b=f:R.next=N,!rt(f,e.memoizedState)&&(Yt=!0,le&&(n=Ts,n!==null)))throw n;e.memoizedState=f,e.baseState=b,e.baseQueue=R,i.lastRenderedState=f}return u===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function yd(e){var t=Ht(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=n.dispatch,u=n.pending,f=t.memoizedState;if(u!==null){n.pending=null;var b=u=u.next;do f=e(f,b.action),b=b.next;while(b!==u);rt(f,t.memoizedState)||(Yt=!0),t.memoizedState=f,t.baseQueue===null&&(t.baseState=f),n.lastRenderedState=f}return[f,i]}function uh(e,t,n){var i=Ge,u=Ht(),f=ne;if(f){if(n===void 0)throw Error(r(407));n=n()}else n=t();var b=!rt((xt||u).memoizedState,n);if(b&&(u.memoizedState=n,Yt=!0),u=u.queue,Sd(mh.bind(null,i,u,e),[e]),u.getSnapshot!==t||b||Pt!==null&&Pt.memoizedState.tag&1){if(i.flags|=2048,zs(9,{destroy:void 0},fh.bind(null,i,u,n,t),null),bt===null)throw Error(r(349));f||(vl&127)!==0||dh(i,t,n)}return n}function dh(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Ge.updateQueue,t===null?(t=hc(),Ge.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function fh(e,t,n,i){t.value=n,t.getSnapshot=i,hh(t)&&ph(e)}function mh(e,t,n){return n(function(){hh(t)&&ph(e)})}function hh(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!rt(e,n)}catch{return!0}}function ph(e){var t=xa(e,2);t!==null&&Un(t,e,2)}function bd(e){var t=jn();if(typeof e=="function"){var n=e;if(e=n(),$i){hn(!0);try{n()}finally{hn(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:yl,lastRenderedState:e},t}function gh(e,t,n,i){return e.baseState=n,vd(e,xt,typeof i=="function"?i:yl)}function jy(e,t,n,i,u){if(yc(e))throw Error(r(485));if(e=t.action,e!==null){var f={payload:u,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(b){f.listeners.push(b)}};I.T!==null?n(!0):f.isTransition=!1,i(f),n=t.pending,n===null?(f.next=t.pending=f,xh(t,f)):(f.next=n.next,t.pending=n.next=f)}}function xh(e,t){var n=t.action,i=t.payload,u=e.state;if(t.isTransition){var f=I.T,b={};I.T=b;try{var N=n(u,i),R=I.S;R!==null&&R(b,N),vh(e,t,N)}catch(K){wd(e,t,K)}finally{f!==null&&b.types!==null&&(f.types=b.types),I.T=f}}else try{f=n(u,i),vh(e,t,f)}catch(K){wd(e,t,K)}}function vh(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(i){yh(e,t,i)},function(i){return wd(e,t,i)}):yh(e,t,n)}function yh(e,t,n){t.status="fulfilled",t.value=n,bh(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,xh(e,n)))}function wd(e,t,n){var i=e.pending;if(e.pending=null,i!==null){i=i.next;do t.status="rejected",t.reason=n,bh(t),t=t.next;while(t!==i)}e.action=null}function bh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function wh(e,t){return t}function Sh(e,t){if(ne){var n=bt.formState;if(n!==null){e:{var i=Ge;if(ne){if(F){t:{for(var u=F,f=je;u.nodeType!==8;){if(!f){u=null;break t}if(u=ba(u.nextSibling),u===null){u=null;break t}}f=u.data,u=f==="F!"||f==="F"?u:null}if(u){F=ba(u.nextSibling),i=u.data==="F!";break e}}Ie(i)}i=!1}i&&(t=n[0])}}return n=jn(),n.memoizedState=n.baseState=t,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:wh,lastRenderedState:t},n.queue=i,n=Uh.bind(null,Ge,i),i.dispatch=n,i=bd(!1),f=Ad.bind(null,Ge,!1,i.queue),i=jn(),u={state:t,dispatch:null,action:e,pending:null},i.queue=u,n=jy.bind(null,Ge,u,f,n),u.dispatch=n,i.memoizedState=e,[t,n,!1]}function Mh(e){var t=Ht();return Ch(t,xt,e)}function Ch(e,t,n){if(t=vd(e,t,wh)[0],e=gc(yl)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var i=Ur(t)}catch(b){throw b===ks?sc:b}else i=t;t=Ht();var u=t.queue,f=u.dispatch;return n!==t.memoizedState&&(Ge.flags|=2048,zs(9,{destroy:void 0},Ny.bind(null,u,n),null)),[i,f,e]}function Ny(e,t){e.action=t}function jh(e){var t=Ht(),n=xt;if(n!==null)return Ch(t,n,e);Ht(),t=t.memoizedState,n=Ht();var i=n.queue.dispatch;return n.memoizedState=e,[t,i,!1]}function zs(e,t,n,i){return e={tag:e,create:n,deps:i,inst:t,next:null},t=Ge.updateQueue,t===null&&(t=hc(),Ge.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(i=n.next,n.next=e,e.next=i,t.lastEffect=e),e}function Nh(){return Ht().memoizedState}function xc(e,t,n,i){var u=jn();Ge.flags|=e,u.memoizedState=zs(1|t,{destroy:void 0},n,i===void 0?null:i)}function vc(e,t,n,i){var u=Ht();i=i===void 0?null:i;var f=u.memoizedState.inst;xt!==null&&i!==null&&fd(i,xt.memoizedState.deps)?u.memoizedState=zs(t,f,n,i):(Ge.flags|=e,u.memoizedState=zs(1|t,f,n,i))}function Ah(e,t){xc(8390656,8,e,t)}function Sd(e,t){vc(2048,8,e,t)}function Ay(e){Ge.flags|=4;var t=Ge.updateQueue;if(t===null)t=hc(),Ge.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Th(e){var t=Ht().memoizedState;return Ay({ref:t,nextImpl:e}),function(){if((ot&2)!==0)throw Error(r(440));return t.impl.apply(void 0,arguments)}}function kh(e,t){return vc(4,2,e,t)}function Eh(e,t){return vc(4,4,e,t)}function Dh(e,t){if(typeof t=="function"){e=e();var n=t(e);return function(){typeof n=="function"?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Rh(e,t,n){n=n!=null?n.concat([e]):null,vc(4,4,Dh.bind(null,t,e),n)}function Md(){}function Lh(e,t){var n=Ht();t=t===void 0?null:t;var i=n.memoizedState;return t!==null&&fd(t,i[1])?i[0]:(n.memoizedState=[e,t],e)}function zh(e,t){var n=Ht();t=t===void 0?null:t;var i=n.memoizedState;if(t!==null&&fd(t,i[1]))return i[0];if(i=e(),$i){hn(!0);try{e()}finally{hn(!1)}}return n.memoizedState=[i,t],i}function Cd(e,t,n){return n===void 0||(vl&1073741824)!==0&&(Xe&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=_p(),Ge.lanes|=e,ii|=e,n)}function _h(e,t,n,i){return rt(n,t)?n:Ds.current!==null?(e=Cd(e,n,i),rt(e,t)||(Yt=!0),e):(vl&42)===0||(vl&1073741824)!==0&&(Xe&261930)===0?(Yt=!0,e.memoizedState=n):(e=_p(),Ge.lanes|=e,ii|=e,t)}function Oh(e,t,n,i,u){var f=Z.p;Z.p=f!==0&&8>f?f:8;var b=I.T,N={};I.T=N,Ad(e,!1,t,n);try{var R=u(),K=I.S;if(K!==null&&K(N,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var le=Sy(R,i);$r(e,t,le,aa(e))}else $r(e,t,i,aa(e))}catch(ce){$r(e,t,{then:function(){},status:"rejected",reason:ce},aa())}finally{Z.p=f,b!==null&&N.types!==null&&(b.types=N.types),I.T=b}}function Ty(){}function jd(e,t,n,i){if(e.tag!==5)throw Error(r(476));var u=Bh(e).queue;Oh(e,u,t,ee,n===null?Ty:function(){return Hh(e),n(i)})}function Bh(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ee,baseState:ee,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:yl,lastRenderedState:ee},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:yl,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Hh(e){var t=Bh(e);t.next===null&&(t=e.alternate.memoizedState),$r(e,t.next.queue,{},aa())}function Nd(){return cn(io)}function Fh(){return Ht().memoizedState}function Ih(){return Ht().memoizedState}function ky(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=aa();e=Jl(n);var i=ei(t,e,n);i!==null&&(Un(i,t,n),Br(i,t,n)),t={cache:td()},e.payload=t;return}t=t.return}}function Ey(e,t,n){var i=aa();n={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},yc(e)?$h(t,n):(n=bs(e,t,n,i),n!==null&&(Un(n,e,i),qh(n,t,i)))}function Uh(e,t,n){var i=aa();$r(e,t,n,i)}function $r(e,t,n,i){var u={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(yc(e))$h(t,u);else{var f=e.alternate;if(e.lanes===0&&(f===null||f.lanes===0)&&(f=t.lastRenderedReducer,f!==null))try{var b=t.lastRenderedState,N=f(b,n);if(u.hasEagerState=!0,u.eagerState=N,rt(N,b))return ys(e,t,u,0),bt===null&&vs(),!1}catch{}if(n=bs(e,t,u,i),n!==null)return Un(n,e,i),qh(n,t,i),!0}return!1}function Ad(e,t,n,i){if(i={lane:2,revertLane:sf(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},yc(e)){if(t)throw Error(r(479))}else t=bs(e,n,i,2),t!==null&&Un(t,e,2)}function yc(e){var t=e.alternate;return e===Ge||t!==null&&t===Ge}function $h(e,t){Rs=fc=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function qh(e,t,n){if((n&4194048)!==0){var i=t.lanes;i&=e.pendingLanes,n|=i,t.lanes=n,Kn(e,n)}}var qr={readContext:cn,use:pc,useCallback:zt,useContext:zt,useEffect:zt,useImperativeHandle:zt,useLayoutEffect:zt,useInsertionEffect:zt,useMemo:zt,useReducer:zt,useRef:zt,useState:zt,useDebugValue:zt,useDeferredValue:zt,useTransition:zt,useSyncExternalStore:zt,useId:zt,useHostTransitionStatus:zt,useFormState:zt,useActionState:zt,useOptimistic:zt,useMemoCache:zt,useCacheRefresh:zt};qr.useEffectEvent=zt;var Gh={readContext:cn,use:pc,useCallback:function(e,t){return jn().memoizedState=[e,t===void 0?null:t],e},useContext:cn,useEffect:Ah,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,xc(4194308,4,Dh.bind(null,t,e),n)},useLayoutEffect:function(e,t){return xc(4194308,4,e,t)},useInsertionEffect:function(e,t){xc(4,2,e,t)},useMemo:function(e,t){var n=jn();t=t===void 0?null:t;var i=e();if($i){hn(!0);try{e()}finally{hn(!1)}}return n.memoizedState=[i,t],i},useReducer:function(e,t,n){var i=jn();if(n!==void 0){var u=n(t);if($i){hn(!0);try{n(t)}finally{hn(!1)}}}else u=t;return i.memoizedState=i.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},i.queue=e,e=e.dispatch=Ey.bind(null,Ge,e),[i.memoizedState,e]},useRef:function(e){var t=jn();return e={current:e},t.memoizedState=e},useState:function(e){e=bd(e);var t=e.queue,n=Uh.bind(null,Ge,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Md,useDeferredValue:function(e,t){var n=jn();return Cd(n,e,t)},useTransition:function(){var e=bd(!1);return e=Oh.bind(null,Ge,e.queue,!0,!1),jn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var i=Ge,u=jn();if(ne){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),bt===null)throw Error(r(349));(Xe&127)!==0||dh(i,t,n)}u.memoizedState=n;var f={value:n,getSnapshot:t};return u.queue=f,Ah(mh.bind(null,i,f,e),[e]),i.flags|=2048,zs(9,{destroy:void 0},fh.bind(null,i,f,n,t),null),n},useId:function(){var e=jn(),t=bt.identifierPrefix;if(ne){var n=sn,i=va;n=(i&~(1<<32-Ot(i)-1)).toString(32)+n,t="_"+t+"R_"+n,n=mc++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=My++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Nd,useFormState:Sh,useActionState:Sh,useOptimistic:function(e){var t=jn();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Ad.bind(null,Ge,!0,n),n.dispatch=t,[e,t]},useMemoCache:xd,useCacheRefresh:function(){return jn().memoizedState=ky.bind(null,Ge)},useEffectEvent:function(e){var t=jn(),n={impl:e};return t.memoizedState=n,function(){if((ot&2)!==0)throw Error(r(440));return n.impl.apply(void 0,arguments)}}},Td={readContext:cn,use:pc,useCallback:Lh,useContext:cn,useEffect:Sd,useImperativeHandle:Rh,useInsertionEffect:kh,useLayoutEffect:Eh,useMemo:zh,useReducer:gc,useRef:Nh,useState:function(){return gc(yl)},useDebugValue:Md,useDeferredValue:function(e,t){var n=Ht();return _h(n,xt.memoizedState,e,t)},useTransition:function(){var e=gc(yl)[0],t=Ht().memoizedState;return[typeof e=="boolean"?e:Ur(e),t]},useSyncExternalStore:uh,useId:Fh,useHostTransitionStatus:Nd,useFormState:Mh,useActionState:Mh,useOptimistic:function(e,t){var n=Ht();return gh(n,xt,e,t)},useMemoCache:xd,useCacheRefresh:Ih};Td.useEffectEvent=Th;var Ph={readContext:cn,use:pc,useCallback:Lh,useContext:cn,useEffect:Sd,useImperativeHandle:Rh,useInsertionEffect:kh,useLayoutEffect:Eh,useMemo:zh,useReducer:yd,useRef:Nh,useState:function(){return yd(yl)},useDebugValue:Md,useDeferredValue:function(e,t){var n=Ht();return xt===null?Cd(n,e,t):_h(n,xt.memoizedState,e,t)},useTransition:function(){var e=yd(yl)[0],t=Ht().memoizedState;return[typeof e=="boolean"?e:Ur(e),t]},useSyncExternalStore:uh,useId:Fh,useHostTransitionStatus:Nd,useFormState:jh,useActionState:jh,useOptimistic:function(e,t){var n=Ht();return xt!==null?gh(n,xt,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:xd,useCacheRefresh:Ih};Ph.useEffectEvent=Th;function kd(e,t,n,i){t=e.memoizedState,n=n(i,t),n=n==null?t:v({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Ed={enqueueSetState:function(e,t,n){e=e._reactInternals;var i=aa(),u=Jl(i);u.payload=t,n!=null&&(u.callback=n),t=ei(e,u,i),t!==null&&(Un(t,e,i),Br(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var i=aa(),u=Jl(i);u.tag=1,u.payload=t,n!=null&&(u.callback=n),t=ei(e,u,i),t!==null&&(Un(t,e,i),Br(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=aa(),i=Jl(n);i.tag=2,t!=null&&(i.callback=t),t=ei(e,i,n),t!==null&&(Un(t,e,n),Br(t,e,n))}};function Yh(e,t,n,i,u,f,b){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(i,f,b):t.prototype&&t.prototype.isPureReactComponent?!Xt(n,i)||!Xt(u,f):!0}function Vh(e,t,n,i){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,i),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,i),t.state!==e&&Ed.enqueueReplaceState(t,t.state,null)}function qi(e,t){var n=t;if("ref"in t){n={};for(var i in t)i!=="ref"&&(n[i]=t[i])}if(e=e.defaultProps){n===t&&(n=v({},n));for(var u in e)n[u]===void 0&&(n[u]=e[u])}return n}function Qh(e){xs(e)}function Kh(e){console.error(e)}function Xh(e){xs(e)}function bc(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(i){setTimeout(function(){throw i})}}function Zh(e,t,n){try{var i=e.onCaughtError;i(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function Dd(e,t,n){return n=Jl(n),n.tag=3,n.payload={element:null},n.callback=function(){bc(e,t)},n}function Wh(e){return e=Jl(e),e.tag=3,e}function Jh(e,t,n,i){var u=n.type.getDerivedStateFromError;if(typeof u=="function"){var f=i.value;e.payload=function(){return u(f)},e.callback=function(){Zh(t,n,i)}}var b=n.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(e.callback=function(){Zh(t,n,i),typeof u!="function"&&(si===null?si=new Set([this]):si.add(this));var N=i.stack;this.componentDidCatch(i.value,{componentStack:N!==null?N:""})})}function Dy(e,t,n,i,u){if(n.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(t=n.alternate,t!==null&&Ns(t,n,u,!0),n=Jn.current,n!==null){switch(n.tag){case 31:case 13:return ya===null?Rc():n.alternate===null&&_t===0&&(_t=3),n.flags&=-257,n.flags|=65536,n.lanes=u,i===rc?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([i]):t.add(i),nf(e,i,u)),!1;case 22:return n.flags|=65536,i===rc?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([i])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([i]):n.add(i)),nf(e,i,u)),!1}throw Error(r(435,n.tag))}return nf(e,i,u),Rc(),!1}if(ne)return t=Jn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=u,i!==Je&&(e=Error(r(422),{cause:i}),Ra(_n(e,n)))):(i!==Je&&(t=Error(r(423),{cause:i}),Ra(_n(t,n))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,i=_n(i,n),u=Dd(e.stateNode,i,u),rd(e,u),_t!==4&&(_t=2)),!1;var f=Error(r(520),{cause:i});if(f=_n(f,n),Zr===null?Zr=[f]:Zr.push(f),_t!==4&&(_t=2),t===null)return!0;i=_n(i,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=u&-u,n.lanes|=e,e=Dd(n.stateNode,i,e),rd(n,e),!1;case 1:if(t=n.type,f=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||f!==null&&typeof f.componentDidCatch=="function"&&(si===null||!si.has(f))))return n.flags|=65536,u&=-u,n.lanes|=u,u=Wh(u),Jh(u,e,n,i),rd(n,u),!1}n=n.return}while(n!==null);return!1}var Rd=Error(r(461)),Yt=!1;function un(e,t,n,i){t.child=e===null?ah(t,null,n,i):Ui(t,e.child,n,i)}function ep(e,t,n,i,u){n=n.render;var f=t.ref;if("ref"in i){var b={};for(var N in i)N!=="ref"&&(b[N]=i[N])}else b=i;return Bi(t),i=md(e,t,n,b,f,u),N=hd(),e!==null&&!Yt?(pd(e,t,u),bl(e,t,u)):(ne&&N&&S(t),t.flags|=1,un(e,t,i,u),t.child)}function tp(e,t,n,i,u){if(e===null){var f=n.type;return typeof f=="function"&&!Rr(f)&&f.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=f,np(e,t,f,i,u)):(e=Ms(n.type,null,i,t,t.mode,u),e.ref=t.ref,e.return=t,t.child=e)}if(f=e.child,!Id(e,u)){var b=f.memoizedProps;if(n=n.compare,n=n!==null?n:Xt,n(b,i)&&e.ref===t.ref)return bl(e,t,u)}return t.flags|=1,e=Pa(f,i),e.ref=t.ref,e.return=t,t.child=e}function np(e,t,n,i,u){if(e!==null){var f=e.memoizedProps;if(Xt(f,i)&&e.ref===t.ref)if(Yt=!1,t.pendingProps=i=f,Id(e,u))(e.flags&131072)!==0&&(Yt=!0);else return t.lanes=e.lanes,bl(e,t,u)}return Ld(e,t,n,i,u)}function ap(e,t,n,i){var u=i.children,f=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.mode==="hidden"){if((t.flags&128)!==0){if(f=f!==null?f.baseLanes|n:n,e!==null){for(i=t.child=e.child,u=0;i!==null;)u=u|i.lanes|i.childLanes,i=i.sibling;i=u&~f}else i=0,t.child=null;return lp(e,t,f,n,i)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ic(t,f!==null?f.cachePool:null),f!==null?sh(t,f):cd(),rh(t);else return i=t.lanes=536870912,lp(e,t,f!==null?f.baseLanes|n:n,n,i)}else f!==null?(ic(t,f.cachePool),sh(t,f),ni(),t.memoizedState=null):(e!==null&&ic(t,null),cd(),ni());return un(e,t,u,n),t.child}function Gr(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function lp(e,t,n,i,u){var f=ad();return f=f===null?null:{parent:Gt._currentValue,pool:f},t.memoizedState={baseLanes:n,cachePool:f},e!==null&&ic(t,null),cd(),rh(t),e!==null&&Ns(e,t,i,!0),t.childLanes=u,null}function wc(e,t){return t=Mc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function ip(e,t,n){return Ui(t,e.child,null,n),e=wc(t,t.pendingProps),e.flags|=2,ea(t),t.memoizedState=null,e}function Ry(e,t,n){var i=t.pendingProps,u=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(ne){if(i.mode==="hidden")return e=wc(t,i),t.lanes=536870912,Gr(null,e);if(dd(t),(e=F)?(e=xg(e,je),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Va!==null?{id:va,overflow:sn}:null,retryLane:536870912,hydrationErrors:null},n=Vl(e),n.return=t,t.child=n,H=t,F=null)):e=null,e===null)throw Ie(t);return t.lanes=536870912,null}return wc(t,i)}var f=e.memoizedState;if(f!==null){var b=f.dehydrated;if(dd(t),u)if(t.flags&256)t.flags&=-257,t=ip(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(r(558));else if(Yt||Ns(e,t,n,!1),u=(n&e.childLanes)!==0,Yt||u){if(i=bt,i!==null&&(b=ll(i,n),b!==0&&b!==f.retryLane))throw f.retryLane=b,xa(e,b),Un(i,e,b),Rd;Rc(),t=ip(e,t,n)}else e=f.treeContext,F=ba(b.nextSibling),H=t,ne=!0,pe=null,je=!1,e!==null&&V(t,e),t=wc(t,i),t.flags|=4096;return t}return e=Pa(e.child,{mode:i.mode,children:i.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Sc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!="function"&&typeof n!="object")throw Error(r(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function Ld(e,t,n,i,u){return Bi(t),n=md(e,t,n,i,void 0,u),i=hd(),e!==null&&!Yt?(pd(e,t,u),bl(e,t,u)):(ne&&i&&S(t),t.flags|=1,un(e,t,n,u),t.child)}function sp(e,t,n,i,u,f){return Bi(t),t.updateQueue=null,n=ch(t,i,n,u),oh(e),i=hd(),e!==null&&!Yt?(pd(e,t,f),bl(e,t,f)):(ne&&i&&S(t),t.flags|=1,un(e,t,n,f),t.child)}function rp(e,t,n,i,u){if(Bi(t),t.stateNode===null){var f=Lt,b=n.contextType;typeof b=="object"&&b!==null&&(f=cn(b)),f=new n(i,f),t.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,f.updater=Ed,t.stateNode=f,f._reactInternals=t,f=t.stateNode,f.props=i,f.state=t.memoizedState,f.refs={},id(t),b=n.contextType,f.context=typeof b=="object"&&b!==null?cn(b):Lt,f.state=t.memoizedState,b=n.getDerivedStateFromProps,typeof b=="function"&&(kd(t,n,b,i),f.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(b=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),b!==f.state&&Ed.enqueueReplaceState(f,f.state,null),Fr(t,i,f,u),Hr(),f.state=t.memoizedState),typeof f.componentDidMount=="function"&&(t.flags|=4194308),i=!0}else if(e===null){f=t.stateNode;var N=t.memoizedProps,R=qi(n,N);f.props=R;var K=f.context,le=n.contextType;b=Lt,typeof le=="object"&&le!==null&&(b=cn(le));var ce=n.getDerivedStateFromProps;le=typeof ce=="function"||typeof f.getSnapshotBeforeUpdate=="function",N=t.pendingProps!==N,le||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(N||K!==b)&&Vh(t,f,i,b),Wl=!1;var W=t.memoizedState;f.state=W,Fr(t,i,f,u),Hr(),K=t.memoizedState,N||W!==K||Wl?(typeof ce=="function"&&(kd(t,n,ce,i),K=t.memoizedState),(R=Wl||Yh(t,n,R,i,W,K,b))?(le||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount()),typeof f.componentDidMount=="function"&&(t.flags|=4194308)):(typeof f.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=i,t.memoizedState=K),f.props=i,f.state=K,f.context=b,i=R):(typeof f.componentDidMount=="function"&&(t.flags|=4194308),i=!1)}else{f=t.stateNode,sd(e,t),b=t.memoizedProps,le=qi(n,b),f.props=le,ce=t.pendingProps,W=f.context,K=n.contextType,R=Lt,typeof K=="object"&&K!==null&&(R=cn(K)),N=n.getDerivedStateFromProps,(K=typeof N=="function"||typeof f.getSnapshotBeforeUpdate=="function")||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(b!==ce||W!==R)&&Vh(t,f,i,R),Wl=!1,W=t.memoizedState,f.state=W,Fr(t,i,f,u),Hr();var J=t.memoizedState;b!==ce||W!==J||Wl||e!==null&&e.dependencies!==null&&ac(e.dependencies)?(typeof N=="function"&&(kd(t,n,N,i),J=t.memoizedState),(le=Wl||Yh(t,n,le,i,W,J,R)||e!==null&&e.dependencies!==null&&ac(e.dependencies))?(K||typeof f.UNSAFE_componentWillUpdate!="function"&&typeof f.componentWillUpdate!="function"||(typeof f.componentWillUpdate=="function"&&f.componentWillUpdate(i,J,R),typeof f.UNSAFE_componentWillUpdate=="function"&&f.UNSAFE_componentWillUpdate(i,J,R)),typeof f.componentDidUpdate=="function"&&(t.flags|=4),typeof f.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof f.componentDidUpdate!="function"||b===e.memoizedProps&&W===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&W===e.memoizedState||(t.flags|=1024),t.memoizedProps=i,t.memoizedState=J),f.props=i,f.state=J,f.context=R,i=le):(typeof f.componentDidUpdate!="function"||b===e.memoizedProps&&W===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&W===e.memoizedState||(t.flags|=1024),i=!1)}return f=i,Sc(e,t),i=(t.flags&128)!==0,f||i?(f=t.stateNode,n=i&&typeof n.getDerivedStateFromError!="function"?null:f.render(),t.flags|=1,e!==null&&i?(t.child=Ui(t,e.child,null,u),t.child=Ui(t,null,n,u)):un(e,t,n,u),t.memoizedState=f.state,e=t.child):e=bl(e,t,u),e}function op(e,t,n,i){return on(),t.flags|=256,un(e,t,n,i),t.child}var zd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function _d(e){return{baseLanes:e,cachePool:Zm()}}function Od(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=na),e}function cp(e,t,n){var i=t.pendingProps,u=!1,f=(t.flags&128)!==0,b;if((b=f)||(b=e!==null&&e.memoizedState===null?!1:(Bt.current&2)!==0),b&&(u=!0,t.flags&=-129),b=(t.flags&32)!==0,t.flags&=-33,e===null){if(ne){if(u?ti(t):ni(),(e=F)?(e=xg(e,je),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Va!==null?{id:va,overflow:sn}:null,retryLane:536870912,hydrationErrors:null},n=Vl(e),n.return=t,t.child=n,H=t,F=null)):e=null,e===null)throw Ie(t);return yf(e)?t.lanes=32:t.lanes=536870912,null}var N=i.children;return i=i.fallback,u?(ni(),u=t.mode,N=Mc({mode:"hidden",children:N},u),i=Ya(i,u,n,null),N.return=t,i.return=t,N.sibling=i,t.child=N,i=t.child,i.memoizedState=_d(n),i.childLanes=Od(e,b,n),t.memoizedState=zd,Gr(null,i)):(ti(t),Bd(t,N))}var R=e.memoizedState;if(R!==null&&(N=R.dehydrated,N!==null)){if(f)t.flags&256?(ti(t),t.flags&=-257,t=Hd(e,t,n)):t.memoizedState!==null?(ni(),t.child=e.child,t.flags|=128,t=null):(ni(),N=i.fallback,u=t.mode,i=Mc({mode:"visible",children:i.children},u),N=Ya(N,u,n,null),N.flags|=2,i.return=t,N.return=t,i.sibling=N,t.child=i,Ui(t,e.child,null,n),i=t.child,i.memoizedState=_d(n),i.childLanes=Od(e,b,n),t.memoizedState=zd,t=Gr(null,i));else if(ti(t),yf(N)){if(b=N.nextSibling&&N.nextSibling.dataset,b)var K=b.dgst;b=K,i=Error(r(419)),i.stack="",i.digest=b,Ra({value:i,source:null,stack:null}),t=Hd(e,t,n)}else if(Yt||Ns(e,t,n,!1),b=(n&e.childLanes)!==0,Yt||b){if(b=bt,b!==null&&(i=ll(b,n),i!==0&&i!==R.retryLane))throw R.retryLane=i,xa(e,i),Un(b,e,i),Rd;vf(N)||Rc(),t=Hd(e,t,n)}else vf(N)?(t.flags|=192,t.child=e.child,t=null):(e=R.treeContext,F=ba(N.nextSibling),H=t,ne=!0,pe=null,je=!1,e!==null&&V(t,e),t=Bd(t,i.children),t.flags|=4096);return t}return u?(ni(),N=i.fallback,u=t.mode,R=e.child,K=R.sibling,i=Pa(R,{mode:"hidden",children:i.children}),i.subtreeFlags=R.subtreeFlags&65011712,K!==null?N=Pa(K,N):(N=Ya(N,u,n,null),N.flags|=2),N.return=t,i.return=t,i.sibling=N,t.child=i,Gr(null,i),i=t.child,N=e.child.memoizedState,N===null?N=_d(n):(u=N.cachePool,u!==null?(R=Gt._currentValue,u=u.parent!==R?{parent:R,pool:R}:u):u=Zm(),N={baseLanes:N.baseLanes|n,cachePool:u}),i.memoizedState=N,i.childLanes=Od(e,b,n),t.memoizedState=zd,Gr(e.child,i)):(ti(t),n=e.child,e=n.sibling,n=Pa(n,{mode:"visible",children:i.children}),n.return=t,n.sibling=null,e!==null&&(b=t.deletions,b===null?(t.deletions=[e],t.flags|=16):b.push(e)),t.child=n,t.memoizedState=null,n)}function Bd(e,t){return t=Mc({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Mc(e,t){return e=vn(22,e,null,t),e.lanes=0,e}function Hd(e,t,n){return Ui(t,e.child,null,n),e=Bd(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function up(e,t,n){e.lanes|=t;var i=e.alternate;i!==null&&(i.lanes|=t),Ju(e.return,t,n)}function Fd(e,t,n,i,u,f){var b=e.memoizedState;b===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:i,tail:n,tailMode:u,treeForkCount:f}:(b.isBackwards=t,b.rendering=null,b.renderingStartTime=0,b.last=i,b.tail=n,b.tailMode=u,b.treeForkCount=f)}function dp(e,t,n){var i=t.pendingProps,u=i.revealOrder,f=i.tail;i=i.children;var b=Bt.current,N=(b&2)!==0;if(N?(b=b&1|2,t.flags|=128):b&=1,ge(Bt,b),un(e,t,i,n),i=ne?Oi:0,!N&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&up(e,n,t);else if(e.tag===19)up(e,n,t);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}switch(u){case"forwards":for(n=t.child,u=null;n!==null;)e=n.alternate,e!==null&&dc(e)===null&&(u=n),n=n.sibling;n=u,n===null?(u=t.child,t.child=null):(u=n.sibling,n.sibling=null),Fd(t,!1,u,n,f,i);break;case"backwards":case"unstable_legacy-backwards":for(n=null,u=t.child,t.child=null;u!==null;){if(e=u.alternate,e!==null&&dc(e)===null){t.child=u;break}e=u.sibling,u.sibling=n,n=u,u=e}Fd(t,!0,n,null,f,i);break;case"together":Fd(t,!1,null,null,void 0,i);break;default:t.memoizedState=null}return t.child}function bl(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),ii|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Ns(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(r(153));if(t.child!==null){for(e=t.child,n=Pa(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Pa(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Id(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&ac(e)))}function Ly(e,t,n){switch(t.tag){case 3:Le(t,t.stateNode.containerInfo),Zl(t,Gt,e.memoizedState.cache),on();break;case 27:case 5:qe(t);break;case 4:Le(t,t.stateNode.containerInfo);break;case 10:Zl(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,dd(t),null;break;case 13:var i=t.memoizedState;if(i!==null)return i.dehydrated!==null?(ti(t),t.flags|=128,null):(n&t.child.childLanes)!==0?cp(e,t,n):(ti(t),e=bl(e,t,n),e!==null?e.sibling:null);ti(t);break;case 19:var u=(e.flags&128)!==0;if(i=(n&t.childLanes)!==0,i||(Ns(e,t,n,!1),i=(n&t.childLanes)!==0),u){if(i)return dp(e,t,n);t.flags|=128}if(u=t.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),ge(Bt,Bt.current),i)break;return null;case 22:return t.lanes=0,ap(e,t,n,t.pendingProps);case 24:Zl(t,Gt,e.memoizedState.cache)}return bl(e,t,n)}function fp(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Yt=!0;else{if(!Id(e,n)&&(t.flags&128)===0)return Yt=!1,Ly(e,t,n);Yt=(e.flags&131072)!==0}else Yt=!1,ne&&(t.flags&1048576)!==0&&nc(t,Oi,t.index);switch(t.lanes=0,t.tag){case 16:e:{var i=t.pendingProps;if(e=Fi(t.elementType),t.type=e,typeof e=="function")Rr(e)?(i=qi(e,i),t.tag=1,t=rp(null,t,e,i,n)):(t.tag=0,t=Ld(null,t,e,i,n));else{if(e!=null){var u=e.$$typeof;if(u===q){t.tag=11,t=ep(null,t,e,i,n);break e}else if(u===E){t.tag=14,t=tp(null,t,e,i,n);break e}}throw t=re(e)||e,Error(r(306,t,""))}}return t;case 0:return Ld(e,t,t.type,t.pendingProps,n);case 1:return i=t.type,u=qi(i,t.pendingProps),rp(e,t,i,u,n);case 3:e:{if(Le(t,t.stateNode.containerInfo),e===null)throw Error(r(387));i=t.pendingProps;var f=t.memoizedState;u=f.element,sd(e,t),Fr(t,i,null,n);var b=t.memoizedState;if(i=b.cache,Zl(t,Gt,i),i!==f.cache&&ed(t,[Gt],n,!0),Hr(),i=b.element,f.isDehydrated)if(f={element:i,isDehydrated:!1,cache:b.cache},t.updateQueue.baseState=f,t.memoizedState=f,t.flags&256){t=op(e,t,i,n);break e}else if(i!==u){u=_n(Error(r(424)),t),Ra(u),t=op(e,t,i,n);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,F=ba(e.firstChild),H=t,ne=!0,pe=null,je=!0,n=ah(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(on(),i===u){t=bl(e,t,n);break e}un(e,t,i,n)}t=t.child}return t;case 26:return Sc(e,t),e===null?(n=Mg(t.type,null,t.pendingProps,null))?t.memoizedState=n:ne||(n=t.type,e=t.pendingProps,i=Fc(Fe.current).createElement(n),i[Y]=t,i[he]=e,dn(i,n,e),Mt(i),t.stateNode=i):t.memoizedState=Mg(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return qe(t),e===null&&ne&&(i=t.stateNode=bg(t.type,t.pendingProps,Fe.current),H=t,je=!0,u=F,ui(t.type)?(bf=u,F=ba(i.firstChild)):F=u),un(e,t,t.pendingProps.children,n),Sc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ne&&((u=i=F)&&(i=cb(i,t.type,t.pendingProps,je),i!==null?(t.stateNode=i,H=t,F=ba(i.firstChild),je=!1,u=!0):u=!1),u||Ie(t)),qe(t),u=t.type,f=t.pendingProps,b=e!==null?e.memoizedProps:null,i=f.children,pf(u,f)?i=null:b!==null&&pf(u,b)&&(t.flags|=32),t.memoizedState!==null&&(u=md(e,t,Cy,null,null,n),io._currentValue=u),Sc(e,t),un(e,t,i,n),t.child;case 6:return e===null&&ne&&((e=n=F)&&(n=ub(n,t.pendingProps,je),n!==null?(t.stateNode=n,H=t,F=null,e=!0):e=!1),e||Ie(t)),null;case 13:return cp(e,t,n);case 4:return Le(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Ui(t,null,i,n):un(e,t,i,n),t.child;case 11:return ep(e,t,t.type,t.pendingProps,n);case 7:return un(e,t,t.pendingProps,n),t.child;case 8:return un(e,t,t.pendingProps.children,n),t.child;case 12:return un(e,t,t.pendingProps.children,n),t.child;case 10:return i=t.pendingProps,Zl(t,t.type,i.value),un(e,t,i.children,n),t.child;case 9:return u=t.type._context,i=t.pendingProps.children,Bi(t),u=cn(u),i=i(u),t.flags|=1,un(e,t,i,n),t.child;case 14:return tp(e,t,t.type,t.pendingProps,n);case 15:return np(e,t,t.type,t.pendingProps,n);case 19:return dp(e,t,n);case 31:return Ry(e,t,n);case 22:return ap(e,t,n,t.pendingProps);case 24:return Bi(t),i=cn(Gt),e===null?(u=ad(),u===null&&(u=bt,f=td(),u.pooledCache=f,f.refCount++,f!==null&&(u.pooledCacheLanes|=n),u=f),t.memoizedState={parent:i,cache:u},id(t),Zl(t,Gt,u)):((e.lanes&n)!==0&&(sd(e,t),Fr(t,null,null,n),Hr()),u=e.memoizedState,f=t.memoizedState,u.parent!==i?(u={parent:i,cache:i},t.memoizedState=u,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=u),Zl(t,Gt,i)):(i=f.cache,Zl(t,Gt,i),i!==u.cache&&ed(t,[Gt],n,!0))),un(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(r(156,t.tag))}function wl(e){e.flags|=4}function Ud(e,t,n,i,u){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(u&335544128)===u)if(e.stateNode.complete)e.flags|=8192;else if(Fp())e.flags|=8192;else throw Ii=rc,ld}else e.flags&=-16777217}function mp(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Tg(t))if(Fp())e.flags|=8192;else throw Ii=rc,ld}function Cc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Ll():536870912,e.lanes|=t,Hs|=t)}function Pr(e,t){if(!ne)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var i=null;n!==null;)n.alternate!==null&&(i=n),n=n.sibling;i===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:i.sibling=null}}function jt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,i=0;if(t)for(var u=e.child;u!==null;)n|=u.lanes|u.childLanes,i|=u.subtreeFlags&65011712,i|=u.flags&65011712,u.return=e,u=u.sibling;else for(u=e.child;u!==null;)n|=u.lanes|u.childLanes,i|=u.subtreeFlags,i|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=i,e.childLanes=n,t}function zy(e,t,n){var i=t.pendingProps;switch(D(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return jt(t),null;case 1:return jt(t),null;case 3:return n=t.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),xl(Gt),Ee(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Cn(t)?wl(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,hl())),jt(t),null;case 26:var u=t.type,f=t.memoizedState;return e===null?(wl(t),f!==null?(jt(t),mp(t,f)):(jt(t),Ud(t,u,null,i,n))):f?f!==e.memoizedState?(wl(t),jt(t),mp(t,f)):(jt(t),t.flags&=-16777217):(e=e.memoizedProps,e!==i&&wl(t),jt(t),Ud(t,u,e,i,n)),null;case 27:if(ke(t),n=Fe.current,u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&wl(t);else{if(!i){if(t.stateNode===null)throw Error(r(166));return jt(t),null}e=be.current,Cn(t)?Nt(t):(e=bg(u,i,n),t.stateNode=e,wl(t))}return jt(t),null;case 5:if(ke(t),u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&wl(t);else{if(!i){if(t.stateNode===null)throw Error(r(166));return jt(t),null}if(f=be.current,Cn(t))Nt(t);else{var b=Fc(Fe.current);switch(f){case 1:f=b.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:f=b.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":f=b.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":f=b.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":f=b.createElement("div"),f.innerHTML="<script><\/script>",f=f.removeChild(f.firstChild);break;case"select":f=typeof i.is=="string"?b.createElement("select",{is:i.is}):b.createElement("select"),i.multiple?f.multiple=!0:i.size&&(f.size=i.size);break;default:f=typeof i.is=="string"?b.createElement(u,{is:i.is}):b.createElement(u)}}f[Y]=t,f[he]=i;e:for(b=t.child;b!==null;){if(b.tag===5||b.tag===6)f.appendChild(b.stateNode);else if(b.tag!==4&&b.tag!==27&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===t)break e;for(;b.sibling===null;){if(b.return===null||b.return===t)break e;b=b.return}b.sibling.return=b.return,b=b.sibling}t.stateNode=f;e:switch(dn(f,u,i),u){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&wl(t)}}return jt(t),Ud(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==i&&wl(t);else{if(typeof i!="string"&&t.stateNode===null)throw Error(r(166));if(e=Fe.current,Cn(t)){if(e=t.stateNode,n=t.memoizedProps,i=null,u=H,u!==null)switch(u.tag){case 27:case 5:i=u.memoizedProps}e[Y]=t,e=!!(e.nodeValue===n||i!==null&&i.suppressHydrationWarning===!0||cg(e.nodeValue,n)),e||Ie(t,!0)}else e=Fc(e).createTextNode(i),e[Y]=t,t.stateNode=e}return jt(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(i=Cn(t),n!==null){if(e===null){if(!i)throw Error(r(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(557));e[Y]=t}else on(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;jt(t),e=!1}else n=hl(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(ea(t),t):(ea(t),null);if((t.flags&128)!==0)throw Error(r(558))}return jt(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=Cn(t),i!==null&&i.dehydrated!==null){if(e===null){if(!u)throw Error(r(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(317));u[Y]=t}else on(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;jt(t),u=!1}else u=hl(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(ea(t),t):(ea(t),null)}return ea(t),(t.flags&128)!==0?(t.lanes=n,t):(n=i!==null,e=e!==null&&e.memoizedState!==null,n&&(i=t.child,u=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(u=i.alternate.memoizedState.cachePool.pool),f=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(f=i.memoizedState.cachePool.pool),f!==u&&(i.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Cc(t,t.updateQueue),jt(t),null);case 4:return Ee(),e===null&&uf(t.stateNode.containerInfo),jt(t),null;case 10:return xl(t.type),jt(t),null;case 19:if(z(Bt),i=t.memoizedState,i===null)return jt(t),null;if(u=(t.flags&128)!==0,f=i.rendering,f===null)if(u)Pr(i,!1);else{if(_t!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(f=dc(e),f!==null){for(t.flags|=128,Pr(i,!1),e=f.updateQueue,t.updateQueue=e,Cc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ec(n,e),n=n.sibling;return ge(Bt,Bt.current&1|2),ne&&Da(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&&ze()>kc&&(t.flags|=128,u=!0,Pr(i,!1),t.lanes=4194304)}else{if(!u)if(e=dc(f),e!==null){if(t.flags|=128,u=!0,e=e.updateQueue,t.updateQueue=e,Cc(t,e),Pr(i,!0),i.tail===null&&i.tailMode==="hidden"&&!f.alternate&&!ne)return jt(t),null}else 2*ze()-i.renderingStartTime>kc&&n!==536870912&&(t.flags|=128,u=!0,Pr(i,!1),t.lanes=4194304);i.isBackwards?(f.sibling=t.child,t.child=f):(e=i.last,e!==null?e.sibling=f:t.child=f,i.last=f)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=ze(),e.sibling=null,n=Bt.current,ge(Bt,u?n&1|2:n&1),ne&&Da(t,i.treeForkCount),e):(jt(t),null);case 22:case 23:return ea(t),ud(),i=t.memoizedState!==null,e!==null?e.memoizedState!==null!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?(n&536870912)!==0&&(t.flags&128)===0&&(jt(t),t.subtreeFlags&6&&(t.flags|=8192)):jt(t),n=t.updateQueue,n!==null&&Cc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==n&&(t.flags|=2048),e!==null&&z(Hi),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),xl(Gt),jt(t),null;case 25:return null;case 30:return null}throw Error(r(156,t.tag))}function _y(e,t){switch(D(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return xl(Gt),Ee(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ke(t),null;case 31:if(t.memoizedState!==null){if(ea(t),t.alternate===null)throw Error(r(340));on()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ea(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));on()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return z(Bt),null;case 4:return Ee(),null;case 10:return xl(t.type),null;case 22:case 23:return ea(t),ud(),e!==null&&z(Hi),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return xl(Gt),null;case 25:return null;default:return null}}function hp(e,t){switch(D(t),t.tag){case 3:xl(Gt),Ee();break;case 26:case 27:case 5:ke(t);break;case 4:Ee();break;case 31:t.memoizedState!==null&&ea(t);break;case 13:ea(t);break;case 19:z(Bt);break;case 10:xl(t.type);break;case 22:case 23:ea(t),ud(),e!==null&&z(Hi);break;case 24:xl(Gt)}}function Yr(e,t){try{var n=t.updateQueue,i=n!==null?n.lastEffect:null;if(i!==null){var u=i.next;n=u;do{if((n.tag&e)===e){i=void 0;var f=n.create,b=n.inst;i=f(),b.destroy=i}n=n.next}while(n!==u)}}catch(N){pt(t,t.return,N)}}function ai(e,t,n){try{var i=t.updateQueue,u=i!==null?i.lastEffect:null;if(u!==null){var f=u.next;i=f;do{if((i.tag&e)===e){var b=i.inst,N=b.destroy;if(N!==void 0){b.destroy=void 0,u=t;var R=n,K=N;try{K()}catch(le){pt(u,R,le)}}}i=i.next}while(i!==f)}}catch(le){pt(t,t.return,le)}}function pp(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{ih(t,n)}catch(i){pt(e,e.return,i)}}}function gp(e,t,n){n.props=qi(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(i){pt(e,t,i)}}function Vr(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var i=e.stateNode;break;case 30:i=e.stateNode;break;default:i=e.stateNode}typeof n=="function"?e.refCleanup=n(i):n.current=i}}catch(u){pt(e,t,u)}}function Qa(e,t){var n=e.ref,i=e.refCleanup;if(n!==null)if(typeof i=="function")try{i()}catch(u){pt(e,t,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(u){pt(e,t,u)}else n.current=null}function xp(e){var t=e.type,n=e.memoizedProps,i=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&i.focus();break e;case"img":n.src?i.src=n.src:n.srcSet&&(i.srcset=n.srcSet)}}catch(u){pt(e,e.return,u)}}function $d(e,t,n){try{var i=e.stateNode;ab(i,e.type,n,t),i[he]=t}catch(u){pt(e,e.return,u)}}function vp(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&ui(e.type)||e.tag===4}function qd(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||vp(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&ui(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Gd(e,t,n){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=tt));else if(i!==4&&(i===27&&ui(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Gd(e,t,n),e=e.sibling;e!==null;)Gd(e,t,n),e=e.sibling}function jc(e,t,n){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(i!==4&&(i===27&&ui(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(jc(e,t,n),e=e.sibling;e!==null;)jc(e,t,n),e=e.sibling}function yp(e){var t=e.stateNode,n=e.memoizedProps;try{for(var i=e.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);dn(t,i,n),t[Y]=e,t[he]=n}catch(f){pt(e,e.return,f)}}var Sl=!1,Vt=!1,Pd=!1,bp=typeof WeakSet=="function"?WeakSet:Set,en=null;function Oy(e,t){if(e=e.containerInfo,mf=Yc,e=Vo(e),Ar(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var u=i.anchorOffset,f=i.focusNode;i=i.focusOffset;try{n.nodeType,f.nodeType}catch{n=null;break e}var b=0,N=-1,R=-1,K=0,le=0,ce=e,W=null;t:for(;;){for(var J;ce!==n||u!==0&&ce.nodeType!==3||(N=b+u),ce!==f||i!==0&&ce.nodeType!==3||(R=b+i),ce.nodeType===3&&(b+=ce.nodeValue.length),(J=ce.firstChild)!==null;)W=ce,ce=J;for(;;){if(ce===e)break t;if(W===n&&++K===u&&(N=b),W===f&&++le===i&&(R=b),(J=ce.nextSibling)!==null)break;ce=W,W=ce.parentNode}ce=J}n=N===-1||R===-1?null:{start:N,end:R}}else n=null}n=n||{start:0,end:0}}else n=null;for(hf={focusedElem:e,selectionRange:n},Yc=!1,en=t;en!==null;)if(t=en,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,en=e;else for(;en!==null;){switch(t=en,f=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n<e.length;n++)u=e[n],u.ref.impl=u.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&f!==null){e=void 0,n=t,u=f.memoizedProps,f=f.memoizedState,i=n.stateNode;try{var Ne=qi(n.type,u);e=i.getSnapshotBeforeUpdate(Ne,f),i.__reactInternalSnapshotBeforeUpdate=e}catch(Be){pt(n,n.return,Be)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)xf(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":xf(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(r(163))}if(e=t.sibling,e!==null){e.return=t.return,en=e;break}en=t.return}}function wp(e,t,n){var i=n.flags;switch(n.tag){case 0:case 11:case 15:Cl(e,n),i&4&&Yr(5,n);break;case 1:if(Cl(e,n),i&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(b){pt(n,n.return,b)}else{var u=qi(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(u,t,e.__reactInternalSnapshotBeforeUpdate)}catch(b){pt(n,n.return,b)}}i&64&&pp(n),i&512&&Vr(n,n.return);break;case 3:if(Cl(e,n),i&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{ih(e,t)}catch(b){pt(n,n.return,b)}}break;case 27:t===null&&i&4&&yp(n);case 26:case 5:Cl(e,n),t===null&&i&4&&xp(n),i&512&&Vr(n,n.return);break;case 12:Cl(e,n);break;case 31:Cl(e,n),i&4&&Cp(e,n);break;case 13:Cl(e,n),i&4&&jp(e,n),i&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Py.bind(null,n),db(e,n))));break;case 22:if(i=n.memoizedState!==null||Sl,!i){t=t!==null&&t.memoizedState!==null||Vt,u=Sl;var f=Vt;Sl=i,(Vt=t)&&!f?jl(e,n,(n.subtreeFlags&8772)!==0):Cl(e,n),Sl=u,Vt=f}break;case 30:break;default:Cl(e,n)}}function Sp(e){var t=e.alternate;t!==null&&(e.alternate=null,Sp(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&ln(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var At=null,Bn=!1;function Ml(e,t,n){for(n=n.child;n!==null;)Mp(e,t,n),n=n.sibling}function Mp(e,t,n){if(ut&&typeof ut.onCommitFiberUnmount=="function")try{ut.onCommitFiberUnmount(Qn,n)}catch{}switch(n.tag){case 26:Vt||Qa(n,t),Ml(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Vt||Qa(n,t);var i=At,u=Bn;ui(n.type)&&(At=n.stateNode,Bn=!1),Ml(e,t,n),no(n.stateNode),At=i,Bn=u;break;case 5:Vt||Qa(n,t);case 6:if(i=At,u=Bn,At=null,Ml(e,t,n),At=i,Bn=u,At!==null)if(Bn)try{(At.nodeType===9?At.body:At.nodeName==="HTML"?At.ownerDocument.body:At).removeChild(n.stateNode)}catch(f){pt(n,t,f)}else try{At.removeChild(n.stateNode)}catch(f){pt(n,t,f)}break;case 18:At!==null&&(Bn?(e=At,pg(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Ys(e)):pg(At,n.stateNode));break;case 4:i=At,u=Bn,At=n.stateNode.containerInfo,Bn=!0,Ml(e,t,n),At=i,Bn=u;break;case 0:case 11:case 14:case 15:ai(2,n,t),Vt||ai(4,n,t),Ml(e,t,n);break;case 1:Vt||(Qa(n,t),i=n.stateNode,typeof i.componentWillUnmount=="function"&&gp(n,t,i)),Ml(e,t,n);break;case 21:Ml(e,t,n);break;case 22:Vt=(i=Vt)||n.memoizedState!==null,Ml(e,t,n),Vt=i;break;default:Ml(e,t,n)}}function Cp(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Ys(e)}catch(n){pt(t,t.return,n)}}}function jp(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Ys(e)}catch(n){pt(t,t.return,n)}}function By(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new bp),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new bp),t;default:throw Error(r(435,e.tag))}}function Nc(e,t){var n=By(e);t.forEach(function(i){if(!n.has(i)){n.add(i);var u=Yy.bind(null,e,i);i.then(u,u)}})}function Hn(e,t){var n=t.deletions;if(n!==null)for(var i=0;i<n.length;i++){var u=n[i],f=e,b=t,N=b;e:for(;N!==null;){switch(N.tag){case 27:if(ui(N.type)){At=N.stateNode,Bn=!1;break e}break;case 5:At=N.stateNode,Bn=!1;break e;case 3:case 4:At=N.stateNode.containerInfo,Bn=!0;break e}N=N.return}if(At===null)throw Error(r(160));Mp(f,b,u),At=null,Bn=!1,f=u.alternate,f!==null&&(f.return=null),u.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Np(t,e),t=t.sibling}var La=null;function Np(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Hn(t,e),Fn(e),i&4&&(ai(3,e,e.return),Yr(3,e),ai(5,e,e.return));break;case 1:Hn(t,e),Fn(e),i&512&&(Vt||n===null||Qa(n,n.return)),i&64&&Sl&&(e=e.updateQueue,e!==null&&(i=e.callbacks,i!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?i:n.concat(i))));break;case 26:var u=La;if(Hn(t,e),Fn(e),i&512&&(Vt||n===null||Qa(n,n.return)),i&4){var f=n!==null?n.memoizedState:null;if(i=e.memoizedState,n===null)if(i===null)if(e.stateNode===null){e:{i=e.type,n=e.memoizedProps,u=u.ownerDocument||u;t:switch(i){case"title":f=u.getElementsByTagName("title")[0],(!f||f[st]||f[Y]||f.namespaceURI==="http://www.w3.org/2000/svg"||f.hasAttribute("itemprop"))&&(f=u.createElement(i),u.head.insertBefore(f,u.querySelector("head > title"))),dn(f,i,n),f[Y]=e,Mt(f),i=f;break e;case"link":var b=Ng("link","href",u).get(i+(n.href||""));if(b){for(var N=0;N<b.length;N++)if(f=b[N],f.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&f.getAttribute("rel")===(n.rel==null?null:n.rel)&&f.getAttribute("title")===(n.title==null?null:n.title)&&f.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){b.splice(N,1);break t}}f=u.createElement(i),dn(f,i,n),u.head.appendChild(f);break;case"meta":if(b=Ng("meta","content",u).get(i+(n.content||""))){for(N=0;N<b.length;N++)if(f=b[N],f.getAttribute("content")===(n.content==null?null:""+n.content)&&f.getAttribute("name")===(n.name==null?null:n.name)&&f.getAttribute("property")===(n.property==null?null:n.property)&&f.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&f.getAttribute("charset")===(n.charSet==null?null:n.charSet)){b.splice(N,1);break t}}f=u.createElement(i),dn(f,i,n),u.head.appendChild(f);break;default:throw Error(r(468,i))}f[Y]=e,Mt(f),i=f}e.stateNode=i}else Ag(u,e.type,e.stateNode);else e.stateNode=jg(u,i,e.memoizedProps);else f!==i?(f===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):f.count--,i===null?Ag(u,e.type,e.stateNode):jg(u,i,e.memoizedProps)):i===null&&e.stateNode!==null&&$d(e,e.memoizedProps,n.memoizedProps)}break;case 27:Hn(t,e),Fn(e),i&512&&(Vt||n===null||Qa(n,n.return)),n!==null&&i&4&&$d(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Hn(t,e),Fn(e),i&512&&(Vt||n===null||Qa(n,n.return)),e.flags&32){u=e.stateNode;try{Ln(u,"")}catch(Ne){pt(e,e.return,Ne)}}i&4&&e.stateNode!=null&&(u=e.memoizedProps,$d(e,u,n!==null?n.memoizedProps:u)),i&1024&&(Pd=!0);break;case 6:if(Hn(t,e),Fn(e),i&4){if(e.stateNode===null)throw Error(r(162));i=e.memoizedProps,n=e.stateNode;try{n.nodeValue=i}catch(Ne){pt(e,e.return,Ne)}}break;case 3:if($c=null,u=La,La=Ic(t.containerInfo),Hn(t,e),La=u,Fn(e),i&4&&n!==null&&n.memoizedState.isDehydrated)try{Ys(t.containerInfo)}catch(Ne){pt(e,e.return,Ne)}Pd&&(Pd=!1,Ap(e));break;case 4:i=La,La=Ic(e.stateNode.containerInfo),Hn(t,e),Fn(e),La=i;break;case 12:Hn(t,e),Fn(e);break;case 31:Hn(t,e),Fn(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Nc(e,i)));break;case 13:Hn(t,e),Fn(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Tc=ze()),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Nc(e,i)));break;case 22:u=e.memoizedState!==null;var R=n!==null&&n.memoizedState!==null,K=Sl,le=Vt;if(Sl=K||u,Vt=le||R,Hn(t,e),Vt=le,Sl=K,Fn(e),i&8192)e:for(t=e.stateNode,t._visibility=u?t._visibility&-2:t._visibility|1,u&&(n===null||R||Sl||Vt||Gi(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){R=n=t;try{if(f=R.stateNode,u)b=f.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none";else{N=R.stateNode;var ce=R.memoizedProps.style,W=ce!=null&&ce.hasOwnProperty("display")?ce.display:null;N.style.display=W==null||typeof W=="boolean"?"":(""+W).trim()}}catch(Ne){pt(R,R.return,Ne)}}}else if(t.tag===6){if(n===null){R=t;try{R.stateNode.nodeValue=u?"":R.memoizedProps}catch(Ne){pt(R,R.return,Ne)}}}else if(t.tag===18){if(n===null){R=t;try{var J=R.stateNode;u?gg(J,!0):gg(R.stateNode,!1)}catch(Ne){pt(R,R.return,Ne)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}i&4&&(i=e.updateQueue,i!==null&&(n=i.retryQueue,n!==null&&(i.retryQueue=null,Nc(e,n))));break;case 19:Hn(t,e),Fn(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Nc(e,i)));break;case 30:break;case 21:break;default:Hn(t,e),Fn(e)}}function Fn(e){var t=e.flags;if(t&2){try{for(var n,i=e.return;i!==null;){if(vp(i)){n=i;break}i=i.return}if(n==null)throw Error(r(160));switch(n.tag){case 27:var u=n.stateNode,f=qd(e);jc(e,f,u);break;case 5:var b=n.stateNode;n.flags&32&&(Ln(b,""),n.flags&=-33);var N=qd(e);jc(e,N,b);break;case 3:case 4:var R=n.stateNode.containerInfo,K=qd(e);Gd(e,K,R);break;default:throw Error(r(161))}}catch(le){pt(e,e.return,le)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Ap(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Ap(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Cl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)wp(e,t.alternate,t),t=t.sibling}function Gi(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:ai(4,t,t.return),Gi(t);break;case 1:Qa(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&gp(t,t.return,n),Gi(t);break;case 27:no(t.stateNode);case 26:case 5:Qa(t,t.return),Gi(t);break;case 22:t.memoizedState===null&&Gi(t);break;case 30:Gi(t);break;default:Gi(t)}e=e.sibling}}function jl(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var i=t.alternate,u=e,f=t,b=f.flags;switch(f.tag){case 0:case 11:case 15:jl(u,f,n),Yr(4,f);break;case 1:if(jl(u,f,n),i=f,u=i.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(K){pt(i,i.return,K)}if(i=f,u=i.updateQueue,u!==null){var N=i.stateNode;try{var R=u.shared.hiddenCallbacks;if(R!==null)for(u.shared.hiddenCallbacks=null,u=0;u<R.length;u++)lh(R[u],N)}catch(K){pt(i,i.return,K)}}n&&b&64&&pp(f),Vr(f,f.return);break;case 27:yp(f);case 26:case 5:jl(u,f,n),n&&i===null&&b&4&&xp(f),Vr(f,f.return);break;case 12:jl(u,f,n);break;case 31:jl(u,f,n),n&&b&4&&Cp(u,f);break;case 13:jl(u,f,n),n&&b&4&&jp(u,f);break;case 22:f.memoizedState===null&&jl(u,f,n),Vr(f,f.return);break;case 30:break;default:jl(u,f,n)}t=t.sibling}}function Yd(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Lr(n))}function Vd(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Lr(e))}function za(e,t,n,i){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Tp(e,t,n,i),t=t.sibling}function Tp(e,t,n,i){var u=t.flags;switch(t.tag){case 0:case 11:case 15:za(e,t,n,i),u&2048&&Yr(9,t);break;case 1:za(e,t,n,i);break;case 3:za(e,t,n,i),u&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Lr(e)));break;case 12:if(u&2048){za(e,t,n,i),e=t.stateNode;try{var f=t.memoizedProps,b=f.id,N=f.onPostCommit;typeof N=="function"&&N(b,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(R){pt(t,t.return,R)}}else za(e,t,n,i);break;case 31:za(e,t,n,i);break;case 13:za(e,t,n,i);break;case 23:break;case 22:f=t.stateNode,b=t.alternate,t.memoizedState!==null?f._visibility&2?za(e,t,n,i):Qr(e,t):f._visibility&2?za(e,t,n,i):(f._visibility|=2,_s(e,t,n,i,(t.subtreeFlags&10256)!==0||!1)),u&2048&&Yd(b,t);break;case 24:za(e,t,n,i),u&2048&&Vd(t.alternate,t);break;default:za(e,t,n,i)}}function _s(e,t,n,i,u){for(u=u&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var f=e,b=t,N=n,R=i,K=b.flags;switch(b.tag){case 0:case 11:case 15:_s(f,b,N,R,u),Yr(8,b);break;case 23:break;case 22:var le=b.stateNode;b.memoizedState!==null?le._visibility&2?_s(f,b,N,R,u):Qr(f,b):(le._visibility|=2,_s(f,b,N,R,u)),u&&K&2048&&Yd(b.alternate,b);break;case 24:_s(f,b,N,R,u),u&&K&2048&&Vd(b.alternate,b);break;default:_s(f,b,N,R,u)}t=t.sibling}}function Qr(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,i=t,u=i.flags;switch(i.tag){case 22:Qr(n,i),u&2048&&Yd(i.alternate,i);break;case 24:Qr(n,i),u&2048&&Vd(i.alternate,i);break;default:Qr(n,i)}t=t.sibling}}var Kr=8192;function Os(e,t,n){if(e.subtreeFlags&Kr)for(e=e.child;e!==null;)kp(e,t,n),e=e.sibling}function kp(e,t,n){switch(e.tag){case 26:Os(e,t,n),e.flags&Kr&&e.memoizedState!==null&&Mb(n,La,e.memoizedState,e.memoizedProps);break;case 5:Os(e,t,n);break;case 3:case 4:var i=La;La=Ic(e.stateNode.containerInfo),Os(e,t,n),La=i;break;case 22:e.memoizedState===null&&(i=e.alternate,i!==null&&i.memoizedState!==null?(i=Kr,Kr=16777216,Os(e,t,n),Kr=i):Os(e,t,n));break;default:Os(e,t,n)}}function Ep(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Xr(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var i=t[n];en=i,Rp(i,e)}Ep(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Dp(e),e=e.sibling}function Dp(e){switch(e.tag){case 0:case 11:case 15:Xr(e),e.flags&2048&&ai(9,e,e.return);break;case 3:Xr(e);break;case 12:Xr(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ac(e)):Xr(e);break;default:Xr(e)}}function Ac(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var i=t[n];en=i,Rp(i,e)}Ep(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:ai(8,t,t.return),Ac(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Ac(t));break;default:Ac(t)}e=e.sibling}}function Rp(e,t){for(;en!==null;){var n=en;switch(n.tag){case 0:case 11:case 15:ai(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var i=n.memoizedState.cachePool.pool;i!=null&&i.refCount++}break;case 24:Lr(n.memoizedState.cache)}if(i=n.child,i!==null)i.return=n,en=i;else e:for(n=e;en!==null;){i=en;var u=i.sibling,f=i.return;if(Sp(i),i===n){en=null;break e}if(u!==null){u.return=f,en=u;break e}en=f}}}var Hy={getCacheForType:function(e){var t=cn(Gt),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return cn(Gt).controller.signal}},Fy=typeof WeakMap=="function"?WeakMap:Map,ot=0,bt=null,Qe=null,Xe=0,ht=0,ta=null,li=!1,Bs=!1,Qd=!1,Nl=0,_t=0,ii=0,Pi=0,Kd=0,na=0,Hs=0,Zr=null,In=null,Xd=!1,Tc=0,Lp=0,kc=1/0,Ec=null,si=null,Wt=0,ri=null,Fs=null,Al=0,Zd=0,Wd=null,zp=null,Wr=0,Jd=null;function aa(){return(ot&2)!==0&&Xe!==0?Xe&-Xe:I.T!==null?sf():gn()}function _p(){if(na===0)if((Xe&536870912)===0||ne){var e=sa;sa<<=1,(sa&3932160)===0&&(sa=262144),na=e}else na=536870912;return e=Jn.current,e!==null&&(e.flags|=32),na}function Un(e,t,n){(e===bt&&(ht===2||ht===9)||e.cancelPendingCommit!==null)&&(Is(e,0),oi(e,Xe,na,!1)),oa(e,n),((ot&2)===0||e!==bt)&&(e===bt&&((ot&2)===0&&(Pi|=n),_t===4&&oi(e,Xe,na,!1)),Ka(e))}function Op(e,t,n){if((ot&6)!==0)throw Error(r(327));var i=!n&&(t&127)===0&&(t&e.expiredLanes)===0||ra(e,t),u=i?$y(e,t):tf(e,t,!0),f=i;do{if(u===0){Bs&&!i&&oi(e,t,0,!1);break}else{if(n=e.current.alternate,f&&!Iy(n)){u=tf(e,t,!1),f=!1;continue}if(u===2){if(f=t,e.errorRecoveryDisabledLanes&f)var b=0;else b=e.pendingLanes&-536870913,b=b!==0?b:b&536870912?536870912:0;if(b!==0){t=b;e:{var N=e;u=Zr;var R=N.current.memoizedState.isDehydrated;if(R&&(Is(N,b).flags|=256),b=tf(N,b,!1),b!==2){if(Qd&&!R){N.errorRecoveryDisabledLanes|=f,Pi|=f,u=4;break e}f=In,In=u,f!==null&&(In===null?In=f:In.push.apply(In,f))}u=b}if(f=!1,u!==2)continue}}if(u===1){Is(e,0),oi(e,t,0,!0);break}e:{switch(i=e,f=u,f){case 0:case 1:throw Error(r(345));case 4:if((t&4194048)!==t)break;case 6:oi(i,t,na,!li);break e;case 2:In=null;break;case 3:case 5:break;default:throw Error(r(329))}if((t&62914560)===t&&(u=Tc+300-ze(),10<u)){if(oi(i,t,na,!li),kn(i,0,!0)!==0)break e;Al=t,i.timeoutHandle=mg(Bp.bind(null,i,n,In,Ec,Xd,t,na,Pi,Hs,li,f,"Throttled",-0,0),u);break e}Bp(i,n,In,Ec,Xd,t,na,Pi,Hs,li,f,null,-0,0)}}break}while(!0);Ka(e)}function Bp(e,t,n,i,u,f,b,N,R,K,le,ce,W,J){if(e.timeoutHandle=-1,ce=t.subtreeFlags,ce&8192||(ce&16785408)===16785408){ce={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:tt},kp(t,f,ce);var Ne=(f&62914560)===f?Tc-ze():(f&4194048)===f?Lp-ze():0;if(Ne=Cb(ce,Ne),Ne!==null){Al=f,e.cancelPendingCommit=Ne(Pp.bind(null,e,t,f,n,i,u,b,N,R,le,ce,null,W,J)),oi(e,f,b,!K);return}}Pp(e,t,f,n,i,u,b,N,R)}function Iy(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var i=0;i<n.length;i++){var u=n[i],f=u.getSnapshot;u=u.value;try{if(!rt(f(),u))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function oi(e,t,n,i){t&=~Kd,t&=~Pi,e.suspendedLanes|=t,e.pingedLanes&=~t,i&&(e.warmLanes|=t),i=e.expirationTimes;for(var u=t;0<u;){var f=31-Ot(u),b=1<<f;i[f]=-1,u&=~b}n!==0&&al(e,n,t)}function Dc(){return(ot&6)===0?(Jr(0),!1):!0}function ef(){if(Qe!==null){if(ht===0)var e=Qe.return;else e=Qe,gl=pl=null,gd(e),Es=null,_r=0,e=Qe;for(;e!==null;)hp(e.alternate,e),e=e.return;Qe=null}}function Is(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,sb(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Al=0,ef(),bt=e,Qe=n=Pa(e.current,null),Xe=t,ht=0,ta=null,li=!1,Bs=ra(e,t),Qd=!1,Hs=na=Kd=Pi=ii=_t=0,In=Zr=null,Xd=!1,(t&8)!==0&&(t|=t&32);var i=e.entangledLanes;if(i!==0)for(e=e.entanglements,i&=t;0<i;){var u=31-Ot(i),f=1<<u;t|=e[u],i&=~f}return Nl=t,vs(),n}function Hp(e,t){Ge=null,I.H=qr,t===ks||t===sc?(t=eh(),ht=3):t===ld?(t=eh(),ht=4):ht=t===Rd?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,ta=t,Qe===null&&(_t=1,bc(e,_n(t,e.current)))}function Fp(){var e=Jn.current;return e===null?!0:(Xe&4194048)===Xe?ya===null:(Xe&62914560)===Xe||(Xe&536870912)!==0?e===ya:!1}function Ip(){var e=I.H;return I.H=qr,e===null?qr:e}function Up(){var e=I.A;return I.A=Hy,e}function Rc(){_t=4,li||(Xe&4194048)!==Xe&&Jn.current!==null||(Bs=!0),(ii&134217727)===0&&(Pi&134217727)===0||bt===null||oi(bt,Xe,na,!1)}function tf(e,t,n){var i=ot;ot|=2;var u=Ip(),f=Up();(bt!==e||Xe!==t)&&(Ec=null,Is(e,t)),t=!1;var b=_t;e:do try{if(ht!==0&&Qe!==null){var N=Qe,R=ta;switch(ht){case 8:ef(),b=6;break e;case 3:case 2:case 9:case 6:Jn.current===null&&(t=!0);var K=ht;if(ht=0,ta=null,Us(e,N,R,K),n&&Bs){b=0;break e}break;default:K=ht,ht=0,ta=null,Us(e,N,R,K)}}Uy(),b=_t;break}catch(le){Hp(e,le)}while(!0);return t&&e.shellSuspendCounter++,gl=pl=null,ot=i,I.H=u,I.A=f,Qe===null&&(bt=null,Xe=0,vs()),b}function Uy(){for(;Qe!==null;)$p(Qe)}function $y(e,t){var n=ot;ot|=2;var i=Ip(),u=Up();bt!==e||Xe!==t?(Ec=null,kc=ze()+500,Is(e,t)):Bs=ra(e,t);e:do try{if(ht!==0&&Qe!==null){t=Qe;var f=ta;t:switch(ht){case 1:ht=0,ta=null,Us(e,t,f,1);break;case 2:case 9:if(Wm(f)){ht=0,ta=null,qp(t);break}t=function(){ht!==2&&ht!==9||bt!==e||(ht=7),Ka(e)},f.then(t,t);break e;case 3:ht=7;break e;case 4:ht=5;break e;case 7:Wm(f)?(ht=0,ta=null,qp(t)):(ht=0,ta=null,Us(e,t,f,7));break;case 5:var b=null;switch(Qe.tag){case 26:b=Qe.memoizedState;case 5:case 27:var N=Qe;if(b?Tg(b):N.stateNode.complete){ht=0,ta=null;var R=N.sibling;if(R!==null)Qe=R;else{var K=N.return;K!==null?(Qe=K,Lc(K)):Qe=null}break t}}ht=0,ta=null,Us(e,t,f,5);break;case 6:ht=0,ta=null,Us(e,t,f,6);break;case 8:ef(),_t=6;break e;default:throw Error(r(462))}}qy();break}catch(le){Hp(e,le)}while(!0);return gl=pl=null,I.H=i,I.A=u,ot=n,Qe!==null?0:(bt=null,Xe=0,vs(),_t)}function qy(){for(;Qe!==null&&!xe();)$p(Qe)}function $p(e){var t=fp(e.alternate,e,Nl);e.memoizedProps=e.pendingProps,t===null?Lc(e):Qe=t}function qp(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=sp(n,t,t.pendingProps,t.type,void 0,Xe);break;case 11:t=sp(n,t,t.pendingProps,t.type.render,t.ref,Xe);break;case 5:gd(t);default:hp(n,t),t=Qe=ec(t,Nl),t=fp(n,t,Nl)}e.memoizedProps=e.pendingProps,t===null?Lc(e):Qe=t}function Us(e,t,n,i){gl=pl=null,gd(t),Es=null,_r=0;var u=t.return;try{if(Dy(e,u,t,n,Xe)){_t=1,bc(e,_n(n,e.current)),Qe=null;return}}catch(f){if(u!==null)throw Qe=u,f;_t=1,bc(e,_n(n,e.current)),Qe=null;return}t.flags&32768?(ne||i===1?e=!0:Bs||(Xe&536870912)!==0?e=!1:(li=e=!0,(i===2||i===9||i===3||i===6)&&(i=Jn.current,i!==null&&i.tag===13&&(i.flags|=16384))),Gp(t,e)):Lc(t)}function Lc(e){var t=e;do{if((t.flags&32768)!==0){Gp(t,li);return}e=t.return;var n=zy(t.alternate,t,Nl);if(n!==null){Qe=n;return}if(t=t.sibling,t!==null){Qe=t;return}Qe=t=e}while(t!==null);_t===0&&(_t=5)}function Gp(e,t){do{var n=_y(e.alternate,e);if(n!==null){n.flags&=32767,Qe=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Qe=e;return}Qe=e=n}while(e!==null);_t=6,Qe=null}function Pp(e,t,n,i,u,f,b,N,R){e.cancelPendingCommit=null;do zc();while(Wt!==0);if((ot&6)!==0)throw Error(r(327));if(t!==null){if(t===e.current)throw Error(r(177));if(f=t.lanes|t.childLanes,f|=_i,nl(e,n,f,b,N,R),e===bt&&(Qe=bt=null,Xe=0),Fs=t,ri=e,Al=n,Zd=f,Wd=u,zp=i,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Vy(Nn,function(){return Xp(),null})):(e.callbackNode=null,e.callbackPriority=0),i=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||i){i=I.T,I.T=null,u=Z.p,Z.p=2,b=ot,ot|=4;try{Oy(e,t,n)}finally{ot=b,Z.p=u,I.T=i}}Wt=1,Yp(),Vp(),Qp()}}function Yp(){if(Wt===1){Wt=0;var e=ri,t=Fs,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=I.T,I.T=null;var i=Z.p;Z.p=2;var u=ot;ot|=4;try{Np(t,e);var f=hf,b=Vo(e.containerInfo),N=f.focusedElem,R=f.selectionRange;if(b!==N&&N&&N.ownerDocument&&Yo(N.ownerDocument.documentElement,N)){if(R!==null&&Ar(N)){var K=R.start,le=R.end;if(le===void 0&&(le=K),"selectionStart"in N)N.selectionStart=K,N.selectionEnd=Math.min(le,N.value.length);else{var ce=N.ownerDocument||document,W=ce&&ce.defaultView||window;if(W.getSelection){var J=W.getSelection(),Ne=N.textContent.length,Be=Math.min(R.start,Ne),yt=R.end===void 0?Be:Math.min(R.end,Ne);!J.extend&&Be>yt&&(b=yt,yt=Be,Be=b);var $=Po(N,Be),O=Po(N,yt);if($&&O&&(J.rangeCount!==1||J.anchorNode!==$.node||J.anchorOffset!==$.offset||J.focusNode!==O.node||J.focusOffset!==O.offset)){var Q=ce.createRange();Q.setStart($.node,$.offset),J.removeAllRanges(),Be>yt?(J.addRange(Q),J.extend(O.node,O.offset)):(Q.setEnd(O.node,O.offset),J.addRange(Q))}}}}for(ce=[],J=N;J=J.parentNode;)J.nodeType===1&&ce.push({element:J,left:J.scrollLeft,top:J.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<ce.length;N++){var oe=ce[N];oe.element.scrollLeft=oe.left,oe.element.scrollTop=oe.top}}Yc=!!mf,hf=mf=null}finally{ot=u,Z.p=i,I.T=n}}e.current=t,Wt=2}}function Vp(){if(Wt===2){Wt=0;var e=ri,t=Fs,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=I.T,I.T=null;var i=Z.p;Z.p=2;var u=ot;ot|=4;try{wp(e,t.alternate,t)}finally{ot=u,Z.p=i,I.T=n}}Wt=3}}function Qp(){if(Wt===4||Wt===3){Wt=0,He();var e=ri,t=Fs,n=Al,i=zp;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?Wt=5:(Wt=0,Fs=ri=null,Kp(e,e.pendingLanes));var u=e.pendingLanes;if(u===0&&(si=null),Dn(n),t=t.stateNode,ut&&typeof ut.onCommitFiberRoot=="function")try{ut.onCommitFiberRoot(Qn,t,void 0,(t.current.flags&128)===128)}catch{}if(i!==null){t=I.T,u=Z.p,Z.p=2,I.T=null;try{for(var f=e.onRecoverableError,b=0;b<i.length;b++){var N=i[b];f(N.value,{componentStack:N.stack})}}finally{I.T=t,Z.p=u}}(Al&3)!==0&&zc(),Ka(e),u=e.pendingLanes,(n&261930)!==0&&(u&42)!==0?e===Jd?Wr++:(Wr=0,Jd=e):Wr=0,Jr(0)}}function Kp(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Lr(t)))}function zc(){return Yp(),Vp(),Qp(),Xp()}function Xp(){if(Wt!==5)return!1;var e=ri,t=Zd;Zd=0;var n=Dn(Al),i=I.T,u=Z.p;try{Z.p=32>n?32:n,I.T=null,n=Wd,Wd=null;var f=ri,b=Al;if(Wt=0,Fs=ri=null,Al=0,(ot&6)!==0)throw Error(r(331));var N=ot;if(ot|=4,Dp(f.current),Tp(f,f.current,b,n),ot=N,Jr(0,!1),ut&&typeof ut.onPostCommitFiberRoot=="function")try{ut.onPostCommitFiberRoot(Qn,f)}catch{}return!0}finally{Z.p=u,I.T=i,Kp(e,t)}}function Zp(e,t,n){t=_n(n,t),t=Dd(e.stateNode,t,2),e=ei(e,t,2),e!==null&&(oa(e,2),Ka(e))}function pt(e,t,n){if(e.tag===3)Zp(e,e,n);else for(;t!==null;){if(t.tag===3){Zp(t,e,n);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(si===null||!si.has(i))){e=_n(n,e),n=Wh(2),i=ei(t,n,2),i!==null&&(Jh(n,i,t,e),oa(i,2),Ka(i));break}}t=t.return}}function nf(e,t,n){var i=e.pingCache;if(i===null){i=e.pingCache=new Fy;var u=new Set;i.set(t,u)}else u=i.get(t),u===void 0&&(u=new Set,i.set(t,u));u.has(n)||(Qd=!0,u.add(n),e=Gy.bind(null,e,t,n),t.then(e,e))}function Gy(e,t,n){var i=e.pingCache;i!==null&&i.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,bt===e&&(Xe&n)===n&&(_t===4||_t===3&&(Xe&62914560)===Xe&&300>ze()-Tc?(ot&2)===0&&Is(e,0):Kd|=n,Hs===Xe&&(Hs=0)),Ka(e)}function Wp(e,t){t===0&&(t=Ll()),e=xa(e,t),e!==null&&(oa(e,t),Ka(e))}function Py(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Wp(e,n)}function Yy(e,t){var n=0;switch(e.tag){case 31:case 13:var i=e.stateNode,u=e.memoizedState;u!==null&&(n=u.retryLane);break;case 19:i=e.stateNode;break;case 22:i=e.stateNode._retryCache;break;default:throw Error(r(314))}i!==null&&i.delete(t),Wp(e,n)}function Vy(e,t){return It(e,t)}var _c=null,$s=null,af=!1,Oc=!1,lf=!1,ci=0;function Ka(e){e!==$s&&e.next===null&&($s===null?_c=$s=e:$s=$s.next=e),Oc=!0,af||(af=!0,Ky())}function Jr(e,t){if(!lf&&Oc){lf=!0;do for(var n=!1,i=_c;i!==null;){if(e!==0){var u=i.pendingLanes;if(u===0)var f=0;else{var b=i.suspendedLanes,N=i.pingedLanes;f=(1<<31-Ot(42|e)+1)-1,f&=u&~(b&~N),f=f&201326741?f&201326741|1:f?f|2:0}f!==0&&(n=!0,ng(i,f))}else f=Xe,f=kn(i,i===bt?f:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(f&3)===0||ra(i,f)||(n=!0,ng(i,f));i=i.next}while(n);lf=!1}}function Qy(){Jp()}function Jp(){Oc=af=!1;var e=0;ci!==0&&ib()&&(e=ci);for(var t=ze(),n=null,i=_c;i!==null;){var u=i.next,f=eg(i,t);f===0?(i.next=null,n===null?_c=u:n.next=u,u===null&&($s=n)):(n=i,(e!==0||(f&3)!==0)&&(Oc=!0)),i=u}Wt!==0&&Wt!==5||Jr(e),ci!==0&&(ci=0)}function eg(e,t){for(var n=e.suspendedLanes,i=e.pingedLanes,u=e.expirationTimes,f=e.pendingLanes&-62914561;0<f;){var b=31-Ot(f),N=1<<b,R=u[b];R===-1?((N&n)===0||(N&i)!==0)&&(u[b]=tl(N,t)):R<=t&&(e.expiredLanes|=N),f&=~N}if(t=bt,n=Xe,n=kn(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i=e.callbackNode,n===0||e===t&&(ht===2||ht===9)||e.cancelPendingCommit!==null)return i!==null&&i!==null&&Rt(i),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||ra(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(i!==null&&Rt(i),Dn(n)){case 2:case 8:n=it;break;case 32:n=Nn;break;case 268435456:n=Na;break;default:n=Nn}return i=tg.bind(null,e),n=It(n,i),e.callbackPriority=t,e.callbackNode=n,t}return i!==null&&i!==null&&Rt(i),e.callbackPriority=2,e.callbackNode=null,2}function tg(e,t){if(Wt!==0&&Wt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(zc()&&e.callbackNode!==n)return null;var i=Xe;return i=kn(e,e===bt?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i===0?null:(Op(e,i,t),eg(e,ze()),e.callbackNode!=null&&e.callbackNode===n?tg.bind(null,e):null)}function ng(e,t){if(zc())return null;Op(e,t,!0)}function Ky(){rb(function(){(ot&6)!==0?It(Mn,Qy):Jp()})}function sf(){if(ci===0){var e=As;e===0&&(e=Ha,Ha<<=1,(Ha&261888)===0&&(Ha=256)),ci=e}return ci}function ag(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Ol(""+e)}function lg(e,t){var n=t.ownerDocument.createElement("input");return n.name=t.name,n.value=t.value,e.id&&n.setAttribute("form",e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function Xy(e,t,n,i,u){if(t==="submit"&&n&&n.stateNode===u){var f=ag((u[he]||null).action),b=i.submitter;b&&(t=(t=b[he]||null)?ag(t.formAction):b.getAttribute("formAction"),t!==null&&(f=t,b=null));var N=new Ea("action","action",null,i,u);e.push({event:N,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(ci!==0){var R=b?lg(u,b):new FormData(u);jd(n,{pending:!0,data:R,method:u.method,action:f},null,R)}}else typeof f=="function"&&(N.preventDefault(),R=b?lg(u,b):new FormData(u),jd(n,{pending:!0,data:R,method:u.method,action:f},f,R))},currentTarget:u}]})}}for(var rf=0;rf<Dr.length;rf++){var of=Dr[rf],Zy=of.toLowerCase(),Wy=of[0].toUpperCase()+of.slice(1);Wn(Zy,"on"+Wy)}Wn(Xo,"onAnimationEnd"),Wn(ps,"onAnimationIteration"),Wn(gs,"onAnimationStart"),Wn("dblclick","onDoubleClick"),Wn("focusin","onFocus"),Wn("focusout","onBlur"),Wn(Xu,"onTransitionRun"),Wn(Zu,"onTransitionStart"),Wn(Wu,"onTransitionCancel"),Wn(Zo,"onTransitionEnd"),Tt("onMouseEnter",["mouseout","mouseover"]),Tt("onMouseLeave",["mouseout","mouseover"]),Tt("onPointerEnter",["pointerout","pointerover"]),Tt("onPointerLeave",["pointerout","pointerover"]),qt("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),qt("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),qt("onBeforeInput",["compositionend","keypress","textInput","paste"]),qt("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),qt("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),qt("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var eo="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Jy=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(eo));function ig(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var i=e[n],u=i.event;i=i.listeners;e:{var f=void 0;if(t)for(var b=i.length-1;0<=b;b--){var N=i[b],R=N.instance,K=N.currentTarget;if(N=N.listener,R!==f&&u.isPropagationStopped())break e;f=N,u.currentTarget=K;try{f(u)}catch(le){xs(le)}u.currentTarget=null,f=R}else for(b=0;b<i.length;b++){if(N=i[b],R=N.instance,K=N.currentTarget,N=N.listener,R!==f&&u.isPropagationStopped())break e;f=N,u.currentTarget=K;try{f(u)}catch(le){xs(le)}u.currentTarget=null,f=R}}}}function Ke(e,t){var n=t[$e];n===void 0&&(n=t[$e]=new Set);var i=e+"__bubble";n.has(i)||(sg(t,e,2,!1),n.add(i))}function cf(e,t,n){var i=0;t&&(i|=4),sg(n,e,i,t)}var Bc="_reactListening"+Math.random().toString(36).slice(2);function uf(e){if(!e[Bc]){e[Bc]=!0,il.forEach(function(n){n!=="selectionchange"&&(Jy.has(n)||cf(n,!1,e),cf(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Bc]||(t[Bc]=!0,cf("selectionchange",!1,t))}}function sg(e,t,n,i){switch(_g(t)){case 2:var u=Ab;break;case 8:u=Tb;break;default:u=jf}n=u.bind(null,t,n,e),u=void 0,!Hl||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(u=!0),i?u!==void 0?e.addEventListener(t,n,{capture:!0,passive:u}):e.addEventListener(t,n,!0):u!==void 0?e.addEventListener(t,n,{passive:u}):e.addEventListener(t,n,!1)}function df(e,t,n,i,u){var f=i;if((t&1)===0&&(t&2)===0&&i!==null)e:for(;;){if(i===null)return;var b=i.tag;if(b===3||b===4){var N=i.stateNode.containerInfo;if(N===u)break;if(b===4)for(b=i.return;b!==null;){var R=b.tag;if((R===3||R===4)&&b.stateNode.containerInfo===u)return;b=b.return}for(;N!==null;){if(b=Ut(N),b===null)return;if(R=b.tag,R===5||R===6||R===26||R===27){i=f=b;continue e}N=N.parentNode}}i=i.return}dr(function(){var K=f,le=ts(n),ce=[];e:{var W=Wo.get(e);if(W!==void 0){var J=Ea,Ne=e;switch(e){case"keypress":if(as(n)===0)break e;case"keydown":case"keyup":J=rs;break;case"focusin":Ne="focus",J=ol;break;case"focusout":Ne="blur",J=ol;break;case"beforeblur":case"afterblur":J=ol;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":J=Bo;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":J=qu;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":J=us;break;case Xo:case ps:case gs:J=is;break;case Zo:J=ga;break;case"scroll":case"scrollend":J=Oo;break;case"wheel":J=qo;break;case"copy":case"cut":case"paste":J=cl;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":J=os;break;case"toggle":case"beforetoggle":J=ds}var Be=(t&4)!==0,yt=!Be&&(e==="scroll"||e==="scrollend"),$=Be?W!==null?W+"Capture":null:W;Be=[];for(var O=K,Q;O!==null;){var oe=O;if(Q=oe.stateNode,oe=oe.tag,oe!==5&&oe!==26&&oe!==27||Q===null||$===null||(oe=zn(O,$),oe!=null&&Be.push(to(O,oe,Q))),yt)break;O=O.return}0<Be.length&&(W=new J(W,Ne,null,n,le),ce.push({event:W,listeners:Be}))}}if((t&7)===0){e:{if(W=e==="mouseover"||e==="pointerover",J=e==="mouseout"||e==="pointerout",W&&n!==es&&(Ne=n.relatedTarget||n.fromElement)&&(Ut(Ne)||Ne[Se]))break e;if((J||W)&&(W=le.window===le?le:(W=le.ownerDocument)?W.defaultView||W.parentWindow:window,J?(Ne=n.relatedTarget||n.toElement,J=K,Ne=Ne?Ut(Ne):null,Ne!==null&&(yt=d(Ne),Be=Ne.tag,Ne!==yt||Be!==5&&Be!==27&&Be!==6)&&(Ne=null)):(J=null,Ne=K),J!==Ne)){if(Be=Bo,oe="onMouseLeave",$="onMouseEnter",O="mouse",(e==="pointerout"||e==="pointerover")&&(Be=os,oe="onPointerLeave",$="onPointerEnter",O="pointer"),yt=J==null?W:wt(J),Q=Ne==null?W:wt(Ne),W=new Be(oe,O+"leave",J,n,le),W.target=yt,W.relatedTarget=Q,oe=null,Ut(le)===K&&(Be=new Be($,O+"enter",Ne,n,le),Be.target=Q,Be.relatedTarget=yt,oe=Be),yt=oe,J&&Ne)t:{for(Be=eb,$=J,O=Ne,Q=0,oe=$;oe;oe=Be(oe))Q++;oe=0;for(var Re=O;Re;Re=Be(Re))oe++;for(;0<Q-oe;)$=Be($),Q--;for(;0<oe-Q;)O=Be(O),oe--;for(;Q--;){if($===O||O!==null&&$===O.alternate){Be=$;break t}$=Be($),O=Be(O)}Be=null}else Be=null;J!==null&&rg(ce,W,J,Be,!1),Ne!==null&&yt!==null&&rg(ce,yt,Ne,Be,!0)}}e:{if(W=K?wt(K):window,J=W.nodeName&&W.nodeName.toLowerCase(),J==="select"||J==="input"&&W.type==="file")var nt=Ei;else if(Mr(W))if(Go)nt=Qu;else{nt=Vm;var Ae=Vu}else J=W.nodeName,!J||J.toLowerCase()!=="input"||W.type!=="checkbox"&&W.type!=="radio"?K&&cr(K.elementType)&&(nt=Ei):nt=Nr;if(nt&&(nt=nt(e,K))){Cr(ce,nt,n,le);break e}Ae&&Ae(e,W,K),e==="focusout"&&K&&W.type==="number"&&K.memoizedProps.value!=null&&_l(W,"number",W.value)}switch(Ae=K?wt(K):window,e){case"focusin":(Mr(Ae)||Ae.contentEditable==="true")&&(Gl=Ae,Tr=K,zi=null);break;case"focusout":zi=Tr=Gl=null;break;case"mousedown":kr=!0;break;case"contextmenu":case"mouseup":case"dragend":kr=!1,Qo(ce,n,le);break;case"selectionchange":if(Ku)break;case"keydown":case"keyup":Qo(ce,n,le)}var Pe;if(Ga)e:{switch(e){case"compositionstart":var Ze="onCompositionStart";break e;case"compositionend":Ze="onCompositionEnd";break e;case"compositionupdate":Ze="onCompositionUpdate";break e}Ze=void 0}else ul?wr(e,n)&&(Ze="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(Ze="onCompositionStart");Ze&&(yr&&n.locale!=="ko"&&(ul||Ze!=="onCompositionStart"?Ze==="onCompositionEnd"&&ul&&(Pe=xn()):(Et=le,Ia="value"in Et?Et.value:Et.textContent,ul=!0)),Ae=Hc(K,Ze),0<Ae.length&&(Ze=new Fo(Ze,e,null,n,le),ce.push({event:Ze,listeners:Ae}),Pe?Ze.data=Pe:(Pe=fs(n),Pe!==null&&(Ze.data=Pe)))),(Pe=Ul?Pu(e,n):Sr(e,n))&&(Ze=Hc(K,"onBeforeInput"),0<Ze.length&&(Ae=new Fo("onBeforeInput","beforeinput",null,n,le),ce.push({event:Ae,listeners:Ze}),Ae.data=Pe)),Xy(ce,e,K,n,le)}ig(ce,t)})}function to(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Hc(e,t){for(var n=t+"Capture",i=[];e!==null;){var u=e,f=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||f===null||(u=zn(e,n),u!=null&&i.unshift(to(e,u,f)),u=zn(e,t),u!=null&&i.push(to(e,u,f))),e.tag===3)return i;e=e.return}return[]}function eb(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function rg(e,t,n,i,u){for(var f=t._reactName,b=[];n!==null&&n!==i;){var N=n,R=N.alternate,K=N.stateNode;if(N=N.tag,R!==null&&R===i)break;N!==5&&N!==26&&N!==27||K===null||(R=K,u?(K=zn(n,f),K!=null&&b.unshift(to(n,K,R))):u||(K=zn(n,f),K!=null&&b.push(to(n,K,R)))),n=n.return}b.length!==0&&e.push({event:t,listeners:b})}var tb=/\r\n?/g,nb=/\u0000|\uFFFD/g;function og(e){return(typeof e=="string"?e:""+e).replace(tb,`
9
+ `).replace(nb,"")}function cg(e,t){return t=og(t),og(e)===t}function vt(e,t,n,i,u,f){switch(n){case"children":typeof i=="string"?t==="body"||t==="textarea"&&i===""||Ln(e,i):(typeof i=="number"||typeof i=="bigint")&&t!=="body"&&Ln(e,""+i);break;case"className":Si(e,"class",i);break;case"tabIndex":Si(e,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":Si(e,n,i);break;case"style":or(e,i,f);break;case"data":if(t!=="object"){Si(e,"data",i);break}case"src":case"href":if(i===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(i==null||typeof i=="function"||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(n);break}i=Ol(""+i),e.setAttribute(n,i);break;case"action":case"formAction":if(typeof i=="function"){e.setAttribute(n,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof f=="function"&&(n==="formAction"?(t!=="input"&&vt(e,t,"name",u.name,u,null),vt(e,t,"formEncType",u.formEncType,u,null),vt(e,t,"formMethod",u.formMethod,u,null),vt(e,t,"formTarget",u.formTarget,u,null)):(vt(e,t,"encType",u.encType,u,null),vt(e,t,"method",u.method,u,null),vt(e,t,"target",u.target,u,null)));if(i==null||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(n);break}i=Ol(""+i),e.setAttribute(n,i);break;case"onClick":i!=null&&(e.onclick=tt);break;case"onScroll":i!=null&&Ke("scroll",e);break;case"onScrollEnd":i!=null&&Ke("scrollend",e);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(r(61));if(n=i.__html,n!=null){if(u.children!=null)throw Error(r(60));e.innerHTML=n}}break;case"multiple":e.multiple=i&&typeof i!="function"&&typeof i!="symbol";break;case"muted":e.muted=i&&typeof i!="function"&&typeof i!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(i==null||typeof i=="function"||typeof i=="boolean"||typeof i=="symbol"){e.removeAttribute("xlink:href");break}n=Ol(""+i),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(n,""+i):e.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":i&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":i===!0?e.setAttribute(n,""):i!==!1&&i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(n,i):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":i!=null&&typeof i!="function"&&typeof i!="symbol"&&!isNaN(i)&&1<=i?e.setAttribute(n,i):e.removeAttribute(n);break;case"rowSpan":case"start":i==null||typeof i=="function"||typeof i=="symbol"||isNaN(i)?e.removeAttribute(n):e.setAttribute(n,i);break;case"popover":Ke("beforetoggle",e),Ke("toggle",e),Fa(e,"popover",i);break;case"xlinkActuate":ua(e,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":ua(e,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":ua(e,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":ua(e,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":ua(e,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":ua(e,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":ua(e,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":ua(e,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":ua(e,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":Fa(e,"is",i);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=ma.get(n)||n,Fa(e,n,i))}}function ff(e,t,n,i,u,f){switch(n){case"style":or(e,i,f);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(r(61));if(n=i.__html,n!=null){if(u.children!=null)throw Error(r(60));e.innerHTML=n}}break;case"children":typeof i=="string"?Ln(e,i):(typeof i=="number"||typeof i=="bigint")&&Ln(e,""+i);break;case"onScroll":i!=null&&Ke("scroll",e);break;case"onScrollEnd":i!=null&&Ke("scrollend",e);break;case"onClick":i!=null&&(e.onclick=tt);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ta.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(u=n.endsWith("Capture"),t=n.slice(2,u?n.length-7:void 0),f=e[he]||null,f=f!=null?f[n]:null,typeof f=="function"&&e.removeEventListener(t,f,u),typeof i=="function")){typeof f!="function"&&f!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,i,u);break e}n in e?e[n]=i:i===!0?e.setAttribute(n,""):Fa(e,n,i)}}}function dn(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ke("error",e),Ke("load",e);var i=!1,u=!1,f;for(f in n)if(n.hasOwnProperty(f)){var b=n[f];if(b!=null)switch(f){case"src":i=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:vt(e,t,f,b,n,null)}}u&&vt(e,t,"srcSet",n.srcSet,n,null),i&&vt(e,t,"src",n.src,n,null);return;case"input":Ke("invalid",e);var N=f=b=u=null,R=null,K=null;for(i in n)if(n.hasOwnProperty(i)){var le=n[i];if(le!=null)switch(i){case"name":u=le;break;case"type":b=le;break;case"checked":R=le;break;case"defaultChecked":K=le;break;case"value":f=le;break;case"defaultValue":N=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(r(137,t));break;default:vt(e,t,i,le,n,null)}}Ji(e,f,N,R,K,b,u,!1);return;case"select":Ke("invalid",e),i=b=f=null;for(u in n)if(n.hasOwnProperty(u)&&(N=n[u],N!=null))switch(u){case"value":f=N;break;case"defaultValue":b=N;break;case"multiple":i=N;default:vt(e,t,u,N,n,null)}t=f,n=b,e.multiple=!!i,t!=null?Xn(e,!!i,t,!1):n!=null&&Xn(e,!!i,n,!0);return;case"textarea":Ke("invalid",e),f=u=i=null;for(b in n)if(n.hasOwnProperty(b)&&(N=n[b],N!=null))switch(b){case"value":i=N;break;case"defaultValue":u=N;break;case"children":f=N;break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(r(91));break;default:vt(e,t,b,N,n,null)}rr(e,i,u,f);return;case"option":for(R in n)n.hasOwnProperty(R)&&(i=n[R],i!=null)&&(R==="selected"?e.selected=i&&typeof i!="function"&&typeof i!="symbol":vt(e,t,R,i,n,null));return;case"dialog":Ke("beforetoggle",e),Ke("toggle",e),Ke("cancel",e),Ke("close",e);break;case"iframe":case"object":Ke("load",e);break;case"video":case"audio":for(i=0;i<eo.length;i++)Ke(eo[i],e);break;case"image":Ke("error",e),Ke("load",e);break;case"details":Ke("toggle",e);break;case"embed":case"source":case"link":Ke("error",e),Ke("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(K in n)if(n.hasOwnProperty(K)&&(i=n[K],i!=null))switch(K){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:vt(e,t,K,i,n,null)}return;default:if(cr(t)){for(le in n)n.hasOwnProperty(le)&&(i=n[le],i!==void 0&&ff(e,t,le,i,n,void 0));return}}for(N in n)n.hasOwnProperty(N)&&(i=n[N],i!=null&&vt(e,t,N,i,n,null))}function ab(e,t,n,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,f=null,b=null,N=null,R=null,K=null,le=null;for(J in n){var ce=n[J];if(n.hasOwnProperty(J)&&ce!=null)switch(J){case"checked":break;case"value":break;case"defaultValue":R=ce;default:i.hasOwnProperty(J)||vt(e,t,J,null,i,ce)}}for(var W in i){var J=i[W];if(ce=n[W],i.hasOwnProperty(W)&&(J!=null||ce!=null))switch(W){case"type":f=J;break;case"name":u=J;break;case"checked":K=J;break;case"defaultChecked":le=J;break;case"value":b=J;break;case"defaultValue":N=J;break;case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(r(137,t));break;default:J!==ce&&vt(e,t,W,J,i,ce)}}sl(e,b,N,R,K,le,f,u);return;case"select":J=b=N=W=null;for(f in n)if(R=n[f],n.hasOwnProperty(f)&&R!=null)switch(f){case"value":break;case"multiple":J=R;default:i.hasOwnProperty(f)||vt(e,t,f,null,i,R)}for(u in i)if(f=i[u],R=n[u],i.hasOwnProperty(u)&&(f!=null||R!=null))switch(u){case"value":W=f;break;case"defaultValue":N=f;break;case"multiple":b=f;default:f!==R&&vt(e,t,u,f,i,R)}t=N,n=b,i=J,W!=null?Xn(e,!!n,W,!1):!!i!=!!n&&(t!=null?Xn(e,!!n,t,!0):Xn(e,!!n,n?[]:"",!1));return;case"textarea":J=W=null;for(N in n)if(u=n[N],n.hasOwnProperty(N)&&u!=null&&!i.hasOwnProperty(N))switch(N){case"value":break;case"children":break;default:vt(e,t,N,null,i,u)}for(b in i)if(u=i[b],f=n[b],i.hasOwnProperty(b)&&(u!=null||f!=null))switch(b){case"value":W=u;break;case"defaultValue":J=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(r(91));break;default:u!==f&&vt(e,t,b,u,i,f)}fa(e,W,J);return;case"option":for(var Ne in n)W=n[Ne],n.hasOwnProperty(Ne)&&W!=null&&!i.hasOwnProperty(Ne)&&(Ne==="selected"?e.selected=!1:vt(e,t,Ne,null,i,W));for(R in i)W=i[R],J=n[R],i.hasOwnProperty(R)&&W!==J&&(W!=null||J!=null)&&(R==="selected"?e.selected=W&&typeof W!="function"&&typeof W!="symbol":vt(e,t,R,W,i,J));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Be in n)W=n[Be],n.hasOwnProperty(Be)&&W!=null&&!i.hasOwnProperty(Be)&&vt(e,t,Be,null,i,W);for(K in i)if(W=i[K],J=n[K],i.hasOwnProperty(K)&&W!==J&&(W!=null||J!=null))switch(K){case"children":case"dangerouslySetInnerHTML":if(W!=null)throw Error(r(137,t));break;default:vt(e,t,K,W,i,J)}return;default:if(cr(t)){for(var yt in n)W=n[yt],n.hasOwnProperty(yt)&&W!==void 0&&!i.hasOwnProperty(yt)&&ff(e,t,yt,void 0,i,W);for(le in i)W=i[le],J=n[le],!i.hasOwnProperty(le)||W===J||W===void 0&&J===void 0||ff(e,t,le,W,i,J);return}}for(var $ in n)W=n[$],n.hasOwnProperty($)&&W!=null&&!i.hasOwnProperty($)&&vt(e,t,$,null,i,W);for(ce in i)W=i[ce],J=n[ce],!i.hasOwnProperty(ce)||W===J||W==null&&J==null||vt(e,t,ce,W,i,J)}function ug(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function lb(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),i=0;i<n.length;i++){var u=n[i],f=u.transferSize,b=u.initiatorType,N=u.duration;if(f&&N&&ug(b)){for(b=0,N=u.responseEnd,i+=1;i<n.length;i++){var R=n[i],K=R.startTime;if(K>N)break;var le=R.transferSize,ce=R.initiatorType;le&&ug(ce)&&(R=R.responseEnd,b+=le*(R<N?1:(N-K)/(R-K)))}if(--i,t+=8*(f+b)/(u.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var mf=null,hf=null;function Fc(e){return e.nodeType===9?e:e.ownerDocument}function dg(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function fg(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function pf(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var gf=null;function ib(){var e=window.event;return e&&e.type==="popstate"?e===gf?!1:(gf=e,!0):(gf=null,!1)}var mg=typeof setTimeout=="function"?setTimeout:void 0,sb=typeof clearTimeout=="function"?clearTimeout:void 0,hg=typeof Promise=="function"?Promise:void 0,rb=typeof queueMicrotask=="function"?queueMicrotask:typeof hg<"u"?function(e){return hg.resolve(null).then(e).catch(ob)}:mg;function ob(e){setTimeout(function(){throw e})}function ui(e){return e==="head"}function pg(e,t){var n=t,i=0;do{var u=n.nextSibling;if(e.removeChild(n),u&&u.nodeType===8)if(n=u.data,n==="/$"||n==="/&"){if(i===0){e.removeChild(u),Ys(t);return}i--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")i++;else if(n==="html")no(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,no(n);for(var f=n.firstChild;f;){var b=f.nextSibling,N=f.nodeName;f[st]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&f.rel.toLowerCase()==="stylesheet"||n.removeChild(f),f=b}}else n==="body"&&no(e.ownerDocument.body);n=u}while(n);Ys(t)}function gg(e,t){var n=e;e=0;do{var i=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(e===0)break;e--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=i}while(n)}function xf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":xf(n),ln(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function cb(e,t,n,i){for(;e.nodeType===1;){var u=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!i&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(i){if(!e[st])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(f=e.getAttribute("rel"),f==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(f!==u.rel||e.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||e.getAttribute("title")!==(u.title==null?null:u.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(f=e.getAttribute("src"),(f!==(u.src==null?null:u.src)||e.getAttribute("type")!==(u.type==null?null:u.type)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&f&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var f=u.name==null?null:""+u.name;if(u.type==="hidden"&&e.getAttribute("name")===f)return e}else return e;if(e=ba(e.nextSibling),e===null)break}return null}function ub(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=ba(e.nextSibling),e===null))return null;return e}function xg(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=ba(e.nextSibling),e===null))return null;return e}function vf(e){return e.data==="$?"||e.data==="$~"}function yf(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function db(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var i=function(){t(),n.removeEventListener("DOMContentLoaded",i)};n.addEventListener("DOMContentLoaded",i),e._reactRetry=i}}function ba(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var bf=null;function vg(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return ba(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function yg(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(t===0)return e;t--}else n!=="/$"&&n!=="/&"||t++}e=e.previousSibling}return null}function bg(e,t,n){switch(t=Fc(n),e){case"html":if(e=t.documentElement,!e)throw Error(r(452));return e;case"head":if(e=t.head,!e)throw Error(r(453));return e;case"body":if(e=t.body,!e)throw Error(r(454));return e;default:throw Error(r(451))}}function no(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);ln(e)}var wa=new Map,wg=new Set;function Ic(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Tl=Z.d;Z.d={f:fb,r:mb,D:hb,C:pb,L:gb,m:xb,X:yb,S:vb,M:bb};function fb(){var e=Tl.f(),t=Dc();return e||t}function mb(e){var t=Jt(e);t!==null&&t.tag===5&&t.type==="form"?Hh(t):Tl.r(e)}var qs=typeof document>"u"?null:document;function Sg(e,t,n){var i=qs;if(i&&typeof t=="string"&&t){var u=kt(t);u='link[rel="'+e+'"][href="'+u+'"]',typeof n=="string"&&(u+='[crossorigin="'+n+'"]'),wg.has(u)||(wg.add(u),e={rel:e,crossOrigin:n,href:t},i.querySelector(u)===null&&(t=i.createElement("link"),dn(t,"link",e),Mt(t),i.head.appendChild(t)))}}function hb(e){Tl.D(e),Sg("dns-prefetch",e,null)}function pb(e,t){Tl.C(e,t),Sg("preconnect",e,t)}function gb(e,t,n){Tl.L(e,t,n);var i=qs;if(i&&e&&t){var u='link[rel="preload"][as="'+kt(t)+'"]';t==="image"&&n&&n.imageSrcSet?(u+='[imagesrcset="'+kt(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(u+='[imagesizes="'+kt(n.imageSizes)+'"]')):u+='[href="'+kt(e)+'"]';var f=u;switch(t){case"style":f=Gs(e);break;case"script":f=Ps(e)}wa.has(f)||(e=v({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),wa.set(f,e),i.querySelector(u)!==null||t==="style"&&i.querySelector(ao(f))||t==="script"&&i.querySelector(lo(f))||(t=i.createElement("link"),dn(t,"link",e),Mt(t),i.head.appendChild(t)))}}function xb(e,t){Tl.m(e,t);var n=qs;if(n&&e){var i=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+kt(i)+'"][href="'+kt(e)+'"]',f=u;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":f=Ps(e)}if(!wa.has(f)&&(e=v({rel:"modulepreload",href:e},t),wa.set(f,e),n.querySelector(u)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(lo(f)))return}i=n.createElement("link"),dn(i,"link",e),Mt(i),n.head.appendChild(i)}}}function vb(e,t,n){Tl.S(e,t,n);var i=qs;if(i&&e){var u=$t(i).hoistableStyles,f=Gs(e);t=t||"default";var b=u.get(f);if(!b){var N={loading:0,preload:null};if(b=i.querySelector(ao(f)))N.loading=5;else{e=v({rel:"stylesheet",href:e,"data-precedence":t},n),(n=wa.get(f))&&wf(e,n);var R=b=i.createElement("link");Mt(R),dn(R,"link",e),R._p=new Promise(function(K,le){R.onload=K,R.onerror=le}),R.addEventListener("load",function(){N.loading|=1}),R.addEventListener("error",function(){N.loading|=2}),N.loading|=4,Uc(b,t,i)}b={type:"stylesheet",instance:b,count:1,state:N},u.set(f,b)}}}function yb(e,t){Tl.X(e,t);var n=qs;if(n&&e){var i=$t(n).hoistableScripts,u=Ps(e),f=i.get(u);f||(f=n.querySelector(lo(u)),f||(e=v({src:e,async:!0},t),(t=wa.get(u))&&Sf(e,t),f=n.createElement("script"),Mt(f),dn(f,"link",e),n.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},i.set(u,f))}}function bb(e,t){Tl.M(e,t);var n=qs;if(n&&e){var i=$t(n).hoistableScripts,u=Ps(e),f=i.get(u);f||(f=n.querySelector(lo(u)),f||(e=v({src:e,async:!0,type:"module"},t),(t=wa.get(u))&&Sf(e,t),f=n.createElement("script"),Mt(f),dn(f,"link",e),n.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},i.set(u,f))}}function Mg(e,t,n,i){var u=(u=Fe.current)?Ic(u):null;if(!u)throw Error(r(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=Gs(n.href),n=$t(u).hoistableStyles,i=n.get(t),i||(i={type:"style",instance:null,count:0,state:null},n.set(t,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=Gs(n.href);var f=$t(u).hoistableStyles,b=f.get(e);if(b||(u=u.ownerDocument||u,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},f.set(e,b),(f=u.querySelector(ao(e)))&&!f._p&&(b.instance=f,b.state.loading=5),wa.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},wa.set(e,n),f||wb(u,e,n,b.state))),t&&i===null)throw Error(r(528,""));return b}if(t&&i!==null)throw Error(r(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Ps(n),n=$t(u).hoistableScripts,i=n.get(t),i||(i={type:"script",instance:null,count:0,state:null},n.set(t,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,e))}}function Gs(e){return'href="'+kt(e)+'"'}function ao(e){return'link[rel="stylesheet"]['+e+"]"}function Cg(e){return v({},e,{"data-precedence":e.precedence,precedence:null})}function wb(e,t,n,i){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?i.loading=1:(t=e.createElement("link"),i.preload=t,t.addEventListener("load",function(){return i.loading|=1}),t.addEventListener("error",function(){return i.loading|=2}),dn(t,"link",n),Mt(t),e.head.appendChild(t))}function Ps(e){return'[src="'+kt(e)+'"]'}function lo(e){return"script[async]"+e}function jg(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var i=e.querySelector('style[data-href~="'+kt(n.href)+'"]');if(i)return t.instance=i,Mt(i),i;var u=v({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),Mt(i),dn(i,"style",u),Uc(i,n.precedence,e),t.instance=i;case"stylesheet":u=Gs(n.href);var f=e.querySelector(ao(u));if(f)return t.state.loading|=4,t.instance=f,Mt(f),f;i=Cg(n),(u=wa.get(u))&&wf(i,u),f=(e.ownerDocument||e).createElement("link"),Mt(f);var b=f;return b._p=new Promise(function(N,R){b.onload=N,b.onerror=R}),dn(f,"link",i),t.state.loading|=4,Uc(f,n.precedence,e),t.instance=f;case"script":return f=Ps(n.src),(u=e.querySelector(lo(f)))?(t.instance=u,Mt(u),u):(i=n,(u=wa.get(f))&&(i=v({},n),Sf(i,u)),e=e.ownerDocument||e,u=e.createElement("script"),Mt(u),dn(u,"link",i),e.head.appendChild(u),t.instance=u);case"void":return null;default:throw Error(r(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(i=t.instance,t.state.loading|=4,Uc(i,n.precedence,e));return t.instance}function Uc(e,t,n){for(var i=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=i.length?i[i.length-1]:null,f=u,b=0;b<i.length;b++){var N=i[b];if(N.dataset.precedence===t)f=N;else if(f!==u)break}f?f.parentNode.insertBefore(e,f.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function wf(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Sf(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var $c=null;function Ng(e,t,n){if($c===null){var i=new Map,u=$c=new Map;u.set(n,i)}else u=$c,i=u.get(n),i||(i=new Map,u.set(n,i));if(i.has(e))return i;for(i.set(e,null),n=n.getElementsByTagName(e),u=0;u<n.length;u++){var f=n[u];if(!(f[st]||f[Y]||e==="link"&&f.getAttribute("rel")==="stylesheet")&&f.namespaceURI!=="http://www.w3.org/2000/svg"){var b=f.getAttribute(t)||"";b=e+b;var N=i.get(b);N?N.push(f):i.set(b,[f])}}return i}function Ag(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function Sb(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Tg(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Mb(e,t,n,i){if(n.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var u=Gs(i.href),f=t.querySelector(ao(u));if(f){t=f._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=qc.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=f,Mt(f);return}f=t.ownerDocument||t,i=Cg(i),(u=wa.get(u))&&wf(i,u),f=f.createElement("link"),Mt(f);var b=f;b._p=new Promise(function(N,R){b.onload=N,b.onerror=R}),dn(f,"link",i),n.instance=f}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=qc.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var Mf=0;function Cb(e,t){return e.stylesheets&&e.count===0&&Pc(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var i=setTimeout(function(){if(e.stylesheets&&Pc(e,e.stylesheets),e.unsuspend){var f=e.unsuspend;e.unsuspend=null,f()}},6e4+t);0<e.imgBytes&&Mf===0&&(Mf=62500*lb());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Pc(e,e.stylesheets),e.unsuspend)){var f=e.unsuspend;e.unsuspend=null,f()}},(e.imgBytes>Mf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(u)}}:null}function qc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Pc(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Gc=null;function Pc(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Gc=new Map,t.forEach(jb,e),Gc=null,qc.call(e))}function jb(e,t){if(!(t.state.loading&4)){var n=Gc.get(e);if(n)var i=n.get(null);else{n=new Map,Gc.set(e,n);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),f=0;f<u.length;f++){var b=u[f];(b.nodeName==="LINK"||b.getAttribute("media")!=="not all")&&(n.set(b.dataset.precedence,b),i=b)}i&&n.set(null,i)}u=t.instance,b=u.getAttribute("data-precedence"),f=n.get(b)||i,f===i&&n.set(null,u),n.set(b,u),this.count++,i=qc.bind(this),u.addEventListener("load",i),u.addEventListener("error",i),f?f.parentNode.insertBefore(u,f.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(u,e.firstChild)),t.state.loading|=4}}var io={$$typeof:L,Provider:null,Consumer:null,_currentValue:ee,_currentValue2:ee,_threadCount:0};function Nb(e,t,n,i,u,f,b,N,R){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Aa(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Aa(0),this.hiddenUpdates=Aa(null),this.identifierPrefix=i,this.onUncaughtError=u,this.onCaughtError=f,this.onRecoverableError=b,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=R,this.incompleteTransitions=new Map}function kg(e,t,n,i,u,f,b,N,R,K,le,ce){return e=new Nb(e,t,n,b,R,K,le,ce,N),t=1,f===!0&&(t|=24),f=vn(3,null,null,t),e.current=f,f.stateNode=e,t=td(),t.refCount++,e.pooledCache=t,t.refCount++,f.memoizedState={element:i,isDehydrated:n,cache:t},id(f),e}function Eg(e){return e?(e=Lt,e):Lt}function Dg(e,t,n,i,u,f){u=Eg(u),i.context===null?i.context=u:i.pendingContext=u,i=Jl(t),i.payload={element:n},f=f===void 0?null:f,f!==null&&(i.callback=f),n=ei(e,i,t),n!==null&&(Un(n,e,t),Br(n,e,t))}function Rg(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Cf(e,t){Rg(e,t),(e=e.alternate)&&Rg(e,t)}function Lg(e){if(e.tag===13||e.tag===31){var t=xa(e,67108864);t!==null&&Un(t,e,67108864),Cf(e,67108864)}}function zg(e){if(e.tag===13||e.tag===31){var t=aa();t=En(t);var n=xa(e,t);n!==null&&Un(n,e,t),Cf(e,t)}}var Yc=!0;function Ab(e,t,n,i){var u=I.T;I.T=null;var f=Z.p;try{Z.p=2,jf(e,t,n,i)}finally{Z.p=f,I.T=u}}function Tb(e,t,n,i){var u=I.T;I.T=null;var f=Z.p;try{Z.p=8,jf(e,t,n,i)}finally{Z.p=f,I.T=u}}function jf(e,t,n,i){if(Yc){var u=Nf(i);if(u===null)df(e,t,i,Vc,n),Og(e,i);else if(Eb(u,e,t,n,i))i.stopPropagation();else if(Og(e,i),t&4&&-1<kb.indexOf(e)){for(;u!==null;){var f=Jt(u);if(f!==null)switch(f.tag){case 3:if(f=f.stateNode,f.current.memoizedState.isDehydrated){var b=Tn(f.pendingLanes);if(b!==0){var N=f;for(N.pendingLanes|=2,N.entangledLanes|=2;b;){var R=1<<31-Ot(b);N.entanglements[1]|=R,b&=~R}Ka(f),(ot&6)===0&&(kc=ze()+500,Jr(0))}}break;case 31:case 13:N=xa(f,2),N!==null&&Un(N,f,2),Dc(),Cf(f,2)}if(f=Nf(i),f===null&&df(e,t,i,Vc,n),f===u)break;u=f}u!==null&&i.stopPropagation()}else df(e,t,i,null,n)}}function Nf(e){return e=ts(e),Af(e)}var Vc=null;function Af(e){if(Vc=null,e=Ut(e),e!==null){var t=d(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=h(t),e!==null)return e;e=null}else if(n===31){if(e=p(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Vc=e,null}function _g(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(lt()){case Mn:return 2;case it:return 8;case Nn:case ja:return 32;case Na:return 268435456;default:return 32}default:return 32}}var Tf=!1,di=null,fi=null,mi=null,so=new Map,ro=new Map,hi=[],kb="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Og(e,t){switch(e){case"focusin":case"focusout":di=null;break;case"dragenter":case"dragleave":fi=null;break;case"mouseover":case"mouseout":mi=null;break;case"pointerover":case"pointerout":so.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ro.delete(t.pointerId)}}function oo(e,t,n,i,u,f){return e===null||e.nativeEvent!==f?(e={blockedOn:t,domEventName:n,eventSystemFlags:i,nativeEvent:f,targetContainers:[u]},t!==null&&(t=Jt(t),t!==null&&Lg(t)),e):(e.eventSystemFlags|=i,t=e.targetContainers,u!==null&&t.indexOf(u)===-1&&t.push(u),e)}function Eb(e,t,n,i,u){switch(t){case"focusin":return di=oo(di,e,t,n,i,u),!0;case"dragenter":return fi=oo(fi,e,t,n,i,u),!0;case"mouseover":return mi=oo(mi,e,t,n,i,u),!0;case"pointerover":var f=u.pointerId;return so.set(f,oo(so.get(f)||null,e,t,n,i,u)),!0;case"gotpointercapture":return f=u.pointerId,ro.set(f,oo(ro.get(f)||null,e,t,n,i,u)),!0}return!1}function Bg(e){var t=Ut(e.target);if(t!==null){var n=d(t);if(n!==null){if(t=n.tag,t===13){if(t=h(n),t!==null){e.blockedOn=t,wi(e.priority,function(){zg(n)});return}}else if(t===31){if(t=p(n),t!==null){e.blockedOn=t,wi(e.priority,function(){zg(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Qc(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Nf(e.nativeEvent);if(n===null){n=e.nativeEvent;var i=new n.constructor(n.type,n);es=i,n.target.dispatchEvent(i),es=null}else return t=Jt(n),t!==null&&Lg(t),e.blockedOn=n,!1;t.shift()}return!0}function Hg(e,t,n){Qc(e)&&n.delete(t)}function Db(){Tf=!1,di!==null&&Qc(di)&&(di=null),fi!==null&&Qc(fi)&&(fi=null),mi!==null&&Qc(mi)&&(mi=null),so.forEach(Hg),ro.forEach(Hg)}function Kc(e,t){e.blockedOn===t&&(e.blockedOn=null,Tf||(Tf=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,Db)))}var Xc=null;function Fg(e){Xc!==e&&(Xc=e,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){Xc===e&&(Xc=null);for(var t=0;t<e.length;t+=3){var n=e[t],i=e[t+1],u=e[t+2];if(typeof i!="function"){if(Af(i||n)===null)continue;break}var f=Jt(n);f!==null&&(e.splice(t,3),t-=3,jd(f,{pending:!0,data:u,method:n.method,action:i},i,u))}}))}function Ys(e){function t(R){return Kc(R,e)}di!==null&&Kc(di,e),fi!==null&&Kc(fi,e),mi!==null&&Kc(mi,e),so.forEach(t),ro.forEach(t);for(var n=0;n<hi.length;n++){var i=hi[n];i.blockedOn===e&&(i.blockedOn=null)}for(;0<hi.length&&(n=hi[0],n.blockedOn===null);)Bg(n),n.blockedOn===null&&hi.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(i=0;i<n.length;i+=3){var u=n[i],f=n[i+1],b=u[he]||null;if(typeof f=="function")b||Fg(n);else if(b){var N=null;if(f&&f.hasAttribute("formAction")){if(u=f,b=f[he]||null)N=b.formAction;else if(Af(u)!==null)continue}else N=b.action;typeof N=="function"?n[i+1]=N:(n.splice(i,3),i-=3),Fg(n)}}}function Ig(){function e(f){f.canIntercept&&f.info==="react-transition"&&f.intercept({handler:function(){return new Promise(function(b){return u=b})},focusReset:"manual",scroll:"manual"})}function t(){u!==null&&(u(),u=null),i||setTimeout(n,20)}function n(){if(!i&&!navigation.transition){var f=navigation.currentEntry;f&&f.url!=null&&navigation.navigate(f.url,{state:f.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var i=!1,u=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){i=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),u!==null&&(u(),u=null)}}}function kf(e){this._internalRoot=e}Zc.prototype.render=kf.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));var n=t.current,i=aa();Dg(n,i,e,t,null,null)},Zc.prototype.unmount=kf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Dg(e.current,2,null,e,null,null),Dc(),t[Se]=null}};function Zc(e){this._internalRoot=e}Zc.prototype.unstable_scheduleHydration=function(e){if(e){var t=gn();e={blockedOn:null,target:e,priority:t};for(var n=0;n<hi.length&&t!==0&&t<hi[n].priority;n++);hi.splice(n,0,e),n===0&&Bg(e)}};var Ug=l.version;if(Ug!=="19.2.7")throw Error(r(527,Ug,"19.2.7"));Z.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(r(188)):(e=Object.keys(e).join(","),Error(r(268,e)));return e=x(t),e=e!==null?y(e):null,e=e===null?null:e.stateNode,e};var Rb={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:I,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Wc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Wc.isDisabled&&Wc.supportsFiber)try{Qn=Wc.inject(Rb),ut=Wc}catch{}}return uo.createRoot=function(e,t){if(!c(e))throw Error(r(299));var n=!1,i="",u=Qh,f=Kh,b=Xh;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onUncaughtError!==void 0&&(u=t.onUncaughtError),t.onCaughtError!==void 0&&(f=t.onCaughtError),t.onRecoverableError!==void 0&&(b=t.onRecoverableError)),t=kg(e,1,!1,null,null,n,i,null,u,f,b,Ig),e[Se]=t.current,uf(e),new kf(t)},uo.hydrateRoot=function(e,t,n){if(!c(e))throw Error(r(299));var i=!1,u="",f=Qh,b=Kh,N=Xh,R=null;return n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(u=n.identifierPrefix),n.onUncaughtError!==void 0&&(f=n.onUncaughtError),n.onCaughtError!==void 0&&(b=n.onCaughtError),n.onRecoverableError!==void 0&&(N=n.onRecoverableError),n.formState!==void 0&&(R=n.formState)),t=kg(e,1,!0,t,n??null,i,u,R,f,b,N,Ig),t.context=Eg(null),n=t.current,i=aa(),i=En(i),u=Jl(i),u.callback=null,ei(n,u,i),n=i,t.current.lanes=n,oa(t,n),Ka(t),e[Se]=t.current,uf(e),new Zc(t)},uo.version="19.2.7",uo}var Jg;function a0(){if(Jg)return zf.exports;Jg=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(l){console.error(l)}}return a(),zf.exports=n0(),zf.exports}var l0=a0();const i0="https://otbyfkjxrkngvjziawki.supabase.co",s0="sb_publishable_NpUs0RDJH2YnllsqTKO6TQ_1jTdSsNQ",Za=Zb(i0,s0,{auth:{autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"pkce",storageKey:"livedesk.mindexec.supabase.auth"}});function xi(a,l,s){if(s<0||l<0||l+s>a.length)throw new Error("Invalid LZO1X block: input overrun.")}function Bf(a,l,s){let r=0;for(;xi(a,l.inputIndex,1),a[l.inputIndex]===0;)r+=1,l.inputIndex+=1;const c=r*255+s+a[l.inputIndex];return l.inputIndex+=1,c}function Jc(a,l,s,r){if(xi(a,l.inputIndex,r),l.outputIndex+r>s.length)throw new Error("Invalid LZO1X block: output overrun.");s.set(a.subarray(l.inputIndex,l.inputIndex+r),l.outputIndex),l.inputIndex+=r,l.outputIndex+=r}function r0(a,l,s,r){const c=l-s;if(c<=0||r<=0)throw new Error("Invalid LZO1X block: invalid match distance.");let d=Math.min(c,r);for(a.set(a.subarray(s,s+d),l);d<r;){const h=Math.min(d,r-d);a.copyWithin(l+d,l,l+h),d+=h}return l+r}function fv(a,l){if(!(a instanceof Uint8Array)||a.length<3||l<0)throw new Error("Invalid LZO1X block.");const s=new Uint8Array(l),r={inputIndex:0,outputIndex:0};let c=0,d=0;if(a[r.inputIndex]>=22){const h=a[r.inputIndex]-17;r.inputIndex+=1,Jc(a,r,s,h),c=4}else a[r.inputIndex]>=18&&(c=a[r.inputIndex]-17,r.inputIndex+=1,Jc(a,r,s,c));for(;;){xi(a,r.inputIndex,1);const h=a[r.inputIndex];r.inputIndex+=1;let p,g;if((h&192)!==0)xi(a,r.inputIndex,1),g=r.outputIndex-((a[r.inputIndex]<<3)+(h>>2&7)+1),r.inputIndex+=1,d=(h>>5)+1,p=h&3;else if((h&32)!==0){d=(h&31)+2,d===2&&(d+=Bf(a,r,31)),xi(a,r.inputIndex,2);const x=a[r.inputIndex]|a[r.inputIndex+1]<<8;r.inputIndex+=2,g=r.outputIndex-((x>>2)+1),p=x&3}else if((h&16)!==0){d=(h&7)+2,d===2&&(d+=Bf(a,r,7)),xi(a,r.inputIndex,2);const x=a[r.inputIndex]|a[r.inputIndex+1]<<8;if(r.inputIndex+=2,g=r.outputIndex-(((h&8)<<11)+(x>>2)),p=x&3,g===r.outputIndex)break;g-=16384}else if(c===0){let x=h+3;x===3&&(x+=Bf(a,r,15)),Jc(a,r,s,x),c=4;continue}else c!==4?(xi(a,r.inputIndex,1),p=h&3,g=r.outputIndex-((h>>2)+(a[r.inputIndex]<<2)+1),r.inputIndex+=1,d=2):(xi(a,r.inputIndex,1),p=h&3,g=r.outputIndex-((h>>2)+(a[r.inputIndex]<<2)+2049),r.inputIndex+=1,d=3);if(g<0||r.outputIndex+d+p>s.length)throw new Error("Invalid LZO1X block: lookbehind overrun.");r.outputIndex=r0(s,r.outputIndex,g,d),c=p,Jc(a,r,s,p)}if(d!==3||r.inputIndex!==a.length||r.outputIndex!==s.length)throw new Error("Invalid LZO1X block: incomplete output.");return s}const ex=16,tx=8,o0=24*1024*1024,mv=new Uint8Array(new Uint32Array([16909060]).buffer)[0]===4,om=new Uint32Array(65536);for(let a=0;a<om.length;a+=1){const l=Math.round((a>>11&31)*255/31),s=Math.round((a>>5&63)*255/63),r=Math.round((a&31)*255/31);om[a]=mv?(l|s<<8|r<<16|4278190080)>>>0:(l<<24|s<<16|r<<8|255)>>>0}function gi(a,l){return a[l]|a[l+1]<<8}function c0(a,l){const s=Number(l);if(!Number.isSafeInteger(s)||s<ex||s>o0)throw new Error(`Invalid Mode 5 packet length: ${l}.`);const r=fv(new Uint8Array(a),s);if(r[0]!==76||r[1]!==68||r[2]!==53||r[3]!==68)throw new Error("Invalid Mode 5 packet magic.");if(r[4]!==1)throw new Error(`Unsupported Mode 5 packet version: ${r[4]}.`);const c=(r[5]&1)!==0,d=gi(r,6),h=gi(r,8),p=gi(r,10),g=gi(r,12);if(d<=0||h<=0||d>3840||h>2160)throw new Error(`Invalid Mode 5 frame size: ${d}x${h}.`);if(p<=0||p>256||g>8192)throw new Error(`Invalid Mode 5 tile header: ${p}/${g}.`);const x=[];let y=ex;for(let v=0;v<g;v+=1){if(y+tx>r.length)throw new Error("Mode 5 tile header is truncated.");const w=gi(r,y),M=gi(r,y+2),C=gi(r,y+4),j=gi(r,y+6);y+=tx;const k=C*j*2;if(C<=0||j<=0||C>p||j>p||w+C>d||M+j>h||y+k>r.length)throw new Error(`Invalid Mode 5 tile ${v}.`);x.push({x:w,y:M,width:C,height:j,pixels:r.subarray(y,y+k)}),y+=k}if(y!==r.length)throw new Error(`Mode 5 packet has ${r.length-y} trailing bytes.`);return{keyFrame:c,width:d,height:h,tileSize:p,tiles:x}}function u0(a,l,s,r){if(!(a instanceof Uint8ClampedArray)||a.length!==l*s*4||r.width!==l||r.height!==s)throw new Error("Mode 5 canvas state does not match the packet dimensions.");let c=l,d=s,h=0,p=0;const g=new Uint32Array(a.buffer,a.byteOffset,a.byteLength>>>2);for(const x of r.tiles){const y=mv&&(x.pixels.byteOffset&1)===0?new Uint16Array(x.pixels.buffer,x.pixels.byteOffset,x.pixels.byteLength>>>1):null;let v=0;for(let w=0;w<x.height;w+=1){let M=(x.y+w)*l+x.x;for(let C=0;C<x.width;C+=1){const j=v<<1,k=y?y[v]:x.pixels[j]|x.pixels[j+1]<<8;g[M]=om[k],v+=1,M+=1}}c=Math.min(c,x.x),d=Math.min(d,x.y),h=Math.max(h,x.x+x.width),p=Math.max(p,x.y+x.height)}return r.tiles.length>0?{x:c,y:d,width:h-c,height:p-d}:null}const Yn=new WeakMap,Ao=new WeakMap,cm=new WeakMap,To=new Set,Qi=new Set,Mu=new WeakMap,um=new WeakMap,dm=new WeakMap,Cu=new WeakMap,Tm=32,d0=2,f0=2,m0=2,h0=18,p0=40,g0=0,x0=750,hv=80,nx=5,v0=150,y0=24,b0=180,w0=1200,S0=18,M0=.65,C0=2e3,j0=500,pv=250;let ju=!1;function N0(){return typeof navigator>"u"?!1:/mac/i.test(`${navigator.platform||""} ${navigator.userAgent||""}`)}function A0(){const a=Math.max(1,Number(navigator.hardwareConcurrency||8));return Math.max(4,Math.min(16,Math.round(a/2)))}let Ki={h264DecodeAcceleration:"prefer-hardware",h264HardwareDecoderBudget:A0()};function T0(a){a.h264DecodeAcceleration&&(Ki={...Ki,h264DecodeAcceleration:a.h264DecodeAcceleration}),Number.isFinite(Number(a.h264HardwareDecoderBudget))&&(Ki.h264HardwareDecoderBudget=Math.max(1,Math.min(64,Math.round(Number(a.h264HardwareDecoderBudget)))))}function gv(a,l=Ki.h264DecodeAcceleration){const s=Mu.get(a);return s?.requested===l?(s.actual!=="prefer-hardware"&&Qi.delete(a),s.actual):(s&&Mu.delete(a),l!=="prefer-hardware"?(Qi.delete(a),l):Qi.has(a)?"prefer-hardware":Qi.size<Ki.h264HardwareDecoderBudget?(Qi.add(a),"prefer-hardware"):"prefer-software")}function Ru(a,l){return l!=="prefer-hardware"?!1:(Mu.set(a,{requested:l,actual:"prefer-software"}),Qi.delete(a),!0)}function k0(a,l,s,r=64){try{let c=um.get(a);c||(c={canvas:document.createElement("canvas"),lastHash:"",initialized:!1},um.set(a,c));const d=Math.max(8,Math.min(64,Math.round(r))),h=Math.max(1,Math.round(d*Math.max(1,s)/Math.max(1,l)));(c.canvas.width!==d||c.canvas.height!==h)&&(c.canvas.width=d,c.canvas.height=h);const p=c.canvas.getContext("2d",{willReadFrequently:!0});if(!p)return{visualHash:"",visualChanged:!0};p.drawImage(a,0,0,Math.max(1,l),Math.max(1,s),0,0,d,h);const g=p.getImageData(0,0,d,h).data;let x=2166136261;for(let w=0;w<g.length;w+=4)x^=g[w],x=Math.imul(x,16777619),x^=g[w+1],x=Math.imul(x,16777619),x^=g[w+2],x=Math.imul(x,16777619);const y=(x>>>0).toString(16).padStart(8,"0"),v=!c.initialized||y!==c.lastHash;return c.initialized=!0,c.lastHash=y,{visualHash:y,visualChanged:v}}catch{return{visualHash:"",visualChanged:!0}}}function fm(a,l,s,r=pv,c=64){let d=dm.get(a);d||(d={lastHash:"",initialized:!1,lastCanvasSampleAt:0},dm.set(a,d));const h=performance.now();if(d.initialized&&r>0&&h-d.lastCanvasSampleAt<r)return{visualHash:d.lastHash,visualChanged:!1};const p=k0(a,l,s,c);return d.initialized=!0,d.lastHash=p.visualHash,d.lastCanvasSampleAt=h,p}function E0(a,l){let s=Cu.get(a);s||(s={lastHash:"",initialized:!1},Cu.set(a,s));const r=String(l.contentHash||""),c=!s.initialized||!r||r!==s.lastHash;return s.initialized=!0,s.lastHash=r,{visualHash:r,visualChanged:c}}function xv(a,l){const s=cm.get(a);if(s)return s;const r=a.getContext("2d",{alpha:!1,desynchronized:l==="interactive"});if(r){const c=r.getContextAttributes?.(),d={context:r,presentation:c?.desynchronized?"desync":"sync"};return cm.set(a,d),d}return null}function D0(a){const l=String(a.frameMode||a.mode||"").toLowerCase(),s=String(a.compression||"").toLowerCase(),r=String(a.mimeType||"").toLowerCase();return l==="mode2-lzo"||s==="lzo1x"||r==="application/vnd.livedesk.lzo-rgb565"||l==="mode2-lz4"||String(a.compression||"").toLowerCase()==="lz4"||r==="application/vnd.livedesk.lz4-raw"}function R0(a){return String(a.frameMode||a.mode||"").toLowerCase()==="mode3-h264-hw"||String(a.codec||"").toLowerCase()==="h264"||String(a.mimeType||"").toLowerCase()==="video/h264"}function L0(a){const l=String(a.frameMode||a.mode||"").toLowerCase(),s=String(a.mimeType||"").toLowerCase();return l==="mode5-lzo-delta"||s==="application/vnd.livedesk.lzo-rgb565-delta"}function ax(a,l,s){let r=s,c=l;if(r===15){let d=255;for(;d===255;){if(c>=a.length)throw new Error("Invalid LZ4 block: length overrun.");d=a[c],c+=1,r+=d}}return{length:r,cursor:c}}function z0(a,l){const s=new Uint8Array(l);let r=0,c=0;for(;r<a.length;){const d=a[r];r+=1;const h=ax(a,r,d>>4);r=h.cursor;const p=h.length;if(r+p>a.length||c+p>s.length)throw new Error("Invalid LZ4 block: literal overrun.");if(s.set(a.subarray(r,r+p),c),r+=p,c+=p,r>=a.length)break;if(r+2>a.length)throw new Error("Invalid LZ4 block: missing offset.");const g=a[r]|a[r+1]<<8;if(r+=2,g<=0||g>c)throw new Error("Invalid LZ4 block: bad match offset.");const x=ax(a,r,d&15);r=x.cursor;const y=x.length+4;if(c+y>s.length)throw new Error("Invalid LZ4 block: match overrun.");let v=c-g;for(let w=0;w<y;w+=1)s[c]=s[v],c+=1,v+=1}if(c!==s.length)throw new Error("Invalid LZ4 block: incomplete output.");return s}function _0(a){const l=Math.max(1,Math.floor(a.width||0)),s=Math.max(1,Math.floor(a.height||0)),r=String(a.compression||"").toLowerCase(),c=String(a.pixelFormat||a.codec||"").toLowerCase();if(r==="lzo1x"||String(a.frameMode||a.mode||"").toLowerCase()==="mode2-lzo"||String(a.mimeType||"").toLowerCase()==="application/vnd.livedesk.lzo-rgb565"){const y=Math.max(1,Math.floor(a.bytesPerPixel||2)),v=l*s*2,w=Math.floor(a.uncompressedByteLength||v);if(y!==2||w!==v)throw new Error(`Invalid mode2 RGB565 frame size: ${w} for ${l}x${s}.`);if(c&&c!=="rgb565le"&&c!=="rgb565")throw new Error(`Unsupported mode2 pixel format: ${c}`);const M=fv(new Uint8Array(a.payload),v),C=new Uint8ClampedArray(l*s*4);for(let j=0,k=0;j<M.length;j+=2,k+=4){const T=M[j]|M[j+1]<<8,A=T>>11&31,L=T>>5&63,q=T&31;C[k]=A<<3|A>>2,C[k+1]=L<<2|L>>4,C[k+2]=q<<3|q>>2,C[k+3]=255}return new ImageData(C,l,s)}const h=Math.max(1,Math.floor(a.bytesPerPixel||4)),p=Math.max(l*s*h,Math.floor(a.uncompressedByteLength||0)),g=z0(new Uint8Array(a.payload),p);if(h!==4)throw new Error(`Unsupported mode2 pixel size: ${h}`);const x=new Uint8ClampedArray(l*s*4);if(c==="rgba32"||c==="rgba")x.set(g.subarray(0,x.length));else for(let y=0,v=0;v<x.length;y+=4,v+=4)x[v]=g[y+2],x[v+1]=g[y+1],x[v+2]=g[y],x[v+3]=g[y+3];return new ImageData(x,l,s)}function lx(a,l="smooth"){const s=window.VideoDecoder;if(!s||!window.EncodedVideoChunk)throw new Error("WebCodecs H.264 decode is not supported in this browser.");const r=Yn.get(a);if(r&&r.decoder.state!=="closed"&&r.latencyMode===l)return r;r&&Oa(a);let c;return c={decoder:new s({output:h=>{if(Yn.get(a)!==c){h.close();return}const p=Number(h.timestamp||0);c.outputSerial+=1;let g=c.pendingFrames.get(p);if(g)c.pendingFrames.delete(p);else if(c.pendingFrames.size>0){const C=c.pendingFrames.entries().next().value;C&&(c.pendingFrames.delete(C[0]),g=C[1],c.timestampFallbacks+=1)}const x=h.displayWidth||h.codedWidth||a.width||960,y=h.displayHeight||h.codedHeight||a.height||540,v=Number(g?.frame.durationUs||0),w=Number(h.duration||0),M=Math.max(16,Math.min(250,(v>0?v:w||83333)/1e3));for(c.targetPaintIntervalMs=M,c.decodedFrames.push({videoFrame:h,pending:g,decodedAt:performance.now(),width:x,height:y,durationMs:M}),c.lastOutputAt=performance.now();c.decodedFrames.length>vv(c);)Nu(c,c.decodedFrames.shift());yv(c),c.renderTimer!==null&&c.renderScheduledAt>0&&performance.now()-c.renderScheduledAt>j0&&(typeof document>"u"||document.visibilityState==="visible")&&(window.cancelAnimationFrame(c.renderTimer),c.renderTimer=null,c.renderScheduledAt=0),c.renderTimer!==null&&c.decodedFrames.length>=Tm&&(window.cancelAnimationFrame(c.renderTimer),c.renderTimer=null,c.renderScheduledAt=0),Au(a,c)},error:()=>{Yn.get(a)===c&&(Ru(a,c.hardwareAcceleration),km(c),To.delete(a),Yn.delete(a))}}),configured:!1,configKey:"",hardwareAcceleration:gv(a),latencyMode:l,keyFrameSeen:!1,droppedForLatency:0,pendingFrames:new Map,decodedFrames:[],renderTimer:null,renderScheduledAt:0,flushTimer:null,flushInFlight:!1,flushCount:0,timestampFallbacks:0,inputSerial:0,outputSerial:0,lastFlushInputSerial:0,lastOutputAt:0,lastPaintAt:0,lastInputAt:0,interactiveBufferPrimed:!1,interactiveBufferStartedAt:0,interactiveBufferWaitCount:0,interactiveBufferWaitMs:0,interactiveQueueDrainCount:0,lastInputFrameSeq:void 0,targetPaintIntervalMs:1e3/12,nextChunkTimestampUs:0,healthSampleStartedAt:performance.now(),healthInputSerial:0,healthOutputSerial:0},Yn.set(a,c),To.add(a),c}function km(a){a.renderTimer!==null&&(window.cancelAnimationFrame(a.renderTimer),a.renderTimer=null),a.renderScheduledAt=0,a.flushTimer!==null&&(window.clearTimeout(a.flushTimer),a.flushTimer=null),a.flushInFlight=!1;for(const l of a.decodedFrames)l.videoFrame.close();a.decodedFrames=[],a.interactiveBufferPrimed=!1,a.interactiveBufferStartedAt=0}function Nu(a,l){l&&(l.videoFrame.close(),a.droppedForLatency+=1)}function vv(a){return a.latencyMode==="interactive"?f0:String(a.decodedFrames[0]?.pending?.frame.frameMode||a.decodedFrames[0]?.pending?.frame.mode||"").toLowerCase()==="mode4-h264-atlas"?d0:Tm}function yv(a,l=performance.now()){const s=vv(a);for(;a.decodedFrames.length>s;)Nu(a,a.decodedFrames.shift());const r=a.latencyMode==="interactive"?hv:x0;let c=a.decodedFrames[0];for(;a.decodedFrames.length>1&&c?.pending&&l-c.pending.queuedAt>r;)Nu(a,a.decodedFrames.shift()),c=a.decodedFrames[0]}function bv(a,l){if(l.hardwareAcceleration!=="prefer-hardware"||l.flushTimer!==null||l.flushInFlight)return;const s=l.latencyMode==="interactive"?y0:v0,r=l.latencyMode==="interactive";l.flushTimer=window.setTimeout(async()=>{l.flushTimer=null;const c=performance.now();for(const[p,g]of l.pendingFrames.entries())c-g.queuedAt>C0&&l.pendingFrames.delete(p);if(Yn.get(a)!==l||l.decoder.state!=="configured"||l.pendingFrames.size===0||l.inputSerial<=l.lastFlushInputSerial||!r&&l.lastOutputAt>0&&c-l.lastOutputAt<s)return;const d=l.inputSerial,h=performance.now();l.flushInFlight=!0,l.flushCount+=1;try{await l.decoder.flush(),l.lastFlushInputSerial=Math.max(l.lastFlushInputSerial,d)}catch{Yn.get(a)===l&&hu(l)}finally{l.flushInFlight=!1;const p=performance.now()-h;if(r&&p>=b0&&l.hardwareAcceleration==="prefer-hardware"){ju=!0,Ru(a,l.hardwareAcceleration),Oa(a);return}Yn.get(a)===l&&l.inputSerial>d&&l.pendingFrames.size>0&&(r||performance.now()-l.lastOutputAt>=s)&&bv(a,l)}},s)}function ix(a,l,s){const r=performance.now();try{(a.width!==s.width||a.height!==s.height)&&(a.width=s.width,a.height=s.height);const c=xv(a,l.latencyMode);if(c?.context.drawImage(s.videoFrame,0,0,s.width,s.height),s.pending){const d=performance.now(),p=l.latencyMode==="interactive"?E0(a,s.pending.frame):fm(a,s.width,s.height,pv,64);try{l.onPaint?.(s.pending.frame,{deviceId:s.pending.frame.deviceId,frameSeq:s.pending.frame.frameSeq,mode:s.pending.frame.frameMode||s.pending.frame.mode||s.pending.frame.codec||s.pending.frame.mimeType,width:s.width,height:s.height,byteLength:s.pending.frame.byteLength,queuedForMs:Math.max(0,r-s.pending.queuedAt),decodedForMs:Math.max(0,s.decodedAt-s.pending.queuedAt),scheduledForMs:Math.max(0,r-s.decodedAt),drawMs:Math.max(0,d-r),queueSize:s.pending.queueSize,renderQueueSize:l.decodedFrames.length,droppedForLatency:l.droppedForLatency,h264DecodeAcceleration:l.hardwareAcceleration,decoderLabel:l.hardwareAcceleration,decoderFlushCount:l.flushCount,decoderTimestampFallbacks:l.timestampFallbacks,decoderInputCount:l.inputSerial,decoderOutputCount:l.outputSerial,targetPaintIntervalMs:l.targetPaintIntervalMs,canvasPresentation:c?.presentation||"sync",interactiveBufferWaitCount:l.interactiveBufferWaitCount,interactiveBufferWaitMs:l.interactiveBufferWaitMs,interactiveQueueDrainCount:l.interactiveQueueDrainCount,visualHash:p.visualHash,visualChanged:p.visualChanged,paintedAt:d})}catch{}}l.lastPaintAt=performance.now()}finally{s.videoFrame.close()}}function Au(a,l){if(l.renderTimer!==null||l.decodedFrames.length===0)return;const s=Math.max(16,Math.min(250,l.targetPaintIntervalMs||1e3/12)),r=()=>{if(l.renderTimer=null,l.renderScheduledAt=0,l.decodedFrames.length===0)return;const c=performance.now();if(yv(l,c),l.decodedFrames.length===0)return;if(l.latencyMode==="interactive"){const g=l.targetPaintIntervalMs<=p0,x=l.targetPaintIntervalMs<=20;if(x&&!l.interactiveBufferPrimed){l.interactiveBufferStartedAt<=0&&(l.interactiveBufferStartedAt=c,l.interactiveBufferWaitCount+=1);const j=l.decodedFrames.length>=m0,k=c-l.interactiveBufferStartedAt>=h0;if(!j&&!k){l.renderScheduledAt=performance.now(),l.renderTimer=window.requestAnimationFrame(r);return}l.interactiveBufferWaitMs+=Math.max(0,c-l.interactiveBufferStartedAt),l.interactiveBufferPrimed=!0}else x||(l.interactiveBufferPrimed=!0);const y=l.decodedFrames[0],v=y?.pending?Math.max(0,c-y.pending.queuedAt):0,w=l.lastPaintAt>0?l.lastPaintAt+s:c;if(!(!g||c+nx>=w||v>=hv)){l.renderScheduledAt=performance.now(),l.renderTimer=window.requestAnimationFrame(r);return}const C=l.decodedFrames.shift();if(C)try{ix(a,l,C)}catch{}l.decodedFrames.length===0&&(l.interactiveQueueDrainCount+=1,l.interactiveBufferPrimed=!1,l.interactiveBufferStartedAt=0),Au(a,l);return}const d=l.lastPaintAt>0?l.lastPaintAt+s:c+g0;if(!(c+nx>=d||l.decodedFrames.length>=Tm-1)){l.renderScheduledAt=performance.now(),l.renderTimer=window.requestAnimationFrame(r);return}const p=l.decodedFrames.shift();if(p)try{ix(a,l,p)}catch{}Au(a,l)};l.renderScheduledAt=performance.now(),l.renderTimer=window.requestAnimationFrame(r)}function wv(a,l){if(Yn.get(a)!==l||l.decoder.state==="closed")return!1;for(l.renderTimer!==null&&(window.cancelAnimationFrame(l.renderTimer),l.renderTimer=null),l.renderScheduledAt=0;l.decodedFrames.length>1;)Nu(l,l.decodedFrames.shift());return l.lastPaintAt=0,l.interactiveBufferPrimed=!1,l.interactiveBufferStartedAt=0,Au(a,l),!0}function Hf(){if(!(typeof document>"u"||document.visibilityState!=="visible"))for(const a of To){const l=Yn.get(a);if(!l||l.decoder.state==="closed"){To.delete(a);continue}wv(a,l)}}typeof document<"u"&&typeof window<"u"&&(document.addEventListener("visibilitychange",Hf),window.addEventListener("focus",Hf),window.addEventListener("pageshow",Hf));function Oa(a){Qi.delete(a),To.delete(a),Cu.delete(a);const l=Yn.get(a);if(l){Yn.delete(a);try{km(l),l.decoder.state!=="closed"&&l.decoder.close()}catch{}}}function Ff(a){a&&(Mu.delete(a),cm.delete(a),dm.delete(a),um.delete(a),Cu.delete(a),Ao.delete(a),Oa(a))}function hu(a,l=1){try{a.decoder.state!=="closed"&&a.decoder.reset()}catch{}a.configured=!1,a.configKey="",a.keyFrameSeen=!1,a.pendingFrames.clear(),km(a),a.lastPaintAt=0,a.lastOutputAt=0,a.lastInputAt=0,a.interactiveBufferPrimed=!1,a.interactiveBufferStartedAt=0,a.lastInputFrameSeq=void 0,a.nextChunkTimestampUs=0,a.healthSampleStartedAt=performance.now(),a.healthInputSerial=a.inputSerial,a.healthOutputSerial=a.outputSerial,a.droppedForLatency+=Math.max(1,Math.min(1e4,Math.floor(l)))}function eu(a,l,s,r){a.decoder.configure(l),a.configured=!0,a.configKey=s,a.hardwareAcceleration=r,a.keyFrameSeen=!1,a.nextChunkTimestampUs=0,a.lastInputFrameSeq=void 0}function O0(a,l){if(l.latencyMode!=="interactive"||l.hardwareAcceleration!=="prefer-hardware")return!1;const s=performance.now();if(s-l.healthSampleStartedAt<w0)return!1;const r=l.inputSerial-l.healthInputSerial,c=l.outputSerial-l.healthOutputSerial;return l.healthSampleStartedAt=s,l.healthInputSerial=l.inputSerial,l.healthOutputSerial=l.outputSerial,r<S0||c/Math.max(1,r)>=M0?!1:(ju=!0,Ru(a,l.hardwareAcceleration),Oa(a),!0)}function sx(a,l=1){if(!a)return!1;const s=Yn.get(a);return s?(s.droppedForLatency+=Math.max(1,Math.min(1e4,Math.floor(l))),Oa(a),!0):!1}function B0(a){if(!a)return!1;const l=Yn.get(a);return l?wv(a,l):!1}function H0(a,l,s,r="interactive"){Oa(a);const c=performance.now(),d=c0(l.payload,l.uncompressedByteLength||0),h=String(l.streamId||"mode5");let p=Ao.get(a);if(!p||p.streamId!==h||p.width!==d.width||p.height!==d.height){const j=new Uint8ClampedArray(d.width*d.height*4);for(let k=3;k<j.length;k+=4)j[k]=255;p={streamId:h,width:d.width,height:d.height,rgba:j,imageData:new ImageData(j,d.width,d.height),keyFrameSeen:!1,inputSerial:0,outputSerial:0},Ao.set(a,p)}if(!p)throw new Error("Mode 5 canvas state could not be initialized.");p.inputSerial+=1;const x=Number(l.streamFrameSeq||0);if(x>0&&(p.lastStreamFrameSeq=x),!d.keyFrame&&!p.keyFrameSeen)return;d.keyFrame&&(p.keyFrameSeen=!0);const y=u0(p.rgba,p.width,p.height,d),v=performance.now();(a.width!==p.width||a.height!==p.height)&&(a.width=p.width,a.height=p.height);const w=xv(a,r),M=performance.now();y&&w?.context.putImageData(p.imageData,0,0,y.x,y.y,y.width,y.height);const C=performance.now();p.outputSerial+=1,s?.(l,{deviceId:l.deviceId,frameSeq:l.frameSeq,mode:l.frameMode||l.mode||l.mimeType,width:p.width,height:p.height,byteLength:l.byteLength,queuedForMs:Math.max(0,C-c),decodedForMs:Math.max(0,v-c),scheduledForMs:0,drawMs:Math.max(0,C-M),queueSize:0,renderQueueSize:0,droppedForLatency:0,h264DecodeAcceleration:"prefer-software",decoderLabel:"lzo-rgb565-delta",decoderFlushCount:0,decoderTimestampFallbacks:0,decoderInputCount:p.inputSerial,decoderOutputCount:p.outputSerial,targetPaintIntervalMs:Math.max(1,Number(l.durationUs||0)/1e3||1e3/30),canvasPresentation:w?.presentation||"sync",interactiveBufferWaitCount:0,interactiveBufferWaitMs:0,interactiveQueueDrainCount:0,visualHash:String(l.contentHash||""),visualChanged:Number(l.deltaVisualTileCount||0)>0,paintedAt:C})}function F0(a,l,s,r,c="smooth"){Ao.delete(a);const d=String(l.h264Format||"").toLowerCase()==="avc"?"avc":"annexb",h=Math.max(1,Math.floor(l.width||960)),p=Math.max(1,Math.floor(l.height||540)),g=String(l.frameMode||l.mode||"").toLowerCase(),x=c==="interactive"&&r==="prefer-hardware"&&N0(),v=g==="mode4-h264-atlas"?"prefer-software":gv(a,c==="interactive"&&(ju||x)?"prefer-software":r),w=[l.streamId||"",l.commandId||"",h,p,d,v,c].join("|");let M=lx(a,c);M.onPaint=s,M.configured&&M.decoder.state!=="configured"&&(M.configured=!1,M.configKey=""),M.configured&&M.configKey!==w&&(Oa(a),M=lx(a,c),M.onPaint=s);const C={codec:"avc1.42E01E",codedWidth:h,codedHeight:p,hardwareAcceleration:v,optimizeForLatency:!0,avc:{format:d}};M.configured||eu(M,C,w,v);const j=l.isKeyFrame===!0||String(l.chunkType||"").toLowerCase()==="key";Number(l.frameSeq||0);const k=Number(l.streamFrameSeq||0);if(k>0&&M.lastInputFrameSeq!==void 0){if(k<=M.lastInputFrameSeq){if(!j||k===M.lastInputFrameSeq)return;hu(M,M.lastInputFrameSeq-k+1),eu(M,C,w,v)}if(k>M.lastInputFrameSeq+1){if(hu(M,k-M.lastInputFrameSeq-1),!j)return;eu(M,C,w,v)}}if(k>0&&(M.lastInputFrameSeq=k),!j&&!M.keyFrameSeen)return;j&&(M.keyFrameSeen=!0);const T=Number(M.decoder.decodeQueueSize||0);if(T>8){if(M.latencyMode==="interactive"&&M.hardwareAcceleration==="prefer-hardware"){ju=!0,Ru(a,M.hardwareAcceleration),Oa(a);return}if(hu(M),!j)return;eu(M,C,w,v),M.keyFrameSeen=!0}const A=Math.max(1,Math.floor(l.durationUs||1e6/12)),L=M.nextChunkTimestampUs;M.nextChunkTimestampUs+=A,M.pendingFrames.set(L,{frame:l,queuedAt:performance.now(),queueSize:T}),M.inputSerial+=1,M.lastInputAt=performance.now();const q=new EncodedVideoChunk({type:j?"key":"delta",timestamp:L,duration:A,data:l.payload});try{M.decoder.decode(q)}catch(U){throw Oa(a),U}bv(a,M),O0(a,M)}async function If(a,l,s,r,c,d="smooth"){if(L0(l)){s()||H0(a,l,r,d);return}if(R0(l)){s()||F0(a,l,r,c,d);return}if(Ao.delete(a),D0(l)){Oa(a);const v=_0(l);if(s())return;(a.width!==v.width||a.height!==v.height)&&(a.width=v.width,a.height=v.height);const w=a.getContext("2d"),M=performance.now();w?.putImageData(v,0,0);const C=performance.now(),j=fm(a,v.width,v.height);r?.(l,{deviceId:l.deviceId,frameSeq:l.frameSeq,mode:l.frameMode||l.mode||l.codec||l.mimeType,width:v.width,height:v.height,byteLength:l.byteLength,queuedForMs:0,decodedForMs:0,scheduledForMs:0,drawMs:Math.max(0,C-M),queueSize:0,renderQueueSize:0,droppedForLatency:0,h264DecodeAcceleration:Ki.h264DecodeAcceleration,decoderLabel:"lzo-rgb565",decoderFlushCount:0,decoderTimestampFallbacks:0,decoderInputCount:0,decoderOutputCount:0,targetPaintIntervalMs:0,canvasPresentation:"sync",interactiveBufferWaitCount:0,interactiveBufferWaitMs:0,interactiveQueueDrainCount:0,visualHash:j.visualHash,visualChanged:j.visualChanged,paintedAt:C});return}Oa(a);const h=new Blob([l.payload],{type:l.mimeType}),p=await createImageBitmap(h);if(s()){p.close();return}const g=l.width||p.width||960,x=l.height||p.height||540;(a.width!==g||a.height!==x)&&(a.width=g,a.height=x);const y=a.getContext("2d");if(y){const v=performance.now();y.clearRect(0,0,g,x),y.drawImage(p,0,0,g,x);const w=performance.now(),M=fm(a,g,x);r?.(l,{deviceId:l.deviceId,frameSeq:l.frameSeq,mode:l.frameMode||l.mode||l.codec||l.mimeType,width:g,height:x,byteLength:l.byteLength,queuedForMs:0,decodedForMs:0,scheduledForMs:0,drawMs:Math.max(0,w-v),queueSize:0,renderQueueSize:0,droppedForLatency:0,h264DecodeAcceleration:Ki.h264DecodeAcceleration,decoderLabel:"image",decoderFlushCount:0,decoderTimestampFallbacks:0,decoderInputCount:0,decoderOutputCount:0,targetPaintIntervalMs:0,canvasPresentation:"sync",interactiveBufferWaitCount:0,interactiveBufferWaitMs:0,interactiveQueueDrainCount:0,visualHash:M.visualHash,visualChanged:M.visualChanged,paintedAt:w})}p.close()}const wo=5179,mn=Do(`http://127.0.0.1:${wo}`);function I0(a){const l=a.split(".").map(s=>Number(s));return l.length===4&&l.every(s=>Number.isInteger(s)&&s>=0&&s<=255)?l:[]}function U0(a){const l=a.trim().toLowerCase();return l==="localhost"||l==="127.0.0.1"||l==="::1"||l==="[::1]"}function $0(a){const l=a.trim().toLowerCase();return!l||l==="0.0.0.0"||l==="::"||l==="[::]"}function q0(a){const l=I0(a);return l.length===0?!1:l[0]===10||l[0]===172&&l[1]>=16&&l[1]<=31||l[0]===192&&l[1]===168}function G0(a){return a.includes(":")&&!a.startsWith("[")?`[${a}]`:a}function P0(a){const l=String(a||"").trim();if(!l)return null;const s=/^[a-z][a-z\d+.-]*:\/\//i.test(l)?l:`tcp://${l}`;try{const r=new URL(s),c=r.hostname.replace(/^\[|\]$/g,""),d=Number(r.port);return!c||!Number.isInteger(d)||d<1||d>65535||$0(c)?null:{host:c,port:d}}catch{return null}}function Do(a){const l=String(a||"").trim()||`http://127.0.0.1:${wo}`,s=/^[a-z][a-z\d+.-]*:\/\//i.test(l)?l:`http://${l}`;try{const r=new URL(s);return r.port||(r.port=String(wo)),r.hash="",r.search="",r.toString().replace(/\/+$/,"")}catch{return`http://127.0.0.1:${wo}`}}function Y0(a){const l=P0(a);return l?Do(`http://${G0(l.host)}:${wo}`):""}function rx(a){const s=[a?.endpoint,...Array.isArray(a?.endpoint_candidates)?a.endpoint_candidates:[]].map(r=>Y0(String(r||""))).filter(Boolean);return[...new Set(s)]}function So(a=mn){if(!(typeof window>"u"||window.location.protocol!=="https:"))try{const l=new URL(a);if(l.protocol!=="http:")return;if(U0(l.hostname))return"loopback";if(q0(l.hostname))return"local"}catch{return}}function Lu(a,l=mn){const s=new URL(a,Do(l));return s.protocol=s.protocol==="https:"?"wss:":"ws:",s.toString()}async function ct(a,l,s=mn){const r=Do(s),c={...l,headers:{"Content-Type":"application/json",...l?.headers||{}},cache:"no-store"},d=So(r);d&&(c.targetAddressSpace=d);let h;try{h=await fetch(`${r}${a}`,c)}catch(p){throw d?new Error("LiveDesk Hub is not reachable at this local network address. If Chrome shows a local network prompt, allow it; otherwise restart the Hub so port 5179 is open on the network."):p}if(!h.ok)throw new Error(`${h.status} ${h.statusText}`);return await h.json()}function mm(a){if(!a)return"-";const l=Date.now()-Date.parse(a);return Number.isFinite(l)?l<1e3?"now":l<6e4?`${Math.round(l/1e3)}s`:l<36e5?`${Math.round(l/6e4)}m`:`${Math.round(l/36e5)}h`:"-"}async function Vi(a){await navigator.clipboard.writeText(a)}const ox="livedesk_remote_host_targets",V0="livedesk_entitlements";function Q0(a){const s=(Array.isArray(a)?a:[a||mn]).map(r=>Do(r||mn));return[...new Set(s.filter(Boolean))]}function K0(){const[a,l]=m.useState(null),[s,r]=m.useState(!0);return m.useEffect(()=>{let c=!0;Za.auth.getSession().then(({data:h})=>{c&&(l(h.session??null),r(!1))});const{data:{subscription:d}}=Za.auth.onAuthStateChange((h,p)=>{l(p),r(!1)});return()=>{c=!1,d.unsubscribe()}},[]),{session:a,loading:s}}function X0(a,l=!0){const[s,r]=m.useState(null),[c,d]=m.useState([]),[h,p]=m.useState(""),[g,x]=m.useState(""),[y,v]=m.useState(0),w=m.useRef(new Map),M=Array.isArray(a)?a.join(`
10
+ `):String(a||""),C=m.useMemo(()=>Q0(a),[M]),j=m.useMemo(()=>C.find(A=>So(A)==="loopback")||C[0]||mn,[C]),k=m.useCallback(async()=>{if(!l){r(null),d([]),x(""),p("");return}let A=null;const L=Date.now(),q=C.filter(U=>(w.current.get(U)||0)<=L);if(q.length===0)throw new Error("No LiveDesk Hub endpoint is reachable. Retrying shortly.");for(const U of q)try{const[X,E]=await Promise.all([ct("/api/remote/status",void 0,U),ct("/api/remote/devices",void 0,U)]);if(!Array.isArray(E.devices))throw new Error("Invalid Hub devices response.");w.current.delete(U),r(X),d(E.devices),x(U),p("");return}catch(X){A=X,w.current.set(U,Date.now()+1e4)}throw x(""),A||new Error("No LiveDesk Hub endpoint is reachable.")},[l,C]),T=m.useCallback(()=>{w.current.clear(),k().catch(A=>{p(A instanceof Error?A.message:String(A))}),v(A=>A+1)},[k]);return m.useEffect(()=>{if(!l){r(null),d([]),x(""),p("");return}let A=!0;const L=async()=>{try{await k()}catch(U){A&&p(U instanceof Error?U.message:String(U))}};L();const q=window.setInterval(L,2500);return()=>{A=!1,window.clearInterval(q)}},[l,k,y]),{status:s,devices:c,error:h,refresh:T,hubBaseUrl:g||j,hubCandidates:C}}function Z0(a){const[l,s]=m.useState(null),[r,c]=m.useState(""),d=a?.user?.id||"",h=m.useCallback(async()=>{if(!d){s(null);return}const{data:p,error:g}=await Za.from(ox).select("*").eq("user_id",d).maybeSingle();if(g){c(g.message);return}s(p),c("")},[d]);return m.useEffect(()=>{h()},[h]),m.useEffect(()=>{if(!d)return;const p=Za.channel(`livedesk-remote-host-targets-${d.replace(/[^a-zA-Z0-9]/g,"")}`).on("postgres_changes",{event:"*",schema:"public",table:ox,filter:`user_id=eq.${d}`},g=>s(g.new)).subscribe();return()=>{Za.removeChannel(p)}},[d]),{target:l,error:r,refresh:h}}function W0(a){const[l,s]=m.useState(null),[r,c]=m.useState(!1),[d,h]=m.useState(""),p=a?.user?.id||"",g=m.useCallback(async()=>{if(!p){s(null),h(""),c(!1);return}c(!0);const{data:y,error:v}=await Za.from(V0).select("*").eq("user_id",p).eq("product_key","livedesk").maybeSingle();if(v){h(v.message),c(!1);return}s(y),h(""),c(!1)},[p]);m.useEffect(()=>{g()},[g]);const x=m.useMemo(()=>!l||l.status!=="active"?!1:l.expires_at?new Date(l.expires_at).getTime()>Date.now():!0,[l]);return{entitlement:l,licensed:x,loading:r,error:d,refresh:g}}const Mo={totalFrames:0,totalBytes:0,framesPerSecond:0,bytesPerSecond:0,sampleMs:0,lastUpdatedAt:0},J0=2500,ew=3e4,tw=64*1024,nw=6,Sv=new Map;function aw(a){return Sv.get(a)}const cx={totalSent:0,totalDropped:0,sentPerSecond:0,droppedPerSecond:0,bufferedAmount:0,lastInputType:"",lastInputSeq:0,lastRoundTripMs:0,lastAgentApplyMs:0,lastUpdatedAt:0};function ux(a){const l=Date.parse(String(a||""));if(!Number.isFinite(l))return 0;const s=Date.now()-l;return s>0&&s<=ew?s:0}function dx(a,l,s=mn,r={}){const[c,d]=m.useState(new Map),[h,p]=m.useState("idle"),[g,x]=m.useState(""),[y,v]=m.useState(Mo),w=m.useRef(new Map),M=m.useRef(new Map),C=m.useRef(0),j=m.useRef(new Set),[k,T]=m.useState(0),A=m.useRef(r.onFrame),L=m.useRef({totalFrames:0,totalBytes:0,sampleFrames:0,sampleBytes:0,sampleStartedAt:0}),q=m.useMemo(()=>[...a].sort().join(","),[a]),U=Number.isFinite(r.fps)?Number(r.fps):2,X=Number.isFinite(r.maxWidth)?Number(r.maxWidth):640,E=Number.isFinite(r.maxHeight)?Number(r.maxHeight):360,P=Number.isFinite(r.quality)?Number(r.quality):45,te=String(r.frameMode||r.mode||"mode3-h264-hw").trim()||"mode3-h264-hw",B=r.streamPurpose==="control"?"control":"wall",ue=m.useMemo(()=>{const I=Object.entries(r.monitorSelections||{}).filter(([Z])=>!!Z).sort(([Z],[ee])=>Z.localeCompare(ee));return JSON.stringify(Object.fromEntries(I))},[r.monitorSelections]);m.useEffect(()=>{A.current=r.onFrame},[r.onFrame]);const G=m.useCallback((I,Z="livedesk-frame-socket-release")=>{I.disposed=!0;try{I.socket.readyState===WebSocket.CONNECTING||I.socket.readyState===WebSocket.OPEN?I.socket.close(1e3,Z):I.socket.close()}catch{}},[]),de=m.useCallback(()=>{const I=[...M.current.values()].map(Z=>Z.socket);if(I.length===0){p("idle");return}if(I.some(Z=>Z.readyState===WebSocket.OPEN)){p("open");return}if(I.some(Z=>Z.readyState===WebSocket.CONNECTING)){p("connecting");return}p("closed")},[]),re=m.useCallback((I,Z)=>{if(!I||I.byteLength<5)return;const ee=Date.now(),ae=new DataView(I).getUint32(0,!1);if(ae<=0||ae+4>I.byteLength)return;const me=new Uint8Array(I.slice(4,4+ae)),z=JSON.parse(new TextDecoder().decode(me));if(Math.max(ux(z.receivedAt),ux(z.capturedAt))>J0)return;const be=I.slice(4+ae),Me={deviceId:String(z.deviceId||""),kind:z.kind==="thumbnail"?"thumbnail":"live",frameSeq:Number(z.frameSeq||0),streamFrameSeq:Number(z.streamFrameSeq||0)||void 0,streamId:String(z.streamId||""),commandId:z.commandId?String(z.commandId):void 0,width:Number(z.width||0),height:Number(z.height||0),sourceWidth:Number(z.sourceWidth||0)||void 0,sourceHeight:Number(z.sourceHeight||0)||void 0,mimeType:String(z.mimeType||"image/jpeg"),mode:z.mode?String(z.mode):void 0,frameMode:z.frameMode?String(z.frameMode):void 0,frameProfile:z.frameProfile?String(z.frameProfile):void 0,encoding:z.encoding?String(z.encoding):void 0,codec:z.codec?String(z.codec):void 0,compression:z.compression?String(z.compression):void 0,pixelFormat:z.pixelFormat?String(z.pixelFormat):void 0,bytesPerPixel:Number(z.bytesPerPixel||0)||0,uncompressedByteLength:Number(z.uncompressedByteLength||0)||0,h264Format:z.h264Format?String(z.h264Format):void 0,isKeyFrame:z.isKeyFrame===!0,chunkType:z.chunkType?String(z.chunkType):void 0,timestampUs:Number(z.timestampUs||0)||0,durationUs:Number(z.durationUs||0)||0,sourceGapMs:Number(z.sourceGapMs||0)||0,agentSendGapMs:Number(z.agentSendGapMs||0)||0,agentSendDurationMs:Number(z.agentSendDurationMs||0)||0,agentSendDurationFrameSeq:Number(z.agentSendDurationFrameSeq||0)||0,agentPaceMs:Number(z.agentPaceMs||0)||0,agentQueueBeforePaceMs:Number(z.agentQueueBeforePaceMs||0)||0,agentFrameAgeMs:Number(z.agentFrameAgeMs||0)||0,droppedByAgent:Number(z.droppedByAgent||0)||0,hubIngressDropped:Number(z.hubIngressDropped||0)||0,hubClientDropped:Number(z.hubClientDropped||0)||0,hardwareEncoder:z.hardwareEncoder?String(z.hardwareEncoder):void 0,platformProfile:z.platformProfile?String(z.platformProfile):void 0,monitorIndex:Number.isFinite(Number(z.monitorIndex))?Number(z.monitorIndex):void 0,monitorCount:Number.isFinite(Number(z.monitorCount))?Number(z.monitorCount):void 0,capturedAt:String(z.capturedAt||""),receivedAt:String(z.receivedAt||""),hubPacketAt:z.hubPacketAt?String(z.hubPacketAt):void 0,hubPacketEpochMs:Number.isFinite(Number(z.hubPacketEpochMs))?Number(z.hubPacketEpochMs):void 0,browserReceivedEpochMs:ee,byteLength:Number(z.byteLength||be.byteLength),contentHash:z.contentHash?String(z.contentHash):void 0,captureMs:Number(z.captureMs||0)||0,captureStageMs:Number(z.captureStageMs||0)||0,convertMs:Number(z.convertMs||0)||0,compressMs:Number(z.compressMs||0)||0,captureSourceSerial:Number(z.captureSourceSerial||0)||0,captureSourceSkipped:Number(z.captureSourceSkipped||0)||0,deltaTileSize:Number(z.deltaTileSize||0)||0,deltaTileCount:Number(z.deltaTileCount||0)||0,deltaVisualTileCount:Number(z.deltaVisualTileCount||0)||0,deltaRefreshTileCount:Number(z.deltaRefreshTileCount||0)||0,deltaTotalTiles:Number(z.deltaTotalTiles||0)||0,payload:be};if(!Me.deviceId)return;const Fe={streamId:Z.lastFrameStreamId,commandId:Z.lastFrameCommandId,order:Z.lastFrameOrder},Ve=Number(Me.streamFrameSeq||Me.frameSeq||0),Le=!!Fe.commandId&&!!Me.commandId,Ee=Fe.streamId===Me.streamId&&(!Le||Fe.commandId===Me.commandId),qe=Fe.order;if(Ee&&qe>=Ve&&(qe===Ve||Le))return;Z.lastFrameStreamId=Me.streamId,Z.lastFrameCommandId=Me.commandId||"",Z.lastFrameOrder=Ve;const ke=L.current;ke.totalFrames+=1,ke.totalBytes+=be.byteLength,ke.sampleFrames+=1,ke.sampleBytes+=be.byteLength,w.current.set(Me.deviceId,Me),A.current?.(Me)},[]);m.useEffect(()=>{const I=window.setInterval(()=>{const Z=performance.now(),ee=L.current,_=Math.max(1,Z-ee.sampleStartedAt);v({totalFrames:ee.totalFrames,totalBytes:ee.totalBytes,framesPerSecond:ee.sampleFrames*1e3/_,bytesPerSecond:ee.sampleBytes*1e3/_,sampleMs:_,lastUpdatedAt:Date.now()}),d(new Map(w.current)),ee.sampleFrames=0,ee.sampleBytes=0,ee.sampleStartedAt=Z},2e3);return()=>{window.clearInterval(I)}},[]),m.useEffect(()=>{const I=q?q.split(",").filter(Boolean):[],Z=new Set(I),ee=performance.now();for(const[_,ae]of M.current.entries())Z.has(_)||(G(ae,"livedesk-device-unsubscribed"),M.current.delete(_),w.current.delete(_));if(I.length===0){for(const _ of M.current.values())G(_,"livedesk-no-devices");M.current.clear(),w.current=new Map,d(new Map),x(""),L.current={totalFrames:0,totalBytes:0,sampleFrames:0,sampleBytes:0,sampleStartedAt:0},v(Mo),de();return}L.current.sampleStartedAt<=0&&(L.current.sampleStartedAt=ee,v({...Mo,lastUpdatedAt:Date.now()}));for(const _ of I){const ae=r.monitorSelections?.[_],me=Number.isFinite(Number(ae))?{[_]:Number(ae)}:{},z={type:"subscribe",deviceIds:[_],autoStartLive:l,fps:U,maxWidth:X,maxHeight:E,quality:P,mode:te,frameMode:te,streamPurpose:B,forceRestart:B==="control",restartReason:B==="control"?"control-subscribe":"",monitorSelections:me},ge=JSON.stringify(z),be=M.current.get(_),Me=!!be&&be.payloadKey!==ge;if(be){const Ee=be.socket.readyState===WebSocket.CONNECTING||be.socket.readyState===WebSocket.OPEN;if(be.payloadKey===ge&&Ee&&!be.disposed)continue;G(be,be.payloadKey===ge?"livedesk-frame-socket-refresh":"livedesk-subscription-replaced"),M.current.delete(_)}const Fe=new WebSocket(Lu(`/api/remote/frames/ws?devices=${encodeURIComponent(_)}`,s));Fe.binaryType="arraybuffer";const Ve=Me?{...z,forceRestart:!0,restartReason:"subscription-options-changed",restartToken:`${Date.now()}-${Math.random().toString(36).slice(2)}`}:z,Le={socket:Fe,payload:Ve,payloadKey:ge,generation:C.current+1,disposed:!1,lastFrameStreamId:"",lastFrameCommandId:"",lastFrameOrder:-1};C.current=Le.generation,M.current.set(_,Le),Fe.addEventListener("open",()=>{if(Le.disposed||M.current.get(_)!==Le){G(Le,"livedesk-stale-frame-socket");return}x(""),Fe.send(JSON.stringify(Le.payload)),de()}),Fe.addEventListener("message",Ee=>{if(Le.disposed||M.current.get(_)!==Le)return;if(typeof Ee.data=="string"){try{const ke=JSON.parse(Ee.data);if(ke?.type==="RemoteFrameSubscriptionError")x(String(ke.error||"control-stream-start-failed"));else if(ke?.type==="RemoteFrameLiveAutoStart"){const ie=(Array.isArray(ke.skipped)?ke.skipped:[]).find(ve=>ve?.deviceId===_);ie?x(String(ie.reason||"control-stream-start-failed")):Array.isArray(ke.started)&&ke.started.some(ve=>ve?.deviceId===_)&&x("")}}catch{}return}const qe=Ee.data instanceof ArrayBuffer?Ee.data:null;qe&&(x(""),re(qe,Le))}),Fe.addEventListener("error",()=>{Le.disposed||M.current.get(_)!==Le||(x("frame-socket-error"),p("error"))}),Fe.addEventListener("close",()=>{const Ee=!Le.disposed;Le.disposed=!0;const qe=M.current.get(_);if(qe===Le&&M.current.delete(_),de(),Ee&&qe===Le){const ke=window.setTimeout(()=>{j.current.delete(ke),T(gt=>gt+1)},750);j.current.add(ke)}})}de()},[l,G,q,U,te,re,s,E,X,ue,r.monitorSelections,P,k,B,de]),m.useEffect(()=>()=>{for(const I of M.current.values())G(I,"livedesk-hook-unmount");M.current.clear();for(const I of j.current)window.clearTimeout(I);j.current.clear()},[G]);const fe=m.useCallback((I,Z="browser-stale")=>{const ee=Array.isArray(I)&&I.length>0?I:q.split(",").filter(Boolean);if(ee.length===0)return!1;let _=!1;for(const ae of ee){const me=M.current.get(ae);!me||me.socket.readyState!==WebSocket.OPEN||(me.socket.send(JSON.stringify({...me.payload,type:"restart-live",deviceIds:[ae],forceRestart:!0,restartReason:Z,restartToken:`${Date.now()}-${Math.random().toString(36).slice(2)}`})),_=!0)}return _},[q]);return{frames:c,state:h,error:g,stats:y,restartLive:fe}}function lw(a,l,s=mn,r={}){const[c,d]=m.useState(null),[h,p]=m.useState(null),[g,x]=m.useState("idle"),[y,v]=m.useState(Mo),w=m.useRef(null),M=m.useRef(r.onFrame),C=m.useRef(null),j=m.useRef(0),k=m.useRef({totalFrames:0,totalBytes:0,sampleFrames:0,sampleBytes:0,sampleStartedAt:0}),T=m.useMemo(()=>[...new Set(a.filter(Boolean))].join(","),[a]),A=m.useMemo(()=>JSON.stringify(r.monitorSelections||{}),[r.monitorSelections]),L=m.useMemo(()=>({deviceIds:T.split(",").filter(Boolean),fps:Number(r.fps||20),width:Number(r.width||1920),height:Number(r.height||1080),tileWidth:Number(r.tileWidth||320),tileHeight:Number(r.tileHeight||180),monitorSelections:r.monitorSelections||{}}),[T,A,r.fps,r.height,r.monitorSelections,r.tileHeight,r.tileWidth,r.width]),q=m.useMemo(()=>JSON.stringify(L),[L]),U=m.useRef(L);U.current=L;const X=l&&L.deviceIds.length>0,E=m.useCallback(te=>te.readyState!==WebSocket.OPEN?!1:(te.send(JSON.stringify({type:"configure",...U.current})),!0),[]);m.useEffect(()=>{M.current=r.onFrame},[r.onFrame]),m.useEffect(()=>{const te=window.setInterval(()=>{const B=k.current,ue=performance.now(),G=Math.max(1,ue-B.sampleStartedAt);v({totalFrames:B.totalFrames,totalBytes:B.totalBytes,framesPerSecond:B.sampleFrames*1e3/G,bytesPerSecond:B.sampleBytes*1e3/G,sampleMs:G,lastUpdatedAt:Date.now()});const de=C.current;de&&de.frameSeq!==j.current&&(j.current=de.frameSeq,d(de)),B.sampleFrames=0,B.sampleBytes=0,B.sampleStartedAt=ue},1e3);return()=>window.clearInterval(te)},[]),m.useEffect(()=>{if(!X){w.current?.close(),w.current=null,d(null),C.current=null,j.current=0,p(null),x("idle"),v(Mo);return}let te=!1,B=0;const ue=()=>{if(te)return;const G=new WebSocket(Lu("/api/remote/atlas/ws",s));G.binaryType="arraybuffer",w.current=G,x("connecting"),G.addEventListener("open",()=>{k.current.sampleStartedAt=performance.now(),x("open"),E(G)}),G.addEventListener("message",de=>{if(typeof de.data=="string"){try{const fe=JSON.parse(de.data);fe?.type==="Mode4AtlasLayout"&&p({layoutVersion:Number(fe.layoutVersion||0),width:Number(fe.width||1920),height:Number(fe.height||1080),columns:Number(fe.columns||1),rows:Number(fe.rows||1),tiles:Array.isArray(fe.tiles)?fe.tiles:[]})}catch{}return}const re=de.data instanceof ArrayBuffer?de.data:null;if(!(!re||re.byteLength<5))try{const fe=Date.now(),Z=new DataView(re).getUint32(0,!1);if(Z<=0||Z+4>re.byteLength)return;const ee=JSON.parse(new TextDecoder().decode(new Uint8Array(re,4,Z))),_=re.slice(4+Z),ae={deviceId:String(ee.deviceId||"__livedesk_mode4_atlas__"),kind:"live",frameSeq:Number(ee.frameSeq||0),streamFrameSeq:Number(ee.streamFrameSeq||0)||void 0,streamId:String(ee.streamId||"mode4-atlas"),commandId:ee.commandId?String(ee.commandId):void 0,width:Number(ee.width||1920),height:Number(ee.height||1080),sourceWidth:Number(ee.sourceWidth||ee.width||1920),sourceHeight:Number(ee.sourceHeight||ee.height||1080),mimeType:String(ee.mimeType||"video/h264"),mode:String(ee.mode||"mode4-h264-atlas"),frameMode:String(ee.frameMode||"mode4-h264-atlas"),frameProfile:String(ee.frameProfile||"mode4-h264-atlas-v1"),encoding:String(ee.encoding||"video-atlas"),codec:String(ee.codec||"h264"),compression:String(ee.compression||"video/h264"),h264Format:String(ee.h264Format||"annexb"),isKeyFrame:ee.isKeyFrame===!0,chunkType:String(ee.chunkType||""),timestampUs:Number(ee.timestampUs||0),durationUs:Number(ee.durationUs||0),hardwareEncoder:ee.hardwareEncoder?String(ee.hardwareEncoder):void 0,platformProfile:ee.platformProfile?String(ee.platformProfile):void 0,capturedAt:String(ee.capturedAt||""),receivedAt:String(ee.receivedAt||""),hubPacketAt:ee.hubPacketAt?String(ee.hubPacketAt):void 0,hubPacketEpochMs:Number(ee.hubPacketEpochMs||0)||void 0,browserReceivedEpochMs:fe,byteLength:_.byteLength,layoutVersion:Number(ee.layoutVersion||0),atlasComposeMs:Number(ee.atlasComposeMs||0),atlasPoolStarved:Number(ee.atlasPoolStarved||0),atlasReadyTiles:Number(ee.atlasReadyTiles||0),atlasTileCount:Number(ee.atlasTileCount||0),payload:_},me=k.current;me.totalFrames+=1,me.totalBytes+=_.byteLength,me.sampleFrames+=1,me.sampleBytes+=_.byteLength,C.current=ae,j.current===0&&(j.current=ae.frameSeq,d(ae)),M.current?.(ae)}catch{}}),G.addEventListener("error",()=>x("error")),G.addEventListener("close",()=>{w.current===G&&(w.current=null),!te&&(x("closed"),B=window.setTimeout(ue,1200))})};return ue(),()=>{te=!0,window.clearTimeout(B),w.current?.close(),w.current=null}},[X,s,E]),m.useEffect(()=>{if(!X)return;const te=w.current;te&&E(te)},[q,X,E]);const P=m.useCallback(()=>{const te=w.current;return te?E(te):!1},[E]);return{frame:c,layout:h,state:g,stats:y,refreshInputs:P}}function iw(a,l=mn){const s=m.useRef(null),r=m.useRef(0),c=m.useRef(0),d=m.useRef(new Map),[h,p]=m.useState("idle"),[g,x]=m.useState(cx),y=m.useRef({totalSent:0,totalDropped:0,sampleSent:0,sampleDropped:0,sampleStartedAt:0,lastInputType:"",lastInputSeq:0,lastRoundTripMs:0,lastAgentApplyMs:0});m.useEffect(()=>{if(!a){s.current?.close(),s.current=null,c.current=0,p("idle"),x(cx);return}const w=new WebSocket(Lu("/api/remote/input/ws",l));return s.current=w,y.current.sampleStartedAt=performance.now(),p("connecting"),w.addEventListener("open",()=>p("open")),w.addEventListener("message",M=>{if(typeof M.data=="string")try{const C=JSON.parse(M.data);if(C?.type!=="RemoteInputApplied")return;const j=Number(C.inputSeq||0),k=d.current.get(j);k!==void 0&&(y.current.lastRoundTripMs=Math.max(0,performance.now()-k),d.current.delete(j)),y.current.lastInputSeq=j,y.current.lastAgentApplyMs=Math.max(0,Number(C.agentApplyMs||0))}catch{}}),w.addEventListener("close",()=>p("closed")),w.addEventListener("error",()=>p("error")),()=>{w.close(),d.current.clear(),s.current===w&&(s.current=null)}},[a,l]),m.useEffect(()=>{if(!a)return;const w=window.setInterval(()=>{const M=performance.now(),C=y.current,j=Math.max(1,M-C.sampleStartedAt);x({totalSent:C.totalSent,totalDropped:C.totalDropped,sentPerSecond:C.sampleSent*1e3/j,droppedPerSecond:C.sampleDropped*1e3/j,bufferedAmount:s.current?.bufferedAmount||0,lastInputType:C.lastInputType,lastInputSeq:C.lastInputSeq,lastRoundTripMs:C.lastRoundTripMs,lastAgentApplyMs:C.lastAgentApplyMs,lastUpdatedAt:Date.now()}),C.sampleSent=0,C.sampleDropped=0,C.sampleStartedAt=M},1e3);return()=>window.clearInterval(w)},[a]);const v=m.useCallback((w,M)=>{const C=s.current;if(!C||C.readyState!==WebSocket.OPEN||!w)return!1;const j=String(M.type||"").toLowerCase(),k=j==="pointermove",T=y.current;if(k&&C.bufferedAmount>tw)return T.totalDropped+=1,T.sampleDropped+=1,T.lastInputType="pointermove-drop",!1;const A=r.current+1;r.current=A;const L=Date.now(),q=!k||A-c.current>=nw;for(q&&(d.current.set(A,performance.now()),k&&(c.current=A)),k||Sv.set(w,{inputSeq:A,inputType:j||"input",sentAt:performance.now()});d.current.size>256;){const U=d.current.keys().next().value;if(U===void 0)break;d.current.delete(U)}return C.send(JSON.stringify({type:"input",requestId:k?"":crypto.randomUUID(),fireAndForget:k,deviceId:w,input:{...M,inputSeq:A,requestAck:q,issuedAtEpochMs:L,issuedAt:new Date(L).toISOString()}})),T.totalSent+=1,T.sampleSent+=1,T.lastInputType=j||"input",!0},[]);return{state:h,sendInput:v,stats:g}}function sw(a){const l=String(a||"").toLowerCase();return l.includes("audio/pcm")||l.includes("audio/l16")||l.includes("f32le")||l.includes("s16le")}function rw(a,l,s){const r=Math.max(1,Math.min(8,Math.floor(l.channels||2))),c=Math.max(8e3,Math.min(192e3,Math.floor(l.sampleRate||48e3))),d=String(l.mimeType||"").toLowerCase(),h=d.includes("s16le")||d.includes("audio/l16"),p=h?2:4,g=Math.floor(s.byteLength/p),x=Math.floor(g/r),y=a.createBuffer(r,x,c),v=new DataView(s);for(let w=0;w<r;w+=1){const M=y.getChannelData(w);for(let C=0;C<x;C+=1){const k=(C*r+w)*p;M[C]=h?Math.max(-1,Math.min(1,v.getInt16(k,!0)/32768)):Math.max(-1,Math.min(1,v.getFloat32(k,!0)))}}return y}function ow(a,l,s=mn){const r=m.useRef(null),c=m.useRef(0),[d,h]=m.useState("idle"),[p,g]=m.useState(null),[x,y]=m.useState("");return m.useEffect(()=>{if(!l||!a){h("idle"),g(null),y("");return}const v=window.AudioContext||window.webkitAudioContext;if(!v){h("unsupported"),y("Audio playback is not supported in this browser.");return}const w=new v;r.current=w,c.current=w.currentTime;const M=new WebSocket(Lu(`/api/remote/audio/ws?devices=${encodeURIComponent(a)}`,s));M.binaryType="arraybuffer";let C=!1;return h("connecting"),y(""),M.addEventListener("open",()=>{C||(h("open"),M.send(JSON.stringify({type:"subscribe",deviceIds:[a]})),w.resume())}),M.addEventListener("message",j=>{if(typeof j.data=="string")return;const k=j.data instanceof ArrayBuffer?j.data:null;!k||k.byteLength<5||(async()=>{try{const A=new DataView(k).getUint32(0,!1);if(A<=0||A+4>k.byteLength)return;const L=new Uint8Array(k.slice(4,4+A)),q=JSON.parse(new TextDecoder().decode(L)),U=k.slice(4+A),X={deviceId:String(q.deviceId||""),frameSeq:Number(q.frameSeq||0),streamId:String(q.streamId||""),mimeType:String(q.mimeType||"audio/webm;codecs=opus"),sampleRate:Number(q.sampleRate||48e3),channels:Number(q.channels||2),capturedAt:String(q.capturedAt||""),receivedAt:String(q.receivedAt||""),byteLength:Number(q.byteLength||U.byteLength),payload:U};if(!X.deviceId||C)return;const E=sw(X.mimeType)?rw(w,X,U):await w.decodeAudioData(U.slice(0));if(C)return;const P=w.createBufferSource();P.buffer=E,P.connect(w.destination);const te=Math.max(w.currentTime+.02,c.current);P.start(te),c.current=te+E.duration,g(X),h("playing")}catch(T){C||(h("error"),y(T instanceof Error?T.message:String(T)))}})()}),M.addEventListener("error",()=>{C||h("error")}),M.addEventListener("close",()=>{C||h("closed")}),()=>{C=!0,M.close(),w.close().catch(()=>{}),r.current===w&&(r.current=null)}},[a,l,s]),{state:d,lastFrame:p,error:x}}const cw=[{id:"pin",label:"PIN",icon:_b},{id:"wall",label:"Wall",icon:$g},{id:"control",label:"Control",icon:$g}];function uw({initialTab:a="pin",pin:l,wall:s,control:r}){const[c,d]=m.useState(a),h=`settings-panel-${c}`,p=c==="pin"?l:c==="wall"?s:r;return o.jsxs("section",{className:"settings-page",children:[o.jsx("div",{className:"settings-page-tabs",role:"tablist","aria-label":"LiveDesk settings",children:cw.map(({id:g,label:x,icon:y})=>o.jsxs("button",{className:c===g?"active":"",id:`settings-tab-${g}`,role:"tab","aria-selected":c===g,"aria-controls":`settings-panel-${g}`,tabIndex:c===g?0:-1,onClick:()=>d(g),type:"button",children:[o.jsx(y,{size:16}),x]},g))}),o.jsx("section",{className:"settings-page-panel",id:h,role:"tabpanel","aria-labelledby":`settings-tab-${c}`,tabIndex:0,children:p})]})}function dw({children:a}){return o.jsx("div",{className:"settings-tab-content",children:a})}function fw({children:a}){return o.jsx("div",{className:"settings-tab-content",children:a})}function mw({children:a}){return o.jsx("div",{className:"settings-tab-content",children:a})}new Date().valueOf();function Wa(a){const[l,s]=m.useState(a),r=m.useRef(a);return m.useEffect(()=>{if(r.current!==a){if(Array.isArray(r.current)&&Array.isArray(a)&&r.current.length===0&&a.length===0)return;r.current=a,s(a)}},[a]),[l,s]}function Em(a,l){return typeof a=="function"?typeof l=="object"?a(l):a():a}function ar(a,l="data-id"){let s=a;for(!s.tagName&&a.target&&(s=a.target);s;){if(s.getAttribute&&s.getAttribute(l))return s;s=s.parentNode}return null}function hw(a,l="data-id"){const s=ar(a,l);return s?s.getAttribute(l):null}function ko(a,l="data-id"){const s=ar(a,l);return s?zu(s,l):null}function zu(a,l="data-id"){const s=a.getAttribute(l);return s?pw(s):null}function tn(a){return typeof a=="string"?":"+a:a}function pw(a){if(a.startsWith(":"))return a.substring(1);const l=a*1;return isNaN(l)?a:l}function gw(){return{detect:()=>!0,addEvent:function(a,l,s){return a.addEventListener(l,s),()=>a.removeEventListener(l,s)},addGlobalEvent:function(a,l){return document.addEventListener(a,l),()=>document.removeEventListener(a,l)},getTopNode:function(){return window.document.body}}}var Vn=gw();function Dm(a){Object.assign(Vn,a)}function fx(a,l,s){function r(c){const d=ar(c);if(!d)return;const h=zu(d);if(typeof l=="function")return l(h,c);let p,g=c.target;for(;g!=d;){if(p=g.dataset?g.dataset.action:null,p&&l[p]){l[p](h,c);return}g=g.parentNode}l[s]&&l[s](h,c)}Vn.addEvent(a,s,r)}function lr(a,l){fx(a,l,"click"),l.dblclick&&fx(a,l.dblclick,"dblclick")}function xw(a,l){for(let s=a.length-1;s>=0;s--)if(a[s]===l){a.splice(s,1);break}}function vw(a,l,s){for(let r=0;r<Dl.length;r++){if(r===s)continue;const c=Dl[r],d=c.props.parent?.();if(d&&a.contains(d)&&c.node.contains(l))return!0}return!1}var Mv=new Date,Tu=!1,tu=[],Dl=[],mx=a=>{const l=a.target;if(Tu||!l.isConnected){Tu=!1;return}for(let s=Dl.length-1;s>=0;s--){const{node:r,date:c,props:d}=Dl[s];if(!(c>Mv)&&!r.contains(l)&&r!==l&&(vw(r,l,s)||(d.callback&&d.callback(a),d.modal||a.defaultPrevented)))break}},yw=a=>{Mv=new Date,Tu=!0;for(let l=Dl.length-1;l>=0;l--){const{node:s}=Dl[l];if(!s.contains(a.target)&&s!==a.target){Tu=!1;break}}};function Ja(a,l){tu.length||(tu=[Vn.addGlobalEvent("click",mx,a),Vn.addGlobalEvent("contextmenu",mx,a),Vn.addGlobalEvent("mousedown",yw,a)]),typeof l!="object"&&(l={callback:l});const s={node:a,date:new Date,props:l};return Dl.push(s),{destroy(){xw(Dl,s),Dl.length||(tu.forEach(r=>r()),tu=[])}}}var nu=a=>a.indexOf("bottom")!==-1,au=a=>a.indexOf("left")!==-1,lu=a=>a.indexOf("right")!==-1,Uf=a=>a.indexOf("top")!==-1,hx=a=>a.indexOf("fit")!==-1,fo=a=>a.indexOf("overlap")!==-1,bw=a=>a.split("-").every(l=>["center","fit"].indexOf(l)>-1),ww=a=>{const l=a.match(/(start|center|end)/);return l?l[0]:null};function Sw(a,l){let s=0;const r=Vn.getTopNode(a);for(;a&&a!==r;){const c=getComputedStyle(a).position;if((c==="absolute"||c==="relative"||c==="fixed")&&(s=parseInt(getComputedStyle(a).zIndex)||0),a=a.parentNode,a===l)break}return s}var Qt,yn,mo,fn;function Cv(a,l,s="bottom",r=0,c=0){if(!a)return null;Qt=r,yn=c,mo="auto";let d=0,h=0,p=s;const g=jv(a),x=fo(s)?Vn.getTopNode(a):g;if(!g)return null;const y=g.getBoundingClientRect(),v=a.getBoundingClientRect(),w=x.getBoundingClientRect(),M=window.getComputedStyle(x),C={left:0,top:0,bottom:0,right:0};for(const q in C){const U=`border-${q}-width`;C[q]=parseFloat(M.getPropertyValue(U))}if(l){const q=Sw(l,g);d=Math.max(q+1,20)}if(l){if(fn=l.getBoundingClientRect(),hx(s)&&(mo=fn.width+"px"),s!=="point")if(bw(s))hx(s)?Qt=0:(Qt=w.width/2,h=1),yn=(w.height-v.height)/2;else{const q=fo(s)?0:1;Qt=lu(s)?fn.right+q:fn.left-q,yn=nu(s)?fn.bottom+1:fn.top;const U=ww(s);U&&(lu(s)||au(s)?U==="center"?yn-=(v.height-fn.height)/2:U==="end"&&(yn-=v.height-fn.height):(nu(s)||Uf(s))&&(U==="center"?Qt-=(v.width-fn.width)/2:U==="end"&&(Qt-=v.width-fn.width),fo(s)||(Qt+=1)))}}else fn={left:r,right:r,top:c,bottom:c};const j=(au(s)||lu(s))&&(nu(s)||Uf(s));au(s)&&(h=2);const k=Qt-v.width-w.left;l&&au(s)&&!j&&k<0&&(Qt=fn.right,h=0,p=p.replace("left","right"));const T=Qt+v.width*(1-h/2)-w.right;if(T>0)if(!lu(s))Qt=w.right-C.right-v.width;else{const q=fn.left-w.x-v.width;l&&!j&&q>=0?(Qt=fn.left-v.width,p=p.replace("right","left")):Qt-=T+C.right}h&&(Qt=Math.round(Qt-v.width*h/2));const A=k<0||T>0||!j;Uf(s)&&(yn=fn.top-v.height,l&&yn<w.y&&A&&(yn=fn.bottom,p=p.replace("top","bottom")));const L=yn+v.height-w.bottom;return L>0&&(l&&nu(s)&&A?(yn-=v.height+fn.height+1,p=p.replace("bottom","top")):yn-=L+C.bottom),Qt-=y.left+C.left,yn-=y.top+C.top,Qt=(fo(s)?Qt:Math.max(Qt,0))+x.scrollLeft,yn=(fo(s)?yn:Math.max(yn,0))+x.scrollTop,mo=mo||"auto",{at:p,x:Qt,y:yn,z:d,width:mo}}function jv(a){const l=Vn.getTopNode(a);for(a&&(a=a.parentElement);a;){const s=getComputedStyle(a).position;if(a===l||s==="relative"||s==="absolute"||s==="fixed")return a;a=a.parentNode}return null}function Mw(a){const l=[];let s=a;const r=Vn.getTopNode(a);for(;s&&s!==r&&!s.getAttribute("data-wx-portal-root");)getComputedStyle(s).position==="absolute"&&l.push(s),s=s.parentNode;return l}var px=new Date().valueOf();function Rm(){return px+=1,px}function wn(a){return a<10?"0"+a:a.toString()}function Cw(a){const l=wn(a);return l.length==2?"0"+l:l}function Nv(a){const l=Math.floor(a/11)*11;return{start:l,end:l+11}}function $f(a){const l=(a.getDay()+6)%7,s=new Date(a.valueOf());s.setDate(a.getDate()+(3-l)),s.setHours(0,0,0,0);const r=new Date(s.getFullYear(),0,1),c=Math.round((s.getTime()-r.getTime())/864e5);return 1+Math.floor(c/7)}var gx=["",""];function jw(a,l,s){switch(a){case"%d":return wn(l.getDate());case"%m":return wn(l.getMonth()+1);case"%j":return l.getDate();case"%n":return l.getMonth()+1;case"%y":return wn(l.getFullYear()%100);case"%Y":return l.getFullYear();case"%D":return s.dayShort[l.getDay()];case"%l":return s.dayFull[l.getDay()];case"%M":return s.monthShort[l.getMonth()];case"%F":return s.monthFull[l.getMonth()];case"%h":return wn((l.getHours()+11)%12+1);case"%g":return(l.getHours()+11)%12+1;case"%G":return l.getHours();case"%H":return wn(l.getHours());case"%i":return wn(l.getMinutes());case"%a":return((l.getHours()>11?s.pm:s.am)||gx)[0];case"%A":return((l.getHours()>11?s.pm:s.am)||gx)[1];case"%s":return wn(l.getSeconds());case"%S":return Cw(l.getMilliseconds());case"%W":return wn($f(l));case"%w":{const r=s.weekStart??1;if(r===1)return wn($f(l));const c=(l.getDay()-r+7)%7,d=(1-r+7)%7,h=new Date(l.valueOf());return h.setDate(l.getDate()+(d-c)),wn($f(h))}case"%c":{let r=l.getFullYear()+"";return r+="-"+wn(l.getMonth()+1),r+="-"+wn(l.getDate()),r+="T",r+=wn(l.getHours()),r+=":"+wn(l.getMinutes()),r+=":"+wn(l.getSeconds()),r}case"%Q":return Math.floor(l.getMonth()/3)+1;default:return a}}var Nw=/%[a-zA-Z]/g;function er(a,l){return typeof a=="function"?a:function(s){return s?(s.getMonth||(s=new Date(s)),a.replace(Nw,r=>jw(r,s,l))):""}}function xx(a){return a&&typeof a=="object"&&!Array.isArray(a)}function hm(a,l){for(const s in l){const r=l[s];xx(a[s])&&xx(r)?a[s]=hm({...a[s]},l[s]):a[s]=l[s]}return a}function Ro(a){return{getGroup(l){const s=a[l];return r=>s&&s[r]||r},getRaw(){return a},extend(l,s){if(!l)return this;let r;return s?r=hm({...l},a):r=hm({...a},l),Ro(r)}}}var Aw=dv();const Tw="en-US",kw={monthFull:["January","February","March","April","May","June","July","August","September","October","November","December"],monthShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayFull:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],hours:"Hours",minutes:"Minutes",done:"Done",clear:"Clear",today:"Today",am:["am","AM"],pm:["pm","PM"],weekStart:0,clockFormat:24},Ew={ok:"OK",cancel:"Cancel",select:"Select","No data":"No data","Rows per page":"Rows per page","Total pages":"Total pages"},Dw={timeFormat:"%H:%i",dateFormat:"%m/%d/%Y",monthYearFormat:"%F %Y",yearFormat:"%Y"},Av={core:Ew,calendar:kw,formats:Dw,lang:Tw},Lm=m.createContext(""),Tv=m.createContext({}),Ba=m.createContext(null),kv=m.createContext(null),an=Object.freeze(Object.defineProperty({__proto__:null,fieldId:kv,helpers:Tv,i18n:Ba,theme:Lm},Symbol.toStringTag,{value:"Module"}));function Ev(a){const l=m.useContext(kv),[s]=m.useState(()=>a||l||Rm());return s}function Co({type:a="",css:l="",icon:s="",disabled:r=!1,title:c="",tooltip:d,text:h="",children:p,onClick:g}){const x=m.useMemo(()=>{let v=a?a.split(" ").filter(w=>w!=="").map(w=>"wx-"+w).join(" "):"";return l+(l?" ":"")+v},[a,l]),y=v=>{g&&g(v)};return o.jsxs("button",{title:c,className:`wx-2ZWgb4 wx-button ${x} ${s&&!p?"wx-icon":""}`,disabled:r,onClick:y,"data-tooltip-text":d,children:[s&&o.jsx("i",{className:"wx-2ZWgb4 "+s}),p||h||" "]})}function Rw({id:a,label:l="",inputValue:s="",value:r=!1,onChange:c,disabled:d=!1,css:h=""}){const p=Ev(a),[g,x]=Wa(r),y=({target:v})=>{const w=v.checked;x(w),c&&c({value:w,inputValue:s})};return o.jsxs("div",{className:`wx-2IvefP wx-checkbox ${h}`,children:[o.jsx("input",{type:"checkbox",id:p,disabled:d,className:"wx-2IvefP wx-check",checked:g,value:s,onChange:y}),o.jsxs("label",{htmlFor:p,className:"wx-2IvefP wx-label",children:[o.jsx("span",{className:"wx-2IvefP wx-before"}),l&&o.jsx("span",{className:"wx-2IvefP wx-after",children:l})]})]})}function zm({theme:a="",target:l,children:s}){const r=m.useRef(null),c=m.useRef(null),[d,h]=m.useState(null);r.current||(r.current=document.createElement("div"));const p=m.useContext(Lm);return m.useEffect(()=>{h(l||Lw(c.current)||Vn.getTopNode(c.current))},[c.current]),o.jsxs(o.Fragment,{children:[o.jsx("span",{ref:c,style:{display:"none"}}),c.current&&d?Aw.createPortal(o.jsx("div",{className:`wx-3ZWsT0 wx-${a||p}-theme`,children:s}),d):null]})}function Lw(a){const l=Vn.getTopNode(a);for(;a&&a!==l&&!a.getAttribute("data-wx-portal-root");)a=a.parentNode;return a}function zw({left:a=0,top:l=0,at:s="bottom",parent:r=null,width:c="auto",css:d="",onCancel:h,children:p,trackScroll:g=!1}){const[x,y]=m.useState(0),[v,w]=m.useState(0),[M,C]=m.useState("auto"),[j,k]=m.useState(!1),T=m.useRef(null),A=m.useRef(null),L=m.useRef(h);m.useEffect(()=>{L.current=h},[h]);function q(X){return r&&(c+"").indexOf("%")>-1?c.replace(/(\d+)%/,(E,P)=>(P=P*r.offsetWidth/100+"px",c.replace(E,P))):c&&c!=="auto"?c:X}const U=m.useCallback(()=>{if(!T.current)return;const X=Cv(T.current,r,s,a,l);X&&(y(X.x),w(X.y),C(q(X.width)))},[T,r,s,a,l,c]);return m.useLayoutEffect(()=>{const X=P=>{L.current&&P.target!==A.current&&T.current&&!T.current.contains(P.target)&&L.current(P)};let E;return requestAnimationFrame(()=>{U(),k(!0),g&&T.current&&(A.current=jv(T.current),A.current&&A.current.addEventListener("scroll",X,!0)),r&&(E=new ResizeObserver(U),E.observe(r))}),()=>{g&&A.current&&A.current.removeEventListener("scroll",X,!0),E?.disconnect()}},[]),m.useLayoutEffect(()=>{U()},[r,s,a,l]),m.useEffect(()=>{const X=E=>{L.current&&L.current(E)};if(T.current)return Ja(T.current,{callback:X,parent:()=>r}).destroy},[r]),o.jsx("div",{ref:T,className:["wx-37M6Fj","wx-popup",d].filter(Boolean).join(" "),style:{position:"absolute",visibility:j?"visible":"hidden",top:v+"px",left:x+"px",width:M},children:p})}function _w({position:a="bottom",align:l="start",autoFit:s=!0,onCancel:r=null,width:c="100%",css:d="",children:h}){const p=m.useRef(null),[g,x]=m.useState(a),[y,v]=m.useState(l),w=m.useRef(r);return m.useEffect(()=>{w.current=r},[r]),m.useEffect(()=>{if(s){const M=p.current;if(M){const C=M.getBoundingClientRect(),j=document.body.getBoundingClientRect();C.right>=j.right&&v("end"),C.bottom>=j.bottom&&x("top")}}},[]),m.useEffect(()=>{if(p.current){const M=C=>{w.current&&w.current(C)};return Ja(p.current,M).destroy}},[]),o.jsx("div",{ref:p,className:["wx-dropdown",`wx-${g}-${y}`,d||"","wx-aaaVytZW"].filter(Boolean).join(" "),style:{width:c},children:h})}function _m({position:a="bottom",align:l="start",autoFit:s=!0,inline:r=!1,onCancel:c,width:d="100%",children:h,...p}){const[g,x]=m.useState(void 0),y=m.useRef(null),v=m.useMemo(()=>`${a}-${l}`,[a,l]);return m.useLayoutEffect(()=>{y.current&&x(y.current.parentNode)},[]),o.jsxs(o.Fragment,{children:[g&&(r?o.jsx(_w,{onCancel:c,position:a,align:l,autoFit:s,width:d,...p,children:h}):o.jsx(zm,{children:o.jsx(zw,{parent:g,at:v,onCancel:c,width:d,...p,children:h})})),o.jsx("span",{ref:y,className:"wx-portal-node wx-32GZ52"})]})}function _u(){return Ro(Av)}function Ow(){let a=null,l=!1,s=!1,r,c,d,h;const p=(v,w,M,C,j)=>{r=v,c=w,d=M,h=C,s=j},g=v=>{a=v,l=a!==null,d(a)},x=(v,w)=>{if(!s&&v!==null&&r){const M=r.querySelectorAll(".wx-list > .wx-item")[v];M&&(M.scrollIntoView({block:"nearest"}),w&&w.preventDefault())}},y=(v,w)=>{const M=v===null?null:Math.max(0,Math.min(a+v,c.length-1));M!==a&&(g(M),r?x(M,w):requestAnimationFrame(()=>x(M,w)))};return{move:v=>{const w=ko(v),M=c.findIndex(C=>C.id===w);M!==a&&g(M)},keydown:(v,w)=>{switch(v.code){case"Enter":l?h():g(0);break;case"Space":l||g(0);break;case"Escape":d(a=null);break;case"Tab":d(a=null);break;case"ArrowDown":y(l?1:w||0,v);break;case"ArrowUp":y(l?-1:w||0,v);break}},init:p,navigate:y}}const vx=10,Bw=m.memo(function({data:a,checkboxes:l,itemTemplate:s,value:r}){return o.jsxs(o.Fragment,{children:[l&&o.jsx(Rw,{id:a.id,css:"wx-list-checkbox",value:r&&r.includes(a.id)}),s?Em(s,{option:a}):a.label]})});function yx({visibleItems:a,visibleRange:l,navIndex:s,checkboxes:r,itemTemplate:c,value:d,measureRefCallback:h}){return a.map((p,g)=>{const x=l.start+g;return o.jsx("div",{ref:g===0?h:void 0,className:`wx-233fr7 wx-item ${x===s?"wx-focus":""}`,"data-id":p.id,children:o.jsx(Bw,{data:p,checkboxes:r,itemTemplate:c,value:d})},p.id)})}function Ou({items:a=[],children:l,onSelect:s,onReady:r,virtualized:c=!1,checkboxes:d,multiselect:h,value:p,...g}){const x=m.useRef(),y=m.useRef(!1),v=m.useRef(Ow()),[w,M]=m.useState(null),C=m.useRef(w),[j,k]=m.useState(0),[T,A]=m.useState(24),L=m.useRef(!1),q=(m.useContext(Ba)||_u()).getGroup("core"),U=m.useRef(a);m.useEffect(()=>{U.current=a},[a]);const X=m.useRef(p);m.useEffect(()=>{X.current=p},[p]);const E=m.useRef(0);m.useEffect(()=>{E.current=T},[T]);const P=m.useCallback(z=>{z&&z.stopPropagation();const ge=U.current,be=X.current,Me=C.current;let Fe;const Ve=ge[Me]?.id;h?be&&be.includes(Ve)?Fe=be.filter(Le=>Le!==Ve):Fe=[...be||[],Ve]:Fe=Ve,s&&s({id:Fe})},[h,s]),te=m.useRef(P);m.useEffect(()=>{te.current=P},[P]);const B=m.useCallback(z=>{if(x.current){let ge=z*E.current-x.current.clientHeight+E.current;k(ge),x.current.scrollTop=ge}},[E.current]),ue=m.useCallback(z=>{x.current=z,c&&(z&&!y.current&&C.current!==null&&requestAnimationFrame(()=>{x.current&&(B(C.current),y.current=!0)}),z||(y.current=!1))},[B]),G=m.useCallback(z=>{if(!z||L.current)return;const ge=z.getBoundingClientRect().height;ge&&(A(ge),E.current=ge,L.current=!0)},[]);m.useEffect(()=>{v.current.init(x.current,a,z=>{M(z),C.current=z},z=>te.current(z),c)},[a,x.current,c]),m.useEffect(()=>{const z=(be,Me)=>{v.current.navigate(be,Me),B(C.current)},ge=(be,Me)=>{const Fe=C.current,Ve=U.current;if(Fe!==0&&Fe!==Ve.length-1&&(be.key==="ArrowDown"||be.key==="ArrowUp")&&be.preventDefault(),v.current.keydown(be,Me),x.current){const Le=x.current.scrollTop<=C.current*E.current,Ee=x.current.scrollTop+x.current.clientHeight>=C.current*E.current+E.current;Le?Ee||B(C.current):(x.current.scrollTop=C.current*E.current,k(x.current.scrollTop))}};r&&r({navigate:c?z:v.current.navigate,keydown:c?ge:v.current.keydown,move:v.current.move})},[]);const de=m.useRef(0),re=m.useRef(a);re.current!==a&&(re.current=a,de.current+=1);const fe=m.useCallback(()=>{v.current.navigate(null)},[v]),I=m.useCallback(z=>{c&&k(z.target.scrollTop)},[c]),Z=m.useMemo(()=>Math.ceil((x.current?.clientHeight||0)/T),[T,j]),ee=m.useMemo(()=>{if(!c)return{start:0,end:a.length};if(!a.length)return{start:0,end:0};const z=Math.floor(j/T),ge=z+Z;return{start:Math.max(0,z-vx),end:Math.min(a.length,ge+vx)}},[c,a,j,T,Z]),_=m.useMemo(()=>{if(!c)return a;const{start:z,end:ge}=ee;return a.slice(z,ge).map(be=>({...be}))},[c,a,ee]),ae=ee.start*T,me=a.length*T;return m.useEffect(()=>{c&&k(0)},[a,c]),m.useEffect(()=>{w===null&&(y.current=!1)},[w]),w===null?null:o.jsx(_m,{onCancel:fe,...g,children:o.jsx("div",{className:"wx-233fr7 wx-list",ref:ue,onClick:P,onMouseMove:v.current.move,onScroll:I,children:a.length?c?o.jsx("div",{className:"wx-233fr7 wx-list-wrapper",style:{height:`${me}px`},children:o.jsx("div",{className:"wx-233fr7 wx-list-content",style:{transform:`translateY(${ae}px)`},children:o.jsx(yx,{visibleRange:ee,visibleItems:_,navIndex:w,measureRefCallback:G,checkboxes:d,itemTemplate:l,value:p})})}):o.jsx(yx,{visibleRange:ee,visibleItems:_,navIndex:w,measureRefCallback:G,checkboxes:d,itemTemplate:l,value:p}):o.jsx("div",{className:"wx-233fr7 wx-no-data",children:q("No data")})})},de.current)}function Om({value:a="",id:l,readonly:s=!1,focus:r=!1,select:c=!1,type:d="text",placeholder:h="",disabled:p=!1,error:g=!1,title:x="",tooltip:y,css:v="",icon:w="",clear:M=!1,onChange:C}){const j=Ev(l),[k,T]=Wa(a),A=m.useRef(null),L=m.useMemo(()=>w&&v.indexOf("wx-icon-left")===-1?"wx-icon-right "+v:v,[w,v]),q=m.useMemo(()=>w&&v.indexOf("wx-icon-left")!==-1,[w,v]);m.useEffect(()=>{const te=setTimeout(()=>{r&&A.current&&A.current.focus(),c&&A.current&&A.current.select()},1);return()=>clearTimeout(te)},[r,c]);const U=m.useCallback(te=>{const B=te.target.value;T(B),C&&C({value:B,input:!0})},[C]),X=m.useCallback(te=>C&&C({value:te.target.value}),[C]);function E(te){te.stopPropagation(),T(""),C&&C({value:""})}let P=d;return d!=="password"&&d!=="number"&&(P="text"),m.useEffect(()=>{const te=X,B=A.current;return B.addEventListener("change",te),()=>{B&&B.removeEventListener("change",te)}},[X]),o.jsxs("div",{className:`wx-hQ64J4 wx-text ${L} ${g?"wx-error":""} ${p?"wx-disabled":""} ${M?"wx-clear":""}`,"data-tooltip-text":y,children:[o.jsx("input",{className:"wx-hQ64J4 wx-input",ref:A,id:j,readOnly:s,disabled:p,placeholder:h,type:P,title:x,value:k,onInput:U}),M&&!p&&k?o.jsxs(o.Fragment,{children:[o.jsx("i",{className:"wx-hQ64J4 wx-icon wxi-close",onClick:E}),q&&o.jsx("i",{className:`wx-hQ64J4 wx-icon ${w}`})]}):w?o.jsx("i",{className:`wx-hQ64J4 wx-icon ${w}`}):null]})}function Hw({date:a,type:l,part:s,onShift:r}){const{calendar:c,formats:d}=m.useContext(Ba).getRaw(),h=a.getFullYear(),p=m.useMemo(()=>{switch(l){case"month":return er(d.monthYearFormat,c)(a);case"year":return er(d.yearFormat,c)(a);case"duodecade":{const{start:x,end:y}=Nv(h),v=er(d.yearFormat,c);return`${v(new Date(x,0,1))} - ${v(new Date(y,11,31))}`}default:return""}},[a,l,h,c,d]);function g(){r&&r({diff:0,type:l})}return o.jsxs("div",{className:"wx-8HQVQV wx-header",children:[s!=="right"?o.jsx("i",{className:"wx-8HQVQV wx-pager wxi-angle-left",onClick:()=>r&&r({diff:-1,type:l})}):o.jsx("span",{className:"wx-8HQVQV wx-spacer"}),o.jsx("span",{className:"wx-8HQVQV wx-label",onClick:g,children:p}),s!=="left"?o.jsx("i",{className:"wx-8HQVQV wx-pager wxi-angle-right",onClick:()=>r&&r({diff:1,type:l})}):o.jsx("span",{className:"wx-8HQVQV wx-spacer"})]})}function Bm({onClick:a,children:l}){return o.jsx("button",{className:"wx-3s8W4d wx-button",onClick:a,children:l})}function Fw({value:a,current:l,part:s="",markers:r=null,css:c="",onCancel:d,onChange:h}){const p=(m.useContext(Ba)||_u()).getRaw().calendar,g=(p.weekStart||7)%7,x=p.dayShort.slice(g).concat(p.dayShort.slice(0,g)),y=(U,X,E)=>new Date(U.getFullYear(),U.getMonth()+(X||0),U.getDate()+(E||0));let v=s!=="normal";function w(U){const X=U.getDay();return X===0||X===6}function M(){const U=y(l,0,1-l.getDate());return U.setDate(U.getDate()-(U.getDay()-(g-7))%7),U}function C(){const U=y(l,1,-l.getDate());return U.setDate(U.getDate()+(6-U.getDay()+g)%7),U}const j=m.useRef(0);function k(U,X){X.timeStamp!==j.current&&(j.current=X.timeStamp,X.stopPropagation(),h&&h(new Date(U)),d&&d())}const T=m.useMemo(()=>s=="normal"?[a?y(a).valueOf():0]:a?[a.start?y(a.start).valueOf():0,a.end?y(a.end).valueOf():0]:[0,0],[s,a]),A=m.useMemo(()=>{const U=M(),X=C(),E=l.getMonth();let P=[];for(let te=U;te<=X;te.setDate(te.getDate()+1)){const B={day:te.getDate(),in:te.getMonth()===E,date:te.valueOf()};let ue="";if(ue+=B.in?"":" wx-inactive",ue+=T.indexOf(B.date)>-1?" wx-selected":"",v){const G=B.date==T[0],de=B.date==T[1];G&&!de?ue+=" wx-left":de&&!G&&(ue+=" wx-right"),B.date>T[0]&&B.date<T[1]&&(ue+=" wx-inrange")}if(ue+=w(te)?" wx-weekend":"",r){const G=r(te);G&&(ue+=" "+G)}P.push({...B,css:ue})}return P},[l,T,v,r]),L=m.useRef(null);let q=m.useRef({});return q.current.click=k,m.useEffect(()=>{lr(L.current,q.current)},[]),o.jsxs("div",{className:`wx-398RBS wx-month ${c}`,children:[o.jsx("div",{className:"wx-398RBS wx-weekdays",children:x.map(U=>o.jsx("div",{className:"wx-398RBS wx-weekday",children:U},U))}),o.jsx("div",{className:"wx-398RBS wx-days",ref:L,children:A.map(U=>o.jsx("div",{className:`wx-398RBS wx-day ${U.css} ${U.in?"":"wx-out"}`,"data-id":U.date,children:U.day},U.date))})]})}function Iw({value:a,current:l,part:s,onCancel:r,onChange:c,onShift:d}){const h=m.useRef(new Date),[p,g]=Wa(a||h.current),[x,y]=Wa(l||h.current),v=m.useContext(Ba).getRaw().calendar,w=v.monthShort||[],M=m.useMemo(()=>x.getMonth(),[x]),C=m.useCallback((T,A)=>{if(T!=null){A.stopPropagation();const L=new Date(x);L.setMonth(T),y(L),d&&d({current:L})}s==="normal"&&g(new Date(x)),r&&r()},[x,s,d,r]),j=m.useCallback(()=>{const T=new Date(Dv(p,s)||x);T.setMonth(x.getMonth()),T.setFullYear(x.getFullYear()),c&&c(T)},[p,x,s,c]),k=m.useCallback(T=>{const A=T.target.closest("[data-id]");if(A){const L=parseInt(A.getAttribute("data-id"),10);C(L,T)}},[C]);return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"wx-34U8T8 wx-months",onClick:k,children:w.map((T,A)=>o.jsx("div",{className:"wx-34U8T8 wx-month"+(M===A?" wx-current":""),"data-id":A,children:T},A))}),o.jsx("div",{className:"wx-34U8T8 wx-buttons",children:o.jsx(Bm,{onClick:j,children:v.done})})]})}const qf="wx-1XEF33",Uw=({value:a,current:l,onCancel:s,onChange:r,onShift:c,part:d})=>{const h=m.useContext(Ba).getRaw().calendar,[p,g]=Wa(l),[x,y]=Wa(a),v=m.useMemo(()=>p.getFullYear(),[p]),w=m.useMemo(()=>{const{start:T,end:A}=Nv(v),L=[];for(let q=T;q<=A;++q)L.push(q);return L},[v]),M={click:C};function C(T,A){if(T){A.stopPropagation();const L=new Date(p);L.setFullYear(T),g(L),c&&c({current:L})}d==="normal"&&y(new Date(p)),s&&s()}function j(){const T=new Date(Dv(x,d)||p);T.setFullYear(p.getFullYear()),r&&r(T)}const k=m.useRef(null);return m.useEffect(()=>{k.current&&lr(k.current,M)},[]),o.jsxs(o.Fragment,{children:[o.jsx("div",{className:qf+" wx-years",ref:k,children:w.map((T,A)=>o.jsx("div",{className:qf+` wx-year ${v==T?"wx-current":""} ${A===0?"wx-prev-decade":""} ${A===11?"wx-next-decade":""}`,"data-id":T,children:T},A))}),o.jsx("div",{className:qf+" wx-buttons",children:o.jsx(Bm,{onClick:j,children:h.done})})]})},bx={month:{component:Fw,next:qw,prev:$w},year:{component:Iw,next:Pw,prev:Gw},duodecade:{component:Uw,next:Vw,prev:Yw}};function $w(a){return a=new Date(a),a.setMonth(a.getMonth()-1),a}function qw(a){return a=new Date(a),a.setMonth(a.getMonth()+1),a}function Gw(a){return a=new Date(a),a.setFullYear(a.getFullYear()-1),a}function Pw(a){return a=new Date(a),a.setFullYear(a.getFullYear()+1),a}function Yw(a){return a=new Date(a),a.setFullYear(a.getFullYear()-10),a}function Vw(a){return a=new Date(a),a.setFullYear(a.getFullYear()+10),a}function Dv(a,l){let s;if(l==="normal")s=a;else{const{start:r,end:c}=a;l==="left"?s=r:l=="right"?s=c:s=r&&c}return s}const Qw=["clear","today"];function Kw(a){if(a==="done")return-1;if(a==="clear")return null;if(a==="today")return new Date}function Xw({value:a,current:l,onCurrentChange:s,part:r="normal",markers:c=null,buttons:d,css:h="",onShift:p,onChange:g}){const x=m.useContext(Ba).getGroup("calendar"),[y,v]=m.useState("month"),w=Array.isArray(d)?d:d?Qw:[],M=(A,L)=>{A.preventDefault(),g&&g({value:L})},C=()=>{y==="duodecade"?v("year"):y==="year"&&v("month")},j=A=>{const{diff:L,current:q}=A;if(L===0){y==="month"?v("year"):y==="year"&&v("duodecade");return}if(L){const U=bx[y];s(L>0?U.next(l):U.prev(l))}else q&&s(q);p&&p()},k=A=>{v("month"),g&&g({select:!0,value:A})},T=m.useMemo(()=>bx[y].component,[y]);return o.jsx("div",{className:`wx-2Gr4AS wx-calendar ${r!=="normal"&&r!=="both"?"wx-part":""} ${h}`,children:o.jsxs("div",{className:"wx-2Gr4AS wx-wrap",children:[o.jsx(Hw,{date:l,part:r,type:y,onShift:j}),o.jsxs("div",{children:[o.jsx(T,{value:a,current:l,onCurrentChange:s,part:r,markers:c,onCancel:C,onChange:k,onShift:j}),y==="month"&&w.length>0&&o.jsx("div",{className:"wx-2Gr4AS wx-buttons",children:w.map(A=>o.jsx("div",{className:"wx-2Gr4AS wx-button-item",children:o.jsx(Bm,{onClick:L=>M(L,Kw(A)),children:x(A)})},A))})]})]})})}function Hm(a){let{words:l=null,optional:s=!1,children:r}=a,c=m.useContext(Ba);const d=m.useMemo(()=>{let h=c;return(!h||!h.extend)&&(h=Ro(Av)),l!==null&&(h=h.extend(l,s)),h},[l,s,c]);return o.jsx(Ba.Provider,{value:d,children:r})}function wx(a,l,s,r){if(!a||r){const c=l?new Date(l):new Date;c.setDate(1),s(c)}else if(a.getDate()!==1){const c=new Date(a);c.setDate(1),s(c)}}const Zw=["clear","today"];function Rv({value:a,current:l,markers:s=null,buttons:r=Zw,css:c="",onChange:d}){const[h,p]=Wa(a),[g,x]=Wa(l);m.useEffect(()=>{wx(g,h,x,!1)},[h,g]);const y=m.useCallback(w=>{const M=w.value;M?(p(new Date(M)),wx(g,new Date(M),x,!0)):p(null),d&&d({value:M?new Date(M):null})},[d,g]),v=m.useCallback(w=>{x(w)},[x]);return g?o.jsx(Hm,{children:o.jsx(Xw,{value:h,current:g,markers:s,buttons:r,css:c,onChange:y,onCurrentChange:v})}):null}function Ww(a){return a||(a={}),a.width||(a.width="unset"),a}const Jw=["clear","today"];function eS({value:a,id:l,disabled:s=!1,error:r=!1,placeholder:c="",format:d="",buttons:h=Jw,css:p="",title:g="",tooltip:x,editable:y=!1,clear:v=!1,onChange:w,dropdown:M={}}){const{calendar:C,formats:j}=(m.useContext(Ba)||_u()).getRaw(),k=d||j?.dateFormat;let T=typeof k=="function"?k:er(k,C);const[A,L]=m.useState(a),[q,U]=m.useState(!1);m.useEffect(()=>{L(a)},[a]);function X(){U(!1)}function E(B){const ue=B===A||B&&A&&B.valueOf()===A.valueOf()||!B&&!A;L(B),ue||w&&w({value:B}),setTimeout(X,1)}const P=m.useMemo(()=>A?T(A):"",[A,T]);function te({value:B,input:ue}){if(!y&&!v||ue)return;let G=typeof y=="function"?y(B):B?new Date(B):null;G=isNaN(G)?A||null:G||null,E(G)}return m.useEffect(()=>{const B=X;return window.addEventListener("scroll",B),()=>window.removeEventListener("scroll",B)},[]),o.jsxs("div",{className:"wx-1lKOFG wx-datepicker",onClick:()=>U(!0),children:[o.jsx(Om,{css:`wx-date-input ${p}`,title:g,tooltip:x,value:P,id:l,readonly:!y,disabled:s,error:r,placeholder:c,onInput:X,onChange:te,icon:"wxi-calendar",clear:v}),q&&!s&&o.jsx(_m,{onCancel:X,...Ww(M),children:o.jsx(Rv,{buttons:h,value:A,onChange:B=>E(B.value)})})]})}function tS({value:a="",options:l=[],textOptions:s=null,placeholder:r="",disabled:c=!1,error:d=!1,title:h="",tooltip:p,textField:g="label",clear:x=!1,css:y="",children:v,onChange:w,dropdown:M={}}){const C=m.useRef(null),j=m.useRef(null);let[k,T]=Wa(a);function A(E){C.current=E.navigate,j.current=E.keydown}const L=m.useMemo(()=>k||k===0?(s||l).find(E=>E.id===k):null,[k,s,l]),q=m.useCallback(({id:E})=>{(E||E===0)&&(T(E),C.current(null),w&&w({value:E}))},[T,w]),U=m.useCallback(E=>{E.stopPropagation(),T(""),w&&w({value:""})},[T,w]),X=m.useCallback(()=>l.findIndex(E=>E.id===k),[l,k]);return o.jsxs("div",{className:`wx-2YgblL wx-richselect ${y} ${d?"wx-2YgblL wx-error":""} ${c?"wx-2YgblL wx-disabled":""} ${v?"":"wx-2YgblL wx-nowrap"}`,title:h,onClick:()=>C.current(X()),onKeyDown:E=>j.current(E,X()),tabIndex:0,"data-tooltip-text":p,children:[o.jsx("div",{className:"wx-2YgblL wx-label",children:L?v?v(L):L[g]:r?o.jsx("span",{className:"wx-2YgblL wx-placeholder",children:r}):" "}),x&&!c&&k?o.jsx("i",{className:"wx-2YgblL wx-icon wxi-close",onClick:U}):o.jsx("i",{className:"wx-2YgblL wx-icon wxi-angle-down"}),!c&&o.jsx(Ou,{items:l,onReady:A,onSelect:q,...M,children:({option:E})=>v?v(E):E[g]})]})}const nS=({options:a=[],value:l="",css:s="",children:r,onChange:c})=>{const[d,h]=m.useState(l),p=g=>{h(g),c&&c({value:g})};return m.useEffect(()=>{h(l)},[l]),o.jsx("div",{className:`wx-0hMO7P wx-segmented ${s}`,children:a.map(g=>o.jsx("button",{className:`wx-0hMO7P wx-segment ${g.css} ${g.id===d?"wx-selected":""}`,title:g.title,onClick:()=>p(g.id),"data-tooltip-text":g.tooltip,children:r?Em(r,{option:g}):o.jsxs(o.Fragment,{children:[g.icon&&o.jsx("i",{className:`wx-0hMO7P wx-icon ${g.icon} ${g.label?"":"wx-only"}`}),g.label&&o.jsx("span",{className:"wx-0hMO7P wx-label",children:g.label})]})},g.id))})};function aS({notice:a={}}){function l(){a.remove&&a.remove()}return o.jsxs("div",{className:`wx-11sNg5 wx-notice wx-${a.type?a.type:""}`,role:"status","aria-live":"polite",children:[o.jsx("div",{className:"wx-11sNg5 wx-text",children:a.text}),o.jsx("div",{className:"wx-11sNg5 wx-button",children:o.jsx("i",{className:"wx-11sNg5 wxi-close",onClick:l})})]})}function lS({data:a=[]}){return o.jsx("div",{className:"wx-3nwoO9 wx-notices",children:a.map(l=>o.jsx(aS,{notice:l},l.id))})}function pm({title:a="",buttons:l=["cancel","ok"],header:s,children:r,footer:c,css:d="",onConfirm:h,onCancel:p}){const g=(m.useContext(Ba)||_u()).getGroup("core"),x=m.useRef(null);m.useEffect(()=>{x.current?.focus()},[]);function y(w){switch(w.code){case"Enter":{const M=w.target.tagName;if(M==="TEXTAREA"||M==="BUTTON")return;h&&h({event:w});break}case"Escape":p&&p({event:w});break}}function v(w,M){const C={event:w,button:M};M==="cancel"?p&&p(C):h&&h(C)}return o.jsx("div",{className:`wx-1FxkZa wx-modal ${d}`,ref:x,tabIndex:0,onKeyDown:y,children:o.jsxs("div",{className:"wx-1FxkZa wx-window",children:[s||(a?o.jsx("div",{className:"wx-1FxkZa wx-header",children:a}):null),o.jsx("div",{children:r}),c||l&&o.jsx("div",{className:"wx-1FxkZa wx-buttons",children:l.map(w=>o.jsx("div",{className:"wx-1FxkZa wx-button",children:o.jsx(Co,{type:`block ${w==="ok"?"primary":"secondary"}`,onClick:M=>v(M,w),children:g(w)})},w))})]})})}function iS({children:a},l){const[s,r]=m.useState(null),[c,d]=m.useState([]);return m.useImperativeHandle(l,()=>({showModal:h=>{const p={...h};return r(p),new Promise((g,x)=>{p.resolve=y=>{r(null),g(y)},p.reject=y=>{r(null),x(y)}})},showNotice:h=>{h={...h},h.id=h.id||Rm(),h.remove=()=>d(p=>p.filter(g=>g.id!==h.id)),h.expire!=-1&&setTimeout(h.remove,h.expire||5100),d(p=>[...p,h])}}),[]),o.jsxs(o.Fragment,{children:[a,s&&o.jsx(pm,{title:s.title,buttons:s.buttons,onConfirm:s.resolve,onCancel:s.reject,children:s.message}),o.jsx(lS,{data:c})]})}const sS=m.forwardRef(iS);function rS(a){let{children:l}=a,s=m.useRef();const r=m.useMemo(()=>({showNotice:c=>s.current.showNotice(c),showModal:c=>s.current.showModal(c)}),[]);return o.jsx(Tv.Provider,{value:r,children:o.jsx(sS,{ref:s,children:l})})}const oS=({value:a=!1,type:l="",icon:s="",disabled:r=!1,iconActive:c="",onClick:d,title:h="",tooltip:p,css:g="",text:x="",textActive:y="",children:v,active:w,onChange:M})=>{const[C,j]=Wa(a),k=m.useMemo(()=>(C?"pressed":"")+(l?" "+l:""),[C,l]),T=m.useCallback(A=>{let L=!C;d&&d(A),A.defaultPrevented||(j(L),M&&M({value:L}))},[C,d,M]);return C&&w?o.jsx(Co,{title:h,tooltip:p,text:C&&y||x,css:g,type:k,icon:C&&c||s,onClick:T,disabled:r,children:Em(w,{value:C})}):v?o.jsx(Co,{title:h,tooltip:p,text:C&&y||x,css:g,type:k,icon:C&&c||s,onClick:T,disabled:r,children:v}):o.jsx(Co,{title:h,tooltip:p,text:C&&y||x,css:g,type:k,icon:C&&c||s,onClick:T,disabled:r})};function cS(){return o.jsx(o.Fragment,{})}function Sx(a){const{fonts:l=!0,children:s}=a;return o.jsx(Lm.Provider,{value:"willow",children:o.jsxs(o.Fragment,{children:[s&&s&&o.jsx("div",{className:"wx-theme wx-willow-theme",children:s}),l&&o.jsxs(o.Fragment,{children:[o.jsx("link",{rel:"preconnect",href:"https://cdn.svar.dev",crossOrigin:"true"}),o.jsx(cS,{}),o.jsx("link",{rel:"stylesheet",href:"https://cdn.svar.dev/fonts/wxi/wx-icons.css"})]})]})})}Dm(Vn);const Fm={grid:{"Add before":"Add before","Add after":"Add after",Copy:"Copy",Cut:"Cut",Paste:"Paste",Delete:"Delete","New row":"New row","Move up":"Move up","Move down":"Move down",Undo:"Undo",Redo:"Redo",selected:"selected"}};new Date().valueOf();var Lv=class{constructor(a){this._nextHandler=null,this._dispatch=a,this.exec=this.exec.bind(this)}async exec(a,l){return this._dispatch(a,l),this._nextHandler&&await this._nextHandler.exec(a,l),l}setNext(a){return this._nextHandler=a}};new Date().valueOf();var uS=class{constructor(a){const l={id:0,$level:0,data:[],parent:null},s=new Map;s.set(0,l),this._pool=s,a&&a.length&&this.parse(a,0)}parse(a,l){const s=this._pool;for(let c=0;c<a.length;c++){const d=a[c];d.parent=d.parent||l,d.data=null,s.set(d.id,d)}for(let c=0;c<a.length;c++){const d=a[c],h=s.get(d.parent);h&&(h.data||(h.data=[]),h.data.push(d))}const r=s.get(l);this.setLevel(r,r.$level+1,!1)}add(a,l){const s=this._pool.get(a.parent||0);a.$level=s.$level+1,this._pool.set(a.id,a),s.data?l===-1?s.data=[...s.data,a]:Mx(s,l,a):s.data=[a]}addAfter(a,l){if(!l)return this.add(a,-1);const s=this.byId(l),r=this.byId(s.parent),c=iu(r,s.id)+1;a.parent=r.id,a.$level=r.$level+1,this.add(a,c)}remove(a){const l=this._pool.get(a);this._remove(l);const s=this._pool.get(l.parent);s.data=s.data.filter(r=>r.id!=a),this._clearBranch(s)}_remove(a){a.data&&a.data.forEach(l=>this._remove(l)),this._pool.delete(a.id)}update(a,l){let s=this._pool.get(a);const r=this._pool.get(s.parent),c=iu(r,s.id);s={...s,...l},r&&c>=0&&(r.data[c]=s,r.data=[...r.data]),this._pool.set(s.id,s)}move(a,l,s){const r=this._pool.get(a),c=l==="child",d=this._pool.get(s),h=d.$level+(c?1:0);if(!r||!d)return;const p=this._pool.get(r.parent),g=c?d:this._pool.get(d.parent);g.data||(g.data=[]);const x=iu(p,r.id);dS(p,x);const y=c?g.data.length:iu(g,d.id)+(l==="after"?1:0);if(Mx(g,y,r),p.id===g.id&&x===y)return null;r.parent=g.id,r.$level!==h&&(r.$level=h,this.setLevel(r,h+1,!0)),this.update(r.id,r),this._clearBranch(p)}_clearBranch(a){a.data&&!a.data.length&&(a.open&&delete a.open,this.update(a.id,{data:null}))}toArray(){const a=[],l=this._pool.get(0).data;return l&&zv(l,a),a}byId(a){return this._pool.get(a)}getBranch(a){return this._pool.get(a).data}forEach(a){this._pool.forEach((l,s)=>{s!==0&&a(l)})}eachChild(a,l){const s=this.byId(l);!s||!s.data||s.data.forEach((r,c)=>{a(this.byId(r.id),c),this.eachChild(a,r.id)})}setLevel(a,l,s){a.data&&(a.data=a.data.map(r=>(s&&(r={...r},this._pool.set(r.id,r)),r.$level=l,r.data&&this.setLevel(r,l+1,s),r)))}};function zv(a,l){a.forEach(s=>{l.push(s),s.open===!0&&zv(s.data,l)})}function dS(a,l){const s=[...a.data];s.splice(l,1),a.data=s}function Mx(a,l,s){const r=[...a.data];r.splice(l,0,s),a.data=r}function iu(a,l){return a?.data.findIndex(s=>s.id===l)}var _v=2,fS=class{constructor(l){l&&(this._writable=l.writable,this._async=l.async),this._values={},this._state={}}setState(l,s=0){const r={};return this._wrapProperties(l,this._state,this._values,"",r,s),r}getState(){return this._values}getReactive(){return this._state}_wrapProperties(l,s,r,c,d,h){for(const p in l){const g=s[p],x=r[p],y=l[p];if(g&&(x===y&&typeof y!="object"||y instanceof Date&&x instanceof Date&&x.getTime()===y.getTime()))continue;const v=c+(c?".":"")+p;g?(g.__parse(y,v,d,h)&&(r[p]=y),h&_v?d[v]=g.__trigger:g.__trigger()):(y&&y.__reactive?s[p]=this._wrapNested(y,y,v,d):s[p]=this._wrapWritable(y),r[p]=y),d[v]=d[v]||null}}_wrapNested(l,s,r,c){const d=this._wrapWritable(l);return this._wrapProperties(l,d,s,r,c,0),d.__parse=(h,p,g,x)=>(this._wrapProperties(h,d,s,p,g,x),!1),d}_wrapWritable(l){const s=[],r=function(){for(let c=0;c<s.length;c++)s[c](l)};return{subscribe:c=>(s.push(c),this._async?setTimeout(c,1,l):c(l),()=>{const d=s.indexOf(c);d>=0&&s.splice(d,1)}),__trigger:()=>{s.length&&(this._async?setTimeout(r,1):r())},__parse:function(c){return l=c,!0}}}};function Cx(a,l){return Object.defineProperty(a,"__reactive",{value:!0,enumerable:!1,writable:!1}),a}var mS=class{constructor(l,s,r,c){typeof l=="function"?this._setter=l:this._setter=l.setState.bind(l),this._routes=s,this._parsers=r,this._prev={},this._triggers=new Map,this._sources=new Map,this._routes.forEach(d=>{d.in.forEach(h=>{const p=this._triggers.get(h)||[];p.push(d),this._triggers.set(h,p)}),d.out.forEach(h=>{const p=this._sources.get(h)||{};d.in.forEach(g=>p[g]=!0),this._sources.set(h,p)})}),this._routes.forEach(d=>{d.length=Math.max(...d.in.map(h=>Ov(h,this._sources,1)))}),this._bus=c}init(l){const s={};for(const r in l)if(this._prev[r]!==l[r]){const c=this._parsers[r];s[r]=c?c(l[r]):l[r]}this._prev=this._prev?{...this._prev,...l}:{...l},this.setState(s),this._bus&&this._bus.exec("init-state",s)}setStateAsync(l){const s=this._setter(l,_v);return this._async?Object.assign(this._async.signals,s):this._async={signals:s,timer:setTimeout(this._applyState.bind(this),1)},s}_applyState(){const l=this._async;if(l){this._async=null,this._triggerUpdates(l.signals,[]);for(const s in l.signals){const r=l.signals[s];r&&r()}}}setState(l,s=[]){const r=this._setter(l);return this._triggerUpdates(r,s),r}_triggerUpdates(l,s){const r=Object.keys(l),c=!s.length;s=s||[];for(let d=0;d<r.length;d++){const h=r[d],p=this._triggers.get(h);p&&p.forEach(g=>{s.indexOf(g)==-1&&s.push(g)})}c&&this._execNext(s)}_execNext(l){for(;l.length;){l.sort((r,c)=>r.length<c.length?1:-1);const s=l[l.length-1];l.splice(l.length-1),s.exec(l)}}};function Ov(a,l,s){const r=l.get(a);if(!r)return s;const c=Object.keys(r).map(d=>Ov(d,l,s+1));return Math.max(...c)}var hS=class{constructor(){this._nextHandler=null,this._handlers={},this._tag=new WeakMap,this.exec=this.exec.bind(this)}on(l,s,r){let c=this._handlers[l];c?r&&r.intercept?c.unshift(s):c.push(s):c=this._handlers[l]=[s],r&&r.tag&&this._tag.set(s,r.tag)}intercept(l,s,r){this.on(l,s,{...r,intercept:!0})}detach(l){for(const s in this._handlers){const r=this._handlers[s];for(let c=r.length-1;c>=0;c--)this._tag.get(r[c])===l&&r.splice(c,1)}}async exec(l,s){const r=this._handlers[l];if(r)for(let c=0;c<r.length;c++){const d=r[c](s);if(d===!1||d&&d.then&&await d===!1)return}return this._nextHandler&&await this._nextHandler.exec(l,s),s}setNext(l){return this._nextHandler=l}};const Qs=1024;function Eo(a){return a<Qs?`${a} B`:a<Qs**2?`${(a/Qs).toFixed(1)} KB`:a<Qs**3?`${(a/Qs**2).toFixed(1)} MB`:`${(a/Qs**3).toFixed(1)} GB`}function jx(a,l){l||(l={key:"name",order:"asc"});const s=a.filter(h=>h.type==="folder"),r=a.filter(h=>h.type!=="folder"),c=s.sort(Nx(l)),d=r.sort(Nx(l));return[...c,...d]}function pS(a,l){return typeof a=="string"?a.localeCompare(l,void 0,{numeric:!0}):typeof a=="object"?a.getTime()-l.getTime():(a??0)-(l??0)}function gS(a,l){return typeof a=="string"?-a.localeCompare(l,void 0,{numeric:!0}):typeof l=="object"?l.getTime()-a.getTime():(l??0)-(a??0)}function Nx({key:a,order:l}){const s=l==="asc"?pS:gS;return(r,c)=>s(r[a],c[a])}function Im(a,l){const s=a==="/"?1:a.split("/").length;return s>=l.length?null:l[s].id}function xS(a){return a.length>1?a[a.length-2].id:null}let vS=class extends uS{constructor(l){const s={id:"/",name:"My files",open:!0,$level:1,parent:0,ext:"",type:"folder"};super([s]),this.parse(l,"/")}parse(l,s,r){!l||!l.length||(l.forEach(c=>this.parseId(c,r?s:void 0)),super.parse(l,s))}parseId(l,s){if(l.parent===0)return;const r=l.id,c=r.lastIndexOf("/");if(l.parent=s??(c===0?"/":r.slice(0,c)),l.name=r.slice(c+1),l.type=l.type||"file",l.type!=="folder"){const d=l.name.lastIndexOf("."),h=d!==-1?l.name.slice(d+1):"";l.ext=h!=="new"?h?.toLocaleLowerCase():""}}getParents(l){const s=[];let r=this.byId(l);if(!r)return s;for(;r.id!==0;)s.push(r),r=this.byId(r.parent);return s.reverse()}findFiles(l,s="/"){const r=[],c=l.toLocaleLowerCase();return this.eachChild(d=>{d.name.toLowerCase().indexOf(c)!==-1&&r.push(d)},s),r}add(l,s){const r=this.byId(l.parent||"/"),c=l.data?[...l.data]:null;l.data=null,super.add(l,s??r.data?r.data.length:0),c&&c.forEach(d=>this.add(d))}renameFiles(l,s,r){const c=this.byId(l),d=this.normalizeFile(c,s),h=[];return d.data?.forEach(p=>h.push(this.renameFiles(p.id,d.id,r))),h.length&&(d.data=h),r[l]=d.id,d}copyFiles(l,s,r){const c={};return l.forEach(d=>{const h=this.renameFiles(d,s,c);this.add(h),r&&this.remove(d),c[d]=h.id}),c}moveFiles(l,s){if(this.byId(l[0]).parent!==s)return this.copyFiles(l,s,!0)}serialize(l="/"){const s=[],r=this.byId(l);return r?(r.data?.forEach(c=>{const{id:d,date:h,type:p,size:g,lazy:x}=c,y={id:d,date:h,type:p??"file"};x&&(y.lazy=x),g&&(y.size=g),s.push(y);const v=this.serialize(d);v.length&&s.push(...v)}),s):null}normalizeFile(l,s){const r=l.name,c=r.lastIndexOf("."),d=c!==-1?r.slice(c+1):"",h=d?`.${d}`:"";let p=c!==-1?r.slice(0,c):r,g=s+(s==="/"?"":"/")+p;for(;this.byId(g+h);){const x=".new";g+=x,p+=x}return{...l,id:g+h,name:p+h,parent:s,ext:d.toLocaleLowerCase()}}},yS=class extends fS{in;_router;constructor(l){super({writable:l,async:!1});const s=[];for(let d=0;d<2;d++)s.push({in:["data",`panels.${d}.path`],out:[`panels.${d}._crumbs`],exec:h=>{const{data:p,panels:g}=this.getState(),x=[];x[d]={_crumbs:p.getParents(g[d].path)},this.setState({panels:x},h)}}),s.push({in:["data",`panels.${d}.path`,`panels.${d}._sorts`,"search"],out:[`panels.${d}._files`],exec:h=>{const{data:p,panels:g,search:x}=this.getState();let y;x?y=p.findFiles(x,g[d].path):y=p.byId(g[d].path)?.data||[];const{path:v,_sorts:w}=g[d];y=jx(y,w[v]);const M=[];M[d]={_files:y},this.setState({panels:M},h)}}),s.push({in:["data",`panels.${d}.selected`,`panels.${d}._sorts`],out:[`panels.${d}._selected`],exec:h=>{const{data:p,panels:g}=this.getState(),x=[];g[d].selected.forEach(C=>{const j=p.byId(C);j&&x.push(j)});const{path:y,_sorts:v}=g[d],w=jx(x,v[y]),M=[];M[d]={_selected:w},this.setState({panels:M},h)}});this._router=new mS(super.setState.bind(this),s,{data:d=>new vS(d)});const r=this.in=new hS;r.on("select-file",({id:d,toggle:h,range:p,panel:g,type:x})=>{const{panels:y,activePanel:v}=this.getState();typeof g>"u"&&(g=v),d||(h=p=!1);let w=[...y[g].selected];if(h){const C=w.indexOf(d);C===-1?w.push(d):w.splice(C,1)}else if(p&&y[g]._lastSelected){const C=y[g]._files;let j=C.findIndex(A=>A.id==y[g]._lastSelected),k=C.findIndex(A=>A.id==d);k<j&&([j,k]=[k,j]);const T=C.slice(j,k+1).map(A=>A.id);w=[...new Set([...w,...T])]}else w=d?[d]:[];const M=[];M[g]={selected:w,_lastSelected:d,_selectNavigation:x==="navigation"},this.setState({panels:M})}),r.on("set-path",({id:d,panel:h,selected:p})=>{const{data:g,activePanel:x}=this.getState(),y=g.byId(d);if(y){const v=[];typeof h>"u"&&(h=x),v[h]={path:d},this.setState({panels:v}),r.exec("select-file",{panel:h}),p&&p.forEach(w=>r.exec("select-file",{id:w,panel:h,toggle:!0})),y.lazy&&r.exec("request-data",{id:d})}}),r.on("provide-data",({id:d,data:h})=>{const{mode:p,data:g}=this.getState(),x=g.byId(d);x&&(x.lazy||(x.data=[]),x.lazy=!1,g.parse(h,d,p==="search"),this.setState({data:g}))}),r.on("open-tree-folder",({id:d,mode:h})=>{const{data:p}=this.getState();p.update(d,{open:h}),this.setState({data:p})}),r.on("show-preview",({mode:d})=>{this.setState({preview:d})}),r.on("rename-file",d=>{const{id:h,name:p}=d,{data:g,panels:x}=this.getState(),y=g.byId(h);if(y.name!==p){y.name=p;const v=g.normalizeFile(y,y.parent);d.newId=v.id,v.data=null,g.add(v);let w={[h]:v.id};y.data?.forEach(C=>w={...g.moveFiles([C.id],v.id),...w});const M=x.map(C=>({selected:C.selected,_crumbs:C._crumbs,_lastSelected:C._lastSelected,_sorts:C._sorts}));g.remove(h),this._updatePanels(M,w),this.setState({data:g,panels:M})}}),r.on("create-file",d=>{const{file:h,parent:p}=d,{data:g}=this.getState(),x=g.normalizeFile(h,p);x.type=h.type||"file",d.newId=x.id,g.add(x),this.setState({data:g}),r.exec("select-file",{id:x.id})}),r.on("delete-files",({ids:d})=>{const{data:h,panels:p}=this.getState(),g=p.map(x=>({selected:x.selected,_crumbs:x._crumbs,_lastSelected:x._lastSelected,_sorts:x._sorts}));d.forEach(x=>h.remove(x)),this._updatePanels(g,{}),this.setState({data:h,panels:g})}),r.on("copy-files",d=>{const{ids:h,target:p}=d;if(this._isPlacedIntoSelf(h,p)){console.error("You cannot copy a folder into itself"),d.skipProvider=!0;return}const{data:g,panels:x,activePanel:y}=this.getState(),v=g.copyFiles(h,p);d.newIds=h.map(w=>v[w]),this.setState({data:g}),x[y].path==p&&(r.exec("select-file",{}),h.forEach(w=>{r.exec("select-file",{id:v[w],toggle:!0})}))}),r.on("move-files",d=>{const{ids:h,target:p}=d;if(this._isPlacedIntoSelf(h,p)){console.error("You cannot move a folder into itself"),d.skipProvider=!0;return}const{data:g,panels:x,activePanel:y}=this.getState(),v=g.moveFiles(h,p);if(v){d.newIds=h.map(M=>v[M]);const w=x.map(M=>({selected:M.selected,_crumbs:M._crumbs,_lastSelected:M._lastSelected,_sorts:M._sorts}));this._updatePanels(w,v,!0),this.setState({data:g,panels:w}),x[y].path==p&&(r.exec("select-file",{}),h.forEach(M=>{r.exec("select-file",{id:v[M],toggle:!0})}))}});let c=null;r.on("filter-files",({text:d})=>{if(!d){c&&this.setState({...c});return}r.exec("select-file",{});const{panels:h,mode:p}=this.getState();c||(c={panels:h,mode:p,search:""}),this.setState({mode:"search",search:d})}),r.on("set-mode",({mode:d})=>{const{activePanel:h}=this.getState(),p=[];p[h]={_selectNavigation:!1};const g={mode:d,search:"",panels:p};c=null,this.setState(g)}),r.on("set-active-panel",({panel:d})=>{this.setState({activePanel:d})}),r.on("sort-files",({key:d,order:h,panel:p,path:g})=>{const{activePanel:x,panels:y}=this.getState();p=p??x,g=g??y[p].path;const v=[];v[p]={_sorts:{...y[p]._sorts,[g]:{key:d,order:h}}},this.setState({panels:v})}),this.initOnce()}initOnce(){const l=[];for(let r=0;r<2;r++)l[r]=Cx({_crumbs:[],_files:[],_selected:[],_sorts:{},path:"/",selected:[],...l[r]});const s={panels:Cx(l),data:[],search:""};this._router.init(s)}init(l){const s={...l};this._router.init(s)}setState(l,s){return this._router.setState(l,s)}getFile(l){const{data:s}=this.getState();return s.byId(l)||null}serialize(l){const{data:s}=this.getState();return s.serialize(l)}_updatePanels(l,s,r){const{data:c}=this.getState();l.forEach(d=>{const h=[];d.selected.forEach(x=>{c.byId(x)?h.push(x):!r&&s[x]&&h.push(s[x])}),d.selected=h,c.byId(d._lastSelected)||(d._lastSelected=r?null:s[d._lastSelected]||null);const p={};Object.keys(d._sorts).forEach(x=>{c.byId(x)?p[x]=d._sorts[x]:s[x]&&!r&&(p[s[x]]=d._sorts[x])}),d._sorts=p;const g=d._crumbs[d._crumbs.length-1];g?.id!=="/"&&(s[g.id]?d.path=s[g.id]:c.byId(g.id)||(d.path="/"))})}_isPlacedIntoSelf(l,s){return l.some(r=>r===s||this.getState().data.getParents(s).some(c=>c.id===r))}};function bS(a){switch(a){case"body":return[{icon:"wxi-content-paste",text:"Paste",hotkey:"Ctrl+V",id:"paste"}];case"add":return[{icon:"mdi mdi-folder-plus-outline",text:"Add new file",id:"add-file"},{icon:"mdi mdi-file-plus-outline",text:"Add new folder",id:"add-folder"},{icon:"mdi mdi-file-upload-outline",text:"Upload file",id:"upload",comp:"upload"}];case"multiselect":return[{icon:"wxi-content-copy",text:"Copy",hotkey:"Ctrl+C",id:"copy"},{icon:"wxi-content-cut",text:"Cut",hotkey:"Ctrl+X",id:"move"},{comp:"separator"},{icon:"wxi-close",text:"Delete",hotkey:"Delete",id:"delete"}];default:return[a==="folder"?null:{icon:"wxi-download",text:"Download",hotkey:"Ctrl+D",id:"download"},{icon:"wxi-content-copy",text:"Copy",hotkey:"Ctrl+C",id:"copy"},{icon:"wxi-content-cut",text:"Cut",hotkey:"Ctrl+X",id:"move"},{icon:"wxi-content-paste",text:"Paste",hotkey:"Ctrl+V",id:"paste"},{comp:"separator"},{icon:"wxi-edit",text:"Rename",hotkey:"Ctrl+R",id:"rename"},{icon:"wxi-close",text:"Delete",hotkey:"Delete",id:"delete"}].filter(l=>l!==null)}}function wS(a,l="data-id"){let s=a;for(!s.tagName&&a.target&&(s=a.target);s;){if(s.getAttribute&&s.getAttribute(l))return s;s=s.parentNode}return null}function SS(a,l="data-id"){const s=wS(a,l);return s?s.getAttribute(l):null}new Date().valueOf();function MS(a,l){const{api:s}=l;function r(d,h){const p=l.getPanel(),g=p.selected,x=h.ctrlKey||h.metaKey,y=h.shiftKey;let v;const w=g?.[0]?s.getFile(g[0]):null;g?.length?g.length>1?v=l.menuOptions("multiselect"):v=l.menuOptions(w.type,w):v=l.menuOptions("body");const M=`${x?"ctrl+":""}${y?"shift+":""}${d}`,C=v?v.find(k=>k.hotkey?.toLowerCase()===M):!1,j=l.performAction;if(C)switch(M){case"ctrl+c":j("copy");break;case"ctrl+x":j("move");break;case"ctrl+v":j("paste",w);break;case"delete":j("delete");break;case"ctrl+r":h.preventDefault(),j("rename",w);break;case"ctrl+d":h.preventDefault(),j("download",w);break;default:C.handler?.({context:w})}switch(d){case"enter":{if(x||y)break;const{_crumbs:k,_selectNavigation:T}=p;if(T){const A=xS(k);if(A){const L=Im(A,k);s.exec("set-path",{id:A,selected:[L]})}}else if(g.length===1){const A=s.getFile(g[0]);A&&s.exec(A.type==="folder"?"set-path":"open-file",{id:A.id})}break}case"arrowup":case"arrowleft":{const{_files:k,_selected:T,path:A,_selectNavigation:L}=p;let q;if(T.length){const U=T.at(0).id,X=k.findIndex(E=>E.id===U);if(X!==-1){const E=X-1;k[E]?q=k[E].id:A!=="/"&&!(x||y)&&s.exec("select-file",{type:"navigation"})}}else{if(L)break;if(A!=="/"){s.exec("select-file",{type:"navigation"});break}q=k.at(0)?.id}q&&s.exec("select-file",{id:q,toggle:x,range:y});break}case"arrowdown":case"arrowright":{const{_files:k,_selected:T,path:A,_selectNavigation:L}=p;let q;if(T.length){const U=T.at(-1).id,X=k.findIndex(E=>E.id===U);if(X!==-1){const E=X+1;k[E]&&(q=k[E].id)}}else{if(A!=="/"&&!L){s.exec("select-file",{type:"navigation"});break}q=k.at(0)?.id}q&&s.exec("select-file",{id:q,toggle:x,range:y});break}}}function c(d){const h=d.code.replace("Key","").toLowerCase();r(h,d),h=="tab"&&setTimeout(()=>{const p=document.activeElement;p.className.indexOf("table")!=-1&&s.exec("set-active-panel",{panel:+SS(p,"data-panel")})})}return a.addEventListener("keydown",c),{destroy:()=>{a.removeEventListener("keydown",c)}}}function CS(a,l="data-id"){let s=a;for(!s.tagName&&a.target&&(s=a.target);s;){if(s.getAttribute&&s.getAttribute(l))return s;s=s.parentNode}return null}function jS(a,l="data-id"){const s=a.getAttribute(l);return s?NS(s):null}function NS(a){if(a.startsWith(":"))return a.substring(1);const l=a*1;return isNaN(l)?a:l}function AS(){return{detect:()=>!0,addEvent:function(a,l,s){return a.addEventListener(l,s),()=>a.removeEventListener(l,s)},addGlobalEvent:function(a,l){return document.addEventListener(a,l),()=>document.removeEventListener(a,l)},getTopNode:function(){return window.document.body}}}var TS=AS();new Date().valueOf();function Bv(a){const[l,s]=m.useState(a),r=m.useRef(a);return m.useEffect(()=>{if(r.current!==a){if(Array.isArray(r.current)&&Array.isArray(a)&&r.current.length===0&&a.length===0)return;r.current=a,s(a)}},[a]),[l,s]}function kS(a,l,s){const[r,c]=m.useState(()=>l);return a||console.warn(`Writable ${s} is not defined`),m.useEffect(()=>a?a.subscribe(h=>{c(()=>h)}):void 0,[a]),r}function Ue(a,l){const s=a.getState(),r=a.getReactiveState();return kS(r[l],s[l],l)}function ES(a,l){const s=m.useRef(l);s.current=l;const[r,c]=m.useState(1);return m.useEffect(()=>a.subscribe(h=>{s.current=h,c(p=>p+1)}),[a]),[s.current,r]}function Ca(a,l){const s=a.getState(),r=a.getReactiveState();return ES(r[l],s[l])}function Hv(a){const l={};return a.split(";").forEach(s=>{const[r,c]=s.split(":");if(c){let d=r.trim();d.indexOf("-")&&(d=d.replace(/-([a-z])/g,(h,p)=>p.toUpperCase())),l[d]=c.trim()}}),l}function Fv(a){let l=a,s=[];return{subscribe:p=>{s.push(p),p(l)},unsubscribe:p=>{s=s.filter(g=>g!==p)},set:p=>{l=p,s.forEach(g=>g(l))},update:p=>{l=p(l),s.forEach(g=>g(l))}}}function Ax(a,l,s){function r(c){const d=CS(c);if(!d)return;const h=jS(d);if(typeof l=="function")return l(h,c);let p,g=c.target;for(;g!=d;){if(p=g.dataset?g.dataset.action:null,p&&l[p]){l[p](h,c);return}g=g.parentNode}l[s]&&l[s](h,c)}return TS.addEvent(a,s,r)}function DS(a,l){const s=[Ax(a,l,"click")];return l.dblclick&&s.push(Ax(a,l.dblclick,"dblclick")),()=>{s.forEach(r=>r())}}function Iv(a,l){return a.map((s,r)=>{const c=l(s,r);return s.data&&s.data.length&&(c.data=Iv(s.data,l)),c}).filter(Boolean)}function Uv(a,l){const s=[];return a.forEach(r=>{if(r.data){const c=Uv(r.data,l);c.length&&s.push({...r,data:c})}else l(r)&&s.push(r)}),s}function RS(a){return Iv(a,(l,s)=>{const r={...l,id:l.id||Rm()};return r.type&&(r.comp=r.type),r.comp==="separator"&&a[s-1]?.comp==="separator"?null:r})}const $v={};function LS(a){return $v[a]||a}function zS(a,l){$v[a]=l}function _S({onClick:a,onShow:l,option:s}){const r=m.useRef(null),c=m.useCallback(()=>{l(s.data?s.id:!1,r.current)},[l,s]),d=m.useCallback(p=>{if(s.data){p.stopPropagation(),l(s.id,r.current);return}a(p)},[a,l,s]),h=m.useMemo(()=>s&&s.comp?LS(s.comp):null,[s]);return o.jsxs("div",{ref:r,className:`wx-cDCz9rZQ wx-option ${s.css||""} ${s.disabled?"wx-disabled":""}`,"data-id":tn(s.id),onMouseEnter:c,onClick:d,children:[s.icon?o.jsx("i",{className:`wx-cDCz9rZQ wx-icon ${s.icon}`}):null,s.comp?h?o.jsx(h,{item:s,option:s}):null:o.jsxs("span",{className:"wx-cDCz9rZQ wx-value",children:[" ",s.text," "]}),s.subtext?o.jsx("span",{className:"wx-cDCz9rZQ wx-subtext",children:s.subtext}):null,s.data?o.jsx("i",{className:"wx-cDCz9rZQ wx-sub-icon wxi-angle-right"}):null]})}function Um({options:a,left:l=0,top:s=0,at:r="bottom",parent:c=null,mount:d=null,context:h=null,css:p="",onClick:g,onCancel:x}){const[y,v]=m.useState(-1e4),[w,M]=m.useState(-1e4),[C,j]=m.useState(20),[k,T]=m.useState(),A=m.useRef(null),[L,q]=m.useState(!1),[U,X]=m.useState(null),E=m.useCallback(()=>{const re=Cv(A.current,c,r,l,s);re&&(v(re.x),M(re.y),T(re.width));let fe=re?.z??20;const I=c?Mw(c):[];let Z=0;for(const ee of I){const _=parseInt(getComputedStyle(ee).zIndex,10);_>Z&&(Z=_)}Z>=fe&&(fe=Z+1),j(fe)},[c,r,l,s]);m.useEffect(()=>{d&&d(E)},[]);const P=m.useCallback(()=>{q(!1)},[]),te=m.useCallback((re,fe)=>{q(re),X(fe)},[]),B=m.useMemo(()=>RS(a),[a]);m.useEffect(()=>{E()},[c,E]);const ue=m.useRef(g),G=m.useRef(x),de=m.useRef(c);return m.useEffect(()=>{ue.current=g},[g]),m.useEffect(()=>{G.current=x},[x]),m.useEffect(()=>{de.current=c},[c]),m.useEffect(()=>{if(!A.current)return;function re(fe){G.current?G.current(fe):ue.current&&ue.current({action:null,option:null})}return Ja(A.current,{callback:re,modal:!0,parent:()=>de.current}).destroy},[]),o.jsx("div",{ref:A,"data-wx-menu":"true",className:`wx-XMmAGqVx wx-menu ${p}`,style:{position:"absolute",top:w+"px",left:y+"px",width:k,zIndex:C},onMouseLeave:P,children:B.map(re=>o.jsxs(m.Fragment,{children:[re.comp==="separator"?o.jsx("div",{className:"wx-XMmAGqVx wx-separator"}):o.jsx(_S,{option:re,onShow:te,onClick:fe=>{if(!re.data&&!fe.defaultPrevented){const I={context:h,action:re,option:re,event:fe};re.handler&&re.handler(I),g&&g(I),fe.stopPropagation()}}}),re.data&&L===re.id?o.jsx(Um,{css:p,options:re.data,at:"right-overlap",parent:U,context:h,onClick:g,onCancel:x}):null]},re.id))})}const qv=m.forwardRef(function(a,l){const{options:s,at:r="bottom",resolver:c=null,dataKey:d="contextId",filter:h=null,css:p="",children:g,onClick:x}=a,[y,v]=m.useState(null),[w,M]=m.useState(null),[C,j]=m.useState(0),[k,T]=m.useState(0),A=m.useRef(null),L=m.useMemo(()=>`data-${d.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,[d]),q=m.useMemo(()=>y!==null&&h?Uv(s,P=>h(P,y)):s,[y,h,s]);function U(P){M(null),x&&x(P)}function X(P){if(A.current===P){A.current=null;return}M(null),x&&x({action:null,option:null})}const E=m.useCallback((P,te)=>{if(!P){M(null);return}if(P.defaultPrevented)return;const B=P.target;if(B&&B.dataset&&B.dataset.menuIgnore)return;if(w&&w===B){M(null),P.preventDefault();return}j(P.clientX+1),T(P.clientY+1);let ue=typeof te<"u"?te:ko(B,L);c&&(ue=c(ue,P),!ue)||(v(ue),M(B),A.current=P.nativeEvent||P,P.preventDefault())},[w,L,c]);return m.useImperativeHandle(l,()=>({show:E}),[E]),o.jsxs(o.Fragment,{children:[g?o.jsx("span",{onClick:E,"data-menu-ignore":"true",children:typeof g=="function"?g():g}):null,w?o.jsx(zm,{children:o.jsx(Um,{css:p,at:r,top:k,left:C,parent:w,context:y,onClick:U,onCancel:X,options:q},w)}):null]})}),OS=m.forwardRef(function(a,l){const{options:s,at:r="bottom",css:c="",children:d,onClick:h}=a,[p,g]=m.useState(null),x=m.useRef(null);function y(C){g(null),h&&h(C)}function v(C){if(x.current===C){x.current=null;return}g(null),h&&h({action:null,option:null})}const w=m.useCallback(C=>{g(C.target),x.current=C.nativeEvent||C,C.preventDefault()},[]);m.useImperativeHandle(l,()=>({show:w}),[w]);function M(C){let j=C.target;for(;!j.dataset.menuIgnore;)g(j),j=j.parentNode}return o.jsxs(o.Fragment,{children:[o.jsx("span",{onClick:M,"data-menu-ignore":"true",children:d}),p?o.jsx(zm,{children:o.jsx(Um,{css:c,at:r,parent:p,options:s,onClick:y,onCancel:v})}):null]})}),BS=m.forwardRef(function(a,l){const{options:s,at:r="bottom",resolver:c=null,dataKey:d="contextId",filter:h=null,css:p="",children:g,onClick:x}=a,y=m.useRef(null),v=m.useCallback((w,M)=>{y.current.show(w,M)},[]);return m.useImperativeHandle(l,()=>({show:v}),[v]),o.jsxs(o.Fragment,{children:[g?o.jsx("span",{onContextMenu:v,"data-menu-ignore":"true",children:g}):null,o.jsx(qv,{css:p,at:r,options:s,resolver:c,dataKey:d,filter:h,ref:y,onClick:x})]})}),HS={uploader:{B:"B",KB:"KB",MB:"MB",GB:"GB",TB:"TB",PB:"PB",EB:"EB","Drop files here or":"Drop files here or","select files":"select files"}};let FS=class{constructor(l,s,r,c,d){this.setFiles=l,this.setReady=s,this.setSignal=r,this.setDrag=c,d&&d.length&&this.setFiles(d)}open(l){this.setSignal(["click",l||{}])}getState(){let l="server";const s=this.files;for(let r=0;r<s.length;r++){if(s[r].status==="client")return"client";s[r].status==="error"&&(l="error")}return l}droparea(l,s){s=s||{};const r=()=>{s.dragEnter&&s.dragEnter(),this.setDrag(!0)},c=()=>{s.dragLeave&&s.dragLeave(),this.setDrag(!1)},d=p=>{p.preventDefault()},h=p=>{p.preventDefault(),this.setDrag(!1),this.setSignal(["drop",s,p]),s.dragLeave&&s.dragLeave(),s.drop&&s.drop()};return l.addEventListener("dragenter",r),l.addEventListener("dragleave",c),l.addEventListener("dragover",d,!0),l.addEventListener("drop",h,!0),()=>{l.removeEventListener("dragenter",r),l.removeEventListener("dragleave",c),l.removeEventListener("dragover",d,!0),l.removeEventListener("drop",h,!0)}}updateFile(l,s){const r=this.files.findIndex(d=>d.id===l);if(r===-1)return;const c=[...this.files];return c[r]={...c[r],...s},this.files=c,this.setFiles(this.files),this.files[r]}deleteFile(l){this.files=this.files.filter(s=>s.id!==l),this.setFiles(this.files)}addFile(l,s){s?this.files=[...this.files,l]:this.files=[l],this.setFiles(this.files)}deleteAll(){this.files=[],this.setFiles(this.files)}};function Gv(a){const[l,s]=m.useState([]),[r,c]=m.useState(Promise.resolve(null)),[d,h]=m.useState(null),[p,g]=m.useState(!1),x=m.useRef();return x.current||(x.current=new FS(s,c,h,g,a)),x.current.files=l,x.current.ready=r,x.current.signal=d,x.current.drag=p,x.current}function IS(a,l){{if(a){const s=a.getGroup(l);if(s)return s}return Ro(HS).getGroup(l)}}const US=()=>Math.random().toString(36).substr(2,9),$S=({data:a,accept:l="",multiple:s=!0,folder:r=!1,uploadURL:c="",apiOnly:d=!1,disabled:h=!1,children:p,onChange:g,onUpload:x})=>{const y=m.useRef(null),v=m.useRef(null),[w,M]=m.useState({}),C=Gv(),j=a||C,k=m.useContext(an.i18n),T=IS(k,"uploader");m.useEffect(()=>{y.current&&r&&(y.current.webkitdirectory=!0)},[r]),m.useEffect(()=>{if(!d&&v.current&&!h)return j.droparea(v.current)},[d,h,v]);const A=B=>{const ue=new FormData;return ue.append("upload",B.file),fetch(c,{method:"POST",body:ue}).then(G=>G.json()).then(G=>({id:B.id,...G}),()=>({id:B.id,status:"error"})).catch(G=>(console.log(G),{id:B.id,status:"error"}))},L=(B,ue)=>{const G=j.updateFile(B,ue),de={...G,status:j.getState()};G&&G.uploaded&&G.uploaded(de),x&&x(de),G.temp&&j.deleteFile(G.id)},q=B=>{if(!B)return;const ue=typeof c=="function"?c(B):A(B);j.setReady(ue.then(G=>{G.status=G.status||"server",L(B.id,G)}).catch(G=>{L(B.id,{status:"error",error:G})}))},U=(B,ue)=>{const G={...ue||w,id:US(),status:"client",name:B.name,file:B};G.selected&&G.selected(G),g&&g(G),j.addFile(G,s),q(G),y.current&&(y.current.value="")},X=(B,ue,G)=>{B.isFile?B.file(de=>{U(de,G)}):B.isDirectory&&B.createReader().readEntries(de=>{de.forEach(re=>{X(re,ue+re.name+"/",G)})})},E=B=>{Array.from(B.target.files).forEach(ue=>U(ue))},P=(B,ue)=>{Array.from(B.dataTransfer.items).forEach(G=>{const de=G.webkitGetAsEntry();de&&X(de,"",ue)})},te=()=>{y.current&&y.current.click()};return m.useEffect(()=>{if(j.signal){const[B,ue,G]=j.signal;M(ue),B==="click"?te():B==="drop"&&P(G,ue),j.setSignal(null)}},[j.signal]),d?o.jsxs(o.Fragment,{children:[o.jsx("input",{type:"file",className:"wx-at1A8tb8 wx-input",ref:y,onChange:E,accept:l,multiple:s,disabled:h}),p]}):o.jsxs("div",{className:`wx-at1A8tb8 wx-label ${j.drag?"wx-active":""} ${h?"wx-disabled":""}`,ref:v,children:[o.jsx("input",{type:"file",className:"wx-at1A8tb8 wx-input",ref:y,onChange:E,accept:l,multiple:s,disabled:h}),p||o.jsx("div",{className:"wx-at1A8tb8 wx-dropzone",children:o.jsxs("span",{children:[T("Drop files here or")," ",o.jsx("span",{className:"wx-at1A8tb8 wx-action",onClick:te,children:T("select files")})]})})]})};new Date().valueOf();function qS(a,l){if(Object.keys(a).length!==Object.keys(l).length)return!1;for(const s in l){const r=a[s],c=l[s];if(!Bu(r,c))return!1}return!0}function Bu(a,l){if(typeof a=="number"||typeof a=="string"||typeof a=="boolean"||a===null)return a===l;if(typeof a!=typeof l||(a===null||l===null)&&a!==l||a instanceof Date&&l instanceof Date&&a.getTime()!==l.getTime())return!1;if(typeof a=="object")if(Array.isArray(a)&&Array.isArray(l)){if(a.length!==l.length)return!1;for(let s=a.length-1;s>=0;s--)if(!Bu(a[s],l[s]))return!1;return!0}else return qS(a,l);return a===l}function gm(a){if(typeof a!="object"||a===null)return a;if(a instanceof Date)return new Date(a);if(a instanceof Array)return a.map(gm);const l={};for(const s in a)l[s]=gm(a[s]);return l}var Pv=2,GS=class{constructor(a){a&&(this._writable=a.writable,this._async=a.async),this._values={},this._state={}}setState(a,l=0){const s={};return this._wrapProperties(a,this._state,this._values,"",s,l),s}getState(){return this._values}getReactive(){return this._state}_wrapProperties(a,l,s,r,c,d){for(const h in a){const p=l[h],g=s[h],x=a[h];if(p&&(g===x&&typeof x!="object"||x instanceof Date&&g instanceof Date&&g.getTime()===x.getTime()))continue;const y=r+(r?".":"")+h;p?(p.__parse(x,y,c,d)&&(s[h]=x),d&Pv?c[y]=p.__trigger:p.__trigger()):(x&&x.__reactive?l[h]=this._wrapNested(x,x,y,c):l[h]=this._wrapWritable(x),s[h]=x),c[y]=c[y]||null}}_wrapNested(a,l,s,r){const c=this._wrapWritable(a);return this._wrapProperties(a,c,l,s,r,0),c.__parse=(d,h,p,g)=>(this._wrapProperties(d,c,l,h,p,g),!1),c}_wrapWritable(a){const l=[],s=function(){for(let r=0;r<l.length;r++)l[r](a)};return{subscribe:r=>(l.push(r),this._async?setTimeout(r,1,a):r(a),()=>{const c=l.indexOf(r);c>=0&&l.splice(c,1)}),__trigger:()=>{l.length&&(this._async?setTimeout(s,1):s())},__parse:function(r){return a=r,!0}}}},PS=class{constructor(a,l,s,r){typeof a=="function"?this._setter=a:this._setter=a.setState.bind(a),this._routes=l,this._parsers=s,this._prev={},this._triggers=new Map,this._sources=new Map,this._routes.forEach(c=>{c.in.forEach(d=>{const h=this._triggers.get(d)||[];h.push(c),this._triggers.set(d,h)}),c.out.forEach(d=>{const h=this._sources.get(d)||{};c.in.forEach(p=>h[p]=!0),this._sources.set(d,h)})}),this._routes.forEach(c=>{c.length=Math.max(...c.in.map(d=>Yv(d,this._sources,1)))}),this._bus=r}init(a){const l={};for(const s in a)if(this._prev[s]!==a[s]){const r=this._parsers[s];l[s]=r?r(a[s]):a[s]}this._prev=this._prev?{...this._prev,...a}:{...a},this.setState(l),this._bus&&this._bus.exec("init-state",l)}setStateAsync(a){const l=this._setter(a,Pv);return this._async?Object.assign(this._async.signals,l):this._async={signals:l,timer:setTimeout(this._applyState.bind(this),1)},l}_applyState(){const a=this._async;if(a){this._async=null,this._triggerUpdates(a.signals,[]);for(const l in a.signals){const s=a.signals[l];s&&s()}}}setState(a,l=[]){const s=this._setter(a);return this._triggerUpdates(s,l),s}_triggerUpdates(a,l){const s=Object.keys(a),r=!l.length;l=l||[];for(let c=0;c<s.length;c++){const d=s[c],h=this._triggers.get(d);h&&h.forEach(p=>{l.indexOf(p)==-1&&l.push(p)})}r&&this._execNext(l)}_execNext(a){for(;a.length;){a.sort((s,r)=>s.length<r.length?1:-1);const l=a[a.length-1];a.splice(a.length-1),l.exec(a)}}};function Yv(a,l,s){const r=l.get(a);if(!r)return s;const c=Object.keys(r).map(d=>Yv(d,l,s+1));return Math.max(...c)}var YS=class{constructor(){this._nextHandler=null,this._handlers={},this._tag=new WeakMap,this.exec=this.exec.bind(this)}on(a,l,s){let r=this._handlers[a];r?s&&s.intercept?r.unshift(l):r.push(l):r=this._handlers[a]=[l],s&&s.tag&&this._tag.set(l,s.tag)}intercept(a,l,s){this.on(a,l,{...s,intercept:!0})}detach(a){for(const l in this._handlers){const s=this._handlers[l];for(let r=s.length-1;r>=0;r--)this._tag.get(s[r])===a&&s.splice(r,1)}}async exec(a,l){const s=this._handlers[a];if(s)for(let r=0;r<s.length;r++){const c=s[r](l);if(c===!1||c&&c.then&&await c===!1)return}return this._nextHandler&&await this._nextHandler.exec(a,l),l}setNext(a){return this._nextHandler=a}};function VS(a){return l=>l[a]}function QS(a){return(l,s)=>l[a]=s}function bi(a,l){return(l.getter||VS(l.id))(a)}function Gf(a,l,s){return(l.setter||QS(l.id))(a,s)}function KS(a,l){const s=document.createElement("a");s.href=URL.createObjectURL(a),s.download=l,document.body.appendChild(s),s.click(),document.body.removeChild(s)}function yi(a,l){let s=bi(a,l)??"";return l.template?s=l.template(s,a,l):l.optionsMap&&(Array.isArray(s)?s=s.map(r=>l.optionsMap.get(r)).join(", "):s=l.optionsMap.get(s)),typeof s>"u"?"":s+""}function XS(a,l){const s=/\n|"|;|,/;let r="";const c=l.rows||`
11
+ `,d=l.cols||" ",h=a._columns,p=a.flatData;l.header!==!1&&h[0].header&&(r=Tx("header",h,r,d,c));for(let g=0;g<p.length;g++){const x=[];for(let y=0;y<h.length;y++){let v=yi(p[g],h[y]);s.test(v)&&(v='"'+v.replace(/"/g,'""')+'"'),x.push(v)}r+=(r?c:"")+x.join(d)}return l.footer!==!1&&h[0].footer&&(r=Tx("footer",h,r,d,c)),r}function Tx(a,l,s,r,c){const d=/\n|"|;|,/;for(let h=0;h<l[0][a].length;h++){const p=[];for(let g=0;g<l.length;g++){let x=(l[g][a][h].text||"")+"";d.test(x)&&(x='"'+x.replace(/"/g,'""')+'"'),p.push(x)}s+=(s?c:"")+p.join(r)}return s}const ZS="portrait",WS=100,JS="a4",e1={a3:{width:11.7,height:16.5},a4:{width:8.27,height:11.7},letter:{width:8.5,height:11}};function t1(a,l){const s=[];let r=[],c=0;const d=a.filter(p=>!p.hidden),h=n1(l);return d.forEach((p,g)=>{c+p.width<=h?(c+=p.width,r.push(p)):(r.length&&s.push(r),r=[p],c=p.width),g===d.length-1&&r.length&&s.push(r)}),s}function kx(a,l,s){const r=[];return a.forEach((c,d)=>{const h=c[l];for(let p=0;p<s.length;p++){r[p]||(r[p]=[]);const g={...h[p]};if(r[p][d]!==null){if(!d&&!g.rowspan&&!g.colspan){let x=1,y=a[d+x][l][p],v=g.width;for(;!y.rowspan&&!y.colspan;)x++,y=a[d+x][l][p],v+=y.width;g.colspan=x,g.width=v,g.height=s[p]}if(r[p].push(g),!g.collapsed&&g.colspan>1){let x=g.colspan-1;if(g.colspan+d>a.length){const y=g.colspan-(g.colspan+d-a.length);g.colspan=y,g.width=a.slice(d,d+x+1).reduce((v,w)=>v+w.width,0),y>1&&(x=y-1)}for(let y=0;y<x;y++)r[p].push(null)}if(g.rowspan>1){const x=g.rowspan;for(let y=1;y<x;y++)r[p+y]||(r[p+y]=[]),r[p+y].push(null)}}}if(c.collapsed)for(let p=0;p<r.length;p++){const g=r[p],x=g[d];if(x&&x.collapsed){if(g[d]=null,!p)break}else{const y=x||g.findLast(v=>v?.colspan>=1);y&&(y.colspan=y.colspan-1,y.width=y.width-c.width)}}}),r.map(c=>c.filter(d=>d&&d.colspan!==0))}function n1(a){const{mode:l,ppi:s,paper:r}=a,{width:c,height:d}=e1[r];return a1(l==="portrait"?c:d,s)}function a1(a,l){return a*l}function l1(a={}){const{mode:l,ppi:s,paper:r}=a;return{mode:l||ZS,ppi:s||WS,paper:r||JS}}function Vv(a,l){return a.flexgrow?`min-width:${l}px;width:auto`:`width:${a.width}px; max-width:${a.width}px; height:${a.height}px`}function i1(a,l,s){let r=a[s.id];if(s.filter.type==="richselect"&&r){const c=s.filter.config?.options||l.find(({id:d})=>d==s.id).options;c&&(r=c.find(({id:d})=>d==r).label)}return r??""}const Ex=["resize-column","hide-column","update-cell"],s1=["delete-row","update-row","update-cell"],r1=["move-item"],o1=["resize-column","move-item"];class c1{undo=[];redo=[];progress={};in;getState;setState;_previousValues={};constructor(l,s,r){this.in=l,this.getState=s,this.setState=r,this.setHandlers(),this.resetStateHistory()}getHandlers(){return{"add-row":{handler:l=>({action:"delete-row",data:{id:l.id},source:{action:"add-row",data:l}})},"delete-row":{handler:l=>{const{id:s}=l,{data:r}=this.getPrev(),c=r.findIndex(d=>d.id===s);return{action:"add-row",data:{id:s,row:r[c],before:c<r.length-1?r[c+1].id:void 0},source:{action:"delete-row",data:l}}}},"update-cell":{handler:l=>{const{id:s,column:r}=l,c=this.getRow(s),d=this.getColumn(r),h=bi(c,d);return Bu(h,l.value)?null:{action:"update-cell",data:{id:s,column:r,value:h},source:{action:"update-cell",data:l}}}},"update-row":{handler:l=>{const{id:s,row:r}=l,c=this.getRow(s);for(const d in r)Object.keys(c).includes(d)||(c[d]=void 0);return{action:"update-row",data:{id:s,row:c},source:{action:"update-row",data:l}}}},"copy-row":{handler:l=>{const{id:s}=l,{data:r}=this.getState(),c=r.findIndex(h=>h.id===s),d=r[c];return{action:"delete-row",data:{id:s},source:{action:"add-row",data:{id:s,row:d,before:c<r.length-1?r[c+1].id:void 0}}}}},"resize-column":{handler:l=>{const{id:s,width:r}=l,c=this.getColumn(s),{_sizes:d}=this.getState();return{action:"resize-column",data:{id:s,width:c.width??d.columnWidth},source:{action:"resize-column",data:{id:s,width:r}}}}},"hide-column":{handler:l=>{const{id:s}=l,r=this.getColumn(s);return{action:"hide-column",data:{id:s,mode:r.hidden},source:{action:"hide-column",data:l}}}},"collapse-column":{handler:l=>{const{id:s,row:r,mode:c}=l;return{action:"collapse-column",data:{id:s,row:r,mode:typeof c=="boolean"?!c:c},source:{action:"collapse-column",data:l}}}},"move-item":{handler:l=>{const{id:s,target:r,mode:c}=l,{flatData:d}=this.getPrev(),h=d.findIndex(p=>p.id===s);return{action:"move-item",data:{id:s,target:d[h+(h?-1:1)].id,mode:h?"after":"before"},source:{action:"move-item",data:{id:s,target:r,mode:c}}}}},"open-row":{handler:l=>{const{id:s,nested:r}=l;return{action:"close-row",data:{id:s,nested:r},source:{action:"open-row",data:l}}}},"close-row":{handler:l=>{const{id:s,nested:r}=l;return{action:"open-row",data:{id:s,nested:r},source:{action:"close-row",data:l}}}}}}resetHistory(){this.undo=[],this.redo=[],this.progress={},this.resetStateHistory()}getPrev(){return this._previousValues}setHandlers(){const l=this.getHandlers();for(const s in l)this.in.intercept(s,r=>{if(!(r.eventSource==="undo"||r.eventSource==="redo"||r.skipUndo)){if(o1.includes(s)){(r.inProgress&&!this.progress[s]||typeof r.inProgress!="boolean")&&(r1.includes(s)&&this.setPrev("flatData"),Ex.includes(s)&&this.setPrev("columns")),this.progress[s]=r.inProgress;return}s1.includes(s)&&this.setPrev("data"),Ex.includes(s)&&this.setPrev("columns")}}),this.in.on(s,r=>{if(r.eventSource==="undo"||r.eventSource==="redo"||r.skipUndo||r.inProgress)return;const c=l[s].handler(r);c&&this.addToHistory(c)})}setPrev(l){this._previousValues[l]=gm(this.getState()[l])}addToHistory(l){this.undo.push(l),this.redo=[],this.setStateHistory()}handleUndo(){if(!this.undo.length)return;const l=this.undo.pop();this.redo.push({...l.source,source:l}),this.in.exec(l.action,{...l.data,eventSource:"undo"}),this.setStateHistory()}handleRedo(){if(!this.redo.length)return;const l=this.redo.pop();this.undo.push({...l.source,source:l}),this.in.exec(l.action,{...l.data,eventSource:"redo"}),this.setStateHistory()}resetStateHistory(){this.setState({history:{undo:0,redo:0}})}setStateHistory(){this.setState({history:{undo:this.undo.length,redo:this.redo.length}})}getRow(l){const{data:s}=this.getPrev();return this.getState().tree?this.getTreeRow(s,l):s.find(r=>r.id===l)}getTreeRow(l,s){for(let r=0;r<l.length;r++){if(l[r].id===s)return l[r];if(l[r].data){const c=this.getTreeRow(l[r].data,s);if(c)return c}}return null}getColumn(l){const{columns:s}=this.getPrev();return s.find(r=>r.id===l)}}function Qv(a,l){return typeof a>"u"||a===null?-1:typeof l>"u"||l===null?1:a===l?0:a>l?1:-1}function u1(a,l){return-Qv(a,l)}function d1(a,l){if(typeof l.sort=="function")return function(r,c){const d=l.sort(r,c);return a==="asc"?d:-d};const s=a==="asc"?Qv:u1;return function(r,c){return s(bi(r,l),bi(c,l))}}function f1(a,l){if(!a||!a.length)return;const s=a.map(r=>{const c=l.find(d=>d.id==r.key);return d1(r.order,c)});return a.length===1?s[0]:function(r,c){for(let d=0;d<s.length;d++){const h=s[d](r,c);if(h!==0)return h}return 0}}const su=28,m1=20;function h1(){if(typeof document>"u")return"willow";const a=document.querySelector('[class^="wx"][class$="theme"]');return a?a.className.substring(3,a.className.length-6):"willow"}function ku(a,l,s,r,c){const d=document.createElement("div"),h=document.createElement("div"),p=document.body;c=c?`${c}px`:"auto";let g,x;h.className=l,d.classList.add(`wx-${s}-theme`),d.style.cssText=`height:auto;position:absolute;top:0px;left:100px;overflow:hidden;width=${c};white-space:nowrap;`,d.appendChild(h),p.appendChild(d),typeof a!="object"&&(a=[a]);for(let y=0;y<a.length;y++){h.innerText=a[y]+"";const v=d.getBoundingClientRect(),w=Math.ceil(v.width)+(r&&r.length?r[y]:0),M=Math.ceil(v.height);g=Math.max(g||0,w),x=Math.max(x||0,M)}return d.remove(),{width:g,height:x}}function Dx(a,l,s,r,c){const d=[];for(let h=0;h<a.length;h++){const p=a[h][l],g=p.length;for(let x=0;x<g;x++){const{text:y,vertical:v,collapsed:w,rowspan:M,css:C}=p[x];if(!y){d[x]=Math.max(d[x]||0,r);continue}let j=0;if(v&&!w){let k=`wx-measure-cell-${l}`;if(k+=C?` ${C}`:"",j=ku(y,k,c).width,(M>1||!p[x+1])&&s>x+1){const T=M||s-x,A=d.slice(x,x+T).reduce((L,q)=>L+q,0);if(A<j){const L=Math.ceil((j-A)/T);for(let q=x;q<x+T;q++)d[q]=(d[q]||r)+L}continue}}d[x]=Math.max(d[x]||r,j)}}return d}function p1(a,l,s){const r=[],c=[];let d="wx-measure-cell-body";d+=a.css?` ${a.css}`:"";for(let h=0;h<l.length;h++){const p=l[h],g=yi(p,a);g&&(r.push(g),a.treetoggle?c.push(l[h].$level*su+(l[h].$count?su:0)+(a.draggable?su:0)):a.draggable&&c.push(su))}return ku(r,d,s,c).width}function g1(a,l){const s="wx-measure-cell-header",r=a.sort?m1:0;let c=a.header;if(typeof c=="string")return ku(c,s,l).width+r;let d;Array.isArray(c)||(c=[c]);for(let h=0;h<c.length;h++){const p=c[h],g=typeof p=="string"?p:p.text,x=s+(typeof p=="string"?"":` ${p.css}`);let y=ku(g,x,l).width;h===c.length-1&&(y+=r),d=Math.max(d||0,y)}return d}const x1={text:(a,l)=>a?a.toString().toLowerCase().indexOf(l.toLowerCase())!==-1:!l,richselect:(a,l)=>typeof l!="number"&&!l?!0:a==l,datepicker:(a,l)=>l?a&&y1(a,l):!0,multiselect:(a,l)=>!l||l?.length===0?!0:Array.isArray(a)?a?.some(s=>l.includes(s)):a&&l.includes(a)};function Kv(a){return x1[a]}function v1(a,l){const s=[];for(const r in a){const c=l.find(g=>g.id==r),{config:d,type:h}=c.header.find(g=>g.filter).filter,p=a[r];s.push(g=>{const x=bi(g,c);return d?.handler?d.handler(x,p):Kv(h)(x,p)})}return r=>{for(let c=0;c<s.length;c++)if(!s[c](r))return!1;return!0}}function y1(a,l){return a.getFullYear()===l.getFullYear()&&a.getMonth()===l.getMonth()&&a.getDate()===l.getDate()}let b1=class extends GS{in;_router;_branches;_xlsxWorker;_historyManager;constructor(l){super({writable:l,async:!1});const s={rowHeight:37,columnWidth:160,headerHeight:36,footerHeight:36};this._router=new PS(super.setState.bind(this),[{in:["columns","sizes","_skin"],out:["_columns","_sizes"],exec:c=>{const{columns:d,sizes:h,_skin:p}=this.getState(),g=this.copyColumns(d),x=g.reduce((w,M)=>Math.max(M.header.length,w),0),y=g.reduce((w,M)=>Math.max(M.footer.length,w),0);g.forEach(this.setCollapsibleColumns);const v=this.normalizeSizes(g,h,x,y,p);for(let w=0;w<g.length;w++)this.normalizeColumns(g,w,"header",x,v),this.normalizeColumns(g,w,"footer",y,v);this.setState({_columns:g,_sizes:v},c)}},{in:["data","tree","_filterIds"],out:["flatData","_rowHeightFromData"],exec:c=>{const{data:d,tree:h,dynamic:p,_filterIds:g}=this.getState(),x=g&&new Set(g),y=h?this.flattenRows(d,[],g):x?d.filter(w=>x.has(w.id)):d,v=!p&&y.some(w=>w.rowHeight);this.setState({flatData:y,_rowHeightFromData:v},c)}}],{sizes:c=>({...s,...c})});const r=this.in=new YS;r.on("close-editor",({ignore:c})=>{const{editor:d}=this.getState();d&&(c||r.exec("update-cell",d),this.setState({editor:null}))}),r.on("open-editor",({id:c,column:d})=>{let h=this.getState().editor;h&&r.exec("close-editor",{});const p=this.getRow(c),g=d?this.getColumn(d):this.getNextEditor(p);if(g?.editor){let x=g.editor;if(typeof x=="function"&&(x=x(p,g)),!x)return;h={column:g.id,id:c,value:bi(p,g)??"",renderedValue:yi(p,g),type:x.type||x},typeof x=="object"&&x.config&&(h.config=x.config,x.config.options&&(h.options=x.config.options)),g.options&&!h.options&&(h.options=g.options),this.setState({editor:h})}}),r.on("editor",({value:c})=>{let d=this.getState().editor;if(d){d={...d},d.value=c;const h=this.getColumn(d.column),p={...this.getRow(d.id)};Gf(p,h,c),d.renderedValue=yi(p,h),this.setState({editor:d})}}),r.on("add-row",c=>{const d=this.getState();let{data:h}=d;const{select:p,_filterIds:g}=d,{row:x,before:y,after:v,select:w}=c;if(c.id=x.id=c.id||x.id||ru(),y||v){const C=y||v,j=h.findIndex(k=>k.id===C);h=[...h],h.splice(j+(v?1:0),0,c.row)}else h=[...h,c.row];const M={data:h};g&&(M._filterIds=[...g,c.id]),this.setState(M),!(typeof w=="boolean"&&!w)&&(w||p)&&r.exec("select-row",{id:x.id,show:!0})}),r.on("delete-row",c=>{const{data:d,selectedRows:h,focusCell:p,editor:g}=this.getState(),{id:x}=c,y={data:d.filter(v=>v.id!==x)};this.isSelected(x)&&(y.selectedRows=h.filter(v=>v!==x)),g?.id===x&&(y.editor=null),this.setState(y),p?.row===x&&this.in.exec("focus-cell",{eventSource:"delete-row"})}),r.on("update-cell",c=>{const d=this.getState();let{data:h}=d;h=[...h];const{tree:p}=d,{id:g,column:x,value:y}=c,v=this.getColumn(x);if(p){const w={...this._branches[g]};Gf(w,v,y);const M=this.updateTreeRow(w);w.$parent===0&&(h=M)}else{const w=h.findIndex(C=>C.id===g),M={...h[w]};Gf(M,v,y),h[w]=M}this.setState({data:h})}),r.on("update-row",c=>{let{data:d}=this.getState();const{id:h,row:p}=c,g=d.findIndex(x=>x.id===h);d=[...d],d[g]={...d[g],...p},this.setState({data:d})}),r.on("select-row",({id:c,toggle:d,range:h,mode:p,show:g,column:x})=>{const y=this.getState(),{focusCell:v}=y;let{selectedRows:w}=y;if(w.length||(h=d=!1),h){const{data:M}=this.getState();let C=M.findIndex(k=>k.id===w[w.length-1]),j=M.findIndex(k=>k.id===c);C>j&&([C,j]=[j,C]),M.slice(C,j+1).forEach(k=>{this.isSelected(k.id)||w.push(k.id)})}else if(d&&this.isSelected(c)){if(p===!0)return;w=w.filter(M=>M!==c)}else if(d){if(p===!1)return;w.push(c)}else w=[c];this.setState({selectedRows:[...w]}),v?.row!==c&&this.in.exec("focus-cell",{eventSource:"select-row"}),g&&this.in.exec("scroll",{row:c,column:x})}),this.in.on("focus-cell",c=>{const{row:d,column:h,eventSource:p}=c,{_columns:g,split:x}=this.getState();d&&h?(this.setState({focusCell:{row:d,column:h}}),p!=="click"&&((!x.left||g.findIndex(y=>y.id===c.column)>=x.left)&&(!x.right||g.findIndex(y=>y.id===c.column)<g.length-x.right)?this.in.exec("scroll",{row:d,column:h}):this.in.exec("scroll",{row:d}))):this.setState({focusCell:null})}),r.on("resize-column",c=>{const{id:d,auto:h,maxRows:p,inProgress:g}=c;if(g===!1)return;let x=c.width||0;const y=[...this.getState().columns],v=this.getColumn(d);if(h){if(h==="data"||h===!0){const{flatData:w,_skin:M}=this.getState();let C=w.length;p&&(C=Math.min(p,C));const j=w.slice(0,C);x=p1(v,j,M)}if(h==="header"||h===!0){const{_skin:w}=this.getState();x=Math.max(g1(v,w),x)}}v.width=Math.max(17,x),delete v.flexgrow,this.setState({columns:y})}),r.on("hide-column",c=>{const{id:d,mode:h}=c,p=[...this.getState().columns],g=this.getColumn(d),x=p.reduce((y,v)=>y+(v.hidden?0:1),0);!h||x>1?(g.hidden=!g.hidden,this.setState({columns:p})):c.skipUndo=!0}),r.on("sort-rows",c=>{const{key:d,add:h,sort:p}=c,g=this.getState(),{columns:x,data:y,tree:v}=g;if(p){const A=[...y];A.sort(p),this.setState({data:A});return}const{order:w="asc"}=c;let M=g.sortMarks;const C=Object.keys(M),j=C.length;!h||!j||j===1&&M[d]?M={[d]:{order:w}}:(j===1&&(M[C[0]]={...M[C[0]],index:0}),M={...M,[d]:{order:w,index:typeof h=="number"?h:M[d]?.index??j}});const k=Object.keys(M).sort((A,L)=>M[A].index-M[L].index).map(A=>({key:A,order:M[A].order}));this.setState({sortMarks:M});const T=f1(k,x);if(T){const A=[...y];v?this.sortTree(A,T):A.sort(T),this.setState({data:A})}}),r.on("filter-rows",c=>{const{value:d,key:h,filter:p}=c;if(!Object.keys(c).length){this.setState({filterValues:{},_filterIds:null});return}const g=this.getState(),{data:x,tree:y,_columns:v}=g;let w=g.filterValues;const M={};h&&(w={...w,[h]:d},M.filterValues=w);const C=p??v1(w,v);let j=[];y?j=this.filterTree(x,C,j):x.forEach(k=>{C(k)&&j.push(k.id)}),M._filterIds=j,this.setState(M)}),r.on("collapse-column",c=>{const{id:d,row:h,mode:p}=c,g=[...this.getState().columns],x=this.getColumn(d).header,y=Array.isArray(x)?x[h]:x;typeof y=="object"&&(y.collapsed=p??!y.collapsed,this.setState({columns:g}))}),r.on("move-item",c=>{const{id:d,inProgress:h}=c;let{target:p,mode:g="after"}=c;const{data:x,flatData:y,tree:v}=this.getState(),w=y.findIndex(j=>j.id===d);let M;if(g==="up"||g==="down"){if(g==="up"){if(w===0)return;M=w-1,g="before"}else if(g==="down"){if(w===y.length-1)return;M=w+1,g="after"}p=y[M]&&y[M].id}else M=y.findIndex(j=>j.id===p);if(w===-1||M===-1||h===!1)return;let C;v||(C=this.moveItem(d,p,x,g)),this.setState({data:v?this.normalizeTreeRows(C):C})}),r.on("copy-row",c=>{const{id:d,target:h,mode:p="after"}=c,g=this.getState(),{flatData:x,_filterIds:y}=g;let{data:v}=g;const w=this.getRow(d);if(!w)return;const M={...w,id:ru()};c.id=M.id;const C=x.findIndex(k=>k.id===h);if(C===-1)return;v.splice(C+(p==="after"?1:0),0,M),v=[...v];const j={data:v};y&&(j._filterIds=[...y,M.id]),this.setState(j)}),r.on("open-row",c=>{const{id:d,nested:h}=c;this.toggleBranch(d,!0,h)}),r.on("close-row",c=>{const{id:d,nested:h}=c;this.toggleBranch(d,!1,h)}),r.on("export-data",c=>new Promise((d,h)=>{const p=c.format||"csv",g=`${c.fileName||"data"}.${p}`;if(p==="csv"){const x=XS(this.getState(),c.csv||{});c.download!==!1?KS(new Blob(["\uFEFF"+x],{type:"text/csv"}),g):c.result=x,d(!0)}else h()})),r.on("hotkey",({key:c,event:d,isInput:h})=>{switch(c){case"arrowup":{const{flatData:p,focusCell:g,select:x}=this.getState();if(d.preventDefault(),h)return;const y=g?g.column:this._getFirstVisibleColumn()?.id,v=g?this.getPrevRow(g.row)?.id:p[p.length-1]?.id;y&&v&&(this.in.exec("focus-cell",{row:v,column:y,eventSource:"key"}),x&&this.in.exec("select-row",{id:v}));break}case"arrowdown":{const{flatData:p,focusCell:g,select:x}=this.getState();if(d.preventDefault(),h)return;const y=g?g.column:this._getFirstVisibleColumn()?.id,v=g?this.getNextRow(g.row)?.id:p[0]?.id;y&&v&&(this.in.exec("focus-cell",{row:v,column:y,eventSource:"key"}),x&&this.in.exec("select-row",{id:v}));break}case"arrowright":{const{focusCell:p}=this.getState();if(h)return;if(d.preventDefault(),p){const g=this.getNextColumn(p.column,!0)?.id;g&&this.in.exec("focus-cell",{row:p.row,column:g,eventSource:"key"})}break}case"arrowleft":{const{focusCell:p}=this.getState();if(h)return;if(d.preventDefault(),p){const g=this.getPrevColumn(p.column,!0)?.id;g&&this.in.exec("focus-cell",{row:p.row,column:g,eventSource:"key"})}break}case"tab":{const{editor:p,focusCell:g,select:x}=this.getState();if(p){d.preventDefault();const y=p.column;let v=p.id,w=this.getNextEditor(this.getRow(v),this.getColumn(y));if(!w){const M=this.getNextRow(v);M&&(v=M.id,w=this.getNextEditor(M))}w&&(this.in.exec("open-editor",{id:v,column:w.id}),this.in.exec("focus-cell",{row:v,column:w.id,eventSource:"key"}),x&&!this.isSelected(v)&&this.in.exec("select-row",{id:v}))}else g&&this.in.exec("focus-cell",{eventSource:"key"});break}case"shift+tab":{const{editor:p,focusCell:g,select:x}=this.getState();if(p){d.preventDefault();const y=p.column;let v=p.id,w=this.getPrevEditor(this.getRow(v),this.getColumn(y));if(!w){const M=this.getPrevRow(v);M&&(v=M.id,w=this.getPrevEditor(M))}w&&(this.in.exec("open-editor",{id:v,column:w.id}),this.in.exec("focus-cell",{row:v,column:w.id,eventSource:"key"}),x&&!this.isSelected(v)&&this.in.exec("select-row",{id:v}))}else g&&this.in.exec("focus-cell",{eventSource:"key"});break}case"escape":{const{editor:p}=this.getState();p&&(this.in.exec("close-editor",{ignore:p.type!="multiselect"}),this.in.exec("focus-cell",{row:p.id,column:p.column,eventSource:"key"}));break}case"f2":{const{editor:p,focusCell:g}=this.getState();!p&&g&&this.in.exec("open-editor",{id:g.row,column:g.column});break}case"enter":{const{focusCell:p,tree:g}=this.getState();if(!h&&g&&p&&this.getColumn(p.column).treetoggle){const x=this.getRow(p.row);if(!x.data)return;this.in.exec(x.open?"close-row":"open-row",{id:p.row,nested:!0})}break}case"home":{const{editor:p,focusCell:g}=this.getState();if(!p&&g){d.preventDefault();const x=this._getFirstVisibleColumn()?.id;this.in.exec("focus-cell",{row:g.row,column:x,eventSource:"key"})}break}case"ctrl+home":{const{editor:p,focusCell:g,flatData:x,select:y}=this.getState();if(!p&&g){d.preventDefault();const v=x[0]?.id,w=this._getFirstVisibleColumn()?.id;v&&w&&(this.in.exec("focus-cell",{row:v,column:w,eventSource:"key"}),y&&!this.isSelected(v)&&this.in.exec("select-row",{id:v}))}break}case"end":{const{editor:p,focusCell:g}=this.getState();if(!p&&g){d.preventDefault();const x=this._getLastVisibleColumn()?.id,y=g.row;this.in.exec("focus-cell",{row:y,column:x,eventSource:"key"})}break}case"ctrl+end":{const{editor:p,focusCell:g,flatData:x,select:y}=this.getState();if(!p&&g){d.preventDefault();const v=x.at(-1).id,w=this._getLastVisibleColumn()?.id;v&&w&&(this.in.exec("focus-cell",{row:v,column:w,eventSource:"key"}),y&&!this.isSelected(v)&&this.in.exec("select-row",{id:v}))}break}case"ctrl+z":{this.in.exec("undo",{});break}case"ctrl+y":{this.in.exec("redo",{});break}}}),r.on("scroll",c=>{const{_columns:d,split:h,_sizes:p,flatData:g,dynamic:x,_rowHeightFromData:y}=this.getState();let v=-1,w=-1,M=0,C=0;if(c.column){v=0;const j=d.findIndex(k=>k.id===c.column);M=d[j].width;for(let k=h.left??0;k<j;k++){const T=d[k];T.hidden||(v+=T.width)}}if(c.row&&!x){const j=g.findIndex(k=>k.id===c.row);j>=0&&(y?(w=g.slice(0,j).reduce((k,T)=>k+(T.rowHeight||p.rowHeight),0),C=g[j].rowHeight):w=p.rowHeight*j)}this.setState({scroll:{top:w,left:v,width:M,height:C||p.rowHeight}})}),r.on("scroll-to",c=>{const d={};c.top!==void 0&&(d.scrollTop=c.top),c.left!==void 0&&(d.scrollLeft=c.left),Object.keys(d).length&&this.setState(d)}),r.on("print",c=>{const d=l1(c);this.setState({_print:d}),this.setStateAsync({_print:null})}),r.on("undo",()=>{this._historyManager?.handleUndo()}),r.on("redo",()=>{this._historyManager?.handleRedo()}),this.initOnce()}getXlsxWorker(l){if(!this._xlsxWorker){const s=window.URL.createObjectURL(new Blob([`importScripts('${l}');`],{type:"text/javascript"}));this._xlsxWorker=new Promise(r=>{const c=new Worker(s);c.addEventListener("message",d=>{d.data.type==="init"&&r(c)})})}return this._xlsxWorker}initOnce(){const l={sortMarks:{},_filterIds:null,data:[],filterValues:{},scroll:null,scrollLeft:0,scrollTop:0,editor:null,focusCell:null,_print:null,history:{undo:0,redo:0},search:null};this._router.init(l)}init(l){l.hasOwnProperty("_skin")&&!l._skin&&(l._skin=h1()),l.columns&&l.columns.forEach(s=>{s.options&&(s.optionsMap=new Map(s.options.map(r=>[r.id,r.label])))}),Bu(this.getState().data,l.data)||(l.tree?l.data=this.normalizeTreeRows(l.data):l.data=this.normalizeRows(l.data),this.setState({_filterIds:null,filterValues:{},sortMarks:{},search:null}),this._historyManager&&this._historyManager.resetHistory()),l.tree&&(l.undo=!1,l.reorder=!1),l.split?.right&&(l.split.right=0),l.undo&&!this._historyManager&&(this._historyManager=new c1(this.in,this.getState.bind(this),this.setState.bind(this))),this._router.init({...l})}setState(l,s){return this._router.setState(l,s)}setStateAsync(l){this._router.setStateAsync(l)}getRow(l){const{tree:s}=this.getState();return s?this._branches[l]:this.getState().data.find(r=>r.id===l)}getRowIndex(l,s){return s||(s=this.getState().flatData),s.findIndex(r=>r.id===l)}getNextRow(l){const s=this.getState().flatData,r=this.getRowIndex(l,s);return s[r+1]}getPrevRow(l){const s=this.getState().flatData,r=this.getRowIndex(l,s);return s[r-1]}getColumn(l){return this.getState().columns.find(s=>s.id===l)}getNextColumn(l,s){const r=this.getState()._columns,c=r.findIndex(d=>d.id===l);return s?this._getFirstVisibleColumn(c+1):r[c+1]}getPrevColumn(l,s){const r=this.getState()._columns,c=r.findIndex(d=>d.id===l);return s?this._getLastVisibleColumn(c-1):r[c-1]}_getFirstVisibleColumn(l){const s=this.getState()._columns;let r=l??0;for(;r<s.length&&(s[r]?.hidden||s[r]?.collapsed);)r++;return s[r]}_getLastVisibleColumn(l){const s=this.getState()._columns;let r=l??s.length-1;for(;r<s.length&&(s[r]?.hidden||s[r]?.collapsed);)r--;return s[r]}isCellEditable(l,s){const{editor:r,hidden:c}=s;return!r||c?!1:typeof r=="function"?r(l,s):!0}getNextEditor(l,s){let r=this.getState().columns;if(s){const c=r.findIndex(d=>d.id===s.id);r=r.slice(c+1)}return r.find(c=>this.isCellEditable(l,c))}getPrevEditor(l,s){let r=this.getState().columns;if(s){const c=r.findLastIndex(d=>d.id===s.id);r=r.slice(0,c)}return r.findLast(c=>this.isCellEditable(l,c))}toggleBranch(l,s,r){let c=this._branches[l],{data:d}=this.getState();if(d=[...d],l!==0){c={...c,open:s};const h=this.updateTreeRow(c);c.$parent===0&&(d=h)}r&&c.data?.length&&c.data.forEach(h=>{const p=this.toggleKids(h,s,r);l===0&&(d=p)}),this.setState({data:d})}toggleKids(l,s,r){l={...l,open:s};const c=this.updateTreeRow(l);return r&&l.data?.length&&l.data.forEach(d=>{this.toggleKids(d,s,r)}),c}updateTreeRow(l){const s=l.id;this._branches[s]=l;const r=this._branches[l.$parent],c=r.data.findIndex(d=>d.id===s);return r.data=[...r.data],r.data[c]=l,r.data}isSelected(l){return this.getState().selectedRows.indexOf(l)!==-1}findAndRemove(l,s){for(let r=0;r<l.length;r++){if(l[r].id===s)return l.splice(r,1)[0];if(l[r].data){const c=[...l[r].data],d=this.findAndRemove(c,s);if(d)return l[r]={...l[r],data:c},d}}return null}insertItem(l,s,r,c){for(let d=0;d<l.length;d++){if(l[d].id===s){const h=l[d],p=c==="before"?d:d+1;if(h.data){if(c==="before"){const g=d>0?l[d-1]:null;return g?.data&&g.open?l[d-1]={...g,data:[...g.data,r]}:l.splice(p,0,r),!0}else if(h.open)return l[d]={...h,data:[r,...h.data]},!0}return l.splice(p,0,r),!0}if(l[d].data&&(l[d]={...l[d],data:[...l[d].data]},this.insertItem(l[d].data,s,r,c)))return!0}return!1}moveItem(l,s,r,c){const d=[...r],h=this.findAndRemove(d,l);return this.insertItem(d,s,h,c),d}copyColumns(l){const s=[];for(let r=0;r<l.length;r++){const c={...l[r]};this.copyHeaderFooter(c,"header"),this.copyHeaderFooter(c,"footer"),s[r]=c}return s}copyHeaderFooter(l,s){let r=l[s];r=Array.isArray(r)?[...r]:[r],r.forEach((c,d)=>{r[d]=typeof c=="string"?{text:c}:{...c}}),l[s]=r}setCollapsibleColumns(l,s,r){let c=l.header;for(let d=0;d<c.length;d++){const h=c[d];if(h.collapsible&&h.collapsed){if(h.collapsible!=="first"){l.collapsed=!0,l.width=36,h.vertical=!0;const g=c.length-d;c=c.slice(0,d+1),c[d].rowspan=g}const p=h.colspan;if(p){const g=c[d+1];let x=1;g&&g.colspan&&!g.collapsed&&(x=g.colspan);for(let y=x;y<p;y++){const v=r[s+y];v&&(v.hidden=!0)}}}}}normalizeColumns(l,s,r,c,d){const h=l[s];h.width||(h.width=h.flexgrow?17:d.columnWidth),h._colindex=s+1;const p=h[r],g=d[`${r}RowHeights`];for(let x=0;x<c;x++){const y=p[x];y.id=h.id,x===p.length-1&&(y.rowspan=y.rowspan?Math.min(y.rowspan,c-x):c-x);for(let v=1;v<y.rowspan;v++){p.splice(x+v,0,{_hidden:!0});for(let w=1;w<y.colspan;w++)l[s+w][r].splice(x+v,0,{})}if(y.rowspan){const v=(y.rowspan===c?g:g.slice(x,y.rowspan+x)).reduce((w,M)=>w+M,0);y.height=v,x+y.rowspan!=c&&y.height--}if(y.colspan){let v=h.width,w=h.flexgrow||0;const M=y.colspan;for(let C=1;C<M;C++){const j=l[s+C];j&&(j.hidden?y.colspan-=1:j.flexgrow?w+=j.flexgrow:v+=j.width||d.columnWidth),w?y.flexgrow=w:y.width=v}}else y.width=h.width,y.flexgrow=h.flexgrow;r==="header"&&y.filter&&typeof y.filter=="string"&&(y.filter={type:y.filter})}p.length>c&&(p.length=c),h[r]=p}normalizeRows(l){for(let s=0;s<l.length;s++)l[s].id||(l[s].id=ru());return l}normalizeTreeRows(l,s,r){return!s&&!r&&(this._branches={0:{data:l}}),l.forEach(c=>{c.id||(c.id=ru()),c.$level=s||0,c.$parent=r||0,this._branches[c.id]=c,c.data&&(c.data.length?(c.$count=c.data.length,this.normalizeTreeRows(c.data,c.$level+1,c.id)):(delete c.data,delete c.$count,delete c.open))}),l}sortTree(l,s){l.sort(s),l.forEach(r=>{r.data&&this.sortTree(r.data,s)})}filterTree(l,s,r){return l.forEach(c=>{s(c)&&r.push(c.id),c.data&&this.filterTree(c.data,s,r)}),r}flattenRows(l,s,r){const c=s;return l.forEach(d=>{(!r||r.includes(d.id))&&c.push(d),d.data?.length&&d.open!==!1&&this.flattenRows(d.data,c,r)}),c}createFilter(l){const{_columns:s}=this.getState(),r=[];for(const c in l){const d=s.find(x=>x.id==c),{config:h,type:p}=d.header.find(x=>x.filter).filter,g=l[c];r.push(x=>{const y=bi(x,d);return h?.handler?h.handler(y,g):Kv(p)(y,g)})}return c=>{for(let d=0;d<r.length;d++)if(!r[d](c))return!1;return!0}}searchRows(l,s){l=l.trim().toLowerCase();const r={};if(!l)return r;const{flatData:c,columns:d}=this.getState(),h=s?d.filter(p=>s[p.id]):d;return c.forEach(p=>{const g={};h.forEach(x=>{const y=yi(p,x);String(y).toLowerCase().includes(l)&&(g[x.id]=!0)}),Object.keys(g).length&&(r[p.id]=g)}),r}normalizeSizes(l,s,r,c,d){const h=Dx(l,"header",r,s.headerHeight,d),p=Dx(l,"footer",c,s.footerHeight,d),g=h.reduce((y,v)=>y+v,0),x=p.reduce((y,v)=>y+v,0);return{...s,headerRowHeights:h,footerRowHeights:p,headerHeight:g,footerHeight:x}}},w1=new Date().valueOf();function ru(){return"temp://"+w1++}function S1(a,l="data-id"){let s=a;for(!s.tagName&&a.target&&(s=a.target);s;){if(s.getAttribute&&s.getAttribute(l))return s;s=s.parentNode}return null}new Date().valueOf();var M1=class{constructor(){this.store=new Map}configure(a,l){this.node=l;for(const s in a)if(a[s]){const r=s.toLowerCase().replace(/[ ]/g,""),c=a[s];this.store.set(r,c)}}},tr=[],C1={subscribe:a=>{j1();const l=new M1;return tr.push(l),a(l),()=>{const s=tr.findIndex(r=>r===l);s>=0&&tr.splice(s,1)}}},Rx=!1;function j1(){Rx||(Rx=!0,document.addEventListener("keydown",a=>{if(tr.length&&(a.ctrlKey||a.altKey||a.metaKey||a.shiftKey||a.key.length>1||a.key===" ")){const l=[];a.ctrlKey&&l.push("ctrl"),a.altKey&&l.push("alt"),a.metaKey&&l.push("meta"),a.shiftKey&&l.push("shift");let s=a.code.replace("Key","").toLocaleLowerCase();a.key===" "&&(s="space"),l.push(s);const r=l.join("+");for(let c=tr.length-1;c>=0;c--){const d=tr[c],h=d.store.get(r)||d.store.get(s);h&&d.node.contains(a.target)&&h(a,{key:r,evKey:s})}}}))}const N1={tab:!0,"shift+tab":!0,arrowup:!0,arrowdown:!0,arrowright:!0,arrowleft:!0,enter:!0,escape:!0,f2:!0,home:!0,end:!0,"ctrl+home":!0,"ctrl+end":!0,"ctrl+z":!0,"ctrl+y":!0};function A1(a,{keys:l,exec:s}){if(!l)return;function r(h){const p=h.target;return p.tagName==="INPUT"||p.tagName==="TEXTAREA"||S1(p,"data-header-id")?.classList.contains("wx-filter")||!!p.closest(".wx-cell.wx-editor")}const c={};for(const h in l){const p=l[h];typeof p<"u"&&(typeof p=="function"?c[h]=p:p&&(c[h]=g=>{const x=r(g);s({key:h,event:g,isInput:x})}))}const d=C1.subscribe(h=>{h.configure(c,a)});return{destroy:()=>{d()}}}function T1(a,l){let s=null;l.scroll.subscribe(r=>{if(!r||r===s)return;s=r;const{left:c,top:d,height:h,width:p}=r,g=l.getHeight(),x=l.getWidth(),y=l.getScrollMargin();if(d>=0){const v=a.scrollTop;d<v?a.scrollTop=d:d+h>v+g&&(a.scrollTop=d-g+h)}if(c>=0){const v=a.scrollLeft;c<v?a.scrollLeft=c:c+p>v+x-y&&(a.scrollLeft=c-x+p+y)}}),l.scrollLeft?.subscribe?.(r=>{requestAnimationFrame(()=>{Math.abs(a.scrollLeft-r)>1&&(a.scrollLeft=r)})}),l.scrollTop?.subscribe?.(r=>{requestAnimationFrame(()=>{Math.abs(a.scrollTop-r)>1&&(a.scrollTop=r)})})}const ia=m.createContext(null);function k1(a,l){const s=new ResizeObserver(r=>{requestAnimationFrame(()=>l(r[0].contentRect))});return s.observe(a.parentNode),{destroy(){s.disconnect()}}}const Lx=5,E1=700;function pu(a){const l=a.getBoundingClientRect(),s=document.body,r=l.top+s.scrollTop-s.clientTop||0,c=l.left+s.scrollLeft-s.clientLeft||0;return{y:Math.round(r),x:Math.round(c),width:a.offsetWidth,height:a.offsetHeight}}function xm(a,l){const s=pu(l);return{x:a.clientX-s.x,y:a.clientY-s.y}}function D1(a,l){const s=l.current;let r=null,c,d,h=!1,p=!1;const g=document.createElement("DIV");g.className="wx-drag-zone",g.setAttribute("tabindex",-1);function x(){clearTimeout(c),c=null}function y(E){const P=ar(E);P&&(r={container:g,sourceNode:E.target,from:zu(P),pos:xm(E,a)},d=r.pos,v(E))}function v(E){if(!r)return;const P=r.pos=xm(E,a);if(!h){if(!p&&!E?.target?.getAttribute("draggable-data")&&Math.abs(d.x-P.x)<Lx&&Math.abs(d.y-P.y)<Lx)return;if(U(E)===!1)return X()}if(p){const te=window.scrollX||document.documentElement.scrollLeft||document.body.scrollLeft,B=window.scrollY||document.documentElement.scrollTop||document.body.scrollTop;r.targetNode=document.elementFromPoint(E.pageX-te,E.pageY-B)}else r.targetNode=E.target;s.move&&s.move(E,r),g.style.left=-(r.offset?r.offset.x:0)+"px",g.style.top=r.pos.y+(r.offset?r.offset.y:0)+"px"}function w(E){g.parentNode&&g.parentNode.removeChild(g),g.innerHTML="",h&&s.end&&s.end(E,r),r=d=null,X()}function M(E){s.getReorder&&!s.getReorder()||E.button===0&&(q(E),window.addEventListener("mousemove",C),window.addEventListener("mouseup",j),y(E))}function C(E){v(E)}function j(E){w(E)}function k(E){if(s.getReorder&&!s.getReorder())return;c=setTimeout(()=>{p=!0,y(E.touches[0])},E1),q(E);function P(){c&&x(),E.target.removeEventListener("touchmove",T),E.target.removeEventListener("touchend",P),w(E)}E.target.addEventListener("touchmove",T),E.target.addEventListener("touchend",P),a.addEventListener("contextmenu",A)}function T(E){h?(E.preventDefault(),v(E.touches[0])):c&&x()}function A(E){if(h||c)return E.preventDefault(),!1}function L(E){E.preventDefault()}function q(E){if(!s.getDraggableInfo)return;const{hasDraggable:P}=s.getDraggableInfo();(!P||E.target.getAttribute("draggable-data"))&&(document.body.style.userSelect="none",document.body.style.webkitUserSelect="none")}function U(E){if(h=!0,s.start){if(s.start(E,r)===!1)return!1;a.appendChild(g),document.body.style.cursor="move"}}function X(E){h=p=!1,document.body.style.cursor="",document.body.style.userSelect="",document.body.style.webkitUserSelect="",window.removeEventListener("mousemove",C),window.removeEventListener("mouseup",j),E&&(a.removeEventListener("mousedown",M),a.removeEventListener("touchstart",k),a.removeEventListener("dragstart",L))}return a.addEventListener("mousedown",M),a.addEventListener("touchstart",k),a.addEventListener("dragstart",L),{destroy(){X(!0)}}}const R1=.004;function L1(){return{dirX:0,dirY:0,scrollSpeedFactor:1}}function z1(a,l,s,r){const{node:c,left:d,top:h,bottom:p,sense:g,xScroll:x,yScroll:y}=r,v=xm(a,c);s.scrollState||(s.scrollState=L1());let w=0,M=0;v.x<d+g?w=-1:v.x>l.width-g&&(w=1),v.y<h+Math.round(g/2)?M=-1:v.y>l.height-p-Math.round(g/2)&&(M=1),(s.scrollState.dirX!==w||s.scrollState.dirY!==M)&&(Xv(s),s.scrollState.dirX=w,s.scrollState.dirY=M),(x&&s.scrollState.dirX!==0||y&&s.scrollState.dirY!==0)&&_1(s,r,{x:s.scrollState.dirX,y:s.scrollState.dirY})}function _1(a,l,s){a.autoScrollTimer||(a.autoScrollTimer=setTimeout(()=>{a.activeAutoScroll=setInterval(O1,15,a,l,s)},250))}function Xv(a){a.scrollSpeedFactor=1,a.autoScrollTimer&&(a.autoScrollTimer=clearTimeout(a.autoScrollTimer),a.activeAutoScroll=clearInterval(a.activeAutoScroll))}function O1(a,l,s){const{x:r,y:c}=s;a.scrollSpeedFactor+=R1,r!==0&&H1(a,l,r),c!==0&&B1(a,l,c)}function B1(a,l,s){const r=l.node.scrollTop;Zv(r+Math.round(l.sense/3)*a.scrollSpeedFactor*s,"scrollTop",l)}function H1(a,l,s){const r=l.node.scrollLeft;Zv(r+Math.round(l.sense/3)*a.scrollSpeedFactor*s,"scrollLeft",l)}function Zv(a,l,s){s.node[l]=a}function Hu(a,l,s,r,c,d){const h={};return a&&(h.width=`${a}px`,h.minWidth=`${a}px`),l&&(h.flexGrow=l),d&&(h.height=`${d}px`),s&&(h.position="sticky",s.left&&(h.left=`${r}px`),s.right&&(h.right=`${c}px`)),h}function Wv(a,l,s){let r="";if(a.fixed)for(const c in a.fixed){let d=a.fixed[c]===-1;!d&&a.fixed.leftSize&&l.colspan&&(d=l.colspan+a._colindex-1===a.fixed.leftSize),r+=d?"wx-shadow ":"wx-fixed "}return r+=l.rowspan>1?"wx-rowspan ":"",r+=l.colspan>1?"wx-colspan ":"",r+=l.vertical?"wx-vertical ":"",r+=s?s(a)+" ":"",r}function F1(a){const{row:l,column:s,cellStyle:r=null,columnStyle:c=null,children:d,focusable:h}=a,p=m.useContext(ia),g=Ue(p,"focusCell"),x=Ue(p,"search"),y=Ue(p,"reorder"),v=m.useMemo(()=>x?.rows[l.id]&&x.rows[l.id][s.id],[x,l.id,s.id]),w=m.useMemo(()=>Hu(s.width,s.flexgrow,s.fixed,s.left,s.right),[s.width,s.flexgrow,s.fixed,s.left,s.right]);function M(U,X){let E="wx-cell";return E+=s.fixed?" "+(s.fixed===-1?"wx-shadow":"wx-fixed"):"",E+=U?" "+U(s):"",E+=X?" "+X(l,s):"",E+=s.treetoggle?" wx-tree-cell":"",E}const C=m.useMemo(()=>M(c,r),[c,r,s,l]),j=m.useMemo(()=>typeof s.draggable=="function"?s.draggable(l,s)!==!1:s.draggable,[s,l]),k=m.useRef(null);m.useEffect(()=>{k.current&&h&&g?.row===l.id&&g?.column===s.id&&k.current.focus()},[g,h,l.id,s.id]);const T=m.useCallback(()=>{h&&!g&&p.exec("focus-cell",{row:l.id,column:s.id,eventSource:"focus"})},[p,h,g,l.id,s.id]);function A(U){const X=new RegExp(`(${x.value.trim()})`,"gi");return String(U).split(X).map(E=>({text:E,highlight:X.test(E)}))}const L=m.useMemo(()=>{const U=s.fixed&&s.fixed.left===-1||s.fixed.right===-1,X=s.fixed&&s.fixed.right;return[C,U?"wx-shadow":"",X?"wx-fixed-right":""].filter(Boolean).join(" ")},[C,s]),q=s.cell;return o.jsxs("div",{className:"wx-TSCaXsGV "+L,ref:k,onFocus:T,style:w,"data-row-id":tn(l.id),"data-col-id":tn(s.id),tabIndex:h?"0":"-1",role:"gridcell","aria-colindex":s._colindex,"aria-readonly":s.editor?void 0:!0,children:[y&&s.draggable?j?o.jsx("i",{"draggable-data":"true",className:"wx-TSCaXsGV wx-draggable wxi-drag"}):o.jsx("i",{className:"wx-TSCaXsGV wx-draggable-stub"}):null,s.treetoggle?o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{marginLeft:`${l.$level*28}px`}}),l.$count?o.jsx("i",{"data-action":"toggle-row",className:`wx-TSCaXsGV wx-table-tree-toggle wxi-menu-${l.open!==!1?"down":"right"}`}):null]}):null,q?o.jsx(q,{api:p,row:l,column:s,onAction:({action:U,data:X})=>p.exec(U,X)}):d?d():v?o.jsx("span",{children:A(yi(l,s)).map(({highlight:U,text:X},E)=>U?o.jsx("mark",{className:"wx-TSCaXsGV wx-search",children:X},E):o.jsx("span",{children:X},E))}):yi(l,s)]})}function zx(a,l){let s,r;function c(p){s=p.clientX,a.style.opacity=1,document.body.style.cursor="ew-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",d),window.addEventListener("mouseup",h),l&&l.down&&l.down(a)}function d(p){r=p.clientX-s,l&&l.move&&l.move(r)}function h(){a.style.opacity="",document.body.style.cursor="",document.body.style.userSelect="",l&&l.up&&l.up(r),window.removeEventListener("mousemove",d),window.removeEventListener("mouseup",h)}return a.addEventListener("mousedown",c),{destroy(){a.removeEventListener("mousedown",c)}}}function I1({filter:a,column:l,action:s,filterValue:r}){function c({value:d}){s({value:d,key:l.id})}return o.jsx(Om,{...a.config??{},value:r,onChange:c})}function U1({filter:a,column:l,action:s,filterValue:r}){const c=m.useContext(ia),d=Ue(c,"flatData"),h=m.useMemo(()=>a?.config?.options||l?.options||g(),[a,l,d]),p=m.useMemo(()=>a?.config?.template,[a]);function g(){const v=[];return d.forEach(w=>{const M=bi(w,l);v.includes(M)||v.push(M)}),v.map(w=>({id:w,label:w}))}function x({value:v}){s({value:v,key:l.id})}function y(v){v.key!=="Tab"&&v.preventDefault()}return o.jsx("div",{style:{width:"100%"},onKeyDown:y,children:o.jsx(tS,{placeholder:"",clear:!0,...a?.config??{},options:h,value:r,onChange:x,children:v=>p?p(v):v.label})})}function $1({filter:a,column:l,action:s,filterValue:r}){function c({value:d}){s({value:d,key:l.id})}return o.jsx("div",{className:"wx-aaaK5VYO",style:{width:"100%"},children:o.jsx(eS,{placeholder:"",clear:!0,...a?.config??{},value:r,onChange:c})})}function Jv(a){const{value:l,options:s=[],placeholder:r="",clear:c=!1,text:d=null,template:h=null,cell:p=null,dropdown:g={},autoOpen:x=!1,onChange:y,onAction:v}=a,[w,M]=Bv(l||[]),C=m.useMemo(()=>(w||[]).map(B=>s.find(ue=>ue.id===B)).filter(Boolean),[w,s]),j=m.useRef(null),k=m.useRef(null),[T,A]=m.useState(null),L=()=>{const B=w||[];if(!B.length)return 0;const ue=s.find(G=>B.includes(G.id));return ue?s.indexOf(ue):0};function q(B){k.current=B.navigate,A(()=>B.keydown),x&&B.navigate(L())}m.useEffect(()=>{x&&(j.current?.focus(),typeof window<"u"&&window.getSelection&&window.getSelection().removeAllRanges())},[]);function U({id:B}){M(B),y&&y({value:B})}function X(B){B.stopPropagation(),M([]),y&&y({value:[]})}function E(){k.current?.(L())}function P(){k.current?.(null)}function te(B){T?.(B,L())}return o.jsxs("div",{ref:j,className:"wx-multiselect wx-aadNNOwy",onClick:E,onKeyDown:te,tabIndex:0,children:[o.jsx("div",{className:"wx-label wx-aadNNOwy",children:h?h(C):p?o.jsx(p,{data:C,onAction:v}):d?o.jsx("span",{className:"wx-text wx-aadNNOwy",children:d}):C.length?o.jsx("span",{className:"wx-text wx-aadNNOwy",children:C.map(B=>B.label).join(", ")}):r?o.jsx("span",{className:"wx-placeholder wx-aadNNOwy",children:r}):" "}),c&&w?.length?o.jsx("i",{className:"wx-icon wxi-close wx-aadNNOwy",onClick:X}):o.jsx("i",{className:"wx-icon wxi-angle-down wx-aadNNOwy"}),o.jsx(Ou,{items:s,onReady:q,onSelect:U,multiselect:!0,checkboxes:!0,value:w||[],onCancel:P,...g,children:({option:B})=>o.jsx("div",{className:"wx-option wx-aadNNOwy",children:h?h(B):p?o.jsx(p,{data:B,onAction:v}):B.label})})]})}function q1({filter:a,column:l,action:s,filterValue:r}){const c=m.useContext(an.i18n)?.getGroup("grid")||Ro(Fm).getGroup("grid"),d=m.useMemo(()=>({clear:!0,...a?.config||{}}),[a]),h=m.useMemo(()=>d.options||l.options,[d,l]),p=m.useMemo(()=>{const y=r?.length;return y?y<3?r.map(v=>l.optionsMap.get(v)).join(", "):y+" "+c("selected"):""},[r,l,c]);function g({value:y}){s({value:y,key:l.id})}function x(y){y.key!=="Tab"&&y.preventDefault()}return o.jsx("div",{style:{width:"100%"},onKeyDown:x,children:o.jsx(Jv,{placeholder:"",...d,options:h,value:r||[],text:p,onChange:g})})}const G1={text:I1,richselect:U1,datepicker:$1,multiselect:q1};function P1({filter:a,column:l}){const s=m.useContext(ia),r=Ue(s,"filterValues");function c(h){s.exec("filter-rows",h)}const d=m.useMemo(()=>G1[a.type],[a.type]);return o.jsx(d,{filter:a,column:l,action:c,filterValue:r[l.id]})}function Y1(a){const{cell:l,column:s,row:r,lastRow:c,sortRow:d,columnStyle:h,bodyHeight:p,hasSplit:g}=a,x=m.useContext(ia),y=Ue(x,"sortMarks"),v=m.useMemo(()=>y?y[s.id]:void 0,[y,s.id]),w=m.useRef(),M=m.useCallback(re=>{w.current=l.flexgrow?re.parentNode.clientWidth:l.width},[l.flexgrow,l.width]),C=m.useCallback((re,fe)=>{x.exec("resize-column",{id:l.id,width:Math.max(1,(w.current||0)+re),inProgress:fe})},[x,l.id]),j=m.useCallback(re=>C(re,!0),[C]),k=m.useCallback(re=>C(re,!1),[C]),T=m.useCallback(re=>{if(!s.sort||l.filter)return;let fe=v?.order;fe&&(fe=fe==="asc"?"desc":"asc"),x.exec("sort-rows",{key:l.id,add:re.ctrlKey||re.metaKey,order:fe})},[x,l.id,l.filter,s.sort,v?.order]),A=m.useCallback(re=>{re&&re.stopPropagation(),x.exec("collapse-column",{id:l.id,row:r})},[x,l.id,r]),L=m.useCallback(re=>{re.key==="Enter"&&A()},[A]),q=m.useCallback(re=>{re.key==="Enter"&&!l.filter&&T(re)},[T,l.filter]),U=m.useMemo(()=>l.collapsed&&s.collapsed,[l.collapsed,s.collapsed]),X=m.useMemo(()=>U&&!g&&l.collapsible!=="header",[U,g,l.collapsible]),E=m.useMemo(()=>X?{top:-p/2,position:"absolute"}:{},[X,p]),P=m.useMemo(()=>Hu(l.width,l.flexgrow,s.fixed,s.left,l.right??s.right,l.height+(U&&X?p:0)),[l.width,l.flexgrow,s.fixed,s.left,l.right,s.right,l.height,U,X,p]),te=m.useMemo(()=>Wv(s,l,h),[s,l,h]),B=m.useCallback(()=>Object.fromEntries(Object.entries(l).filter(([re])=>re!=="cell")),[l]),ue=`wx-cell ${te} ${l.css||""} wx-collapsed`,G=["wx-cell",te,l.css||"",l.filter?"wx-filter":"",s.fixed&&s.fixed.right?"wx-fixed-right":""].filter(Boolean).join(" "),de=m.useRef(null);return m.useEffect(()=>{const re=de.current;if(!re)return;const fe=zx(re,{down:M,move:j,up:k});return()=>{typeof fe=="function"&&fe()}},[M,j,k,zx]),U?o.jsx("div",{className:"wx-RsQD74qC "+ue,style:P,role:"button","aria-label":`Expand column ${l.text||""}`,"aria-expanded":!l.collapsed,tabIndex:0,onKeyDown:L,onClick:A,"data-header-id":tn(s.id),children:o.jsx("div",{className:"wx-RsQD74qC wx-text",style:E,children:l.text||""})}):o.jsxs("div",{className:"wx-RsQD74qC "+G,style:P,onClick:T,"data-header-id":tn(s.id),tabIndex:!l._hidden&&s.sort&&!l.filter?0:void 0,role:"columnheader","aria-colindex":s._colindex,"aria-colspan":l.colspan>1?l.colspan:void 0,"aria-rowspan":l.rowspan>1?l.rowspan:void 0,"aria-sort":!v?.order||l.filter?"none":v?.order==="asc"?"ascending":"descending",onKeyDown:q,children:[l.collapsible?o.jsx("div",{className:"wx-RsQD74qC wx-collapse",role:"button","aria-label":l.collapsed?"Expand column":"Collapse column","aria-expanded":!l.collapsed,tabIndex:0,onKeyDown:L,onClick:A,children:o.jsx("i",{className:`wx-RsQD74qC wxi-angle-${l.collapsed?"down":"right"}`})}):null,l.cell?(()=>{const re=l.cell;return o.jsx(re,{api:x,cell:B(),column:s,row:r,onAction:({action:fe,data:I})=>x.exec(fe,I)})})():l.filter?o.jsx(P1,{filter:l.filter,column:s}):o.jsx("div",{className:"wx-RsQD74qC wx-text",children:l.text||""}),s.resize&&c&&!l._hidden?o.jsx("div",{className:"wx-RsQD74qC wx-grip",role:"presentation","aria-label":"Resize column",ref:de,onClick:re=>re.stopPropagation(),children:o.jsx("div",{})}):null,d?o.jsx("div",{className:"wx-RsQD74qC wx-sort",children:v?o.jsxs(o.Fragment,{children:[typeof v.index<"u"?o.jsx("div",{className:"wx-RsQD74qC wx-order",children:v.index+1}):null,o.jsx("i",{className:`wx-RsQD74qC wxi-arrow-${v.order==="asc"?"up":"down"}`})]}):null}):null]})}function V1({cell:a,column:l,row:s,columnStyle:r}){const c=m.useContext(ia),d=m.useMemo(()=>Hu(a?.width,a?.flexgrow,l?.fixed,l?.left,a?.right??l?.right,a?.height),[a?.width,a?.flexgrow,l?.fixed,l?.left,a?.right,l?.right,a?.height]),h=m.useMemo(()=>Wv(l,a,r),[l,a,r]),p=m.useCallback(()=>Object.fromEntries(Object.entries(a||{}).filter(([x])=>x!=="cell")),[a]),g=`wx-6Sdi3Dfd wx-cell ${h||""} ${a?.css||""}`+(l?.fixed&&l?.fixed.right?" wx-fixed-right":"");return o.jsx("div",{className:g,style:d,children:!l?.collapsed&&!a?.collapsed?a?.cell?Nm.createElement(a.cell,{api:c,cell:p(),column:l,row:s,onAction:({action:x,data:y})=>c.exec(x,y)}):o.jsx("div",{className:"wx-6Sdi3Dfd wx-text",children:a?.text||""}):null})}function _x({deltaLeft:a,contentWidth:l,columns:s,type:r="header",columnStyle:c,bodyHeight:d}){const h=m.useContext(ia),p=Ue(h,"_sizes"),g=Ue(h,"split"),x=m.useMemo(()=>p?.[`${r}RowHeights`],[p,r]),y=m.useMemo(()=>{let j=[];if(s&&s.length){const k=s[0][r].length;for(let T=0;T<k;T++){let A=0;j.push([]),s.forEach((L,q)=>{const U={...L[r][T]};A||j[T].push(U),U.colspan>1?A=U.colspan-1:A&&A--})}}return j},[s,r]),v=m.useMemo(()=>g?.left||g?.right,[g]);function w(j){return s.find(k=>k.id===j)}function M(j,k){let T=k;return j.rowspan&&(T+=j.rowspan-1),T===y.length-1}function C(j,k,T){if(!T.sort)return!1;for(let A=y.length-1;A>=0;A--){const L=T.header[A];if(!L.filter&&!L._hidden)return k===A}return M(j,k)}return o.jsx("div",{className:`wx-sAsPVaUK wx-${r}`,style:{paddingLeft:`${a}px`,width:`${l}px`},role:"rowgroup",children:y.map((j,k)=>o.jsx("div",{className:r==="header"?"wx-sAsPVaUK wx-h-row":"wx-sAsPVaUK wx-f-row",style:{height:`${x?.[k]}px`,display:"flex"},role:"row",children:j.map(T=>{const A=w(T.id);return r==="header"?o.jsx(Y1,{cell:T,columnStyle:c,column:A,row:k,lastRow:M(T,k),bodyHeight:d,sortRow:C(T,k,A),hasSplit:v},T.id):o.jsx(V1,{cell:T,columnStyle:c,column:w(T.id),row:k},T.id)})},k))})}function Q1({overlay:a}){const l=m.useContext(ia);function s(c){return typeof c=="function"}const r=a;return o.jsx("div",{className:"wx-1ty666CQ wx-overlay",children:s(a)?o.jsx(r,{onAction:({action:c,data:d})=>l.exec(c,d)}):a})}function K1(a){const{editor:l,onSave:s,onApply:r}=a,[c,d]=m.useState(l?.value||""),{type:h="text"}=m.useMemo(()=>l?.config||{},[l]),p=m.useRef(null);m.useEffect(()=>{p.current&&p.current.focus()},[]),m.useEffect(()=>{if(!p.current)return;const y=Ja(p.current,()=>s(!0));return()=>y.destroy()},[s]);function g(){p.current&&(d(p.current.value),r(p.current.value))}function x({key:y}){y==="Enter"&&s()}return o.jsx("input",{className:"wx-e7Ao5ejY wx-text",onInput:g,onKeyDown:x,ref:p,type:h,value:c})}function X1({editor:a,onAction:l,onSave:s,onApply:r,onCancel:c}){const[d,h]=m.useState(a?.value),[p,g]=m.useState(a?.renderedValue),[x,y]=m.useState(a?.options||[]),v=m.useMemo(()=>a?.config?.template,[a]),w=m.useMemo(()=>a?.config?.cell,[a]),M=m.useMemo(()=>a?.config?.dropdown||{},[a]),C=m.useMemo(()=>({trackScroll:!0,...M}),[M]),j=m.useMemo(()=>(x||[]).findIndex(E=>E.id===d),[x,d]),k=m.useRef(null),T=m.useRef(null),A=m.useCallback(E=>{k.current=E.navigate,T.current=E.keydown,k.current(j)},[j,k]),L=m.useCallback(E=>{const P=E?.target?.value??"";g(P);const te=P?(a?.options||[]).filter(B=>(B.label||"").toLowerCase().includes(P.toLowerCase())):a?.options||[];y(te),te.length?k.current(-1/0):k.current(null)},[a]),q=m.useRef(null);m.useEffect(()=>{q.current&&q.current.focus()},[]);const U=m.useRef(s);m.useEffect(()=>{U.current=s},[s]),m.useEffect(()=>{if(!q.current)return;const E=Ja(q.current,()=>U.current(!0));return()=>E.destroy()},[]),m.useEffect(()=>{h(a?.value),g(a?.renderedValue),y(a?.options||[])},[a]);const X=m.useCallback(({id:E})=>{r(E),s()},[r,s]);return o.jsxs(o.Fragment,{children:[o.jsx("input",{className:"wx-0UYfSd1x wx-input",ref:q,value:p??"",onChange:L,onKeyDown:E=>T.current?T.current(E,j):void 0}),o.jsx(Ou,{items:x,onReady:A,onSelect:X,...C,onCancel:c,children:({option:E})=>v?v(E):w?o.jsx(w,{data:E,onAction:l}):E.label})]})}function Z1({editor:a,onAction:l,onSave:s,onApply:r,onCancel:c}){const[d]=m.useState(()=>a.value||new Date),{template:h,cell:p,dropdown:g={}}=a?.config||{},x=m.useMemo(()=>({trackScroll:!0,width:"auto",...g}),[g]);function y({value:C}){r(C),s()}const v=m.useRef(null),[w,M]=m.useState(null);return m.useEffect(()=>{v.current&&v.current.focus(),typeof window<"u"&&window.getSelection&&window.getSelection().removeAllRanges()},[]),m.useEffect(()=>{if(!w)return;const C=Ja(w,()=>s(!0));return()=>C.destroy()},[w,s]),o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"wx-lNWNYUb6 wx-value",ref:v,tabIndex:0,onClick:c,onKeyDown:C=>C.preventDefault(),children:h?h(d):p?o.jsx(p,{data:a.value,onAction:l}):o.jsx("span",{className:"wx-lNWNYUb6 wx-text",children:a.renderedValue})}),o.jsx(_m,{...x,onCancel:c,children:o.jsx("div",{ref:M,className:"wx-lNWNYUb6",children:o.jsx(Rv,{value:d,onChange:y,buttons:a.config?.buttons})})})]})}function W1(a){const{editor:l}=a,s=a.onAction??a.onaction,r=a.onSave??a.onsave,c=a.onApply??a.onapply,d=a.onCancel??a.oncancel,h=l.config||{},{dropdown:p={}}=h,g=m.useMemo(()=>({trackScroll:!0,...p}),[p]),[x]=m.useState(l.options.find(L=>L.id===l.value)),[y]=m.useState(l.value),[v]=m.useState(l.options),w=m.useMemo(()=>v.findIndex(L=>L.id===y),[v,y]);function M({id:L}){c(L),r()}let C;const[j,k]=m.useState();function T(L){C=L.navigate,k(()=>L.keydown),C(w)}const A=m.useRef(null);return m.useEffect(()=>{A.current&&A.current.focus(),typeof window<"u"&&window.getSelection&&window.getSelection().removeAllRanges()},[]),m.useEffect(()=>{if(!A.current)return;const L=Ja(A.current,()=>r(!0));return()=>L.destroy()},[r]),o.jsxs(o.Fragment,{children:[o.jsx("div",{ref:A,className:"wx-ywGRk611 wx-value",tabIndex:0,onClick:d,onKeyDown:L=>{j(L,w),L.preventDefault()},children:h.template?h.template(x):h.cell?(()=>{const L=h.cell;return o.jsx(L,{data:x,onAction:s})})():o.jsx("span",{className:"wx-ywGRk611 wx-text",children:l.renderedValue})}),o.jsx(Ou,{items:v,onReady:T,onSelect:M,...g,onCancel:d,children:({option:L})=>h.template?h.template(L):h.cell?(()=>{const q=h.cell;return o.jsx(q,{data:L,onAction:s})})():L.label})]})}function J1(a){const{editor:l,onAction:s,onSave:r,onApply:c}=a,d=l?.config||{},h=l?.options??[],p=l?.value||[],g=l?.renderedValue,x=m.useMemo(()=>({trackScroll:!0,...d.dropdown||{}}),[d]);function y({value:w}){c(w)}const v=m.useRef(null);return m.useEffect(()=>{if(!v.current)return;const w=Ja(v.current,()=>r(!0));return()=>w.destroy()},[r]),o.jsx("div",{ref:v,className:"wx-value wx-aacZ4gNU",onClick:()=>r(!0),children:o.jsx(Jv,{value:p,options:h,text:g,template:d.template,cell:d.cell,clear:d.clear,dropdown:x,autoOpen:!0,onChange:y,onAction:s})})}const eM={text:K1,combo:X1,datepicker:Z1,richselect:W1,multiselect:J1};function tM({column:a,row:l}){const s=m.useContext(ia),r=Ue(s,"editor"),c=m.useCallback((C,j)=>{s.exec("close-editor",{ignore:C}),j&&s.exec("focus-cell",{...j,eventSource:"click"})},[s]),d=m.useCallback(C=>{const j=C?null:{row:r?.id,column:r?.column};c(!1,j)},[r,c]),h=m.useCallback(()=>{c(!0,{row:r?.id,column:r?.column})},[r,c]),p=m.useCallback(C=>{s.exec("editor",{value:C})},[s]),g=m.useCallback(C=>{C.key==="Enter"&&r&&(a.editor.type==="multiselect"?p(r.value):h())},[r,a.editor,h,p]),x=m.useMemo(()=>Hu(a.width,a.flexgrow,a.fixed,a.left,a.right),[a.width,a.flexgrow,a.fixed,a.left,a.right]),y=m.useMemo(()=>{let C=a.editor;if(typeof C=="function"&&(C=C(l,a)),!C)return null;let j=typeof C=="string"?C:C.type;return eM[j]},[a,l]),v=m.useRef(null);m.useEffect(()=>{v.current&&typeof x=="string"&&v.current.setAttribute("style",x)},[x]);const w=typeof l.$parent<"u"?"gridcell":"cell",M=typeof l.$parent<"u"?!a.editor:void 0;return o.jsx("div",{className:"wx-8l724t2g wx-cell wx-editor",ref:v,style:typeof x=="object"&&x!==null?x:void 0,role:w,"aria-readonly":M,tabIndex:-1,onClick:C=>C.stopPropagation(),onDoubleClick:C=>C.stopPropagation(),onKeyDown:g,children:y?o.jsx(y,{editor:r,onSave:d,onApply:p,onCancel:h,onAction:({action:C,data:j})=>s.exec(C,j)}):null})}function Ox(a){const{columns:l,type:s,columnStyle:r}=a,c=m.useContext(ia),{filterValues:d,_columns:h,_sizes:p}=c.getState();function g(x){return r?" "+r(x):""}return o.jsx(o.Fragment,{children:l.map((x,y)=>o.jsx("tr",{children:x.map(v=>{const w=h.find(j=>j.id===v.id),M=`wx-print-cell-${s}${g(w)}${v.filter?" wx-print-cell-filter":""}${v.vertical?" wx-vertical":""}`,C=v.cell;return o.jsx("th",{style:Hv(Vv(v,p.columnWidth)),className:"wx-Gy81xq2u "+M,rowSpan:v.rowspan,colSpan:v.colspan,children:C?o.jsx(C,{api:c,cell:Object.fromEntries(Object.entries(v).filter(([j])=>j!=="cell")),column:w,row:y}):v.filter?o.jsx("div",{className:"wx-Gy81xq2u wx-print-filter",children:i1(d,h,v)}):o.jsx("div",{className:"wx-Gy81xq2u wx-text",children:v.text??""})},v.id)})},y))})}function nM(a){const{columns:l,rowStyle:s,columnStyle:r,cellStyle:c,header:d,footer:h,reorder:p}=a,g=m.useContext(ia),{flatData:x,_sizes:y}=g.getState(),v=d&&kx(l,"header",y.headerRowHeights),w=h&&kx(l,"footer",y.footerRowHeights);function M(j,k){let T="";return T+=r?" "+r(k):"",T+=c?" "+c(j,k):"",T}function C(j,k){return typeof k.draggable=="function"?k.draggable(j,k)!==!1:k.draggable}return o.jsxs("table",{className:`wx-8NTMLH0z wx-print-grid ${l.some(j=>j.flexgrow)?"wx-flex-columns":""}`,children:[d?o.jsx("thead",{children:o.jsx(Ox,{columns:v,type:"header",columnStyle:r})}):null,o.jsx("tbody",{children:x.map((j,k)=>o.jsx("tr",{className:"wx-8NTMLH0z wx-row"+(s?" "+s(j):""),style:{height:`${j.rowHeight||y.rowHeight}px`},children:l.map(T=>T.collapsed?null:o.jsxs("td",{className:`wx-8NTMLH0z wx-print-cell wx-cell ${M(j,T)}`,style:Hv(Vv(T,y.columnWidth)),children:[p&&T.draggable?o.jsx("span",{className:"wx-8NTMLH0z wx-print-draggable",children:C(j,T)?o.jsx("i",{className:"wx-8NTMLH0z wxi-drag"}):null}):null,T.treetoggle?o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{marginLeft:j.$level*28+"px"}}),j.$count?o.jsx("i",{className:`wx-8NTMLH0z wx-print-grid-tree-toggle wxi-menu-${j.open!==!1?"down":"right"}`}):null]}):null,T.cell?(()=>{const A=T.cell;return o.jsx(A,{api:g,row:j,column:T})})():o.jsx("span",{children:yi(j,T)})]},T.id))},k))}),h?o.jsx("tfoot",{children:o.jsx(Ox,{columns:w,type:"footer",columnStyle:r})}):null]})}function aM(a){const{config:l,...s}=a,r=m.useContext(ia),{_skin:c,_columns:d}=r.getState(),h=m.useMemo(()=>t1(d,l),[]),p=m.useRef(null);return m.useEffect(()=>{const g=document.body;g.classList.add("wx-print");const x=p.current;if(!x)return;const y=x.cloneNode(!0);g.appendChild(y);const v=`@media print { @page { size: ${l.paper} ${l.mode}; }`,w=document.createElement("style");w.setAttribute("type","text/css"),w.setAttribute("media","print"),document.getElementsByTagName("head")[0].appendChild(w),w.appendChild(document.createTextNode(v)),window.print(),w.remove(),g.classList.remove("wx-print"),y.remove()},[]),o.jsx("div",{className:`wx-4zwCKA7C wx-${c}-theme wx-print-container`,ref:p,children:h.map((g,x)=>o.jsx("div",{className:"wx-4zwCKA7C wx-print-grid-wrapper",children:o.jsx(nM,{columns:g,...s})},x))})}function lM(a){const{header:l,footer:s,overlay:r,multiselect:c,onreorder:d,rowStyle:h,columnStyle:p,cellStyle:g,autoRowHeight:x,resize:y,clientWidth:v,clientHeight:w,responsiveLevel:M,hotkeys:C}=a,j=m.useContext(ia),k=Ue(j,"dynamic"),T=Ue(j,"_columns"),A=Ue(j,"flatData"),L=Ue(j,"split"),q=Ue(j,"_sizes"),[U,X]=Ca(j,"selectedRows"),E=Ue(j,"select"),P=Ue(j,"editor"),te=Ue(j,"scrollLeft"),B=Ue(j,"scrollTop"),ue=Ue(j,"tree"),G=Ue(j,"focusCell"),de=Ue(j,"_print"),re=Ue(j,"undo"),fe=Ue(j,"reorder"),I=Ue(j,"_rowHeightFromData"),[Z,ee]=m.useState(0);m.useEffect(()=>{ee(Aa())},[]);const[_,ae]=m.useState(0),me=m.useMemo(()=>(T||[]).some(Y=>!Y.hidden&&Y.flexgrow),[T]),z=m.useMemo(()=>q?.rowHeight||0,[q]),ge=m.useRef(null),[be,Me]=m.useState(null),[Fe,Ve]=m.useState(null),Le=m.useMemo(()=>{let Y=[],he=0;return L&&L.left&&(Y=(T||[]).slice(0,L.left).filter(Se=>!Se.hidden).map(Se=>({...Se})),Y.forEach(Se=>{Se.fixed={left:1,leftSize:L.left},Se.left=he,he+=Se.width}),Y.length&&(Y[Y.length-1].fixed.left=-1)),{columns:Y,width:he}},[L,T]),Ee=m.useMemo(()=>{let Y=[],he=0;if(L&&L.right){Y=(T||[]).slice(L.right*-1).filter(Se=>!Se.hidden).map(Se=>({...Se}));for(let Se=Y.length-1;Se>=0;Se--){const $e=Y[Se];$e.fixed={right:1},$e.right=he,he+=$e.width}Y.length&&(Y[0].fixed={right:-1})}return{columns:Y,width:he}},[L,T]),qe=m.useMemo(()=>{const Y=(T||[]).slice(L?.left||0,(T||[]).length-(L?.right??0)).filter(he=>!he.hidden);return Y.forEach(he=>{he.fixed=0}),Y},[T,L]),ke=m.useMemo(()=>(T||[]).reduce((Y,he)=>(he.hidden||(Y+=he.width),Y),0),[T]),gt=1;function ie(Y,he,Se){let $e=he,dt=Y;if(qe.length){let ft=qe.length;for(let _e=Y;_e>=0;_e--)qe[_e][Se].forEach(st=>{st.colspan>1&&_e>Y-st.colspan&&_e<ft&&(ft=_e)});if(ft!==qe.length&&ft<Y){for(let _e=ft;_e<Y;_e++)$e-=qe[_e].width;dt=ft}}return{index:dt,delta:$e}}const ve=m.useMemo(()=>{let Y,he,Se;const $e=te||0,dt=(te||0)+(v||0);let ft=0,_e=0,st=0,ln=0;qe.forEach((qt,Tt)=>{$e>st&&(ft=Tt,ln=st),st=st+qt.width,dt>st&&(_e=Tt+gt)});const Ut={header:0,footer:0};for(let qt=_e;qt>=ft;qt--)["header","footer"].forEach(Tt=>{qe[qt]&&qe[qt][Tt].forEach(ca=>{const ka=ca.colspan;if(ka&&ka>1){const zl=ka-(_e-qt+1);zl>0&&(Ut[Tt]=Math.max(Ut[Tt],zl))}})});const Jt=ie(ft,ln,"header"),wt=ie(ft,ln,"footer"),$t=Jt.delta,Mt=Jt.index,il=wt.delta,Ta=wt.index;return me&&ke>(v||0)?Y=he=Se=[...Le.columns,...qe,...Ee.columns]:(Y=[...Le.columns,...qe.slice(ft,_e+1),...Ee.columns],he=[...Le.columns,...qe.slice(Mt,_e+Ut.header+1),...Ee.columns],Se=[...Le.columns,...qe.slice(Ta,_e+Ut.footer+1),...Ee.columns]),{data:Y||[],header:he||[],footer:Se||[],d:ln,df:il,dh:$t}},[qe,Le,Ee,te,v,me,ke]),Te=m.useMemo(()=>l&&q?.headerHeight||0,[l,q]),De=m.useMemo(()=>s&&q?.footerHeight||0,[s,q]),se=m.useMemo(()=>v&&w?ke>=v:!1,[v,w,ke]),[et,Ce]=m.useState(!1),It=m.useMemo(()=>(w||0)-Te-De-(se?Z:0),[w,Te,De,se,Z]),Rt=m.useMemo(()=>Math.ceil((It||0)/(z||1))+1,[It,z]),xe=m.useRef([]),[He,ze]=m.useState(0),[lt,Mn]=m.useState(void 0),it=m.useMemo(()=>{let Y=0,he=0;const Se=2,$e=B||0;if(x){let _e=$e;for(;_e>0;)_e-=xe.current[Y]||z,Y++;he=$e-_e;for(let st=Math.max(0,Y-Se-1);st<Y;st++)he-=xe.current[Y-st]||z;Y=Math.max(0,Y-Se)}else{if(I){let _e=0,st=0;for(let wt=0;wt<(A||[]).length;wt++){const $t=A[wt].rowHeight||z;if(st+$t>$e){_e=wt;break}st+=$t}Y=Math.max(0,_e-Se);for(let wt=0;wt<Y;wt++)he+=A[wt].rowHeight||z;let ln=0,Ut=0;for(let wt=_e+1;wt<(A||[]).length;wt++){const $t=A[wt].rowHeight||z;if(ln++,Ut+$t>It)break;Ut+=$t}const Jt=Math.min(k?k.rowCount:(A||[]).length,_e+ln+Se);return{d:he,start:Y,end:Jt}}Y=Math.floor($e/(z||1)),Y=Math.max(0,Y-Se),he=Y*(z||0)}const dt=k?k.rowCount:(A||[]).length,ft=Math.min(dt,Y+(Rt||0)+Se);return{d:he,start:Y,end:ft}},[x,I,B,z,k,A,Rt,It]),Nn=m.useMemo(()=>{const Y=k?k.rowCount:(A||[]).length;if(x)return He+it.d+(Y-(lt||0))*(z||0);if(!I)return Y*(z||0);let he=0;for(let Se=0;Se<Y;Se++)he+=A[Se]?.rowHeight||z;return he},[k,A,z,x,I,He,it.d,lt]),ja=m.useRef({});ja.current={clientWidth:v,clientHeight:w,fullHeight:Nn,headerHeight:Te,footerHeight:De,fullWidth:ke,SCROLLSIZE:Z};const Na=m.useCallback(()=>{const Y=ja.current;Ce(Y.clientWidth&&Y.clientHeight?Y.fullHeight+Y.headerHeight+Y.footerHeight>=Y.clientHeight-(Y.fullWidth>=Y.clientWidth?Y.SCROLLSIZE:0):!1)},[]);m.useEffect(()=>{const Y=requestAnimationFrame(Na);return()=>window.cancelAnimationFrame(Y)},[_,Na]),m.useEffect(()=>{Na()},[w,Na]);const An=m.useMemo(()=>me&&ke<=(v||0)?(v||0)-0-(et?Z:0):ke,[me,ke,v,et,Z,se]),el=m.useMemo(()=>me&&ke<=(v||0)?v||0:An<(v||0)?ke+(et?Z:0):-1,[me,ke,v,An,et,Z]),Qn=m.useRef({});m.useEffect(()=>{if(k&&(Qn.current.start!==it.start||Qn.current.end!==it.end)){const{start:Y,end:he}=it;Qn.current={start:Y,end:he},j&&j.exec&&j.exec("request-data",{row:{start:Y,end:he}})}},[k,it,j]);const ut=m.useMemo(()=>k?A||[]:(A||[]).slice(it.start,it.end),[k,A,it]),hn=m.useMemo(()=>(U||[]).filter(Y=>(ut||[]).some(he=>he.id===Y)),[X,ut]),Ot=m.useMemo(()=>it.start,[it.start]),Rl=m.useRef({top:B,left:te});Rl.current={top:B,left:te};const ir=m.useCallback(Y=>{const he=Y.target.scrollTop,Se=Y.target.scrollLeft,$e=Rl.current;(he!==$e.top||Se!==$e.left)&&j.exec("scroll-to",{top:he,left:Se})},[j]),Wi=m.useCallback(Y=>{Y.shiftKey&&Y.preventDefault(),ge.current&&ge.current.focus&&ge.current.focus()},[]),Ha=m.useCallback(()=>!!(T||[]).find(Y=>!!Y.draggable),[T]),sa=m.useRef(null),pn=m.useRef(null),Tn=m.useRef({dblclick:(Y,he)=>{const Se={id:Y,column:ko(he,"data-col-id")};j.exec("open-editor",Se)},click:(Y,he)=>{if(he.target.closest("input")||sa.current)return;const Se=ko(he,"data-col-id");if(G?.id!==Y&&j.exec("focus-cell",{row:Y,column:Se,eventSource:"click"}),E===!1)return;const $e=c&&(he.ctrlKey||he.metaKey),dt=c&&he.shiftKey;($e||U.length>1||!U.includes(Y))&&j.exec("select-row",{id:Y,toggle:$e,range:dt})},"toggle-row":Y=>{const he=j.getRow(Y);j.exec(he.open!==!1?"close-row":"open-row",{id:Y})},"ignore-click":()=>!1}),kn=m.useMemo(()=>({top:Te,bottom:De,left:Le.width,xScroll:se,yScroll:et,sense:x&&Fe?Fe.offsetHeight:Math.max(q?.rowHeight||0,40),node:ge.current&&ge.current.firstElementChild}),[Te,De,Le.width,se,et,x,Fe,q]);function ra(Y,he){const{container:Se,sourceNode:$e,from:dt}=he;if(Ha()&&!$e.getAttribute("draggable-data"))return!1;Me(dt),ue&&j.getRow(dt).open&&j.exec("close-row",{id:dt,nested:!0});const ft=ar($e),_e=ft.cloneNode(!0);_e.classList.remove("wx-selected"),_e.querySelectorAll("[tabindex]").forEach(Jt=>Jt.setAttribute("tabindex","-1")),Se.appendChild(_e),Ve(_e);const st=(te||0)-ve.d,ln=et?Z:0;Se.style.width=Math.min((v||0)-ln,me&&ke<=(v||0)?An:An-ln)+st+"px";const Ut=pu(ft);he.offset={x:st,y:-Math.round(Ut.height/2)},pn.current||(pn.current=Y.clientY)}function tl(Y,he){const{from:Se}=he,$e=he.pos,dt=pu(ge.current);$e.x=dt.x;const ft=kn.top;if($e.y<ft)$e.y=ft;else{const _e=dt.height-(se&&Z>0?Z:Math.round(kn.sense/2))-kn.bottom;$e.y>_e&&($e.y=_e)}if(ge.current.contains(he.targetNode)){const _e=ar(he.targetNode),st=_e&&zu(_e);if(st&&st!==Se){he.to=st;const ln=x?Fe?.offsetHeight:q?.rowHeight;if(Fe&&((B||0)===0||$e.y>ft+ln-1)){const Ut=_e.getBoundingClientRect(),Jt=pu(Fe).y,wt=Ut.y,$t=Jt>wt?-1:1,Mt=$t===1?"after":"before",il=j.getState().flatData,Ta=Math.abs(il.findIndex(Tt=>Tt.id===Se)-il.findIndex(Tt=>Tt.id===st)),qt=Ta!==1?Mt==="before"?"after":"before":Mt;if(Ta===1&&($t===-1&&Y.clientY>pn.current||$t===1&&Y.clientY<pn.current))return;pn.current=Y.clientY,j.exec("move-item",{id:Se,target:st,mode:qt,inProgress:!0})}}d&&d({event:Y,context:he})}z1(Y,dt,he,kn)}function Ll(Y,he){const{from:Se,to:$e}=he;j.exec("move-item",{id:Se,target:$e,inProgress:!1}),sa.current=setTimeout(()=>{sa.current=0},1),Me(null),Ve(null),pn.current=null,Xv(he)}function Aa(){const Y=document.createElement("div");Y.style.cssText="position:absolute;left:-1000px;width:100px;padding:0px;margin:0px;min-height:100px;overflow-y:scroll;",document.body.appendChild(Y);const he=Y.offsetWidth-Y.clientWidth;return document.body.removeChild(Y),he}const oa=m.useMemo(()=>el>0?{width:`${el}px`}:void 0,[el]),nl=m.useRef(null);function al(){Promise.resolve().then(()=>{let Y=0,he=Ot;const Se=nl.current;Se&&(Array.from(Se.children).forEach(($e,dt)=>{xe.current[Ot+dt]=$e.offsetHeight,Y+=$e.offsetHeight,he++}),ze(Y),Mn(he))})}m.useEffect(()=>{ut&&x&&al()},[ut,x,Ot]);let[Kn,ll]=m.useState();m.useEffect(()=>{if(G&&(!E||!hn.length||hn.includes(G.row)))ll({...G});else if(ut.length&&ve.data.length){if(!Kn||hn.length&&!hn.includes(Kn.row)||ut.findIndex(Y=>Y.id===Kn.row)===-1||ve.data.findIndex(Y=>Y.id===Kn.column&&!Y.collapsed)===-1){const Y=hn[0]||ut[0].id,he=ve.data.findIndex(Se=>!Se.collapsed);ll(he!==-1?{row:Y,column:ve.data[he].id}:null)}}else ll(null)},[G]);const En=m.useRef(null);m.useEffect(()=>{const Y=ge.current;if(!Y)return;const he=k1(Y,y);return()=>{typeof he=="function"&&he()}},[y]);const Dn=m.useRef({});Object.assign(Dn.current,{start:ra,move:tl,end:Ll,getReorder:()=>fe,getDraggableInfo:()=>({hasDraggable:Ha()})}),m.useEffect(()=>{const Y=ge.current;return Y?D1(Y,Dn).destroy:void 0},[fe,ge.current]),m.useEffect(()=>{const Y=ge.current;return Y?A1(Y,{keys:C!==!1&&{...N1,"ctrl+z":re,"ctrl+y":re,...C},exec:he=>j.exec("hotkey",he)}).destroy:void 0},[j,re,C]);const gn=m.useRef({scroll:j.getReactiveState().scroll,scrollLeft:j.getReactiveState().scrollLeft,scrollTop:j.getReactiveState().scrollTop});gn.current.getWidth=()=>(v||0)-(et?Z:0),gn.current.getHeight=()=>It,gn.current.getScrollMargin=()=>Le.width+Ee.width,m.useEffect(()=>{T1(En.current,gn.current)},[]);const wi=m.useRef(null);m.useEffect(()=>{const Y=wi.current;if(!Y)return;const he=[];he.push(Ja(Y,()=>G&&j.exec("focus-cell",{eventSource:"click"})).destroy),he.push(DS(Y,Tn.current)),ae(Y.clientHeight);const Se=new ResizeObserver(()=>{ae(Y.clientHeight)});return Se.observe(Y),he.push(()=>Se.disconnect()),()=>he.forEach($e=>$e())},[]);const Rn=`wx-grid ${M?`wx-responsive-${M}`:""}`;return m.useEffect(()=>{G&&(ut.some(Y=>Y.id===G.row)&&ve.data.some(Y=>Y.id===G.column&&!Y.collapsed)||j.exec("focus-cell",{eventSource:"destroy"}))},[G,ut,ve.data,j]),o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"wx-4VuBwK2D "+Rn,style:{"--header-height":`${Te}px`,"--footer-height":`${De}px`,"--split-left-width":`${Le.width}px`,"--split-right-width":`${Ee.width}px`},children:o.jsx("div",{ref:ge,className:"wx-4VuBwK2D wx-table-box",style:oa,role:ue?"treegrid":"grid","aria-colcount":ve.data.length,"aria-rowcount":ut.length,"aria-multiselectable":ue&&c?!0:void 0,tabIndex:-1,children:o.jsxs("div",{ref:En,className:"wx-4VuBwK2D wx-scroll",style:{overflowX:se?"scroll":"hidden",overflowY:et?"scroll":"hidden"},onScroll:ir,children:[l?o.jsx("div",{className:"wx-4VuBwK2D wx-header-wrapper",children:o.jsx(_x,{contentWidth:An,deltaLeft:ve.dh,columns:ve.header,columnStyle:p,bodyHeight:It-+s})}):null,o.jsxs("div",{ref:wi,className:"wx-4VuBwK2D wx-body",style:{width:`${An}px`,height:`${Nn}px`},onMouseDown:Y=>Wi(Y),children:[r?o.jsx(Q1,{overlay:r}):null,o.jsx("div",{ref:nl,className:"wx-4VuBwK2D wx-data",style:{paddingTop:`${it.d}px`,paddingLeft:`${ve.d}px`},children:ut.map((Y,he)=>{const Se=U.indexOf(Y.id)!==-1,$e=be===Y.id,dt="wx-row"+(x?" wx-autoheight":"")+(h?" "+h(Y):"")+(Se?" wx-selected":"")+($e?" wx-inactive":""),ft=x?{minHeight:`${Y.rowHeight||z}px`}:{height:`${Y.rowHeight||z}px`};return o.jsx("div",{className:"wx-4VuBwK2D "+dt,"data-id":tn(Y.id),"data-context-id":tn(Y.id),style:ft,role:"row","aria-rowindex":he,"aria-expanded":Y.open,"aria-level":ue?Y.$level+1:void 0,"aria-selected":ue?Se:void 0,tabIndex:-1,children:ve.data.map(_e=>_e.collapsed?o.jsx("div",{className:"wx-4VuBwK2D wx-cell wx-collapsed"},_e.id):P?.id===Y.id&&P.column===_e.id?o.jsx(tM,{row:Y,column:_e},_e.id):o.jsx(F1,{row:Y,column:_e,columnStyle:p,cellStyle:g,reorder:fe,focusable:Kn?.row===Y.id&&Kn?.column===_e.id},_e.id))},Y.id)})})]}),s&&(A||[]).length?o.jsx(_x,{type:"footer",contentWidth:An,deltaLeft:ve.df,columns:ve.footer,columnStyle:p}):null]})})}),de?o.jsx(aM,{config:de,rowStyle:h,columnStyle:p,cellStyle:g,header:l,footer:s,reorder:fe}):null]})}const iM=a=>a.split("-").map(l=>l?l.charAt(0).toUpperCase()+l.slice(1):"").join(""),sM=m.forwardRef(function({data:a=[],columns:l=[],rowStyle:s=null,columnStyle:r=null,cellStyle:c=null,selectedRows:d,select:h=!0,multiselect:p=!1,header:g=!0,footer:x=!1,dynamic:y=null,overlay:v=null,reorder:w=!1,onReorder:M=null,autoRowHeight:C=!1,sizes:j,split:k,tree:T=!1,autoConfig:A=!1,init:L=null,responsive:q=null,sortMarks:U,undo:X=!1,hotkeys:E=null,filterValues:P,...te},B){const ue=m.useRef();ue.current=te;const G=m.useMemo(()=>new b1(Fv),[]),de=m.useMemo(()=>G.in,[G]),re=m.useRef(null);re.current===null&&(re.current=new Lv((Ee,qe)=>{const ke="on"+iM(Ee);ue.current&&ue.current[ke]&&ue.current[ke](qe)}),de.setNext(re.current));const fe=m.useMemo(()=>({getState:G.getState.bind(G),getReactiveState:G.getReactive.bind(G),getStores:()=>({data:G}),exec:de.exec,setNext:Ee=>(re.current=re.current.setNext(Ee),re.current),intercept:de.intercept.bind(de),on:de.on.bind(de),detach:de.detach.bind(de),getRow:G.getRow.bind(G),getColumn:G.getColumn.bind(G)}),[G,de]),[I,Z]=m.useState(0),[ee,_]=m.useState(0),[ae,me]=m.useState(null),[z,ge]=m.useState(null),be=m.useMemo(()=>{if(A&&!l.length&&a.length){const Ee=a[0],qe=[];for(let ke in Ee)if(ke!=="id"&&ke[0]!=="$"){let gt={id:ke,header:ke[0].toUpperCase()+ke.slice(1)};typeof A=="object"&&(gt={...gt,...A}),qe.push(gt)}return qe}return(z&&z.columns)??l},[A,l,a,z]),Me=m.useMemo(()=>(z&&z.sizes)??j,[z,j]),Fe=m.useCallback(Ee=>{if(Z(Ee.width),_(Ee.height),q){const qe=Object.keys(q).map(Number).sort((ke,gt)=>ke-gt).find(ke=>Ee.width<=ke)??null;qe!==ae&&(ge(q[qe]),me(qe))}},[q,ae]),Ve=m.useContext(an.theme),Le=m.useRef(0);return m.useEffect(()=>{if(!Le.current)L&&L(fe);else{const Ee=G.getState();G.init({data:a,columns:be,split:k||Ee.split,sizes:Me||Ee.sizes,selectedRows:d||Ee.selectedRows,dynamic:y,tree:T,sortMarks:U||Ee.sortMarks,filterValues:P||Ee.filterValues,undo:X,reorder:w,_skin:Ve,_select:h})}Le.current++},[G,a,be,k,Me,d,y,T,U,P,X,w,Ve,h,L,fe]),Le.current===0&&G.init({data:a,columns:be,split:k||{left:0},sizes:Me||{},selectedRows:d||[],dynamic:y,tree:T,sortMarks:U||{},filterValues:P||{},undo:X,reorder:w,_skin:Ve,select:h}),m.useImperativeHandle(B,()=>({...fe}),[fe]),o.jsx(ia.Provider,{value:fe,children:o.jsx(Hm,{words:Fm,optional:!0,children:o.jsx(lM,{header:g,footer:x,overlay:v,rowStyle:s,columnStyle:r,cellStyle:c,onReorder:M,multiselect:p,autoRowHeight:C,clientWidth:I,clientHeight:ee,responsiveLevel:ae,resize:Fe,hotkeys:E})})})});Dm(Vn);const nn=m.createContext(null),$m=m.createContext(null),qm=m.createContext(null);function rM({children:a}){const l=m.useContext(an.i18n),s=m.useMemo(()=>l.getGroup("filemanager"),[l]),r=m.useContext(nn),[c]=Ca(r,"panels"),d=Ue(r,"activePanel"),h=c[d].path,[p,g]=m.useState(null),[x,y]=m.useState(null),[v,w]=m.useState(""),[M,C]=m.useState(""),[j,k]=m.useState(!1);function T(){const U=v.trim();if(!U){k(!0);return}p.add?r.exec("create-file",{file:{...p.item,name:U},parent:h}):M!==U&&r.exec("rename-file",{id:p.item.id,name:U}),A()}function A(){g(null),k(null),C(""),w("")}function L(){r.exec("delete-files",{ids:x.selected}),y(null)}const q=m.useMemo(()=>({showPrompt(U){const X=U.item.name||(U.item.type==="folder"?s("New folder"):`${s("New file")}.txt`);C(X),w(X),g({...U})},showConfirm(U){y({...U})}}),[s]);return o.jsxs($m.Provider,{value:q,children:[o.jsx(rS,{children:a}),p?o.jsx(pm,{title:s(`Enter ${p.item.type} name`),onConfirm:T,onCancel:A,children:o.jsx(Om,{error:j,select:!0,focus:!0,value:v,onChange:({value:U})=>w(U)})}):null,x?o.jsx(pm,{title:s("Are you sure you want to delete these items:"),onConfirm:L,onCancel:()=>y(null),children:x.selected?o.jsx("ul",{className:"wx-gq7BMzEP wx-list",children:x.selected.map((U,X)=>o.jsx("li",{children:U},X))}):null}):null]})}let Bx={"7z":!0,rar:!0,zip:!0,css:!0,html:!0,js:!0,php:!0,md:!0,xml:!0,sql:!0,aif:!0,mid:!0,mp3:!0,waw:!0,wma:!0,doc:!0,docx:!0,txt:!0,avi:!0,mov:!0,mp4:!0,mpeg:!0,mpg:!0,pdf:!0,xls:!0,xlsx:!0,gif:!0,jpg:!0,jpeg:!0,png:!0,psd:!0,tiff:!0,svg:!0,folder:!0,file:!0,multiple:!0,search:!0,none:!0};function oM(a){const l=a.lastIndexOf("."),s=l>0&&l<a.length-1?Math.min(10,a.length-l):Math.min(5,a.length),r=a.slice(0,-s),c=a.slice(-s);return[r,c]}function cM({item:a}){const l=m.useContext(nn),s=m.useContext(an.i18n).getGroup("filemanager"),r=m.useContext(nn).templates,[c]=Ca(l,"panels"),d=Ue(l,"activePanel"),h=Ue(l,"mode"),p=c[d].selected,g=m.useMemo(()=>r.preview(a,214,163),[r,a]),x=m.useMemo(()=>r.icon(a,"big"),[r,a]),[y,v]=m.useMemo(()=>oM(a.name),[a.name]);return o.jsx(o.Fragment,{children:a.id==="/wx-filemanager-parent-link"?h!=="search"?o.jsx("div",{className:"wx-GAOa4kDV wx-back-item",children:o.jsxs("div",{className:`wx-GAOa4kDV wx-back ${a.navigation?"wx-selected":""}`,"data-id":tn("/wx-filemanager-parent-link"),children:[o.jsx("i",{className:"wx-GAOa4kDV wxi-arrow-left"}),o.jsx("span",{children:s("Back to parent folder")})]})}):null:o.jsxs("div",{className:`wx-GAOa4kDV wx-item ${p?.length&&p.indexOf(a.id)>=0?"wx-selected":""}`,"data-id":tn(a.id),children:[g?o.jsx("div",{className:"wx-GAOa4kDV wx-preview wx-file-preview",children:o.jsx("img",{className:"wx-GAOa4kDV wx-card-preview",alt:s("A miniature file preview"),src:g})}):x?o.jsx("div",{className:"wx-GAOa4kDV wx-preview wx-file-icon",children:o.jsx("img",{className:"wx-GAOa4kDV wx-card-preview",alt:"",src:x})}):o.jsx("div",{className:"wx-GAOa4kDV wx-preview",children:o.jsx("i",{className:`wx-GAOa4kDV wxi-${a.type}`})}),a.type==="folder"?o.jsxs("div",{className:"wx-GAOa4kDV wx-info",children:[o.jsxs("div",{className:"wx-GAOa4kDV wx-folder-name",children:[o.jsx("span",{className:"wx-GAOa4kDV wx-type",children:s("Folder")}),o.jsxs("span",{className:"wx-GAOa4kDV wx-name",children:[o.jsx("span",{children:y}),o.jsx("span",{children:v})]})]}),o.jsx("div",{"data-action-id":tn(a.id),className:"wx-GAOa4kDV wx-more",children:o.jsx("i",{className:"wx-GAOa4kDV wxi-dots-v"})})]}):o.jsxs("div",{className:"wx-GAOa4kDV wx-info",children:[o.jsx("div",{className:"wx-GAOa4kDV wx-file-name",children:o.jsxs("span",{className:"wx-GAOa4kDV wx-name",children:[o.jsx("span",{children:y}),o.jsx("span",{children:v})]})}),o.jsx("div",{"data-action-id":tn(a.id),className:"wx-GAOa4kDV wx-more",children:o.jsx("i",{className:"wx-GAOa4kDV wxi-dots-v"})})]})]})})}function ey(){const a=m.useContext(nn),l=m.useContext(an.i18n),s=m.useMemo(()=>l.getGroup("filemanager"),[l]),[r]=Ca(a,"panels"),c=Ue(a,"activePanel"),d=Ue(a,"mode"),h=r[c]._files,p=r[c].selected,g=r[c].path,x=r[c]._crumbs,y=r[c]._selectNavigation,v=m.useCallback((A,L)=>{const q=L&&(L.ctrlKey||L.metaKey),U=L&&L.shiftKey;if(A==="/wx-filemanager-parent-link"){if(p.length&&(q||U))return;a.exec("select-file",{type:"navigation"});return}let X=A==="body"&&L?null:A;const E=L.target.className.indexOf("wx-more")!==-1||L.target.className.indexOf("wxi-dots-v")!==-1;setTimeout(()=>{a.exec("select-file",{id:X,toggle:q&&!E,range:U&&!E,panel:c})},1)},[a,p,c]),w=m.useCallback(()=>{x.length>1&&a.exec("set-path",{id:x[x.length-2].id,panel:c,selected:[x[x.length-1].id]})},[a,x,c]),M=m.useCallback(A=>{if(A==="/wx-filemanager-parent-link")return w();d==="search"&&a.exec("filter-files",{text:""});const L=h.find(q=>q.id===A);L&&(L.type=="folder"?a.exec("set-path",{id:L.id,panel:c}):a.exec("open-file",{id:L.id}))},[a,w,d,h,c]),C=m.useCallback((A,L)=>{(!p?.length||!p.filter(q=>q?.id===A).length>0)&&v(A,L)},[p,v]),j=m.useMemo(()=>g!=="/"?[{id:"/wx-filemanager-parent-link",name:s("Back to parent folder"),navigation:y},...h]:h,[g,s,y,h]),k=m.useRef(null),T=m.useRef();return m.useEffect(()=>{k.current&&(T.current?(T.current.click=v,T.current._dblclick=M,T.current.context=C):(T.current={click:v,dblclick:A=>T.current._dblclick(A),_dblclick:M,context:C},lr(k.current,T.current)))},[v,M,C]),d=="search"&&!j.length?o.jsx("div",{className:"wx-iyjASZCY wx-not-found",children:o.jsx("div",{className:"wx-iyjASZCY wx-not-found-text",children:s("Looks like nothing is here")})}):o.jsx("div",{tabIndex:0,className:"wx-iyjASZCY "+("wx-cards"+(g!=="/"&&d!=="search"?" wx-has-back-link":"")),"data-id":tn("body"),ref:k,children:j.map(A=>o.jsx(cM,{item:A},A.id))})}function Xi({name:a="",spin:l=!1,onClick:s}){return o.jsx("i",{"data-menu-ignore":"true",className:`wx-uwcvNSAG wx-icon wxi-${a} ${l?"wx-spin":""} ${s?"wx-clickable":""}`,onClick:()=>{s&&s()}})}function uM(){const a=m.useContext(an.i18n).getGroup("filemanager"),l=m.useContext(nn),s=Ue(l,"activePanel"),[r]=Ca(l,"panels"),c=m.useMemo(()=>r[s]._crumbs,[r,s]);function d(){l.exec("filter-files",{text:""})}return o.jsxs("div",{className:"wx-GDJvtROw wx-search",children:[o.jsxs("div",{className:"wx-GDJvtROw wx-toolbar",children:[o.jsx("div",{className:"wx-GDJvtROw wx-back-icon",children:o.jsx(Xi,{name:"angle-left",onClick:d})}),o.jsxs("div",{className:"wx-GDJvtROw wx-text",children:[a("Search results in")," ",Array.isArray(c)&&c.map((h,p)=>o.jsxs(m.Fragment,{children:[p?"/":null,h.id=="/"?a(h.name):h.name]},p))]})]}),o.jsx(ey,{})]})}function Pf({narrowMode:a,extraInfo:l}){const s=m.useContext(nn),{preview:r,icon:c}=s.templates,d=m.useContext(an.i18n),h=m.useMemo(()=>d.getGroup("filemanager"),[d]),p=m.useMemo(()=>er("%D, %d %F %Y, %H:%i",d.getRaw().calendar),[d]),[g,x]=Ca(s,"panels"),y=Ue(s,"activePanel"),v=Ue(s,"preview"),w=Ue(s,"search"),M=m.useMemo(()=>{const E=g&&y!=null&&g[y]?._selected?.length||0;return w&&!E},[w,x,y]),C=m.useMemo(()=>{const E=g&&y!=null?g[y]:null;return E?M?E._files:E._selected:[]},[M,x,y]),j=m.useCallback((E,P)=>(E?`${E} ${h(E>1?"folders":"folder")} `:"")+(P?`${P} ${h(P>1?"files":"file")}`:""),[h]),k=m.useCallback(()=>{s.exec("show-preview",{mode:!v})},[s,v]),T=m.useCallback(E=>E.type==="folder"?h("Folder"):E.ext||h("Unknown file"),[h]),A=m.useMemo(()=>{let E,P,te,B,ue,G,de,re;if(C.length===1&&!M){P=C[0],E=P.name;const fe=r(P,400,500);fe?(te=fe,B=""):(B=c(P,"big"),te=""),ue=P.type!=="folder"}else{if(P=ue=null,E="",C.length){let fe=0,I=0,Z=0,ee=[],_;C.forEach(me=>{typeof me.size>"u"&&(_=!0,fe=void 0),_||(fe+=me.size),ee.push(T(me)),me.type==="folder"?I++:Z++});const ae=new Set(ee);G=ae.size>1?h("multiple"):[...ae][0],de=j(I,Z),re=fe,M||(E=h("Multiple files"))}B=c({type:M?"search":C.length?"multiple":"none"},"big"),te=""}return{name:E,item:P,previewSrc:te,iconSrc:B,showDownloadIcon:ue,type:G,totalCount:de,totalSize:re}},[C,M,r,c,h,T,j]),L=m.useCallback(()=>{s.exec("download-file",{id:C[0].id})},[s,C]),q=m.useCallback(async E=>{if(!l||!E)return null;try{return await l(E)}catch(P){return console.log(P),null}},[l]),[U,X]=m.useState(null);return m.useEffect(()=>{let E=!1;return X(null),Promise.resolve(q(A.item)).then(P=>{E||X(P)}).catch(()=>{E||X(null)}),()=>{E=!0}},[q,A.item]),o.jsx("div",{className:"wx-O0BTtRrH wx-wrapper",children:C&&C.length?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"wx-O0BTtRrH wx-preview",children:[o.jsxs("div",{className:"wx-O0BTtRrH wx-toolbar",children:[o.jsx("div",{className:"wx-O0BTtRrH wx-name",children:A.name}),o.jsxs("div",{className:"wx-O0BTtRrH wx-icons",children:[A.showDownloadIcon?o.jsx(Xi,{name:"download",onClick:L}):null,a?o.jsx(Xi,{name:"close",onClick:k}):null]})]}),A.previewSrc?o.jsx("div",{className:"wx-O0BTtRrH wx-img-wrapper",children:o.jsx("img",{src:A.previewSrc,alt:h("A miniature file preview")})}):A.iconSrc?o.jsx("div",{className:"wx-O0BTtRrH wx-icon-wrapper",children:o.jsx("img",{src:A.iconSrc,alt:h("A miniature file preview")})}):o.jsx("div",{className:"wx-O0BTtRrH wx-icon-wrapper",children:A.item?o.jsx("i",{className:`wx-O0BTtRrH wx-icon wxi-${A.item.type}`}):o.jsx("i",{className:`wx-O0BTtRrH wx-icon wxi-${M?"search":"file-multiple-outline"}`})})]}),o.jsxs("div",{className:"wx-O0BTtRrH wx-info-panel",children:[o.jsx("div",{className:"wx-O0BTtRrH wx-title",children:h(M?"Found":"Information")}),o.jsxs("div",{className:"wx-O0BTtRrH wx-list",children:[A.item?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"wx-O0BTtRrH wx-name",children:h("Type")}),o.jsx("span",{className:"wx-O0BTtRrH wx-value",children:T(A.item)}),typeof A.item.size<"u"?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"wx-O0BTtRrH wx-name",children:h("Size")}),o.jsx("span",{className:"wx-O0BTtRrH wx-value",children:Eo(A.item.size)})]}):null,o.jsx("span",{className:"wx-O0BTtRrH wx-name",children:h("Date")}),o.jsxs("span",{className:"wx-O0BTtRrH wx-value",children:[p(A.item.date)," "]})]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"wx-O0BTtRrH wx-name",children:h("Count")}),o.jsx("span",{className:"wx-O0BTtRrH wx-value",children:A.totalCount}),o.jsx("span",{className:"wx-O0BTtRrH wx-name",children:h("Type")}),o.jsx("span",{className:"wx-O0BTtRrH wx-value",children:A.type}),typeof A.totalSize<"u"?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"wx-O0BTtRrH wx-name",children:h("Size")}),o.jsx("span",{className:"wx-O0BTtRrH wx-value",children:Eo(A.totalSize)})]}):null]}),U?Object.entries(U).map(([E,P])=>o.jsxs(Nm.Fragment,{children:[o.jsx("span",{className:"wx-O0BTtRrH wx-name",children:E}),o.jsx("span",{className:"wx-O0BTtRrH wx-value",children:P})]},E)):null]})]})]}):o.jsxs("div",{className:"wx-O0BTtRrH wx-no-info-panel",children:[o.jsxs("div",{className:"wx-O0BTtRrH wx-toolbar",children:[o.jsx("div",{className:"wx-O0BTtRrH wx-name",children:A.name}),o.jsx("div",{className:"wx-O0BTtRrH wx-icons",children:a?o.jsx(Xi,{name:"close",onClick:k}):null})]}),o.jsx("div",{className:"wx-O0BTtRrH wx-no-info-wrapper",children:o.jsxs("div",{className:"wx-O0BTtRrH wx-no-info",children:[A.previewSrc?o.jsx("div",{className:"wx-O0BTtRrH wx-img-wrapper",children:o.jsx("img",{src:A.previewSrc,alt:h("A miniature file preview")})}):A.iconSrc?o.jsx("div",{className:"wx-O0BTtRrH wx-icon-wrapper",children:o.jsx("img",{src:A.iconSrc,alt:h("A miniature file preview")})}):o.jsx("div",{className:"wx-O0BTtRrH wx-icon-wrapper",children:o.jsx("i",{className:`wx-O0BTtRrH wx-icon wxi-${M?"search":"message-question-outline"}`})}),o.jsx("span",{className:"wx-O0BTtRrH wx-text",children:M?"":h("Select file or folder to view details")})]})})]})})}function ty({panel:a}){const l=m.useContext(nn),s=m.useContext(an.i18n),r=m.useMemo(()=>s.getGroup("filemanager"),[s]),[c,d]=Ca(l,"panels"),h=m.useMemo(()=>c[a]._files,[d,a]),p=m.useMemo(()=>c[a]._crumbs||[],[d,a]);function g(C){const j=Im(C,p);l.exec("set-path",{id:C,panel:a,...j&&{selected:[j]}})}const[x,y]=m.useState(null);m.useEffect(()=>{h&&y(null)},[h]);function v(){y(!0),l.exec("request-data",{id:p[p.length-1].id}),setTimeout(()=>{y(null)},5e3)}const w=m.useRef(null),M=m.useRef();return m.useEffect(()=>{M.current?M.current.click=g:(M.current={click:g},lr(w.current,M.current))},[g]),o.jsxs("div",{className:"wx-SNY5LTYx wx-breadcrumbs","data-menu-ignore":"true",ref:w,children:[o.jsx("div",{className:"wx-SNY5LTYx wx-refresh-icon",children:o.jsx(Xi,{name:"refresh",spin:!!x,onClick:v})}),p.map((C,j)=>o.jsxs(Nm.Fragment,{children:[j?o.jsx(Xi,{name:"angle-right"}):null,o.jsx("div",{className:"wx-SNY5LTYx wx-item","data-id":tn(C.id),"data-menu-ignore":"true",children:C.id=="/"?r(C.name):C.name})]},j))]})}function dM({row:a}){const l=m.useContext(an.i18n),[s]=m.useState(()=>l.getGroup("filemanager")),r=m.useContext(nn).templates,[c]=m.useState(()=>r.icon(a,"small"));return o.jsx("div",{className:"wx-qgAqG6sL wx-name-cell",children:a.id==="/wx-filemanager-parent-link"?o.jsxs(o.Fragment,{children:[o.jsx("i",{className:"wx-qgAqG6sL wxi-arrow-left"}),o.jsxs("span",{className:"wx-qgAqG6sL wx-name",children:[" ",s("Back to parent folder")]})]}):o.jsxs(o.Fragment,{children:[c?o.jsx("img",{className:"wx-qgAqG6sL wx-icon",alt:"",src:c,height:"24px",width:"24px"}):o.jsx("i",{className:`wx-qgAqG6sL wxi-${a.type}`}),o.jsxs("span",{className:"wx-qgAqG6sL wx-name",children:[" ",a.name," "]})]})})}function ny({children:a}){const l=m.useContext(nn),s=Ue(l,"activePanel"),r=m.useContext(qm),c=m.useRef(null);let d=m.useRef({});return d.current.drop=()=>{const h=c.current,p=hw(h,"data-panel");p&&p!=s&&l.exec("set-active-panel",{panel:p*1})},d.current.dragEnter=()=>{const h=c.current;h&&h.classList.toggle("wx-active")},d.current.dragLeave=()=>{const h=c.current;h&&h.classList.toggle("wx-active")},m.useEffect(()=>{const h=c.current;return r.droparea(h,d.current)},[]),o.jsx("div",{className:"wx-LT9X7tb7 wx-upload-area",ref:c,children:a})}function vm({panel:a,active:l=!1,onClick:s,onContextMenu:r}){const c=m.useContext(nn),d=m.useContext(an.i18n),h=m.useMemo(()=>d.getGroup("filemanager"),[d]),p=m.useMemo(()=>er("%d %M %Y",d.getRaw().calendar),[d]),[g]=Ca(c,"panels"),x=g[a].selected,y=g[a].path,v=g[a]._crumbs,w=g[a]._sorts,M=g[a]._selectNavigation,C=g[a]._files,j=m.useMemo(()=>[{id:"name",header:h("Name"),flexgrow:3,sort:!0,resize:!0,cell:dM},{id:"size",header:h("Size"),width:100,sort:!0,resize:!0,template:G=>typeof G=="number"?Eo(G):""},{id:"date",header:h("Date"),width:120,sort:!0,resize:!0,template:G=>G?p(G):""}],[h,p]),k=m.useRef(null),T=m.useRef(null),A=m.useMemo(()=>M?["/wx-filemanager-parent-link"]:[...x],[M,x]);function L(G,de){if(de&&de.target&&de.target.className&&de.target.className.indexOf("wx-grip")!==-1)return;const re=de&&(de.ctrlKey||de.metaKey),fe=de&&de.shiftKey;if(G==="/wx-filemanager-parent-link"){if(x.length&&(re||fe))return;c.exec("select-file",{type:"navigation"});return}let I=G==="body"&&de?null:G;!k.current&&!T.current?c.exec("select-file",{id:I,toggle:re,range:fe,panel:a}):(k.current=null,T.current=null)}function q(){v.length>1&&c.exec("set-path",{id:v[v.length-2].id,panel:a,selected:[v[v.length-1].id]})}function U(G){if(G==="/wx-filemanager-parent-link")return q();const de=C.find(re=>re.id===G);de&&(de.type==="folder"?c.exec("set-path",{id:de.id,panel:a}):c.exec("open-file",{id:de.id}))}function X(G){const de=G.key,re=w[y];let fe=re?"asc":"desc";re&&re.key===de&&(fe=re.order==="asc"?"desc":"asc"),c.exec("sort-files",{key:de,order:fe,panel:a,path:y})}function E(G){G.intercept("sort-rows",de=>(k.current=!0,X(de),!1)),G.intercept("select-row",()=>!1),G.on("resize-column",()=>T.current=!0),G.intercept("hotkey",()=>!1)}const P=m.useMemo(()=>y!=="/"?[{id:"/wx-filemanager-parent-link",name:h("Back to parent folder")},...C]:C,[y,C,h]),te=m.useMemo(()=>{if(P&&w&&w[y]){const{key:G,order:de}=w[y];return{[G]:{order:de}}}},[P,w,y]),B=m.useRef(null),ue=m.useRef();return m.useEffect(()=>{ue.current?(ue.current.click=L,ue.current._dblclick=U):(ue.current={click:L,dblclick:G=>ue.current._dblclick(G),_dblclick:U},lr(B.current,ue.current))},[L,U]),o.jsxs("div",{onClick:s,onContextMenu:r,className:"wx-SSaVhET7 wx-wrapper",children:[o.jsx(ty,{panel:a}),o.jsx("div",{"data-id":tn("body"),className:`wx-SSaVhET7 wx-list ${l?"wx-active":""}`,ref:B,children:o.jsx(ny,{children:o.jsx(sM,{init:E,data:P,columns:j,selectedRows:A,columnStyle:()=>"wx-SSaVhET7 wx-each-cell",sizes:{rowHeight:42,headerHeight:42},sortMarks:te})})})]})}function fM(){const a=m.useContext(nn),l=Ue(a,"activePanel");function s(r){a.exec("set-active-panel",{panel:r})}return o.jsxs("div",{className:"wx-L55BfJa2 wx-panels","data-id":tn("body"),children:[o.jsx("div",{className:"wx-L55BfJa2 wx-item","data-panel":0,children:o.jsx(vm,{panel:0,active:l==0,onClick:()=>s(0),onContextMenu:()=>s(0)})}),o.jsx("div",{className:"wx-L55BfJa2 wx-item","data-panel":1,children:o.jsx(vm,{panel:1,active:l==1,onClick:()=>s(1),onContextMenu:()=>s(1)})})]})}function ay({folderIcon:a=!1,folder:l={}}){const s=m.useContext(nn),[r,c]=Ca(s,"panels"),d=Ue(s,"activePanel"),h=m.useMemo(()=>r[d].path,[c,d]),p=m.useContext(an.i18n),g=m.useMemo(()=>p.getGroup("filemanager"),[p]),x=m.useMemo(()=>!!l.data?.find(M=>M.type==="folder"),[l]),y=m.useMemo(()=>l.id=="/"?g(l.name):l.name,[l,g]),v=m.useMemo(()=>l.$level>1?(l.$level-1)*20:0,[l]),w=l.open;return o.jsxs(o.Fragment,{children:[o.jsxs("li",{"data-id":tn(l.id),className:`wx-NYfhvGIt wx-folder${h===l.id?" wx-selected":""}`,style:{paddingLeft:`${v}px`},children:[x?o.jsx("i",{className:`wx-NYfhvGIt wx-toggle wxi-${w?"angle-down":"angle-right"}`,"data-action":"toggle"}):o.jsx("span",{className:"wx-NYfhvGIt wx-toggle-placeholder"}),o.jsx("i",{className:"wx-NYfhvGIt "+(a||"wxi-folder")}),o.jsxs("span",{className:"wx-NYfhvGIt wx-name",children:[" ",y," "]})]}),w&&l.data&&l.data.length&&x?o.jsx(o.Fragment,{children:l.data.map(M=>M.type==="folder"?o.jsx(ay,{folder:M},M.id):null)}):null]})}function mM(){const a=m.useContext(nn),[l,s]=Ca(a,"data"),[r,c]=Ca(a,"panels"),d=Ue(a,"activePanel"),h=m.useMemo(()=>r[d]._crumbs,[c,d]),p=m.useCallback(M=>{a.exec("open-tree-folder",{id:M,mode:!l.byId(M).open})},[a,s]),g=m.useCallback(M=>{const C=Im(M,h);a.exec("set-path",{id:M,panel:d,...C&&{selected:[C]}})},[a,h,d]),[x,y]=m.useState([]);m.useEffect(()=>{y(l.byId(0).data)},[s]);const v=m.useRef(null),w=m.useRef();return m.useEffect(()=>{w.current?(w.current.click=g,w.current.toggle=p):(w.current={click:g,toggle:p},lr(v.current,w.current))},[g,p]),o.jsx("ul",{ref:v,className:"wx-LyHJ6R6A",children:x.map(M=>M.type==="folder"?o.jsx(ay,{folder:M},M.id):null)})}function hM(){const a=m.useContext(nn),l=m.useContext(an.i18n),s=m.useMemo(()=>l.getGroup("filemanager"),[l]),r=Ue(a,"drive"),c=r?r.used:"",d=r?r.total:"";return c&&d?o.jsxs("div",{className:"wx-DetSyKGG wx-drive",children:[o.jsx("progress",{value:c,max:d,className:"wx-DetSyKGG wx-progress"}),o.jsxs("p",{children:[Eo(c)," ",s("of")," ",Eo(d)," ",s("used")]})]}):null}function pM({option:a}){const l=m.useContext(an.i18n).getGroup("filemanager"),s=m.useContext(qm),r=m.useCallback(()=>{s.open({})},[s]);return o.jsx("div",{className:"wx-9XiKcxq5 wx-upload-button",onClick:r,children:o.jsx("span",{children:l(a.text)})})}function gM({readonly:a,menuOptions:l}){const s=m.useContext(an.i18n).getGroup("filemanager"),{showPrompt:r}=m.useContext($m);m.useEffect(()=>{zS("upload",pM)},[]);function c({action:h}){h&&(h.id==="add-file"?r({item:{type:"file",size:0,date:new Date},add:!0}):h.id==="add-folder"&&r({item:{type:"folder",date:new Date},add:!0}))}const d=m.useMemo(()=>l("add").map(h=>(h.text=s(h.text),h)),[l,s]);return o.jsxs("div",{className:"wx-FlucfALM wx-wrapper",children:[!a&&o.jsx("div",{className:"wx-FlucfALM wx-button",children:o.jsx(OS,{options:d,at:"bottom-fit",onClick:c,children:o.jsx(Co,{type:"primary block",children:s("Add New")})})}),o.jsx("div",{className:"wx-FlucfALM wx-tree",children:o.jsx(mM,{})}),o.jsx(hM,{})]})}function xM({value:a="",onSearch:l}){const[s,r]=Bv(a),c=m.useContext(an.i18n).getGroup("filemanager"),d=m.useRef(null),h=m.useMemo(()=>s!==""?"wxi-close":"wxi-search",[s]);function p(x){const y=x.target.value;r(y),l&&l({value:y})}function g(){r(""),d.current&&d.current.focus(),l&&l({value:""})}return o.jsxs("div",{className:"wx-lUZMtgT1 wx-search-input",children:[o.jsx("i",{className:`wx-lUZMtgT1 wx-icon ${h}`,onClick:g}),o.jsx("input",{type:"text",className:"wx-lUZMtgT1 wx-text",ref:d,value:s,onInput:p,placeholder:c("Search")})]})}function vM({narrowMode:a=!1,onShowTree:l}){const s=m.useContext(nn),r=m.useContext(an.i18n).getGroup("filemanager"),c=Ue(s,"mode"),d=Ue(s,"preview"),h=Ue(s,"search"),p=[{icon:"wxi-view-sequential",id:"table"},{icon:"wxi-view-grid",id:"cards"},{icon:"wxi-view-column",id:"panels"}];function g({value:v}){s.exec("set-mode",{mode:v})}function x(v){v.preventDefault(),s.exec("show-preview",{mode:!d})}function y(v){s.exec("filter-files",{text:v.value})}return o.jsxs("div",{className:"wx-5PZQQztG wx-toolbar",children:[o.jsxs("div",{className:"wx-5PZQQztG wx-left "+(a?"wx-left-narrow":""),children:[a?c==="panels"||c==="search"?null:o.jsx("div",{className:"wx-5PZQQztG wx-sidebar-icon","data-id":tn("toggle-tree"),children:o.jsx(Xi,{onClick:()=>l&&l(),name:"subtask"})}):o.jsx("div",{className:"wx-5PZQQztG wx-name",children:r("Files")}),o.jsx(xM,{onSearch:y,value:h})]}),o.jsxs("div",{className:"wx-5PZQQztG wx-right",children:[a?null:o.jsx("div",{className:"wx-5PZQQztG wx-preview-icon",children:o.jsx(oS,{onClick:x,value:d,children:o.jsx("i",{className:"wx-5PZQQztG wxi-eye"})})}),o.jsx("div",{className:"wx-5PZQQztG wx-modes",children:o.jsx(nS,{value:c,options:p,onChange:g})})]})]})}function yM(){const a=m.useContext(nn),l=Ue(a,"activePanel");return o.jsxs("div",{className:"wx-NwohNJzN wx-wrapper",children:[o.jsx(ty,{panel:l}),o.jsx(ny,{children:o.jsx(ey,{})})]})}function bM({readonly:a=!1,menuOptions:l,extraInfo:s}){const r=m.useRef(null),c=m.useRef(null),[d,h]=m.useState(void 0),[p,g]=m.useState(void 0),[x,y]=m.useState(!1),v=Gv(),w=m.useContext(nn),{showPrompt:M,showConfirm:C}=m.useContext($m),j=m.useContext(an.i18n),k=m.useMemo(()=>j.getGroup("filemanager"),[j]),T=Ue(w,"mode"),A=Ue(w,"preview"),L=Ue(w,"activePanel"),[q,U]=Ca(w,"panels"),X=m.useMemo(()=>(q&&L!=null?q[L]:null)?.selected??[],[U,L]),E=m.useMemo(()=>(q&&L!=null?q[L]:null)?.path,[U,L]),[P,te]=m.useState([]);m.useEffect(()=>{const ae=r.current;if(!ae)return;const me=new ResizeObserver(z=>{const ge=z[0]?.borderBoxSize?.[0]?.inlineSize;typeof ge=="number"&&g(ge<768)});return me.observe(ae),()=>{me.disconnect()}},[]);const B=m.useCallback(()=>{y(ae=>!ae)},[]),ue=m.useCallback(ae=>{p&&ko(ae)!=="toggle-tree"&&y(!1)},[p]);m.useEffect(()=>{const ae=c.current;if(ae)return Ja(ae,ue).destroy},[ue]),m.useEffect(()=>{const ae=c.current;if(!ae)return;const me=new ResizeObserver(()=>{ae&&h(ae.clientWidth)});return me.observe(ae),ae&&h(ae.clientWidth),()=>{me.disconnect()}},[]);const G=m.useMemo(()=>({icon:"wxi-eye",text:"Preview",id:"preview"}),[]),de=m.useCallback(ae=>{let me=p?[G]:[];return ae==="file"&&(me=[...me,...l().filter(z=>z.id==="download")]),me},[p,G,l]),re=m.useRef(null),fe=m.useCallback((ae,me,z)=>{const ge=z?[me.id]:X;switch(ae){case"download":w.exec("download-file",{id:me.id});break;case"copy":case"move":re.current={action:ae,ids:ge};break;case"paste":re.current&&w.exec(re.current.action==="copy"?"copy-files":"move-files",{ids:re.current.ids,target:me?.type==="folder"?me.id:E});break;case"rename":M({item:me});break;case"delete":C({selected:ge});break;case"preview":w.exec("show-preview",{mode:!A});break}},[w,X,E,M,C,A]),I=m.useCallback(()=>q?.[L],[q,L]);m.useEffect(()=>{const ae=r.current;if(!ae)return;const me=MS(ae,{api:w,menuOptions:a?de:l,performAction:fe,getPanel:I});return()=>{typeof me=="function"?me():me&&typeof me.destroy=="function"&&me.destroy()}},[w,a,de,l,fe,I]);const Z=m.useCallback((ae,me)=>{const z=ae?w.getFile(ae):null,ge=me.target.closest(".tree-item.folder");let be;if(a)be=de(z?.type);else{switch(ae){case"body":be=l(ae);break;default:if(z)if(!ge&&X.length>1)be=p?[G,...l("multiselect")]:l("multiselect");else if(ae==="/")be=l("folder",z).filter(Me=>Me.id==="paste");else{const Me=l(z.type,z);Me&&(be=p?[G,...Me]:Me)}}T==="search"&&(be=be?.filter(Me=>Me.id!=="paste"))}if(z?.id&&(!X.length||!X.some(Me=>Me===z.id))&&!ge&&w.exec("select-file",{id:z.id}),be?.length)return be.forEach(Me=>{ge&&(Me.hotkey=""),Me.text&&(Me.text=k(Me.text)),Me.hotkey&&(Me.subtext=Me.hotkey)}),te(be),z||{}},[w,a,de,l,X,p,G,T,k]),ee=m.useCallback(ae=>{const{action:me,context:z}=ae;me&&fe(me.id,z,!me.hotkey)},[fe]);async function _(ae){await Promise.resolve();const{name:me,size:z}=ae.file;w.exec("create-file",{file:{name:me,size:z,date:new Date,file:ae.file},parent:E})}return o.jsx("div",{className:"wx-RJbNonjJ wx-filemanager wx-flex",ref:r,"data-menu-ignore":"false",children:p&&A?o.jsx("div",{className:"wx-RJbNonjJ wx-info-narrow",children:o.jsx(Pf,{narrowMode:p,extraInfo:s})}):o.jsxs(o.Fragment,{children:[o.jsx(vM,{narrowMode:p,onShowTree:B}),o.jsx(BS,{dataKey:"id",at:"point",options:P,resolver:Z,onClick:ee,children:o.jsxs(qv,{dataKey:"actionId",options:P,resolver:Z,onClick:ee,children:[o.jsx($S,{data:v,apiOnly:!0,uploadURL:_}),o.jsx(qm.Provider,{value:v,children:o.jsx("div",{className:"wx-RJbNonjJ wx-content-wrapper wx-flex",children:T!=="panels"&&T!=="search"?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"wx-RJbNonjJ "+["wx-sidebar",p?"wx-sidebar-narrow":"",x?"wx-sidebar-visible":""].filter(Boolean).join(" "),ref:c,children:o.jsx(gM,{readonly:a,menuOptions:l})}),o.jsxs("div",{className:"wx-RJbNonjJ wx-content",style:{width:`calc(100% - ${d||0}px - 10px)`},children:[o.jsx("div",{className:`wx-RJbNonjJ wx-content-item${A?"":"-fit"}`,"data-id":tn("body"),children:T==="table"?o.jsx(vm,{panel:L}):o.jsx(yM,{})}),A?o.jsx("div",{className:"wx-RJbNonjJ wx-info",children:o.jsx(Pf,{extraInfo:s})}):null]})]}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`wx-RJbNonjJ wx-content-item${A?"":"-fit"}`,children:T==="panels"?o.jsx(fM,{}):o.jsx(uM,{})}),A?o.jsx("div",{className:"wx-RJbNonjJ wx-info",children:o.jsx(Pf,{extraInfo:s})}):null]})})})]})})]})})}const wM=a=>a.split("-").map(l=>l?l.charAt(0).toUpperCase()+l.slice(1):"").join("");function SM(a,l){const{type:s,ext:r}=a;if(s==="folder")return!1;let c;return s&&s!=="file"&&Bx[s]?c=s:r?c=Bx[r]?r:"file":c="unknown",`https://cdn.svar.dev/icons/filemanager/vivid/${l}/${c}.svg`}const MM=m.forwardRef(function(a,l){const{data:s=[],mode:r="cards",drive:c=null,preview:d=!1,panels:h=null,activePanel:p=0,readonly:g=!1,menuOptions:x=bS,extraInfo:y=null,init:v=null,icons:w=SM,previews:M=null,...C}=a,j=m.useRef();j.current=C;const k=m.useMemo(()=>new yS(Fv),[]),T=m.useMemo(()=>k.in,[k]),A=m.useRef(null);A.current===null&&(A.current=new Lv((U,X)=>{const E="on"+wM(U);j.current&&j.current[E]&&j.current[E](X)}),T.setNext(A.current));const L=m.useMemo(()=>({getState:k.getState.bind(k),getReactiveState:k.getReactive.bind(k),getStores:()=>({data:k}),exec:T.exec,setNext:U=>(A.current=A.current.setNext(U),A.current),intercept:T.intercept.bind(T),on:T.on.bind(T),detach:T.detach.bind(T),getFile:k.getFile.bind(k),serialize:k.serialize.bind(k),templates:{preview:M||(()=>null),icon:w==="simple"?(()=>null):w}}),[k,T]),q=m.useRef(0);return m.useEffect(()=>{if(!q.current)v&&v(L);else{const U=k.getState();k.init({data:s,mode:r,drive:c,preview:d,panels:h||U.panels||[],activePanel:p})}q.current++},[k,s,r,c,d,h,p,v,L]),q.current===0&&k.init({data:s,mode:r,drive:c,preview:d,panels:h||[],activePanel:p}),m.useImperativeHandle(l,()=>({...L}),[L]),o.jsx(nn.Provider,{value:L,children:o.jsx(Hm,{words:Fm,optional:!0,children:o.jsx(rM,{children:o.jsx(bM,{readonly:g,menuOptions:x,extraInfo:y})})})})});function CM({fonts:a=!0,children:l}){return l?o.jsx(Sx,{fonts:a,children:l}):o.jsx(Sx,{fonts:a})}Dm(Vn);function Gm(a,l){if(!a||typeof a!="object"||Array.isArray(a))throw new Error(`Invalid Hub ${l} response.`);return a}function Lo(a,l,s){const r=Gm(a,s);if(!Array.isArray(r[l]))throw new Error(`Invalid Hub ${s} response: ${l} must be an array.`);return r[l]}function jM(a,l,s){const r=Gm(a,s);if(!r[l]||typeof r[l]!="object"||Array.isArray(r[l]))throw new Error(`Invalid Hub ${s} response: ${l} must be an object.`);return r[l]}async function Hx(a,l=!1){return Lo(await ct(`/api/remote/filesystem/roots${l?"?refresh=1":""}`,void 0,a),"roots","filesystem roots")}async function Yf(a,l){const s=await ct(`/api/remote/filesystem/entries?id=${encodeURIComponent(a)}`,void 0,l);return{folder:jM(s,"folder","filesystem entries"),entries:Lo(s,"entries","filesystem entries")}}async function NM(a,l){return ct("/api/remote/filesystem/selection/scan",{method:"POST",body:JSON.stringify({itemIds:a})},l)}async function AM(a,l,s,r){return ct("/api/remote/files/from-hub",{method:"POST",body:JSON.stringify({itemIds:a,deviceIds:l,remoteDirectory:s})},r)}async function TM(a,l=!1){const s=await ct(`/api/remote/files/jobs?active=${l?"1":"0"}`,void 0,a);return{jobs:Lo(s,"jobs","file transfer jobs")}}async function kM(a,l){return ct(`/api/remote/files/jobs/${encodeURIComponent(a)}`,void 0,l)}async function EM(a,l){return ct(`/api/remote/files/jobs/${encodeURIComponent(a)}/cancel`,{method:"POST"},l)}async function Fx(a){return Lo(await ct("/api/remote/filesystem/shared-folders",void 0,a),"folders","shared folders")}async function DM(a,l){return ct("/api/remote/filesystem/shared-folders",{method:"POST",body:JSON.stringify({sourceId:a})},l)}async function RM(a,l,s){return ct(`/api/remote/filesystem/shared-folders/${encodeURIComponent(a)}`,{method:"PATCH",body:JSON.stringify(l)},s)}async function LM(a,l){return ct(`/api/remote/filesystem/shared-folders/${encodeURIComponent(a)}`,{method:"DELETE"},l)}async function zM(a,l,s,r){const c=await ct(`/api/remote/filesystem/shared-folders/${encodeURIComponent(a)}/sync`,{method:"POST",body:JSON.stringify({deviceIds:l,remoteDirectory:s})},r),d=Gm(c,"shared folder sync");return{ok:d.ok===!0,jobs:Lo(c,"jobs","shared folder sync"),files:Number(d.files||0),totalBytes:Number(d.totalBytes||0)}}function _M(a){return{id:String(a.id),parentId:a.parent,name:a.name,type:a.type==="file"?"file":"folder",size:Number(a.size||0),modifiedAt:a.date?.toISOString()||null,displayPath:String(a.displayPath||a.name),hasChildren:a.lazy===!0||!!a.data?.length,locked:a.locked===!0}}function Ix(a){if(!Number.isFinite(a)||a<=0)return"0 B";const l=["B","KB","MB","GB","TB"];let s=a,r=0;for(;s>=1024&&r<l.length-1;)s/=1024,r+=1;return`${s.toFixed(r===0||s>=100?0:1)} ${l[r]}`}function gu(a){return a.driveType==="network"?"network":a.driveType==="removable"?"removable":"local"}function OM(a){const l=a.filter(s=>gu(s)==="local");return l.find(s=>/\bC:/i.test(`${s.name} ${s.displayPath||""}`))||l[0]||a[0]||null}function BM({hubUrl:a,roots:l,loading:s,error:r,onRefreshRoots:c,onImportFiles:d,onImportFolder:h,onSelectionChange:p,onShareItem:g,onAddSyncFolder:x,onNotice:y}){const v=m.useRef(null),w=m.useRef("/"),M=m.useRef(0),C=m.useRef([]),j=m.useRef(new Map),[k,T]=m.useState(null),[A,L]=m.useState([]),[q,U]=m.useState([]),[X,E]=m.useState(0),[P,te]=m.useState(null),[B,ue]=m.useState(!1),[G,de]=m.useState(""),[re,fe]=m.useState(new Set),I=l.find(ie=>ie.id===k)||null,Z=A[A.length-1]||null,ee=I?Z?.svarPath||`/${I.name}`:null,_=ee;m.useEffect(()=>{C.current=A,w.current=_||"/"},[_,A]);const ae=m.useMemo(()=>(j.current.clear(),!I||!_||A.length===0?[]:(A.forEach(ie=>j.current.set(ie.svarPath,ie.hubId)),[...A.map((ie,ve)=>({id:ie.svarPath,parent:ve===0?"/":A[ve-1].svarPath,type:"folder",name:ie.name,date:ie.modifiedAt?new Date(ie.modifiedAt):void 0,lazy:!1})),...q.map(ie=>{const ve=`${_}/${ie.name}`;return j.current.set(ve,ie.id),{id:ve,parent:_,name:ie.name,type:ie.type==="file"?"file":"folder",...ie.type==="file"?{size:ie.size}:{},date:ie.modifiedAt?new Date(ie.modifiedAt):void 0,lazy:ie.type!=="file"&&ie.hasChildren===!0,displayPath:ie.displayPath,locked:ie.locked,driveType:ie.driveType,totalBytes:ie.totalBytes,freeBytes:ie.freeBytes}})])),[I,q,_,A]),me=ie=>j.current.get(String(ie))||String(ie),z=ie=>_M({...ie,id:me(String(ie.id)),parent:me(String(ie.parent))}),ge=async(ie,ve)=>{const Te=ie[ie.length-1];if(!Te)return;const De=++M.current;ue(!0),de("");try{const se=await Yf(Te.hubId,a);if(De!==M.current)return;if(!Array.isArray(se.entries))throw new Error("Invalid Hub filesystem entries response.");const et={...Te,displayPath:se.folder.displayPath||Te.displayPath,modifiedAt:se.folder.modifiedAt||Te.modifiedAt},Ce=[...ie.slice(0,-1),et];C.current=Ce,L(Ce),U(se.entries),E(It=>It+1)}catch(se){if(De!==M.current)return;console.error("[LiveDesk FS] folder navigation failed",{folderId:Te.hubId,error:se}),de(se instanceof Error?`${ve}: ${se.message}`:`${ve}: Unable to read this folder.`)}finally{De===M.current&&ue(!1)}},be=async ie=>{const ve={svarPath:`/${ie.name}`,hubId:ie.id,name:ie.name,displayPath:ie.displayPath,modifiedAt:ie.modifiedAt},Te=++M.current;T(ie.id),C.current=[ve],L([ve]),w.current=ve.svarPath,U([]),de(""),ue(!0),te(ie.id),fe(De=>{const se=new Set(De);return se.delete(ie.id),se});try{const De=await Yf(ie.id,a);if(Te!==M.current)return;if(!Array.isArray(De.entries))throw new Error("Invalid Hub filesystem entries response.");const se={...ve,displayPath:De.folder.displayPath||ve.displayPath,modifiedAt:De.folder.modifiedAt||ve.modifiedAt};C.current=[se],L([se]),U(De.entries),E(et=>et+1)}catch(De){if(Te!==M.current)return;console.error("[LiveDesk FS] getEntries failed",{rootId:ie.id,error:De}),fe(se=>new Set(se).add(ie.id)),de(De instanceof Error?`${ie.name}: ${De.message}`:`${ie.name}: Unable to read this drive.`),y(De instanceof Error?`${ie.name}: ${De.message}`:`${ie.name}: Unable to read this drive.`)}finally{Te===M.current&&(te(null),ue(!1))}},Me=ie=>{const ve=C.current;ie<0||ie>=ve.length||ie===ve.length-1||ge(ve.slice(0,ie+1),ve[ie].name)},Fe=(ie,ve)=>{if(ie.type!=="folder")return;const Te=C.current,De=Te.findIndex(et=>et.svarPath===ve);if(De<0)return;const se={svarPath:`${ve}/${ie.name}`,hubId:ie.id,name:ie.name,displayPath:ie.displayPath,modifiedAt:ie.modifiedAt};ge([...Te.slice(0,De+1),se],ie.name)},Ve=()=>Me(C.current.length-2),Le=ie=>{if(ie.key!=="Enter"&&ie.code!=="Enter"&&ie.code!=="NumpadEnter"||ie.target?.closest('button, input, textarea, [contenteditable="true"]'))return;const Te=v.current;if(!Te)return;const De=Te.getState().panels?.flatMap(et=>et.selected||[])||[];if(De.length!==1)return;const se=Te.getFile(String(De[0]));se?.type==="folder"&&(ie.preventDefault(),ie.stopPropagation(),Fe(z(se),String(se.parent||w.current)))};m.useEffect(()=>{const ie=l.find(ve=>ve.id===k)||OM(l);if(fe(ve=>new Set([...ve].filter(Te=>l.some(De=>De.id===Te)))),!ie){T(null),C.current=[],L([]),U([]);return}be(ie)},[l]);const Ee=ie=>{v.current=ie,ie.on("request-data",async({id:ve})=>{const Te=String(ve),De=me(Te);try{const se=await Yf(De,a);if(!Array.isArray(se.entries))throw new Error("Invalid Hub filesystem entries response.");const et=se.entries.map(Ce=>{const It=`${Te}/${Ce.name}`;return j.current.set(It,Ce.id),{id:It,parent:Te,name:Ce.name,type:Ce.type==="file"?"file":"folder",...Ce.type==="file"?{size:Ce.size}:{},date:Ce.modifiedAt?new Date(Ce.modifiedAt):void 0,lazy:Ce.type!=="file"&&Ce.hasChildren===!0,displayPath:Ce.displayPath,locked:Ce.locked,driveType:Ce.driveType,totalBytes:Ce.totalBytes,freeBytes:Ce.freeBytes}});await ie.exec("provide-data",{id:Te,data:et})}catch(se){console.error("[LiveDesk FS] nested getEntries failed",{id:De,error:se}),y(se instanceof Error?se.message:"Unable to read this folder.")}}),ie.intercept("set-path",({id:ve})=>{const Te=String(ve),De=C.current.findIndex(et=>et.svarPath===Te);if(De>=0)return Me(De),!1;const se=ie.getFile(Te);if(se?.type==="folder")return Fe(z(se),String(se.parent||w.current)),!1}),ie.intercept("open-file",()=>!1),ie.on("select-file",()=>{window.setTimeout(()=>{const De=(ie.getState().panels?.flatMap(se=>se.selected||[])||[]).map(se=>ie.getFile(se)).filter(Boolean).map(se=>z(se));p(De.map(se=>se.id),De)},0)})},qe=(ie,ve)=>{const Te=ve?z(ve):null,De=()=>{const se=Te?.type==="file"?String(ve?.parent||w.current):String(ve?.id||w.current);v.current?.exec("request-data",{id:se})};return ie==="body"?[{id:"refresh",text:"Refresh",icon:"mdi mdi-refresh",handler:De},{id:"properties",text:"Properties",icon:"mdi mdi-information-outline",handler:()=>y("Select a file or folder to view its properties.")}]:ie==="multiselect"?[{id:"share",text:"Share to workstations",icon:"mdi mdi-share-variant",handler:()=>{(v.current?.getState().panels?.flatMap(et=>et.selected||[])||[]).forEach(et=>{const Ce=v.current?.getFile(et);Ce&&g(z(Ce))})}},{id:"refresh",text:"Refresh",icon:"mdi mdi-refresh",handler:De}]:Te?[{id:"share",text:"Share to workstations",icon:"mdi mdi-share-variant",handler:()=>g(Te)},...Te.type==="folder"?[{id:"sync",text:"Add folder to Sync",icon:"mdi mdi-folder-sync-outline",handler:()=>x(Te)}]:[],{id:"copy-path",text:"Copy path",icon:"mdi mdi-content-copy",handler:()=>{Vi(Te.displayPath||Te.name)}},{id:"refresh",text:"Refresh",icon:"mdi mdi-refresh",handler:De},{id:"properties",text:"Properties",icon:"mdi mdi-information-outline",handler:()=>y(`${Te.name}
12
+ ${Te.displayPath||""}`)}]:[]},ke=async()=>{try{await c()}catch(ie){y(ie instanceof Error?ie.message:"Unable to refresh Hub drives.")}},gt=[{id:"local",label:"Local drives",icon:po,roots:l.filter(ie=>gu(ie)==="local")},{id:"removable",label:"Removable drives",icon:Ob,roots:l.filter(ie=>gu(ie)==="removable")},{id:"network",label:"Network drives",icon:rv,roots:l.filter(ie=>gu(ie)==="network")}];return o.jsxs("section",{className:"hub-file-explorer-panel","aria-label":"Hub file explorer",children:[o.jsxs("div",{className:"hub-file-explorer-heading",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Hub file explorer"}),o.jsxs("strong",{children:[o.jsx(po,{size:16})," Browse files on this Hub"]})]}),o.jsxs("div",{className:"hub-file-explorer-heading-actions",children:[o.jsx("button",{className:"icon-button",onClick:d,title:"Import files from this browser",type:"button",children:o.jsx(ov,{size:16})}),o.jsx("button",{className:"icon-button",onClick:h,title:"Import folder from this browser",type:"button",children:o.jsx(Bb,{size:16})}),o.jsx("button",{className:"icon-button",onClick:()=>{ke()},title:"Refresh drives",type:"button",children:o.jsx(Du,{size:16})})]})]}),s?o.jsxs("div",{className:"hub-file-explorer-state",children:[o.jsx(po,{size:24}),o.jsx("strong",{children:"Connecting to LiveDesk Hub file system..."})]}):r?o.jsxs("div",{className:"hub-file-explorer-state error",role:"alert",children:[o.jsx(lm,{size:24}),o.jsx("strong",{children:r})]}):o.jsxs("div",{className:"hub-file-explorer-content",children:[o.jsxs("aside",{className:"hub-file-explorer-drive-sidebar","aria-label":"Hub drives",children:[o.jsxs("div",{className:"hub-drive-sidebar-title",children:[o.jsx(po,{size:15}),o.jsx("strong",{children:"This PC"})]}),gt.map(ie=>ie.roots.length>0&&o.jsxs("section",{className:"hub-drive-group",children:[o.jsxs("h3",{children:[o.jsx(ie.icon,{size:13}),ie.label]}),o.jsx("div",{className:"hub-drive-list",children:ie.roots.map(ve=>{const Te=ie.icon,De=re.has(ve.id)||ve.locked===!0;return o.jsxs("button",{className:`hub-drive-item ${k===ve.id?"active":""} ${De?"unavailable":""}`,onClick:()=>{be(ve)},"aria-pressed":k===ve.id,type:"button",children:[o.jsx("span",{className:"hub-drive-item-icon",children:o.jsx(Te,{size:16})}),o.jsxs("span",{className:"hub-drive-item-copy",children:[o.jsx("strong",{children:ve.name}),o.jsx("small",{children:ve.displayPath||ve.name}),o.jsxs("em",{children:[Ix(ve.freeBytes||0)," free / ",Ix(ve.totalBytes||0)]})]}),P===ve.id?o.jsx(bu,{className:"hub-drive-item-status spin",size:15}):De?o.jsx(qg,{className:"hub-drive-item-status",size:15}):null]},ve.id)})})]},ie.id)),l.length===0&&o.jsxs("div",{className:"hub-drive-sidebar-empty",children:[o.jsx(lm,{size:17}),o.jsx("span",{children:"No drives available."})]})]}),o.jsxs("div",{className:"hub-file-explorer-browser",children:[o.jsxs("div",{className:"hub-file-explorer-navigation",children:[o.jsx("nav",{className:"hub-file-explorer-breadcrumbs","aria-label":"Current Hub folder",children:A.map((ie,ve)=>o.jsxs("span",{className:"hub-file-explorer-breadcrumb-item",children:[ve>0&&o.jsx(Am,{size:13,"aria-hidden":"true"}),o.jsx("button",{className:`hub-file-explorer-breadcrumb ${ve===A.length-1?"current":""}`,onClick:()=>Me(ve),"aria-current":ve===A.length-1?"location":void 0,type:"button",children:ie.name})]},ie.svarPath))}),o.jsxs("div",{className:"hub-file-explorer-navigation-actions",children:[B&&o.jsx(bu,{className:"hub-file-explorer-loading-icon spin",size:15,"aria-label":"Loading folder"}),o.jsx("button",{className:"icon-button",onClick:Ve,disabled:A.length<=1||B,title:"Back to parent folder",type:"button",children:o.jsx(Hb,{size:16})})]})]}),G&&o.jsxs("div",{className:"hub-file-explorer-folder-error",role:"alert",children:[o.jsx(qg,{size:15}),o.jsx("span",{children:G})]}),o.jsx("div",{className:"hub-file-explorer-svar",onKeyDownCapture:Le,children:o.jsx(CM,{fonts:!1,children:o.jsx(MM,{data:ae,panels:ee?[{path:ee,selected:[]}]:void 0,readonly:!0,mode:"table",preview:!1,init:Ee,icons:"simple",menuOptions:qe},`${I?.id||"no-root"}:${X}`)})})]})]})]})}class HM extends m.Component{state={error:null};static getDerivedStateFromError(l){return{error:l}}componentDidCatch(l,s){console.error("[LiveDesk] Share Files runtime error",l,s.componentStack)}render(){return this.state.error?o.jsxs("section",{className:"file-share-error-boundary",role:"alert",children:[o.jsx(Fb,{size:24}),o.jsx("strong",{children:"Share Files could not be opened."}),o.jsx("span",{children:this.state.error.message||"An unexpected file explorer error occurred."}),o.jsxs("button",{className:"text-button",onClick:this.props.onRetry,type:"button",children:[o.jsx(Du,{size:15})," Retry"]})]}):this.props.children}}function FM(a){return a.deviceName||a.hostname||a.deviceId}function IM({devices:a,mode:l,selectedIds:s,onModeChange:r,onToggle:c}){const d=new Set(s);return o.jsxs("section",{className:"distribution-targets",children:[o.jsxs("div",{className:"file-share-section-heading",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Target"}),o.jsx("strong",{children:l==="all"?`${a.length} connected`:`${s.length} selected`})]}),o.jsxs("div",{className:"file-share-tabs compact","aria-label":"File transfer targets",children:[o.jsxs("button",{className:l==="all"?"active":"",onClick:()=>r("all"),type:"button",children:[o.jsx(cv,{size:14})," All connected"]}),o.jsxs("button",{className:l==="selected"?"active":"",onClick:()=>r("selected"),type:"button",children:[o.jsx(_a,{size:14})," Selected"]})]})]}),o.jsx("div",{className:"file-share-device-list","aria-label":"Connected workstation targets",children:a.length===0?o.jsx("div",{className:"file-share-empty-inline",children:"No connected workstations."}):a.map(h=>{const p=l==="all"||d.has(h.deviceId);return o.jsxs("label",{className:`file-share-device-option ${p?"selected":""}`,children:[o.jsx("input",{type:"checkbox",checked:p,disabled:l==="all",onChange:()=>c(h.deviceId)}),o.jsx(_a,{size:20,"aria-hidden":"true"}),o.jsxs("span",{children:[o.jsx("strong",{children:FM(h)}),o.jsxs("small",{children:["Slot ",h.slotNumber?String(h.slotNumber).padStart(3,"0"):"-"," / ",h.platform||"unknown OS"]})]}),o.jsx(Sa,{size:17,"aria-hidden":"true"})]},h.deviceId)})})]})}function UM(a){if(!Number.isFinite(a)||a<=0)return"0 B";const l=["B","KB","MB","GB","TB"];let s=a,r=0;for(;s>=1024&&r<l.length-1;)s/=1024,r+=1;return`${s.toFixed(r===0||s>=100?0:1)} ${l[r]}`}function $M({folders:a,loading:l,busy:s,canSync:r,onSyncAll:c,onSync:d,onToggleAuto:h,onRemove:p,onAdd:g}){return o.jsxs("section",{className:"file-share-sync-panel",children:[o.jsxs("div",{className:"file-share-section-heading",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Hub folders"}),o.jsx("strong",{children:"Continuous sync"})]}),o.jsxs("button",{className:"text-button compact",onClick:c,disabled:s||!r||a.length===0,type:"button",children:[o.jsx(du,{size:15})," ",s?"Syncing":"Sync all"]})]}),l?o.jsx("div",{className:"file-share-empty-state",children:"Loading Hub sync folders..."}):a.length===0?o.jsxs("button",{className:"file-share-empty-state interactive",onClick:g,type:"button",children:[o.jsx(du,{size:28}),o.jsx("strong",{children:"Add a selected Hub folder"}),o.jsx("span",{children:"Hub keeps the manifest and can sync while this browser is closed."})]}):o.jsx("div",{className:"file-share-sync-list",children:a.map(x=>o.jsxs("article",{className:`file-share-sync-row state-${x.status}`,children:[o.jsx("div",{className:"file-share-sync-icon",children:o.jsx(du,{size:19})}),o.jsxs("div",{className:"file-share-sync-info",children:[o.jsx("strong",{children:x.name}),o.jsx("span",{children:x.displayPath}),o.jsxs("small",{children:[x.fileCount," files / ",UM(x.totalBytes)," · ",x.lastSyncedAt?`Last sync ${mm(x.lastSyncedAt)} ago`:x.message||"Not synced yet"]})]}),o.jsxs("label",{className:"file-share-auto-sync",children:[o.jsx("input",{type:"checkbox",checked:x.autoSync,onChange:()=>h(x)}),o.jsx("span",{children:"Auto"})]}),o.jsxs("button",{className:"text-button compact",onClick:()=>d(x),disabled:s||!r||x.status==="syncing",type:"button",children:[o.jsx(Du,{size:14})," Sync now"]}),o.jsx("button",{className:"icon-button",onClick:()=>p(x),title:"Remove sync folder",type:"button",children:o.jsx(Ib,{size:15})})]},x.id))})]})}function qM(a){const s=(a.targetMode==="all"?a.devices.map(r=>r.deviceId):a.selectedTargetIds).length>0;return o.jsxs("aside",{className:"file-share-distribution-panel",children:[o.jsxs("div",{className:"file-share-distribution-head",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Distribution"}),o.jsx("strong",{children:"Hub → workstations"})]}),o.jsx(wu,{size:18})]}),o.jsxs("div",{className:"file-share-tabs",role:"tablist","aria-label":"Distribution mode",children:[o.jsx("button",{className:a.tab==="send"?"active":"",onClick:()=>a.onTabChange("send"),role:"tab","aria-selected":a.tab==="send",type:"button",children:"Send"}),o.jsx("button",{className:a.tab==="sync"?"active":"",onClick:()=>a.onTabChange("sync"),role:"tab","aria-selected":a.tab==="sync",type:"button",children:"Sync"})]}),a.tab==="send"?o.jsxs(o.Fragment,{children:[o.jsx(IM,{devices:a.devices,mode:a.targetMode,selectedIds:a.selectedTargetIds,onModeChange:a.onTargetModeChange,onToggle:a.onTargetToggle}),o.jsxs("label",{className:"file-share-destination",children:[o.jsx("span",{children:"Destination folder"}),o.jsxs("div",{children:[o.jsx(bo,{size:15}),o.jsx("input",{value:a.remoteDirectory,onChange:r=>a.onRemoteDirectoryChange(r.target.value),placeholder:"Desktop/LiveDeskFiles"})]}),o.jsx("small",{children:"Blank uses Desktop/LiveDeskFiles."})]}),o.jsxs("div",{className:"file-share-selection-summary",children:[o.jsx("span",{children:"Selected"}),o.jsx("strong",{children:a.selectedSummary})]}),o.jsxs("button",{className:"file-share-share-button",onClick:a.onShare,disabled:!a.canShare,type:"button",children:[o.jsx(wu,{size:17})," Share selected"]}),o.jsxs("button",{className:"file-share-secondary-button",onClick:a.onAddSync,disabled:!a.canAddSync,type:"button",children:[o.jsx(bo,{size:16})," Add selected folder to Sync"]})]}):o.jsx($M,{folders:a.folders,loading:a.foldersLoading,busy:a.syncBusy,canSync:s,onSyncAll:a.onSyncAll,onSync:a.onSync,onToggleAuto:a.onToggleAuto,onRemove:a.onRemove,onAdd:a.onAddFolder})]})}function GM(a){if(!Number.isFinite(a)||a<=0)return"0 B";const l=["B","KB","MB","GB","TB"];let s=a,r=0;for(;s>=1024&&r<l.length-1;)s/=1024,r+=1;return`${s.toFixed(r===0||s>=100?0:1)} ${l[r]}`}function Ux(a){return a.totalBytes>0?Math.max(0,Math.min(100,Math.round(a.sentBytes/a.totalBytes*100))):a.totalFiles>0?Math.max(0,Math.min(100,Math.round(a.completedFiles/a.totalFiles*100))):a.state==="completed"?100:0}function $x(a){return a.state==="scanning"?"Scanning selected Hub items":a.state==="queued"?"Preparing transfer":a.state==="sending"?`${a.completedFiles}/${a.totalFiles} · ${a.currentPath||"sending"}`:a.state==="completed"?`Sent ${a.totalFiles} file${a.totalFiles===1?"":"s"} to ${a.targetCount} workstation${a.targetCount===1?"":"s"}`:a.state==="partially-failed"?`${a.failedTargets.length} workstation${a.failedTargets.length===1?"":"s"} failed`:a.state==="cancelled"?"Transfer cancelled":a.error||"Transfer failed"}function qx(a){return["completed","partially-failed","failed","cancelled"].includes(a)}function PM({hubUrl:a,devices:l,localFeatureAccess:s,upgradeNotice:r,notice:c,remoteDirectory:d,onRemoteDirectoryChange:h,targetMode:p,selectedTargetIds:g,onTargetModeChange:x,onTargetToggle:y,filePickerRef:v,folderPickerRef:w,onBrowserFileImport:M,onBrowserFolderImport:C,onNotice:j,onTransferChange:k}){const T=Array.isArray(l)?l:[],[A,L]=m.useState([]),[q,U]=m.useState(!0),[X,E]=m.useState(""),[P,te]=m.useState([]),[B,ue]=m.useState([]),[G,de]=m.useState(null),[re,fe]=m.useState(!1),[I,Z]=m.useState([]),[ee,_]=m.useState(!0),[ae,me]=m.useState(!1),[z,ge]=m.useState("send"),[be,Me]=m.useState([]),Fe=m.useRef(new Set),Ve=m.useMemo(()=>p==="all"?T.map(xe=>xe.deviceId):g.filter(xe=>T.some(He=>He.deviceId===xe)),[T,g,p]),Le=be.find(xe=>!qx(xe.state)),Ee=B.length===1&&B[0].type==="folder"?B[0]:null,qe=B.length===0?"Select files or folders from the Hub explorer.":re?"Calculating selection size...":G?`${G.files} files, ${G.folders} folders · ${GM(G.totalBytes)}`:`${B.length} item${B.length===1?"":"s"} selected`,ke=xe=>{k({id:xe.jobId,state:xe.state,progress:Ux(xe),message:$x(xe)})},gt=m.useCallback(async()=>{const xe=await Hx(a,!0);return L(xe),E(""),xe},[a]),ie=async()=>{try{const He=(await TM(a,!0)).jobs||[],ze=await Promise.all([...Fe.current].map(async it=>{try{return await kM(it,a)}catch{return null}})),lt=[...He,...ze.filter(Boolean)],Mn=[...new Map(lt.map(it=>[it.jobId,it])).values()];Me(Mn),Mn.forEach(ke),Mn.filter(it=>qx(it.state)).forEach(it=>Fe.current.delete(it.jobId))}catch{}};m.useEffect(()=>{let xe=!0;U(!0),E(""),Promise.all([gt(),Fx(a).then(ze=>{xe&&Z(ze)})]).catch(ze=>{xe&&(E(ze instanceof Error?"Hub file system is unavailable. Make sure LiveDesk Hub is running on this computer.":"Hub file system is unavailable."),j(ze instanceof Error?ze.message:"Hub file system is unavailable."))}).finally(()=>{xe&&(U(!1),_(!1))}),ie();const He=window.setInterval(()=>{ie()},800);return()=>{xe=!1,window.clearInterval(He)}},[a,gt]),m.useEffect(()=>{if(P.length===0){de(null);return}let xe=!1;return fe(!0),NM(P,a).then(He=>{xe||de(He)}).catch(He=>{xe||j(He instanceof Error?He.message:"Unable to calculate selected size.")}).finally(()=>{xe||fe(!1)}),()=>{xe=!0}},[a,P.join("|")]);const ve=(xe,He)=>{te(xe),ue(He)},Te=xe=>{xe.forEach(He=>Fe.current.add(He.jobId)),Me(He=>[...new Map([...He,...xe].map(ze=>[ze.jobId,ze])).values()]),xe.forEach(ke)},De=async()=>{if(!s){j(r);return}if(P.length===0){j("Select files or folders from the Hub explorer.");return}if(Ve.length===0){j("Choose at least one connected workstation.");return}if(Le){j("A Hub transfer is already running.");return}try{const xe=await AM(P,Ve,d.trim(),a);Fe.current.add(xe.jobId),j("Hub transfer queued."),await ie()}catch(xe){j(xe instanceof Error?xe.message:"Unable to start Hub transfer.")}},se=async xe=>{const He=xe||Ee;if(!He||He.type!=="folder"){j("Select one folder to add it to Sync.");return}try{const ze=await DM(He.id,a);Z(lt=>[...lt.filter(Mn=>Mn.id!==ze.folder.id),ze.folder]),ge("sync"),j(`${He.name} is ready for Hub sync.`)}catch(ze){j(ze instanceof Error?ze.message:"Unable to add the Hub folder to Sync.")}},et=async xe=>{if(Ve.length===0){j("Choose at least one connected workstation.");return}me(!0),Z(He=>He.map(ze=>ze.id===xe.id?{...ze,status:"syncing"}:ze));try{const He=await zM(xe.id,Ve,d.trim(),a);Te(He.jobs||[]),j(He.jobs?.length?"Hub sync queued.":"No changed files to sync.");const ze=await Fx(a);Z(ze)}catch(He){j(He instanceof Error?He.message:"Unable to sync the Hub folder."),Z(ze=>ze.map(lt=>lt.id===xe.id?{...lt,status:"error",message:"Sync failed"}:lt))}finally{me(!1)}},Ce=async()=>{me(!0);try{for(const xe of I)await et(xe)}finally{me(!1)}},It=async xe=>{try{const He=await RM(xe.id,{autoSync:!xe.autoSync},a);Z(ze=>ze.map(lt=>lt.id===xe.id?He.folder:lt))}catch(He){j(He instanceof Error?He.message:"Unable to update auto sync.")}},Rt=async xe=>{try{await LM(xe.id,a),Z(He=>He.filter(ze=>ze.id!==xe.id))}catch(He){j(He instanceof Error?He.message:"Unable to remove the sync folder.")}};return o.jsxs("section",{className:"livedesk-file-explorer",children:[o.jsx("input",{ref:v,className:"hidden-file-input",type:"file",multiple:!0,onChange:xe=>{xe.currentTarget.files&&M(xe.currentTarget.files),xe.currentTarget.value=""}}),o.jsx("input",{ref:w,className:"hidden-file-input",type:"file",multiple:!0,webkitdirectory:"",directory:"",onChange:xe=>{xe.currentTarget.files&&C(xe.currentTarget.files),xe.currentTarget.value=""}}),(c||X)&&o.jsxs("section",{className:"file-share-notice",role:X?"alert":void 0,children:[X||c,o.jsx("button",{className:"icon-button",onClick:()=>{E(""),U(!0),Hx(a).then(xe=>L(xe)).catch(()=>E("Hub file system is unavailable.")).finally(()=>U(!1))},title:"Retry",type:"button",children:o.jsx(Du,{size:15})})]}),o.jsx("div",{className:"file-share-workspace",children:o.jsxs(HM,{onRetry:()=>window.location.reload(),children:[o.jsx(BM,{hubUrl:a,roots:A,loading:q,error:X,onRefreshRoots:gt,onImportFiles:()=>v.current?.click(),onImportFolder:()=>w.current?.click(),onSelectionChange:ve,onShareItem:xe=>{te([xe.id]),ue([xe]),ge("send")},onAddSyncFolder:xe=>{te([xe.id]),ue([xe]),se(xe)},onNotice:j}),o.jsx(qM,{devices:T,targetMode:p,selectedTargetIds:g,onTargetModeChange:x,onTargetToggle:y,remoteDirectory:d,onRemoteDirectoryChange:h,selectedEntries:B,selectedSummary:qe,canShare:s&&!Le&&P.length>0&&Ve.length>0&&!re,onShare:()=>{De()},canAddSync:!!Ee,onAddSync:()=>{se()},tab:z,onTabChange:ge,folders:I,foldersLoading:ee,syncBusy:ae,onSyncAll:()=>{Ce()},onSync:xe=>{et(xe)},onToggleAuto:xe=>{It(xe)},onRemove:xe=>{Rt(xe)},onAddFolder:()=>{se()}})]})}),Le&&o.jsx("footer",{className:"file-share-workspace-footer",children:o.jsxs("span",{children:[$x(Le)," · ",Ux(Le),"% ",o.jsx("button",{className:"icon-button",onClick:()=>{EM(Le.jobId,a).then(xe=>{Me(He=>He.map(ze=>ze.jobId===xe.jobId?xe:ze)),ke(xe)})},title:"Cancel transfer",type:"button",children:o.jsx(Su,{size:14})})]})})]})}function YM({value:a,onChange:l,onSubmit:s,disabled:r=!1}){return o.jsxs("form",{className:"agents-composer",onSubmit:c=>{c.preventDefault(),s()},children:[o.jsx("textarea",{value:a,onChange:c=>l(c.target.value.slice(0,4e3)),placeholder:"Ask LiveDesk to work across your machines...","aria-label":"Ask LiveDesk",rows:2,disabled:r}),o.jsxs("button",{className:"agents-run-button",type:"submit",disabled:r||!a.trim(),children:[r?o.jsx(bu,{className:"spin",size:16}):o.jsx(wu,{size:16}),r?"Running":"Run"]})]})}function ly(a){return a.deviceName?.trim()||a.hostname?.trim()||a.deviceId}function VM(a){return a==="running"||a==="completed"||a==="failed"||a==="cancelled"?a:"queued"}function QM(a){switch(a){case"process.list":return"Process list";case"system.health":return"System health";case"gpu.status":return"GPU status";case"disk.status":return"Disk status";case"service.status":return"Service status";case"diagnostics.collect":return"Diagnostics"}}function KM(a){const l=a.trim().toLowerCase();return l?/(process|프로세스|실행 중|실행중|comfyui|running|processes)/i.test(l)?{operation:"process.list",query:l.includes("comfyui")?"comfyui":void 0}:/(gpu|그래픽|vram|gpu 상태)/i.test(l)?{operation:"gpu.status"}:/(disk|디스크|storage|저장 공간)/i.test(l)?{operation:"disk.status"}:/(service|서비스)/i.test(l)?{operation:"service.status"}:/(diagnostic|진단|로그)/i.test(l)?{operation:"diagnostics.collect"}:/(health|system|시스템|상태)/i.test(l)?{operation:"system.health"}:null:null}const XM=["이 작업은 아직 지원되지 않습니다.","","현재 지원:","• 시스템 상태 확인","• GPU 상태 확인","• 디스크 상태 확인","• 프로세스 조회","• 서비스 상태 조회","• 진단 로그 수집"].join(`
13
+ `);function ZM({state:a}){const l=a.status==="completed"?im:a.status==="failed"||a.status==="cancelled"?Su:a.status==="running"?bu:Ub,s=a.status==="running"?a.stage||"Working":a.status==="completed"?a.result||"Completed":a.status==="failed"?a.error||"Failed":a.status==="cancelled"?"Cancelled":"Queued";return o.jsxs("div",{className:`agent-target-row status-${a.status}`,"data-agent-target-id":a.deviceId,children:[o.jsx("span",{className:"agent-target-status","aria-hidden":"true",children:o.jsx(l,{size:15})}),o.jsx("strong",{children:a.deviceName}),o.jsx("span",{className:"agent-target-state",children:a.status[0].toUpperCase()+a.status.slice(1)}),o.jsx("small",{children:s})]})}function WM({operation:a,states:l,status:s,onCancel:r,onRetry:c,busy:d=!1}){const h=["running","queued"].includes(s),p=l.some(g=>g.status==="failed");return o.jsxs("section",{className:"agent-task-block","aria-label":"Task execution",children:[o.jsxs("div",{className:"agent-task-head",children:[o.jsxs("div",{children:[o.jsx("span",{children:"LiveDesk Agent"}),o.jsx("strong",{children:QM(a)})]}),o.jsx("span",{className:`agent-task-status status-${s}`,children:s==="completed-with-failures"?"Completed with failures":s[0].toUpperCase()+s.slice(1)})]}),o.jsx("div",{className:"agent-task-rows",children:l.map(g=>o.jsx(ZM,{state:g},g.deviceId))}),(h||p)&&o.jsxs("div",{className:"agent-task-actions",children:[h&&r&&o.jsxs("button",{onClick:r,disabled:d,type:"button",children:[o.jsx($b,{size:14})," Cancel"]}),!h&&p&&c&&o.jsxs("button",{onClick:c,disabled:d,type:"button",children:[o.jsx(fu,{size:14})," Retry failed"]})]})]})}function JM({items:a,onCancel:l,onRetry:s,busyBatchId:r}){return o.jsxs("section",{className:"agents-conversation","aria-live":"polite",children:[a.length===0&&o.jsxs("div",{className:"agents-empty-conversation",children:[o.jsx("strong",{children:"Ask LiveDesk to work across your machines."}),o.jsx("span",{children:"Start with a read-only request such as “모든 PC에서 ComfyUI가 실행 중인지 확인해줘”."})]}),a.map(c=>{if(c.type==="task"){const d=c;return o.jsx(WM,{operation:d.operation,states:d.states,status:d.status,onCancel:()=>l(d.batchId),onRetry:()=>s(d.batchId),busy:r===d.batchId},d.id)}return o.jsxs("article",{className:`agents-message ${c.type}`,children:[o.jsx("span",{children:c.type==="user"?"You":"LiveDesk Agent"}),o.jsx("p",{children:c.text})]},c.id)})]})}function eC({devices:a,mode:l,selectedIds:s,onModeChange:r,onToggle:c}){const d=a.filter(p=>p.connected),h=s.filter(p=>d.some(g=>g.deviceId===p)).length;return o.jsxs("section",{className:"agents-target-picker","aria-label":"Agent targets",children:[o.jsxs("div",{className:"agents-target-toolbar",children:[o.jsx("span",{className:"agents-section-label",children:"Targets"}),o.jsxs("div",{className:"agents-target-modes",children:[o.jsxs("button",{className:l==="all"?"active":"",onClick:()=>r("all"),type:"button",children:[o.jsx(cv,{size:14})," All connected ",o.jsx("small",{children:d.length})]}),o.jsxs("button",{className:l==="selected"?"active":"",onClick:()=>r("selected"),type:"button",children:[o.jsx(im,{size:14})," Selected ",h]})]})]}),o.jsx("div",{className:"agents-target-list",children:a.length===0?o.jsx("span",{className:"agents-target-empty",children:"No workstations discovered."}):a.map(p=>{const g=l==="all"?p.connected:s.includes(p.deviceId);return o.jsxs("label",{className:`agents-target-option ${g?"selected":""} ${p.connected?"":"offline"}`,children:[o.jsx("input",{type:"checkbox",checked:g,disabled:!p.connected||l==="all",onChange:()=>c(p.deviceId)}),o.jsx("span",{className:"agents-target-icon",children:o.jsx(_a,{size:15})}),o.jsxs("span",{children:[o.jsx("strong",{children:ly(p)}),o.jsx("small",{children:p.connected?"Connected":"Offline"})]}),g&&o.jsx(im,{className:"agents-target-check",size:15,"aria-hidden":"true"})]},p.deviceId)})})]})}async function tC(a,l){return ct("/api/remote/tasks",{method:"POST",body:JSON.stringify({instruction:l.instruction,deviceIds:l.deviceIds,operation:l.operation,targetQuery:l.targetQuery,approvalLevel:"read-only"})},a)}async function nC(a,l){return ct(`/api/remote/tasks/${encodeURIComponent(l)}`,void 0,a)}async function aC(a,l){return ct(`/api/remote/tasks/${encodeURIComponent(l)}/cancel`,{method:"POST",body:JSON.stringify({})},a)}async function lC(a,l){return ct(`/api/remote/tasks/${encodeURIComponent(l)}/retry`,{method:"POST",body:JSON.stringify({failedOnly:!0})},a)}function Ks(a){return`${a}-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function Vf(a,l){const s=new Map(l.map(r=>[r.deviceId,ly(r)]));return a.results.map(r=>({deviceId:r.deviceId,deviceName:r.deviceName||s.get(r.deviceId)||r.deviceId,status:VM(r.status),stage:r.stage||(r.status==="running"?"Checking processes":void 0),result:r.result,error:r.error,sequence:Number.isSafeInteger(r.sequence)?r.sequence:0}))}function iC(a,l){const s=new Map(l.map(r=>[r.deviceId,r]));return a.map(r=>{const c=s.get(r.deviceId);return!c||c.sequence<=r.sequence?r:c})}function sC(a,l){const s=l.filter(d=>d.status==="completed"),r=l.filter(d=>d.status==="failed");if(a.operation==="process.list"){const h=`${s.filter(p=>{const g=p.result||"";return!/not running|no process/i.test(g)&&/running|online|found/i.test(g)}).length}대에서 요청한 프로세스가 실행 중입니다.`;return r.length>0?`${h}
14
+ ${r.map(p=>`${p.deviceName}는 ${p.error||"응답하지 않았습니다."}`).join(`
15
+ `)}`:h}return r.length>0?`${s.length}대 완료, ${r.length}대 실패했습니다.`:`${s.length}대 작업이 완료되었습니다.`}function rC({hubUrl:a,devices:l}){const[s,r]=m.useState("all"),[c,d]=m.useState([]),[h,p]=m.useState(""),[g,x]=m.useState([]),[y,v]=m.useState(""),[w,M]=m.useState(""),[C,j]=m.useState(""),k=m.useRef(new Set),T=m.useMemo(()=>l.filter(E=>E.connected).map(E=>E.deviceId),[l]),A=m.useCallback(E=>{const P=Vf(E,l);x(te=>te.map(B=>B.type==="task"&&B.batchId===E.batchId?{...B,states:iC(B.states,P),status:E.status}:B)),!["running","queued"].includes(E.status)&&!k.current.has(E.batchId)&&(k.current.add(E.batchId),x(te=>[...te,{type:"agent",id:Ks("agent-summary"),text:sC(E,P)}]),v(te=>te===E.batchId?"":te))},[l]),L=m.useCallback(async E=>{const P=await nC(a,E);return A(P),P},[a,A]);m.useEffect(()=>{if(!y)return;let E=!0;const P=async()=>{try{const B=await L(y);E&&!["running","queued"].includes(B.status)&&v("")}catch(B){E&&j(B instanceof Error?B.message:String(B))}};P();const te=window.setInterval(()=>{P()},800);return()=>{E=!1,window.clearInterval(te)}},[y,L]);const q=async()=>{const E=h.trim();if(!E||y)return;const P=KM(E);if(x(B=>[...B,{type:"user",id:Ks("user"),text:E}]),p(""),j(""),!P){x(B=>[...B,{type:"error",id:Ks("unsupported"),text:XM}]);return}const te=s==="all"?T:c.filter(B=>T.includes(B));if(te.length===0){x(B=>[...B,{type:"error",id:Ks("no-targets"),text:"연결된 대상 장비를 하나 이상 선택해 주세요."}]);return}try{const B=await tC(a,{instruction:E,deviceIds:te,operation:P.operation,targetQuery:P.query});if(!B.ok||!B.batch||!B.batchId)throw new Error(B.error||"작업을 만들지 못했습니다.");const ue={type:"task",id:Ks("task"),batchId:B.batchId,operation:P.operation,instruction:E,states:Vf(B.batch,l),status:B.batch.status};x(G=>[...G,{type:"agent",id:Ks("agent-start"),text:`${te.length}개 워크스테이션에서 확인하고 있습니다.`},ue]),v(B.batchId)}catch(B){j(B instanceof Error?B.message:String(B))}},U=async E=>{M(E);try{const P=await aC(a,E);A(P),v(te=>te===E?"":te)}catch(P){j(P instanceof Error?P.message:String(P))}finally{M("")}},X=async E=>{M(E);try{const P=await lC(a,E);if(!P.ok||!P.batch||!P.batchId)throw new Error(P.error||"재시도하지 못했습니다.");k.current.delete(P.batchId),x(te=>te.map(B=>B.type==="task"&&B.batchId===E?{...B,batchId:P.batchId,states:Vf(P.batch,l),status:P.batch.status}:B)),v(P.batchId)}catch(P){j(P instanceof Error?P.message:String(P))}finally{M("")}};return o.jsxs("section",{className:"agents-page",children:[o.jsxs("header",{className:"agents-page-header",children:[o.jsxs("div",{children:[o.jsx("span",{className:"agents-eyebrow",children:"Multi-machine work console"}),o.jsx("h2",{children:"Agents"}),o.jsx("p",{children:"Ask LiveDesk to complete safe, read-only work across your workstations."})]}),o.jsxs("div",{className:"agents-page-badges",children:[o.jsxs("span",{children:["Targets: ",T.length," workstations"]}),o.jsx("strong",{children:"Read only"})]})]}),o.jsx(eC,{devices:l,mode:s,selectedIds:c,onModeChange:r,onToggle:E=>d(P=>P.includes(E)?P.filter(te=>te!==E):[...P,E])}),C&&o.jsx("div",{className:"agents-error",role:"alert",children:C}),o.jsx(JM,{items:g,onCancel:U,onRetry:X,busyBatchId:w}),o.jsx(YM,{value:h,onChange:p,onSubmit:()=>{q()},disabled:!!y})]})}const oC=120,cC=999,Js=5,vo=30,uC=Number.POSITIVE_INFINITY,iy="livedesk.remoteDirectory",ym="livedesk.localHubAccessEnabled",sy="livedesk.streamSettings",ry=15,oy="livedesk.controlStreamSettings",bm=6,Qf=512*1024,wm="".trim(),cy="".trim(),Gx="livedesk-adsense-script",Kf=!!wm&&!!cy,dC=1e3/60,Xf=1500,fC=650,mC=1800,hC=650,pC=2500,Px=1500,Yx=15e3,Vx=240,gC=1024,xC=480,vC=270;function yC(a,l){if(l.deviceId!==a.deviceId)return!1;const s=Number(l.browserReceivedEpochMs);if(!Number.isFinite(s)||s<a.startedAtEpochMs)return!1;const r=Number(l.monitorIndex);if(Number.isFinite(r)&&Math.floor(r)!==a.monitorIndex)return!1;const c=String(l.frameMode||l.mode||"").trim().toLowerCase();return!c||c===a.frameMode?!0:a.frameMode==="mode5-lzo-delta"&&c==="mode3-h264-hw"}const kl={free:{name:"Free",price:"$0",limit:Js,audience:"Personal trial",note:"5 devices with a standard ad banner."},ltd:{name:"Plus",price:"$5/mo",yearly:"$40/year",ltd:"$79 LTD",limit:vo,audience:"Creators and homelabs",note:"30 devices, no ads, personal use."},pro:{name:"Pro",price:"$15/mo",yearly:"$120/year",ltd:"$199 LTD",limit:uC,audience:"Business and studios",note:"Commercial use and larger workstation walls."}},uy={"mode1-jpeg":5,"mode2-lzo":8,"mode3-h264-hw":20,"mode4-h264-atlas":20};function Xa(a,l){return`${a}:${l}`}const qn={frameMode:"mode3-h264-hw",h264DecodeAcceleration:"prefer-hardware",fps:uy["mode3-h264-hw"],maxWidth:1920,maxHeight:1080,atlasTileWidth:320,atlasTileHeight:180,atlasTileSizeMode:"auto",quality:75,autoStartLive:!0,showScreenStatus:!0,visibleOnlyLive:!0,adaptiveLoadShedding:!0,adaptiveSizeByWall:!0},Gn={frameMode:"mode3-h264-hw",h264DecodeAcceleration:"prefer-software",fps:30,maxWidth:1920,maxHeight:1080,quality:75,showScreenStatus:!1};function xu(a,l){if(a.length===0)return 0;const s=[...a].sort((c,d)=>c-d),r=Math.max(0,Math.min(s.length-1,Math.ceil(s.length*l)-1));return s[r]}function Pm(a,l){a.push(l),a.length>Vx&&a.splice(0,a.length-Vx)}function Qx(a,l){a.sampleFrames=0,a.sampleStartedAt=l,a.intervalCount=0,a.intervalSumMs=0,a.minIntervalMs=Number.POSITIVE_INFINITY,a.maxIntervalMs=0,a.intervalSamplesMs.length=0,a.seqGapCount=0,a.maxSeqGap=0}function Kx(a,l,s){if(a.lastAt!==void 0){const r=Math.max(0,l-a.lastAt);a.intervalCount+=1,a.intervalSumMs+=r,a.minIntervalMs=Math.min(a.minIntervalMs,r),a.maxIntervalMs=Math.max(a.maxIntervalMs,r),Pm(a.intervalSamplesMs,r)}if(a.lastFrameSeq!==void 0){const r=s-a.lastFrameSeq;r!==1&&(a.seqGapCount+=1,a.maxSeqGap=Math.max(a.maxSeqGap,Math.abs(r)))}a.lastAt=l,a.lastFrameSeq=s}function Xx(a){return!a||a.intervalCount<=0?"waiting":`${Math.round(a.averageIntervalMs)}ms avg / p95 ${Math.round(a.p95IntervalMs)}ms / max ${Math.round(a.maxIntervalMs)}ms`}function bC(){const[a,l]=m.useState({framesPerSecond:0,averageIntervalMs:0,p95IntervalMs:0,maxIntervalMs:0,longTaskCount:0,longTaskMs:0});return m.useEffect(()=>{let s=0,r=performance.now(),c=0,d=0,h=[],p=0,g=0,x=null;const y=w=>{document.visibilityState==="visible"?(c+=1,d>0&&Pm(h,Math.max(0,w-d)),d=w):d=0,s=window.requestAnimationFrame(y)};try{x=new PerformanceObserver(w=>{for(const M of w.getEntries())p+=1,g+=M.duration}),x.observe({entryTypes:["longtask"]})}catch{x=null}s=window.requestAnimationFrame(y);const v=window.setInterval(()=>{const w=performance.now(),M=Math.max(1,w-r),C=h.reduce((j,k)=>j+k,0);l({framesPerSecond:c*1e3/M,averageIntervalMs:h.length>0?C/h.length:0,p95IntervalMs:xu(h,.95),maxIntervalMs:h.length>0?Math.max(...h):0,longTaskCount:p,longTaskMs:g}),r=w,c=0,h=[],p=0,g=0},1e3);return()=>{window.cancelAnimationFrame(s),window.clearInterval(v),x?.disconnect()}},[]),a}function Zx(a){return!a||a.seqGapCount<=0?"none":`${a.seqGapCount} gaps / max ${a.maxSeqGap}`}function wC(a){return Number.isFinite(a)?String(a):"30+"}const vu=[{id:"mode4-h264-atlas",label:"Mode 4",detail:"Hub H.264 Atlas"},{id:"mode3-h264-hw",label:"Mode 3",detail:"H.264 hardware"},{id:"mode2-lzo",label:"Mode 2",detail:"RGB565 LZO wall"},{id:"mode1-jpeg",label:"Mode 1",detail:"JPEG test"}],Sm=[{id:"prefer-software",label:"Software low latency"},{id:"prefer-hardware",label:"Hardware decode"},{id:"no-preference",label:"Browser auto"}],SC=[{id:"mode3-h264-hw",label:"Mode 3 - H.264 hardware"},{id:"mode5-lzo-delta",label:"Mode 5 - LZO tile delta"}],yu=[{id:"640x360",label:"Compact",width:640,height:360},{id:"960x540",label:"Standard",width:960,height:540},{id:"1280x720",label:"HD",width:1280,height:720},{id:"1920x1080",label:"Full HD",width:1920,height:1080},{id:"2560x1440",label:"QHD",width:2560,height:1440},{id:"3840x2160",label:"4K",width:3840,height:2160}],Zf=yu.filter(a=>a.width>=1280),Wf=[{id:"auto",label:"Auto by wall size"},{id:"320x180",label:"Standard 320x180",width:320,height:180},{id:"480x270",label:"Sharp 480x270",width:480,height:270}],Ym=[1,2,5,8,12,20,30],MC=[20,30,60],Wx=[45,60,75,90],Jx={large:{maxWidth:1280,maxHeight:720},medium:{maxWidth:960,maxHeight:540},small:{maxWidth:640,maxHeight:360}},Sn={preserveConfiguredFpsDeviceCount:12,visibleRootMargin:"520px 0px 760px 0px",fallbackVisibleCounts:{large:12,medium:18,small:32},maxWallFramesPerSecond:96,maxWallBytesPerSecond:80*1024*1024,maxFrameGapMs:280,lowLoadFrameRatio:.58,lowLoadByteRatio:.52,downshiftCooldownMs:1800,recoveryCooldownMs:14e3,minFps:5},ev=2200,CC=8e3,jC=3500,NC=2600,AC=4200,TC=750,kC=2,tv=4200;function nv(a,l){return Math.min(3e4,a*2**Math.min(3,Math.max(0,l)))}function jo(a,l){const s=a.capabilities?.[l];return typeof s=="boolean"?s:/^(1|true|yes|on)$/i.test(String(s||"").trim())}function No(a){return a.deviceName||a.hostname||a.deviceId}function EC(){return"npx -y livedesk client"}function DC(){return"npx -y livedesk"}function RC(){try{return localStorage.getItem(iy)||""}catch{return""}}function LC(){try{return localStorage.getItem(ym)==="1"}catch{return!1}}function Xs(a){try{a?localStorage.setItem(ym,"1"):localStorage.removeItem(ym)}catch{}}function Ma(a,l,s,r){const c=Number(a);return Number.isFinite(c)?Math.max(l,Math.min(s,Math.round(c))):r}function Mm(a){const l=String(a||"").trim();return l==="mode2-lz4"||l==="lz4"?"mode2-lzo":vu.some(s=>s.id===l)?l:qn.frameMode}function Eu(a){const l=String(a||"").trim();return Sm.some(s=>s.id===l)?l:qn.h264DecodeAcceleration}function Cm(a){return a==="mode3-h264-hw"||a==="mode5-lzo-delta"?a:Gn.frameMode}function dy(a){return uy[a]||12}function fy(a){return a==="mode3-h264-hw"||a==="mode4-h264-atlas"?20:30}function jm(a,l){return Ma(a,1,fy(l),dy(l))}function Zi(a){return a&&typeof a=="object"&&!Array.isArray(a)?a:{}}function $n(a){const l=Zi(a.status),s=Zi(l.screens),r=Zi(a.capabilities),c=[l.monitorCount,l.screenCount,s.count,r.monitorCount,r.screenCount];for(const d of c){const h=Number(d);if(Number.isFinite(h)&&h>0)return Math.max(1,Math.min(64,Math.floor(h)))}return 1}function vi(a){const l=Number(a);return Number.isFinite(l)&&l>0?Math.floor(l):0}function zC(a){const l=Zi(a.status),r=[Zi(l.screens).displays,l.displays,l.monitors];for(const c of r)if(!(!Array.isArray(c)||c.length===0))return c.map(d=>Zi(d));return[]}function my(a,l){const s=zC(a),r=s.find(g=>Number(g.index)===l)||s[l]||s[0]||{},c=vi(r.width),d=vi(r.height),h=[r.name,r.displayName,r.deviceName,r.id].find(g=>typeof g=="string"&&g.trim()),p=typeof h=="string"?h.trim():`Display ${l+1}`;return{index:l,name:p,width:c,height:d,primary:r.primary===!0||r.isPrimary===!0}}function _C(a){const l=$n(a);return Array.from({length:l},(s,r)=>my(a,r))}function OC(a){const l=[a.name||`Display ${a.index+1}`];return a.width>0&&a.height>0&&l.push(`${a.width}x${a.height}`),a.primary&&l.push("Primary"),l.join(" - ")}function hy(a,l){const s=my(a,l);if(s.width>0&&s.height>0)return{width:s.width,height:s.height};const r=Zi(a.status),c=vi(r.screenWidth||r.width),d=vi(r.screenHeight||r.height);return c>0&&d>0?{width:c,height:d}:null}function py(a){if(!a)return null;const l=vi(a.sourceWidth)||vi(a.width),s=vi(a.sourceHeight)||vi(a.height);return l>0&&s>0?{width:l,height:s}:null}function BC(a,l,s){const d=((typeof l?.monitorIndex=="number"?la(l.monitorIndex,Math.max(1,l.monitorCount||1)):s)===s?py(l):null)||hy(a,s);return d?Math.max(.25,Math.min(4,d.width/d.height)):16/9}const ou=16/9;function la(a,l){const s=Math.max(1,Math.min(64,Math.floor(Number(l)||1))),r=Math.floor(Number(a));return Number.isFinite(r)?Math.max(0,Math.min(s-1,r)):0}function HC(){try{const a=JSON.parse(localStorage.getItem(sy)||"{}");if(![ry,14,13,12,11].includes(Number(a.version)))return qn;const l=Mm(a.frameMode),s=Ma(a.maxWidth,320,3840,qn.maxWidth),r=Ma(a.maxHeight,180,2160,qn.maxHeight);return{frameMode:l,h264DecodeAcceleration:Eu(a.h264DecodeAcceleration),fps:jm(a.fps,l),maxWidth:s,maxHeight:r,atlasTileWidth:Number(a.atlasTileWidth)>=480?480:320,atlasTileHeight:Number(a.atlasTileHeight)>=270?270:180,atlasTileSizeMode:a.atlasTileSizeMode==="fixed"?"fixed":"auto",quality:Ma(a.quality,20,95,qn.quality),autoStartLive:typeof a.autoStartLive=="boolean"?a.autoStartLive:qn.autoStartLive,showScreenStatus:typeof a.showScreenStatus=="boolean"?a.showScreenStatus:qn.showScreenStatus,visibleOnlyLive:typeof a.visibleOnlyLive=="boolean"?a.visibleOnlyLive:qn.visibleOnlyLive,adaptiveLoadShedding:typeof a.adaptiveLoadShedding=="boolean"?a.adaptiveLoadShedding:qn.adaptiveLoadShedding,adaptiveSizeByWall:typeof a.adaptiveSizeByWall=="boolean"?a.adaptiveSizeByWall:qn.adaptiveSizeByWall}}catch{return qn}}function FC(a){try{localStorage.setItem(sy,JSON.stringify({...a,version:ry}))}catch{}}function IC(){try{const a=JSON.parse(localStorage.getItem(oy)||"{}"),l=Number(a.version);if(![bm,5,4,3,2,1].includes(l))return Gn;const s=Ma(a.fps,20,60,Gn.fps),r=l<bm;return{frameMode:r?Gn.frameMode:Cm(a.frameMode),h264DecodeAcceleration:r?Gn.h264DecodeAcceleration:Eu(a.h264DecodeAcceleration),fps:r?Gn.fps:s,maxWidth:Ma(a.maxWidth,1280,3840,Gn.maxWidth),maxHeight:Ma(a.maxHeight,720,2160,Gn.maxHeight),quality:Ma(a.quality,20,95,Gn.quality),showScreenStatus:typeof a.showScreenStatus=="boolean"?a.showScreenStatus:Gn.showScreenStatus}}catch{return Gn}}function UC(a){try{localStorage.setItem(oy,JSON.stringify({...a,version:bm}))}catch{}}function cu(a,l){return a.length!==l.length?!1:a.every((s,r)=>s===l[r])}function Jf(a){return[...new Set(a.filter(Boolean))].sort()}function $C(a){return Sn.fallbackVisibleCounts[a]||Sn.fallbackVisibleCounts.large}function qC(a,l,s){if(a.frameMode==="mode2-lzo")return{maxWidth:320,maxHeight:180};if(a.frameMode==="mode4-h264-atlas")return a.atlasTileSizeMode==="auto"?l==="large"?{maxWidth:480,maxHeight:270}:{maxWidth:320,maxHeight:180}:{maxWidth:a.atlasTileWidth,maxHeight:a.atlasTileHeight};if(!a.adaptiveSizeByWall)return{maxWidth:a.maxWidth,maxHeight:a.maxHeight};const r=Jx[l]||Jx.large;return{maxWidth:Math.min(a.maxWidth,r.maxWidth),maxHeight:Math.min(a.maxHeight,r.maxHeight)}}function GC(a,l=Sn.minFps){const s=[...Ym].sort((c,d)=>c-d),r=Math.max(l,Math.floor(a/2));return[...s].reverse().find(c=>c<a&&c>=l)||r}function PC(a,l){return[...Ym].sort((r,c)=>r-c).find(r=>r>a&&r<=l)||l}function yo(a){if(!Number.isFinite(a)||a<=0)return"0 B";const l=["B","KB","MB","GB","TB"];let s=a,r=0;for(;s>=1024&&r<l.length-1;)s/=1024,r+=1;const c=r===0||s>=100?0:1;return`${s.toFixed(c)} ${l[r]}`}function av(a){if(!Number.isFinite(a)||!a||a<=0)return"0GB";const l=1024**4,s=1024**3;return a>=l?`${Math.max(1,Math.round(a/l))}TB`:`${Math.max(1,Math.round(a/s))}GB`}function em(a,l){if(!Number.isFinite(a)||!a||a<=0)return"not reported";const s=Math.max(0,a-Math.max(0,Number(l||0)));return`${av(s)} / ${av(a)}`}function YC(a){const l=new Uint8Array(a),s=32768;let r="";for(let c=0;c<l.length;c+=s){const d=l.subarray(c,c+s);r+=String.fromCharCode(...d)}return btoa(r)}function lv(a){return Array.from(a).filter(l=>l.size>=0).map(l=>{const s=l.webkitRelativePath||l.name;return{file:l,relativePath:s,fingerprint:`${l.size}:${l.lastModified}`}})}function VC(a){return a===1?"middle":a===2?"right":"left"}function iv(a,...l){for(const s of l){const r=a?.[s];if(typeof r=="string"&&r.trim())return r.trim()}return""}function ho(a){const l=Number(a);return Number.isInteger(l)&&l>=1&&l<=cC?l:0}const QC={cpu:"CPU",memory:"MEM",disk:"Disk",gpu:"GPU",vram:"VRAM",npu:"NPU",temp:"Temp",network:"Net"};function KC(a,l,s){if(a==="online")return"Online";if(a==="busy")return"Busy";if(a==="stale")return"Stale";if(a==="offline")return"Offline";if(s==="failed")return"Task failed";const r=a==="critical"?"critical":"warn",c=l.find(h=>h.state===r)||l.find(h=>h.state==="critical"||h.state==="warn");if(!c)return a==="critical"?"Issue":"Check";const d=QC[c.id]||c.label;return c.value&&c.value!=="-"?`${d} ${c.value}`:d}function Fu(a,l){const s=l.split(".");let r=a;for(const c of s){if(r==null)return;if(Array.isArray(r)){const d=Number(c);r=Number.isInteger(d)?r[d]:void 0;continue}if(typeof r=="object"){r=r[c];continue}return}return r}function Dt(a,...l){for(const s of l){const r=Fu(a,s),c=Number(r);if(Number.isFinite(c))return c}}function Pn(a,...l){for(const s of l){const r=Fu(a,s);if(typeof r=="string"&&r.trim())return r.trim();if(typeof r=="number"&&Number.isFinite(r))return String(r)}return""}function XC(a,...l){for(const s of l){const r=Fu(a,s);if(typeof r=="boolean")return r;if(/^(1|true|yes|on|online|running|ready)$/i.test(String(r||"").trim()))return!0;if(/^(0|false|no|off|offline|stopped|missing)$/i.test(String(r||"").trim()))return!1}}function El(a){const l=Number(a);if(Number.isFinite(l))return Math.max(0,Math.min(1,l>1?l/100:l))}function tm(a,l){if(!(typeof a!="number"||typeof l!="number"||!Number.isFinite(a)||!Number.isFinite(l)||a<=0))return El((a-Math.max(0,l))/a)}function Zs(a){return a===void 0?"-":`${Math.round(a*100)}%`}function nm(a){return a===void 0||!Number.isFinite(a)?"":a>=1e3?`${(a/1e3).toFixed(a>=1e4?0:1)}Gb/s`:`${Math.round(a)}Mb/s`}function Yi(a,l=.92,s=.78){return a===void 0?"unknown":a>=l?"critical":a>=s?"warn":"good"}function gy(a){return!Number.isFinite(a)||!a||a<=0?"-":a<3600?`${Math.round(a/60)}m`:a<86400?`${Math.round(a/3600)}h`:`${Math.round(a/86400)}d`}function uu(a,l,s){const r=Fu(a,`tools.${l}`),c=Pn(a,`tools.${l}.status`,`tooling.${l}.status`,`${l}.status`).toLowerCase(),d=XC(a,`tools.${l}.running`,`tooling.${l}.running`,`${l}.running`),h=Pn(a,`tools.${l}.version`,`tooling.${l}.version`,`${l}.version`),p=Pn(a,`tools.${l}.port`,`tooling.${l}.port`,`${l}.port`);let g="unknown";return c==="busy"?g="busy":["online","running","ready","active"].includes(c)||d===!0?g="online":(["offline","stopped","missing","not-found"].includes(c)||d===!1||r===!1)&&(g="offline"),{id:l,label:s,status:g,detail:g==="offline"?"offline":h||(p?`:${p}`:g==="unknown"?"not reported":g)}}function xy(a){const l=a.status||{},s=Dt(l,"cpu.cores","cpuCores","processorCount"),r=Dt(l,"loadavg.0","cpu.load1"),c=El(Dt(l,"cpu.usedRatio","cpu.usageRatio","cpu.ratio","cpu.usedPct","cpu.usagePct","cpu.percent")??(s&&r!==void 0?r/Math.max(1,s):void 0)),d=Dt(l,"memory.totalBytes","totalMem"),h=Dt(l,"memory.freeBytes","freeMem"),p=El(Dt(l,"memory.usedRatio","memory.usedPct","usedMemRatio"))??tm(d,h),g=Dt(l,"disk.totalBytes","rootDisk.totalBytes","storage.totalBytes"),x=Dt(l,"disk.freeBytes","rootDisk.freeBytes","storage.freeBytes"),y=El(Dt(l,"disk.usedRatio","disk.usedPct","rootDisk.usedRatio","storage.usedRatio"))??tm(g,x),v=Dt(l,"thermal.cpuC","temperatureC","cpu.temperatureC","gpu.temperatureC"),w=El(Dt(l,"gpu.usedRatio","gpu.usageRatio","gpu.usedPct","gpu.usagePct","gpu.percent","accelerators.gpu.usageRatio")),M=Pn(l,"gpu.name","gpu.model","accelerators.gpu.name"),C=Dt(l,"gpu.memory.totalBytes","gpu.totalMemoryBytes","gpu.vramTotalBytes"),j=Dt(l,"gpu.memory.freeBytes","gpu.freeMemoryBytes","gpu.vramFreeBytes"),k=El(Dt(l,"gpu.memory.usedRatio","gpu.vramUsedRatio"))??tm(C,j),T=Dt(l,"gpu.temperatureC","thermal.gpuC"),A=El(Dt(l,"npu.usedRatio","npu.usageRatio","npu.usedPct","npu.usagePct","npu.percent","accelerators.npu.usageRatio")),L=Pn(l,"npu.name","npu.model","accelerators.npu.name"),q=Dt(l,"npu.tops","npu.topsInt8","accelerators.npu.tops"),U=Dt(l,"network.rxMbps","network.receiveMbps","network.downMbps"),X=Dt(l,"network.txMbps","network.transmitMbps","network.upMbps"),E=Dt(l,"network.latencyMs","network.rttMs"),P=El(Dt(l,"network.usedRatio","network.usageRatio","network.saturationRatio")),te=Pn(l,"network.link","network.interface","network.name"),B=v===void 0?void 0:El((v-35)/60),ue=Pn(l,"workload.role","role","lane")||(jo(a,"aiAssist")?"Agent worker":jo(a,"taskDispatch")?"Task worker":"Local machine"),G=Pn(a.latestTask,"status")||Pn(l,"workload.status")||"idle",de=Pn(a.latestTask,"title","instructionPreview")||Pn(l,"workload.title"),re=Pn(a.latestTask,"resultSummary","error","instructionPreview")||Pn(l,"workload.summary"),fe=[uu(l,"ollama","Ollama"),uu(l,"lmStudio","LM Studio"),uu(l,"comfyui","ComfyUI"),uu(l,"stableDiffusion","Stable Diffusion")],I=fe.some(z=>z.status!=="unknown"),Z=Date.parse(a.lastSeenAt||a.connectedAt||""),ee=Number.isFinite(Z)?Date.now()-Z:0;let _="online";a.connected?ee>5*6e4?_="stale":(v??0)>=86||(T??0)>=88||(c??0)>=.94||(w??0)>=.96||(k??0)>=.96||(A??0)>=.96||(p??0)>=.94||(y??0)>=.94||(E??0)>=200||G==="failed"?_="critical":(v??0)>=78||(T??0)>=80||(c??0)>=.82||(w??0)>=.86||(k??0)>=.88||(A??0)>=.86||(p??0)>=.82||(y??0)>=.86||(E??0)>=80?_="warn":(["queued","running","targeted"].includes(G)||fe.some(z=>z.status==="busy"))&&(_="busy"):_="offline";const ae=fe.filter(z=>z.status==="online"||z.status==="busy").length,me=[{id:"cpu",label:"CPU",value:Zs(c),detail:s?`${s} cores`:r!==void 0?`load ${r.toFixed(1)}`:"not reported",ratio:c,state:Yi(c,.92,.78)},{id:"memory",label:"RAM",value:Zs(p),detail:em(d,h),ratio:p,state:Yi(p,.92,.78)},{id:"disk",label:"DISK",value:Zs(y),detail:em(g,x),ratio:y,state:Yi(y,.92,.82)},{id:"gpu",label:"GPU",value:Zs(w),detail:M||(C&&j!==void 0?`${yo(j)} VRAM free`:T!==void 0?`${Math.round(T)}C`:"not reported"),ratio:w,state:T!==void 0&&T>=88?"critical":T!==void 0&&T>=80?"warn":Yi(w,.96,.86)},{id:"vram",label:"VRAM",value:Zs(k),detail:em(C,j),ratio:k,state:Yi(k,.96,.88)},{id:"npu",label:"NPU",value:A!==void 0?Zs(A):q!==void 0?`${Math.round(q)} TOPS`:"-",detail:L||(q!==void 0?"neural engine":"not reported"),ratio:A,state:Yi(A,.96,.86)},{id:"temp",label:"TEMP",value:v===void 0?"-":`${Math.round(v)}C`,detail:ae>0?`${ae} local tools`:`uptime ${gy(Dt(l,"uptimeSec"))}`,ratio:B,state:v===void 0?"unknown":v>=86?"critical":v>=78?"warn":"good"},{id:"network",label:"NET",value:nm(U)||(E!==void 0?`${Math.round(E)}ms`:te||"-"),detail:nm(X)?`${nm(X)} up`:te||"not reported",ratio:P,state:E!==void 0&&E>=200?"critical":E!==void 0&&E>=80?"warn":Yi(P,.9,.75)}];return{state:_,label:KC(_,me,G),role:ue,taskLabel:de||(G==="idle"?"idle":G),taskStatus:G,taskSummary:re,tools:I?fe:fe.map(z=>({...z,detail:"not reported"})),metrics:me}}const ZC=[{id:"small",label:"Small"},{id:"medium",label:"Medium"},{id:"large",label:"Large"}],WC=[{id:"wall",label:"Wall",icon:sm,accent:"blue"},{id:"control",label:"Control",icon:mu,accent:"red"},{id:"share-files",label:"Share Files",icon:du,accent:"green"},{id:"agents",label:"Agents",icon:go,accent:"violet"},{id:"doc",label:"Doc",icon:rm,accent:"amber"},{id:"pricing",label:"Pricing",icon:xo,accent:"green"}];function Ft(a){return a.replace(/\bRemoteHub\b/g,"Hub client endpoint").replace(/\bManagers\b/g,"Hubs").replace(/\bManager\b/g,"Hub").replace(/\bmanager\b/g,"Hub").replace(/\bMANAGER\b/g,"HUB").replace(/매니저/g,"Hub")}function Ws(a){return a.map(l=>Ft(l))}function bn(a){return{languageName:a.languageName,languageLabel:a.languageLabel,eyebrow:a.eyebrow,title:Ft(a.title),intro:Ft(a.intro),sections:[{title:Ft(a.managerTitle),body:Ft(a.managerBody),points:Ws(a.managerPoints)},{title:Ft(a.clientTitle),body:Ft(a.clientBody),points:Ws(a.clientPoints)},{title:Ft(a.syncTitle),body:Ft(a.syncBody),points:Ws(a.syncPoints)},{title:Ft(a.platformTitle),body:Ft(a.platformBody),points:Ws(a.platformPoints)}],sync:{title:Ft(a.syncTitle),body:Ft(a.syncBody),points:Ws(a.syncPoints)},firewall:{title:Ft(a.firewallTitle),body:Ft(a.firewallBody),points:Ws(a.firewallPoints)},commands:{title:Ft(a.commandsTitle),body:Ft(a.commandsBody),manager:Ft(a.managerCommandLabel),primary:Ft(a.clientCommandLabel),slot:Ft(a.slotCommandLabel),manual:Ft(a.manualCommandLabel)}}}const nr={ko:bn({languageName:"한국어",languageLabel:"문서 언어",eyebrow:"LiveDesk Manual",title:"한 줄로 여는 로컬 Screen Wall",intro:"LiveDesk는 매니저 PC 한 대에서 여러 작업 PC, AI 박스, 맥미니, 개발 장비를 한 화면에 모니터링하고 필요한 제어를 실행하는 npm-first 원격 작업 데크입니다.",managerTitle:"1. 매니저 실행",managerBody:"화면을 모아 볼 컴퓨터에서 LiveDesk 매니저를 실행합니다. 매니저는 UI와 로컬 서버를 같이 열고 브라우저를 http://127.0.0.1:5179 로 띄웁니다.",managerPoints:["명령은 npx -y livedesk 입니다.","매니저는 Screen Wall/API 포트 5179와 클라이언트 접속 포트 5197을 사용합니다.","기존 LiveDesk 포트가 남아 있으면 기본적으로 정리하고 새로 시작합니다. 필요하면 --no-clean 을 붙입니다."],clientTitle:"2. 워크스테이션 연결",clientBody:"모니터링할 PC에서는 Google 로그인 또는 Hub 화면의 6자리 PIN으로 연결합니다. Hub가 켜져 있지 않아도 클라이언트는 종료하지 않고 5초마다 계속 찾습니다.",clientPoints:["빈 자리에 자동 배치하려면 npx -y livedesk client 를 실행합니다.","자리 번호를 고정하려면 npx -y livedesk client 3 처럼 번호를 붙입니다.","브라우저 연결 페이지에서 Google 버튼 또는 6자리 PIN 입력 중 하나를 선택합니다."],syncTitle:"3. Sync Server와 자동 발견",syncBody:"Sync Server는 이 매니저를 현재 계정의 활성 Screen Wall로 Supabase에 등록합니다. 클라이언트는 같은 Google 계정으로 로그인한 뒤 그 기록을 읽고 접속 후보들을 순서대로 시도합니다.",syncPoints:["등록 정보에는 host instance, LAN/private 주소, public 후보 주소, pair token, 짧은 lease가 포함됩니다.","같은 LAN 후보를 먼저 쓰고, 필요하면 외부 주소 후보를 시도합니다.","매니저 위치, VPN, 방화벽, 공유기 설정이 바뀌었거나 개발 중 활성 매니저를 바꿀 때 Sync Server를 누릅니다.","이제 livedesk.pages.dev의 Chrome Local Network Access 허용은 기본 실행 경로가 아닙니다. npm 매니저 앱이 실제 서버입니다."],platformTitle:"4. 현재 플랫폼 상태",platformBody:"Windows는 실제 화면 전송까지 확인되었습니다. macOS와 Linux도 npm 구조로 같은 명령을 목표로 지원을 넓히고 있습니다.",platformPoints:["Windows: 현재 작동 확인.","macOS: manager/client 경로는 준비되어 있으며 화면 캡처와 제어에는 Screen Recording/Accessibility 권한이 필요합니다.","Linux: linux-x64 runtime, grim/gnome-screenshot/import/scrot 캡처, xdotool 입력 백엔드가 추가되었습니다. 오디오는 아직 비활성입니다."],firewallTitle:"방화벽과 외부 장소 연결",firewallBody:"같은 LAN 안에서는 보통 공유기 포트포워딩이 필요 없습니다. 다른 장소의 PC를 붙이려면 클라이언트가 매니저의 클라이언트 접속 포트에 도달할 수 있어야 합니다.",firewallPoints:["클라이언트 접속 포트는 TCP 5197입니다.","클라이언트 쪽은 나가는 연결이므로 보통 인바운드 포트 개방이 필요 없습니다.","다른 네트워크에서 붙일 때는 매니저 PC 방화벽에서 TCP 5197 인바운드를 허용하고, 공유기에서는 TCP 5197을 매니저 PC로 전달합니다.","Screen Wall/API 포트 5179는 매니저 UI용입니다. 외부 브라우저에서 Wall을 직접 열 필요가 있을 때만 별도로 노출을 검토합니다.","공개 인터넷에 바로 열기보다 VPN, Tailscale, ZeroTier, 고정 IP allowlist를 우선합니다."],commandsTitle:"현재 사용 명령",commandsBody:"웹사이트를 찾아가 설치 파일을 받는 방식보다 터미널 한 줄로 모든 운영체제에서 거의 같은 흐름을 쓰는 것이 LiveDesk의 기본 방향입니다.",managerCommandLabel:"매니저 시작",clientCommandLabel:"워크스테이션 연결",slotCommandLabel:"3번 슬롯에 고정",manualCommandLabel:"고급 수동 연결"}),en:bn({languageName:"English",languageLabel:"Document language",eyebrow:"LiveDesk Manual",title:"Open a local Screen Wall with one command",intro:"LiveDesk is an npm-first remote work deck for monitoring many workstations, AI boxes, Mac minis, and dev machines from one manager PC.",managerTitle:"1. Run the manager",managerBody:"Run LiveDesk on the computer that will watch the screens. The manager starts the UI and local server together, then opens http://127.0.0.1:5179.",managerPoints:["The command is npx -y livedesk.","The manager uses port 5179 for the Screen Wall/API and port 5197 for client connections.","If an old LiveDesk process still owns those ports, startup cleans it by default. Add --no-clean when you want to keep it."],clientTitle:"2. Connect a workstation",clientBody:"On each monitored computer, connect with Google sign-in or the 6-digit PIN shown on the Hub screen. If no manager is online yet, the client keeps running and retries every 5 seconds.",clientPoints:["Run npx -y livedesk client for first available placement.","Run npx -y livedesk client 3 to pin the machine to slot 3.","The browser connection page lets you choose Google or a 6-digit PIN."],syncTitle:"3. Sync Server and discovery",syncBody:"Sync Server publishes this manager as the active Screen Wall for the signed-in account. Clients read that Supabase record after Google sign-in and try the endpoint candidates in order.",syncPoints:["The record includes host instance, LAN/private addresses, public endpoint candidates, pair token, and a short lease.","LAN candidates are preferred first, then public candidates if needed.","Press Sync Server after manager moves, VPN/firewall/router changes, or when this development machine should take over as active manager.","Chrome Local Network Access on livedesk.pages.dev is no longer the default runtime path. The npm manager app is the real server."],platformTitle:"4. Current platform state",platformBody:"Windows has been verified with live screen transfer. macOS and Linux follow the same npm command path as support expands.",platformPoints:["Windows: verified working.","macOS: manager/client paths are prepared; screen capture and control require Screen Recording/Accessibility permissions.","Linux: linux-x64 runtime, grim/gnome-screenshot/import/scrot capture, and xdotool input backend are added. Audio is still disabled."],firewallTitle:"Firewall and remote locations",firewallBody:"On the same LAN, router forwarding is usually unnecessary. For another office, building, or country, clients must be able to reach the manager client port.",firewallPoints:["Client connection port: TCP 5197.","Client machines normally only need outbound access.","For remote networks, allow inbound TCP 5197 on the manager firewall and forward TCP 5197 from the router to the manager PC.","Screen Wall/API port 5179 is for the manager UI. Expose it only if a remote browser must open the Wall directly.","Prefer VPN, Tailscale, ZeroTier, or fixed-IP allowlists over public internet exposure."],commandsTitle:"Current commands",commandsBody:"The product direction is one terminal command across operating systems instead of finding a website, downloading, and installing manually.",managerCommandLabel:"Start manager",clientCommandLabel:"Connect workstation",slotCommandLabel:"Pin to slot 3",manualCommandLabel:"Advanced manual connection"}),ja:bn({languageName:"日本語",languageLabel:"ドキュメント言語",eyebrow:"LiveDesk Manual",title:"1行でローカル Screen Wall を開く",intro:"LiveDesk は、複数の作業 PC、AI マシン、Mac mini、開発機を1台の manager PC から監視する npm-first のリモート作業デッキです。",managerTitle:"1. manager を実行",managerBody:"画面を集めて見るコンピューターで LiveDesk manager を実行します。UI とローカルサーバーが同時に起動し、http://127.0.0.1:5179 が開きます。",managerPoints:["コマンドは npx -y livedesk です。","Screen Wall/API は 5179、client 接続は 5197 を使います。","古い LiveDesk プロセスがポートを使っている場合は、基本的に自動で整理して起動します。"],clientTitle:"2. workstation を接続",clientBody:"監視される PC で同じ Google アカウントにログインします。manager がまだ無くても client は終了せず、5秒ごとに再試行します。",clientPoints:["空きスロットに入れるには npx -y livedesk client を実行します。","スロットを固定するには npx -y livedesk client 3 のように番号を付けます。","大量の PC でも再ログインなしで待ち続けます。"],syncTitle:"3. Sync Server と自動検出",syncBody:"Sync Server はこの manager を現在の Google アカウントの active Screen Wall として Supabase に登録します。",syncPoints:["host instance、LAN/private アドレス、public 候補、pair token、短い lease を登録します。","client は LAN 候補を優先し、必要なら public 候補も試します。","VPN、firewall、router、manager の場所が変わったら Sync Server を押します。","livedesk.pages.dev の Chrome Local Network Access は標準実行経路ではありません。npm manager アプリが実際のサーバーです。"],platformTitle:"4. 現在のプラットフォーム状態",platformBody:"Windows は live screen transfer まで確認済みです。macOS と Linux も同じ npm コマンド経路を目標に対応を広げています。",platformPoints:["Windows: 動作確認済み。","macOS: 画面取得と制御には Screen Recording/Accessibility 権限が必要です。","Linux: linux-x64 runtime、grim/gnome-screenshot/import/scrot capture、xdotool input backend を追加済み。audio は未対応です。"],firewallTitle:"Firewall と外部拠点",firewallBody:"同じ LAN なら通常 router forwarding は不要です。外部拠点では client が manager の接続ポートへ到達できる必要があります。",firewallPoints:["client 接続ポートは TCP 5197 です。","client 側は通常 outbound だけで足ります。","外部 network では manager PC の firewall で TCP 5197 inbound を許可し、router から manager PC へ forward します。","5179 は manager UI 用なので、外部ブラウザで Wall を開く必要がある時だけ公開を検討します。","公開 internet より VPN、Tailscale、ZeroTier、IP allowlist を優先してください。"],commandsTitle:"現在のコマンド",commandsBody:"Web サイトから installer を探すより、OS をまたいで terminal 1行で動かす方向です。",managerCommandLabel:"manager 起動",clientCommandLabel:"workstation 接続",slotCommandLabel:"slot 3 に固定",manualCommandLabel:"高度な手動接続"}),"zh-CN":bn({languageName:"简体中文",languageLabel:"文档语言",eyebrow:"LiveDesk Manual",title:"用一条命令打开本地 Screen Wall",intro:"LiveDesk 是 npm-first 的远程工作台,用一台 manager PC 监控多台工作站、AI 主机、Mac mini 和开发机器。",managerTitle:"1. 运行 manager",managerBody:"在负责查看屏幕的电脑上运行 LiveDesk manager。它会同时启动 UI 和本地服务器,并打开 http://127.0.0.1:5179。",managerPoints:["命令是 npx -y livedesk。","Screen Wall/API 使用 5179,client 连接使用 5197。","如果旧的 LiveDesk 进程占用端口,默认会清理后重新启动。"],clientTitle:"2. 连接 workstation",clientBody:"在被监控的电脑上使用同一个 Google 账号登录。即使 manager 还没在线,client 也会继续运行并每 5 秒重试。",clientPoints:["自动放入空位: npx -y livedesk client。","固定到 3 号位置: npx -y livedesk client 3。","大量电脑也可以持续等待,不需要反复登录。"],syncTitle:"3. Sync Server 和自动发现",syncBody:"Sync Server 会把当前 manager 作为该账号的 active Screen Wall 写入 Supabase。client 登录后读取记录并依次尝试连接候选地址。",syncPoints:["记录包括 host instance、LAN/private 地址、public 候选、pair token 和短 lease。","优先尝试同一 LAN 地址,需要时再尝试外部地址。","manager 位置、VPN、防火墙或路由变化后请点击 Sync Server。","livedesk.pages.dev 的 Chrome Local Network Access 不再是默认运行方式。npm manager app 才是真正服务器。"],platformTitle:"4. 当前平台状态",platformBody:"Windows 已确认可传输实时画面。macOS 和 Linux 正按同一 npm 命令路径扩展支持。",platformPoints:["Windows: 已确认可用。","macOS: 画面捕获和控制需要 Screen Recording/Accessibility 权限。","Linux: 已加入 linux-x64 runtime、grim/gnome-screenshot/import/scrot 捕获、xdotool 输入后端。音频尚未启用。"],firewallTitle:"防火墙和外部地点",firewallBody:"同一 LAN 通常不需要路由端口转发。不同地点连接时,client 必须能访问 manager 的 client 连接端口。",firewallPoints:["client 连接端口是 TCP 5197。","client 机器通常只需要出站访问。","跨网络时,在 manager 防火墙放行 TCP 5197 入站,并在路由器转发到 manager PC。","5179 是 manager UI 端口,仅在需要远程浏览器直接打开 Wall 时考虑暴露。","优先使用 VPN、Tailscale、ZeroTier 或固定 IP allowlist。"],commandsTitle:"当前命令",commandsBody:"产品方向是跨操作系统使用一条终端命令,而不是先找网站、下载、安装。",managerCommandLabel:"启动 manager",clientCommandLabel:"连接 workstation",slotCommandLabel:"固定到 slot 3",manualCommandLabel:"高级手动连接"}),"zh-TW":bn({languageName:"繁體中文",languageLabel:"文件語言",eyebrow:"LiveDesk Manual",title:"用一行指令開啟本機 Screen Wall",intro:"LiveDesk 是 npm-first 的遠端工作台,用一台 manager PC 監看多台工作站、AI 主機、Mac mini 與開發機。",managerTitle:"1. 執行 manager",managerBody:"在負責看畫面的電腦上執行 LiveDesk manager。它會同時啟動 UI 與本機伺服器,並開啟 http://127.0.0.1:5179。",managerPoints:["指令是 npx -y livedesk。","Screen Wall/API 使用 5179,client 連線使用 5197。","若舊的 LiveDesk 程序占用連接埠,預設會清理後重新啟動。"],clientTitle:"2. 連接 workstation",clientBody:"在被監看的電腦上使用同一個 Google 帳號登入。即使 manager 尚未上線,client 也會持續執行並每 5 秒重試。",clientPoints:["自動放入空位: npx -y livedesk client。","固定到 3 號位置: npx -y livedesk client 3。","大量電腦也能持續等待,不需要反覆登入。"],syncTitle:"3. Sync Server 與自動探索",syncBody:"Sync Server 會把目前 manager 登錄為此帳號的 active Screen Wall。client 登入後讀取 Supabase 記錄並依序嘗試連線候選地址。",syncPoints:["記錄包含 host instance、LAN/private 位址、public 候選、pair token 與短 lease。","優先嘗試 LAN 位址,需要時再嘗試外部位址。","manager 位置、VPN、防火牆或路由設定改變後請按 Sync Server。","livedesk.pages.dev 的 Chrome Local Network Access 不再是預設執行路徑。npm manager app 才是真正伺服器。"],platformTitle:"4. 目前平台狀態",platformBody:"Windows 已確認可傳輸即時畫面。macOS 與 Linux 也沿用相同 npm 指令路徑擴充支援。",platformPoints:["Windows: 已確認可用。","macOS: 畫面擷取與控制需要 Screen Recording/Accessibility 權限。","Linux: 已加入 linux-x64 runtime、grim/gnome-screenshot/import/scrot capture、xdotool input backend。音訊尚未啟用。"],firewallTitle:"防火牆與外部地點",firewallBody:"同一 LAN 通常不需要路由器轉發。不同地點連線時,client 必須能到達 manager 的 client 連線埠。",firewallPoints:["client 連線埠是 TCP 5197。","client 電腦通常只需要對外連線。","跨網路時,請在 manager 防火牆允許 TCP 5197 inbound,並從路由器轉發到 manager PC。","5179 是 manager UI 連接埠,只在需要遠端瀏覽器直接打開 Wall 時才考慮公開。","優先使用 VPN、Tailscale、ZeroTier 或固定 IP allowlist。"],commandsTitle:"目前指令",commandsBody:"產品方向是跨作業系統用一行 terminal 指令,而不是先找網站、下載、安裝。",managerCommandLabel:"啟動 manager",clientCommandLabel:"連接 workstation",slotCommandLabel:"固定到 slot 3",manualCommandLabel:"進階手動連線"}),es:bn({languageName:"Español",languageLabel:"Idioma del documento",eyebrow:"LiveDesk Manual",title:"Abre un Screen Wall local con un comando",intro:"LiveDesk es una consola npm-first para vigilar muchas estaciones, cajas de IA, Mac mini y equipos de desarrollo desde un PC manager.",managerTitle:"1. Ejecuta el manager",managerBody:"Ejecuta LiveDesk en el equipo que verá las pantallas. El manager inicia la UI y el servidor local juntos y abre http://127.0.0.1:5179.",managerPoints:["El comando es npx -y livedesk.","El manager usa 5179 para Screen Wall/API y 5197 para conexiones client.","Si un proceso antiguo ocupa los puertos, el arranque lo limpia por defecto."],clientTitle:"2. Conecta una workstation",clientBody:"En cada equipo monitoreado, inicia sesión con la misma cuenta Google. Si el manager aún no está activo, el client sigue intentando cada 5 segundos.",clientPoints:["Usa npx -y livedesk client para el primer slot libre.","Usa npx -y livedesk client 3 para fijar el equipo al slot 3.","Los clients siguen esperando para no repetir login en muchas máquinas."],syncTitle:"3. Sync Server y descubrimiento",syncBody:"Sync Server publica este manager como Screen Wall activo para la cuenta. Los clients leen el registro en Supabase y prueban los endpoints.",syncPoints:["Incluye host instance, direcciones LAN/private, candidatos public, pair token y lease corto.","Primero se prueban candidatos LAN, luego públicos si hace falta.","Pulsa Sync Server después de cambios de manager, VPN, firewall o router.","Chrome Local Network Access en livedesk.pages.dev ya no es el flujo principal. La app npm manager es el servidor real."],platformTitle:"4. Estado de plataformas",platformBody:"Windows ya fue verificado con transferencia de pantalla. macOS y Linux siguen el mismo camino npm.",platformPoints:["Windows: verificado.","macOS: captura y control requieren permisos Screen Recording/Accessibility.","Linux: agregado linux-x64 runtime, captura grim/gnome-screenshot/import/scrot y entrada xdotool. Audio aún desactivado."],firewallTitle:"Firewall y sedes remotas",firewallBody:"En la misma LAN normalmente no hace falta port forwarding. Para otra red, los clients deben llegar al puerto client del manager.",firewallPoints:["Puerto de conexión client: TCP 5197.","Los equipos client normalmente solo necesitan salida.","Para redes remotas, permite TCP 5197 inbound en el manager y reenvía TCP 5197 al PC manager.","El puerto 5179 es para la UI del manager; expónlo solo si un navegador remoto debe abrir el Wall.","Prefiere VPN, Tailscale, ZeroTier o allowlist de IP fijas."],commandsTitle:"Comandos actuales",commandsBody:"La dirección del producto es un comando de terminal común entre sistemas, no descargar e instalar desde una web.",managerCommandLabel:"Iniciar manager",clientCommandLabel:"Conectar workstation",slotCommandLabel:"Fijar al slot 3",manualCommandLabel:"Conexión manual avanzada"}),fr:bn({languageName:"Français",languageLabel:"Langue du document",eyebrow:"LiveDesk Manual",title:"Ouvrir un Screen Wall local en une commande",intro:"LiveDesk est un deck npm-first pour surveiller plusieurs postes, machines IA, Mac mini et machines dev depuis un PC manager.",managerTitle:"1. Lancer le manager",managerBody:"Lancez LiveDesk sur l’ordinateur qui observe les écrans. Le manager démarre l’UI et le serveur local, puis ouvre http://127.0.0.1:5179.",managerPoints:["La commande est npx -y livedesk.","Le manager utilise 5179 pour Screen Wall/API et 5197 pour les connexions client.","Si un ancien processus utilise les ports, le démarrage le nettoie par défaut."],clientTitle:"2. Connecter une workstation",clientBody:"Sur chaque ordinateur surveillé, connectez-vous avec le même compte Google. Si le manager n’est pas encore actif, le client réessaie toutes les 5 secondes.",clientPoints:["Utilisez npx -y livedesk client pour le premier slot libre.","Utilisez npx -y livedesk client 3 pour fixer la machine au slot 3.","Les clients continuent d’attendre pour éviter les reconnexions répétées."],syncTitle:"3. Sync Server et découverte",syncBody:"Sync Server publie ce manager comme Screen Wall actif du compte. Les clients lisent l’enregistrement Supabase et testent les endpoints.",syncPoints:["Il contient host instance, adresses LAN/private, candidats public, pair token et lease court.","Les candidats LAN sont essayés en premier, puis les candidats publics si besoin.","Cliquez Sync Server après un changement de manager, VPN, firewall ou routeur.","Chrome Local Network Access sur livedesk.pages.dev n’est plus le chemin par défaut. L’app npm manager est le vrai serveur."],platformTitle:"4. État des plateformes",platformBody:"Windows est vérifié avec transfert d’écran live. macOS et Linux suivent le même chemin npm.",platformPoints:["Windows: vérifié.","macOS: capture et contrôle nécessitent Screen Recording/Accessibility.","Linux: runtime linux-x64, capture grim/gnome-screenshot/import/scrot et entrée xdotool ajoutés. Audio désactivé."],firewallTitle:"Firewall et sites distants",firewallBody:"Sur le même LAN, le port forwarding est rarement nécessaire. Depuis un autre réseau, les clients doivent atteindre le port client du manager.",firewallPoints:["Port de connexion client: TCP 5197.","Les machines client ont normalement seulement besoin de sortie réseau.","Pour un réseau distant, autorisez TCP 5197 entrant sur le manager et redirigez TCP 5197 vers le PC manager.","Le port 5179 sert à l’UI manager; exposez-le seulement si un navigateur distant doit ouvrir le Wall.","Préférez VPN, Tailscale, ZeroTier ou allowlist IP fixes."],commandsTitle:"Commandes actuelles",commandsBody:"La direction produit est une commande terminal commune aux OS, plutôt qu’un téléchargement manuel depuis un site.",managerCommandLabel:"Démarrer manager",clientCommandLabel:"Connecter workstation",slotCommandLabel:"Fixer au slot 3",manualCommandLabel:"Connexion manuelle avancée"}),de:bn({languageName:"Deutsch",languageLabel:"Dokumentsprache",eyebrow:"LiveDesk Manual",title:"Lokale Screen Wall mit einem Befehl öffnen",intro:"LiveDesk ist ein npm-first Arbeitsdeck, um viele Workstations, AI-Boxen, Mac minis und Dev-Rechner von einem Manager-PC zu überwachen.",managerTitle:"1. Manager starten",managerBody:"Starte LiveDesk auf dem Computer, der die Screens sieht. Der Manager startet UI und lokalen Server zusammen und öffnet http://127.0.0.1:5179.",managerPoints:["Der Befehl ist npx -y livedesk.","Der Manager nutzt 5179 für Screen Wall/API und 5197 für Client-Verbindungen.","Wenn alte LiveDesk-Prozesse Ports belegen, werden sie beim Start standardmäßig bereinigt."],clientTitle:"2. Workstation verbinden",clientBody:"Melde dich auf jedem überwachten Computer mit demselben Google-Konto an. Wenn kein Manager online ist, versucht der Client alle 5 Sekunden weiter.",clientPoints:["npx -y livedesk client nutzt den ersten freien Slot.","npx -y livedesk client 3 fixiert den Rechner auf Slot 3.","Clients warten weiter, damit große Setups kein wiederholtes Login brauchen."],syncTitle:"3. Sync Server und Discovery",syncBody:"Sync Server veröffentlicht diesen Manager als aktive Screen Wall des Kontos. Clients lesen den Supabase-Eintrag und testen Endpoints der Reihe nach.",syncPoints:["Enthält host instance, LAN/private Adressen, public Kandidaten, pair token und kurze lease.","LAN-Kandidaten werden zuerst versucht, danach public Kandidaten.","Nach Änderungen an Manager, VPN, Firewall oder Router Sync Server drücken.","Chrome Local Network Access auf livedesk.pages.dev ist nicht mehr der Standardpfad. Die npm Manager App ist der echte Server."],platformTitle:"4. Plattformstatus",platformBody:"Windows wurde mit Live-Screen-Transfer geprüft. macOS und Linux folgen demselben npm-Pfad.",platformPoints:["Windows: verifiziert.","macOS: Capture und Control brauchen Screen Recording/Accessibility Rechte.","Linux: linux-x64 Runtime, grim/gnome-screenshot/import/scrot Capture und xdotool Input Backend sind ergänzt. Audio ist deaktiviert."],firewallTitle:"Firewall und entfernte Standorte",firewallBody:"Im gleichen LAN ist Router-Forwarding meist unnötig. Aus anderen Netzwerken müssen Clients den Client-Port des Managers erreichen.",firewallPoints:["Client-Verbindungsport: TCP 5197.","Client-Rechner brauchen normalerweise nur ausgehenden Zugriff.","Für entfernte Netzwerke TCP 5197 inbound am Manager erlauben und vom Router zum Manager-PC forwarden.","Port 5179 ist für die Manager-UI; nur öffnen, wenn ein Remote-Browser die Wall direkt öffnen muss.","VPN, Tailscale, ZeroTier oder feste IP-Allowlists bevorzugen."],commandsTitle:"Aktuelle Befehle",commandsBody:"Die Produktlinie ist ein Terminalbefehl über Betriebssysteme hinweg, statt Website suchen, herunterladen und installieren.",managerCommandLabel:"Manager starten",clientCommandLabel:"Workstation verbinden",slotCommandLabel:"An Slot 3 fixieren",manualCommandLabel:"Erweiterte manuelle Verbindung"}),"pt-BR":bn({languageName:"Português",languageLabel:"Idioma do documento",eyebrow:"LiveDesk Manual",title:"Abra um Screen Wall local com um comando",intro:"LiveDesk é um deck npm-first para monitorar várias estações, caixas de IA, Mac minis e máquinas dev a partir de um PC manager.",managerTitle:"1. Execute o manager",managerBody:"Rode LiveDesk no computador que verá as telas. O manager inicia a UI e o servidor local juntos e abre http://127.0.0.1:5179.",managerPoints:["O comando é npx -y livedesk.","O manager usa 5179 para Screen Wall/API e 5197 para conexões client.","Se um processo antigo ocupa as portas, a inicialização limpa por padrão."],clientTitle:"2. Conecte uma workstation",clientBody:"Em cada computador monitorado, entre com a mesma conta Google. Se o manager ainda não estiver online, o client tenta a cada 5 segundos.",clientPoints:["Use npx -y livedesk client para o primeiro slot livre.","Use npx -y livedesk client 3 para fixar no slot 3.","Clients continuam tentando para evitar login repetido em muitos PCs."],syncTitle:"3. Sync Server e descoberta",syncBody:"Sync Server publica este manager como Screen Wall ativo da conta. Clients leem o registro no Supabase e testam endpoints.",syncPoints:["Inclui host instance, endereços LAN/private, candidatos public, pair token e lease curto.","Candidatos LAN vêm primeiro; public depois se necessário.","Clique Sync Server após mudanças de manager, VPN, firewall ou roteador.","Chrome Local Network Access em livedesk.pages.dev não é mais o caminho padrão. O app npm manager é o servidor real."],platformTitle:"4. Estado das plataformas",platformBody:"Windows foi verificado com transferência de tela. macOS e Linux seguem o mesmo caminho npm.",platformPoints:["Windows: verificado.","macOS: captura e controle precisam de permissões Screen Recording/Accessibility.","Linux: runtime linux-x64, captura grim/gnome-screenshot/import/scrot e entrada xdotool adicionados. Áudio ainda desativado."],firewallTitle:"Firewall e locais remotos",firewallBody:"Na mesma LAN normalmente não é preciso port forwarding. Em outra rede, clients precisam alcançar a porta client do manager.",firewallPoints:["Porta client: TCP 5197.","Máquinas client normalmente só precisam de saída.","Para redes remotas, permita TCP 5197 inbound no manager e encaminhe TCP 5197 para o PC manager.","A porta 5179 é para a UI do manager; exponha apenas se um navegador remoto precisar abrir o Wall.","Prefira VPN, Tailscale, ZeroTier ou allowlist de IP fixo."],commandsTitle:"Comandos atuais",commandsBody:"A direção do produto é um comando de terminal comum entre sistemas, não baixar e instalar manualmente.",managerCommandLabel:"Iniciar manager",clientCommandLabel:"Conectar workstation",slotCommandLabel:"Fixar no slot 3",manualCommandLabel:"Conexão manual avançada"}),it:bn({languageName:"Italiano",languageLabel:"Lingua documento",eyebrow:"LiveDesk Manual",title:"Apri uno Screen Wall locale con un comando",intro:"LiveDesk è un deck npm-first per monitorare workstation, box AI, Mac mini e macchine dev da un solo PC manager.",managerTitle:"1. Avvia il manager",managerBody:"Esegui LiveDesk sul computer che guarderà gli schermi. Il manager avvia UI e server locale e apre http://127.0.0.1:5179.",managerPoints:["Il comando è npx -y livedesk.","Il manager usa 5179 per Screen Wall/API e 5197 per connessioni client.","Se vecchi processi occupano le porte, l’avvio le pulisce di default."],clientTitle:"2. Connetti una workstation",clientBody:"Su ogni computer monitorato, accedi con lo stesso account Google. Se il manager non è online, il client riprova ogni 5 secondi.",clientPoints:["npx -y livedesk client usa il primo slot libero.","npx -y livedesk client 3 fissa la macchina allo slot 3.","I client continuano a provare per evitare login ripetuti."],syncTitle:"3. Sync Server e discovery",syncBody:"Sync Server pubblica questo manager come Screen Wall attivo dell’account. I client leggono Supabase e provano gli endpoint.",syncPoints:["Include host instance, indirizzi LAN/private, candidati public, pair token e lease breve.","Prima LAN, poi public se necessario.","Premi Sync Server dopo cambi di manager, VPN, firewall o router.","Chrome Local Network Access su livedesk.pages.dev non è più il percorso principale. L’app npm manager è il server reale."],platformTitle:"4. Stato piattaforme",platformBody:"Windows è verificato con trasferimento schermo live. macOS e Linux seguono lo stesso percorso npm.",platformPoints:["Windows: verificato.","macOS: capture e control richiedono permessi Screen Recording/Accessibility.","Linux: aggiunti runtime linux-x64, capture grim/gnome-screenshot/import/scrot e input xdotool. Audio disattivato."],firewallTitle:"Firewall e sedi remote",firewallBody:"Nella stessa LAN di solito non serve port forwarding. Da altre reti, i client devono raggiungere la porta client del manager.",firewallPoints:["Porta client: TCP 5197.","I client normalmente richiedono solo uscita.","Per reti remote, abilita TCP 5197 inbound sul manager e inoltra TCP 5197 al PC manager.","La porta 5179 è per la UI manager; esponila solo se un browser remoto deve aprire il Wall.","Preferisci VPN, Tailscale, ZeroTier o IP allowlist."],commandsTitle:"Comandi attuali",commandsBody:"La direzione è un comando terminale comune tra sistemi operativi, invece di download e install manuale.",managerCommandLabel:"Avvia manager",clientCommandLabel:"Connetti workstation",slotCommandLabel:"Fissa allo slot 3",manualCommandLabel:"Connessione manuale avanzata"}),id:bn({languageName:"Bahasa Indonesia",languageLabel:"Bahasa dokumen",eyebrow:"LiveDesk Manual",title:"Buka Screen Wall lokal dengan satu perintah",intro:"LiveDesk adalah deck npm-first untuk memantau banyak workstation, AI box, Mac mini, dan mesin dev dari satu PC manager.",managerTitle:"1. Jalankan manager",managerBody:"Jalankan LiveDesk di komputer yang melihat layar. Manager membuka UI dan server lokal bersama, lalu membuka http://127.0.0.1:5179.",managerPoints:["Perintahnya npx -y livedesk.","Manager memakai 5179 untuk Screen Wall/API dan 5197 untuk koneksi client.","Jika proses lama memakai port itu, startup membersihkannya secara default."],clientTitle:"2. Hubungkan workstation",clientBody:"Di komputer yang dipantau, masuk dengan akun Google yang sama. Jika manager belum online, client tetap mencoba tiap 5 detik.",clientPoints:["npx -y livedesk client memakai slot kosong pertama.","npx -y livedesk client 3 mengunci mesin ke slot 3.","Client terus mencoba agar banyak PC tidak perlu login berulang."],syncTitle:"3. Sync Server dan discovery",syncBody:"Sync Server menerbitkan manager ini sebagai Screen Wall aktif untuk akun. Client membaca Supabase dan mencoba endpoint.",syncPoints:["Berisi host instance, alamat LAN/private, kandidat public, pair token, dan lease pendek.","Kandidat LAN dicoba lebih dulu, lalu public jika perlu.","Tekan Sync Server setelah perubahan manager, VPN, firewall, atau router.","Chrome Local Network Access di livedesk.pages.dev bukan jalur utama lagi. App npm manager adalah server sebenarnya."],platformTitle:"4. Status platform",platformBody:"Windows sudah diverifikasi dengan live screen transfer. macOS dan Linux mengikuti jalur npm yang sama.",platformPoints:["Windows: terverifikasi.","macOS: capture dan control perlu izin Screen Recording/Accessibility.","Linux: runtime linux-x64, capture grim/gnome-screenshot/import/scrot, dan input xdotool sudah ditambahkan. Audio belum aktif."],firewallTitle:"Firewall dan lokasi luar",firewallBody:"Di LAN yang sama biasanya tidak perlu port forwarding. Dari jaringan lain, client harus mencapai port client manager.",firewallPoints:["Port client: TCP 5197.","Mesin client biasanya hanya perlu akses keluar.","Untuk jaringan luar, izinkan TCP 5197 inbound di manager dan forward TCP 5197 ke PC manager.","Port 5179 untuk UI manager; buka hanya jika browser luar harus membuka Wall.","Utamakan VPN, Tailscale, ZeroTier, atau IP allowlist."],commandsTitle:"Perintah saat ini",commandsBody:"Arah produk adalah satu perintah terminal lintas OS, bukan download dan instal manual.",managerCommandLabel:"Mulai manager",clientCommandLabel:"Hubungkan workstation",slotCommandLabel:"Kunci ke slot 3",manualCommandLabel:"Koneksi manual lanjutan"}),vi:bn({languageName:"Tiếng Việt",languageLabel:"Ngôn ngữ tài liệu",eyebrow:"LiveDesk Manual",title:"Mở Screen Wall cục bộ bằng một lệnh",intro:"LiveDesk là deck npm-first để giám sát nhiều workstation, máy AI, Mac mini và máy dev từ một PC manager.",managerTitle:"1. Chạy manager",managerBody:"Chạy LiveDesk trên máy dùng để xem màn hình. Manager khởi động UI và server cục bộ cùng lúc, rồi mở http://127.0.0.1:5179.",managerPoints:["Lệnh là npx -y livedesk.","Manager dùng 5179 cho Screen Wall/API và 5197 cho kết nối client.","Nếu tiến trình cũ giữ port, startup mặc định sẽ dọn và khởi động lại."],clientTitle:"2. Kết nối workstation",clientBody:"Trên mỗi máy được giám sát, đăng nhập cùng tài khoản Google. Nếu manager chưa online, client tiếp tục thử mỗi 5 giây.",clientPoints:["npx -y livedesk client dùng slot trống đầu tiên.","npx -y livedesk client 3 ghim máy vào slot 3.","Client tiếp tục chờ để nhiều máy không cần đăng nhập lại."],syncTitle:"3. Sync Server và tự phát hiện",syncBody:"Sync Server đăng manager này là Screen Wall đang hoạt động của tài khoản. Client đọc Supabase và thử các endpoint.",syncPoints:["Bao gồm host instance, địa chỉ LAN/private, public candidate, pair token và lease ngắn.","Ưu tiên LAN trước, sau đó thử public nếu cần.","Bấm Sync Server sau thay đổi manager, VPN, firewall hoặc router.","Chrome Local Network Access trên livedesk.pages.dev không còn là đường chạy chính. App npm manager mới là server thật."],platformTitle:"4. Trạng thái nền tảng",platformBody:"Windows đã được kiểm chứng với truyền màn hình live. macOS và Linux đi theo cùng đường npm.",platformPoints:["Windows: đã kiểm chứng.","macOS: capture và control cần quyền Screen Recording/Accessibility.","Linux: đã thêm runtime linux-x64, capture grim/gnome-screenshot/import/scrot và input xdotool. Audio chưa bật."],firewallTitle:"Firewall và địa điểm ngoài",firewallBody:"Trong cùng LAN thường không cần port forwarding. Từ mạng khác, client phải truy cập được port client của manager.",firewallPoints:["Port client: TCP 5197.","Máy client thường chỉ cần kết nối outbound.","Với mạng ngoài, cho phép TCP 5197 inbound trên manager và forward TCP 5197 tới PC manager.","Port 5179 dành cho UI manager; chỉ mở nếu trình duyệt từ xa cần mở Wall trực tiếp.","Ưu tiên VPN, Tailscale, ZeroTier hoặc allowlist IP cố định."],commandsTitle:"Lệnh hiện tại",commandsBody:"Hướng sản phẩm là một lệnh terminal dùng chung giữa các OS, thay vì tải và cài thủ công.",managerCommandLabel:"Khởi động manager",clientCommandLabel:"Kết nối workstation",slotCommandLabel:"Ghim vào slot 3",manualCommandLabel:"Kết nối thủ công nâng cao"}),th:bn({languageName:"ไทย",languageLabel:"ภาษาของเอกสาร",eyebrow:"LiveDesk Manual",title:"เปิด Screen Wall ภายในด้วยคำสั่งเดียว",intro:"LiveDesk คือ deck แบบ npm-first สำหรับดู workstation, กล่อง AI, Mac mini และเครื่อง dev หลายเครื่องจาก manager PC เครื่องเดียว",managerTitle:"1. รัน manager",managerBody:"รัน LiveDesk บนเครื่องที่ใช้ดูหน้าจอ Manager จะเปิด UI และ local server พร้อมกัน แล้วเปิด http://127.0.0.1:5179",managerPoints:["คำสั่งคือ npx -y livedesk","Manager ใช้ 5179 สำหรับ Screen Wall/API และ 5197 สำหรับ client connection","ถ้า process เก่ายังใช้ port อยู่ startup จะล้างให้โดย default"],clientTitle:"2. เชื่อม workstation",clientBody:"บนเครื่องที่ต้อง monitor ให้ login ด้วย Google account เดียวกัน ถ้า manager ยังไม่ออนไลน์ client จะลองใหม่ทุก 5 วินาที",clientPoints:["npx -y livedesk client จะใช้ slot ว่างแรก","npx -y livedesk client 3 จะตรึงเครื่องไว้ที่ slot 3","Client จะรอต่อเนื่องเพื่อไม่ต้อง login ซ้ำเมื่อมีหลายเครื่อง"],syncTitle:"3. Sync Server และ discovery",syncBody:"Sync Server จะ publish manager นี้เป็น active Screen Wall ของ account แล้ว client อ่านข้อมูลจาก Supabase และลอง endpoint ต่างๆ",syncPoints:["มี host instance, LAN/private address, public candidate, pair token และ short lease","ลอง LAN ก่อน แล้วค่อยลอง public ถ้าจำเป็น","กด Sync Server หลังเปลี่ยน manager, VPN, firewall หรือ router","Chrome Local Network Access บน livedesk.pages.dev ไม่ใช่ runtime หลักแล้ว app npm manager คือ server จริง"],platformTitle:"4. สถานะ platform",platformBody:"Windows ตรวจสอบแล้วว่าส่งภาพ live ได้ macOS และ Linux ใช้เส้นทาง npm เดียวกัน",platformPoints:["Windows: verified","macOS: capture/control ต้องใช้สิทธิ์ Screen Recording/Accessibility","Linux: เพิ่ม linux-x64 runtime, grim/gnome-screenshot/import/scrot capture และ xdotool input แล้ว audio ยังปิดอยู่"],firewallTitle:"Firewall และเครื่องต่างสถานที่",firewallBody:"ใน LAN เดียวกันปกติไม่ต้อง port forwarding ถ้าอยู่คนละ network client ต้องเข้าถึง client port ของ manager ได้",firewallPoints:["Client port คือ TCP 5197","เครื่อง client ปกติต้องการ outbound เท่านั้น","ถ้าอยู่นอก network ให้เปิด TCP 5197 inbound ที่ manager และ forward TCP 5197 ไปยัง manager PC","Port 5179 เป็น UI ของ manager เปิดเฉพาะเมื่อ browser ระยะไกลต้องเปิด Wall โดยตรง","ควรใช้ VPN, Tailscale, ZeroTier หรือ IP allowlist ก่อนเปิดสู่ public internet"],commandsTitle:"คำสั่งปัจจุบัน",commandsBody:"ทิศทาง product คือคำสั่ง terminal เดียวข้าม OS ไม่ใช่ download/install จากเว็บไซต์",managerCommandLabel:"เริ่ม manager",clientCommandLabel:"เชื่อม workstation",slotCommandLabel:"ตรึง slot 3",manualCommandLabel:"manual connection ขั้นสูง"}),hi:bn({languageName:"हिन्दी",languageLabel:"दस्तावेज़ भाषा",eyebrow:"LiveDesk Manual",title:"एक कमांड से local Screen Wall खोलें",intro:"LiveDesk एक npm-first remote work deck है जिससे एक manager PC से कई workstation, AI box, Mac mini और dev machines देखे जा सकते हैं।",managerTitle:"1. manager चलाएं",managerBody:"जिस computer से screens देखनी हैं उस पर LiveDesk manager चलाएं। यह UI और local server साथ में शुरू करता है और http://127.0.0.1:5179 खोलता है।",managerPoints:["कमांड है npx -y livedesk।","Manager Screen Wall/API के लिए 5179 और client connections के लिए 5197 इस्तेमाल करता है।","अगर पुराने LiveDesk ports बचे हों तो startup default रूप से साफ करता है।"],clientTitle:"2. workstation जोड़ें",clientBody:"हर monitored computer पर उसी Google account से sign in करें। Manager online न हो तब भी client बंद नहीं होता और हर 5 सेकंड retry करता है।",clientPoints:["npx -y livedesk client पहला खाली slot लेता है।","npx -y livedesk client 3 machine को slot 3 पर pin करता है।","बहुत सी machines हों तब भी बार-बार login की जरूरत नहीं रहती।"],syncTitle:"3. Sync Server और discovery",syncBody:"Sync Server इस manager को account का active Screen Wall बनाकर Supabase में publish करता है। Clients record पढ़कर endpoints try करते हैं।",syncPoints:["इसमें host instance, LAN/private addresses, public candidates, pair token और short lease होता है।","LAN candidates पहले try होते हैं, जरूरत हो तो public candidates।","Manager, VPN, firewall या router बदलने के बाद Sync Server दबाएं।","livedesk.pages.dev का Chrome Local Network Access अब default runtime नहीं है। npm manager app ही real server है।"],platformTitle:"4. Platform status",platformBody:"Windows live screen transfer के साथ verified है। macOS और Linux भी इसी npm path पर आगे बढ़ रहे हैं।",platformPoints:["Windows: verified.","macOS: capture/control के लिए Screen Recording/Accessibility permissions चाहिए।","Linux: linux-x64 runtime, grim/gnome-screenshot/import/scrot capture और xdotool input backend जोड़े गए हैं। Audio अभी disabled है।"],firewallTitle:"Firewall और remote locations",firewallBody:"Same LAN में आम तौर पर router forwarding जरूरी नहीं। दूसरे network से clients को manager client port तक पहुंचना होगा।",firewallPoints:["Client connection port: TCP 5197.","Client machines को आम तौर पर सिर्फ outbound access चाहिए।","Remote network के लिए manager firewall में TCP 5197 inbound allow करें और router से TCP 5197 manager PC पर forward करें।","5179 manager UI port है; इसे तभी expose करें जब remote browser को Wall खोलना हो।","Public internet से पहले VPN, Tailscale, ZeroTier या fixed IP allowlist बेहतर है।"],commandsTitle:"Current commands",commandsBody:"Product direction है OS के बीच एक terminal command, website से download/install नहीं।",managerCommandLabel:"Start manager",clientCommandLabel:"Connect workstation",slotCommandLabel:"Pin to slot 3",manualCommandLabel:"Advanced manual connection"}),ar:bn({languageName:"العربية",languageLabel:"لغة المستند",eyebrow:"LiveDesk Manual",title:"افتح Screen Wall محلي بأمر واحد",intro:"LiveDesk هو deck بنمط npm-first لمراقبة عدة workstations وأجهزة AI وMac mini وأجهزة تطوير من كمبيوتر manager واحد.",managerTitle:"1. شغل manager",managerBody:"شغل LiveDesk على الكمبيوتر الذي سيعرض الشاشات. يبدأ manager الواجهة والخادم المحلي معا ويفتح http://127.0.0.1:5179.",managerPoints:["الأمر هو npx -y livedesk.","يستخدم manager المنفذ 5179 للواجهة/API والمنفذ 5197 لاتصالات client.","إذا بقيت عملية LiveDesk قديمة على المنافذ، يتم تنظيفها افتراضيا عند التشغيل."],clientTitle:"2. وصل workstation",clientBody:"على كل كمبيوتر تتم مراقبته، سجل الدخول بنفس حساب Google. إذا لم يكن manager متاحا، يبقى client يعمل ويحاول كل 5 ثوان.",clientPoints:["npx -y livedesk client يختار أول slot فارغ.","npx -y livedesk client 3 يثبت الجهاز في slot 3.","clients تستمر بالمحاولة لتجنب تكرار تسجيل الدخول عند كثرة الأجهزة."],syncTitle:"3. Sync Server والاكتشاف",syncBody:"Sync Server ينشر هذا manager كـ active Screen Wall للحساب. يقرأ clients سجل Supabase ويجربون endpoints بالترتيب.",syncPoints:["السجل يتضمن host instance وعناوين LAN/private وpublic candidates وpair token وlease قصير.","يتم تفضيل LAN أولا، ثم public عند الحاجة.","اضغط Sync Server بعد تغيير manager أو VPN أو firewall أو router.","Chrome Local Network Access على livedesk.pages.dev لم يعد مسار التشغيل الافتراضي. تطبيق npm manager هو الخادم الحقيقي."],platformTitle:"4. حالة المنصات",platformBody:"Windows تم التحقق منه مع نقل شاشة live. macOS وLinux يتبعان نفس مسار npm.",platformPoints:["Windows: تم التحقق.","macOS: capture/control يحتاجان أذونات Screen Recording/Accessibility.","Linux: تمت إضافة linux-x64 runtime وgrim/gnome-screenshot/import/scrot capture وxdotool input. الصوت ما زال معطلا."],firewallTitle:"Firewall والمواقع البعيدة",firewallBody:"داخل نفس LAN غالبا لا تحتاج port forwarding. من شبكة أخرى يجب أن يصل client إلى منفذ manager client.",firewallPoints:["منفذ client: TCP 5197.","أجهزة client تحتاج عادة اتصال outbound فقط.","للشبكات البعيدة، اسمح TCP 5197 inbound على manager ووجه TCP 5197 من router إلى manager PC.","المنفذ 5179 مخصص لواجهة manager؛ اكشفه فقط إذا كان متصفح بعيد يحتاج فتح Wall مباشرة.","يفضل VPN أو Tailscale أو ZeroTier أو fixed IP allowlist بدل التعريض العام."],commandsTitle:"الأوامر الحالية",commandsBody:"اتجاه المنتج هو أمر terminal واحد عبر الأنظمة، وليس تحميل وتثبيت يدوي من موقع.",managerCommandLabel:"Start manager",clientCommandLabel:"Connect workstation",slotCommandLabel:"Pin to slot 3",manualCommandLabel:"Advanced manual connection"}),tr:bn({languageName:"Türkçe",languageLabel:"Belge dili",eyebrow:"LiveDesk Manual",title:"Yerel Screen Wall tek komutla açılsın",intro:"LiveDesk, tek bir manager PC üzerinden birçok workstation, AI box, Mac mini ve dev machine izlemek için npm-first bir çalışma deckidir.",managerTitle:"1. Manager çalıştır",managerBody:"Ekranları izleyecek bilgisayarda LiveDesk manager çalıştır. Manager UI ve local server birlikte başlar ve http://127.0.0.1:5179 açılır.",managerPoints:["Komut: npx -y livedesk.","Manager Screen Wall/API için 5179, client bağlantıları için 5197 kullanır.","Eski LiveDesk process portları tutuyorsa başlangıç varsayılan olarak temizler."],clientTitle:"2. Workstation bağla",clientBody:"İzlenecek bilgisayarda aynı Google hesabıyla giriş yap. Manager henüz online değilse client kapanmaz ve her 5 saniyede tekrar dener.",clientPoints:["npx -y livedesk client ilk boş slota yerleşir.","npx -y livedesk client 3 makineyi slot 3’e sabitler.","Çok makinede tekrar tekrar login gerekmesin diye client beklemeye devam eder."],syncTitle:"3. Sync Server ve discovery",syncBody:"Sync Server bu managerı hesabın active Screen Wall kaydı olarak Supabase’e yazar. Clients bu kaydı okuyup endpoint adaylarını dener.",syncPoints:["Host instance, LAN/private adresler, public adaylar, pair token ve kısa lease içerir.","Önce LAN adayları, gerekirse public adaylar denenir.","Manager, VPN, firewall veya router değişince Sync Server’a bas.","livedesk.pages.dev üzerindeki Chrome Local Network Access artık default runtime yolu değil. Gerçek server npm manager app."],platformTitle:"4. Platform durumu",platformBody:"Windows live screen transfer ile doğrulandı. macOS ve Linux aynı npm yolunu takip ediyor.",platformPoints:["Windows: doğrulandı.","macOS: capture/control için Screen Recording/Accessibility izinleri gerekir.","Linux: linux-x64 runtime, grim/gnome-screenshot/import/scrot capture ve xdotool input backend eklendi. Audio kapalı."],firewallTitle:"Firewall ve uzak konumlar",firewallBody:"Aynı LAN içinde genelde router forwarding gerekmez. Başka ağdan clients manager client portuna ulaşabilmelidir.",firewallPoints:["Client port: TCP 5197.","Client makineler normalde sadece outbound erişim ister.","Uzak ağ için manager firewall üzerinde TCP 5197 inbound aç ve routerdan TCP 5197yi manager PCye forward et.","5179 manager UI portudur; sadece uzak browser Wall açacaksa expose et.","Public internet yerine VPN, Tailscale, ZeroTier veya sabit IP allowlist tercih et."],commandsTitle:"Güncel komutlar",commandsBody:"Ürün yönü, webden indirip kurmak yerine işletim sistemleri arasında ortak tek terminal komutu.",managerCommandLabel:"Manager başlat",clientCommandLabel:"Workstation bağla",slotCommandLabel:"Slot 3’e sabitle",manualCommandLabel:"Gelişmiş manuel bağlantı"})},JC=Object.entries(nr).map(([a,l])=>({id:a,label:l.languageName}));function ej(){if(typeof navigator>"u")return"en";const a=navigator.languages?.length?navigator.languages:[navigator.language];for(const l of a){const s=l.toLowerCase();if(nr[l])return l;if(s.startsWith("zh-tw")||s.startsWith("zh-hk"))return"zh-TW";if(s.startsWith("pt"))return"pt-BR";const r=s.split("-")[0];if(nr[r])return r}return"en"}function sv({index:a,selected:l,onSelect:s}){const r=a+1;return o.jsx("article",{className:`device-tile placeholder-tile ${l?"selected":""}`,children:o.jsxs("button",{className:"tile-screen",onClick:s,"aria-pressed":l,title:`Select slot ${r}`,type:"button",children:[o.jsx("span",{className:"slot-grid","aria-hidden":"true"}),o.jsxs("span",{className:"empty-screen",children:[o.jsx(_a,{size:24}),o.jsxs("strong",{children:["Slot ",String(r).padStart(3,"0")]})]})]})})}function am({device:a,frame:l,selected:s,controlEnabled:r,showStatus:c,monitorIndex:d,monitorCount:h,onSelect:p,onFocusDevice:g,onOpenControl:x,onCycleMonitor:y,onCanvasReady:v,sendInput:w,presentationReady:M}){const C=m.useRef(null),j=m.useRef(null),k=m.useRef(0),T=m.useRef(null),A=xy(a),L=["cpu","gpu","memory","vram"].map(_=>A.metrics.find(ae=>ae.id===_)).filter(_=>!!_),q=la(d,h),U=h>1,X=M??!!l,E=BC(a,l,q),P=E>=ou?100:E/ou*100,te=E>=ou?ou/E*100:100,B={"--screen-aspect":E.toFixed(5),"--screen-content-width":`${Math.max(1,Math.min(100,P)).toFixed(3)}%`,"--screen-content-height":`${Math.max(1,Math.min(100,te)).toFixed(3)}%`},ue=m.useCallback(_=>{C.current=_,v(a.deviceId,_)},[a.deviceId,v]),G=_=>{const ae=_.currentTarget.getBoundingClientRect();return{normalizedX:Math.max(0,Math.min(1,(_.clientX-ae.left)/Math.max(1,ae.width))),normalizedY:Math.max(0,Math.min(1,(_.clientY-ae.top)/Math.max(1,ae.height)))}},de=_=>({shiftKey:_.shiftKey,ctrlKey:_.ctrlKey,altKey:_.altKey,metaKey:_.metaKey}),re=m.useCallback(()=>{T.current!==null&&(window.cancelAnimationFrame(T.current),T.current=null)},[]),fe=m.useCallback(()=>{const _=j.current;if(!_)return;j.current=null;const ae=Number(_.input.normalizedX),me=Number(_.input.normalizedY);if(!Number.isFinite(ae)||!Number.isFinite(me))return;w(a.deviceId,{..._.input,normalizedX:ae,normalizedY:me})&&(k.current=performance.now())},[a.deviceId,w]),I=m.useCallback(()=>{T.current===null&&(T.current=window.requestAnimationFrame(()=>{T.current=null,fe()}))},[fe]);m.useEffect(()=>()=>{re(),j.current=null},[re]);const Z=(_,ae)=>{if(!r)return;const me={type:ae,monitorIndex:q,...G(_),button:VC(_.button),...de(_)};if(ae==="pointermove"){const z=performance.now();j.current={input:me},z-k.current>=dC&&(re(),fe()),I();return}j.current&&(re(),fe()),w(a.deviceId,me)},ee=m.useCallback(_=>{const ae=document.activeElement;ae instanceof HTMLElement&&_.contains(ae)&&ae.classList.contains("monitor-cycle-button")&&ae.blur()},[]);return o.jsx("article",{className:`device-tile ${s?"selected":""} ${a.connected?"online":"offline"}`,"data-live-device-id":a.deviceId,style:B,children:o.jsxs("div",{className:`tile-screen ${X?"has-frame":"is-empty"}`,role:"button",tabIndex:r?-1:0,"aria-pressed":s,onClick:()=>{r||p()},onKeyDown:_=>{r||(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),p())},onDoubleClick:_=>{_.preventDefault(),x()},onPointerLeave:_=>ee(_.currentTarget),children:[o.jsx("span",{className:`screen-content ${X?"has-frame":"is-empty"}`,children:o.jsx("canvas",{ref:ue,className:`remote-canvas ${X?"has-frame":"is-empty"}`,tabIndex:r?0:-1,onPointerDown:_=>{r&&(_.preventDefault(),_.stopPropagation(),g(),_.currentTarget.focus(),_.currentTarget.setPointerCapture(_.pointerId),Z(_,"pointerdown"))},onPointerMove:_=>{r&&_.preventDefault(),Z(_,"pointermove")},onPointerUp:_=>{r&&(_.preventDefault(),_.stopPropagation(),Z(_,"pointerup"),_.currentTarget.hasPointerCapture(_.pointerId)&&_.currentTarget.releasePointerCapture(_.pointerId))},onPointerCancel:_=>{_.currentTarget.hasPointerCapture(_.pointerId)&&_.currentTarget.releasePointerCapture(_.pointerId)},onWheel:_=>{r&&(_.preventDefault(),w(a.deviceId,{type:"wheel",monitorIndex:q,...G(_),deltaX:_.deltaX,deltaY:_.deltaY,...de(_)}))},onKeyDown:_=>{r&&(_.preventDefault(),_.stopPropagation(),w(a.deviceId,{type:"keydown",monitorIndex:q,key:_.key,code:_.code,keyCode:_.keyCode||_.which||0,location:_.location,text:_.key.length===1?_.key:"",repeat:_.repeat,...de(_)}))},onKeyUp:_=>{r&&(_.preventDefault(),_.stopPropagation(),w(a.deviceId,{type:"keyup",monitorIndex:q,key:_.key,code:_.code,keyCode:_.keyCode||_.which||0,location:_.location,text:_.key.length===1?_.key:"",repeat:!1,...de(_)}))},onContextMenu:_=>r&&_.preventDefault()})}),!X&&o.jsx("span",{className:"empty-screen",children:o.jsx(_a,{size:26})}),c&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:`tile-health-pill state-${A.state}`,children:A.label}),o.jsx("span",{className:"tile-metrics","aria-label":`${No(a)} status`,children:L.map(_=>o.jsxs("span",{className:`tile-metric state-${_.state}`,children:[o.jsx("b",{children:_.label}),o.jsx("em",{children:_.value}),_.ratio!==void 0&&o.jsx("i",{style:{width:`${Math.round(_.ratio*100)}%`}})]},_.id))})]}),U&&o.jsxs("span",{className:"monitor-cycle","aria-label":`${No(a)} display ${q+1} of ${h}`,children:[o.jsx("button",{className:"monitor-cycle-button previous",onClick:_=>{_.preventDefault(),_.stopPropagation(),y(-1),_.currentTarget.blur()},title:"Previous display",type:"button",children:o.jsx(uv,{size:18})}),o.jsxs("span",{className:"monitor-cycle-count",children:["Screen ",q+1,"/",h]}),o.jsx("button",{className:"monitor-cycle-button next",onClick:_=>{_.preventDefault(),_.stopPropagation(),y(1),_.currentTarget.blur()},title:"Next display",type:"button",children:o.jsx(Am,{size:18})})]})]})})}function tj({visible:a}){return m.useEffect(()=>{if(!a||!Kf)return;if(!document.getElementById(Gx)){const s=document.createElement("script");s.id=Gx,s.async=!0,s.crossOrigin="anonymous",s.src=`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${encodeURIComponent(wm)}`,document.head.appendChild(s)}const l=window.setTimeout(()=>{try{window.adsbygoogle=window.adsbygoogle||[],window.adsbygoogle.push({})}catch{}},120);return()=>window.clearTimeout(l)},[a]),a?o.jsxs("aside",{className:`free-ad-banner ${Kf?"adsense-ready":"house-ad"}`,"aria-label":"Advertisement",children:[o.jsx("span",{className:"ad-label",children:"Advertisement"}),Kf?o.jsx("ins",{className:"adsbygoogle livedesk-ad-unit",style:{display:"block"},"data-ad-client":wm,"data-ad-slot":cy,"data-ad-format":"auto","data-full-width-responsive":"true"}):o.jsxs("div",{className:"house-ad-copy",children:[o.jsx("strong",{children:"Sponsored placement"}),o.jsx("span",{children:"Local AI gear, mini PCs, GPUs, NAS, and developer tools."})]})]}):null}function nj(){const a=bC(),{session:l,loading:s}=K0(),{target:r,error:c,refresh:d}=Z0(l),h=m.useMemo(()=>{if(!r?.active)return null;const S=r.expires_at?Date.parse(r.expires_at):Number.POSITIVE_INFINITY;return Number.isFinite(S)&&S<=Date.now()?null:r},[r]),p=m.useMemo(()=>rx(h),[h]),g=m.useMemo(()=>p.length>0?[...new Set([...p,mn])]:[mn],[p]),[x,y]=m.useState(LC),v=m.useMemo(()=>g.some(S=>!!So(S)),[g]),w=!v||x,{status:M,devices:C,error:j,refresh:k,hubBaseUrl:T}=X0(g,w),{entitlement:A,licensed:L,loading:q,error:U,refresh:X}=W0(l),[E,P]=m.useState([]),[te,B]=m.useState([]),[ue,G]=m.useState(""),[de,re]=m.useState(""),[fe,I]=m.useState(!1),[Z,ee]=m.useState(!1),[_,ae]=m.useState(""),[me,z]=m.useState(""),[ge,be]=m.useState("wall"),[Me,Fe]=m.useState("large"),[Ve,Le]=m.useState(ej),[Ee,qe]=m.useState(!1),[ke,gt]=m.useState(!1),[ie,ve]=m.useState(!1),[Te,De]=m.useState(RC),[se,et]=m.useState(HC),[Ce,It]=m.useState(IC),[Rt,xe]=m.useState({}),[He,ze]=m.useState([]),[lt,Mn]=m.useState(se.fps),it=m.useRef(new Map),Nn=m.useRef(new Map),ja=m.useRef(null),Na=m.useRef(new Map),An=m.useRef(null),el=m.useRef(0),Qn=m.useRef(new Map),[ut,hn]=m.useState({}),Ot=m.useRef(new Map),[Rl,ir]=m.useState({}),[Wi,Ha]=m.useState(!1),sa=m.useRef(null),pn=m.useRef(new Map),Tn=m.useRef(new Map),kn=m.useRef(performance.now()),ra=m.useRef(new Map),tl=m.useRef(new Map),Ll=m.useRef(new Map),Aa=m.useRef(0),oa=m.useRef(0),nl=m.useRef(0),al=m.useRef(0),Kn=m.useRef(0),ll=m.useRef(new Map),En=m.useRef(new Map),[Dn,gn]=m.useState(null),[wi,Rn]=m.useState(!1),[Y,he]=m.useState([]),[Se,$e]=m.useState("all"),[dt,ft]=m.useState([]),[_e,st]=m.useState(!1),[ln,Ut]=m.useState(!0),Jt=m.useRef(null),wt=m.useRef(null),$t=m.useRef(null),Mt=m.useRef(null),il=m.useRef(!1),Ta=m.useRef(!1),qt=m.useRef(0),Tt=m.useRef(0),ca=m.useRef(0),ka=ge==="settings",zl=ge==="pricing",zo=ge==="doc",Fa=ge==="share-files",Si=ge==="agents",ua=!ka&&!zl&&!zo&&!Fa&&!Si,Oe=ge==="control",mt=se.frameMode==="mode4-h264-atlas",sr=Ce.frameMode==="mode5-lzo-delta"?Math.min(30,Ce.fps):Ce.fps,da=Ce.frameMode==="mode5-lzo-delta"?{maxWidth:Math.min(1920,Ce.maxWidth),maxHeight:Math.min(1080,Ce.maxHeight)}:{maxWidth:Ce.maxWidth,maxHeight:Ce.maxHeight};m.useEffect(()=>{if(M?.started){if(!l?.access_token){ct("/api/remote/license",{method:"DELETE"},T).catch(()=>{});return}ct("/api/remote/license/sync",{method:"POST",headers:{Authorization:`Bearer ${l.access_token}`}},T).catch(S=>{console.warn("[LiveDesk] Hub license sync failed",S)})}},[A?.updated_at,T,l?.access_token,M?.started]);const We=m.useMemo(()=>C.filter(S=>S.connected),[C]),Mi=Se==="all"?We.length:dt.filter(S=>We.some(D=>D.deviceId===S)).length,Iu=m.useMemo(()=>We.reduce((S,D)=>Math.max(S,ho(D.slotNumber)),0),[We]),kt=Math.max(oC,We.length,Iu),sl=m.useMemo(()=>{const S=Array(kt).fill(null),D=[];for(const V of We){const H=ho(V.slotNumber);H>0&&H<=kt&&!S[H-1]?S[H-1]=V:D.push(V)}for(const V of D){const H=S.findIndex(F=>!F);H<0?S.push(V):S[H]=V}return S},[We,kt]),Ji=m.useMemo(()=>We.map(S=>S.deviceId),[We]),_l=m.useMemo(()=>new Set(E),[E]),Xn=m.useMemo(()=>new Set(te),[te]),fa=m.useMemo(()=>We.filter(S=>_l.has(S.deviceId)||Xn.has(ho(S.slotNumber))),[We,_l,Xn]),rr=m.useMemo(()=>C.find(S=>S.deviceId===ue)||fa[0]||null,[C,ue,fa]),Ln=m.useMemo(()=>C.find(S=>S.deviceId===de)||null,[de,C]),_o=Ln?la(Rt[Ln.deviceId],$n(Ln)):0,we=Oe?Ln:rr,or=m.useMemo(()=>new Set(dt),[dt]),cr=m.useMemo(()=>Se==="all"?We.map(S=>S.deviceId):We.filter(S=>or.has(S.deviceId)).map(S=>S.deviceId),[We,or,Se]),ma=m.useMemo(()=>we?xy(we):null,[we]),Uu=we?jo(we,"control"):!1,Ol=we?jo(we,"audio")||jo(we,"remoteAudio"):!1,tt=L?A?.plan==="pro"?"pro":"ltd":"free",es=kl[tt],ts=es.limit,Bl=tt==="free"&&We.length<=Js,St=We.length<=ts,rl=tt==="ltd"?`Plus includes up to ${vo} workstations. Upgrade to Pro for commercial use and larger walls.`:`Free includes up to ${Js} workstations. Upgrade to Plus for ${vo} devices and no ads.`,ur=tt==="free",dr=St&&!!we,zn=St&&!!we&&Uu,ha=St&&!!we&&Ol,Hl=m.useMemo(()=>sl.filter(S=>!!S?.connected).slice(0,$C(Me)).map(S=>S.deviceId),[sl,Me]),pa=m.useMemo(()=>mt?Ji:se.visibleOnlyLive?He.length>0?He:Hl:Ji,[Hl,mt,He,se.visibleOnlyLive,Ji]),Et=m.useMemo(()=>St?Jf(pa):[],[St,pa]),Ia=m.useMemo(()=>St&&Oe&&we?[we.deviceId]:[],[St,we,Oe]),ns=m.useMemo(()=>Jf([...Et,...Ia]),[Ia,Et]),xn=m.useMemo(()=>qC(se,Me),[se,Me]),as=m.useCallback((S,D)=>{const V=it.current.get(S);if(V&&V!==D&&Ff(V),D){it.current.set(S,D);return}it.current.delete(S)},[]),ls=m.useCallback((S,D)=>{const V=Nn.current.get(S);if(V&&V!==D&&Ff(V),D){Nn.current.set(S,D);return}Nn.current.delete(S)},[]),Ci=m.useCallback((S,D,V)=>{const H=performance.now(),F=Xa(S,V.deviceId);let ne=V;if(S==="control"&&V.visualChanged){const je=aw(V.deviceId),Je=ll.current.get(V.deviceId)||0,Ie=je?H-je.sentAt:Number.POSITIVE_INFINITY;je&&je.inputSeq>Je&&Ie<=Px&&(ne={...V,inputFeedbackSeq:je.inputSeq,inputFeedbackMs:Math.max(0,Ie),inputFeedbackAt:H},ll.current.set(V.deviceId,je.inputSeq))}Tn.current.set(F,H);const pe=Qn.current.get(F)||{totalFrames:0,totalChangedFrames:0,sampleFrames:0,sampleChangedFrames:0,sampleStartedAt:H,intervalCount:0,intervalSumMs:0,minIntervalMs:Number.POSITIVE_INFINITY,maxIntervalMs:0,intervalSamplesMs:[],seqGapCount:0,maxSeqGap:0,sampleDecoderInputBase:0,sampleDecoderOutputBase:0};S==="control"&&ne.inputFeedbackMs===void 0&&pe.lastInfo?.inputFeedbackMs!==void 0&&pe.lastInfo.inputFeedbackAt!==void 0&&H-pe.lastInfo.inputFeedbackAt<=Px&&(ne={...ne,inputFeedbackSeq:pe.lastInfo.inputFeedbackSeq,inputFeedbackMs:pe.lastInfo.inputFeedbackMs,inputFeedbackAt:pe.lastInfo.inputFeedbackAt}),pe.totalFrames+=1,pe.sampleFrames+=1,Kx(pe,H,ne.frameSeq),ne.visualChanged&&(pe.totalChangedFrames+=1,pe.sampleChangedFrames+=1),pe.lastInfo=ne,Qn.current.set(F,pe)},[]),Kt=m.useCallback((S,D)=>{Ci("wall",S,D)},[Ci]),Ua=m.useCallback((S,D)=>{Ci("control",S,D);const V=sa.current;!V||!yC(V,S)||Ha(!0)},[Ci]);m.useEffect(()=>{const S=window.setInterval(()=>{const D=performance.now(),V={};for(const[H,F]of Qn.current.entries()){const ne=Math.max(1,D-F.sampleStartedAt);V[H]={totalFrames:F.totalFrames,totalChangedFrames:F.totalChangedFrames,framesPerSecond:F.sampleFrames*1e3/ne,changedFramesPerSecond:F.sampleChangedFrames*1e3/ne,averageIntervalMs:F.intervalCount>0?F.intervalSumMs/F.intervalCount:0,minIntervalMs:Number.isFinite(F.minIntervalMs)?F.minIntervalMs:0,maxIntervalMs:F.maxIntervalMs,p95IntervalMs:xu(F.intervalSamplesMs,.95),intervalCount:F.intervalCount,seqGapCount:F.seqGapCount,maxSeqGap:F.maxSeqGap,decoderInputFps:Math.max(0,(Number(F.lastInfo?.decoderInputCount||0)-F.sampleDecoderInputBase)*1e3/ne),decoderOutputFps:Math.max(0,(Number(F.lastInfo?.decoderOutputCount||0)-F.sampleDecoderOutputBase)*1e3/ne),sampleMs:ne,lastInfo:F.lastInfo},F.sampleDecoderInputBase=Number(F.lastInfo?.decoderInputCount||0),F.sampleDecoderOutputBase=Number(F.lastInfo?.decoderOutputCount||0),F.sampleChangedFrames=0,Qx(F,D)}hn(V)},1e3);return()=>window.clearInterval(S)},[]);const Ea=m.useCallback((S,D)=>{const V=performance.now(),H=Xa(S,D.deviceId);pn.current.set(H,V),En.current.delete(H);const F=Ot.current.get(H)||{totalFrames:0,sampleFrames:0,sampleStartedAt:V,intervalCount:0,intervalSumMs:0,minIntervalMs:Number.POSITIVE_INFINITY,maxIntervalMs:0,intervalSamplesMs:[],seqGapCount:0,maxSeqGap:0,sampleBytes:0,sampleH264Frames:0,sampleTinyFrames:0,sampleRepeatedFrames:0,sourceSendIntervalsMs:[]};if(F.totalFrames+=1,F.sampleFrames+=1,F.sampleBytes+=Math.max(0,Number(D.byteLength||0)),String(D.frameMode||D.mode||D.codec||D.mimeType||"").toLowerCase().includes("h264")){F.sampleH264Frames+=1,Number(D.byteLength||0)<=gC&&(F.sampleTinyFrames+=1);const Je=String(D.contentHash||"");Je&&F.lastContentHash===Je&&(F.sampleRepeatedFrames+=1),F.lastContentHash=Je}const je=Number(D.agentSendGapMs||0);je>0&&je<1e3&&Pm(F.sourceSendIntervalsMs,je),F.lastFrame=D,Kx(F,V,D.frameSeq),Ot.current.set(H,F)},[]);m.useEffect(()=>{const S=window.setInterval(()=>{const D=performance.now(),V={};for(const[H,F]of Ot.current.entries()){const ne=Math.max(1,D-F.sampleStartedAt);V[H]={totalFrames:F.totalFrames,framesPerSecond:F.sampleFrames*1e3/ne,averageIntervalMs:F.intervalCount>0?F.intervalSumMs/F.intervalCount:0,minIntervalMs:Number.isFinite(F.minIntervalMs)?F.minIntervalMs:0,maxIntervalMs:F.maxIntervalMs,p95IntervalMs:xu(F.intervalSamplesMs,.95),intervalCount:F.intervalCount,seqGapCount:F.seqGapCount,maxSeqGap:F.maxSeqGap,averageFrameBytes:F.sampleFrames>0?F.sampleBytes/F.sampleFrames:0,tinyFrameRatio:F.sampleH264Frames>0?F.sampleTinyFrames/F.sampleH264Frames:0,repeatedFrameRatio:F.sampleH264Frames>0?F.sampleRepeatedFrames/F.sampleH264Frames:0,sourceSendAverageMs:F.sourceSendIntervalsMs.length>0?F.sourceSendIntervalsMs.reduce((pe,je)=>pe+je,0)/F.sourceSendIntervalsMs.length:0,sourceSendP95Ms:xu(F.sourceSendIntervalsMs,.95),sourceSendSampleCount:F.sourceSendIntervalsMs.length,sampleMs:ne,lastFrame:F.lastFrame},F.sampleBytes=0,F.sampleH264Frames=0,F.sampleTinyFrames=0,F.sampleRepeatedFrames=0,F.sourceSendIntervalsMs.length=0,Qx(F,D)}ir(V)},1e3);return()=>window.clearInterval(S)},[]);const Fl=m.useCallback(S=>{Ea("wall",S);const D=it.current.get(S.deviceId);D&&If(D,S,()=>it.current.get(S.deviceId)!==D,Kt,se.h264DecodeAcceleration).catch(()=>{})},[Kt,Ea,se.h264DecodeAcceleration]),Oo=m.useCallback(S=>{Ea("control",S);const D=Nn.current.get(S.deviceId);D&&If(D,S,()=>Nn.current.get(S.deviceId)!==D,Ua,Ce.h264DecodeAcceleration,"interactive").catch(()=>{})},[Ce.h264DecodeAcceleration,Ua,Ea]),fr=m.useCallback(S=>{const D=ja.current;D&&D!==S&&Ff(D),ja.current=S,Aa.current=0,oa.current=0,nl.current=0,al.current=0,Kn.current=0,el.current=0},[]),$a=m.useCallback(()=>{const S=ja.current,D=An.current;if(!(!S||!D||S.width<=0||S.height<=0||el.current!==D.layoutVersion))for(const V of D.tiles){const H=Na.current.get(V.deviceId);if(!H||V.width<=0||V.height<=0)continue;const F=Math.max(1,Math.round(V.width)),ne=Math.max(1,Math.round(V.height)),pe=xC,je=vC;(H.width!==pe||H.height!==je)&&(H.width=pe,H.height=je);const Je=H.getContext("2d",{alpha:!1});if(Je){Je.imageSmoothingEnabled=!0,Je.imageSmoothingQuality="high";try{Je.drawImage(S,Math.round(V.x),Math.round(V.y),F,ne,0,0,pe,je)}catch{}}}},[]),ji=m.useCallback((S,D)=>{if(D){Na.current.set(S,D),window.requestAnimationFrame($a);return}Na.current.delete(S)},[$a]),Ni=m.useCallback((S,D)=>{nl.current=performance.now(),el.current=Number(S.layoutVersion||0),$a();const V=An.current?.tiles||[],H=V.length>0?Math.round(S.byteLength/V.length):S.byteLength;for(const F of V){const ne={...S,deviceId:F.deviceId,width:F.width,height:F.height,sourceWidth:F.width,sourceHeight:F.height,byteLength:H};Kt(ne,{...D,deviceId:F.deviceId,width:F.width,height:F.height,byteLength:H})}},[Kt,$a]),Bo=m.useCallback(S=>{const D=performance.now();Aa.current<=0&&(Aa.current=D),oa.current=D;const V=ja.current;if(!V)return;const H=An.current?.tiles||[],F=H.length>0?Math.round(S.byteLength/H.length):S.byteLength;for(const ne of H)Ea("wall",{...S,deviceId:ne.deviceId,width:ne.width,height:ne.height,sourceWidth:ne.width,sourceHeight:ne.height,byteLength:F});If(V,S,()=>ja.current!==V,Ni).catch(()=>{})},[Ni,Ea]),$u=m.useMemo(()=>({fps:lt,maxWidth:xn.maxWidth,maxHeight:xn.maxHeight,quality:se.quality,mode:se.frameMode,frameMode:se.frameMode,streamPurpose:"wall",monitorSelections:Rt,onFrame:Fl}),[lt,Fl,xn,Rt,se]),qu=m.useMemo(()=>({fps:sr,maxWidth:da.maxWidth,maxHeight:da.maxHeight,quality:Ce.quality,mode:Ce.frameMode,frameMode:Ce.frameMode,streamPurpose:"control",monitorSelections:Rt,onFrame:Oo}),[Ce.frameMode,Ce.quality,Oo,sr,da.maxHeight,da.maxWidth,Rt]),{frames:Ho,state:ol,stats:qa,restartLive:is}=dx(mt?[]:Et,!mt&&se.autoStartLive&&Et.length>0,T,$u),{frame:Il,layout:cl,state:mr,stats:Fo,refreshInputs:Io}=lw(pa,mt&&se.autoStartLive&&pa.length>0,T,{fps:20,width:1920,height:1080,tileWidth:xn.maxWidth,tileHeight:xn.maxHeight,monitorSelections:Rt,onFrame:Bo});m.useEffect(()=>{An.current=cl,cl&&window.requestAnimationFrame($a)},[cl,$a]),m.useEffect(()=>{if(!mt||mr!=="open"){Aa.current=0,oa.current=0,nl.current=0;return}const S=window.setInterval(()=>{const D=ja.current,V=performance.now();if(!D||document.visibilityState!=="visible"||V-kn.current<Xf)return;const H=oa.current,F=Aa.current;if(H<=0||F<=0||V-H>500)return;const ne=nl.current||F,pe=V-ne;if(pe>=mC&&V-Kn.current>=pC){sx(D)&&(Kn.current=V,al.current=V);return}pe>=fC&&V-al.current>=hC&&B0(D)&&(al.current=V)},250);return()=>window.clearInterval(S)},[mr,mt]);const{frames:hr,state:pr,error:Uo,stats:gr,restartLive:ss}=dx(Ia,Ia.length>0,T,qu),rs=m.useMemo(()=>{const S=new Map(Ho);if(mt&&Il){const D=new Map((cl?.tiles||[]).map(H=>[H.deviceId,H])),V=Math.max(1,D.size);for(const H of pa){const F=D.get(H);S.set(H,{...Il,deviceId:H,width:F?.width||xn.maxWidth,height:F?.height||xn.maxHeight,sourceWidth:F?.width||xn.maxWidth,sourceHeight:F?.height||xn.maxHeight,byteLength:Math.round(Il.byteLength/V)})}}for(const[D,V]of hr.entries())S.set(D,V);return S},[Il,cl,hr,xn,mt,Ho,pa]),xr=Oe&&Ia.length>0?pr:mt?mr:ol,os=Oe&&Ia.length>0?gr:mt?Fo:qa;m.useCallback((S,D="browser-stale")=>{const V=is(S,D),H=ss(S,D);return V||H},[ss,is]),m.useEffect(()=>{mt&&!Oe&&Io()},[mt,Io,Oe]);const cs=m.useCallback((S,D,V)=>{const H=D==="control"?Nn.current.get(S)||null:it.current.get(S)||null;if(!H||!sx(H))return!1;const F=performance.now();return Ll.current.set(Xa(D,S),F),!0},[]);m.useEffect(()=>{Ha(!1);const S=Oe?Ln:null;if(S){sa.current={deviceId:S.deviceId,monitorIndex:_o,frameMode:Ce.frameMode,startedAtEpochMs:Date.now()};const D=Xa("control",de);tl.current.set(D,performance.now()),pn.current.delete(D),Tn.current.delete(D),En.current.delete(D);return}sa.current=null},[Ln?.sessionId,de,Ce.frameMode,_o,Oe]);const{state:us,sendInput:Ai,stats:ga}=iw(zn&&fe,T),{state:$o,error:qo}=ow(we?.deviceId||"",ha&&Z,T);m.useEffect(()=>{if(!Oe||!fe||!zn||!we)return;const S=(H,F)=>{const ne=H.target,pe=ne?.tagName?.toLowerCase();ne?.isContentEditable||pe==="input"||pe==="textarea"||pe==="select"||(H.preventDefault(),H.stopPropagation(),Ai(we.deviceId,{type:F,monitorIndex:la(Rt[we.deviceId],$n(we)),key:H.key,code:H.code,keyCode:H.keyCode||H.which||0,location:H.location,text:H.key.length===1?H.key:"",repeat:F==="keydown"?H.repeat:!1,shiftKey:H.shiftKey,ctrlKey:H.ctrlKey,altKey:H.altKey,metaKey:H.metaKey}))},D=H=>S(H,"keydown"),V=H=>S(H,"keyup");return window.addEventListener("keydown",D),window.addEventListener("keyup",V),()=>{window.removeEventListener("keydown",D),window.removeEventListener("keyup",V)}},[zn,fe,Rt,we,Ai,Oe]),m.useEffect(()=>{const S=()=>{document.visibilityState==="visible"&&(kn.current=performance.now())};return document.addEventListener("visibilitychange",S),window.addEventListener("pageshow",S),()=>{document.removeEventListener("visibilitychange",S),window.removeEventListener("pageshow",S)}},[]),m.useEffect(()=>{if(!Oe||!we||pr!=="open")return;const S=we.deviceId,D=Xa("control",S),V=window.setInterval(()=>{const H=performance.now();if(document.visibilityState!=="visible"||H-kn.current<Xf)return;const F=pn.current.get(D)||0,ne=Tn.current.get(D)||0,pe=ra.current.get(D)||0,je=tl.current.get(D)||H;tl.current.has(D)||tl.current.set(D,je);const Je=F<=0,Ie=Je?H-je>CC:H-F>ev,Nt=F>0&&(ne<=0||H-ne>ev);if(!Ie&&Nt){const on=Ll.current.get(D)||0;H-on>=tv&&cs(S,"control","decoder-paint-stale");return}if(!Ie)return;const rn=En.current.get(D)||0;if(H-pe<nv(jC,rn))return;ss([S],Je?"control-first-frame-timeout":"control-receive-stale")&&(ra.current.set(D,H),tl.current.set(D,H),En.current.set(D,rn+1))},650);return()=>window.clearInterval(V)},[pr,cs,ss,we,Oe]),m.useEffect(()=>{if(mt||ol!=="open"||!se.autoStartLive||Et.length===0)return;const S=window.setInterval(()=>{const D=performance.now();if(document.visibilityState!=="visible"||D-kn.current<Xf)return;const V=1e3/Math.max(1,lt||se.fps||1),H=Math.max(NC,Math.ceil(V*4)),F=[];for(const ne of Et){if(F.length>=kC)break;const pe=Xa("wall",ne),je=pn.current.get(pe)||0;if(je<=0)continue;const Je=ra.current.get(pe)||0,Ie=Tn.current.get(pe)||0,Nt=D-je>H,rn=Ie<=0||D-Ie>H;if(!Nt&&rn){const on=Ll.current.get(pe)||0;D-on>=tv&&cs(ne,"wall","decoder-paint-stale");continue}if(!Nt)continue;const Cn=En.current.get(pe)||0;D-Je>=nv(AC,Cn)&&F.push(ne)}if(F.length>0&&is(F,"wall-frame-stale"))for(const ne of F){const pe=Xa("wall",ne);ra.current.set(pe,D),En.current.set(pe,(En.current.get(pe)||0)+1)}},TC);return()=>window.clearInterval(S)},[lt,mt,cs,is,se.autoStartLive,se.fps,Et,ol]),m.useEffect(()=>{Mn(se.fps),Tt.current=Date.now(),ca.current=0},[se.fps,se.frameMode,se.adaptiveLoadShedding]),m.useEffect(()=>{T0({h264DecodeAcceleration:se.h264DecodeAcceleration})},[se.h264DecodeAcceleration]),m.useEffect(()=>{if(!St||Oe||!se.visibleOnlyLive){ze([]);return}const S=Jt.current;if(!S||typeof IntersectionObserver>"u"){ze(Hl);return}const D=Array.from(S.querySelectorAll("[data-live-device-id]"));if(D.length===0){ze([]);return}const V=new Map,H=()=>{const ne=Jf(D.map(pe=>String(pe.dataset.liveDeviceId||"")).filter(pe=>(V.get(pe)||0)>0));ze(pe=>cu(pe,ne)?pe:ne)},F=new IntersectionObserver(ne=>{for(const pe of ne){const je=String(pe.target.dataset.liveDeviceId||"");je&&V.set(je,pe.isIntersecting?pe.intersectionRatio||.01:0)}H()},{root:null,rootMargin:Sn.visibleRootMargin,threshold:[0,.01,.2,.6,1]});return D.forEach(ne=>F.observe(ne)),H(),()=>F.disconnect()},[Hl,St,Oe,sl,se.visibleOnlyLive,Me]),m.useEffect(()=>{if(mt||!se.adaptiveLoadShedding||!se.autoStartLive||Et.length===0)return;const S=se.fps;if(Et.length<=Sn.preserveConfiguredFpsDeviceCount){lt!==S&&(Mn(S),Tt.current=Date.now(),ca.current=0);return}if(ol!=="open"||qa.sampleMs<500)return;const D=Date.now(),V=Et.length*lt,H=qa.framesPerSecond,F=qa.bytesPerSecond,ne=Math.max(0,...Et.map(Nt=>Rl[Xa("wall",Nt)]?.maxIntervalMs||0)),pe=Math.max(0,...Et.map(Nt=>ut[Xa("wall",Nt)]?.maxIntervalMs||0)),je=V>8&&H>0&&H<V*.72;if(H>Sn.maxWallFramesPerSecond||F>Sn.maxWallBytesPerSecond||ne>Sn.maxFrameGapMs||pe>Sn.maxFrameGapMs||je){ca.current=0;const Nt=Sn.minFps;if(D-Tt.current>=Sn.downshiftCooldownMs&&lt>Nt){const rn=Math.max(Nt,GC(lt,Nt));rn<lt&&(Mn(rn),Tt.current=D)}return}const Ie=H<Sn.maxWallFramesPerSecond*Sn.lowLoadFrameRatio&&F<Sn.maxWallBytesPerSecond*Sn.lowLoadByteRatio;if(!Ie||lt>=S){Ie||(ca.current=0);return}if(!ca.current){ca.current=D;return}if(D-ca.current>=Sn.recoveryCooldownMs){const Nt=Math.min(S,PC(lt,S));Nt>lt&&(Mn(Nt),Tt.current=D,ca.current=0)}},[lt,mt,ut,Rl,Et.length,Et,ol,qa.bytesPerSecond,qa.framesPerSecond,qa.lastUpdatedAt,qa.sampleMs,se.adaptiveLoadShedding,se.autoStartLive,se.frameMode,se.fps]),m.useEffect(()=>{const S=new URLSearchParams(window.location.search).get("checkout");if(S==="success"){z("Checkout returned. Waiting for Dodo confirmation."),X();const D=window.setInterval(()=>{X()},4e3),V=window.setTimeout(()=>{window.clearInterval(D)},45e3);return()=>{window.clearInterval(D),window.clearTimeout(V)}}S==="cancelled"&&z("Checkout cancelled.")},[X]),m.useEffect(()=>{!St&&fe&&I(!1),!St&&Z&&ee(!1)},[Z,fe,St]),m.useEffect(()=>{ee(!1)},[we?.deviceId]),m.useEffect(()=>{const S=We.map(H=>H.deviceId),D=new Set(S),V=new Map(We.map(H=>[H.deviceId,H]));P(H=>{const F=H.filter(ne=>D.has(ne));return cu(H,F)?H:F}),G(H=>H&&D.has(H)?H:""),re(H=>H&&D.has(H)?H:""),B(H=>{const F=H.filter(ne=>ne>=1&&ne<=kt);return cu(H.map(String),F.map(String))?H:F}),xe(H=>{let F=!1;const ne={};for(const[pe,je]of Object.entries(H)){if(!D.has(pe)){F=!0;continue}const Je=V.get(pe),Ie=la(je,Je?$n(Je):1);ne[pe]=Ie,Ie!==je&&(F=!0)}return F?ne:H}),ft(H=>{const F=H.filter(ne=>D.has(ne));return cu(H,F)?H:F})},[We,kt]),m.useEffect(()=>{he([]),Ut(!1)},[]),m.useEffect(()=>{!Fa||Se!=="selected"||dt.length>0||fa.length===0||ft(fa.map(S=>S.deviceId))},[fa,dt.length,Se,Fa]),m.useEffect(()=>{try{localStorage.setItem(iy,Te)}catch{}},[Te]),m.useEffect(()=>{FC(se)},[se]),m.useEffect(()=>{UC(Ce)},[Ce]);const vr=m.useCallback(async()=>{const S=new Set(g);S.add(mn);try{const ne=await ct("/api/remote/status",void 0,mn);rx({endpoint:ne.agentEndpoint,endpoint_candidates:[...ne.agentEndpointCandidates||[],...ne.hostTargetEndpointCandidates||[]]}).forEach(pe=>S.add(pe))}catch{}const D=[...S].sort((ne,pe)=>{const je=Je=>{const Ie=So(Je);return Ie==="local"?0:Ie==="loopback"?1:2};return je(ne)-je(pe)||ne.localeCompare(pe)});let V=!1,H="",F=!1;try{for(const ne of D){const pe=So(ne);try{if(await ct("/api/health",void 0,ne),pe==="local")return y(!0),Xs(!0),ne;pe==="loopback"&&(V=!0,H=ne)}catch{pe==="local"&&(F=!0)}}return V?(F&&z("LiveDesk Hub is reachable on this PC, but not through the LAN address yet. Restart LiveDesk Hub to bind 5179 on the network."),y(!0),Xs(!0),H||mn):(y(!1),Xs(!1),"")}catch{return y(!1),Xs(!1),""}},[g]),ds=async()=>{ae("auth"),gt(!1),await vr();const{error:S}=await Za.auth.signInWithOAuth({provider:"google",options:{redirectTo:window.location.origin}});S&&(z(S.message),ae(""))},Gu=async()=>{ae("auth"),gt(!1),await Za.auth.signOut(),ae("")};m.useEffect(()=>{if(!ke)return;const S=V=>{V.target instanceof Element&&(V.target.closest(".account-popover, .rail-account")||gt(!1))},D=V=>{V.key==="Escape"&&gt(!1)};return window.addEventListener("pointerdown",S),window.addEventListener("keydown",D),()=>{window.removeEventListener("pointerdown",S),window.removeEventListener("keydown",D)}},[ke]);const Ga=m.useCallback(async(S={})=>{const D=S.silent===!0,V=S.takeover===!0,H=S.requestLocalAccess===!0,F=H?await vr():"";if(!l?.user){D||z("Sign in before publishing this host.");return}if(!Ta.current){Ta.current=!0,D||ae("host");try{const ne=F||T||mn,pe=M||await ct("/api/remote/status",void 0,ne);if(!pe.started)throw new Error("Start LiveDesk on this computer before syncing the server.");const je=`livedesk-${l.user.id}`,Je=await ct("/api/remote/host-target",{method:"POST",body:JSON.stringify({nodeId:je,leaseMs:6e4,takeover:V})},ne);if(!Je.ok)throw new Error(Je.error||"host-target-failed");const Ie=await ct("/api/remote/status",void 0,ne),Nt=await ct("/api/remote/registry-credentials",void 0,ne),rn=Je.hostTarget||{},Cn=Ie.hostTargetEndpointCandidates||Ie.agentEndpointCandidates||pe.agentEndpointCandidates||[Ie.agentEndpoint||pe.agentEndpoint].filter(Boolean),{data:on,error:hl}=await Za.rpc("set_livedesk_remote_host_target",{p_node_id:je,p_lease_id:String(rn.leaseId||Ie.hostTargetLeaseId||crypto.randomUUID()),p_host_instance_id:Ie.hostInstanceId||je,p_endpoint:Ie.hostTargetEndpoint||Ie.agentEndpoint||pe.agentEndpoint,p_pair_token:Nt.pairToken||"",p_manager_package:"@livedesk/hub",p_manager_version:Ie.managerVersion||"0.1.0",p_agent_package:"@livedesk/client",p_activated_at:new Date().toISOString(),p_expires_at:new Date(Date.now()+6e4).toISOString(),p_takeover:V,p_endpoint_candidates:Cn,p_pairing_pin:Nt.pairingPin||Ie.pairingPin||""});if(hl)throw hl;const Ra=Array.isArray(on)?on[0]:on;if(Ra&&Ra.ok===!1)throw new Error(Ra.reason||"registry-rejected");D||(z("Host published."),(H||v)&&(y(!0),Xs(!0)),k()),d()}catch(ne){if(!D){const pe=ne instanceof Error?ne.message:String(ne);pe.includes("local network access")&&(y(!1),Xs(!1)),z(pe)}}finally{Ta.current=!1,D||ae("")}}},[T,v,k,d,vr,l,M]),Ti=m.useCallback(async()=>{if(!_){ae("pin");try{const D=await ct("/api/remote/pairing-pin",{method:"POST"},T||mn);if(!D.ok)throw new Error(D.error||"pin-rotation-failed");await k(),l?.user&&await Ga({silent:!0,takeover:!0}),z("New PIN published.")}catch(S){z(S instanceof Error?S.message:String(S))}finally{ae("")}}},[_,T,Ga,k,l]);m.useEffect(()=>{if(!l?.user||!M?.started||j)return;const S=r?.expires_at?Date.parse(r.expires_at):Number.POSITIVE_INFINITY,D=r?.active===!0&&(!r.expires_at||!Number.isFinite(S)||S>Date.now()),V=!!r?.host_instance_id&&!!M.hostInstanceId&&r.host_instance_id===M.hostInstanceId;if(D&&!V)return;let H=!1;const F=()=>{if(H)return;const pe=Date.now();pe-qt.current<25e3||(qt.current=pe,Ga({silent:!0}))};F();const ne=window.setInterval(F,3e4);return()=>{H=!0,window.clearInterval(ne)}},[j,Ga,l?.user?.id,M?.agentEndpoint,M?.hostInstanceId,M?.started,r?.active,r?.expires_at,r?.host_instance_id]);const Ul=m.useCallback(S=>{S&&(G(S),P(D=>D.includes(S)?D:[...D,S]))},[]),yr=m.useCallback(S=>{if(!S)return;const D=We.find(H=>H.deviceId===S),V=ho(D?.slotNumber);G(S),V>0&&B(H=>H.filter(F=>F!==V)),P(H=>H.includes(S)?H:[...H,S])},[We]),br=m.useCallback(S=>{!Number.isInteger(S)||S<1||S>kt||(G(""),B(D=>D.includes(S)?D.filter(V=>V!==S):[...D,S].sort((V,H)=>V-H)))},[kt]),$l=m.useCallback(()=>{P([]),B([]),G("")},[]),wr=m.useCallback(()=>{P([]),G(""),B(Array.from({length:kt},(S,D)=>D+1))},[kt]),fs=m.useCallback((S,D)=>{const V=We.find(F=>F.deviceId===S);if(!V)return;const H=$n(V);H<=1||(xe(F=>{const pe=(la(F[S],H)+D+H)%H;return{...F,[S]:pe}}),Oe?re(S):Ul(S))},[We,Ul,Oe]);m.useEffect(()=>{const S=D=>{if(Oe&&fe&&zn)return;const V=D.target,H=V?.tagName?.toLowerCase();V?.isContentEditable||H==="input"||H==="textarea"||H==="select"||((D.ctrlKey||D.metaKey)&&D.key.toLowerCase()==="a"&&(D.preventDefault(),wr()),D.key==="Escape"&&$l())};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[zn,$l,fe,wr,Oe]);const ul=async(S,D={})=>{if(!St){z(rl);return}const V=D.focused||Oe;V?re(S):Ul(S);try{const H=We.find(pe=>pe.deviceId===S),F=V?{maxWidth:Ce.maxWidth,maxHeight:Ce.maxHeight}:xn,ne=la(D.monitorIndex??Rt[S],H?$n(H):1);await ct(`/api/remote/devices/${encodeURIComponent(S)}/live/start`,{method:"POST",body:JSON.stringify({fps:V?Ce.fps:lt,maxWidth:F.maxWidth,maxHeight:F.maxHeight,quality:V?Ce.quality:se.quality,mode:V?Ce.frameMode:se.frameMode,frameMode:V?Ce.frameMode:se.frameMode,streamPurpose:V?"control":"wall",monitorIndex:ne})},T),z("Live stream requested."),k()}catch(H){z(H instanceof Error?H.message:String(H))}},Pu=(S,D)=>{const V=We.find(F=>F.deviceId===S),H=la(D,V?$n(V):1);xe(F=>({...F,[S]:H})),Oe?re(S):Ul(S)},Sr=async S=>{if(re(S),be("control"),!St){I(!1),z(rl);return}I(!0)},Yu=async()=>{if(!we){z("Select a workstation before playing audio.");return}if(!St){z(rl);return}if(!Ol){z("Selected workstation does not report remote audio support yet.");return}const S=!Z;ee(S);try{await ct(`/api/remote/devices/${encodeURIComponent(we.deviceId)}/audio/${S?"start":"stop"}`,{method:"POST",body:JSON.stringify({mimeType:"audio/webm;codecs=opus",sampleRate:48e3,channels:2})},T),z(S?"Remote audio requested.":"Remote audio stopped.")}catch(D){ee(!1),z(D instanceof Error?D.message:String(D))}},Mr=async(S,D,V="files")=>{const H=S.filter(je=>je.file.size>=0);if(H.length===0)return{files:0,bytes:0};if(!St)throw new Error(rl);if(D.length===0)throw new Error("Select at least one connected workstation.");const F=crypto.randomUUID(),ne=H.reduce((je,Je)=>je+Je.file.size,0);let pe=0;gn({id:F,status:"reading",progress:1,message:`Preparing ${H.length} ${V}`});try{for(let je=0;je<H.length;je+=1){const Je=H[je],Ie=Je.file,Nt=Math.max(1,Math.ceil(Ie.size/Qf));for(let rn=0;rn<Nt;rn+=1){const Cn=rn*Qf,on=Math.min(Ie.size,Cn+Qf),hl=Ie.size===0?new ArrayBuffer(0):await Ie.slice(Cn,on).arrayBuffer(),Ra=rn===Nt-1;gn({id:F,status:"sending",progress:Math.max(2,Math.min(98,Math.round(pe/Math.max(1,ne)*96))),message:`${je+1}/${H.length} ${Je.relativePath}`});const Xl=await ct("/api/remote/files/chunk",{method:"POST",body:JSON.stringify({transferId:F,deviceIds:D,remoteDirectory:Te.trim(),name:Ie.name,relativePath:Je.relativePath,size:Ie.size,type:Ie.type,lastModified:Ie.lastModified,offset:Cn,totalBytes:Ie.size,final:Ra,dataBase64:YC(hl)})},T);if(!Xl.ok||Xl.queued!==D.length)throw new Error(Xl.error||`file-chunk-not-queued-${Xl.queued}/${D.length}`);pe+=hl.byteLength,await new Promise(pl=>window.setTimeout(pl,0))}}return gn({id:F,status:"queued",progress:100,message:`Sent ${H.length} file${H.length===1?"":"s"} to ${D.length} workstation${D.length===1?"":"s"}`}),window.setTimeout(()=>{gn(je=>je?.id===F&&je.status==="queued"?null:je)},4500),{files:H.length,bytes:ne}}catch(je){throw gn({id:F,status:"failed",progress:100,message:je instanceof Error?je.message:String(je)}),je}},Cr=async S=>{const D=fa.length>0?fa.map(V=>V.deviceId):we?[we.deviceId]:[];try{await Mr(lv(S),D)}catch(V){z(V instanceof Error?V.message:String(V))}},ql=async S=>{try{await Mr(lv(S),cr)}catch(D){z(D instanceof Error?D.message:String(D))}};m.useEffect(()=>{il.current=!1},[]);const ki=S=>{S.preventDefault(),S.stopPropagation(),Rn(!1),Cr(S.dataTransfer.files)},ms=async(S="ltd")=>{if(!l){z("Sign in with Google before checkout.");return}if(L&&S===tt){z("LiveDesk license is already active.");return}if(L&&tt==="pro"){z("LiveDesk Pro is already active.");return}ae("checkout");try{const{data:D,error:V}=await Za.functions.invoke("dodo-checkout",{body:{plan:S}});if(V)throw V;if(!D?.checkout_url)throw new Error("Checkout function did not return a checkout URL.");window.location.assign(D.checkout_url)}catch(D){z(D instanceof Error?D.message:String(D)),ae("")}},Zn=EC(),Ei=DC(),Go=We.length,Di=ns.filter(S=>rs.has(S)).length,Ri=xr==="open"&&os.sampleMs>0?`${os.framesPerSecond.toFixed(1)} fps`:xr,ye=we?Oe?hr.get(we.deviceId):rs.get(we.deviceId):void 0,Li=we?la(Rt[we.deviceId],$n(we)):0,jr=we?_C(we):[],Vu=typeof ye?.monitorIndex=="number"?la(ye.monitorIndex,Math.max(1,ye.monitorCount||1)):Li,Nr=(ye&&Vu===Li?py(ye):null)||(we?hy(we,Li):null),Qu=Nr?`${Nr.width}x${Nr.height}`:"-",hs=we?Xa(Oe?"control":"wall",we.deviceId):"",rt=hs?Rl[hs]:void 0,Xt=hs?ut[hs]:void 0,Ye=Xt?.lastInfo,Po=rt&&rt.sampleMs>0?`${rt.framesPerSecond.toFixed(1)} fps`:"waiting",Yo=rt?`#${rt.totalFrames} / ${Po}`:"waiting",Vo=Xt&&Xt.sampleMs>0?`${Xt.framesPerSecond.toFixed(1)} fps`:"waiting",Ar=Xt&&Xt.sampleMs>0?`${Xt.changedFramesPerSecond.toFixed(1)} fps`:"waiting",Ku=Ye?`#${Ye.frameSeq} ${Ye.decoderLabel} q${Ye.queueSize} r${Ye.renderQueueSize} d${Ye.droppedForLatency} f${Ye.decoderFlushCount} t${Ye.decoderTimestampFallbacks} io${Ye.decoderInputCount}/${Ye.decoderOutputCount} ${Ye.visualChanged?"changed":"same"}`:"waiting",Gl=Ye?`${Math.round(Ye.queuedForMs)}ms total / ${Math.round(Ye.decodedForMs)}ms decode / ${Math.round(Ye.scheduledForMs)}ms pace / ${Ye.drawMs.toFixed(1)}ms draw`:"-",Tr=Ye?.targetPaintIntervalMs?`${Ye.targetPaintIntervalMs.toFixed(1)}ms / ${(1e3/Ye.targetPaintIntervalMs).toFixed(1)} fps`:"-",zi=Xt?`${Xt.decoderInputFps.toFixed(1)} in / ${Xt.decoderOutputFps.toFixed(1)} out fps`:"waiting",kr=Ye?.canvasPresentation||"-",Qo=Ye?`${Ye.interactiveBufferWaitCount} waits / ${Math.round(Ye.interactiveBufferWaitMs)}ms / ${Ye.interactiveQueueDrainCount} drains`:"waiting",dl=a.framesPerSecond>0?`${a.framesPerSecond.toFixed(1)} fps / p95 ${a.p95IntervalMs.toFixed(1)}ms / max ${a.maxIntervalMs.toFixed(1)}ms / long ${a.longTaskCount} (${Math.round(a.longTaskMs)}ms)`:"waiting",Pl=rt?ye?.frameMode==="mode5-lzo-delta"?`${yo(rt.averageFrameBytes)} avg / visual ${ye.deltaVisualTileCount||0} + refresh ${ye.deltaRefreshTileCount||0} / ${ye.deltaTotalTiles||0}`:`${yo(rt.averageFrameBytes)} avg / tiny ${Math.round(rt.tinyFrameRatio*100)}% / repeat ${Math.round(rt.repeatedFrameRatio*100)}%`:"waiting",Er=rt&&rt.sourceSendSampleCount>0?`${rt.sourceSendAverageMs.toFixed(1)}ms avg / p95 ${rt.sourceSendP95Ms.toFixed(1)}ms`:"waiting",Ko=Xx(rt),fl=Xx(Xt),Xo=rt&&Xt?`rx ${Zx(rt)} / paint ${Zx(Xt)}`:"waiting",ps=ye?ye.frameMode||ye.mode||ye.codec||ye.mimeType:Oe?Ce.frameMode:se.frameMode,gs=Oe?Ce.frameMode:se.frameMode,Xu=ps!==gs?`${gs} -> ${ps}`:gs,Zu=ye?`${ye.width}x${ye.height} ${yo(ye.byteLength)}`:Oe?`${da.maxWidth}x${da.maxHeight}`:`${se.maxWidth}x${se.maxHeight}`,Wu=ye?ye.frameMode==="mode2-lzo"?"independent":`${ye.isKeyFrame?"key":String(ye.chunkType||"delta")}`:"-",Zo=ye&&ye.monitorCount?`${(ye.monitorIndex??0)+1}/${ye.monitorCount}`:"-",Wo=ye?[`src ${Math.round(ye.sourceGapMs||0)}ms`,`gap ${Math.round(ye.agentSendGapMs||0)}ms`,`tx ${Math.round(ye.agentSendDurationMs||0)}ms`,`pace ${Math.round(ye.agentPaceMs||0)}ms`,`queue ${Math.round(ye.agentQueueBeforePaceMs||0)}ms`,`age ${Math.round(ye.agentFrameAgeMs||0)}ms`,ye.browserReceivedEpochMs&&ye.receivedAt?`hub ${Math.max(0,Math.round(ye.browserReceivedEpochMs-Date.parse(ye.receivedAt)))}ms`:"",ye.browserReceivedEpochMs&&ye.hubPacketEpochMs?`sock ${Math.max(0,Math.round(ye.browserReceivedEpochMs-ye.hubPacketEpochMs))}ms`:"",ye.droppedByAgent?`drop ${ye.droppedByAgent}`:"",ye.hubIngressDropped?`ingress-drop ${ye.hubIngressDropped}`:"",ye.hubClientDropped?`ws-drop ${ye.hubClientDropped}`:"",ye.captureStageMs?`capture ${Math.round(ye.captureStageMs)}ms`:"",ye.convertMs?`rgb565 ${Math.round(ye.convertMs)}ms`:"",ye.compressMs?`lzo ${Math.round(ye.compressMs)}ms`:"",ye.captureSourceSerial?`cap #${ye.captureSourceSerial}`:"",ye.captureSourceSkipped?`cap skip ${ye.captureSourceSkipped}`:"",ye.frameMode==="mode5-lzo-delta"?`tiles ${ye.deltaVisualTileCount||0}+${ye.deltaRefreshTileCount||0}/${ye.deltaTotalTiles||0}@${ye.deltaTileSize||0}`:"",ye.platformProfile||ye.hardwareEncoder||"-",ye.atlasComposeMs?`atlas ${ye.atlasComposeMs.toFixed(1)}ms`:"",ye.atlasPoolStarved?`pool ${ye.atlasPoolStarved}`:"",ye.atlasTileCount?`tiles ${ye.atlasReadyTiles||0}/${ye.atlasTileCount}`:"",Ye?.inputFeedbackMs!==void 0&&Ye.inputFeedbackAt!==void 0&&performance.now()-Ye.inputFeedbackAt<=Yx?`feedback ${Math.round(Ye.inputFeedbackMs)}ms`:"",ye.contentHash?`enc ${ye.contentHash.slice(0,6)}`:"",Ye?.visualHash?`pix ${Ye.visualHash.slice(0,6)}`:""].filter(Boolean).join(" / "):"-",Dr=us==="open"?[`${ga.sentPerSecond.toFixed(1)} hz`,ga.lastInputSeq>0?`rtt ${Math.round(ga.lastRoundTripMs)}ms`:"",ga.lastInputSeq>0?`apply ${ga.lastAgentApplyMs.toFixed(1)}ms`:"",ga.droppedPerSecond>0?`drop ${ga.droppedPerSecond.toFixed(1)}/s`:"",ga.bufferedAmount>0?`buf ${yo(ga.bufferedAmount)}`:"",ga.lastInputType||"ready"].filter(Boolean).join(" / "):us,Wn=Ye?.inputFeedbackMs!==void 0&&Ye.inputFeedbackAt!==void 0&&performance.now()-Ye.inputFeedbackAt<=Yx?`${Math.round(Ye.inputFeedbackMs)}ms / input #${Ye.inputFeedbackSeq||0}`:"waiting for changed frame",xs=ye?`#${ye.frameSeq} ${mm(ye.receivedAt||ye.capturedAt)}`:"waiting",Zt=Math.max(0,os.bytesPerSecond*8/1e6),ml=Il?.atlasReadyTiles??Di,_i=Il?.atlasTileCount??Di,vs=ml===_i?`${_i} tiles`:`${ml}/${_i} tiles`,ys=Oe?`1 stream / ${Ri} / ${Zt.toFixed(Zt>=10?0:1)}Mbps`:mt?`1 stream / ${vs} / ${Ri} / ${Zt.toFixed(Zt>=10?0:1)}Mbps`:`${Di} screens / ${Ri} / ${Zt.toFixed(Zt>=10?0:1)}Mbps`,bs=j?"offline":M?.started?"online":"starting",xa=fa.length+te.filter(S=>!We.some(D=>ho(D.slotNumber)===S)).length,Jo=te.length===1?`Slot ${String(te[0]).padStart(3,"0")}`:`${te.length} slots selected`,ws=Oe?we?No(we):"No workstation":xa===0?"No workstation":xa>1?`${xa} selected`:we?No(we):Jo,Lt=nr[Ve]||nr.en,Ss=Lt.sync||nr.en.sync,vn=s||q?"checking":L?tt==="pro"?"Pro LTD active":`Plus LTD ${We.length}/${vo}`:Bl?`Free ${We.length}/${Js}`:`Upgrade ${We.length}/${Js}`,Rr=tt==="pro"?"Pro active":_==="checkout"?"Opening":tt==="ltd"?"Pro $199":"Plus $79",ec=L?tt==="pro"?"Pro active":"Upgrade to Pro LTD":l?_==="checkout"?"Opening checkout":tt==="ltd"?"Buy Pro LTD":"Buy Plus LTD":_==="auth"?"Opening Google":"Sign in to buy",Ms=tt==="pro"||_==="checkout"||_==="auth"||s||q,Ya=l?.user.user_metadata,Yl=iv(Ya,"avatar_url","picture"),Vl=iv(Ya,"full_name","name")||l?.user.email||"Google",Cs=Vl.slice(0,1).toUpperCase(),tc=M?.started?"Local app ready":"Start LiveDesk",_n=r?.active?"Published":l?"Not published":"Sign in required",Ql=/^\d{6}$/.test(M?.pairingPin||"")?M?.pairingPin:"------",Kl=yu.find(S=>S.width===se.maxWidth&&S.height===se.maxHeight)?.id||`${se.maxWidth}x${se.maxHeight}`,js=se.atlasTileSizeMode==="auto"?"auto":Wf.find(S=>S.width===se.atlasTileWidth&&S.height===se.atlasTileHeight)?.id||"320x180",Oi=Zf.find(S=>S.width===Ce.maxWidth&&S.height===Ce.maxHeight)?.id||`${Ce.maxWidth}x${Ce.maxHeight}`,On=vu.find(S=>S.id===se.frameMode)||vu[0],Ct=S=>{et(D=>{const V=S.frameMode?Mm(S.frameMode):D.frameMode,H=S.frameMode!==void 0&&V!==D.frameMode;return{...D,...S,frameMode:V,fps:jm(S.fps??(H?dy(V):D.fps),V)}})},Va=S=>{const D=yu.find(V=>V.id===S);D&&Ct({maxWidth:D.width,maxHeight:D.height})},va=S=>{if(S==="auto"){Ct({atlasTileSizeMode:"auto"});return}const D=Wf.find(V=>V.id===S);!D?.width||!D?.height||Ct({atlasTileSizeMode:"fixed",atlasTileWidth:D.width,atlasTileHeight:D.height})},sn=S=>{It(D=>{const V=S.frameMode?Cm(S.frameMode):D.frameMode,H=S.frameMode!==void 0&&V!==D.frameMode,F=S.fps??(H?30:D.fps),ne=S.maxWidth??D.maxWidth,pe=S.maxHeight??D.maxHeight;return{...D,...S,frameMode:V,fps:Ma(F,20,V==="mode5-lzo-delta"?30:60,V==="mode5-lzo-delta"?30:60),maxWidth:V==="mode5-lzo-delta"?Math.min(1920,ne):ne,maxHeight:V==="mode5-lzo-delta"?Math.min(1080,pe):pe}})},Da=S=>{const D=Zf.find(V=>V.id===S);D&&sn({maxWidth:D.width,maxHeight:D.height})},nc=S=>{if(S==="control"){const D=Ln||rr;if(D&&re(D.deviceId),be(S),!St){I(!1),z(rl);return}I(!0);return}be(S),I(!1)};return o.jsxs("main",{className:"app-shell",children:[o.jsxs("aside",{className:"tool-rail","aria-label":"LiveDesk tools",children:[o.jsx("div",{className:"rail-brand",title:"LiveDesk",children:o.jsx(_a,{size:22})}),o.jsx("nav",{className:"rail-tools",children:WC.map(S=>{const D=S.icon;return o.jsxs("button",{className:`rail-tool ${ge===S.id?"active":""} accent-${S.accent}`,onClick:()=>nc(S.id),title:S.label,type:"button",children:[o.jsx(D,{size:19}),o.jsx("span",{children:S.label})]},S.id)})}),o.jsxs("div",{className:"rail-footer",children:[o.jsxs("button",{className:"rail-tool compact sync-server",onClick:()=>Ga({takeover:!0,requestLocalAccess:!0}),title:"Sync Server",type:"button",children:[o.jsx(Ef,{size:18}),o.jsx("span",{children:"Sync Server"})]}),o.jsxs("button",{className:`rail-tool compact local-settings ${ka?"active":""}`,onClick:()=>{be("settings"),gt(!1),I(!1),qe(!1)},title:"Settings",type:"button",children:[o.jsx(qb,{size:18}),o.jsx("span",{children:"Settings"})]}),o.jsxs("button",{className:`rail-account ${l?"signed-in":""}`,onClick:()=>{gt(S=>!S)},disabled:s||_==="auth","aria-expanded":ke,title:l?`Account: ${l.user.email||Vl}`:"Sign in with Google",type:"button",children:[l?Yl?o.jsx("img",{src:Yl,alt:Vl,referrerPolicy:"no-referrer"}):o.jsx("span",{className:"avatar-fallback",children:Cs}):o.jsx(Df,{size:18}),o.jsx("span",{children:l?"Account":"Google"})]}),ke&&o.jsxs("section",{className:"account-popover",role:"dialog","aria-label":"LiveDesk account",children:[o.jsxs("div",{className:"account-popover-head",children:[o.jsx("div",{className:"account-popover-avatar",children:l&&Yl?o.jsx("img",{src:Yl,alt:Vl,referrerPolicy:"no-referrer"}):l?o.jsx("span",{children:Cs}):o.jsx(Df,{size:18})}),o.jsxs("div",{children:[o.jsx("strong",{children:l?Vl:"Account"}),o.jsx("p",{children:l?.user.email||"Not signed in"})]})]}),o.jsxs("dl",{className:"account-popover-facts",children:[o.jsx("dt",{children:"User"}),o.jsx("dd",{children:l?.user.email||"Not signed in"}),o.jsx("dt",{children:"Network"}),o.jsx("dd",{children:tc}),o.jsx("dt",{children:"Access"}),o.jsx("dd",{children:_n}),o.jsx("dt",{children:"Plan"}),o.jsx("dd",{children:vn}),o.jsx("dt",{children:"Ads"}),o.jsx("dd",{children:tt==="free"?"Standard banner":"Removed"})]}),l?o.jsxs("button",{className:"account-popover-action",onClick:Gu,disabled:_==="auth",type:"button",children:[o.jsx(Gb,{size:16}),"Logout"]}):o.jsxs("button",{className:"account-popover-action primary",onClick:ds,disabled:_==="auth",type:"button",children:[o.jsx(Df,{size:16}),"Sign in with Google"]})]})]})]}),o.jsxs("section",{className:`desk-stage ${ua&&!Ee?"dock-open":""} ${Oe?"control-stage":""}`,children:[o.jsxs("header",{className:"topbar",children:[o.jsxs("div",{className:"brand",children:[o.jsx("span",{className:"brand-mark",children:o.jsx(Rf,{size:18})}),o.jsxs("div",{children:[o.jsx("h1",{children:"LiveDesk"}),o.jsx("p",{children:"Control wall for local machines"})]})]}),Fa&&!Oe&&o.jsxs("div",{className:"file-share-top-route","aria-label":"File distribution route",children:[o.jsxs("div",{children:[o.jsx(po,{size:17}),o.jsxs("span",{children:[o.jsx("small",{children:"Source"}),o.jsx("strong",{children:"LiveDesk Hub"})]})]}),o.jsx(rv,{size:15}),o.jsx(Pb,{size:16}),o.jsxs("div",{children:[o.jsx("span",{className:"file-share-top-route-laptops",children:"▣ ▣ ▣"}),o.jsxs("span",{children:[o.jsx("small",{children:"Destination"}),o.jsxs("strong",{children:[Mi," workstation",Mi===1?"":"s"]}),o.jsx("em",{children:Te.trim()||"Desktop/LiveDeskFiles"})]})]})]}),ua&&!Oe&&o.jsx("div",{className:"top-actions",children:o.jsx("div",{className:"segmented-control","aria-label":"Screen size",children:ZC.map(S=>o.jsx("button",{className:Me===S.id?"active":"",onClick:()=>Fe(S.id),type:"button",children:S.label},S.id))})})]}),zo?o.jsxs("section",{className:"doc-page",lang:Ve,dir:Ve==="ar"?"rtl":"ltr",children:[o.jsxs("section",{className:"doc-hero",children:[o.jsxs("div",{className:"doc-hero-copy",children:[o.jsxs("span",{className:"pricing-eyebrow",children:[o.jsx(rm,{size:16}),Lt.eyebrow]}),o.jsx("h2",{children:Lt.title}),o.jsx("p",{children:Lt.intro})]}),o.jsxs("label",{className:"doc-language-picker",children:[o.jsxs("span",{children:[o.jsx(Yb,{size:17}),Lt.languageLabel]}),o.jsx("select",{value:Ve,onChange:S=>Le(S.target.value),children:JC.map(S=>o.jsx("option",{value:S.id,children:S.label},S.id))})]})]}),o.jsx("section",{className:"doc-grid",children:Lt.sections.map((S,D)=>{const H=[Gg,go,sm,Vb][D]||rm;return o.jsxs("article",{className:"doc-card",children:[o.jsx("div",{className:"doc-card-icon",children:o.jsx(H,{size:19})}),o.jsxs("div",{children:[o.jsx("h3",{children:S.title}),o.jsx("p",{children:S.body}),o.jsx("ul",{children:S.points.map(F=>o.jsx("li",{children:F},F))})]})]},S.title)})}),Ss&&o.jsxs("section",{className:"doc-sync",children:[o.jsxs("div",{className:"doc-sync-head",children:[o.jsx(Ef,{size:20}),o.jsxs("div",{children:[o.jsx("h3",{children:Ss.title}),o.jsx("p",{children:Ss.body})]})]}),o.jsx("ul",{children:Ss.points.map(S=>o.jsx("li",{children:S},S))})]}),o.jsxs("section",{className:"doc-firewall",children:[o.jsxs("div",{className:"doc-firewall-head",children:[o.jsx(Pg,{size:20}),o.jsxs("div",{children:[o.jsx("h3",{children:Lt.firewall.title}),o.jsx("p",{children:Lt.firewall.body})]})]}),o.jsx("ul",{children:Lt.firewall.points.map(S=>o.jsx("li",{children:S},S))})]}),o.jsxs("section",{className:"doc-command-panel",children:[o.jsxs("div",{className:"doc-command-head",children:[o.jsx(go,{size:20}),o.jsxs("div",{children:[o.jsx("h3",{children:Lt.commands.title}),o.jsx("p",{children:Lt.commands.body})]})]}),o.jsxs("div",{className:"doc-command-list",children:[Lt.commands.manager&&o.jsxs("div",{className:"doc-command-row",children:[o.jsx("span",{children:Lt.commands.manager}),o.jsx("code",{children:Ei}),o.jsx("button",{className:"icon-button",onClick:()=>Vi(Ei),title:"Copy command",type:"button",children:o.jsx(Vs,{size:16})})]}),o.jsxs("div",{className:"doc-command-row",children:[o.jsx("span",{children:Lt.commands.primary}),o.jsx("code",{children:Zn}),o.jsx("button",{className:"icon-button",onClick:()=>Vi(Zn),title:"Copy command",type:"button",children:o.jsx(Vs,{size:16})})]}),o.jsxs("div",{className:"doc-command-row",children:[o.jsx("span",{children:Lt.commands.slot}),o.jsx("code",{children:`${Zn} 3`}),o.jsx("button",{className:"icon-button",onClick:()=>Vi(`${Zn} 3`),title:"Copy command",type:"button",children:o.jsx(Vs,{size:16})})]})]})]})]}):Si?o.jsx(rC,{hubUrl:T,devices:C}):Fa?o.jsx(PM,{hubUrl:T,devices:We,localFeatureAccess:St,upgradeNotice:rl,notice:me,remoteDirectory:Te,onRemoteDirectoryChange:De,targetMode:Se,selectedTargetIds:dt,onTargetModeChange:$e,onTargetToggle:S=>ft(D=>D.includes(S)?D.filter(V=>V!==S):[...D,S]),filePickerRef:$t,folderPickerRef:Mt,onBrowserFileImport:S=>{ql(S)},onBrowserFolderImport:S=>{ql(S)},onNotice:z,onTransferChange:S=>{if(!S){gn(null);return}const D=S.state==="failed"||S.state==="partially-failed"||S.state==="cancelled"?"failed":S.state==="completed"?"queued":S.state==="sending"?"sending":"reading";gn({id:S.id,status:D,progress:S.progress,message:S.message}),["completed","partially-failed","failed","cancelled"].includes(S.state)&&window.setTimeout(()=>gn(V=>V?.id===S.id?null:V),4500)}}):ka?o.jsx(uw,{pin:o.jsxs(dw,{children:[(j||c||U||me)&&o.jsx("section",{className:"notice-band",children:j||c||U||me}),o.jsxs("div",{className:"settings-section-grid",children:[o.jsxs("section",{className:"settings-section-card settings-pairing-card",children:[o.jsxs("div",{className:"settings-section-heading",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Pair a workstation"}),o.jsx("h3",{children:"Connect another local PC"})]}),o.jsx(_a,{size:20})]}),o.jsxs("div",{className:"settings-pin-display",children:[o.jsx("span",{children:"Hub PIN"}),o.jsx("strong",{children:Ql}),o.jsxs("button",{className:"text-button ghost compact",onClick:Ti,disabled:!M?.started||_==="pin",type:"button",children:[o.jsx(lm,{size:15}),_==="pin"?"Creating":"New PIN"]})]}),o.jsxs("div",{className:"settings-command-list",children:[o.jsxs("div",{className:"settings-command-row",children:[o.jsx("span",{children:"Client"}),o.jsx("code",{children:Zn}),o.jsx("button",{className:"icon-button",onClick:()=>Vi(Zn),title:"Copy client command",type:"button",children:o.jsx(Vs,{size:16})})]}),o.jsxs("div",{className:"settings-command-row",children:[o.jsx("span",{children:"Slot example"}),o.jsx("code",{children:`${Zn} 3`}),o.jsx("button",{className:"icon-button",onClick:()=>Vi(`${Zn} 3`),title:"Copy slot command",type:"button",children:o.jsx(Vs,{size:16})})]}),o.jsxs("div",{className:"settings-command-row",children:[o.jsx("span",{children:"Hub"}),o.jsx("code",{children:Ei}),o.jsx("button",{className:"icon-button",onClick:()=>Vi(Ei),title:"Copy Hub command",type:"button",children:o.jsx(Vs,{size:16})})]})]})]}),o.jsxs("section",{className:"settings-section-card",children:[o.jsxs("div",{className:"settings-section-heading",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Hub status"}),o.jsx("h3",{children:bs})]}),o.jsx("span",{className:`settings-status-dot state-${bs}`})]}),o.jsxs("dl",{className:"settings-facts",children:[o.jsx("dt",{children:"Address"}),o.jsx("dd",{children:T||"-"}),o.jsx("dt",{children:"Connected workstations"}),o.jsxs("dd",{children:[Go,"/",kt]}),o.jsx("dt",{children:"Sync access"}),o.jsx("dd",{children:M?.started?"Local app ready":"Start Hub first"}),o.jsx("dt",{children:"Plan"}),o.jsx("dd",{children:vn})]}),o.jsxs("div",{className:"settings-action-row",children:[o.jsxs("button",{className:"text-button primary",onClick:()=>Ga({takeover:!0,requestLocalAccess:!0}),disabled:!l||_==="host",type:"button",children:[o.jsx(Ef,{size:16}),"Sync access"]}),o.jsxs("button",{className:"text-button buy",onClick:()=>ms(tt==="ltd"?"pro":"ltd"),disabled:_==="checkout"||tt==="pro",type:"button",children:[o.jsx(xo,{size:16}),Rr]})]})]})]}),o.jsxs("section",{className:"settings-section-card",children:[o.jsxs("div",{className:"settings-section-heading",children:[o.jsxs("div",{children:[o.jsx("span",{children:"File transfer"}),o.jsx("h3",{children:"Client destination folder"})]}),o.jsx(bo,{size:20})]}),o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:"Remote folder"}),o.jsx("input",{value:Te,onChange:S=>De(S.target.value),placeholder:"Desktop/LiveDeskFiles"})]}),o.jsx("p",{className:"settings-help",children:"Blank uses Desktop/LiveDeskFiles on each workstation."})]})]}),wall:o.jsx(fw,{children:o.jsxs("div",{className:"settings-section-grid",children:[o.jsxs("section",{className:"settings-section-card",children:[o.jsxs("div",{className:"settings-section-heading",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Wall stream"}),o.jsx("h3",{children:"Frame delivery"})]}),o.jsx(sm,{size:20})]}),o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:"Frame mode"}),o.jsx("select",{value:se.frameMode,onChange:S=>Ct({frameMode:Mm(S.target.value)}),children:vu.map(S=>o.jsxs("option",{value:S.id,children:[S.label," - ",S.detail]},S.id))})]}),o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:"H.264 decode"}),o.jsx("select",{value:se.h264DecodeAcceleration,onChange:S=>Ct({h264DecodeAcceleration:Eu(S.target.value)}),children:Sm.map(S=>o.jsx("option",{value:S.id,children:S.label},S.id))})]}),o.jsxs("div",{className:"settings-field-grid",children:[o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:"FPS"}),o.jsx("select",{value:se.fps,onChange:S=>Ct({fps:jm(S.target.value,se.frameMode)}),children:Ym.filter(S=>S<=fy(se.frameMode)).map(S=>o.jsx("option",{value:S,children:S},S))})]}),o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:mt?"Atlas tile":"Resolution"}),o.jsx("select",{value:mt?js:Kl,onChange:S=>mt?va(S.target.value):Va(S.target.value),children:(mt?Wf:yu).map(S=>o.jsx("option",{value:S.id,children:S.label},S.id))})]})]}),o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:"Quality"}),o.jsx("select",{value:se.quality,onChange:S=>Ct({quality:Ma(S.target.value,20,95,qn.quality)}),children:Wx.map(S=>o.jsx("option",{value:S,children:S},S))})]})]}),o.jsxs("section",{className:"settings-section-card",children:[o.jsxs("div",{className:"settings-section-heading",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Wall behavior"}),o.jsx("h3",{children:"Visibility and load"})]}),o.jsx(Rf,{size:20})]}),o.jsxs("label",{className:"settings-toggle",children:[o.jsx("input",{type:"checkbox",checked:se.autoStartLive,onChange:S=>Ct({autoStartLive:S.target.checked})}),o.jsx("span",{children:"Auto live on connected screens"})]}),o.jsxs("label",{className:"settings-toggle",children:[o.jsx("input",{type:"checkbox",checked:se.visibleOnlyLive,onChange:S=>Ct({visibleOnlyLive:S.target.checked})}),o.jsx("span",{children:"Stream visible tiles first"})]}),!mt&&o.jsxs("label",{className:"settings-toggle",children:[o.jsx("input",{type:"checkbox",checked:se.adaptiveSizeByWall,onChange:S=>Ct({adaptiveSizeByWall:S.target.checked})}),o.jsx("span",{children:"Fit stream size to Wall"})]}),o.jsxs("label",{className:"settings-toggle",children:[o.jsx("input",{type:"checkbox",checked:se.adaptiveLoadShedding,onChange:S=>Ct({adaptiveLoadShedding:S.target.checked})}),o.jsx("span",{children:"Reduce FPS under load"})]}),o.jsxs("label",{className:"settings-toggle",children:[o.jsx("input",{type:"checkbox",checked:se.showScreenStatus,onChange:S=>Ct({showScreenStatus:S.target.checked})}),o.jsx("span",{children:"Screen status overlay"})]}),o.jsxs("div",{className:"settings-summary",children:[o.jsx("span",{children:On.label}),o.jsxs("strong",{children:[xn.maxWidth,"x",xn.maxHeight," / ",lt,"fps"]})]}),o.jsxs("button",{className:"settings-reset",onClick:()=>et(qn),type:"button",children:[o.jsx(fu,{size:15})," Reset Wall settings"]})]})]})}),control:o.jsx(mw,{children:o.jsxs("div",{className:"settings-section-grid",children:[o.jsxs("section",{className:"settings-section-card",children:[o.jsxs("div",{className:"settings-section-heading",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Control stream"}),o.jsx("h3",{children:"Low-latency delivery"})]}),o.jsx(mu,{size:20})]}),o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:"Frame mode"}),o.jsx("select",{value:Ce.frameMode,onChange:S=>sn({frameMode:Cm(S.target.value)}),children:SC.map(S=>o.jsx("option",{value:S.id,children:S.label},S.id))})]}),Ce.frameMode==="mode3-h264-hw"&&o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:"H.264 decode"}),o.jsx("select",{value:Ce.h264DecodeAcceleration,onChange:S=>sn({h264DecodeAcceleration:Eu(S.target.value)}),children:Sm.map(S=>o.jsx("option",{value:S.id,children:S.label},S.id))})]}),o.jsxs("div",{className:"settings-field-grid",children:[o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:"FPS"}),o.jsx("select",{value:Ce.fps,onChange:S=>sn({fps:Ma(S.target.value,20,60,Gn.fps)}),children:MC.filter(S=>Ce.frameMode==="mode3-h264-hw"||S<=30).map(S=>o.jsx("option",{value:S,children:S},S))})]}),o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:"Resolution"}),o.jsx("select",{value:Oi,onChange:S=>Da(S.target.value),children:Zf.filter(S=>Ce.frameMode==="mode3-h264-hw"||S.width<=1920).map(S=>o.jsx("option",{value:S.id,children:S.label},S.id))})]})]}),Ce.frameMode==="mode3-h264-hw"&&o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:"Quality"}),o.jsx("select",{value:Ce.quality,onChange:S=>sn({quality:Ma(S.target.value,20,95,Gn.quality)}),children:Wx.map(S=>o.jsx("option",{value:S,children:S},S))})]})]}),o.jsxs("section",{className:"settings-section-card",children:[o.jsxs("div",{className:"settings-section-heading",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Control behavior"}),o.jsx("h3",{children:"Session display"})]}),o.jsx(_a,{size:20})]}),o.jsxs("label",{className:"settings-toggle",children:[o.jsx("input",{type:"checkbox",checked:Ce.showScreenStatus,onChange:S=>sn({showScreenStatus:S.target.checked})}),o.jsx("span",{children:"Screen status overlay"})]}),o.jsxs("div",{className:"settings-summary control",children:[o.jsx("span",{children:Ce.frameMode==="mode5-lzo-delta"?"Mode 5 tile delta":"Mode 3 H.264"}),o.jsxs("strong",{children:[da.maxWidth,"x",da.maxHeight," / ",sr,"fps"]})]}),o.jsxs("button",{className:"settings-reset",onClick:()=>It(Gn),type:"button",children:[o.jsx(fu,{size:15})," Reset Control settings"]})]})]})})}):zl?o.jsxs("section",{className:"pricing-page",children:[o.jsxs("header",{className:"pricing-header",children:[o.jsxs("div",{children:[o.jsxs("span",{className:"pricing-eyebrow",children:[o.jsx(Qb,{size:15})," LiveDesk plans"]}),o.jsx("h2",{children:"Choose the plan that fits your wall"}),o.jsx("p",{children:"Start free with a local screen wall. Upgrade when you need ad-free monitoring, more workstations, or commercial controls."})]}),o.jsx("button",{className:"pricing-close",onClick:()=>be("wall"),title:"Close pricing",type:"button",children:o.jsx(Su,{size:18})})]}),(U||me)&&o.jsx("section",{className:"notice-band",children:U||me}),o.jsxs("div",{className:"pricing-status","aria-live":"polite",children:[o.jsx("span",{children:"Current plan"}),o.jsx("strong",{children:es.name}),o.jsxs("small",{children:[We.length,"/",wC(ts)," connected devices"]})]}),o.jsxs("div",{className:"pricing-cards","aria-label":"LiveDesk plans",children:[o.jsxs("article",{className:`pricing-plan-card ${tt==="free"?"current":""}`,children:[o.jsxs("div",{className:"pricing-plan-topline",children:[o.jsx("span",{className:"pricing-plan-badge free",children:"Free"}),o.jsx("strong",{children:"$0"})]}),o.jsx("p",{className:"pricing-plan-audience",children:kl.free.audience}),o.jsx("h3",{children:"Monitor your local wall"}),o.jsx("p",{children:kl.free.note}),o.jsxs("ul",{children:[o.jsxs("li",{children:[o.jsx(Sa,{size:16})," Up to ",Js," devices"]}),o.jsxs("li",{children:[o.jsx(Sa,{size:16})," Live view and local control"]}),o.jsxs("li",{children:[o.jsx(Sa,{size:16})," Standard ad-supported banner"]})]}),o.jsx("span",{className:"pricing-current-label",children:tt==="free"?"Current plan":"Included for everyone"})]}),o.jsxs("article",{className:`pricing-plan-card featured ${tt==="ltd"?"current":""}`,children:[o.jsxs("div",{className:"pricing-plan-topline",children:[o.jsxs("span",{className:"pricing-plan-badge plus",children:[o.jsx(Kb,{size:14})," Plus"]}),o.jsx("strong",{children:"$5"})]}),o.jsx("p",{className:"pricing-plan-audience",children:kl.ltd.audience}),o.jsx("h3",{children:"Ad-free monitoring"}),o.jsx("p",{children:"More room for personal AI workstations without the standard banner."}),o.jsxs("ul",{children:[o.jsxs("li",{children:[o.jsx(Sa,{size:16})," Up to ",vo," devices"]}),o.jsxs("li",{children:[o.jsx(Sa,{size:16})," No standard ad banner"]}),o.jsxs("li",{children:[o.jsx(Sa,{size:16})," ",kl.ltd.yearly," or ",kl.ltd.ltd]})]}),o.jsxs("button",{className:"pricing-plan-button",onClick:l?()=>ms("ltd"):ds,disabled:tt!=="free"||_==="checkout"||_==="auth"||s||q,type:"button",children:[o.jsx(xo,{size:16}),tt==="free"?l?"Choose Plus":"Sign in for Plus":"Plus active"]})]}),o.jsxs("article",{className:`pricing-plan-card pro ${tt==="pro"?"current":""}`,children:[o.jsxs("div",{className:"pricing-plan-topline",children:[o.jsxs("span",{className:"pricing-plan-badge pro",children:[o.jsx(Pg,{size:14})," Pro"]}),o.jsx("strong",{children:"$15"})]}),o.jsx("p",{className:"pricing-plan-audience",children:kl.pro.audience}),o.jsx("h3",{children:"For serious operations"}),o.jsx("p",{children:"Commercial-ready monitoring for larger AI labs, studios, and teams."}),o.jsxs("ul",{children:[o.jsxs("li",{children:[o.jsx(Sa,{size:16})," 30+ workstation walls"]}),o.jsxs("li",{children:[o.jsx(Sa,{size:16})," Commercial use included"]}),o.jsxs("li",{children:[o.jsx(Sa,{size:16})," ",kl.pro.yearly," or ",kl.pro.ltd]})]}),o.jsxs("button",{className:"pricing-plan-button",onClick:l?()=>ms("pro"):ds,disabled:tt==="pro"||_==="checkout"||_==="auth"||s||q,type:"button",children:[o.jsx(xo,{size:16}),tt==="pro"?"Pro active":l?"Choose Pro":"Sign in for Pro"]})]})]}),o.jsxs("section",{className:"pricing-includes",children:[o.jsxs("div",{children:[o.jsx(_a,{size:17}),o.jsx("span",{children:"Screen wall"}),o.jsx("strong",{children:"120+ slots"})]}),o.jsxs("div",{children:[o.jsx(mu,{size:17}),o.jsx("span",{children:"Focused control"}),o.jsx("strong",{children:"Local-first"})]}),o.jsxs("div",{children:[o.jsx(Yg,{size:17}),o.jsx("span",{children:"Remote audio"}),o.jsx("strong",{children:"Available"})]}),o.jsxs("div",{children:[o.jsx(bo,{size:17}),o.jsx("span",{children:"File transfer"}),o.jsx("strong",{children:"Included"})]})]}),o.jsxs("p",{className:"pricing-note",children:[o.jsx(Sa,{size:15})," Commercial use requires Pro. Plus LTD is for personal, creator, and homelab use."]}),o.jsxs("button",{className:"pricing-primary-cta",onClick:l?()=>ms(tt==="ltd"?"pro":"ltd"):ds,disabled:Ms,type:"button",children:[o.jsx(xo,{size:18}),ec]})]}):o.jsx(o.Fragment,{children:o.jsxs("section",{className:`monitor-layout ${Ee?"dock-collapsed":""}`,children:[o.jsxs("section",{ref:Jt,className:`screen-wall-panel ${wi?"drop-active":""}`,onClick:S=>{S.currentTarget===S.target&&$l()},onDragEnter:S=>{S.preventDefault(),Rn(!0)},onDragOver:S=>{S.preventDefault(),S.dataTransfer.dropEffect="copy"},onDragLeave:S=>{S.currentTarget===S.target&&Rn(!1)},onDrop:ki,children:[mt&&o.jsx("canvas",{ref:fr,className:"atlas-source-canvas",width:cl?.width||1920,height:cl?.height||1080,"aria-hidden":"true"}),Oe?o.jsx("section",{className:"control-focus",children:o.jsxs("div",{className:"control-wall",children:[we&&jr.length>1&&o.jsx("div",{className:"control-monitor-tabs","aria-label":"Select monitor",children:jr.map(S=>o.jsxs("button",{className:S.index===Li?"active":"",onClick:()=>Pu(we.deviceId,S.index),title:OC(S),type:"button",children:[o.jsx("span",{children:S.name||`Display ${S.index+1}`}),S.width>0&&S.height>0&&o.jsxs("small",{children:[S.width,"x",S.height]})]},S.index))}),we?o.jsx(am,{device:we,frame:ye,selected:!1,controlEnabled:zn&&fe,showStatus:Ce.showScreenStatus,monitorIndex:la(Rt[we.deviceId],$n(we)),monitorCount:$n(we),onSelect:()=>{},onFocusDevice:()=>re(we.deviceId),onOpenControl:()=>Sr(we.deviceId),onCycleMonitor:S=>fs(we.deviceId,S),onCanvasReady:ls,sendInput:Ai,presentationReady:Wi},we.deviceId):o.jsxs("div",{className:"control-empty",children:[o.jsx(_a,{size:30}),o.jsx("strong",{children:"No workstation"}),o.jsx("span",{children:"Open a workstation from the Wall."})]}),we&&!Wi&&o.jsxs("div",{className:"control-connection-overlay",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"control-connection-spinner","aria-hidden":"true"}),o.jsx("strong",{children:"Connecting"}),o.jsx("small",{children:Uo?`Control stream: ${Uo}`:xr==="open"?"Preparing the first control frame":"Opening the Control stream"})]})]})}):mt?o.jsx("div",{className:`screen-wall atlas-slot-wall size-${Me}`,onClick:S=>{S.currentTarget===S.target&&$l()},children:sl.map((S,D)=>{const V=D+1;return S?o.jsx(am,{device:S,frame:rs.get(S.deviceId),selected:_l.has(S.deviceId)||Xn.has(V),controlEnabled:!1,showStatus:se.showScreenStatus,monitorIndex:la(Rt[S.deviceId],$n(S)),monitorCount:$n(S),onSelect:()=>yr(S.deviceId),onFocusDevice:()=>Ul(S.deviceId),onOpenControl:()=>Sr(S.deviceId),onCycleMonitor:H=>fs(S.deviceId,H),onCanvasReady:ji,sendInput:Ai},S.deviceId):o.jsx(sv,{index:D,selected:Xn.has(V),onSelect:()=>br(V)},`slot-${D}`)})}):o.jsx("div",{className:`screen-wall size-${Me}`,onClick:S=>{S.currentTarget===S.target&&$l()},children:sl.map((S,D)=>{const V=D+1;return S?o.jsx(am,{device:S,frame:rs.get(S.deviceId),selected:_l.has(S.deviceId)||Xn.has(V),controlEnabled:zn&&fe&&we?.deviceId===S.deviceId,showStatus:se.showScreenStatus,monitorIndex:la(Rt[S.deviceId],$n(S)),monitorCount:$n(S),onSelect:()=>yr(S.deviceId),onFocusDevice:()=>Ul(S.deviceId),onOpenControl:()=>Sr(S.deviceId),onCycleMonitor:H=>fs(S.deviceId,H),onCanvasReady:as,sendInput:Ai},S.deviceId):o.jsx(sv,{index:D,selected:Xn.has(V),onSelect:()=>br(V)},`slot-${D}`)})}),o.jsx(tj,{visible:ur&&!Oe})]}),!ka&&o.jsxs("aside",{className:`right-dock actions-mode ${Ee?"collapsed":""}`,"aria-label":"LiveDesk tools",children:[o.jsx("button",{className:"dock-toggle",onClick:()=>qe(S=>!S),"aria-label":Ee?"Show control panel":"Hide control panel",title:Ee?"Show control panel":"Hide control panel",type:"button",children:Ee?o.jsx(uv,{size:18}):o.jsx(Am,{size:18})}),!Ee&&o.jsxs(o.Fragment,{children:[o.jsxs("section",{className:"action-dock",children:[o.jsxs("div",{className:"action-context",children:[o.jsx("span",{children:Oe?"Control target":xa>0?"Selection":"No selection"}),o.jsx("strong",{children:ws})]}),o.jsx("input",{ref:wt,className:"hidden-file-input",type:"file",multiple:!0,onChange:S=>{S.currentTarget.files&&Cr(S.currentTarget.files),S.currentTarget.value=""}}),(j||me)&&o.jsx("div",{className:"notice-band compact",children:o.jsx("span",{children:j||me})}),o.jsxs("div",{className:"action-grid",children:[o.jsxs("button",{className:"action-tile primary",onClick:()=>we&&ul(we.deviceId),disabled:!dr,type:"button",children:[o.jsx(Vg,{size:21}),o.jsx("span",{children:"Live"})]}),o.jsxs("button",{className:`action-tile ${fe?"active":""}`,onClick:()=>I(S=>!S),disabled:!zn,type:"button",children:[o.jsx(mu,{size:21}),o.jsx("span",{children:us!=="idle"?us:"Control"})]}),o.jsxs("button",{className:`action-tile ${Z?"active":""}`,onClick:Yu,disabled:!ha,type:"button",title:Ol?"Remote PC audio":"Remote audio is not supported by this workstation yet",children:[o.jsx(Yg,{size:21}),o.jsx("span",{children:Z&&$o!=="idle"?$o:"Audio"})]}),o.jsxs("button",{className:"action-tile",onClick:()=>wt.current?.click(),disabled:!St||(Oe?!we:fa.length===0),type:"button",title:"File transfer",children:[o.jsx(bo,{size:21}),o.jsx("span",{children:"Files"})]}),o.jsxs("button",{className:"action-tile",disabled:!0,type:"button",title:"Reboot",children:[o.jsx(fu,{size:21}),o.jsx("span",{children:"Reboot"})]}),o.jsxs("button",{className:"action-tile",disabled:!0,type:"button",title:"Power",children:[o.jsx(Xb,{size:21}),o.jsx("span",{children:"Power"})]}),o.jsxs("button",{className:"action-tile",disabled:!0,type:"button",title:"Terminal",children:[o.jsx(go,{size:21}),o.jsx("span",{children:"Shell"})]})]})]}),we&&ma&&o.jsxs("section",{className:"side-panel selected-panel",children:[o.jsxs("div",{className:"machine-detail-head",children:[o.jsxs("div",{className:"panel-title",children:[o.jsx(_a,{size:17}),o.jsx("h2",{children:"Machine detail"})]}),o.jsx("span",{className:`machine-health state-${ma.state}`,children:ma.label})]}),o.jsxs("div",{className:"machine-title",children:[o.jsx("strong",{children:No(we)}),o.jsx("span",{children:ma.role})]}),o.jsx("div",{className:"machine-metric-grid",children:ma.metrics.map(S=>o.jsxs("article",{className:`machine-metric state-${S.state}`,children:[o.jsx("span",{children:S.label}),o.jsx("strong",{children:S.value}),o.jsx("small",{children:S.detail}),S.ratio!==void 0&&o.jsx("i",{children:o.jsx("b",{style:{width:`${Math.round(S.ratio*100)}%`}})})]},S.id))}),o.jsxs("section",{className:"machine-section",children:[o.jsxs("div",{className:"machine-section-title",children:[o.jsx(Rf,{size:15}),o.jsx("span",{children:"Stream"})]}),o.jsxs("dl",{className:"facts compact",children:[o.jsx("dt",{children:"Frames"}),o.jsx("dd",{children:Yo}),o.jsx("dt",{children:Oe?"Control RX":mt?"Atlas RX":"Wall RX"}),o.jsx("dd",{children:ys}),o.jsx("dt",{children:"Painted"}),o.jsx("dd",{children:Vo}),o.jsx("dt",{children:Oe?"Encoded changes":"Visual samples"}),o.jsx("dd",{children:Ar}),o.jsx("dt",{children:"Decoder"}),o.jsx("dd",{children:Ku}),o.jsx("dt",{children:"Decoder IO"}),o.jsx("dd",{children:zi}),o.jsx("dt",{children:"Canvas"}),o.jsx("dd",{children:kr}),o.jsx("dt",{children:"Control buffer"}),o.jsx("dd",{children:Qo}),o.jsx("dt",{children:"Browser RAF"}),o.jsx("dd",{children:dl}),o.jsx("dt",{children:"Latency"}),o.jsx("dd",{children:Gl}),o.jsx("dt",{children:"Cadence"}),o.jsx("dd",{children:Tr}),o.jsx("dt",{children:"Source send"}),o.jsx("dd",{children:Er}),o.jsx("dt",{children:"Packet mix"}),o.jsx("dd",{children:Pl}),o.jsx("dt",{children:"Receive gap"}),o.jsx("dd",{children:Ko}),o.jsx("dt",{children:"Paint gap"}),o.jsx("dd",{children:fl}),o.jsx("dt",{children:"Seq gap"}),o.jsx("dd",{children:Xo}),o.jsx("dt",{children:"Selected"}),o.jsx("dd",{children:xs}),o.jsx("dt",{children:"Requested"}),o.jsx("dd",{children:Xu}),o.jsx("dt",{children:"Mode"}),o.jsx("dd",{children:ps}),o.jsx("dt",{children:"Chunk"}),o.jsx("dd",{children:Wu}),o.jsx("dt",{children:"Size"}),o.jsx("dd",{children:Zu}),o.jsx("dt",{children:"Native"}),o.jsx("dd",{children:Qu}),o.jsx("dt",{children:"Monitor"}),o.jsx("dd",{children:Zo}),o.jsx("dt",{children:"Source"}),o.jsx("dd",{children:Wo}),o.jsx("dt",{children:"Input"}),o.jsx("dd",{children:Dr}),Oe&&o.jsxs(o.Fragment,{children:[o.jsx("dt",{children:"Visual feedback"}),o.jsx("dd",{children:Wn})]})]})]}),o.jsxs("section",{className:"machine-section",children:[o.jsxs("div",{className:"machine-section-title",children:[o.jsx(go,{size:15}),o.jsx("span",{children:"Local services"})]}),o.jsx("div",{className:"tool-probe-list",children:ma.tools.map(S=>o.jsxs("span",{className:`tool-probe state-${S.status}`,children:[o.jsx("b",{children:S.label}),o.jsx("em",{children:S.detail})]},S.id))})]}),o.jsxs("section",{className:"machine-section",children:[o.jsxs("div",{className:"machine-section-title",children:[o.jsx(wu,{size:15}),o.jsx("span",{children:"Workload"})]}),o.jsxs("div",{className:"workload-card",children:[o.jsx("strong",{children:ma.taskLabel}),o.jsx("span",{children:ma.taskStatus}),ma.taskSummary&&o.jsx("p",{children:ma.taskSummary})]})]}),o.jsxs("div",{className:"machine-section",children:[o.jsxs("div",{className:"machine-section-title",children:[o.jsx(Gg,{size:15}),o.jsx("span",{children:"System"})]}),o.jsxs("dl",{className:"facts compact",children:[o.jsx("dt",{children:"Platform"}),o.jsxs("dd",{children:[we.platform||"-"," ",we.arch||""]}),o.jsx("dt",{children:"Release"}),o.jsx("dd",{children:Pn(we.status,"release")||"-"}),o.jsx("dt",{children:"Uptime"}),o.jsx("dd",{children:gy(Dt(we.status,"uptimeSec"))}),o.jsx("dt",{children:"Last seen"}),o.jsx("dd",{children:mm(we.lastSeenAt||we.connectedAt)}),o.jsx("dt",{children:"Agent"}),o.jsx("dd",{children:we.agentVersion||"-"}),o.jsx("dt",{children:"Address"}),o.jsx("dd",{children:we.remoteAddress||"-"})]})]}),qo&&o.jsx("p",{className:"panel-warning",children:qo}),o.jsxs("button",{className:"text-button full",onClick:()=>we&&ul(we.deviceId),disabled:!dr,type:"button",children:[o.jsx(Vg,{size:16}),"Start live"]})]})]})]})]})})]}),Dn&&o.jsxs("aside",{className:`transfer-bar state-${Dn.status}`,"aria-live":"polite",children:[o.jsx("span",{className:"transfer-bar-icon","aria-hidden":"true",children:Dn.status==="queued"?o.jsx(Sa,{size:18}):Dn.status==="failed"?o.jsx(Su,{size:18}):o.jsx(ov,{size:18})}),o.jsxs("div",{className:"transfer-bar-copy",children:[o.jsx("p",{children:Dn.message}),o.jsx("div",{className:"transfer-bar-track",children:o.jsx("span",{style:{width:`${Math.max(0,Math.min(100,Dn.progress))}%`}})})]}),o.jsxs("strong",{children:[Math.max(0,Math.min(100,Dn.progress)),"%"]})]})]})}l0.createRoot(document.getElementById("root")).render(o.jsx(m.StrictMode,{children:o.jsx(nj,{})}));