livedesk 0.1.201 → 0.1.203

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 $b,a as m,K as qb,S as Qg,m as Dm,H as er,U as Gb,N as Rm,F as gy,b as Pb,R as Lu,L as rm,c as Cu,C as Kg,d as Lm,A as Yb,e as Vb,f as xy,M as _a,g as Sa,h as mu,T as Qb,i as Mu,j as bo,X as Ao,k as Kb,l as om,n as Xb,B as Zb,o as hu,p as cm,q as Wb,s as Jb,t as um,u as ew,v as tw,w as nw,x as pu,y as dm,z as gu,D as go,E as fm,G as xo,I as Rf,J as aw,O as Lf,P as lw,Q as iw,V as sw,W as Xg,Y as rw,Z as Zg,_ as Vs,$ as ow,a0 as Wg,a1 as yy,a2 as Jg,a3 as cw}from"./icons-CFo4MnrY.js";import{r as vy}from"./react-DBGbimXz.js";import{c as uw}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 zf={exports:{}},uo={};var ex;function dw(){if(ex)return uo;ex=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 uo.Fragment=l,uo.jsx=s,uo.jsxs=s,uo}var tx;function fw(){return tx||(tx=1,zf.exports=dw()),zf.exports}var o=fw(),_f={exports:{}},fo={},Of={exports:{}},Bf={};var nx;function mw(){return nx||(nx=1,(function(a){function l(I,Z){var ne=I.length;I.push(Z);e:for(;0<ne;){var O=ne-1>>>1,le=I[O];if(0<c(le,Z))I[O]=Z,I[ne]=le,ne=O;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],ne=I.pop();if(ne!==Z){I[0]=ne;e:for(var O=0,le=I.length,me=le>>>1;O<me;){var _=2*(O+1)-1,ge=I[_],be=_+1,Ce=I[be];if(0>c(ge,ne))be<le&&0>c(Ce,ge)?(I[O]=Ce,I[be]=ne,O=be):(I[O]=ge,I[_]=ne,O=_);else if(be<le&&0>c(Ce,ne))I[O]=Ce,I[be]=ne,O=be;else break e}}return Z}function c(I,Z){var ne=I.sortIndex-Z.sortIndex;return ne!==0?ne: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=[],v=1,y=null,w=3,C=!1,j=!1,M=!1,T=!1,k=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 D(I){if(M=!1,q(I),!j)if(s(g)!==null)j=!0,$||($=!0,B());else{var Z=s(x);Z!==null&&fe(D,Z.startTime-I)}}var $=!1,E=-1,ee=5,de=-1;function V(){return T?!0:!(a.unstable_now()-de<ee)}function J(){if(T=!1,$){var I=a.unstable_now();de=I;var Z=!0;try{e:{j=!1,M&&(M=!1,A(E),E=-1),C=!0;var ne=w;try{t:{for(q(I),y=s(g);y!==null&&!(y.expirationTime>I&&V());){var O=y.callback;if(typeof O=="function"){y.callback=null,w=y.priorityLevel;var le=O(y.expirationTime<=I);if(I=a.unstable_now(),typeof le=="function"){y.callback=le,q(I),Z=!0;break t}y===s(g)&&r(g),q(I)}else r(g);y=s(g)}if(y!==null)Z=!0;else{var me=s(x);me!==null&&fe(D,me.startTime-I),Z=!1}}break e}finally{y=null,w=ne,C=!1}Z=void 0}}finally{Z?B():$=!1}}}var B;if(typeof L=="function")B=function(){L(J)};else if(typeof MessageChannel<"u"){var ie=new MessageChannel,K=ie.port2;ie.port1.onmessage=J,B=function(){K.postMessage(null)}}else B=function(){k(J,0)};function fe(I,Z){E=k(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"):ee=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 ne=w;w=Z;try{return I()}finally{w=ne}},a.unstable_requestPaint=function(){T=!0},a.unstable_runWithPriority=function(I,Z){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var ne=w;w=I;try{return Z()}finally{w=ne}},a.unstable_scheduleCallback=function(I,Z,ne){var O=a.unstable_now();switch(typeof ne=="object"&&ne!==null?(ne=ne.delay,ne=typeof ne=="number"&&0<ne?O+ne:O):ne=O,I){case 1:var le=-1;break;case 2:le=250;break;case 5:le=1073741823;break;case 4:le=1e4;break;default:le=5e3}return le=ne+le,I={id:v++,callback:Z,priorityLevel:I,startTime:ne,expirationTime:le,sortIndex:-1},ne>O?(I.sortIndex=ne,l(x,I),s(g)===null&&I===s(x)&&(M?(A(E),E=-1):M=!0,fe(D,ne-O))):(I.sortIndex=le,l(g,I),j||C||(j=!0,$||($=!0,B()))),I},a.unstable_shouldYield=V,a.unstable_wrapCallback=function(I){var Z=w;return function(){var ne=w;w=Z;try{return I.apply(this,arguments)}finally{w=ne}}}})(Bf)),Bf}var ax;function hw(){return ax||(ax=1,Of.exports=mw()),Of.exports}var lx;function pw(){if(lx)return fo;lx=1;var a=hw(),l=$b(),s=vy();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 v(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=v(e),t!==null)return t;e=e.sibling}return null}var y=Object.assign,w=Symbol.for("react.element"),C=Symbol.for("react.transitional.element"),j=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),L=Symbol.for("react.context"),q=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),$=Symbol.for("react.suspense_list"),E=Symbol.for("react.memo"),ee=Symbol.for("react.lazy"),de=Symbol.for("react.activity"),V=Symbol.for("react.memo_cache_sentinel"),J=Symbol.iterator;function B(e){return e===null||typeof e!="object"?null:(e=J&&e[J]||e["@@iterator"],typeof e=="function"?e:null)}var ie=Symbol.for("react.client.reference");function K(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ie?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case M:return"Fragment";case k:return"Profiler";case T:return"StrictMode";case D:return"Suspense";case $:return"SuspenseList";case de:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case j: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:K(e.type)||"Memo";case ee:t=e._payload,e=e._init;try{return K(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,ne={pending:!1,data:null,method:null,action:null},O=[],le=-1;function me(e){return{current:e}}function _(e){0>le||(e.current=O[le],O[le]=null,le--)}function ge(e,t){le++,O[le]=e.current,e.current=t}var be=me(null),Ce=me(null),Ie=me(null),Ve=me(null);function Le(e,t){switch(ge(Ie,t),ge(Ce,e),ge(be,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?xg(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=xg(t),e=yg(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}_(be),ge(be,e)}function Ee(){_(be),_(Ce),_(Ie)}function qe(e){e.memoizedState!==null&&ge(Ve,e);var t=be.current,n=yg(t,e.type);t!==n&&(ge(Ce,e),ge(be,n))}function Te(e){Ce.current===e&&(_(be),_(Ce)),Ve.current===e&&(_(Ve),so._currentValue=ne)}var gt,re;function ye(e){if(gt===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);gt=t&&t[1]||"",re=-1<n.stack.indexOf(`
2
+ at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
3
+ `+gt+e+re}var ke=!1;function De(e,t){if(!e||ke)return"";ke=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(t){var ue=function(){throw Error()};if(Object.defineProperty(ue.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ue,[])}catch(te){var W=te}Reflect.construct(e,[],ue)}else{try{ue.call()}catch(te){W=te}e.call(ue.prototype)}}else{try{throw Error()}catch(te){W=te}(ue=e())&&typeof ue.catch=="function"&&ue.catch(function(){})}}catch(te){if(te&&W&&typeof te.stack=="string")return[te.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 z=b.split(`
4
+ `),X=N.split(`
5
+ `);for(u=i=0;i<z.length&&!z[i].includes("DetermineComponentFrameRoot");)i++;for(;u<X.length&&!X[u].includes("DetermineComponentFrameRoot");)u++;if(i===z.length||u===X.length)for(i=z.length-1,u=X.length-1;1<=i&&0<=u&&z[i]!==X[u];)u--;for(;1<=i&&0<=u;i--,u--)if(z[i]!==X[u]){if(i!==1||u!==1)do if(i--,u--,0>u||z[i]!==X[u]){var se=`
6
+ `+z[i].replace(" at new "," at ");return e.displayName&&se.includes("<anonymous>")&&(se=se.replace("<anonymous>",e.displayName)),se}while(1<=i&&0<=u);break}}}finally{ke=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?ye(n):""}function oe(e,t){switch(e.tag){case 26:case 27:case 5:return ye(e.type);case 16:return ye("Lazy");case 13:return e.child!==t&&t!==null?ye("Suspense Fallback"):ye("Suspense");case 19:return ye("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 ye("Activity");default:return""}}function et(e){try{var t="",n=null;do t+=oe(e,n),n=e,e=e.return;while(e);return t}catch(i){return`
7
+ Error generating stack: `+i.message+`
8
+ `+i.stack}}var Me=Object.prototype.hasOwnProperty,Ft=a.unstable_scheduleCallback,Rt=a.unstable_cancelCallback,xe=a.unstable_shouldYield,He=a.unstable_requestPaint,ze=a.unstable_now,lt=a.unstable_getCurrentPriorityLevel,Cn=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,sr=Math.LN2;function Wi(e){return e>>>=0,e===0?32:31-(Rl(e)/sr|0)|0}var Ha=256,sa=262144,pn=4194304;function kn(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 Tn(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=kn(i):(b&=N,b!==0?u=kn(b):n||(n=N&~e,n!==0&&(u=kn(n))))):(N=i&~f,N!==0?u=kn(N):b!==0?u=kn(b):n||(n=i&~e,n!==0&&(u=kn(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,z=e.expirationTimes,X=e.hiddenUpdates;for(n=b&~n;0<n;){var se=31-Ot(n),ue=1<<se;N[se]=0,z[se]=-1;var W=X[se];if(W!==null)for(X[se]=null,se=0;se<W.length;se++){var te=W[se];te!==null&&(te.lane&=-536870913)}n&=~ue}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:Ug(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),P="__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[P],delete e[he],delete e[$e],delete e[dt],delete e[ft]}function Ut(e){var t=e[P];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Se]||n[P]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=jg(e);e!==null;){if(n=e[P])return n;e=jg(e)}return t}e=n,n=e.parentNode}return null}function Jt(e){if(e=e[P]||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 Ct(e){e[st]=!0}var il=new Set,ka={};function qt(e,t){kt(e,t),kt(e+"Capture",t)}function kt(e,t){for(ka[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]*$"),Ta={},zl={};function _o(e){return Me.call(zl,e)?!0:Me.call(Ta,e)?!1:ca.test(e)?zl[e]=!0:(Ta[e]=!0,!1)}function Ia(e,t,n){if(_o(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 rr(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=rr(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 Ci(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 $u=/[\n"\\]/g;function Tt(e){return e.replace($u,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"&&Ci(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 or(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 Oo=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||Oo.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function cr(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 ur(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"]]),qu=/^[\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 qu.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="'+Tt(""+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 dr=!1;function fr(e,t,n){if(dr)return e(t,n);dr=!0;try{var i=e(t);return i}finally{if(dr=!1,(Bl!==null||St!==null)&&(Rc(),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,Fa=null,ns=null;function xn(){if(ns)return ns;var e,t=Fa,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 Mi(){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:Mi,this.isPropagationStopped=Mi,this}return y(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),Il=y({},Ua,{view:0,detail:0}),Bo=Kt(Il),mr,$a,ji,Ni=y({},Il,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:xr,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"?(mr=e.screenX-ji.screenX,$a=e.screenY-ji.screenY):$a=mr=0,ji=e),mr)},movementY:function(e){return"movementY"in e?e.movementY:$a}}),Ho=Kt(Ni),Gu=y({},Ni,{dataTransfer:0}),Pu=Kt(Gu),Io=y({},Il,{relatedTarget:0}),ol=Kt(Io),qa=y({},Ua,{animationName:0,elapsedTime:0,pseudoElement:0}),is=Kt(qa),Fl=y({},Ua,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),cl=Kt(Fl),hr=y({},Ua,{data:0}),Fo=Kt(hr),Uo={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},pr={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"},gr={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function $o(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=gr[e])?!!t[e]:!1}function xr(){return $o}var ss=y({},Il,{key:function(e){if(e.key){var t=Uo[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"?pr[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:xr,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),yr=y({},Ni,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),os=Kt(yr),cs=y({},Il,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:xr}),us=Kt(cs),Ai=y({},Ua,{propertyName:0,elapsedTime:0,pseudoElement:0}),ga=Kt(Ai),qo=y({},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}),Go=Kt(qo),vr=y({},Ua,{newState:0,oldState:0}),ds=Kt(vr),Yu=[9,13,27,32],Ga=ha&&"CompositionEvent"in window,ki=null;ha&&"documentMode"in document&&(ki=document.documentMode);var Ul=ha&&"TextEvent"in window&&!ki,br=ha&&(!Ga||ki&&8<ki&&11>=ki),wr=" ",$l=!1;function Sr(e,t){switch(e){case"keyup":return Yu.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 Vu(e,t){switch(e){case"compositionend":return fs(t);case"keypress":return t.which!==32?null:($l=!0,wr);case"textInput":return e=t.data,e===wr&&$l?null:e;default:return null}}function Cr(e,t){if(ul)return e==="compositionend"||!Ga&&Sr(e,t)?(e=xn(),ns=Fa=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 br&&t.locale!=="ko"?null:t.data;default:return null}}var Qu={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"?!!Qu[e.type]:t==="textarea"}function jr(e,t,n,i){Bl?St?St.push(i):St=[i]:Bl=i,t=Ic(t,"onChange"),0<t.length&&(n=new Ea("onChange","change",null,n,i),e.push({event:n,listeners:t}))}var ql=null,Ti=null;function ms(e){dg(e,0)}function Zn(e){var t=wt(e);if(We(t))return e}function Ei(e,t){if(e==="change")return t}var Po=!1;if(ha){var Di;if(ha){var Ri="oninput"in document;if(!Ri){var ve=document.createElement("div");ve.setAttribute("oninput","return;"),Ri=typeof ve.oninput=="function"}Di=Ri}else Di=!1;Po=Di&&(!document.documentMode||9<document.documentMode)}function Li(){ql&&(ql.detachEvent("onpropertychange",Nr),Ti=ql=null)}function Nr(e){if(e.propertyName==="value"&&Zn(Ti)){var t=[];jr(t,Ti,e,ts(e)),fr(ms,t)}}function Ku(e,t,n){e==="focusin"?(Li(),ql=t,Ti=n,ql.attachEvent("onpropertychange",Nr)):e==="focusout"&&Li()}function Jm(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Zn(Ti)}function Ar(e,t){if(e==="click")return Zn(t)}function Xu(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(!Me.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 Yo(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 Vo(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Vo(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Qo(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ci(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=Ci(e.document)}return t}function kr(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 Zu=ha&&"documentMode"in document&&11>=document.documentMode,Gl=null,Tr=null,zi=null,Er=!1;function Ko(e,t,n){var i=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Er||Gl==null||Gl!==Ci(i)||(i=Gl,"selectionStart"in i&&kr(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=Ic(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")},Dr={},Xo={};ha&&(Xo=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(Dr[e])return Dr[e];if(!Pl[e])return e;var t=Pl[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Xo)return Dr[e]=t[n];return e}var Zo=fl("animationend"),ps=fl("animationiteration"),gs=fl("animationstart"),Wu=fl("transitionrun"),Ju=fl("transitionstart"),ed=fl("transitioncancel"),Wo=fl("transitionend"),Jo=new Map,Rr="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(" ");Rr.push("scrollEnd");function Wn(e,t){Jo.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 ys(){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&&ec(n,u,f)}}function vs(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 vs(e,t,n,i),ws(e)}function xa(e,t){return vs(e,null,null,t),ws(e)}function ec(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<Jr)throw Jr=0,tf=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 yn(e,t,n,i){return new Ss(e,t,n,i)}function Lr(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Pa(e,t){var n=e.alternate;return n===null?(n=yn(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 tc(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 Cs(e,t,n,i,u,f){var b=0;if(i=e,typeof e=="function")Lr(e)&&(b=1);else if(typeof e=="string")b=Eb(e,n,be.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case de:return e=yn(31,n,t,u),e.elementType=de,e.lanes=f,e;case M:return Ya(n.children,u,f,t);case T:b=8,u|=24;break;case k:return e=yn(12,n,t,u|2),e.elementType=k,e.lanes=f,e;case D:return e=yn(13,n,t,u),e.elementType=D,e.lanes=f,e;case $:return e=yn(19,n,t,u),e.elementType=$,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 ee:b=16,i=null;break e}b=29,n=Error(r(130,e===null?"null":typeof e,"")),i=null}return t=yn(b,n,t,u),t.elementType=e,t.type=i,t.lanes=f,t}function Ya(e,t,n,i){return e=yn(7,e,i,t),e.lanes=n,e}function Yl(e,t,n){return e=yn(6,e,null,t),e.lanes=n,e}function Vl(e){var t=yn(18,null,null,0);return t.stateNode=e,t}function Ms(e,t,n){return t=yn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var nc=new WeakMap;function _n(e,t){if(typeof e=="object"&&e!==null){var n=nc.get(e);return n!==void 0?n:(t={value:e,source:t,stack:et(t)},nc.set(e,t),t)}return{value:e,source:t,stack:et(t)}}var Ql=[],Kl=0,js=null,Oi=0,On=[],Mt=0,Va=null,ya=1,sn="";function Da(e,t){Ql[Kl++]=Oi,Ql[Kl++]=js,js=e,Oi=t}function ac(e,t,n){On[Mt++]=ya,On[Mt++]=sn,On[Mt++]=Va,Va=e;var i=ya;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,ya=1<<32-Ot(t)+u|n<<u|i,sn=f+e}else ya=1<<f|n<<u|i,sn=e}function S(e){e.return!==null&&(Da(e,1),ac(e,1,0))}function R(e){for(;e===js;)js=Ql[--Kl],Ql[Kl]=null,Oi=Ql[--Kl],Ql[Kl]=null;for(;e===Va;)Va=On[--Mt],On[Mt]=null,sn=On[--Mt],On[Mt]=null,ya=On[--Mt],On[Mt]=null}function Y(e,t){On[Mt++]=ya,On[Mt++]=sn,On[Mt++]=Va,ya=t.id,sn=t.overflow,Va=e}var F=null,U=null,ae=!1,pe=null,je=!1,Je=Error(r(519));function Fe(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[P]=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<to.length;n++)Ke(to[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),or(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||pg(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||Fe(e,!0)}function rn(e){for(F=e.return;F;)switch(F.tag){case 5:case 31:case 13:je=!1;return;case 27:case 3:je=!0;return;default:F=F.return}}function Mn(e){if(e!==F)return!1;if(!ae)return rn(e),ae=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||xf(e.type,e.memoizedProps)),n=!n),n&&U&&Fe(e),rn(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));U=Mg(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));U=Mg(e)}else t===27?(t=U,ui(e.type)?(e=Sf,Sf=null,U=e):U=t):U=F?ba(e.stateNode.nextSibling):null;return!0}function on(){U=F=null,ae=!1}function hl(){var e=pe;return e!==null&&(Fn===null?Fn=e:Fn.push.apply(Fn,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,_(Xl)}function td(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 nd(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 z=0;z<t.length;z++)if(N.context===t[z]){f.lanes|=n,N=f.alternate,N!==null&&(N.lanes|=n),td(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),td(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(so):e=[so])}u=u.return}e!==null&&nd(t,e,n,i),t.flags|=262144}function lc(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 eh(pl,e)}function ic(e,t){return pl===null&&Bi(e),eh(e,t)}function eh(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 Nv=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()})}},Av=a.unstable_scheduleCallback,kv=a.unstable_NormalPriority,Gt={$$typeof:L,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ad(){return{controller:new Nv,data:new Map,refCount:0}}function zr(e){e.refCount--,e.refCount===0&&Av(kv,function(){e.controller.abort()})}var _r=null,ld=0,As=0,ks=null;function Tv(e,t){if(_r===null){var n=_r=[];ld=0,As=of(),ks={status:"pending",value:void 0,then:function(i){n.push(i)}}}return ld++,t.then(th,th),t}function th(){if(--ld===0&&_r!==null){ks!==null&&(ks.status="fulfilled");var e=_r;_r=null,As=0,ks=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Ev(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 nh=I.S;I.S=function(e,t){Ip=ze(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&Tv(e,t),nh!==null&&nh(e,t)};var Hi=me(null);function id(){var e=Hi.current;return e!==null?e:bt.pooledCache}function sc(e,t){t===null?ge(Hi,Hi.current):ge(Hi,t.pool)}function ah(){var e=id();return e===null?null:{parent:Gt._currentValue,pool:e}}var Ts=Error(r(460)),sd=Error(r(474)),rc=Error(r(542)),oc={then:function(){}};function lh(e){return e=e.status,e==="fulfilled"||e==="rejected"}function ih(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,rh(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,rh(e),e}throw Fi=t,Ts}}function Ii(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Fi=n,Ts):n}}var Fi=null;function sh(){if(Fi===null)throw Error(r(459));var e=Fi;return Fi=null,e}function rh(e){if(e===Ts||e===rc)throw Error(r(483))}var Es=null,Or=0;function cc(e){var t=Or;return Or+=1,Es===null&&(Es=[]),ih(Es,e,t)}function Br(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function uc(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 oh(e){function t(G,H){if(e){var Q=G.deletions;Q===null?(G.deletions=[H],G.flags|=16):Q.push(H)}}function n(G,H){if(!e)return null;for(;H!==null;)t(G,H),H=H.sibling;return null}function i(G){for(var H=new Map;G!==null;)G.key!==null?H.set(G.key,G):H.set(G.index,G),G=G.sibling;return H}function u(G,H){return G=Pa(G,H),G.index=0,G.sibling=null,G}function f(G,H,Q){return G.index=Q,e?(Q=G.alternate,Q!==null?(Q=Q.index,Q<H?(G.flags|=67108866,H):Q):(G.flags|=67108866,H)):(G.flags|=1048576,H)}function b(G){return e&&G.alternate===null&&(G.flags|=67108866),G}function N(G,H,Q,ce){return H===null||H.tag!==6?(H=Yl(Q,G.mode,ce),H.return=G,H):(H=u(H,Q),H.return=G,H)}function z(G,H,Q,ce){var Re=Q.type;return Re===M?se(G,H,Q.props.children,ce,Q.key):H!==null&&(H.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===ee&&Ii(Re)===H.type)?(H=u(H,Q.props),Br(H,Q),H.return=G,H):(H=Cs(Q.type,Q.key,Q.props,null,G.mode,ce),Br(H,Q),H.return=G,H)}function X(G,H,Q,ce){return H===null||H.tag!==4||H.stateNode.containerInfo!==Q.containerInfo||H.stateNode.implementation!==Q.implementation?(H=Ms(Q,G.mode,ce),H.return=G,H):(H=u(H,Q.children||[]),H.return=G,H)}function se(G,H,Q,ce,Re){return H===null||H.tag!==7?(H=Ya(Q,G.mode,ce,Re),H.return=G,H):(H=u(H,Q),H.return=G,H)}function ue(G,H,Q){if(typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint")return H=Yl(""+H,G.mode,Q),H.return=G,H;if(typeof H=="object"&&H!==null){switch(H.$$typeof){case C:return Q=Cs(H.type,H.key,H.props,null,G.mode,Q),Br(Q,H),Q.return=G,Q;case j:return H=Ms(H,G.mode,Q),H.return=G,H;case ee:return H=Ii(H),ue(G,H,Q)}if(fe(H)||B(H))return H=Ya(H,G.mode,Q,null),H.return=G,H;if(typeof H.then=="function")return ue(G,cc(H),Q);if(H.$$typeof===L)return ue(G,ic(G,H),Q);uc(G,H)}return null}function W(G,H,Q,ce){var Re=H!==null?H.key:null;if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return Re!==null?null:N(G,H,""+Q,ce);if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case C:return Q.key===Re?z(G,H,Q,ce):null;case j:return Q.key===Re?X(G,H,Q,ce):null;case ee:return Q=Ii(Q),W(G,H,Q,ce)}if(fe(Q)||B(Q))return Re!==null?null:se(G,H,Q,ce,null);if(typeof Q.then=="function")return W(G,H,cc(Q),ce);if(Q.$$typeof===L)return W(G,H,ic(G,Q),ce);uc(G,Q)}return null}function te(G,H,Q,ce,Re){if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return G=G.get(Q)||null,N(H,G,""+ce,Re);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case C:return G=G.get(ce.key===null?Q:ce.key)||null,z(H,G,ce,Re);case j:return G=G.get(ce.key===null?Q:ce.key)||null,X(H,G,ce,Re);case ee:return ce=Ii(ce),te(G,H,Q,ce,Re)}if(fe(ce)||B(ce))return G=G.get(Q)||null,se(H,G,ce,Re,null);if(typeof ce.then=="function")return te(G,H,Q,cc(ce),Re);if(ce.$$typeof===L)return te(G,H,Q,ic(H,ce),Re);uc(H,ce)}return null}function Ne(G,H,Q,ce){for(var Re=null,nt=null,Ae=H,Pe=H=0,Ze=null;Ae!==null&&Pe<Q.length;Pe++){Ae.index>Pe?(Ze=Ae,Ae=null):Ze=Ae.sibling;var at=W(G,Ae,Q[Pe],ce);if(at===null){Ae===null&&(Ae=Ze);break}e&&Ae&&at.alternate===null&&t(G,Ae),H=f(at,H,Pe),nt===null?Re=at:nt.sibling=at,nt=at,Ae=Ze}if(Pe===Q.length)return n(G,Ae),ae&&Da(G,Pe),Re;if(Ae===null){for(;Pe<Q.length;Pe++)Ae=ue(G,Q[Pe],ce),Ae!==null&&(H=f(Ae,H,Pe),nt===null?Re=Ae:nt.sibling=Ae,nt=Ae);return ae&&Da(G,Pe),Re}for(Ae=i(Ae);Pe<Q.length;Pe++)Ze=te(Ae,G,Pe,Q[Pe],ce),Ze!==null&&(e&&Ze.alternate!==null&&Ae.delete(Ze.key===null?Pe:Ze.key),H=f(Ze,H,Pe),nt===null?Re=Ze:nt.sibling=Ze,nt=Ze);return e&&Ae.forEach(function(pi){return t(G,pi)}),ae&&Da(G,Pe),Re}function Be(G,H,Q,ce){if(Q==null)throw Error(r(151));for(var Re=null,nt=null,Ae=H,Pe=H=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(G,Ae,at.value,ce);if(pi===null){Ae===null&&(Ae=Ze);break}e&&Ae&&pi.alternate===null&&t(G,Ae),H=f(pi,H,Pe),nt===null?Re=pi:nt.sibling=pi,nt=pi,Ae=Ze}if(at.done)return n(G,Ae),ae&&Da(G,Pe),Re;if(Ae===null){for(;!at.done;Pe++,at=Q.next())at=ue(G,at.value,ce),at!==null&&(H=f(at,H,Pe),nt===null?Re=at:nt.sibling=at,nt=at);return ae&&Da(G,Pe),Re}for(Ae=i(Ae);!at.done;Pe++,at=Q.next())at=te(Ae,G,Pe,at.value,ce),at!==null&&(e&&at.alternate!==null&&Ae.delete(at.key===null?Pe:at.key),H=f(at,H,Pe),nt===null?Re=at:nt.sibling=at,nt=at);return e&&Ae.forEach(function(Ub){return t(G,Ub)}),ae&&Da(G,Pe),Re}function vt(G,H,Q,ce){if(typeof Q=="object"&&Q!==null&&Q.type===M&&Q.key===null&&(Q=Q.props.children),typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case C:e:{for(var Re=Q.key;H!==null;){if(H.key===Re){if(Re=Q.type,Re===M){if(H.tag===7){n(G,H.sibling),ce=u(H,Q.props.children),ce.return=G,G=ce;break e}}else if(H.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===ee&&Ii(Re)===H.type){n(G,H.sibling),ce=u(H,Q.props),Br(ce,Q),ce.return=G,G=ce;break e}n(G,H);break}else t(G,H);H=H.sibling}Q.type===M?(ce=Ya(Q.props.children,G.mode,ce,Q.key),ce.return=G,G=ce):(ce=Cs(Q.type,Q.key,Q.props,null,G.mode,ce),Br(ce,Q),ce.return=G,G=ce)}return b(G);case j:e:{for(Re=Q.key;H!==null;){if(H.key===Re)if(H.tag===4&&H.stateNode.containerInfo===Q.containerInfo&&H.stateNode.implementation===Q.implementation){n(G,H.sibling),ce=u(H,Q.children||[]),ce.return=G,G=ce;break e}else{n(G,H);break}else t(G,H);H=H.sibling}ce=Ms(Q,G.mode,ce),ce.return=G,G=ce}return b(G);case ee:return Q=Ii(Q),vt(G,H,Q,ce)}if(fe(Q))return Ne(G,H,Q,ce);if(B(Q)){if(Re=B(Q),typeof Re!="function")throw Error(r(150));return Q=Re.call(Q),Be(G,H,Q,ce)}if(typeof Q.then=="function")return vt(G,H,cc(Q),ce);if(Q.$$typeof===L)return vt(G,H,ic(G,Q),ce);uc(G,Q)}return typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint"?(Q=""+Q,H!==null&&H.tag===6?(n(G,H.sibling),ce=u(H,Q),ce.return=G,G=ce):(n(G,H),ce=Yl(Q,G.mode,ce),ce.return=G,G=ce),b(G)):n(G,H)}return function(G,H,Q,ce){try{Or=0;var Re=vt(G,H,Q,ce);return Es=null,Re}catch(Ae){if(Ae===Ts||Ae===rc)throw Ae;var nt=yn(29,Ae,null,G.mode);return nt.lanes=ce,nt.return=G,nt}}}var Ui=oh(!0),ch=oh(!1),Wl=!1;function rd(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function od(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),ec(e,null,n),t}return vs(e,i,t,n),ws(e)}function Hr(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 cd(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 ud=!1;function Ir(){if(ud){var e=ks;if(e!==null)throw e}}function Fr(e,t,n,i){ud=!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 z=N,X=z.next;z.next=null,b===null?f=X:b.next=X,b=z;var se=e.alternate;se!==null&&(se=se.updateQueue,N=se.lastBaseUpdate,N!==b&&(N===null?se.firstBaseUpdate=X:N.next=X,se.lastBaseUpdate=z))}if(f!==null){var ue=u.baseState;b=0,se=X=z=null,N=f;do{var W=N.lane&-536870913,te=W!==N.lane;if(te?(Xe&W)===W:(i&W)===W){W!==0&&W===As&&(ud=!0),se!==null&&(se=se.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var Ne=e,Be=N;W=t;var vt=n;switch(Be.tag){case 1:if(Ne=Be.payload,typeof Ne=="function"){ue=Ne.call(vt,ue,W);break e}ue=Ne;break e;case 3:Ne.flags=Ne.flags&-65537|128;case 0:if(Ne=Be.payload,W=typeof Ne=="function"?Ne.call(vt,ue,W):Ne,W==null)break e;ue=y({},ue,W);break e;case 2:Wl=!0}}W=N.callback,W!==null&&(e.flags|=64,te&&(e.flags|=8192),te=u.callbacks,te===null?u.callbacks=[W]:te.push(W))}else te={lane:W,tag:N.tag,payload:N.payload,callback:N.callback,next:null},se===null?(X=se=te,z=ue):se=se.next=te,b|=W;if(N=N.next,N===null){if(N=u.shared.pending,N===null)break;te=N,N=te.next,te.next=null,u.lastBaseUpdate=te,u.shared.pending=null}}while(!0);se===null&&(z=ue),u.baseState=z,u.firstBaseUpdate=X,u.lastBaseUpdate=se,f===null&&(u.shared.lanes=0),ii|=b,e.lanes=b,e.memoizedState=ue}}function uh(e,t){if(typeof e!="function")throw Error(r(191,e));e.call(t)}function dh(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)uh(n[e],t)}var Ds=me(null),dc=me(0);function fh(e,t){e=Nl,ge(dc,e),ge(Ds,t),Nl=e|t.baseLanes}function dd(){ge(dc,Nl),ge(Ds,Ds.current)}function fd(){Nl=dc.current,_(Ds),_(dc)}var Jn=me(null),va=null;function ti(e){var t=e.alternate;ge(Bt,Bt.current&1),ge(Jn,e),va===null&&(t===null||Ds.current!==null||t.memoizedState!==null)&&(va=e)}function md(e){ge(Bt,Bt.current),ge(Jn,e),va===null&&(va=e)}function mh(e){e.tag===22?(ge(Bt,Bt.current),ge(Jn,e),va===null&&(va=e)):ni()}function ni(){ge(Bt,Bt.current),ge(Jn,Jn.current)}function ea(e){_(Jn),va===e&&(va=null),_(Bt)}var Bt=me(0);function fc(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||bf(n)||wf(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 yl=0,Ge=null,xt=null,Pt=null,mc=!1,Rs=!1,$i=!1,hc=0,Ur=0,Ls=null,Dv=0;function zt(){throw Error(r(321))}function hd(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 pd(e,t,n,i,u,f){return yl=f,Ge=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,I.H=e===null||e.memoizedState===null?Xh:Ed,$i=!1,f=n(i,u),$i=!1,Rs&&(f=ph(t,n,i,u)),hh(e),f}function hh(e){I.H=Gr;var t=xt!==null&&xt.next!==null;if(yl=0,Pt=xt=Ge=null,mc=!1,Ur=0,Ls=null,t)throw Error(r(300));e===null||Yt||(e=e.dependencies,e!==null&&lc(e)&&(Yt=!0))}function ph(e,t,n,i){Ge=e;var u=0;do{if(Rs&&(Ls=null),Ur=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=Zh,f=t(n,i)}while(Rs);return f}function Rv(){var e=I.H,t=e.useState()[0];return t=typeof t.then=="function"?$r(t):t,e=e.useState()[0],(xt!==null?xt.memoizedState:null)!==e&&(Ge.flags|=1024),t}function gd(){var e=hc!==0;return hc=0,e}function xd(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function yd(e){if(mc){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}mc=!1}yl=0,Pt=xt=Ge=null,Rs=!1,Ur=hc=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 pc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function $r(e){var t=Ur;return Ur+=1,Ls===null&&(Ls=[]),e=ih(Ls,e,t),t=Ge,(Pt===null?t.memoizedState:Pt.next)===null&&(t=t.alternate,I.H=t===null||t.memoizedState===null?Xh:Ed),e}function gc(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return $r(e);if(e.$$typeof===L)return cn(e)}throw Error(r(438,String(e)))}function vd(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=pc(),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]=V;return t.index++,n}function vl(e,t){return typeof t=="function"?t(e):t}function xc(e){var t=Ht();return bd(t,xt,e)}function bd(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,z=null,X=t,se=!1;do{var ue=X.lane&-536870913;if(ue!==X.lane?(Xe&ue)===ue:(yl&ue)===ue){var W=X.revertLane;if(W===0)z!==null&&(z=z.next={lane:0,revertLane:0,gesture:null,action:X.action,hasEagerState:X.hasEagerState,eagerState:X.eagerState,next:null}),ue===As&&(se=!0);else if((yl&W)===W){X=X.next,W===As&&(se=!0);continue}else ue={lane:0,revertLane:X.revertLane,gesture:null,action:X.action,hasEagerState:X.hasEagerState,eagerState:X.eagerState,next:null},z===null?(N=z=ue,b=f):z=z.next=ue,Ge.lanes|=W,ii|=W;ue=X.action,$i&&n(f,ue),f=X.hasEagerState?X.eagerState:n(f,ue)}else W={lane:ue,revertLane:X.revertLane,gesture:X.gesture,action:X.action,hasEagerState:X.hasEagerState,eagerState:X.eagerState,next:null},z===null?(N=z=W,b=f):z=z.next=W,Ge.lanes|=ue,ii|=ue;X=X.next}while(X!==null&&X!==t);if(z===null?b=f:z.next=N,!rt(f,e.memoizedState)&&(Yt=!0,se&&(n=ks,n!==null)))throw n;e.memoizedState=f,e.baseState=b,e.baseQueue=z,i.lastRenderedState=f}return u===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function wd(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 gh(e,t,n){var i=Ge,u=Ht(),f=ae;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,Md(vh.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},yh.bind(null,i,u,n,t),null),bt===null)throw Error(r(349));f||(yl&127)!==0||xh(i,t,n)}return n}function xh(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Ge.updateQueue,t===null?(t=pc(),Ge.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function yh(e,t,n,i){t.value=n,t.getSnapshot=i,bh(t)&&wh(e)}function vh(e,t,n){return n(function(){bh(t)&&wh(e)})}function bh(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!rt(e,n)}catch{return!0}}function wh(e){var t=xa(e,2);t!==null&&Un(t,e,2)}function Sd(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:vl,lastRenderedState:e},t}function Sh(e,t,n,i){return e.baseState=n,bd(e,xt,typeof i=="function"?i:vl)}function Lv(e,t,n,i,u){if(bc(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,Ch(t,f)):(f.next=n.next,t.pending=n.next=f)}}function Ch(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),z=I.S;z!==null&&z(b,N),Mh(e,t,N)}catch(X){Cd(e,t,X)}finally{f!==null&&b.types!==null&&(f.types=b.types),I.T=f}}else try{f=n(u,i),Mh(e,t,f)}catch(X){Cd(e,t,X)}}function Mh(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(i){jh(e,t,i)},function(i){return Cd(e,t,i)}):jh(e,t,n)}function jh(e,t,n){t.status="fulfilled",t.value=n,Nh(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Ch(e,n)))}function Cd(e,t,n){var i=e.pending;if(e.pending=null,i!==null){i=i.next;do t.status="rejected",t.reason=n,Nh(t),t=t.next;while(t!==i)}e.action=null}function Nh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Ah(e,t){return t}function kh(e,t){if(ae){var n=bt.formState;if(n!==null){e:{var i=Ge;if(ae){if(U){t:{for(var u=U,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){U=ba(u.nextSibling),i=u.data==="F!";break e}}Fe(i)}i=!1}i&&(t=n[0])}}return n=jn(),n.memoizedState=n.baseState=t,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ah,lastRenderedState:t},n.queue=i,n=Vh.bind(null,Ge,i),i.dispatch=n,i=Sd(!1),f=Td.bind(null,Ge,!1,i.queue),i=jn(),u={state:t,dispatch:null,action:e,pending:null},i.queue=u,n=Lv.bind(null,Ge,u,f,n),u.dispatch=n,i.memoizedState=e,[t,n,!1]}function Th(e){var t=Ht();return Eh(t,xt,e)}function Eh(e,t,n){if(t=bd(e,t,Ah)[0],e=xc(vl)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var i=$r(t)}catch(b){throw b===Ts?rc: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},zv.bind(null,u,n),null)),[i,f,e]}function zv(e,t){e.action=t}function Dh(e){var t=Ht(),n=xt;if(n!==null)return Eh(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=pc(),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 Rh(){return Ht().memoizedState}function yc(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&&hd(i,xt.memoizedState.deps)?u.memoizedState=zs(t,f,n,i):(Ge.flags|=e,u.memoizedState=zs(1|t,f,n,i))}function Lh(e,t){yc(8390656,8,e,t)}function Md(e,t){vc(2048,8,e,t)}function _v(e){Ge.flags|=4;var t=Ge.updateQueue;if(t===null)t=pc(),Ge.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function zh(e){var t=Ht().memoizedState;return _v({ref:t,nextImpl:e}),function(){if((ot&2)!==0)throw Error(r(440));return t.impl.apply(void 0,arguments)}}function _h(e,t){return vc(4,2,e,t)}function Oh(e,t){return vc(4,4,e,t)}function Bh(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 Hh(e,t,n){n=n!=null?n.concat([e]):null,vc(4,4,Bh.bind(null,t,e),n)}function jd(){}function Ih(e,t){var n=Ht();t=t===void 0?null:t;var i=n.memoizedState;return t!==null&&hd(t,i[1])?i[0]:(n.memoizedState=[e,t],e)}function Fh(e,t){var n=Ht();t=t===void 0?null:t;var i=n.memoizedState;if(t!==null&&hd(t,i[1]))return i[0];if(i=e(),$i){hn(!0);try{e()}finally{hn(!1)}}return n.memoizedState=[i,t],i}function Nd(e,t,n){return n===void 0||(yl&1073741824)!==0&&(Xe&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=Up(),Ge.lanes|=e,ii|=e,n)}function Uh(e,t,n,i){return rt(n,t)?n:Ds.current!==null?(e=Nd(e,n,i),rt(e,t)||(Yt=!0),e):(yl&42)===0||(yl&1073741824)!==0&&(Xe&261930)===0?(Yt=!0,e.memoizedState=n):(e=Up(),Ge.lanes|=e,ii|=e,t)}function $h(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,Td(e,!1,t,n);try{var z=u(),X=I.S;if(X!==null&&X(N,z),z!==null&&typeof z=="object"&&typeof z.then=="function"){var se=Ev(z,i);qr(e,t,se,aa(e))}else qr(e,t,i,aa(e))}catch(ue){qr(e,t,{then:function(){},status:"rejected",reason:ue},aa())}finally{Z.p=f,b!==null&&N.types!==null&&(b.types=N.types),I.T=b}}function Ov(){}function Ad(e,t,n,i){if(e.tag!==5)throw Error(r(476));var u=qh(e).queue;$h(e,u,t,ne,n===null?Ov:function(){return Gh(e),n(i)})}function qh(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ne,baseState:ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:vl,lastRenderedState:ne},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:vl,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Gh(e){var t=qh(e);t.next===null&&(t=e.alternate.memoizedState),qr(e,t.next.queue,{},aa())}function kd(){return cn(so)}function Ph(){return Ht().memoizedState}function Yh(){return Ht().memoizedState}function Bv(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),Hr(i,t,n)),t={cache:ad()},e.payload=t;return}t=t.return}}function Hv(e,t,n){var i=aa();n={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},bc(e)?Qh(t,n):(n=bs(e,t,n,i),n!==null&&(Un(n,e,i),Kh(n,t,i)))}function Vh(e,t,n){var i=aa();qr(e,t,n,i)}function qr(e,t,n,i){var u={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(bc(e))Qh(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 vs(e,t,u,0),bt===null&&ys(),!1}catch{}if(n=bs(e,t,u,i),n!==null)return Un(n,e,i),Kh(n,t,i),!0}return!1}function Td(e,t,n,i){if(i={lane:2,revertLane:of(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},bc(e)){if(t)throw Error(r(479))}else t=bs(e,n,i,2),t!==null&&Un(t,e,2)}function bc(e){var t=e.alternate;return e===Ge||t!==null&&t===Ge}function Qh(e,t){Rs=mc=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Kh(e,t,n){if((n&4194048)!==0){var i=t.lanes;i&=e.pendingLanes,n|=i,t.lanes=n,Kn(e,n)}}var Gr={readContext:cn,use:gc,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};Gr.useEffectEvent=zt;var Xh={readContext:cn,use:gc,useCallback:function(e,t){return jn().memoizedState=[e,t===void 0?null:t],e},useContext:cn,useEffect:Lh,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,yc(4194308,4,Bh.bind(null,t,e),n)},useLayoutEffect:function(e,t){return yc(4194308,4,e,t)},useInsertionEffect:function(e,t){yc(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=Hv.bind(null,Ge,e),[i.memoizedState,e]},useRef:function(e){var t=jn();return e={current:e},t.memoizedState=e},useState:function(e){e=Sd(e);var t=e.queue,n=Vh.bind(null,Ge,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:jd,useDeferredValue:function(e,t){var n=jn();return Nd(n,e,t)},useTransition:function(){var e=Sd(!1);return e=$h.bind(null,Ge,e.queue,!0,!1),jn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var i=Ge,u=jn();if(ae){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),bt===null)throw Error(r(349));(Xe&127)!==0||xh(i,t,n)}u.memoizedState=n;var f={value:n,getSnapshot:t};return u.queue=f,Lh(vh.bind(null,i,f,e),[e]),i.flags|=2048,zs(9,{destroy:void 0},yh.bind(null,i,f,n,t),null),n},useId:function(){var e=jn(),t=bt.identifierPrefix;if(ae){var n=sn,i=ya;n=(i&~(1<<32-Ot(i)-1)).toString(32)+n,t="_"+t+"R_"+n,n=hc++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=Dv++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:kd,useFormState:kh,useActionState:kh,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=Td.bind(null,Ge,!0,n),n.dispatch=t,[e,t]},useMemoCache:vd,useCacheRefresh:function(){return jn().memoizedState=Bv.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)}}},Ed={readContext:cn,use:gc,useCallback:Ih,useContext:cn,useEffect:Md,useImperativeHandle:Hh,useInsertionEffect:_h,useLayoutEffect:Oh,useMemo:Fh,useReducer:xc,useRef:Rh,useState:function(){return xc(vl)},useDebugValue:jd,useDeferredValue:function(e,t){var n=Ht();return Uh(n,xt.memoizedState,e,t)},useTransition:function(){var e=xc(vl)[0],t=Ht().memoizedState;return[typeof e=="boolean"?e:$r(e),t]},useSyncExternalStore:gh,useId:Ph,useHostTransitionStatus:kd,useFormState:Th,useActionState:Th,useOptimistic:function(e,t){var n=Ht();return Sh(n,xt,e,t)},useMemoCache:vd,useCacheRefresh:Yh};Ed.useEffectEvent=zh;var Zh={readContext:cn,use:gc,useCallback:Ih,useContext:cn,useEffect:Md,useImperativeHandle:Hh,useInsertionEffect:_h,useLayoutEffect:Oh,useMemo:Fh,useReducer:wd,useRef:Rh,useState:function(){return wd(vl)},useDebugValue:jd,useDeferredValue:function(e,t){var n=Ht();return xt===null?Nd(n,e,t):Uh(n,xt.memoizedState,e,t)},useTransition:function(){var e=wd(vl)[0],t=Ht().memoizedState;return[typeof e=="boolean"?e:$r(e),t]},useSyncExternalStore:gh,useId:Ph,useHostTransitionStatus:kd,useFormState:Dh,useActionState:Dh,useOptimistic:function(e,t){var n=Ht();return xt!==null?Sh(n,xt,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:vd,useCacheRefresh:Yh};Zh.useEffectEvent=zh;function Dd(e,t,n,i){t=e.memoizedState,n=n(i,t),n=n==null?t:y({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Rd={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),Hr(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),Hr(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),Hr(t,e,n))}};function Wh(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 Jh(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&&Rd.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=y({},n));for(var u in e)n[u]===void 0&&(n[u]=e[u])}return n}function ep(e){xs(e)}function tp(e){console.error(e)}function np(e){xs(e)}function wc(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(i){setTimeout(function(){throw i})}}function ap(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 Ld(e,t,n){return n=Jl(n),n.tag=3,n.payload={element:null},n.callback=function(){wc(e,t)},n}function lp(e){return e=Jl(e),e.tag=3,e}function ip(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(){ap(t,n,i)}}var b=n.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(e.callback=function(){ap(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 Iv(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 va===null?Lc():n.alternate===null&&_t===0&&(_t=3),n.flags&=-257,n.flags|=65536,n.lanes=u,i===oc?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([i]):t.add(i),lf(e,i,u)),!1;case 22:return n.flags|=65536,i===oc?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)),lf(e,i,u)),!1}throw Error(r(435,n.tag))}return lf(e,i,u),Lc(),!1}if(ae)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=Ld(e.stateNode,i,u),cd(e,u),_t!==4&&(_t=2)),!1;var f=Error(r(520),{cause:i});if(f=_n(f,n),Wr===null?Wr=[f]:Wr.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=Ld(n.stateNode,i,e),cd(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=lp(u),ip(u,e,n,i),cd(n,u),!1}n=n.return}while(n!==null);return!1}var zd=Error(r(461)),Yt=!1;function un(e,t,n,i){t.child=e===null?ch(t,null,n,i):Ui(t,e.child,n,i)}function sp(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=pd(e,t,n,b,f,u),N=gd(),e!==null&&!Yt?(xd(e,t,u),bl(e,t,u)):(ae&&N&&S(t),t.flags|=1,un(e,t,i,u),t.child)}function rp(e,t,n,i,u){if(e===null){var f=n.type;return typeof f=="function"&&!Lr(f)&&f.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=f,op(e,t,f,i,u)):(e=Cs(n.type,null,i,t,t.mode,u),e.ref=t.ref,e.return=t,t.child=e)}if(f=e.child,!$d(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 op(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,$d(e,u))(e.flags&131072)!==0&&(Yt=!0);else return t.lanes=e.lanes,bl(e,t,u)}return _d(e,t,n,i,u)}function cp(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 up(e,t,f,n,i)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&sc(t,f!==null?f.cachePool:null),f!==null?fh(t,f):dd(),mh(t);else return i=t.lanes=536870912,up(e,t,f!==null?f.baseLanes|n:n,n,i)}else f!==null?(sc(t,f.cachePool),fh(t,f),ni(),t.memoizedState=null):(e!==null&&sc(t,null),dd(),ni());return un(e,t,u,n),t.child}function Pr(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function up(e,t,n,i,u){var f=id();return f=f===null?null:{parent:Gt._currentValue,pool:f},t.memoizedState={baseLanes:n,cachePool:f},e!==null&&sc(t,null),dd(),mh(t),e!==null&&Ns(e,t,i,!0),t.childLanes=u,null}function Sc(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 dp(e,t,n){return Ui(t,e.child,null,n),e=Sc(t,t.pendingProps),e.flags|=2,ea(t),t.memoizedState=null,e}function Fv(e,t,n){var i=t.pendingProps,u=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(ae){if(i.mode==="hidden")return e=Sc(t,i),t.lanes=536870912,Pr(null,e);if(md(t),(e=U)?(e=Cg(e,je),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Va!==null?{id:ya,overflow:sn}:null,retryLane:536870912,hydrationErrors:null},n=Vl(e),n.return=t,t.child=n,F=t,U=null)):e=null,e===null)throw Fe(t);return t.lanes=536870912,null}return Sc(t,i)}var f=e.memoizedState;if(f!==null){var b=f.dehydrated;if(md(t),u)if(t.flags&256)t.flags&=-257,t=dp(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),zd;Lc(),t=dp(e,t,n)}else e=f.treeContext,U=ba(b.nextSibling),F=t,ae=!0,pe=null,je=!1,e!==null&&Y(t,e),t=Sc(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 Cc(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 _d(e,t,n,i,u){return Bi(t),n=pd(e,t,n,i,void 0,u),i=gd(),e!==null&&!Yt?(xd(e,t,u),bl(e,t,u)):(ae&&i&&S(t),t.flags|=1,un(e,t,n,u),t.child)}function fp(e,t,n,i,u,f){return Bi(t),t.updateQueue=null,n=ph(t,i,n,u),hh(e),i=gd(),e!==null&&!Yt?(xd(e,t,f),bl(e,t,f)):(ae&&i&&S(t),t.flags|=1,un(e,t,n,f),t.child)}function mp(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=Rd,t.stateNode=f,f._reactInternals=t,f=t.stateNode,f.props=i,f.state=t.memoizedState,f.refs={},rd(t),b=n.contextType,f.context=typeof b=="object"&&b!==null?cn(b):Lt,f.state=t.memoizedState,b=n.getDerivedStateFromProps,typeof b=="function"&&(Dd(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&&Rd.enqueueReplaceState(f,f.state,null),Fr(t,i,f,u),Ir(),f.state=t.memoizedState),typeof f.componentDidMount=="function"&&(t.flags|=4194308),i=!0}else if(e===null){f=t.stateNode;var N=t.memoizedProps,z=qi(n,N);f.props=z;var X=f.context,se=n.contextType;b=Lt,typeof se=="object"&&se!==null&&(b=cn(se));var ue=n.getDerivedStateFromProps;se=typeof ue=="function"||typeof f.getSnapshotBeforeUpdate=="function",N=t.pendingProps!==N,se||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(N||X!==b)&&Jh(t,f,i,b),Wl=!1;var W=t.memoizedState;f.state=W,Fr(t,i,f,u),Ir(),X=t.memoizedState,N||W!==X||Wl?(typeof ue=="function"&&(Dd(t,n,ue,i),X=t.memoizedState),(z=Wl||Wh(t,n,z,i,W,X,b))?(se||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=X),f.props=i,f.state=X,f.context=b,i=z):(typeof f.componentDidMount=="function"&&(t.flags|=4194308),i=!1)}else{f=t.stateNode,od(e,t),b=t.memoizedProps,se=qi(n,b),f.props=se,ue=t.pendingProps,W=f.context,X=n.contextType,z=Lt,typeof X=="object"&&X!==null&&(z=cn(X)),N=n.getDerivedStateFromProps,(X=typeof N=="function"||typeof f.getSnapshotBeforeUpdate=="function")||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(b!==ue||W!==z)&&Jh(t,f,i,z),Wl=!1,W=t.memoizedState,f.state=W,Fr(t,i,f,u),Ir();var te=t.memoizedState;b!==ue||W!==te||Wl||e!==null&&e.dependencies!==null&&lc(e.dependencies)?(typeof N=="function"&&(Dd(t,n,N,i),te=t.memoizedState),(se=Wl||Wh(t,n,se,i,W,te,z)||e!==null&&e.dependencies!==null&&lc(e.dependencies))?(X||typeof f.UNSAFE_componentWillUpdate!="function"&&typeof f.componentWillUpdate!="function"||(typeof f.componentWillUpdate=="function"&&f.componentWillUpdate(i,te,z),typeof f.UNSAFE_componentWillUpdate=="function"&&f.UNSAFE_componentWillUpdate(i,te,z)),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=te),f.props=i,f.state=te,f.context=z,i=se):(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,Cc(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 hp(e,t,n,i){return on(),t.flags|=256,un(e,t,n,i),t.child}var Od={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Bd(e){return{baseLanes:e,cachePool:ah()}}function Hd(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=na),e}function pp(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(ae){if(u?ti(t):ni(),(e=U)?(e=Cg(e,je),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Va!==null?{id:ya,overflow:sn}:null,retryLane:536870912,hydrationErrors:null},n=Vl(e),n.return=t,t.child=n,F=t,U=null)):e=null,e===null)throw Fe(t);return wf(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=Bd(n),i.childLanes=Hd(e,b,n),t.memoizedState=Od,Pr(null,i)):(ti(t),Id(t,N))}var z=e.memoizedState;if(z!==null&&(N=z.dehydrated,N!==null)){if(f)t.flags&256?(ti(t),t.flags&=-257,t=Fd(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=Bd(n),i.childLanes=Hd(e,b,n),t.memoizedState=Od,t=Pr(null,i));else if(ti(t),wf(N)){if(b=N.nextSibling&&N.nextSibling.dataset,b)var X=b.dgst;b=X,i=Error(r(419)),i.stack="",i.digest=b,Ra({value:i,source:null,stack:null}),t=Fd(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!==z.retryLane))throw z.retryLane=i,xa(e,i),Un(b,e,i),zd;bf(N)||Lc(),t=Fd(e,t,n)}else bf(N)?(t.flags|=192,t.child=e.child,t=null):(e=z.treeContext,U=ba(N.nextSibling),F=t,ae=!0,pe=null,je=!1,e!==null&&Y(t,e),t=Id(t,i.children),t.flags|=4096);return t}return u?(ni(),N=i.fallback,u=t.mode,z=e.child,X=z.sibling,i=Pa(z,{mode:"hidden",children:i.children}),i.subtreeFlags=z.subtreeFlags&65011712,X!==null?N=Pa(X,N):(N=Ya(N,u,n,null),N.flags|=2),N.return=t,i.return=t,i.sibling=N,t.child=i,Pr(null,i),i=t.child,N=e.child.memoizedState,N===null?N=Bd(n):(u=N.cachePool,u!==null?(z=Gt._currentValue,u=u.parent!==z?{parent:z,pool:z}:u):u=ah(),N={baseLanes:N.baseLanes|n,cachePool:u}),i.memoizedState=N,i.childLanes=Hd(e,b,n),t.memoizedState=Od,Pr(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 Id(e,t){return t=Mc({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Mc(e,t){return e=yn(22,e,null,t),e.lanes=0,e}function Fd(e,t,n){return Ui(t,e.child,null,n),e=Id(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function gp(e,t,n){e.lanes|=t;var i=e.alternate;i!==null&&(i.lanes|=t),td(e.return,t,n)}function Ud(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 xp(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=ae?Oi:0,!N&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&gp(e,n,t);else if(e.tag===19)gp(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&&fc(e)===null&&(u=n),n=n.sibling;n=u,n===null?(u=t.child,t.child=null):(u=n.sibling,n.sibling=null),Ud(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&&fc(e)===null){t.child=u;break}e=u.sibling,u.sibling=n,n=u,u=e}Ud(t,!0,n,null,f,i);break;case"together":Ud(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 $d(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&lc(e)))}function Uv(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,md(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?pp(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 xp(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,cp(e,t,n,t.pendingProps);case 24:Zl(t,Gt,e.memoizedState.cache)}return bl(e,t,n)}function yp(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Yt=!0;else{if(!$d(e,n)&&(t.flags&128)===0)return Yt=!1,Uv(e,t,n);Yt=(e.flags&131072)!==0}else Yt=!1,ae&&(t.flags&1048576)!==0&&ac(t,Oi,t.index);switch(t.lanes=0,t.tag){case 16:e:{var i=t.pendingProps;if(e=Ii(t.elementType),t.type=e,typeof e=="function")Lr(e)?(i=qi(e,i),t.tag=1,t=mp(null,t,e,i,n)):(t.tag=0,t=_d(null,t,e,i,n));else{if(e!=null){var u=e.$$typeof;if(u===q){t.tag=11,t=sp(null,t,e,i,n);break e}else if(u===E){t.tag=14,t=rp(null,t,e,i,n);break e}}throw t=K(e)||e,Error(r(306,t,""))}}return t;case 0:return _d(e,t,t.type,t.pendingProps,n);case 1:return i=t.type,u=qi(i,t.pendingProps),mp(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,od(e,t),Fr(t,i,null,n);var b=t.memoizedState;if(i=b.cache,Zl(t,Gt,i),i!==f.cache&&nd(t,[Gt],n,!0),Ir(),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=hp(e,t,i,n);break e}else if(i!==u){u=_n(Error(r(424)),t),Ra(u),t=hp(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,U=ba(e.firstChild),F=t,ae=!0,pe=null,je=!0,n=ch(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 Cc(e,t),e===null?(n=Tg(t.type,null,t.pendingProps,null))?t.memoizedState=n:ae||(n=t.type,e=t.pendingProps,i=Fc(Ie.current).createElement(n),i[P]=t,i[he]=e,dn(i,n,e),Ct(i),t.stateNode=i):t.memoizedState=Tg(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return qe(t),e===null&&ae&&(i=t.stateNode=Ng(t.type,t.pendingProps,Ie.current),F=t,je=!0,u=U,ui(t.type)?(Sf=u,U=ba(i.firstChild)):U=u),un(e,t,t.pendingProps.children,n),Cc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ae&&((u=i=U)&&(i=xb(i,t.type,t.pendingProps,je),i!==null?(t.stateNode=i,F=t,U=ba(i.firstChild),je=!1,u=!0):u=!1),u||Fe(t)),qe(t),u=t.type,f=t.pendingProps,b=e!==null?e.memoizedProps:null,i=f.children,xf(u,f)?i=null:b!==null&&xf(u,b)&&(t.flags|=32),t.memoizedState!==null&&(u=pd(e,t,Rv,null,null,n),so._currentValue=u),Cc(e,t),un(e,t,i,n),t.child;case 6:return e===null&&ae&&((e=n=U)&&(n=yb(n,t.pendingProps,je),n!==null?(t.stateNode=n,F=t,U=null,e=!0):e=!1),e||Fe(t)),null;case 13:return pp(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 sp(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 rp(e,t,t.type,t.pendingProps,n);case 15:return op(e,t,t.type,t.pendingProps,n);case 19:return xp(e,t,n);case 31:return Fv(e,t,n);case 22:return cp(e,t,n,t.pendingProps);case 24:return Bi(t),i=cn(Gt),e===null?(u=id(),u===null&&(u=bt,f=ad(),u.pooledCache=f,f.refCount++,f!==null&&(u.pooledCacheLanes|=n),u=f),t.memoizedState={parent:i,cache:u},rd(t),Zl(t,Gt,u)):((e.lanes&n)!==0&&(od(e,t),Fr(t,null,null,n),Ir()),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&&nd(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 qd(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(Pp())e.flags|=8192;else throw Fi=oc,sd}else e.flags&=-16777217}function vp(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!zg(t))if(Pp())e.flags|=8192;else throw Fi=oc,sd}function jc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Ll():536870912,e.lanes|=t,Hs|=t)}function Yr(e,t){if(!ae)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 $v(e,t,n){var i=t.pendingProps;switch(R(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)&&(Mn(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),vp(t,f)):(jt(t),qd(t,u,null,i,n))):f?f!==e.memoizedState?(wl(t),jt(t),vp(t,f)):(jt(t),t.flags&=-16777217):(e=e.memoizedProps,e!==i&&wl(t),jt(t),qd(t,u,e,i,n)),null;case 27:if(Te(t),n=Ie.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,Mn(t)?Nt(t):(e=Ng(u,i,n),t.stateNode=e,wl(t))}return jt(t),null;case 5:if(Te(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,Mn(t))Nt(t);else{var b=Fc(Ie.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[P]=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),qd(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=Ie.current,Mn(t)){if(e=t.stateNode,n=t.memoizedProps,i=null,u=F,u!==null)switch(u.tag){case 27:case 5:i=u.memoizedProps}e[P]=t,e=!!(e.nodeValue===n||i!==null&&i.suppressHydrationWarning===!0||pg(e.nodeValue,n)),e||Fe(t,!0)}else e=Fc(e).createTextNode(i),e[P]=t,t.stateNode=e}return jt(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(i=Mn(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[P]=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=Mn(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[P]=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),jc(t,t.updateQueue),jt(t),null);case 4:return Ee(),e===null&&ff(t.stateNode.containerInfo),jt(t),null;case 10:return xl(t.type),jt(t),null;case 19:if(_(Bt),i=t.memoizedState,i===null)return jt(t),null;if(u=(t.flags&128)!==0,f=i.rendering,f===null)if(u)Yr(i,!1);else{if(_t!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(f=fc(e),f!==null){for(t.flags|=128,Yr(i,!1),e=f.updateQueue,t.updateQueue=e,jc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)tc(n,e),n=n.sibling;return ge(Bt,Bt.current&1|2),ae&&Da(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&&ze()>Ec&&(t.flags|=128,u=!0,Yr(i,!1),t.lanes=4194304)}else{if(!u)if(e=fc(f),e!==null){if(t.flags|=128,u=!0,e=e.updateQueue,t.updateQueue=e,jc(t,e),Yr(i,!0),i.tail===null&&i.tailMode==="hidden"&&!f.alternate&&!ae)return jt(t),null}else 2*ze()-i.renderingStartTime>Ec&&n!==536870912&&(t.flags|=128,u=!0,Yr(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),ae&&Da(t,i.treeForkCount),e):(jt(t),null);case 22:case 23:return ea(t),fd(),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&&jc(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&&_(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 qv(e,t){switch(R(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 Te(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 _(Bt),null;case 4:return Ee(),null;case 10:return xl(t.type),null;case 22:case 23:return ea(t),fd(),e!==null&&_(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 bp(e,t){switch(R(t),t.tag){case 3:xl(Gt),Ee();break;case 26:case 27:case 5:Te(t);break;case 4:Ee();break;case 31:t.memoizedState!==null&&ea(t);break;case 13:ea(t);break;case 19:_(Bt);break;case 10:xl(t.type);break;case 22:case 23:ea(t),fd(),e!==null&&_(Hi);break;case 24:xl(Gt)}}function Vr(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 z=n,X=N;try{X()}catch(se){pt(u,z,se)}}}i=i.next}while(i!==f)}}catch(se){pt(t,t.return,se)}}function wp(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{dh(t,n)}catch(i){pt(e,e.return,i)}}}function Sp(e,t,n){n.props=qi(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(i){pt(e,t,i)}}function Qr(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 Cp(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 Gd(e,t,n){try{var i=e.stateNode;db(i,e.type,n,t),i[he]=t}catch(u){pt(e,e.return,u)}}function Mp(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&ui(e.type)||e.tag===4}function Pd(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Mp(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 Yd(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(Yd(e,t,n),e=e.sibling;e!==null;)Yd(e,t,n),e=e.sibling}function Nc(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(Nc(e,t,n),e=e.sibling;e!==null;)Nc(e,t,n),e=e.sibling}function jp(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[P]=e,t[he]=n}catch(f){pt(e,e.return,f)}}var Sl=!1,Vt=!1,Vd=!1,Np=typeof WeakSet=="function"?WeakSet:Set,en=null;function Gv(e,t){if(e=e.containerInfo,pf=Vc,e=Qo(e),kr(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,z=-1,X=0,se=0,ue=e,W=null;t:for(;;){for(var te;ue!==n||u!==0&&ue.nodeType!==3||(N=b+u),ue!==f||i!==0&&ue.nodeType!==3||(z=b+i),ue.nodeType===3&&(b+=ue.nodeValue.length),(te=ue.firstChild)!==null;)W=ue,ue=te;for(;;){if(ue===e)break t;if(W===n&&++X===u&&(N=b),W===f&&++se===i&&(z=b),(te=ue.nextSibling)!==null)break;ue=W,W=ue.parentNode}ue=te}n=N===-1||z===-1?null:{start:N,end:z}}else n=null}n=n||{start:0,end:0}}else n=null;for(gf={focusedElem:e,selectionRange:n},Vc=!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)vf(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":vf(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 Ap(e,t,n){var i=n.flags;switch(n.tag){case 0:case 11:case 15:Ml(e,n),i&4&&Vr(5,n);break;case 1:if(Ml(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&&wp(n),i&512&&Qr(n,n.return);break;case 3:if(Ml(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{dh(e,t)}catch(b){pt(n,n.return,b)}}break;case 27:t===null&&i&4&&jp(n);case 26:case 5:Ml(e,n),t===null&&i&4&&Cp(n),i&512&&Qr(n,n.return);break;case 12:Ml(e,n);break;case 31:Ml(e,n),i&4&&Ep(e,n);break;case 13:Ml(e,n),i&4&&Dp(e,n),i&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Jv.bind(null,n),vb(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):Ml(e,n),Sl=u,Vt=f}break;case 30:break;default:Ml(e,n)}}function kp(e){var t=e.alternate;t!==null&&(e.alternate=null,kp(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 Cl(e,t,n){for(n=n.child;n!==null;)Tp(e,t,n),n=n.sibling}function Tp(e,t,n){if(ut&&typeof ut.onCommitFiberUnmount=="function")try{ut.onCommitFiberUnmount(Qn,n)}catch{}switch(n.tag){case 26:Vt||Qa(n,t),Cl(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),Cl(e,t,n),ao(n.stateNode),At=i,Bn=u;break;case 5:Vt||Qa(n,t);case 6:if(i=At,u=Bn,At=null,Cl(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,wg(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Ys(e)):wg(At,n.stateNode));break;case 4:i=At,u=Bn,At=n.stateNode.containerInfo,Bn=!0,Cl(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),Cl(e,t,n);break;case 1:Vt||(Qa(n,t),i=n.stateNode,typeof i.componentWillUnmount=="function"&&Sp(n,t,i)),Cl(e,t,n);break;case 21:Cl(e,t,n);break;case 22:Vt=(i=Vt)||n.memoizedState!==null,Cl(e,t,n),Vt=i;break;default:Cl(e,t,n)}}function Ep(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 Dp(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 Pv(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Np),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Np),t;default:throw Error(r(435,e.tag))}}function Ac(e,t){var n=Pv(e);t.forEach(function(i){if(!n.has(i)){n.add(i);var u=eb.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));Tp(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;)Rp(t,e),t=t.sibling}var La=null;function Rp(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Hn(t,e),In(e),i&4&&(ai(3,e,e.return),Vr(3,e),ai(5,e,e.return));break;case 1:Hn(t,e),In(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),In(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[P]||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[P]=e,Ct(f),i=f;break e;case"link":var b=Rg("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=Rg("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[P]=e,Ct(f),i=f}e.stateNode=i}else Lg(u,e.type,e.stateNode);else e.stateNode=Dg(u,i,e.memoizedProps);else f!==i?(f===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):f.count--,i===null?Lg(u,e.type,e.stateNode):Dg(u,i,e.memoizedProps)):i===null&&e.stateNode!==null&&Gd(e,e.memoizedProps,n.memoizedProps)}break;case 27:Hn(t,e),In(e),i&512&&(Vt||n===null||Qa(n,n.return)),n!==null&&i&4&&Gd(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Hn(t,e),In(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,Gd(e,u,n!==null?n.memoizedProps:u)),i&1024&&(Vd=!0);break;case 6:if(Hn(t,e),In(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(qc=null,u=La,La=Uc(t.containerInfo),Hn(t,e),La=u,In(e),i&4&&n!==null&&n.memoizedState.isDehydrated)try{Ys(t.containerInfo)}catch(Ne){pt(e,e.return,Ne)}Vd&&(Vd=!1,Lp(e));break;case 4:i=La,La=Uc(e.stateNode.containerInfo),Hn(t,e),In(e),La=i;break;case 12:Hn(t,e),In(e);break;case 31:Hn(t,e),In(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Ac(e,i)));break;case 13:Hn(t,e),In(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,Ac(e,i)));break;case 22:u=e.memoizedState!==null;var z=n!==null&&n.memoizedState!==null,X=Sl,se=Vt;if(Sl=X||u,Vt=se||z,Hn(t,e),Vt=se,Sl=X,In(e),i&8192)e:for(t=e.stateNode,t._visibility=u?t._visibility&-2:t._visibility|1,u&&(n===null||z||Sl||Vt||Gi(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){z=n=t;try{if(f=z.stateNode,u)b=f.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none";else{N=z.stateNode;var ue=z.memoizedProps.style,W=ue!=null&&ue.hasOwnProperty("display")?ue.display:null;N.style.display=W==null||typeof W=="boolean"?"":(""+W).trim()}}catch(Ne){pt(z,z.return,Ne)}}}else if(t.tag===6){if(n===null){z=t;try{z.stateNode.nodeValue=u?"":z.memoizedProps}catch(Ne){pt(z,z.return,Ne)}}}else if(t.tag===18){if(n===null){z=t;try{var te=z.stateNode;u?Sg(te,!0):Sg(z.stateNode,!1)}catch(Ne){pt(z,z.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,Ac(e,n))));break;case 19:Hn(t,e),In(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Ac(e,i)));break;case 30:break;case 21:break;default:Hn(t,e),In(e)}}function In(e){var t=e.flags;if(t&2){try{for(var n,i=e.return;i!==null;){if(Mp(i)){n=i;break}i=i.return}if(n==null)throw Error(r(160));switch(n.tag){case 27:var u=n.stateNode,f=Pd(e);Nc(e,f,u);break;case 5:var b=n.stateNode;n.flags&32&&(Ln(b,""),n.flags&=-33);var N=Pd(e);Nc(e,N,b);break;case 3:case 4:var z=n.stateNode.containerInfo,X=Pd(e);Yd(e,X,z);break;default:throw Error(r(161))}}catch(se){pt(e,e.return,se)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Lp(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Lp(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Ml(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Ap(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"&&Sp(t,t.return,n),Gi(t);break;case 27:ao(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),Vr(4,f);break;case 1:if(jl(u,f,n),i=f,u=i.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(X){pt(i,i.return,X)}if(i=f,u=i.updateQueue,u!==null){var N=i.stateNode;try{var z=u.shared.hiddenCallbacks;if(z!==null)for(u.shared.hiddenCallbacks=null,u=0;u<z.length;u++)uh(z[u],N)}catch(X){pt(i,i.return,X)}}n&&b&64&&wp(f),Qr(f,f.return);break;case 27:jp(f);case 26:case 5:jl(u,f,n),n&&i===null&&b&4&&Cp(f),Qr(f,f.return);break;case 12:jl(u,f,n);break;case 31:jl(u,f,n),n&&b&4&&Ep(u,f);break;case 13:jl(u,f,n),n&&b&4&&Dp(u,f);break;case 22:f.memoizedState===null&&jl(u,f,n),Qr(f,f.return);break;case 30:break;default:jl(u,f,n)}t=t.sibling}}function Qd(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&&zr(n))}function Kd(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&zr(e))}function za(e,t,n,i){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)zp(e,t,n,i),t=t.sibling}function zp(e,t,n,i){var u=t.flags;switch(t.tag){case 0:case 11:case 15:za(e,t,n,i),u&2048&&Vr(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&&zr(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(z){pt(t,t.return,z)}}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):Kr(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&&Qd(b,t);break;case 24:za(e,t,n,i),u&2048&&Kd(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,z=i,X=b.flags;switch(b.tag){case 0:case 11:case 15:_s(f,b,N,z,u),Vr(8,b);break;case 23:break;case 22:var se=b.stateNode;b.memoizedState!==null?se._visibility&2?_s(f,b,N,z,u):Kr(f,b):(se._visibility|=2,_s(f,b,N,z,u)),u&&X&2048&&Qd(b.alternate,b);break;case 24:_s(f,b,N,z,u),u&&X&2048&&Kd(b.alternate,b);break;default:_s(f,b,N,z,u)}t=t.sibling}}function Kr(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:Kr(n,i),u&2048&&Qd(i.alternate,i);break;case 24:Kr(n,i),u&2048&&Kd(i.alternate,i);break;default:Kr(n,i)}t=t.sibling}}var Xr=8192;function Os(e,t,n){if(e.subtreeFlags&Xr)for(e=e.child;e!==null;)_p(e,t,n),e=e.sibling}function _p(e,t,n){switch(e.tag){case 26:Os(e,t,n),e.flags&Xr&&e.memoizedState!==null&&Db(n,La,e.memoizedState,e.memoizedProps);break;case 5:Os(e,t,n);break;case 3:case 4:var i=La;La=Uc(e.stateNode.containerInfo),Os(e,t,n),La=i;break;case 22:e.memoizedState===null&&(i=e.alternate,i!==null&&i.memoizedState!==null?(i=Xr,Xr=16777216,Os(e,t,n),Xr=i):Os(e,t,n));break;default:Os(e,t,n)}}function Op(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 Zr(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,Hp(i,e)}Op(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Bp(e),e=e.sibling}function Bp(e){switch(e.tag){case 0:case 11:case 15:Zr(e),e.flags&2048&&ai(9,e,e.return);break;case 3:Zr(e);break;case 12:Zr(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,kc(e)):Zr(e);break;default:Zr(e)}}function kc(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,Hp(i,e)}Op(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:ai(8,t,t.return),kc(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,kc(t));break;default:kc(t)}e=e.sibling}}function Hp(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:zr(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(kp(i),i===n){en=null;break e}if(u!==null){u.return=f,en=u;break e}en=f}}}var Yv={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}},Vv=typeof WeakMap=="function"?WeakMap:Map,ot=0,bt=null,Qe=null,Xe=0,ht=0,ta=null,li=!1,Bs=!1,Xd=!1,Nl=0,_t=0,ii=0,Pi=0,Zd=0,na=0,Hs=0,Wr=null,Fn=null,Wd=!1,Tc=0,Ip=0,Ec=1/0,Dc=null,si=null,Wt=0,ri=null,Is=null,Al=0,Jd=0,ef=null,Fp=null,Jr=0,tf=null;function aa(){return(ot&2)!==0&&Xe!==0?Xe&-Xe:I.T!==null?of():gn()}function Up(){if(na===0)if((Xe&536870912)===0||ae){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)&&(Fs(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 $p(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?Xv(e,t):af(e,t,!0),f=i;do{if(u===0){Bs&&!i&&oi(e,t,0,!1);break}else{if(n=e.current.alternate,f&&!Qv(n)){u=af(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=Wr;var z=N.current.memoizedState.isDehydrated;if(z&&(Fs(N,b).flags|=256),b=af(N,b,!1),b!==2){if(Xd&&!z){N.errorRecoveryDisabledLanes|=f,Pi|=f,u=4;break e}f=Fn,Fn=u,f!==null&&(Fn===null?Fn=f:Fn.push.apply(Fn,f))}u=b}if(f=!1,u!==2)continue}}if(u===1){Fs(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:Fn=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),Tn(i,0,!0)!==0)break e;Al=t,i.timeoutHandle=vg(qp.bind(null,i,n,Fn,Dc,Wd,t,na,Pi,Hs,li,f,"Throttled",-0,0),u);break e}qp(i,n,Fn,Dc,Wd,t,na,Pi,Hs,li,f,null,-0,0)}}break}while(!0);Ka(e)}function qp(e,t,n,i,u,f,b,N,z,X,se,ue,W,te){if(e.timeoutHandle=-1,ue=t.subtreeFlags,ue&8192||(ue&16785408)===16785408){ue={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:tt},_p(t,f,ue);var Ne=(f&62914560)===f?Tc-ze():(f&4194048)===f?Ip-ze():0;if(Ne=Rb(ue,Ne),Ne!==null){Al=f,e.cancelPendingCommit=Ne(Zp.bind(null,e,t,f,n,i,u,b,N,z,se,ue,null,W,te)),oi(e,f,b,!X);return}}Zp(e,t,f,n,i,u,b,N,z)}function Qv(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&=~Zd,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 Rc(){return(ot&6)===0?(eo(0),!1):!0}function nf(){if(Qe!==null){if(ht===0)var e=Qe.return;else e=Qe,gl=pl=null,yd(e),Es=null,Or=0,e=Qe;for(;e!==null;)bp(e.alternate,e),e=e.return;Qe=null}}function Fs(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,hb(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Al=0,nf(),bt=e,Qe=n=Pa(e.current,null),Xe=t,ht=0,ta=null,li=!1,Bs=ra(e,t),Xd=!1,Hs=na=Zd=Pi=ii=_t=0,Fn=Wr=null,Wd=!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,ys(),n}function Gp(e,t){Ge=null,I.H=Gr,t===Ts||t===rc?(t=sh(),ht=3):t===sd?(t=sh(),ht=4):ht=t===zd?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,ta=t,Qe===null&&(_t=1,wc(e,_n(t,e.current)))}function Pp(){var e=Jn.current;return e===null?!0:(Xe&4194048)===Xe?va===null:(Xe&62914560)===Xe||(Xe&536870912)!==0?e===va:!1}function Yp(){var e=I.H;return I.H=Gr,e===null?Gr:e}function Vp(){var e=I.A;return I.A=Yv,e}function Lc(){_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 af(e,t,n){var i=ot;ot|=2;var u=Yp(),f=Vp();(bt!==e||Xe!==t)&&(Dc=null,Fs(e,t)),t=!1;var b=_t;e:do try{if(ht!==0&&Qe!==null){var N=Qe,z=ta;switch(ht){case 8:nf(),b=6;break e;case 3:case 2:case 9:case 6:Jn.current===null&&(t=!0);var X=ht;if(ht=0,ta=null,Us(e,N,z,X),n&&Bs){b=0;break e}break;default:X=ht,ht=0,ta=null,Us(e,N,z,X)}}Kv(),b=_t;break}catch(se){Gp(e,se)}while(!0);return t&&e.shellSuspendCounter++,gl=pl=null,ot=i,I.H=u,I.A=f,Qe===null&&(bt=null,Xe=0,ys()),b}function Kv(){for(;Qe!==null;)Qp(Qe)}function Xv(e,t){var n=ot;ot|=2;var i=Yp(),u=Vp();bt!==e||Xe!==t?(Dc=null,Ec=ze()+500,Fs(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(lh(f)){ht=0,ta=null,Kp(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:lh(f)?(ht=0,ta=null,Kp(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?zg(b):N.stateNode.complete){ht=0,ta=null;var z=N.sibling;if(z!==null)Qe=z;else{var X=N.return;X!==null?(Qe=X,zc(X)):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:nf(),_t=6;break e;default:throw Error(r(462))}}Zv();break}catch(se){Gp(e,se)}while(!0);return gl=pl=null,I.H=i,I.A=u,ot=n,Qe!==null?0:(bt=null,Xe=0,ys(),_t)}function Zv(){for(;Qe!==null&&!xe();)Qp(Qe)}function Qp(e){var t=yp(e.alternate,e,Nl);e.memoizedProps=e.pendingProps,t===null?zc(e):Qe=t}function Kp(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=fp(n,t,t.pendingProps,t.type,void 0,Xe);break;case 11:t=fp(n,t,t.pendingProps,t.type.render,t.ref,Xe);break;case 5:yd(t);default:bp(n,t),t=Qe=tc(t,Nl),t=yp(n,t,Nl)}e.memoizedProps=e.pendingProps,t===null?zc(e):Qe=t}function Us(e,t,n,i){gl=pl=null,yd(t),Es=null,Or=0;var u=t.return;try{if(Iv(e,u,t,n,Xe)){_t=1,wc(e,_n(n,e.current)),Qe=null;return}}catch(f){if(u!==null)throw Qe=u,f;_t=1,wc(e,_n(n,e.current)),Qe=null;return}t.flags&32768?(ae||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))),Xp(t,e)):zc(t)}function zc(e){var t=e;do{if((t.flags&32768)!==0){Xp(t,li);return}e=t.return;var n=$v(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 Xp(e,t){do{var n=qv(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 Zp(e,t,n,i,u,f,b,N,z){e.cancelPendingCommit=null;do _c();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,z),e===bt&&(Qe=bt=null,Xe=0),Is=t,ri=e,Al=n,Jd=f,ef=u,Fp=i,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,tb(Nn,function(){return ng(),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{Gv(e,t,n)}finally{ot=b,Z.p=u,I.T=i}}Wt=1,Wp(),Jp(),eg()}}function Wp(){if(Wt===1){Wt=0;var e=ri,t=Is,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{Rp(t,e);var f=gf,b=Qo(e.containerInfo),N=f.focusedElem,z=f.selectionRange;if(b!==N&&N&&N.ownerDocument&&Vo(N.ownerDocument.documentElement,N)){if(z!==null&&kr(N)){var X=z.start,se=z.end;if(se===void 0&&(se=X),"selectionStart"in N)N.selectionStart=X,N.selectionEnd=Math.min(se,N.value.length);else{var ue=N.ownerDocument||document,W=ue&&ue.defaultView||window;if(W.getSelection){var te=W.getSelection(),Ne=N.textContent.length,Be=Math.min(z.start,Ne),vt=z.end===void 0?Be:Math.min(z.end,Ne);!te.extend&&Be>vt&&(b=vt,vt=Be,Be=b);var G=Yo(N,Be),H=Yo(N,vt);if(G&&H&&(te.rangeCount!==1||te.anchorNode!==G.node||te.anchorOffset!==G.offset||te.focusNode!==H.node||te.focusOffset!==H.offset)){var Q=ue.createRange();Q.setStart(G.node,G.offset),te.removeAllRanges(),Be>vt?(te.addRange(Q),te.extend(H.node,H.offset)):(Q.setEnd(H.node,H.offset),te.addRange(Q))}}}}for(ue=[],te=N;te=te.parentNode;)te.nodeType===1&&ue.push({element:te,left:te.scrollLeft,top:te.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<ue.length;N++){var ce=ue[N];ce.element.scrollLeft=ce.left,ce.element.scrollTop=ce.top}}Vc=!!pf,gf=pf=null}finally{ot=u,Z.p=i,I.T=n}}e.current=t,Wt=2}}function Jp(){if(Wt===2){Wt=0;var e=ri,t=Is,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{Ap(e,t.alternate,t)}finally{ot=u,Z.p=i,I.T=n}}Wt=3}}function eg(){if(Wt===4||Wt===3){Wt=0,He();var e=ri,t=Is,n=Al,i=Fp;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?Wt=5:(Wt=0,Is=ri=null,tg(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&&_c(),Ka(e),u=e.pendingLanes,(n&261930)!==0&&(u&42)!==0?e===tf?Jr++:(Jr=0,tf=e):Jr=0,eo(0)}}function tg(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,zr(t)))}function _c(){return Wp(),Jp(),eg(),ng()}function ng(){if(Wt!==5)return!1;var e=ri,t=Jd;Jd=0;var n=Dn(Al),i=I.T,u=Z.p;try{Z.p=32>n?32:n,I.T=null,n=ef,ef=null;var f=ri,b=Al;if(Wt=0,Is=ri=null,Al=0,(ot&6)!==0)throw Error(r(331));var N=ot;if(ot|=4,Bp(f.current),zp(f,f.current,b,n),ot=N,eo(0,!1),ut&&typeof ut.onPostCommitFiberRoot=="function")try{ut.onPostCommitFiberRoot(Qn,f)}catch{}return!0}finally{Z.p=u,I.T=i,tg(e,t)}}function ag(e,t,n){t=_n(n,t),t=Ld(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)ag(e,e,n);else for(;t!==null;){if(t.tag===3){ag(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=lp(2),i=ei(t,n,2),i!==null&&(ip(n,i,t,e),oa(i,2),Ka(i));break}}t=t.return}}function lf(e,t,n){var i=e.pingCache;if(i===null){i=e.pingCache=new Vv;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)||(Xd=!0,u.add(n),e=Wv.bind(null,e,t,n),t.then(e,e))}function Wv(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&&Fs(e,0):Zd|=n,Hs===Xe&&(Hs=0)),Ka(e)}function lg(e,t){t===0&&(t=Ll()),e=xa(e,t),e!==null&&(oa(e,t),Ka(e))}function Jv(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),lg(e,n)}function eb(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),lg(e,n)}function tb(e,t){return Ft(e,t)}var Oc=null,$s=null,sf=!1,Bc=!1,rf=!1,ci=0;function Ka(e){e!==$s&&e.next===null&&($s===null?Oc=$s=e:$s=$s.next=e),Bc=!0,sf||(sf=!0,ab())}function eo(e,t){if(!rf&&Bc){rf=!0;do for(var n=!1,i=Oc;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,og(i,f))}else f=Xe,f=Tn(i,i===bt?f:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(f&3)===0||ra(i,f)||(n=!0,og(i,f));i=i.next}while(n);rf=!1}}function nb(){ig()}function ig(){Bc=sf=!1;var e=0;ci!==0&&mb()&&(e=ci);for(var t=ze(),n=null,i=Oc;i!==null;){var u=i.next,f=sg(i,t);f===0?(i.next=null,n===null?Oc=u:n.next=u,u===null&&($s=n)):(n=i,(e!==0||(f&3)!==0)&&(Bc=!0)),i=u}Wt!==0&&Wt!==5||eo(e),ci!==0&&(ci=0)}function sg(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,z=u[b];z===-1?((N&n)===0||(N&i)!==0)&&(u[b]=tl(N,t)):z<=t&&(e.expiredLanes|=N),f&=~N}if(t=bt,n=Xe,n=Tn(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=rg.bind(null,e),n=Ft(n,i),e.callbackPriority=t,e.callbackNode=n,t}return i!==null&&i!==null&&Rt(i),e.callbackPriority=2,e.callbackNode=null,2}function rg(e,t){if(Wt!==0&&Wt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(_c()&&e.callbackNode!==n)return null;var i=Xe;return i=Tn(e,e===bt?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i===0?null:($p(e,i,t),sg(e,ze()),e.callbackNode!=null&&e.callbackNode===n?rg.bind(null,e):null)}function og(e,t){if(_c())return null;$p(e,t,!0)}function ab(){pb(function(){(ot&6)!==0?Ft(Cn,nb):ig()})}function of(){if(ci===0){var e=As;e===0&&(e=Ha,Ha<<=1,(Ha&261888)===0&&(Ha=256)),ci=e}return ci}function cg(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Ol(""+e)}function ug(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 lb(e,t,n,i,u){if(t==="submit"&&n&&n.stateNode===u){var f=cg((u[he]||null).action),b=i.submitter;b&&(t=(t=b[he]||null)?cg(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 z=b?ug(u,b):new FormData(u);Ad(n,{pending:!0,data:z,method:u.method,action:f},null,z)}}else typeof f=="function"&&(N.preventDefault(),z=b?ug(u,b):new FormData(u),Ad(n,{pending:!0,data:z,method:u.method,action:f},f,z))},currentTarget:u}]})}}for(var cf=0;cf<Rr.length;cf++){var uf=Rr[cf],ib=uf.toLowerCase(),sb=uf[0].toUpperCase()+uf.slice(1);Wn(ib,"on"+sb)}Wn(Zo,"onAnimationEnd"),Wn(ps,"onAnimationIteration"),Wn(gs,"onAnimationStart"),Wn("dblclick","onDoubleClick"),Wn("focusin","onFocus"),Wn("focusout","onBlur"),Wn(Wu,"onTransitionRun"),Wn(Ju,"onTransitionStart"),Wn(ed,"onTransitionCancel"),Wn(Wo,"onTransitionEnd"),kt("onMouseEnter",["mouseout","mouseover"]),kt("onMouseLeave",["mouseout","mouseover"]),kt("onPointerEnter",["pointerout","pointerover"]),kt("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 to="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(" "),rb=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(to));function dg(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],z=N.instance,X=N.currentTarget;if(N=N.listener,z!==f&&u.isPropagationStopped())break e;f=N,u.currentTarget=X;try{f(u)}catch(se){xs(se)}u.currentTarget=null,f=z}else for(b=0;b<i.length;b++){if(N=i[b],z=N.instance,X=N.currentTarget,N=N.listener,z!==f&&u.isPropagationStopped())break e;f=N,u.currentTarget=X;try{f(u)}catch(se){xs(se)}u.currentTarget=null,f=z}}}}function Ke(e,t){var n=t[$e];n===void 0&&(n=t[$e]=new Set);var i=e+"__bubble";n.has(i)||(fg(t,e,2,!1),n.add(i))}function df(e,t,n){var i=0;t&&(i|=4),fg(n,e,i,t)}var Hc="_reactListening"+Math.random().toString(36).slice(2);function ff(e){if(!e[Hc]){e[Hc]=!0,il.forEach(function(n){n!=="selectionchange"&&(rb.has(n)||df(n,!1,e),df(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Hc]||(t[Hc]=!0,df("selectionchange",!1,t))}}function fg(e,t,n,i){switch(Ug(t)){case 2:var u=_b;break;case 8:u=Ob;break;default:u=Af}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 mf(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 z=b.tag;if((z===3||z===4)&&b.stateNode.containerInfo===u)return;b=b.return}for(;N!==null;){if(b=Ut(N),b===null)return;if(z=b.tag,z===5||z===6||z===26||z===27){i=f=b;continue e}N=N.parentNode}}i=i.return}fr(function(){var X=f,se=ts(n),ue=[];e:{var W=Jo.get(e);if(W!==void 0){var te=Ea,Ne=e;switch(e){case"keypress":if(as(n)===0)break e;case"keydown":case"keyup":te=rs;break;case"focusin":Ne="focus",te=ol;break;case"focusout":Ne="blur",te=ol;break;case"beforeblur":case"afterblur":te=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":te=Ho;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":te=Pu;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":te=us;break;case Zo:case ps:case gs:te=is;break;case Wo:te=ga;break;case"scroll":case"scrollend":te=Bo;break;case"wheel":te=Go;break;case"copy":case"cut":case"paste":te=cl;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":te=os;break;case"toggle":case"beforetoggle":te=ds}var Be=(t&4)!==0,vt=!Be&&(e==="scroll"||e==="scrollend"),G=Be?W!==null?W+"Capture":null:W;Be=[];for(var H=X,Q;H!==null;){var ce=H;if(Q=ce.stateNode,ce=ce.tag,ce!==5&&ce!==26&&ce!==27||Q===null||G===null||(ce=zn(H,G),ce!=null&&Be.push(no(H,ce,Q))),vt)break;H=H.return}0<Be.length&&(W=new te(W,Ne,null,n,se),ue.push({event:W,listeners:Be}))}}if((t&7)===0){e:{if(W=e==="mouseover"||e==="pointerover",te=e==="mouseout"||e==="pointerout",W&&n!==es&&(Ne=n.relatedTarget||n.fromElement)&&(Ut(Ne)||Ne[Se]))break e;if((te||W)&&(W=se.window===se?se:(W=se.ownerDocument)?W.defaultView||W.parentWindow:window,te?(Ne=n.relatedTarget||n.toElement,te=X,Ne=Ne?Ut(Ne):null,Ne!==null&&(vt=d(Ne),Be=Ne.tag,Ne!==vt||Be!==5&&Be!==27&&Be!==6)&&(Ne=null)):(te=null,Ne=X),te!==Ne)){if(Be=Ho,ce="onMouseLeave",G="onMouseEnter",H="mouse",(e==="pointerout"||e==="pointerover")&&(Be=os,ce="onPointerLeave",G="onPointerEnter",H="pointer"),vt=te==null?W:wt(te),Q=Ne==null?W:wt(Ne),W=new Be(ce,H+"leave",te,n,se),W.target=vt,W.relatedTarget=Q,ce=null,Ut(se)===X&&(Be=new Be(G,H+"enter",Ne,n,se),Be.target=Q,Be.relatedTarget=vt,ce=Be),vt=ce,te&&Ne)t:{for(Be=ob,G=te,H=Ne,Q=0,ce=G;ce;ce=Be(ce))Q++;ce=0;for(var Re=H;Re;Re=Be(Re))ce++;for(;0<Q-ce;)G=Be(G),Q--;for(;0<ce-Q;)H=Be(H),ce--;for(;Q--;){if(G===H||H!==null&&G===H.alternate){Be=G;break t}G=Be(G),H=Be(H)}Be=null}else Be=null;te!==null&&mg(ue,W,te,Be,!1),Ne!==null&&vt!==null&&mg(ue,vt,Ne,Be,!0)}}e:{if(W=X?wt(X):window,te=W.nodeName&&W.nodeName.toLowerCase(),te==="select"||te==="input"&&W.type==="file")var nt=Ei;else if(Mr(W))if(Po)nt=Xu;else{nt=Jm;var Ae=Ku}else te=W.nodeName,!te||te.toLowerCase()!=="input"||W.type!=="checkbox"&&W.type!=="radio"?X&&ur(X.elementType)&&(nt=Ei):nt=Ar;if(nt&&(nt=nt(e,X))){jr(ue,nt,n,se);break e}Ae&&Ae(e,W,X),e==="focusout"&&X&&W.type==="number"&&X.memoizedProps.value!=null&&_l(W,"number",W.value)}switch(Ae=X?wt(X):window,e){case"focusin":(Mr(Ae)||Ae.contentEditable==="true")&&(Gl=Ae,Tr=X,zi=null);break;case"focusout":zi=Tr=Gl=null;break;case"mousedown":Er=!0;break;case"contextmenu":case"mouseup":case"dragend":Er=!1,Ko(ue,n,se);break;case"selectionchange":if(Zu)break;case"keydown":case"keyup":Ko(ue,n,se)}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?Sr(e,n)&&(Ze="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(Ze="onCompositionStart");Ze&&(br&&n.locale!=="ko"&&(ul||Ze!=="onCompositionStart"?Ze==="onCompositionEnd"&&ul&&(Pe=xn()):(Et=se,Fa="value"in Et?Et.value:Et.textContent,ul=!0)),Ae=Ic(X,Ze),0<Ae.length&&(Ze=new Fo(Ze,e,null,n,se),ue.push({event:Ze,listeners:Ae}),Pe?Ze.data=Pe:(Pe=fs(n),Pe!==null&&(Ze.data=Pe)))),(Pe=Ul?Vu(e,n):Cr(e,n))&&(Ze=Ic(X,"onBeforeInput"),0<Ze.length&&(Ae=new Fo("onBeforeInput","beforeinput",null,n,se),ue.push({event:Ae,listeners:Ze}),Ae.data=Pe)),lb(ue,e,X,n,se)}dg(ue,t)})}function no(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Ic(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(no(e,u,f)),u=zn(e,t),u!=null&&i.push(no(e,u,f))),e.tag===3)return i;e=e.return}return[]}function ob(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function mg(e,t,n,i,u){for(var f=t._reactName,b=[];n!==null&&n!==i;){var N=n,z=N.alternate,X=N.stateNode;if(N=N.tag,z!==null&&z===i)break;N!==5&&N!==26&&N!==27||X===null||(z=X,u?(X=zn(n,f),X!=null&&b.unshift(no(n,X,z))):u||(X=zn(n,f),X!=null&&b.push(no(n,X,z)))),n=n.return}b.length!==0&&e.push({event:t,listeners:b})}var cb=/\r\n?/g,ub=/\u0000|\uFFFD/g;function hg(e){return(typeof e=="string"?e:""+e).replace(cb,`
9
+ `).replace(ub,"")}function pg(e,t){return t=hg(t),hg(e)===t}function yt(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":cr(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"&&yt(e,t,"name",u.name,u,null),yt(e,t,"formEncType",u.formEncType,u,null),yt(e,t,"formMethod",u.formMethod,u,null),yt(e,t,"formTarget",u.formTarget,u,null)):(yt(e,t,"encType",u.encType,u,null),yt(e,t,"method",u.method,u,null),yt(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),Ia(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":Ia(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,Ia(e,n,i))}}function hf(e,t,n,i,u,f){switch(n){case"style":cr(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(!ka.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,""):Ia(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:yt(e,t,f,b,n,null)}}u&&yt(e,t,"srcSet",n.srcSet,n,null),i&&yt(e,t,"src",n.src,n,null);return;case"input":Ke("invalid",e);var N=f=b=u=null,z=null,X=null;for(i in n)if(n.hasOwnProperty(i)){var se=n[i];if(se!=null)switch(i){case"name":u=se;break;case"type":b=se;break;case"checked":z=se;break;case"defaultChecked":X=se;break;case"value":f=se;break;case"defaultValue":N=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(r(137,t));break;default:yt(e,t,i,se,n,null)}}Ji(e,f,N,z,X,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:yt(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:yt(e,t,b,N,n,null)}or(e,i,u,f);return;case"option":for(z in n)n.hasOwnProperty(z)&&(i=n[z],i!=null)&&(z==="selected"?e.selected=i&&typeof i!="function"&&typeof i!="symbol":yt(e,t,z,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<to.length;i++)Ke(to[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(X in n)if(n.hasOwnProperty(X)&&(i=n[X],i!=null))switch(X){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:yt(e,t,X,i,n,null)}return;default:if(ur(t)){for(se in n)n.hasOwnProperty(se)&&(i=n[se],i!==void 0&&hf(e,t,se,i,n,void 0));return}}for(N in n)n.hasOwnProperty(N)&&(i=n[N],i!=null&&yt(e,t,N,i,n,null))}function db(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,z=null,X=null,se=null;for(te in n){var ue=n[te];if(n.hasOwnProperty(te)&&ue!=null)switch(te){case"checked":break;case"value":break;case"defaultValue":z=ue;default:i.hasOwnProperty(te)||yt(e,t,te,null,i,ue)}}for(var W in i){var te=i[W];if(ue=n[W],i.hasOwnProperty(W)&&(te!=null||ue!=null))switch(W){case"type":f=te;break;case"name":u=te;break;case"checked":X=te;break;case"defaultChecked":se=te;break;case"value":b=te;break;case"defaultValue":N=te;break;case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(r(137,t));break;default:te!==ue&&yt(e,t,W,te,i,ue)}}sl(e,b,N,z,X,se,f,u);return;case"select":te=b=N=W=null;for(f in n)if(z=n[f],n.hasOwnProperty(f)&&z!=null)switch(f){case"value":break;case"multiple":te=z;default:i.hasOwnProperty(f)||yt(e,t,f,null,i,z)}for(u in i)if(f=i[u],z=n[u],i.hasOwnProperty(u)&&(f!=null||z!=null))switch(u){case"value":W=f;break;case"defaultValue":N=f;break;case"multiple":b=f;default:f!==z&&yt(e,t,u,f,i,z)}t=N,n=b,i=te,W!=null?Xn(e,!!n,W,!1):!!i!=!!n&&(t!=null?Xn(e,!!n,t,!0):Xn(e,!!n,n?[]:"",!1));return;case"textarea":te=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:yt(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":te=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(r(91));break;default:u!==f&&yt(e,t,b,u,i,f)}fa(e,W,te);return;case"option":for(var Ne in n)W=n[Ne],n.hasOwnProperty(Ne)&&W!=null&&!i.hasOwnProperty(Ne)&&(Ne==="selected"?e.selected=!1:yt(e,t,Ne,null,i,W));for(z in i)W=i[z],te=n[z],i.hasOwnProperty(z)&&W!==te&&(W!=null||te!=null)&&(z==="selected"?e.selected=W&&typeof W!="function"&&typeof W!="symbol":yt(e,t,z,W,i,te));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)&&yt(e,t,Be,null,i,W);for(X in i)if(W=i[X],te=n[X],i.hasOwnProperty(X)&&W!==te&&(W!=null||te!=null))switch(X){case"children":case"dangerouslySetInnerHTML":if(W!=null)throw Error(r(137,t));break;default:yt(e,t,X,W,i,te)}return;default:if(ur(t)){for(var vt in n)W=n[vt],n.hasOwnProperty(vt)&&W!==void 0&&!i.hasOwnProperty(vt)&&hf(e,t,vt,void 0,i,W);for(se in i)W=i[se],te=n[se],!i.hasOwnProperty(se)||W===te||W===void 0&&te===void 0||hf(e,t,se,W,i,te);return}}for(var G in n)W=n[G],n.hasOwnProperty(G)&&W!=null&&!i.hasOwnProperty(G)&&yt(e,t,G,null,i,W);for(ue in i)W=i[ue],te=n[ue],!i.hasOwnProperty(ue)||W===te||W==null&&te==null||yt(e,t,ue,W,i,te)}function gg(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function fb(){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&&gg(b)){for(b=0,N=u.responseEnd,i+=1;i<n.length;i++){var z=n[i],X=z.startTime;if(X>N)break;var se=z.transferSize,ue=z.initiatorType;se&&gg(ue)&&(z=z.responseEnd,b+=se*(z<N?1:(N-X)/(z-X)))}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 pf=null,gf=null;function Fc(e){return e.nodeType===9?e:e.ownerDocument}function xg(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 yg(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 xf(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 yf=null;function mb(){var e=window.event;return e&&e.type==="popstate"?e===yf?!1:(yf=e,!0):(yf=null,!1)}var vg=typeof setTimeout=="function"?setTimeout:void 0,hb=typeof clearTimeout=="function"?clearTimeout:void 0,bg=typeof Promise=="function"?Promise:void 0,pb=typeof queueMicrotask=="function"?queueMicrotask:typeof bg<"u"?function(e){return bg.resolve(null).then(e).catch(gb)}:vg;function gb(e){setTimeout(function(){throw e})}function ui(e){return e==="head"}function wg(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")ao(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,ao(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"&&ao(e.ownerDocument.body);n=u}while(n);Ys(t)}function Sg(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 vf(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":vf(n),ln(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function xb(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 yb(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 Cg(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 bf(e){return e.data==="$?"||e.data==="$~"}function wf(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function vb(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 Sf=null;function Mg(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 jg(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 Ng(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 ao(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);ln(e)}var wa=new Map,Ag=new Set;function Uc(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var kl=Z.d;Z.d={f:bb,r:wb,D:Sb,C:Cb,L:Mb,m:jb,X:Ab,S:Nb,M:kb};function bb(){var e=kl.f(),t=Rc();return e||t}function wb(e){var t=Jt(e);t!==null&&t.tag===5&&t.type==="form"?Gh(t):kl.r(e)}var qs=typeof document>"u"?null:document;function kg(e,t,n){var i=qs;if(i&&typeof t=="string"&&t){var u=Tt(t);u='link[rel="'+e+'"][href="'+u+'"]',typeof n=="string"&&(u+='[crossorigin="'+n+'"]'),Ag.has(u)||(Ag.add(u),e={rel:e,crossOrigin:n,href:t},i.querySelector(u)===null&&(t=i.createElement("link"),dn(t,"link",e),Ct(t),i.head.appendChild(t)))}}function Sb(e){kl.D(e),kg("dns-prefetch",e,null)}function Cb(e,t){kl.C(e,t),kg("preconnect",e,t)}function Mb(e,t,n){kl.L(e,t,n);var i=qs;if(i&&e&&t){var u='link[rel="preload"][as="'+Tt(t)+'"]';t==="image"&&n&&n.imageSrcSet?(u+='[imagesrcset="'+Tt(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(u+='[imagesizes="'+Tt(n.imageSizes)+'"]')):u+='[href="'+Tt(e)+'"]';var f=u;switch(t){case"style":f=Gs(e);break;case"script":f=Ps(e)}wa.has(f)||(e=y({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(lo(f))||t==="script"&&i.querySelector(io(f))||(t=i.createElement("link"),dn(t,"link",e),Ct(t),i.head.appendChild(t)))}}function jb(e,t){kl.m(e,t);var n=qs;if(n&&e){var i=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+Tt(i)+'"][href="'+Tt(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=y({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(io(f)))return}i=n.createElement("link"),dn(i,"link",e),Ct(i),n.head.appendChild(i)}}}function Nb(e,t,n){kl.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(lo(f)))N.loading=5;else{e=y({rel:"stylesheet",href:e,"data-precedence":t},n),(n=wa.get(f))&&Cf(e,n);var z=b=i.createElement("link");Ct(z),dn(z,"link",e),z._p=new Promise(function(X,se){z.onload=X,z.onerror=se}),z.addEventListener("load",function(){N.loading|=1}),z.addEventListener("error",function(){N.loading|=2}),N.loading|=4,$c(b,t,i)}b={type:"stylesheet",instance:b,count:1,state:N},u.set(f,b)}}}function Ab(e,t){kl.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(io(u)),f||(e=y({src:e,async:!0},t),(t=wa.get(u))&&Mf(e,t),f=n.createElement("script"),Ct(f),dn(f,"link",e),n.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},i.set(u,f))}}function kb(e,t){kl.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(io(u)),f||(e=y({src:e,async:!0,type:"module"},t),(t=wa.get(u))&&Mf(e,t),f=n.createElement("script"),Ct(f),dn(f,"link",e),n.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},i.set(u,f))}}function Tg(e,t,n,i){var u=(u=Ie.current)?Uc(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(lo(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||Tb(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="'+Tt(e)+'"'}function lo(e){return'link[rel="stylesheet"]['+e+"]"}function Eg(e){return y({},e,{"data-precedence":e.precedence,precedence:null})}function Tb(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),Ct(t),e.head.appendChild(t))}function Ps(e){return'[src="'+Tt(e)+'"]'}function io(e){return"script[async]"+e}function Dg(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var i=e.querySelector('style[data-href~="'+Tt(n.href)+'"]');if(i)return t.instance=i,Ct(i),i;var u=y({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),Ct(i),dn(i,"style",u),$c(i,n.precedence,e),t.instance=i;case"stylesheet":u=Gs(n.href);var f=e.querySelector(lo(u));if(f)return t.state.loading|=4,t.instance=f,Ct(f),f;i=Eg(n),(u=wa.get(u))&&Cf(i,u),f=(e.ownerDocument||e).createElement("link"),Ct(f);var b=f;return b._p=new Promise(function(N,z){b.onload=N,b.onerror=z}),dn(f,"link",i),t.state.loading|=4,$c(f,n.precedence,e),t.instance=f;case"script":return f=Ps(n.src),(u=e.querySelector(io(f)))?(t.instance=u,Ct(u),u):(i=n,(u=wa.get(f))&&(i=y({},n),Mf(i,u)),e=e.ownerDocument||e,u=e.createElement("script"),Ct(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,$c(i,n.precedence,e));return t.instance}function $c(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 Cf(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Mf(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var qc=null;function Rg(e,t,n){if(qc===null){var i=new Map,u=qc=new Map;u.set(n,i)}else u=qc,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[P]||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 Lg(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function Eb(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 zg(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Db(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(lo(u));if(f){t=f._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Gc.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=f,Ct(f);return}f=t.ownerDocument||t,i=Eg(i),(u=wa.get(u))&&Cf(i,u),f=f.createElement("link"),Ct(f);var b=f;b._p=new Promise(function(N,z){b.onload=N,b.onerror=z}),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=Gc.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var jf=0;function Rb(e,t){return e.stylesheets&&e.count===0&&Yc(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var i=setTimeout(function(){if(e.stylesheets&&Yc(e,e.stylesheets),e.unsuspend){var f=e.unsuspend;e.unsuspend=null,f()}},6e4+t);0<e.imgBytes&&jf===0&&(jf=62500*fb());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Yc(e,e.stylesheets),e.unsuspend)){var f=e.unsuspend;e.unsuspend=null,f()}},(e.imgBytes>jf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(u)}}:null}function Gc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Yc(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Pc=null;function Yc(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Pc=new Map,t.forEach(Lb,e),Pc=null,Gc.call(e))}function Lb(e,t){if(!(t.state.loading&4)){var n=Pc.get(e);if(n)var i=n.get(null);else{n=new Map,Pc.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=Gc.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 so={$$typeof:L,Provider:null,Consumer:null,_currentValue:ne,_currentValue2:ne,_threadCount:0};function zb(e,t,n,i,u,f,b,N,z){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=z,this.incompleteTransitions=new Map}function _g(e,t,n,i,u,f,b,N,z,X,se,ue){return e=new zb(e,t,n,b,z,X,se,ue,N),t=1,f===!0&&(t|=24),f=yn(3,null,null,t),e.current=f,f.stateNode=e,t=ad(),t.refCount++,e.pooledCache=t,t.refCount++,f.memoizedState={element:i,isDehydrated:n,cache:t},rd(f),e}function Og(e){return e?(e=Lt,e):Lt}function Bg(e,t,n,i,u,f){u=Og(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),Hr(n,e,t))}function Hg(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Nf(e,t){Hg(e,t),(e=e.alternate)&&Hg(e,t)}function Ig(e){if(e.tag===13||e.tag===31){var t=xa(e,67108864);t!==null&&Un(t,e,67108864),Nf(e,67108864)}}function Fg(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),Nf(e,t)}}var Vc=!0;function _b(e,t,n,i){var u=I.T;I.T=null;var f=Z.p;try{Z.p=2,Af(e,t,n,i)}finally{Z.p=f,I.T=u}}function Ob(e,t,n,i){var u=I.T;I.T=null;var f=Z.p;try{Z.p=8,Af(e,t,n,i)}finally{Z.p=f,I.T=u}}function Af(e,t,n,i){if(Vc){var u=kf(i);if(u===null)mf(e,t,i,Qc,n),$g(e,i);else if(Hb(u,e,t,n,i))i.stopPropagation();else if($g(e,i),t&4&&-1<Bb.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=kn(f.pendingLanes);if(b!==0){var N=f;for(N.pendingLanes|=2,N.entangledLanes|=2;b;){var z=1<<31-Ot(b);N.entanglements[1]|=z,b&=~z}Ka(f),(ot&6)===0&&(Ec=ze()+500,eo(0))}}break;case 31:case 13:N=xa(f,2),N!==null&&Un(N,f,2),Rc(),Nf(f,2)}if(f=kf(i),f===null&&mf(e,t,i,Qc,n),f===u)break;u=f}u!==null&&i.stopPropagation()}else mf(e,t,i,null,n)}}function kf(e){return e=ts(e),Tf(e)}var Qc=null;function Tf(e){if(Qc=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 Qc=e,null}function Ug(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 Cn:return 2;case it:return 8;case Nn:case ja:return 32;case Na:return 268435456;default:return 32}default:return 32}}var Ef=!1,di=null,fi=null,mi=null,ro=new Map,oo=new Map,hi=[],Bb="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 $g(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":ro.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":oo.delete(t.pointerId)}}function co(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&&Ig(t)),e):(e.eventSystemFlags|=i,t=e.targetContainers,u!==null&&t.indexOf(u)===-1&&t.push(u),e)}function Hb(e,t,n,i,u){switch(t){case"focusin":return di=co(di,e,t,n,i,u),!0;case"dragenter":return fi=co(fi,e,t,n,i,u),!0;case"mouseover":return mi=co(mi,e,t,n,i,u),!0;case"pointerover":var f=u.pointerId;return ro.set(f,co(ro.get(f)||null,e,t,n,i,u)),!0;case"gotpointercapture":return f=u.pointerId,oo.set(f,co(oo.get(f)||null,e,t,n,i,u)),!0}return!1}function qg(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(){Fg(n)});return}}else if(t===31){if(t=p(n),t!==null){e.blockedOn=t,wi(e.priority,function(){Fg(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 Kc(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=kf(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&&Ig(t),e.blockedOn=n,!1;t.shift()}return!0}function Gg(e,t,n){Kc(e)&&n.delete(t)}function Ib(){Ef=!1,di!==null&&Kc(di)&&(di=null),fi!==null&&Kc(fi)&&(fi=null),mi!==null&&Kc(mi)&&(mi=null),ro.forEach(Gg),oo.forEach(Gg)}function Xc(e,t){e.blockedOn===t&&(e.blockedOn=null,Ef||(Ef=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,Ib)))}var Zc=null;function Pg(e){Zc!==e&&(Zc=e,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){Zc===e&&(Zc=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(Tf(i||n)===null)continue;break}var f=Jt(n);f!==null&&(e.splice(t,3),t-=3,Ad(f,{pending:!0,data:u,method:n.method,action:i},i,u))}}))}function Ys(e){function t(z){return Xc(z,e)}di!==null&&Xc(di,e),fi!==null&&Xc(fi,e),mi!==null&&Xc(mi,e),ro.forEach(t),oo.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);)qg(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||Pg(n);else if(b){var N=null;if(f&&f.hasAttribute("formAction")){if(u=f,b=f[he]||null)N=b.formAction;else if(Tf(u)!==null)continue}else N=b.action;typeof N=="function"?n[i+1]=N:(n.splice(i,3),i-=3),Pg(n)}}}function Yg(){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 Df(e){this._internalRoot=e}Wc.prototype.render=Df.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));var n=t.current,i=aa();Bg(n,i,e,t,null,null)},Wc.prototype.unmount=Df.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Bg(e.current,2,null,e,null,null),Rc(),t[Se]=null}};function Wc(e){this._internalRoot=e}Wc.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&&qg(e)}};var Vg=l.version;if(Vg!=="19.2.7")throw Error(r(527,Vg,"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?v(e):null,e=e===null?null:e.stateNode,e};var Fb={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:I,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Jc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Jc.isDisabled&&Jc.supportsFiber)try{Qn=Jc.inject(Fb),ut=Jc}catch{}}return fo.createRoot=function(e,t){if(!c(e))throw Error(r(299));var n=!1,i="",u=ep,f=tp,b=np;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=_g(e,1,!1,null,null,n,i,null,u,f,b,Yg),e[Se]=t.current,ff(e),new Df(t)},fo.hydrateRoot=function(e,t,n){if(!c(e))throw Error(r(299));var i=!1,u="",f=ep,b=tp,N=np,z=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&&(z=n.formState)),t=_g(e,1,!0,t,n??null,i,u,z,f,b,N,Yg),t.context=Og(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,ff(e),new Wc(t)},fo.version="19.2.7",fo}var ix;function gw(){if(ix)return _f.exports;ix=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(),_f.exports=pw(),_f.exports}var xw=gw();const yw="https://otbyfkjxrkngvjziawki.supabase.co",vw="sb_publishable_NpUs0RDJH2YnllsqTKO6TQ_1jTdSsNQ",Za=uw(yw,vw,{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 Hf(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 eu(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 bw(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 by(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,eu(a,r,s,h),c=4}else a[r.inputIndex]>=18&&(c=a[r.inputIndex]-17,r.inputIndex+=1,eu(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+=Hf(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+=Hf(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+=Hf(a,r,15)),eu(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=bw(s,r.outputIndex,g,d),c=p,eu(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 sx=16,rx=8,ww=24*1024*1024,wy=new Uint8Array(new Uint32Array([16909060]).buffer)[0]===4,mm=new Uint32Array(65536);for(let a=0;a<mm.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);mm[a]=wy?(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 Sw(a,l){const s=Number(l);if(!Number.isSafeInteger(s)||s<sx||s>ww)throw new Error(`Invalid Mode 5 packet length: ${l}.`);const r=by(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 v=sx;for(let y=0;y<g;y+=1){if(v+rx>r.length)throw new Error("Mode 5 tile header is truncated.");const w=gi(r,v),C=gi(r,v+2),j=gi(r,v+4),M=gi(r,v+6);v+=rx;const T=j*M*2;if(j<=0||M<=0||j>p||M>p||w+j>d||C+M>h||v+T>r.length)throw new Error(`Invalid Mode 5 tile ${y}.`);x.push({x:w,y:C,width:j,height:M,pixels:r.subarray(v,v+T)}),v+=T}if(v!==r.length)throw new Error(`Mode 5 packet has ${r.length-v} trailing bytes.`);return{keyFrame:c,width:d,height:h,tileSize:p,tiles:x}}function Cw(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 v=wy&&(x.pixels.byteOffset&1)===0?new Uint16Array(x.pixels.buffer,x.pixels.byteOffset,x.pixels.byteLength>>>1):null;let y=0;for(let w=0;w<x.height;w+=1){let C=(x.y+w)*l+x.x;for(let j=0;j<x.width;j+=1){const M=y<<1,T=v?v[y]:x.pixels[M]|x.pixels[M+1]<<8;g[C]=mm[T],y+=1,C+=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,ko=new WeakMap,hm=new WeakMap,To=new Set,Qi=new Set,ju=new WeakMap,pm=new WeakMap,gm=new WeakMap,Nu=new WeakMap,zm=32,Mw=2,jw=2,Nw=2,Aw=18,kw=40,Tw=0,Ew=750,Sy=80,ox=5,Dw=150,Rw=24,Lw=180,zw=1200,_w=18,Ow=.65,Bw=2e3,Hw=500,Cy=250;let Au=!1;function Iw(){return typeof navigator>"u"?!1:/mac/i.test(`${navigator.platform||""} ${navigator.userAgent||""}`)}function Fw(){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:Fw()};function Uw(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 My(a,l=Ki.h264DecodeAcceleration){const s=ju.get(a);return s?.requested===l?(s.actual!=="prefer-hardware"&&Qi.delete(a),s.actual):(s&&ju.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 zu(a,l){return l!=="prefer-hardware"?!1:(ju.set(a,{requested:l,actual:"prefer-software"}),Qi.delete(a),!0)}function $w(a,l,s,r=64){try{let c=pm.get(a);c||(c={canvas:document.createElement("canvas"),lastHash:"",initialized:!1},pm.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 v=(x>>>0).toString(16).padStart(8,"0"),y=!c.initialized||v!==c.lastHash;return c.initialized=!0,c.lastHash=v,{visualHash:v,visualChanged:y}}catch{return{visualHash:"",visualChanged:!0}}}function xm(a,l,s,r=Cy,c=64){let d=gm.get(a);d||(d={lastHash:"",initialized:!1,lastCanvasSampleAt:0},gm.set(a,d));const h=performance.now();if(d.initialized&&r>0&&h-d.lastCanvasSampleAt<r)return{visualHash:d.lastHash,visualChanged:!1};const p=$w(a,l,s,c);return d.initialized=!0,d.lastHash=p.visualHash,d.lastCanvasSampleAt=h,p}function qw(a,l){let s=Nu.get(a);s||(s={lastHash:"",initialized:!1},Nu.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 jy(a,l){const s=hm.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 hm.set(a,d),d}return null}function Gw(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 Pw(a){return String(a.frameMode||a.mode||"").toLowerCase()==="mode3-h264-hw"||String(a.codec||"").toLowerCase()==="h264"||String(a.mimeType||"").toLowerCase()==="video/h264"}function Yw(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 cx(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 Vw(a,l){const s=new Uint8Array(l);let r=0,c=0;for(;r<a.length;){const d=a[r];r+=1;const h=cx(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=cx(a,r,d&15);r=x.cursor;const v=x.length+4;if(c+v>s.length)throw new Error("Invalid LZ4 block: match overrun.");let y=c-g;for(let w=0;w<v;w+=1)s[c]=s[y],c+=1,y+=1}if(c!==s.length)throw new Error("Invalid LZ4 block: incomplete output.");return s}function Qw(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 v=Math.max(1,Math.floor(a.bytesPerPixel||2)),y=l*s*2,w=Math.floor(a.uncompressedByteLength||y);if(v!==2||w!==y)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 C=by(new Uint8Array(a.payload),y),j=new Uint8ClampedArray(l*s*4);for(let M=0,T=0;M<C.length;M+=2,T+=4){const k=C[M]|C[M+1]<<8,A=k>>11&31,L=k>>5&63,q=k&31;j[T]=A<<3|A>>2,j[T+1]=L<<2|L>>4,j[T+2]=q<<3|q>>2,j[T+3]=255}return new ImageData(j,l,s)}const h=Math.max(1,Math.floor(a.bytesPerPixel||4)),p=Math.max(l*s*h,Math.floor(a.uncompressedByteLength||0)),g=Vw(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 v=0,y=0;y<x.length;v+=4,y+=4)x[y]=g[v+2],x[y+1]=g[v+1],x[y+2]=g[v],x[y+3]=g[v+3];return new ImageData(x,l,s)}function ux(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 j=c.pendingFrames.entries().next().value;j&&(c.pendingFrames.delete(j[0]),g=j[1],c.timestampFallbacks+=1)}const x=h.displayWidth||h.codedWidth||a.width||960,v=h.displayHeight||h.codedHeight||a.height||540,y=Number(g?.frame.durationUs||0),w=Number(h.duration||0),C=Math.max(16,Math.min(250,(y>0?y:w||83333)/1e3));for(c.targetPaintIntervalMs=C,c.decodedFrames.push({videoFrame:h,pending:g,decodedAt:performance.now(),width:x,height:v,durationMs:C}),c.lastOutputAt=performance.now();c.decodedFrames.length>Ny(c);)ku(c,c.decodedFrames.shift());Ay(c),c.renderTimer!==null&&c.renderScheduledAt>0&&performance.now()-c.renderScheduledAt>Hw&&(typeof document>"u"||document.visibilityState==="visible")&&(window.cancelAnimationFrame(c.renderTimer),c.renderTimer=null,c.renderScheduledAt=0),c.renderTimer!==null&&c.decodedFrames.length>=zm&&(window.cancelAnimationFrame(c.renderTimer),c.renderTimer=null,c.renderScheduledAt=0),Tu(a,c)},error:()=>{Yn.get(a)===c&&(zu(a,c.hardwareAcceleration),_m(c),To.delete(a),Yn.delete(a))}}),configured:!1,configKey:"",hardwareAcceleration:My(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 _m(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 ku(a,l){l&&(l.videoFrame.close(),a.droppedForLatency+=1)}function Ny(a){return a.latencyMode==="interactive"?jw:String(a.decodedFrames[0]?.pending?.frame.frameMode||a.decodedFrames[0]?.pending?.frame.mode||"").toLowerCase()==="mode4-h264-atlas"?Mw:zm}function Ay(a,l=performance.now()){const s=Ny(a);for(;a.decodedFrames.length>s;)ku(a,a.decodedFrames.shift());const r=a.latencyMode==="interactive"?Sy:Ew;let c=a.decodedFrames[0];for(;a.decodedFrames.length>1&&c?.pending&&l-c.pending.queuedAt>r;)ku(a,a.decodedFrames.shift()),c=a.decodedFrames[0]}function ky(a,l){if(l.hardwareAcceleration!=="prefer-hardware"||l.flushTimer!==null||l.flushInFlight)return;const s=l.latencyMode==="interactive"?Rw:Dw,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>Bw&&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&&xu(l)}finally{l.flushInFlight=!1;const p=performance.now()-h;if(r&&p>=Lw&&l.hardwareAcceleration==="prefer-hardware"){Au=!0,zu(a,l.hardwareAcceleration),Oa(a);return}Yn.get(a)===l&&l.inputSerial>d&&l.pendingFrames.size>0&&(r||performance.now()-l.lastOutputAt>=s)&&ky(a,l)}},s)}function dx(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=jy(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"?qw(a,s.pending.frame):xm(a,s.width,s.height,Cy,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 Tu(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(Ay(l,c),l.decodedFrames.length===0)return;if(l.latencyMode==="interactive"){const g=l.targetPaintIntervalMs<=kw,x=l.targetPaintIntervalMs<=20;if(x&&!l.interactiveBufferPrimed){l.interactiveBufferStartedAt<=0&&(l.interactiveBufferStartedAt=c,l.interactiveBufferWaitCount+=1);const M=l.decodedFrames.length>=Nw,T=c-l.interactiveBufferStartedAt>=Aw;if(!M&&!T){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 v=l.decodedFrames[0],y=v?.pending?Math.max(0,c-v.pending.queuedAt):0,w=l.lastPaintAt>0?l.lastPaintAt+s:c;if(!(!g||c+ox>=w||y>=Sy)){l.renderScheduledAt=performance.now(),l.renderTimer=window.requestAnimationFrame(r);return}const j=l.decodedFrames.shift();if(j)try{dx(a,l,j)}catch{}l.decodedFrames.length===0&&(l.interactiveQueueDrainCount+=1,l.interactiveBufferPrimed=!1,l.interactiveBufferStartedAt=0),Tu(a,l);return}const d=l.lastPaintAt>0?l.lastPaintAt+s:c+Tw;if(!(c+ox>=d||l.decodedFrames.length>=zm-1)){l.renderScheduledAt=performance.now(),l.renderTimer=window.requestAnimationFrame(r);return}const p=l.decodedFrames.shift();if(p)try{dx(a,l,p)}catch{}Tu(a,l)};l.renderScheduledAt=performance.now(),l.renderTimer=window.requestAnimationFrame(r)}function Ty(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;)ku(l,l.decodedFrames.shift());return l.lastPaintAt=0,l.interactiveBufferPrimed=!1,l.interactiveBufferStartedAt=0,Tu(a,l),!0}function If(){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}Ty(a,l)}}typeof document<"u"&&typeof window<"u"&&(document.addEventListener("visibilitychange",If),window.addEventListener("focus",If),window.addEventListener("pageshow",If));function Oa(a){Qi.delete(a),To.delete(a),Nu.delete(a);const l=Yn.get(a);if(l){Yn.delete(a);try{_m(l),l.decoder.state!=="closed"&&l.decoder.close()}catch{}}}function Ff(a){a&&(ju.delete(a),hm.delete(a),gm.delete(a),pm.delete(a),Nu.delete(a),ko.delete(a),Oa(a))}function xu(a,l=1){try{a.decoder.state!=="closed"&&a.decoder.reset()}catch{}a.configured=!1,a.configKey="",a.keyFrameSeen=!1,a.pendingFrames.clear(),_m(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 tu(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 Kw(a,l){if(l.latencyMode!=="interactive"||l.hardwareAcceleration!=="prefer-hardware")return!1;const s=performance.now();if(s-l.healthSampleStartedAt<zw)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<_w||c/Math.max(1,r)>=Ow?!1:(Au=!0,zu(a,l.hardwareAcceleration),Oa(a),!0)}function fx(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 Xw(a){if(!a)return!1;const l=Yn.get(a);return l?Ty(a,l):!1}function Zw(a,l,s,r="interactive"){Oa(a);const c=performance.now(),d=Sw(l.payload,l.uncompressedByteLength||0),h=String(l.streamId||"mode5");let p=ko.get(a);if(!p||p.streamId!==h||p.width!==d.width||p.height!==d.height){const M=new Uint8ClampedArray(d.width*d.height*4);for(let T=3;T<M.length;T+=4)M[T]=255;p={streamId:h,width:d.width,height:d.height,rgba:M,imageData:new ImageData(M,d.width,d.height),keyFrameSeen:!1,inputSerial:0,outputSerial:0},ko.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 v=Cw(p.rgba,p.width,p.height,d),y=performance.now();(a.width!==p.width||a.height!==p.height)&&(a.width=p.width,a.height=p.height);const w=jy(a,r),C=performance.now();v&&w?.context.putImageData(p.imageData,0,0,v.x,v.y,v.width,v.height);const j=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,j-c),decodedForMs:Math.max(0,y-c),scheduledForMs:0,drawMs:Math.max(0,j-C),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:j})}function Ww(a,l,s,r,c="smooth"){ko.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"&&Iw(),y=g==="mode4-h264-atlas"?"prefer-software":My(a,c==="interactive"&&(Au||x)?"prefer-software":r),w=[l.streamId||"",l.commandId||"",h,p,d,y,c].join("|");let C=ux(a,c);C.onPaint=s,C.configured&&C.decoder.state!=="configured"&&(C.configured=!1,C.configKey=""),C.configured&&C.configKey!==w&&(Oa(a),C=ux(a,c),C.onPaint=s);const j={codec:"avc1.42E01E",codedWidth:h,codedHeight:p,hardwareAcceleration:y,optimizeForLatency:!0,avc:{format:d}};C.configured||tu(C,j,w,y);const M=l.isKeyFrame===!0||String(l.chunkType||"").toLowerCase()==="key";Number(l.frameSeq||0);const T=Number(l.streamFrameSeq||0);if(T>0&&C.lastInputFrameSeq!==void 0){if(T<=C.lastInputFrameSeq){if(!M||T===C.lastInputFrameSeq)return;xu(C,C.lastInputFrameSeq-T+1),tu(C,j,w,y)}if(T>C.lastInputFrameSeq+1){if(xu(C,T-C.lastInputFrameSeq-1),!M)return;tu(C,j,w,y)}}if(T>0&&(C.lastInputFrameSeq=T),!M&&!C.keyFrameSeen)return;M&&(C.keyFrameSeen=!0);const k=Number(C.decoder.decodeQueueSize||0);if(k>8){if(C.latencyMode==="interactive"&&C.hardwareAcceleration==="prefer-hardware"){Au=!0,zu(a,C.hardwareAcceleration),Oa(a);return}if(xu(C),!M)return;tu(C,j,w,y),C.keyFrameSeen=!0}const A=Math.max(1,Math.floor(l.durationUs||1e6/12)),L=C.nextChunkTimestampUs;C.nextChunkTimestampUs+=A,C.pendingFrames.set(L,{frame:l,queuedAt:performance.now(),queueSize:k}),C.inputSerial+=1,C.lastInputAt=performance.now();const q=new EncodedVideoChunk({type:M?"key":"delta",timestamp:L,duration:A,data:l.payload});try{C.decoder.decode(q)}catch(D){throw Oa(a),D}ky(a,C),Kw(a,C)}async function Uf(a,l,s,r,c,d="smooth"){if(Yw(l)){s()||Zw(a,l,r,d);return}if(Pw(l)){s()||Ww(a,l,r,c,d);return}if(ko.delete(a),Gw(l)){Oa(a);const y=Qw(l);if(s())return;(a.width!==y.width||a.height!==y.height)&&(a.width=y.width,a.height=y.height);const w=a.getContext("2d"),C=performance.now();w?.putImageData(y,0,0);const j=performance.now(),M=xm(a,y.width,y.height);r?.(l,{deviceId:l.deviceId,frameSeq:l.frameSeq,mode:l.frameMode||l.mode||l.codec||l.mimeType,width:y.width,height:y.height,byteLength:l.byteLength,queuedForMs:0,decodedForMs:0,scheduledForMs:0,drawMs:Math.max(0,j-C),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:M.visualHash,visualChanged:M.visualChanged,paintedAt:j});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 v=a.getContext("2d");if(v){const y=performance.now();v.clearRect(0,0,g,x),v.drawImage(p,0,0,g,x);const w=performance.now(),C=xm(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-y),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:C.visualHash,visualChanged:C.visualChanged,paintedAt:w})}p.close()}const wo=5179,mn=Ro(`http://127.0.0.1:${wo}`);function Jw(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 e0(a){const l=a.trim().toLowerCase();return l==="localhost"||l==="127.0.0.1"||l==="::1"||l==="[::1]"}function t0(a){const l=a.trim().toLowerCase();return!l||l==="0.0.0.0"||l==="::"||l==="[::]"}function n0(a){const l=Jw(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 a0(a){return a.includes(":")&&!a.startsWith("[")?`[${a}]`:a}function l0(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||t0(c)?null:{host:c,port:d}}catch{return null}}function Ro(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 i0(a){const l=l0(a);return l?Ro(`http://${a0(l.host)}:${wo}`):""}function mx(a){const s=[a?.endpoint,...Array.isArray(a?.endpoint_candidates)?a.endpoint_candidates:[]].map(r=>i0(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(e0(l.hostname))return"loopback";if(n0(l.hostname))return"local"}catch{return}}function _u(a,l=mn){const s=new URL(a,Ro(l));return s.protocol=s.protocol==="https:"?"wss:":"ws:",s.toString()}async function ct(a,l,s=mn){const r=Ro(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 ym(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 hx="livedesk_remote_host_targets",s0="livedesk_entitlements";function r0(a){const s=(Array.isArray(a)?a:[a||mn]).map(r=>Ro(r||mn));return[...new Set(s.filter(Boolean))]}function o0(){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 c0(a,l=!0){const[s,r]=m.useState(null),[c,d]=m.useState([]),[h,p]=m.useState(""),[g,x]=m.useState(""),[v,y]=m.useState(0),w=m.useRef(new Map),C=Array.isArray(a)?a.join(`
10
+ `):String(a||""),j=m.useMemo(()=>r0(a),[C]),M=m.useMemo(()=>j.find(A=>So(A)==="loopback")||j[0]||mn,[j]),T=m.useCallback(async()=>{if(!l){r(null),d([]),x(""),p("");return}let A=null;const L=Date.now(),q=j.filter(D=>(w.current.get(D)||0)<=L);if(q.length===0)throw new Error("No LiveDesk Hub endpoint is reachable. Retrying shortly.");for(const D of q)try{const[$,E]=await Promise.all([ct("/api/remote/status",void 0,D),ct("/api/remote/devices",void 0,D)]);if(!Array.isArray(E.devices))throw new Error("Invalid Hub devices response.");w.current.delete(D),r($),d(E.devices),x(D),p("");return}catch($){A=$,w.current.set(D,Date.now()+1e4)}throw x(""),A||new Error("No LiveDesk Hub endpoint is reachable.")},[l,j]),k=m.useCallback(()=>{w.current.clear(),T().catch(A=>{p(A instanceof Error?A.message:String(A))}),y(A=>A+1)},[T]);return m.useEffect(()=>{if(!l){r(null),d([]),x(""),p("");return}let A=!0;const L=async()=>{try{await T()}catch(D){A&&p(D instanceof Error?D.message:String(D))}};L();const q=window.setInterval(L,2500);return()=>{A=!1,window.clearInterval(q)}},[l,T,v]),{status:s,devices:c,error:h,refresh:k,hubBaseUrl:g||M,hubCandidates:j}}function u0(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(hx).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:hx,filter:`user_id=eq.${d}`},g=>s(g.new)).subscribe();return()=>{Za.removeChannel(p)}},[d]),{target:l,error:r,refresh:h}}function d0(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:v,error:y}=await Za.from(s0).select("*").eq("user_id",p).eq("product_key","livedesk").maybeSingle();if(y){h(y.message),c(!1);return}s(v),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 Co={totalFrames:0,totalBytes:0,framesPerSecond:0,bytesPerSecond:0,sampleMs:0,lastUpdatedAt:0},f0=2500,m0=3e4,h0=64*1024,p0=6,Ey=new Map;function g0(a){return Ey.get(a)}const px={totalSent:0,totalDropped:0,sentPerSecond:0,droppedPerSecond:0,bufferedAmount:0,lastInputType:"",lastInputSeq:0,lastRoundTripMs:0,lastAgentApplyMs:0,lastUpdatedAt:0};function gx(a){const l=Date.parse(String(a||""));if(!Number.isFinite(l))return 0;const s=Date.now()-l;return s>0&&s<=m0?s:0}function xx(a,l,s=mn,r={}){const[c,d]=m.useState(new Map),[h,p]=m.useState("idle"),[g,x]=m.useState(""),[v,y]=m.useState(Co),w=m.useRef(new Map),C=m.useRef(new Map),j=m.useRef(0),M=m.useRef(new Set),[T,k]=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]),D=Number.isFinite(r.fps)?Number(r.fps):2,$=Number.isFinite(r.maxWidth)?Number(r.maxWidth):640,E=Number.isFinite(r.maxHeight)?Number(r.maxHeight):360,ee=Number.isFinite(r.quality)?Number(r.quality):45,de=String(r.frameMode||r.mode||"mode3-h264-hw").trim()||"mode3-h264-hw",V=r.streamPurpose==="control"?"control":"wall",J=m.useMemo(()=>{const I=Object.entries(r.monitorSelections||{}).filter(([Z])=>!!Z).sort(([Z],[ne])=>Z.localeCompare(ne));return JSON.stringify(Object.fromEntries(I))},[r.monitorSelections]);m.useEffect(()=>{A.current=r.onFrame},[r.onFrame]);const B=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{}},[]),ie=m.useCallback(()=>{const I=[...C.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")},[]),K=m.useCallback((I,Z)=>{if(!I||I.byteLength<5)return;const ne=Date.now(),le=new DataView(I).getUint32(0,!1);if(le<=0||le+4>I.byteLength)return;const me=new Uint8Array(I.slice(4,4+le)),_=JSON.parse(new TextDecoder().decode(me));if(Math.max(gx(_.receivedAt),gx(_.capturedAt))>f0)return;const be=I.slice(4+le),Ce={deviceId:String(_.deviceId||""),kind:_.kind==="thumbnail"?"thumbnail":"live",frameSeq:Number(_.frameSeq||0),streamFrameSeq:Number(_.streamFrameSeq||0)||void 0,streamId:String(_.streamId||""),commandId:_.commandId?String(_.commandId):void 0,width:Number(_.width||0),height:Number(_.height||0),sourceWidth:Number(_.sourceWidth||0)||void 0,sourceHeight:Number(_.sourceHeight||0)||void 0,mimeType:String(_.mimeType||"image/jpeg"),mode:_.mode?String(_.mode):void 0,frameMode:_.frameMode?String(_.frameMode):void 0,frameProfile:_.frameProfile?String(_.frameProfile):void 0,encoding:_.encoding?String(_.encoding):void 0,codec:_.codec?String(_.codec):void 0,compression:_.compression?String(_.compression):void 0,pixelFormat:_.pixelFormat?String(_.pixelFormat):void 0,bytesPerPixel:Number(_.bytesPerPixel||0)||0,uncompressedByteLength:Number(_.uncompressedByteLength||0)||0,h264Format:_.h264Format?String(_.h264Format):void 0,isKeyFrame:_.isKeyFrame===!0,chunkType:_.chunkType?String(_.chunkType):void 0,timestampUs:Number(_.timestampUs||0)||0,durationUs:Number(_.durationUs||0)||0,sourceGapMs:Number(_.sourceGapMs||0)||0,agentSendGapMs:Number(_.agentSendGapMs||0)||0,agentSendDurationMs:Number(_.agentSendDurationMs||0)||0,agentSendDurationFrameSeq:Number(_.agentSendDurationFrameSeq||0)||0,agentPaceMs:Number(_.agentPaceMs||0)||0,agentQueueBeforePaceMs:Number(_.agentQueueBeforePaceMs||0)||0,agentFrameAgeMs:Number(_.agentFrameAgeMs||0)||0,droppedByAgent:Number(_.droppedByAgent||0)||0,hubIngressDropped:Number(_.hubIngressDropped||0)||0,hubClientDropped:Number(_.hubClientDropped||0)||0,hardwareEncoder:_.hardwareEncoder?String(_.hardwareEncoder):void 0,platformProfile:_.platformProfile?String(_.platformProfile):void 0,monitorIndex:Number.isFinite(Number(_.monitorIndex))?Number(_.monitorIndex):void 0,monitorCount:Number.isFinite(Number(_.monitorCount))?Number(_.monitorCount):void 0,capturedAt:String(_.capturedAt||""),receivedAt:String(_.receivedAt||""),hubPacketAt:_.hubPacketAt?String(_.hubPacketAt):void 0,hubPacketEpochMs:Number.isFinite(Number(_.hubPacketEpochMs))?Number(_.hubPacketEpochMs):void 0,browserReceivedEpochMs:ne,byteLength:Number(_.byteLength||be.byteLength),contentHash:_.contentHash?String(_.contentHash):void 0,captureMs:Number(_.captureMs||0)||0,captureStageMs:Number(_.captureStageMs||0)||0,convertMs:Number(_.convertMs||0)||0,compressMs:Number(_.compressMs||0)||0,captureSourceSerial:Number(_.captureSourceSerial||0)||0,captureSourceSkipped:Number(_.captureSourceSkipped||0)||0,deltaTileSize:Number(_.deltaTileSize||0)||0,deltaTileCount:Number(_.deltaTileCount||0)||0,deltaVisualTileCount:Number(_.deltaVisualTileCount||0)||0,deltaRefreshTileCount:Number(_.deltaRefreshTileCount||0)||0,deltaTotalTiles:Number(_.deltaTotalTiles||0)||0,payload:be};if(!Ce.deviceId)return;const Ie={streamId:Z.lastFrameStreamId,commandId:Z.lastFrameCommandId,order:Z.lastFrameOrder},Ve=Number(Ce.streamFrameSeq||Ce.frameSeq||0),Le=!!Ie.commandId&&!!Ce.commandId,Ee=Ie.streamId===Ce.streamId&&(!Le||Ie.commandId===Ce.commandId),qe=Ie.order;if(Ee&&qe>=Ve&&(qe===Ve||Le))return;Z.lastFrameStreamId=Ce.streamId,Z.lastFrameCommandId=Ce.commandId||"",Z.lastFrameOrder=Ve;const Te=L.current;Te.totalFrames+=1,Te.totalBytes+=be.byteLength,Te.sampleFrames+=1,Te.sampleBytes+=be.byteLength,w.current.set(Ce.deviceId,Ce),A.current?.(Ce)},[]);m.useEffect(()=>{const I=window.setInterval(()=>{const Z=performance.now(),ne=L.current,O=Math.max(1,Z-ne.sampleStartedAt);y({totalFrames:ne.totalFrames,totalBytes:ne.totalBytes,framesPerSecond:ne.sampleFrames*1e3/O,bytesPerSecond:ne.sampleBytes*1e3/O,sampleMs:O,lastUpdatedAt:Date.now()}),d(new Map(w.current)),ne.sampleFrames=0,ne.sampleBytes=0,ne.sampleStartedAt=Z},2e3);return()=>{window.clearInterval(I)}},[]),m.useEffect(()=>{const I=q?q.split(",").filter(Boolean):[],Z=new Set(I),ne=performance.now();for(const[O,le]of C.current.entries())Z.has(O)||(B(le,"livedesk-device-unsubscribed"),C.current.delete(O),w.current.delete(O));if(I.length===0){for(const O of C.current.values())B(O,"livedesk-no-devices");C.current.clear(),w.current=new Map,d(new Map),x(""),L.current={totalFrames:0,totalBytes:0,sampleFrames:0,sampleBytes:0,sampleStartedAt:0},y(Co),ie();return}L.current.sampleStartedAt<=0&&(L.current.sampleStartedAt=ne,y({...Co,lastUpdatedAt:Date.now()}));for(const O of I){const le=r.monitorSelections?.[O],me=Number.isFinite(Number(le))?{[O]:Number(le)}:{},_={type:"subscribe",deviceIds:[O],autoStartLive:l,fps:D,maxWidth:$,maxHeight:E,quality:ee,mode:de,frameMode:de,streamPurpose:V,forceRestart:V==="control",restartReason:V==="control"?"control-subscribe":"",monitorSelections:me},ge=JSON.stringify(_),be=C.current.get(O),Ce=!!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;B(be,be.payloadKey===ge?"livedesk-frame-socket-refresh":"livedesk-subscription-replaced"),C.current.delete(O)}const Ie=new WebSocket(_u(`/api/remote/frames/ws?devices=${encodeURIComponent(O)}`,s));Ie.binaryType="arraybuffer";const Ve=Ce?{..._,forceRestart:!0,restartReason:"subscription-options-changed",restartToken:`${Date.now()}-${Math.random().toString(36).slice(2)}`}:_,Le={socket:Ie,payload:Ve,payloadKey:ge,generation:j.current+1,disposed:!1,lastFrameStreamId:"",lastFrameCommandId:"",lastFrameOrder:-1};j.current=Le.generation,C.current.set(O,Le),Ie.addEventListener("open",()=>{if(Le.disposed||C.current.get(O)!==Le){B(Le,"livedesk-stale-frame-socket");return}x(""),Ie.send(JSON.stringify(Le.payload)),ie()}),Ie.addEventListener("message",Ee=>{if(Le.disposed||C.current.get(O)!==Le)return;if(typeof Ee.data=="string"){try{const Te=JSON.parse(Ee.data);if(Te?.type==="RemoteFrameSubscriptionError")x(String(Te.error||"control-stream-start-failed"));else if(Te?.type==="RemoteFrameLiveAutoStart"){const re=(Array.isArray(Te.skipped)?Te.skipped:[]).find(ye=>ye?.deviceId===O);re?x(String(re.reason||"control-stream-start-failed")):Array.isArray(Te.started)&&Te.started.some(ye=>ye?.deviceId===O)&&x("")}}catch{}return}const qe=Ee.data instanceof ArrayBuffer?Ee.data:null;qe&&(x(""),K(qe,Le))}),Ie.addEventListener("error",()=>{Le.disposed||C.current.get(O)!==Le||(x("frame-socket-error"),p("error"))}),Ie.addEventListener("close",()=>{const Ee=!Le.disposed;Le.disposed=!0;const qe=C.current.get(O);if(qe===Le&&C.current.delete(O),ie(),Ee&&qe===Le){const Te=window.setTimeout(()=>{M.current.delete(Te),k(gt=>gt+1)},750);M.current.add(Te)}})}ie()},[l,B,q,D,de,K,s,E,$,J,r.monitorSelections,ee,T,V,ie]),m.useEffect(()=>()=>{for(const I of C.current.values())B(I,"livedesk-hook-unmount");C.current.clear();for(const I of M.current)window.clearTimeout(I);M.current.clear()},[B]);const fe=m.useCallback((I,Z="browser-stale")=>{const ne=Array.isArray(I)&&I.length>0?I:q.split(",").filter(Boolean);if(ne.length===0)return!1;let O=!1;for(const le of ne){const me=C.current.get(le);!me||me.socket.readyState!==WebSocket.OPEN||(me.socket.send(JSON.stringify({...me.payload,type:"restart-live",deviceIds:[le],forceRestart:!0,restartReason:Z,restartToken:`${Date.now()}-${Math.random().toString(36).slice(2)}`})),O=!0)}return O},[q]);return{frames:c,state:h,error:g,stats:v,restartLive:fe}}function x0(a,l,s=mn,r={}){const[c,d]=m.useState(null),[h,p]=m.useState(null),[g,x]=m.useState("idle"),[v,y]=m.useState(Co),w=m.useRef(null),C=m.useRef(r.onFrame),j=m.useRef(null),M=m.useRef(0),T=m.useRef({totalFrames:0,totalBytes:0,sampleFrames:0,sampleBytes:0,sampleStartedAt:0}),k=m.useMemo(()=>[...new Set(a.filter(Boolean))].join(","),[a]),A=m.useMemo(()=>JSON.stringify(r.monitorSelections||{}),[r.monitorSelections]),L=m.useMemo(()=>({deviceIds:k.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||{}}),[k,A,r.fps,r.height,r.monitorSelections,r.tileHeight,r.tileWidth,r.width]),q=m.useMemo(()=>JSON.stringify(L),[L]),D=m.useRef(L);D.current=L;const $=l&&L.deviceIds.length>0,E=m.useCallback(de=>de.readyState!==WebSocket.OPEN?!1:(de.send(JSON.stringify({type:"configure",...D.current})),!0),[]);m.useEffect(()=>{C.current=r.onFrame},[r.onFrame]),m.useEffect(()=>{const de=window.setInterval(()=>{const V=T.current,J=performance.now(),B=Math.max(1,J-V.sampleStartedAt);y({totalFrames:V.totalFrames,totalBytes:V.totalBytes,framesPerSecond:V.sampleFrames*1e3/B,bytesPerSecond:V.sampleBytes*1e3/B,sampleMs:B,lastUpdatedAt:Date.now()});const ie=j.current;ie&&ie.frameSeq!==M.current&&(M.current=ie.frameSeq,d(ie)),V.sampleFrames=0,V.sampleBytes=0,V.sampleStartedAt=J},1e3);return()=>window.clearInterval(de)},[]),m.useEffect(()=>{if(!$){w.current?.close(),w.current=null,d(null),j.current=null,M.current=0,p(null),x("idle"),y(Co);return}let de=!1,V=0;const J=()=>{if(de)return;const B=new WebSocket(_u("/api/remote/atlas/ws",s));B.binaryType="arraybuffer",w.current=B,x("connecting"),B.addEventListener("open",()=>{T.current.sampleStartedAt=performance.now(),x("open"),E(B)}),B.addEventListener("message",ie=>{if(typeof ie.data=="string"){try{const fe=JSON.parse(ie.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 K=ie.data instanceof ArrayBuffer?ie.data:null;if(!(!K||K.byteLength<5))try{const fe=Date.now(),Z=new DataView(K).getUint32(0,!1);if(Z<=0||Z+4>K.byteLength)return;const ne=JSON.parse(new TextDecoder().decode(new Uint8Array(K,4,Z))),O=K.slice(4+Z),le={deviceId:String(ne.deviceId||"__livedesk_mode4_atlas__"),kind:"live",frameSeq:Number(ne.frameSeq||0),streamFrameSeq:Number(ne.streamFrameSeq||0)||void 0,streamId:String(ne.streamId||"mode4-atlas"),commandId:ne.commandId?String(ne.commandId):void 0,width:Number(ne.width||1920),height:Number(ne.height||1080),sourceWidth:Number(ne.sourceWidth||ne.width||1920),sourceHeight:Number(ne.sourceHeight||ne.height||1080),mimeType:String(ne.mimeType||"video/h264"),mode:String(ne.mode||"mode4-h264-atlas"),frameMode:String(ne.frameMode||"mode4-h264-atlas"),frameProfile:String(ne.frameProfile||"mode4-h264-atlas-v1"),encoding:String(ne.encoding||"video-atlas"),codec:String(ne.codec||"h264"),compression:String(ne.compression||"video/h264"),h264Format:String(ne.h264Format||"annexb"),isKeyFrame:ne.isKeyFrame===!0,chunkType:String(ne.chunkType||""),timestampUs:Number(ne.timestampUs||0),durationUs:Number(ne.durationUs||0),hardwareEncoder:ne.hardwareEncoder?String(ne.hardwareEncoder):void 0,platformProfile:ne.platformProfile?String(ne.platformProfile):void 0,capturedAt:String(ne.capturedAt||""),receivedAt:String(ne.receivedAt||""),hubPacketAt:ne.hubPacketAt?String(ne.hubPacketAt):void 0,hubPacketEpochMs:Number(ne.hubPacketEpochMs||0)||void 0,browserReceivedEpochMs:fe,byteLength:O.byteLength,layoutVersion:Number(ne.layoutVersion||0),atlasComposeMs:Number(ne.atlasComposeMs||0),atlasPoolStarved:Number(ne.atlasPoolStarved||0),atlasReadyTiles:Number(ne.atlasReadyTiles||0),atlasTileCount:Number(ne.atlasTileCount||0),payload:O},me=T.current;me.totalFrames+=1,me.totalBytes+=O.byteLength,me.sampleFrames+=1,me.sampleBytes+=O.byteLength,j.current=le,M.current===0&&(M.current=le.frameSeq,d(le)),C.current?.(le)}catch{}}),B.addEventListener("error",()=>x("error")),B.addEventListener("close",()=>{w.current===B&&(w.current=null),!de&&(x("closed"),V=window.setTimeout(J,1200))})};return J(),()=>{de=!0,window.clearTimeout(V),w.current?.close(),w.current=null}},[$,s,E]),m.useEffect(()=>{if(!$)return;const de=w.current;de&&E(de)},[q,$,E]);const ee=m.useCallback(()=>{const de=w.current;return de?E(de):!1},[E]);return{frame:c,layout:h,state:g,stats:v,refreshInputs:ee}}function y0(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(px),v=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(px);return}const w=new WebSocket(_u("/api/remote/input/ws",l));return s.current=w,v.current.sampleStartedAt=performance.now(),p("connecting"),w.addEventListener("open",()=>p("open")),w.addEventListener("message",C=>{if(typeof C.data=="string")try{const j=JSON.parse(C.data);if(j?.type!=="RemoteInputApplied")return;const M=Number(j.inputSeq||0),T=d.current.get(M);T!==void 0&&(v.current.lastRoundTripMs=Math.max(0,performance.now()-T),d.current.delete(M)),v.current.lastInputSeq=M,v.current.lastAgentApplyMs=Math.max(0,Number(j.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 C=performance.now(),j=v.current,M=Math.max(1,C-j.sampleStartedAt);x({totalSent:j.totalSent,totalDropped:j.totalDropped,sentPerSecond:j.sampleSent*1e3/M,droppedPerSecond:j.sampleDropped*1e3/M,bufferedAmount:s.current?.bufferedAmount||0,lastInputType:j.lastInputType,lastInputSeq:j.lastInputSeq,lastRoundTripMs:j.lastRoundTripMs,lastAgentApplyMs:j.lastAgentApplyMs,lastUpdatedAt:Date.now()}),j.sampleSent=0,j.sampleDropped=0,j.sampleStartedAt=C},1e3);return()=>window.clearInterval(w)},[a]);const y=m.useCallback((w,C)=>{const j=s.current;if(!j||j.readyState!==WebSocket.OPEN||!w)return!1;const M=String(C.type||"").toLowerCase(),T=M==="pointermove",k=v.current;if(T&&j.bufferedAmount>h0)return k.totalDropped+=1,k.sampleDropped+=1,k.lastInputType="pointermove-drop",!1;const A=r.current+1;r.current=A;const L=Date.now(),q=!T||A-c.current>=p0;for(q&&(d.current.set(A,performance.now()),T&&(c.current=A)),T||Ey.set(w,{inputSeq:A,inputType:M||"input",sentAt:performance.now()});d.current.size>256;){const D=d.current.keys().next().value;if(D===void 0)break;d.current.delete(D)}return j.send(JSON.stringify({type:"input",requestId:T?"":crypto.randomUUID(),fireAndForget:T,deviceId:w,input:{...C,inputSeq:A,requestAck:q,issuedAtEpochMs:L,issuedAt:new Date(L).toISOString()}})),k.totalSent+=1,k.sampleSent+=1,k.lastInputType=M||"input",!0},[]);return{state:h,sendInput:y,stats:g}}function v0(a){const l=String(a||"").toLowerCase();return l.includes("audio/pcm")||l.includes("audio/l16")||l.includes("f32le")||l.includes("s16le")}function b0(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),v=a.createBuffer(r,x,c),y=new DataView(s);for(let w=0;w<r;w+=1){const C=v.getChannelData(w);for(let j=0;j<x;j+=1){const T=(j*r+w)*p;C[j]=h?Math.max(-1,Math.min(1,y.getInt16(T,!0)/32768)):Math.max(-1,Math.min(1,y.getFloat32(T,!0)))}}return v}function w0(a,l,s=mn){const r=m.useRef(null),c=m.useRef(0),[d,h]=m.useState("idle"),[p,g]=m.useState(null),[x,v]=m.useState("");return m.useEffect(()=>{if(!l||!a){h("idle"),g(null),v("");return}const y=window.AudioContext||window.webkitAudioContext;if(!y){h("unsupported"),v("Audio playback is not supported in this browser.");return}const w=new y;r.current=w,c.current=w.currentTime;const C=new WebSocket(_u(`/api/remote/audio/ws?devices=${encodeURIComponent(a)}`,s));C.binaryType="arraybuffer";let j=!1;return h("connecting"),v(""),C.addEventListener("open",()=>{j||(h("open"),C.send(JSON.stringify({type:"subscribe",deviceIds:[a]})),w.resume())}),C.addEventListener("message",M=>{if(typeof M.data=="string")return;const T=M.data instanceof ArrayBuffer?M.data:null;!T||T.byteLength<5||(async()=>{try{const A=new DataView(T).getUint32(0,!1);if(A<=0||A+4>T.byteLength)return;const L=new Uint8Array(T.slice(4,4+A)),q=JSON.parse(new TextDecoder().decode(L)),D=T.slice(4+A),$={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||D.byteLength),payload:D};if(!$.deviceId||j)return;const E=v0($.mimeType)?b0(w,$,D):await w.decodeAudioData(D.slice(0));if(j)return;const ee=w.createBufferSource();ee.buffer=E,ee.connect(w.destination);const de=Math.max(w.currentTime+.02,c.current);ee.start(de),c.current=de+E.duration,g($),h("playing")}catch(k){j||(h("error"),v(k instanceof Error?k.message:String(k)))}})()}),C.addEventListener("error",()=>{j||h("error")}),C.addEventListener("close",()=>{j||h("closed")}),()=>{j=!0,C.close(),w.close().catch(()=>{}),r.current===w&&(r.current=null)}},[a,l,s]),{state:d,lastFrame:p,error:x}}const S0=[{id:"pin",label:"PIN",icon:qb},{id:"wall",label:"Wall",icon:Qg},{id:"control",label:"Control",icon:Qg}];function C0({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:S0.map(({id:g,label:x,icon:v})=>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(v,{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 M0({children:a}){return o.jsx("div",{className:"settings-tab-content",children:a})}function j0({children:a}){return o.jsx("div",{className:"settings-tab-content",children:a})}function N0({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 Om(a,l){return typeof a=="function"?typeof l=="object"?a(l):a():a}function lr(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 A0(a,l="data-id"){const s=lr(a,l);return s?s.getAttribute(l):null}function Eo(a,l="data-id"){const s=lr(a,l);return s?Ou(s,l):null}function Ou(a,l="data-id"){const s=a.getAttribute(l);return s?k0(s):null}function tn(a){return typeof a=="string"?":"+a:a}function k0(a){if(a.startsWith(":"))return a.substring(1);const l=a*1;return isNaN(l)?a:l}function T0(){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=T0();function Bm(a){Object.assign(Vn,a)}function yx(a,l,s){function r(c){const d=lr(c);if(!d)return;const h=Ou(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 ir(a,l){yx(a,l,"click"),l.dblclick&&yx(a,l.dblclick,"dblclick")}function E0(a,l){for(let s=a.length-1;s>=0;s--)if(a[s]===l){a.splice(s,1);break}}function D0(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 Dy=new Date,Eu=!1,nu=[],Dl=[],vx=a=>{const l=a.target;if(Eu||!l.isConnected){Eu=!1;return}for(let s=Dl.length-1;s>=0;s--){const{node:r,date:c,props:d}=Dl[s];if(!(c>Dy)&&!r.contains(l)&&r!==l&&(D0(r,l,s)||(d.callback&&d.callback(a),d.modal||a.defaultPrevented)))break}},R0=a=>{Dy=new Date,Eu=!0;for(let l=Dl.length-1;l>=0;l--){const{node:s}=Dl[l];if(!s.contains(a.target)&&s!==a.target){Eu=!1;break}}};function Ja(a,l){nu.length||(nu=[Vn.addGlobalEvent("click",vx,a),Vn.addGlobalEvent("contextmenu",vx,a),Vn.addGlobalEvent("mousedown",R0,a)]),typeof l!="object"&&(l={callback:l});const s={node:a,date:new Date,props:l};return Dl.push(s),{destroy(){E0(Dl,s),Dl.length||(nu.forEach(r=>r()),nu=[])}}}var au=a=>a.indexOf("bottom")!==-1,lu=a=>a.indexOf("left")!==-1,iu=a=>a.indexOf("right")!==-1,$f=a=>a.indexOf("top")!==-1,bx=a=>a.indexOf("fit")!==-1,mo=a=>a.indexOf("overlap")!==-1,L0=a=>a.split("-").every(l=>["center","fit"].indexOf(l)>-1),z0=a=>{const l=a.match(/(start|center|end)/);return l?l[0]:null};function _0(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,vn,ho,fn;function Ry(a,l,s="bottom",r=0,c=0){if(!a)return null;Qt=r,vn=c,ho="auto";let d=0,h=0,p=s;const g=Ly(a),x=mo(s)?Vn.getTopNode(a):g;if(!g)return null;const v=g.getBoundingClientRect(),y=a.getBoundingClientRect(),w=x.getBoundingClientRect(),C=window.getComputedStyle(x),j={left:0,top:0,bottom:0,right:0};for(const q in j){const D=`border-${q}-width`;j[q]=parseFloat(C.getPropertyValue(D))}if(l){const q=_0(l,g);d=Math.max(q+1,20)}if(l){if(fn=l.getBoundingClientRect(),bx(s)&&(ho=fn.width+"px"),s!=="point")if(L0(s))bx(s)?Qt=0:(Qt=w.width/2,h=1),vn=(w.height-y.height)/2;else{const q=mo(s)?0:1;Qt=iu(s)?fn.right+q:fn.left-q,vn=au(s)?fn.bottom+1:fn.top;const D=z0(s);D&&(iu(s)||lu(s)?D==="center"?vn-=(y.height-fn.height)/2:D==="end"&&(vn-=y.height-fn.height):(au(s)||$f(s))&&(D==="center"?Qt-=(y.width-fn.width)/2:D==="end"&&(Qt-=y.width-fn.width),mo(s)||(Qt+=1)))}}else fn={left:r,right:r,top:c,bottom:c};const M=(lu(s)||iu(s))&&(au(s)||$f(s));lu(s)&&(h=2);const T=Qt-y.width-w.left;l&&lu(s)&&!M&&T<0&&(Qt=fn.right,h=0,p=p.replace("left","right"));const k=Qt+y.width*(1-h/2)-w.right;if(k>0)if(!iu(s))Qt=w.right-j.right-y.width;else{const q=fn.left-w.x-y.width;l&&!M&&q>=0?(Qt=fn.left-y.width,p=p.replace("right","left")):Qt-=k+j.right}h&&(Qt=Math.round(Qt-y.width*h/2));const A=T<0||k>0||!M;$f(s)&&(vn=fn.top-y.height,l&&vn<w.y&&A&&(vn=fn.bottom,p=p.replace("top","bottom")));const L=vn+y.height-w.bottom;return L>0&&(l&&au(s)&&A?(vn-=y.height+fn.height+1,p=p.replace("bottom","top")):vn-=L+j.bottom),Qt-=v.left+j.left,vn-=v.top+j.top,Qt=(mo(s)?Qt:Math.max(Qt,0))+x.scrollLeft,vn=(mo(s)?vn:Math.max(vn,0))+x.scrollTop,ho=ho||"auto",{at:p,x:Qt,y:vn,z:d,width:ho}}function Ly(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 O0(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 wx=new Date().valueOf();function Hm(){return wx+=1,wx}function wn(a){return a<10?"0"+a:a.toString()}function B0(a){const l=wn(a);return l.length==2?"0"+l:l}function zy(a){const l=Math.floor(a/11)*11;return{start:l,end:l+11}}function qf(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 Sx=["",""];function H0(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)||Sx)[0];case"%A":return((l.getHours()>11?s.pm:s.am)||Sx)[1];case"%s":return wn(l.getSeconds());case"%S":return B0(l.getMilliseconds());case"%W":return wn(qf(l));case"%w":{const r=s.weekStart??1;if(r===1)return wn(qf(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(qf(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 I0=/%[a-zA-Z]/g;function tr(a,l){return typeof a=="function"?a:function(s){return s?(s.getMonth||(s=new Date(s)),a.replace(I0,r=>H0(r,s,l))):""}}function Cx(a){return a&&typeof a=="object"&&!Array.isArray(a)}function vm(a,l){for(const s in l){const r=l[s];Cx(a[s])&&Cx(r)?a[s]=vm({...a[s]},l[s]):a[s]=l[s]}return a}function Lo(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=vm({...l},a):r=vm({...a},l),Lo(r)}}}var F0=vy();const U0="en-US",$0={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},q0={ok:"OK",cancel:"Cancel",select:"Select","No data":"No data","Rows per page":"Rows per page","Total pages":"Total pages"},G0={timeFormat:"%H:%i",dateFormat:"%m/%d/%Y",monthYearFormat:"%F %Y",yearFormat:"%Y"},_y={core:q0,calendar:$0,formats:G0,lang:U0},Im=m.createContext(""),Oy=m.createContext({}),Ba=m.createContext(null),By=m.createContext(null),an=Object.freeze(Object.defineProperty({__proto__:null,fieldId:By,helpers:Oy,i18n:Ba,theme:Im},Symbol.toStringTag,{value:"Module"}));function Hy(a){const l=m.useContext(By),[s]=m.useState(()=>a||l||Hm());return s}function Mo({type:a="",css:l="",icon:s="",disabled:r=!1,title:c="",tooltip:d,text:h="",children:p,onClick:g}){const x=m.useMemo(()=>{let y=a?a.split(" ").filter(w=>w!=="").map(w=>"wx-"+w).join(" "):"";return l+(l?" ":"")+y},[a,l]),v=y=>{g&&g(y)};return o.jsxs("button",{title:c,className:`wx-2ZWgb4 wx-button ${x} ${s&&!p?"wx-icon":""}`,disabled:r,onClick:v,"data-tooltip-text":d,children:[s&&o.jsx("i",{className:"wx-2ZWgb4 "+s}),p||h||" "]})}function P0({id:a,label:l="",inputValue:s="",value:r=!1,onChange:c,disabled:d=!1,css:h=""}){const p=Hy(a),[g,x]=Wa(r),v=({target:y})=>{const w=y.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:v}),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 Fm({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(Im);return m.useEffect(()=>{h(l||Y0(c.current)||Vn.getTopNode(c.current))},[c.current]),o.jsxs(o.Fragment,{children:[o.jsx("span",{ref:c,style:{display:"none"}}),c.current&&d?F0.createPortal(o.jsx("div",{className:`wx-3ZWsT0 wx-${a||p}-theme`,children:s}),d):null]})}function Y0(a){const l=Vn.getTopNode(a);for(;a&&a!==l&&!a.getAttribute("data-wx-portal-root");)a=a.parentNode;return a}function V0({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,v]=m.useState(0),[y,w]=m.useState(0),[C,j]=m.useState("auto"),[M,T]=m.useState(!1),k=m.useRef(null),A=m.useRef(null),L=m.useRef(h);m.useEffect(()=>{L.current=h},[h]);function q($){return r&&(c+"").indexOf("%")>-1?c.replace(/(\d+)%/,(E,ee)=>(ee=ee*r.offsetWidth/100+"px",c.replace(E,ee))):c&&c!=="auto"?c:$}const D=m.useCallback(()=>{if(!k.current)return;const $=Ry(k.current,r,s,a,l);$&&(v($.x),w($.y),j(q($.width)))},[k,r,s,a,l,c]);return m.useLayoutEffect(()=>{const $=ee=>{L.current&&ee.target!==A.current&&k.current&&!k.current.contains(ee.target)&&L.current(ee)};let E;return requestAnimationFrame(()=>{D(),T(!0),g&&k.current&&(A.current=Ly(k.current),A.current&&A.current.addEventListener("scroll",$,!0)),r&&(E=new ResizeObserver(D),E.observe(r))}),()=>{g&&A.current&&A.current.removeEventListener("scroll",$,!0),E?.disconnect()}},[]),m.useLayoutEffect(()=>{D()},[r,s,a,l]),m.useEffect(()=>{const $=E=>{L.current&&L.current(E)};if(k.current)return Ja(k.current,{callback:$,parent:()=>r}).destroy},[r]),o.jsx("div",{ref:k,className:["wx-37M6Fj","wx-popup",d].filter(Boolean).join(" "),style:{position:"absolute",visibility:M?"visible":"hidden",top:y+"px",left:x+"px",width:C},children:p})}function Q0({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),[v,y]=m.useState(l),w=m.useRef(r);return m.useEffect(()=>{w.current=r},[r]),m.useEffect(()=>{if(s){const C=p.current;if(C){const j=C.getBoundingClientRect(),M=document.body.getBoundingClientRect();j.right>=M.right&&y("end"),j.bottom>=M.bottom&&x("top")}}},[]),m.useEffect(()=>{if(p.current){const C=j=>{w.current&&w.current(j)};return Ja(p.current,C).destroy}},[]),o.jsx("div",{ref:p,className:["wx-dropdown",`wx-${g}-${v}`,d||"","wx-aaaVytZW"].filter(Boolean).join(" "),style:{width:c},children:h})}function Um({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),v=m.useRef(null),y=m.useMemo(()=>`${a}-${l}`,[a,l]);return m.useLayoutEffect(()=>{v.current&&x(v.current.parentNode)},[]),o.jsxs(o.Fragment,{children:[g&&(r?o.jsx(Q0,{onCancel:c,position:a,align:l,autoFit:s,width:d,...p,children:h}):o.jsx(Fm,{children:o.jsx(V0,{parent:g,at:y,onCancel:c,width:d,...p,children:h})})),o.jsx("span",{ref:v,className:"wx-portal-node wx-32GZ52"})]})}function Bu(){return Lo(_y)}function K0(){let a=null,l=!1,s=!1,r,c,d,h;const p=(y,w,C,j,M)=>{r=y,c=w,d=C,h=j,s=M},g=y=>{a=y,l=a!==null,d(a)},x=(y,w)=>{if(!s&&y!==null&&r){const C=r.querySelectorAll(".wx-list > .wx-item")[y];C&&(C.scrollIntoView({block:"nearest"}),w&&w.preventDefault())}},v=(y,w)=>{const C=y===null?null:Math.max(0,Math.min(a+y,c.length-1));C!==a&&(g(C),r?x(C,w):requestAnimationFrame(()=>x(C,w)))};return{move:y=>{const w=Eo(y),C=c.findIndex(j=>j.id===w);C!==a&&g(C)},keydown:(y,w)=>{switch(y.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":v(l?1:w||0,y);break;case"ArrowUp":v(l?-1:w||0,y);break}},init:p,navigate:v}}const Mx=10,X0=m.memo(function({data:a,checkboxes:l,itemTemplate:s,value:r}){return o.jsxs(o.Fragment,{children:[l&&o.jsx(P0,{id:a.id,css:"wx-list-checkbox",value:r&&r.includes(a.id)}),s?Om(s,{option:a}):a.label]})});function jx({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(X0,{data:p,checkboxes:r,itemTemplate:c,value:d})},p.id)})}function Hu({items:a=[],children:l,onSelect:s,onReady:r,virtualized:c=!1,checkboxes:d,multiselect:h,value:p,...g}){const x=m.useRef(),v=m.useRef(!1),y=m.useRef(K0()),[w,C]=m.useState(null),j=m.useRef(w),[M,T]=m.useState(0),[k,A]=m.useState(24),L=m.useRef(!1),q=(m.useContext(Ba)||Bu()).getGroup("core"),D=m.useRef(a);m.useEffect(()=>{D.current=a},[a]);const $=m.useRef(p);m.useEffect(()=>{$.current=p},[p]);const E=m.useRef(0);m.useEffect(()=>{E.current=k},[k]);const ee=m.useCallback(_=>{_&&_.stopPropagation();const ge=D.current,be=$.current,Ce=j.current;let Ie;const Ve=ge[Ce]?.id;h?be&&be.includes(Ve)?Ie=be.filter(Le=>Le!==Ve):Ie=[...be||[],Ve]:Ie=Ve,s&&s({id:Ie})},[h,s]),de=m.useRef(ee);m.useEffect(()=>{de.current=ee},[ee]);const V=m.useCallback(_=>{if(x.current){let ge=_*E.current-x.current.clientHeight+E.current;T(ge),x.current.scrollTop=ge}},[E.current]),J=m.useCallback(_=>{x.current=_,c&&(_&&!v.current&&j.current!==null&&requestAnimationFrame(()=>{x.current&&(V(j.current),v.current=!0)}),_||(v.current=!1))},[V]),B=m.useCallback(_=>{if(!_||L.current)return;const ge=_.getBoundingClientRect().height;ge&&(A(ge),E.current=ge,L.current=!0)},[]);m.useEffect(()=>{y.current.init(x.current,a,_=>{C(_),j.current=_},_=>de.current(_),c)},[a,x.current,c]),m.useEffect(()=>{const _=(be,Ce)=>{y.current.navigate(be,Ce),V(j.current)},ge=(be,Ce)=>{const Ie=j.current,Ve=D.current;if(Ie!==0&&Ie!==Ve.length-1&&(be.key==="ArrowDown"||be.key==="ArrowUp")&&be.preventDefault(),y.current.keydown(be,Ce),x.current){const Le=x.current.scrollTop<=j.current*E.current,Ee=x.current.scrollTop+x.current.clientHeight>=j.current*E.current+E.current;Le?Ee||V(j.current):(x.current.scrollTop=j.current*E.current,T(x.current.scrollTop))}};r&&r({navigate:c?_:y.current.navigate,keydown:c?ge:y.current.keydown,move:y.current.move})},[]);const ie=m.useRef(0),K=m.useRef(a);K.current!==a&&(K.current=a,ie.current+=1);const fe=m.useCallback(()=>{y.current.navigate(null)},[y]),I=m.useCallback(_=>{c&&T(_.target.scrollTop)},[c]),Z=m.useMemo(()=>Math.ceil((x.current?.clientHeight||0)/k),[k,M]),ne=m.useMemo(()=>{if(!c)return{start:0,end:a.length};if(!a.length)return{start:0,end:0};const _=Math.floor(M/k),ge=_+Z;return{start:Math.max(0,_-Mx),end:Math.min(a.length,ge+Mx)}},[c,a,M,k,Z]),O=m.useMemo(()=>{if(!c)return a;const{start:_,end:ge}=ne;return a.slice(_,ge).map(be=>({...be}))},[c,a,ne]),le=ne.start*k,me=a.length*k;return m.useEffect(()=>{c&&T(0)},[a,c]),m.useEffect(()=>{w===null&&(v.current=!1)},[w]),w===null?null:o.jsx(Um,{onCancel:fe,...g,children:o.jsx("div",{className:"wx-233fr7 wx-list",ref:J,onClick:ee,onMouseMove:y.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(${le}px)`},children:o.jsx(jx,{visibleRange:ne,visibleItems:O,navIndex:w,measureRefCallback:B,checkboxes:d,itemTemplate:l,value:p})})}):o.jsx(jx,{visibleRange:ne,visibleItems:O,navIndex:w,measureRefCallback:B,checkboxes:d,itemTemplate:l,value:p}):o.jsx("div",{className:"wx-233fr7 wx-no-data",children:q("No data")})})},ie.current)}function $m({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:v,css:y="",icon:w="",clear:C=!1,onChange:j}){const M=Hy(l),[T,k]=Wa(a),A=m.useRef(null),L=m.useMemo(()=>w&&y.indexOf("wx-icon-left")===-1?"wx-icon-right "+y:y,[w,y]),q=m.useMemo(()=>w&&y.indexOf("wx-icon-left")!==-1,[w,y]);m.useEffect(()=>{const de=setTimeout(()=>{r&&A.current&&A.current.focus(),c&&A.current&&A.current.select()},1);return()=>clearTimeout(de)},[r,c]);const D=m.useCallback(de=>{const V=de.target.value;k(V),j&&j({value:V,input:!0})},[j]),$=m.useCallback(de=>j&&j({value:de.target.value}),[j]);function E(de){de.stopPropagation(),k(""),j&&j({value:""})}let ee=d;return d!=="password"&&d!=="number"&&(ee="text"),m.useEffect(()=>{const de=$,V=A.current;return V.addEventListener("change",de),()=>{V&&V.removeEventListener("change",de)}},[$]),o.jsxs("div",{className:`wx-hQ64J4 wx-text ${L} ${g?"wx-error":""} ${p?"wx-disabled":""} ${C?"wx-clear":""}`,"data-tooltip-text":v,children:[o.jsx("input",{className:"wx-hQ64J4 wx-input",ref:A,id:M,readOnly:s,disabled:p,placeholder:h,type:ee,title:x,value:T,onInput:D}),C&&!p&&T?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 Z0({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 tr(d.monthYearFormat,c)(a);case"year":return tr(d.yearFormat,c)(a);case"duodecade":{const{start:x,end:v}=zy(h),y=tr(d.yearFormat,c);return`${y(new Date(x,0,1))} - ${y(new Date(v,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 qm({onClick:a,children:l}){return o.jsx("button",{className:"wx-3s8W4d wx-button",onClick:a,children:l})}function W0({value:a,current:l,part:s="",markers:r=null,css:c="",onCancel:d,onChange:h}){const p=(m.useContext(Ba)||Bu()).getRaw().calendar,g=(p.weekStart||7)%7,x=p.dayShort.slice(g).concat(p.dayShort.slice(0,g)),v=(D,$,E)=>new Date(D.getFullYear(),D.getMonth()+($||0),D.getDate()+(E||0));let y=s!=="normal";function w(D){const $=D.getDay();return $===0||$===6}function C(){const D=v(l,0,1-l.getDate());return D.setDate(D.getDate()-(D.getDay()-(g-7))%7),D}function j(){const D=v(l,1,-l.getDate());return D.setDate(D.getDate()+(6-D.getDay()+g)%7),D}const M=m.useRef(0);function T(D,$){$.timeStamp!==M.current&&(M.current=$.timeStamp,$.stopPropagation(),h&&h(new Date(D)),d&&d())}const k=m.useMemo(()=>s=="normal"?[a?v(a).valueOf():0]:a?[a.start?v(a.start).valueOf():0,a.end?v(a.end).valueOf():0]:[0,0],[s,a]),A=m.useMemo(()=>{const D=C(),$=j(),E=l.getMonth();let ee=[];for(let de=D;de<=$;de.setDate(de.getDate()+1)){const V={day:de.getDate(),in:de.getMonth()===E,date:de.valueOf()};let J="";if(J+=V.in?"":" wx-inactive",J+=k.indexOf(V.date)>-1?" wx-selected":"",y){const B=V.date==k[0],ie=V.date==k[1];B&&!ie?J+=" wx-left":ie&&!B&&(J+=" wx-right"),V.date>k[0]&&V.date<k[1]&&(J+=" wx-inrange")}if(J+=w(de)?" wx-weekend":"",r){const B=r(de);B&&(J+=" "+B)}ee.push({...V,css:J})}return ee},[l,k,y,r]),L=m.useRef(null);let q=m.useRef({});return q.current.click=T,m.useEffect(()=>{ir(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(D=>o.jsx("div",{className:"wx-398RBS wx-weekday",children:D},D))}),o.jsx("div",{className:"wx-398RBS wx-days",ref:L,children:A.map(D=>o.jsx("div",{className:`wx-398RBS wx-day ${D.css} ${D.in?"":"wx-out"}`,"data-id":D.date,children:D.day},D.date))})]})}function J0({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,v]=Wa(l||h.current),y=m.useContext(Ba).getRaw().calendar,w=y.monthShort||[],C=m.useMemo(()=>x.getMonth(),[x]),j=m.useCallback((k,A)=>{if(k!=null){A.stopPropagation();const L=new Date(x);L.setMonth(k),v(L),d&&d({current:L})}s==="normal"&&g(new Date(x)),r&&r()},[x,s,d,r]),M=m.useCallback(()=>{const k=new Date(Iy(p,s)||x);k.setMonth(x.getMonth()),k.setFullYear(x.getFullYear()),c&&c(k)},[p,x,s,c]),T=m.useCallback(k=>{const A=k.target.closest("[data-id]");if(A){const L=parseInt(A.getAttribute("data-id"),10);j(L,k)}},[j]);return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"wx-34U8T8 wx-months",onClick:T,children:w.map((k,A)=>o.jsx("div",{className:"wx-34U8T8 wx-month"+(C===A?" wx-current":""),"data-id":A,children:k},A))}),o.jsx("div",{className:"wx-34U8T8 wx-buttons",children:o.jsx(qm,{onClick:M,children:y.done})})]})}const Gf="wx-1XEF33",eS=({value:a,current:l,onCancel:s,onChange:r,onShift:c,part:d})=>{const h=m.useContext(Ba).getRaw().calendar,[p,g]=Wa(l),[x,v]=Wa(a),y=m.useMemo(()=>p.getFullYear(),[p]),w=m.useMemo(()=>{const{start:k,end:A}=zy(y),L=[];for(let q=k;q<=A;++q)L.push(q);return L},[y]),C={click:j};function j(k,A){if(k){A.stopPropagation();const L=new Date(p);L.setFullYear(k),g(L),c&&c({current:L})}d==="normal"&&v(new Date(p)),s&&s()}function M(){const k=new Date(Iy(x,d)||p);k.setFullYear(p.getFullYear()),r&&r(k)}const T=m.useRef(null);return m.useEffect(()=>{T.current&&ir(T.current,C)},[]),o.jsxs(o.Fragment,{children:[o.jsx("div",{className:Gf+" wx-years",ref:T,children:w.map((k,A)=>o.jsx("div",{className:Gf+` wx-year ${y==k?"wx-current":""} ${A===0?"wx-prev-decade":""} ${A===11?"wx-next-decade":""}`,"data-id":k,children:k},A))}),o.jsx("div",{className:Gf+" wx-buttons",children:o.jsx(qm,{onClick:M,children:h.done})})]})},Nx={month:{component:W0,next:nS,prev:tS},year:{component:J0,next:lS,prev:aS},duodecade:{component:eS,next:sS,prev:iS}};function tS(a){return a=new Date(a),a.setMonth(a.getMonth()-1),a}function nS(a){return a=new Date(a),a.setMonth(a.getMonth()+1),a}function aS(a){return a=new Date(a),a.setFullYear(a.getFullYear()-1),a}function lS(a){return a=new Date(a),a.setFullYear(a.getFullYear()+1),a}function iS(a){return a=new Date(a),a.setFullYear(a.getFullYear()-10),a}function sS(a){return a=new Date(a),a.setFullYear(a.getFullYear()+10),a}function Iy(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 rS=["clear","today"];function oS(a){if(a==="done")return-1;if(a==="clear")return null;if(a==="today")return new Date}function cS({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"),[v,y]=m.useState("month"),w=Array.isArray(d)?d:d?rS:[],C=(A,L)=>{A.preventDefault(),g&&g({value:L})},j=()=>{v==="duodecade"?y("year"):v==="year"&&y("month")},M=A=>{const{diff:L,current:q}=A;if(L===0){v==="month"?y("year"):v==="year"&&y("duodecade");return}if(L){const D=Nx[v];s(L>0?D.next(l):D.prev(l))}else q&&s(q);p&&p()},T=A=>{y("month"),g&&g({select:!0,value:A})},k=m.useMemo(()=>Nx[v].component,[v]);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(Z0,{date:l,part:r,type:v,onShift:M}),o.jsxs("div",{children:[o.jsx(k,{value:a,current:l,onCurrentChange:s,part:r,markers:c,onCancel:j,onChange:T,onShift:M}),v==="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(qm,{onClick:L=>C(L,oS(A)),children:x(A)})},A))})]})]})})}function Gm(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=Lo(_y)),l!==null&&(h=h.extend(l,s)),h},[l,s,c]);return o.jsx(Ba.Provider,{value:d,children:r})}function Ax(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 uS=["clear","today"];function Fy({value:a,current:l,markers:s=null,buttons:r=uS,css:c="",onChange:d}){const[h,p]=Wa(a),[g,x]=Wa(l);m.useEffect(()=>{Ax(g,h,x,!1)},[h,g]);const v=m.useCallback(w=>{const C=w.value;C?(p(new Date(C)),Ax(g,new Date(C),x,!0)):p(null),d&&d({value:C?new Date(C):null})},[d,g]),y=m.useCallback(w=>{x(w)},[x]);return g?o.jsx(Gm,{children:o.jsx(cS,{value:h,current:g,markers:s,buttons:r,css:c,onChange:v,onCurrentChange:y})}):null}function dS(a){return a||(a={}),a.width||(a.width="unset"),a}const fS=["clear","today"];function mS({value:a,id:l,disabled:s=!1,error:r=!1,placeholder:c="",format:d="",buttons:h=fS,css:p="",title:g="",tooltip:x,editable:v=!1,clear:y=!1,onChange:w,dropdown:C={}}){const{calendar:j,formats:M}=(m.useContext(Ba)||Bu()).getRaw(),T=d||M?.dateFormat;let k=typeof T=="function"?T:tr(T,j);const[A,L]=m.useState(a),[q,D]=m.useState(!1);m.useEffect(()=>{L(a)},[a]);function $(){D(!1)}function E(V){const J=V===A||V&&A&&V.valueOf()===A.valueOf()||!V&&!A;L(V),J||w&&w({value:V}),setTimeout($,1)}const ee=m.useMemo(()=>A?k(A):"",[A,k]);function de({value:V,input:J}){if(!v&&!y||J)return;let B=typeof v=="function"?v(V):V?new Date(V):null;B=isNaN(B)?A||null:B||null,E(B)}return m.useEffect(()=>{const V=$;return window.addEventListener("scroll",V),()=>window.removeEventListener("scroll",V)},[]),o.jsxs("div",{className:"wx-1lKOFG wx-datepicker",onClick:()=>D(!0),children:[o.jsx($m,{css:`wx-date-input ${p}`,title:g,tooltip:x,value:ee,id:l,readonly:!v,disabled:s,error:r,placeholder:c,onInput:$,onChange:de,icon:"wxi-calendar",clear:y}),q&&!s&&o.jsx(Um,{onCancel:$,...dS(C),children:o.jsx(Fy,{buttons:h,value:A,onChange:V=>E(V.value)})})]})}function hS({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:v="",children:y,onChange:w,dropdown:C={}}){const j=m.useRef(null),M=m.useRef(null);let[T,k]=Wa(a);function A(E){j.current=E.navigate,M.current=E.keydown}const L=m.useMemo(()=>T||T===0?(s||l).find(E=>E.id===T):null,[T,s,l]),q=m.useCallback(({id:E})=>{(E||E===0)&&(k(E),j.current(null),w&&w({value:E}))},[k,w]),D=m.useCallback(E=>{E.stopPropagation(),k(""),w&&w({value:""})},[k,w]),$=m.useCallback(()=>l.findIndex(E=>E.id===T),[l,T]);return o.jsxs("div",{className:`wx-2YgblL wx-richselect ${v} ${d?"wx-2YgblL wx-error":""} ${c?"wx-2YgblL wx-disabled":""} ${y?"":"wx-2YgblL wx-nowrap"}`,title:h,onClick:()=>j.current($()),onKeyDown:E=>M.current(E,$()),tabIndex:0,"data-tooltip-text":p,children:[o.jsx("div",{className:"wx-2YgblL wx-label",children:L?y?y(L):L[g]:r?o.jsx("span",{className:"wx-2YgblL wx-placeholder",children:r}):" "}),x&&!c&&T?o.jsx("i",{className:"wx-2YgblL wx-icon wxi-close",onClick:D}):o.jsx("i",{className:"wx-2YgblL wx-icon wxi-angle-down"}),!c&&o.jsx(Hu,{items:l,onReady:A,onSelect:q,...C,children:({option:E})=>y?y(E):E[g]})]})}const pS=({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?Om(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 gS({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 xS({data:a=[]}){return o.jsx("div",{className:"wx-3nwoO9 wx-notices",children:a.map(l=>o.jsx(gS,{notice:l},l.id))})}function bm({title:a="",buttons:l=["cancel","ok"],header:s,children:r,footer:c,css:d="",onConfirm:h,onCancel:p}){const g=(m.useContext(Ba)||Bu()).getGroup("core"),x=m.useRef(null);m.useEffect(()=>{x.current?.focus()},[]);function v(w){switch(w.code){case"Enter":{const C=w.target.tagName;if(C==="TEXTAREA"||C==="BUTTON")return;h&&h({event:w});break}case"Escape":p&&p({event:w});break}}function y(w,C){const j={event:w,button:C};C==="cancel"?p&&p(j):h&&h(j)}return o.jsx("div",{className:`wx-1FxkZa wx-modal ${d}`,ref:x,tabIndex:0,onKeyDown:v,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(Mo,{type:`block ${w==="ok"?"primary":"secondary"}`,onClick:C=>y(C,w),children:g(w)})},w))})]})})}function yS({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=v=>{r(null),g(v)},p.reject=v=>{r(null),x(v)}})},showNotice:h=>{h={...h},h.id=h.id||Hm(),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(bm,{title:s.title,buttons:s.buttons,onConfirm:s.resolve,onCancel:s.reject,children:s.message}),o.jsx(xS,{data:c})]})}const vS=m.forwardRef(yS);function bS(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(Oy.Provider,{value:r,children:o.jsx(vS,{ref:s,children:l})})}const wS=({value:a=!1,type:l="",icon:s="",disabled:r=!1,iconActive:c="",onClick:d,title:h="",tooltip:p,css:g="",text:x="",textActive:v="",children:y,active:w,onChange:C})=>{const[j,M]=Wa(a),T=m.useMemo(()=>(j?"pressed":"")+(l?" "+l:""),[j,l]),k=m.useCallback(A=>{let L=!j;d&&d(A),A.defaultPrevented||(M(L),C&&C({value:L}))},[j,d,C]);return j&&w?o.jsx(Mo,{title:h,tooltip:p,text:j&&v||x,css:g,type:T,icon:j&&c||s,onClick:k,disabled:r,children:Om(w,{value:j})}):y?o.jsx(Mo,{title:h,tooltip:p,text:j&&v||x,css:g,type:T,icon:j&&c||s,onClick:k,disabled:r,children:y}):o.jsx(Mo,{title:h,tooltip:p,text:j&&v||x,css:g,type:T,icon:j&&c||s,onClick:k,disabled:r})};function SS(){return o.jsx(o.Fragment,{})}function kx(a){const{fonts:l=!0,children:s}=a;return o.jsx(Im.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(SS,{}),o.jsx("link",{rel:"stylesheet",href:"https://cdn.svar.dev/fonts/wxi/wx-icons.css"})]})]})})}Bm(Vn);const Pm={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 Uy=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 CS=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]:Tx(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=su(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=su(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=su(p,r.id);MS(p,x);const v=c?g.data.length:su(g,d.id)+(l==="after"?1:0);if(Tx(g,v,r),p.id===g.id&&x===v)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&&$y(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 $y(a,l){a.forEach(s=>{l.push(s),s.open===!0&&$y(s.data,l)})}function MS(a,l){const s=[...a.data];s.splice(l,1),a.data=s}function Tx(a,l,s){const r=[...a.data];r.splice(l,0,s),a.data=r}function su(a,l){return a?.data.findIndex(s=>s.id===l)}var qy=2,jS=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],v=l[p];if(g&&(x===v&&typeof v!="object"||v instanceof Date&&x instanceof Date&&x.getTime()===v.getTime()))continue;const y=c+(c?".":"")+p;g?(g.__parse(v,y,d,h)&&(r[p]=v),h&qy?d[y]=g.__trigger:g.__trigger()):(v&&v.__reactive?s[p]=this._wrapNested(v,v,y,d):s[p]=this._wrapWritable(v),r[p]=v),d[y]=d[y]||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 Ex(a,l){return Object.defineProperty(a,"__reactive",{value:!0,enumerable:!1,writable:!1}),a}var NS=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=>Gy(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,qy);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 Gy(a,l,s){const r=l.get(a);if(!r)return s;const c=Object.keys(r).map(d=>Gy(d,l,s+1));return Math.max(...c)}var AS=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 Do(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 Dx(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(Rx(l)),d=r.sort(Rx(l));return[...c,...d]}function kS(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 TS(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 Rx({key:a,order:l}){const s=l==="asc"?kS:TS;return(r,c)=>s(r[a],c[a])}function Ym(a,l){const s=a==="/"?1:a.split("/").length;return s>=l.length?null:l[s].id}function ES(a){return a.length>1?a[a.length-2].id:null}let DS=class extends CS{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,v={id:d,date:h,type:p??"file"};x&&(v.lazy=x),g&&(v.size=g),s.push(v);const y=this.serialize(d);y.length&&s.push(...y)}),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()}}},RS=class extends jS{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 v;x?v=p.findFiles(x,g[d].path):v=p.byId(g[d].path)?.data||[];const{path:y,_sorts:w}=g[d];v=Dx(v,w[y]);const C=[];C[d]={_files:v},this.setState({panels:C},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(j=>{const M=p.byId(j);M&&x.push(M)});const{path:v,_sorts:y}=g[d],w=Dx(x,y[v]),C=[];C[d]={_selected:w},this.setState({panels:C},h)}});this._router=new NS(super.setState.bind(this),s,{data:d=>new DS(d)});const r=this.in=new AS;r.on("select-file",({id:d,toggle:h,range:p,panel:g,type:x})=>{const{panels:v,activePanel:y}=this.getState();typeof g>"u"&&(g=y),d||(h=p=!1);let w=[...v[g].selected];if(h){const j=w.indexOf(d);j===-1?w.push(d):w.splice(j,1)}else if(p&&v[g]._lastSelected){const j=v[g]._files;let M=j.findIndex(A=>A.id==v[g]._lastSelected),T=j.findIndex(A=>A.id==d);T<M&&([M,T]=[T,M]);const k=j.slice(M,T+1).map(A=>A.id);w=[...new Set([...w,...k])]}else w=d?[d]:[];const C=[];C[g]={selected:w,_lastSelected:d,_selectNavigation:x==="navigation"},this.setState({panels:C})}),r.on("set-path",({id:d,panel:h,selected:p})=>{const{data:g,activePanel:x}=this.getState(),v=g.byId(d);if(v){const y=[];typeof h>"u"&&(h=x),y[h]={path:d},this.setState({panels:y}),r.exec("select-file",{panel:h}),p&&p.forEach(w=>r.exec("select-file",{id:w,panel:h,toggle:!0})),v.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(),v=g.byId(h);if(v.name!==p){v.name=p;const y=g.normalizeFile(v,v.parent);d.newId=y.id,y.data=null,g.add(y);let w={[h]:y.id};v.data?.forEach(j=>w={...g.moveFiles([j.id],y.id),...w});const C=x.map(j=>({selected:j.selected,_crumbs:j._crumbs,_lastSelected:j._lastSelected,_sorts:j._sorts}));g.remove(h),this._updatePanels(C,w),this.setState({data:g,panels:C})}}),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:v}=this.getState(),y=g.copyFiles(h,p);d.newIds=h.map(w=>y[w]),this.setState({data:g}),x[v].path==p&&(r.exec("select-file",{}),h.forEach(w=>{r.exec("select-file",{id:y[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:v}=this.getState(),y=g.moveFiles(h,p);if(y){d.newIds=h.map(C=>y[C]);const w=x.map(C=>({selected:C.selected,_crumbs:C._crumbs,_lastSelected:C._lastSelected,_sorts:C._sorts}));this._updatePanels(w,y,!0),this.setState({data:g,panels:w}),x[v].path==p&&(r.exec("select-file",{}),h.forEach(C=>{r.exec("select-file",{id:y[C],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:v}=this.getState();p=p??x,g=g??v[p].path;const y=[];y[p]={_sorts:{...v[p]._sorts,[g]:{key:d,order:h}}},this.setState({panels:y})}),this.initOnce()}initOnce(){const l=[];for(let r=0;r<2;r++)l[r]=Ex({_crumbs:[],_files:[],_selected:[],_sorts:{},path:"/",selected:[],...l[r]});const s={panels:Ex(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 LS(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 zS(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 _S(a,l="data-id"){const s=zS(a,l);return s?s.getAttribute(l):null}new Date().valueOf();function OS(a,l){const{api:s}=l;function r(d,h){const p=l.getPanel(),g=p.selected,x=h.ctrlKey||h.metaKey,v=h.shiftKey;let y;const w=g?.[0]?s.getFile(g[0]):null;g?.length?g.length>1?y=l.menuOptions("multiselect"):y=l.menuOptions(w.type,w):y=l.menuOptions("body");const C=`${x?"ctrl+":""}${v?"shift+":""}${d}`,j=y?y.find(T=>T.hotkey?.toLowerCase()===C):!1,M=l.performAction;if(j)switch(C){case"ctrl+c":M("copy");break;case"ctrl+x":M("move");break;case"ctrl+v":M("paste",w);break;case"delete":M("delete");break;case"ctrl+r":h.preventDefault(),M("rename",w);break;case"ctrl+d":h.preventDefault(),M("download",w);break;default:j.handler?.({context:w})}switch(d){case"enter":{if(x||v)break;const{_crumbs:T,_selectNavigation:k}=p;if(k){const A=ES(T);if(A){const L=Ym(A,T);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:T,_selected:k,path:A,_selectNavigation:L}=p;let q;if(k.length){const D=k.at(0).id,$=T.findIndex(E=>E.id===D);if($!==-1){const E=$-1;T[E]?q=T[E].id:A!=="/"&&!(x||v)&&s.exec("select-file",{type:"navigation"})}}else{if(L)break;if(A!=="/"){s.exec("select-file",{type:"navigation"});break}q=T.at(0)?.id}q&&s.exec("select-file",{id:q,toggle:x,range:v});break}case"arrowdown":case"arrowright":{const{_files:T,_selected:k,path:A,_selectNavigation:L}=p;let q;if(k.length){const D=k.at(-1).id,$=T.findIndex(E=>E.id===D);if($!==-1){const E=$+1;T[E]&&(q=T[E].id)}}else{if(A!=="/"&&!L){s.exec("select-file",{type:"navigation"});break}q=T.at(0)?.id}q&&s.exec("select-file",{id:q,toggle:x,range:v});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:+_S(p,"data-panel")})})}return a.addEventListener("keydown",c),{destroy:()=>{a.removeEventListener("keydown",c)}}}function BS(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 HS(a,l="data-id"){const s=a.getAttribute(l);return s?IS(s):null}function IS(a){if(a.startsWith(":"))return a.substring(1);const l=a*1;return isNaN(l)?a:l}function FS(){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 US=FS();new Date().valueOf();function Py(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 $S(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 $S(r[l],s[l],l)}function qS(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 Ma(a,l){const s=a.getState(),r=a.getReactiveState();return qS(r[l],s[l])}function Yy(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 Vy(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 Lx(a,l,s){function r(c){const d=BS(c);if(!d)return;const h=HS(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 US.addEvent(a,s,r)}function GS(a,l){const s=[Lx(a,l,"click")];return l.dblclick&&s.push(Lx(a,l.dblclick,"dblclick")),()=>{s.forEach(r=>r())}}function Qy(a,l){return a.map((s,r)=>{const c=l(s,r);return s.data&&s.data.length&&(c.data=Qy(s.data,l)),c}).filter(Boolean)}function Ky(a,l){const s=[];return a.forEach(r=>{if(r.data){const c=Ky(r.data,l);c.length&&s.push({...r,data:c})}else l(r)&&s.push(r)}),s}function PS(a){return Qy(a,(l,s)=>{const r={...l,id:l.id||Hm()};return r.type&&(r.comp=r.type),r.comp==="separator"&&a[s-1]?.comp==="separator"?null:r})}const Xy={};function YS(a){return Xy[a]||a}function VS(a,l){Xy[a]=l}function QS({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?YS(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 Vm({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[v,y]=m.useState(-1e4),[w,C]=m.useState(-1e4),[j,M]=m.useState(20),[T,k]=m.useState(),A=m.useRef(null),[L,q]=m.useState(!1),[D,$]=m.useState(null),E=m.useCallback(()=>{const K=Ry(A.current,c,r,l,s);K&&(y(K.x),C(K.y),k(K.width));let fe=K?.z??20;const I=c?O0(c):[];let Z=0;for(const ne of I){const O=parseInt(getComputedStyle(ne).zIndex,10);O>Z&&(Z=O)}Z>=fe&&(fe=Z+1),M(fe)},[c,r,l,s]);m.useEffect(()=>{d&&d(E)},[]);const ee=m.useCallback(()=>{q(!1)},[]),de=m.useCallback((K,fe)=>{q(K),$(fe)},[]),V=m.useMemo(()=>PS(a),[a]);m.useEffect(()=>{E()},[c,E]);const J=m.useRef(g),B=m.useRef(x),ie=m.useRef(c);return m.useEffect(()=>{J.current=g},[g]),m.useEffect(()=>{B.current=x},[x]),m.useEffect(()=>{ie.current=c},[c]),m.useEffect(()=>{if(!A.current)return;function K(fe){B.current?B.current(fe):J.current&&J.current({action:null,option:null})}return Ja(A.current,{callback:K,modal:!0,parent:()=>ie.current}).destroy},[]),o.jsx("div",{ref:A,"data-wx-menu":"true",className:`wx-XMmAGqVx wx-menu ${p}`,style:{position:"absolute",top:w+"px",left:v+"px",width:T,zIndex:j},onMouseLeave:ee,children:V.map(K=>o.jsxs(m.Fragment,{children:[K.comp==="separator"?o.jsx("div",{className:"wx-XMmAGqVx wx-separator"}):o.jsx(QS,{option:K,onShow:de,onClick:fe=>{if(!K.data&&!fe.defaultPrevented){const I={context:h,action:K,option:K,event:fe};K.handler&&K.handler(I),g&&g(I),fe.stopPropagation()}}}),K.data&&L===K.id?o.jsx(Vm,{css:p,options:K.data,at:"right-overlap",parent:D,context:h,onClick:g,onCancel:x}):null]},K.id))})}const Zy=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,[v,y]=m.useState(null),[w,C]=m.useState(null),[j,M]=m.useState(0),[T,k]=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(()=>v!==null&&h?Ky(s,ee=>h(ee,v)):s,[v,h,s]);function D(ee){C(null),x&&x(ee)}function $(ee){if(A.current===ee){A.current=null;return}C(null),x&&x({action:null,option:null})}const E=m.useCallback((ee,de)=>{if(!ee){C(null);return}if(ee.defaultPrevented)return;const V=ee.target;if(V&&V.dataset&&V.dataset.menuIgnore)return;if(w&&w===V){C(null),ee.preventDefault();return}M(ee.clientX+1),k(ee.clientY+1);let J=typeof de<"u"?de:Eo(V,L);c&&(J=c(J,ee),!J)||(y(J),C(V),A.current=ee.nativeEvent||ee,ee.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(Fm,{children:o.jsx(Vm,{css:p,at:r,top:T,left:j,parent:w,context:v,onClick:D,onCancel:$,options:q},w)}):null]})}),KS=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 v(j){g(null),h&&h(j)}function y(j){if(x.current===j){x.current=null;return}g(null),h&&h({action:null,option:null})}const w=m.useCallback(j=>{g(j.target),x.current=j.nativeEvent||j,j.preventDefault()},[]);m.useImperativeHandle(l,()=>({show:w}),[w]);function C(j){let M=j.target;for(;!M.dataset.menuIgnore;)g(M),M=M.parentNode}return o.jsxs(o.Fragment,{children:[o.jsx("span",{onClick:C,"data-menu-ignore":"true",children:d}),p?o.jsx(Fm,{children:o.jsx(Vm,{css:c,at:r,parent:p,options:s,onClick:v,onCancel:y})}):null]})}),XS=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,v=m.useRef(null),y=m.useCallback((w,C)=>{v.current.show(w,C)},[]);return m.useImperativeHandle(l,()=>({show:y}),[y]),o.jsxs(o.Fragment,{children:[g?o.jsx("span",{onContextMenu:y,"data-menu-ignore":"true",children:g}):null,o.jsx(Zy,{css:p,at:r,options:s,resolver:c,dataKey:d,filter:h,ref:v,onClick:x})]})}),ZS={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 WS=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 Wy(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 WS(s,c,h,g,a)),x.current.files=l,x.current.ready=r,x.current.signal=d,x.current.drag=p,x.current}function JS(a,l){{if(a){const s=a.getGroup(l);if(s)return s}return Lo(ZS).getGroup(l)}}const e1=()=>Math.random().toString(36).substr(2,9),t1=({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 v=m.useRef(null),y=m.useRef(null),[w,C]=m.useState({}),j=Wy(),M=a||j,T=m.useContext(an.i18n),k=JS(T,"uploader");m.useEffect(()=>{v.current&&r&&(v.current.webkitdirectory=!0)},[r]),m.useEffect(()=>{if(!d&&y.current&&!h)return M.droparea(y.current)},[d,h,y]);const A=V=>{const J=new FormData;return J.append("upload",V.file),fetch(c,{method:"POST",body:J}).then(B=>B.json()).then(B=>({id:V.id,...B}),()=>({id:V.id,status:"error"})).catch(B=>(console.log(B),{id:V.id,status:"error"}))},L=(V,J)=>{const B=M.updateFile(V,J),ie={...B,status:M.getState()};B&&B.uploaded&&B.uploaded(ie),x&&x(ie),B.temp&&M.deleteFile(B.id)},q=V=>{if(!V)return;const J=typeof c=="function"?c(V):A(V);M.setReady(J.then(B=>{B.status=B.status||"server",L(V.id,B)}).catch(B=>{L(V.id,{status:"error",error:B})}))},D=(V,J)=>{const B={...J||w,id:e1(),status:"client",name:V.name,file:V};B.selected&&B.selected(B),g&&g(B),M.addFile(B,s),q(B),v.current&&(v.current.value="")},$=(V,J,B)=>{V.isFile?V.file(ie=>{D(ie,B)}):V.isDirectory&&V.createReader().readEntries(ie=>{ie.forEach(K=>{$(K,J+K.name+"/",B)})})},E=V=>{Array.from(V.target.files).forEach(J=>D(J))},ee=(V,J)=>{Array.from(V.dataTransfer.items).forEach(B=>{const ie=B.webkitGetAsEntry();ie&&$(ie,"",J)})},de=()=>{v.current&&v.current.click()};return m.useEffect(()=>{if(M.signal){const[V,J,B]=M.signal;C(J),V==="click"?de():V==="drop"&&ee(B,J),M.setSignal(null)}},[M.signal]),d?o.jsxs(o.Fragment,{children:[o.jsx("input",{type:"file",className:"wx-at1A8tb8 wx-input",ref:v,onChange:E,accept:l,multiple:s,disabled:h}),p]}):o.jsxs("div",{className:`wx-at1A8tb8 wx-label ${M.drag?"wx-active":""} ${h?"wx-disabled":""}`,ref:y,children:[o.jsx("input",{type:"file",className:"wx-at1A8tb8 wx-input",ref:v,onChange:E,accept:l,multiple:s,disabled:h}),p||o.jsx("div",{className:"wx-at1A8tb8 wx-dropzone",children:o.jsxs("span",{children:[k("Drop files here or")," ",o.jsx("span",{className:"wx-at1A8tb8 wx-action",onClick:de,children:k("select files")})]})})]})};new Date().valueOf();function n1(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(!Iu(r,c))return!1}return!0}function Iu(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(!Iu(a[s],l[s]))return!1;return!0}else return n1(a,l);return a===l}function wm(a){if(typeof a!="object"||a===null)return a;if(a instanceof Date)return new Date(a);if(a instanceof Array)return a.map(wm);const l={};for(const s in a)l[s]=wm(a[s]);return l}var Jy=2,a1=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 v=r+(r?".":"")+h;p?(p.__parse(x,v,c,d)&&(s[h]=x),d&Jy?c[v]=p.__trigger:p.__trigger()):(x&&x.__reactive?l[h]=this._wrapNested(x,x,v,c):l[h]=this._wrapWritable(x),s[h]=x),c[v]=c[v]||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}}}},l1=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=>ev(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,Jy);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 ev(a,l,s){const r=l.get(a);if(!r)return s;const c=Object.keys(r).map(d=>ev(d,l,s+1));return Math.max(...c)}var i1=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 s1(a){return l=>l[a]}function r1(a){return(l,s)=>l[a]=s}function bi(a,l){return(l.getter||s1(l.id))(a)}function Pf(a,l,s){return(l.setter||r1(l.id))(a,s)}function o1(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 vi(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 c1(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=zx("header",h,r,d,c));for(let g=0;g<p.length;g++){const x=[];for(let v=0;v<h.length;v++){let y=vi(p[g],h[v]);s.test(y)&&(y='"'+y.replace(/"/g,'""')+'"'),x.push(y)}r+=(r?c:"")+x.join(d)}return l.footer!==!1&&h[0].footer&&(r=zx("footer",h,r,d,c)),r}function zx(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 u1="portrait",d1=100,f1="a4",m1={a3:{width:11.7,height:16.5},a4:{width:8.27,height:11.7},letter:{width:8.5,height:11}};function h1(a,l){const s=[];let r=[],c=0;const d=a.filter(p=>!p.hidden),h=p1(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 _x(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,v=a[d+x][l][p],y=g.width;for(;!v.rowspan&&!v.colspan;)x++,v=a[d+x][l][p],y+=v.width;g.colspan=x,g.width=y,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 v=g.colspan-(g.colspan+d-a.length);g.colspan=v,g.width=a.slice(d,d+x+1).reduce((y,w)=>y+w.width,0),v>1&&(x=v-1)}for(let v=0;v<x;v++)r[p].push(null)}if(g.rowspan>1){const x=g.rowspan;for(let v=1;v<x;v++)r[p+v]||(r[p+v]=[]),r[p+v].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 v=x||g.findLast(y=>y?.colspan>=1);v&&(v.colspan=v.colspan-1,v.width=v.width-c.width)}}}),r.map(c=>c.filter(d=>d&&d.colspan!==0))}function p1(a){const{mode:l,ppi:s,paper:r}=a,{width:c,height:d}=m1[r];return g1(l==="portrait"?c:d,s)}function g1(a,l){return a*l}function x1(a={}){const{mode:l,ppi:s,paper:r}=a;return{mode:l||u1,ppi:s||d1,paper:r||f1}}function tv(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 y1(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 Ox=["resize-column","hide-column","update-cell"],v1=["delete-row","update-row","update-cell"],b1=["move-item"],w1=["resize-column","move-item"];class S1{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 Iu(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(w1.includes(s)){(r.inProgress&&!this.progress[s]||typeof r.inProgress!="boolean")&&(b1.includes(s)&&this.setPrev("flatData"),Ox.includes(s)&&this.setPrev("columns")),this.progress[s]=r.inProgress;return}v1.includes(s)&&this.setPrev("data"),Ox.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]=wm(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 nv(a,l){return typeof a>"u"||a===null?-1:typeof l>"u"||l===null?1:a===l?0:a>l?1:-1}function C1(a,l){return-nv(a,l)}function M1(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"?nv:C1;return function(r,c){return s(bi(r,l),bi(c,l))}}function j1(a,l){if(!a||!a.length)return;const s=a.map(r=>{const c=l.find(d=>d.id==r.key);return M1(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 ru=28,N1=20;function A1(){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 Du(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 v=0;v<a.length;v++){h.innerText=a[v]+"";const y=d.getBoundingClientRect(),w=Math.ceil(y.width)+(r&&r.length?r[v]:0),C=Math.ceil(y.height);g=Math.max(g||0,w),x=Math.max(x||0,C)}return d.remove(),{width:g,height:x}}function Bx(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:v,vertical:y,collapsed:w,rowspan:C,css:j}=p[x];if(!v){d[x]=Math.max(d[x]||0,r);continue}let M=0;if(y&&!w){let T=`wx-measure-cell-${l}`;if(T+=j?` ${j}`:"",M=Du(v,T,c).width,(C>1||!p[x+1])&&s>x+1){const k=C||s-x,A=d.slice(x,x+k).reduce((L,q)=>L+q,0);if(A<M){const L=Math.ceil((M-A)/k);for(let q=x;q<x+k;q++)d[q]=(d[q]||r)+L}continue}}d[x]=Math.max(d[x]||r,M)}}return d}function k1(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=vi(p,a);g&&(r.push(g),a.treetoggle?c.push(l[h].$level*ru+(l[h].$count?ru:0)+(a.draggable?ru:0)):a.draggable&&c.push(ru))}return Du(r,d,s,c).width}function T1(a,l){const s="wx-measure-cell-header",r=a.sort?N1:0;let c=a.header;if(typeof c=="string")return Du(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 v=Du(g,x,l).width;h===c.length-1&&(v+=r),d=Math.max(d||0,v)}return d}const E1={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&&R1(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 av(a){return E1[a]}function D1(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):av(h)(x,p)})}return r=>{for(let c=0;c<s.length;c++)if(!s[c](r))return!1;return!0}}function R1(a,l){return a.getFullYear()===l.getFullYear()&&a.getMonth()===l.getMonth()&&a.getDate()===l.getDate()}let L1=class extends a1{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 l1(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,C)=>Math.max(C.header.length,w),0),v=g.reduce((w,C)=>Math.max(C.footer.length,w),0);g.forEach(this.setCollapsibleColumns);const y=this.normalizeSizes(g,h,x,v,p);for(let w=0;w<g.length;w++)this.normalizeColumns(g,w,"header",x,y),this.normalizeColumns(g,w,"footer",v,y);this.setState({_columns:g,_sizes:y},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),v=h?this.flattenRows(d,[],g):x?d.filter(w=>x.has(w.id)):d,y=!p&&v.some(w=>w.rowHeight);this.setState({flatData:v,_rowHeightFromData:y},c)}}],{sizes:c=>({...s,...c})});const r=this.in=new i1;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:vi(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)};Pf(p,h,c),d.renderedValue=vi(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:v,after:y,select:w}=c;if(c.id=x.id=c.id||x.id||ou(),v||y){const j=v||y,M=h.findIndex(T=>T.id===j);h=[...h],h.splice(M+(y?1:0),0,c.row)}else h=[...h,c.row];const C={data:h};g&&(C._filterIds=[...g,c.id]),this.setState(C),!(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,v={data:d.filter(y=>y.id!==x)};this.isSelected(x)&&(v.selectedRows=h.filter(y=>y!==x)),g?.id===x&&(v.editor=null),this.setState(v),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:v}=c,y=this.getColumn(x);if(p){const w={...this._branches[g]};Pf(w,y,v);const C=this.updateTreeRow(w);w.$parent===0&&(h=C)}else{const w=h.findIndex(j=>j.id===g),C={...h[w]};Pf(C,y,v),h[w]=C}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 v=this.getState(),{focusCell:y}=v;let{selectedRows:w}=v;if(w.length||(h=d=!1),h){const{data:C}=this.getState();let j=C.findIndex(T=>T.id===w[w.length-1]),M=C.findIndex(T=>T.id===c);j>M&&([j,M]=[M,j]),C.slice(j,M+1).forEach(T=>{this.isSelected(T.id)||w.push(T.id)})}else if(d&&this.isSelected(c)){if(p===!0)return;w=w.filter(C=>C!==c)}else if(d){if(p===!1)return;w.push(c)}else w=[c];this.setState({selectedRows:[...w]}),y?.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(v=>v.id===c.column)>=x.left)&&(!x.right||g.findIndex(v=>v.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 v=[...this.getState().columns],y=this.getColumn(d);if(h){if(h==="data"||h===!0){const{flatData:w,_skin:C}=this.getState();let j=w.length;p&&(j=Math.min(p,j));const M=w.slice(0,j);x=k1(y,M,C)}if(h==="header"||h===!0){const{_skin:w}=this.getState();x=Math.max(T1(y,w),x)}}y.width=Math.max(17,x),delete y.flexgrow,this.setState({columns:v})}),r.on("hide-column",c=>{const{id:d,mode:h}=c,p=[...this.getState().columns],g=this.getColumn(d),x=p.reduce((v,y)=>v+(y.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:v,tree:y}=g;if(p){const A=[...v];A.sort(p),this.setState({data:A});return}const{order:w="asc"}=c;let C=g.sortMarks;const j=Object.keys(C),M=j.length;!h||!M||M===1&&C[d]?C={[d]:{order:w}}:(M===1&&(C[j[0]]={...C[j[0]],index:0}),C={...C,[d]:{order:w,index:typeof h=="number"?h:C[d]?.index??M}});const T=Object.keys(C).sort((A,L)=>C[A].index-C[L].index).map(A=>({key:A,order:C[A].order}));this.setState({sortMarks:C});const k=j1(T,x);if(k){const A=[...v];y?this.sortTree(A,k):A.sort(k),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:v,_columns:y}=g;let w=g.filterValues;const C={};h&&(w={...w,[h]:d},C.filterValues=w);const j=p??D1(w,y);let M=[];v?M=this.filterTree(x,j,M):x.forEach(T=>{j(T)&&M.push(T.id)}),C._filterIds=M,this.setState(C)}),r.on("collapse-column",c=>{const{id:d,row:h,mode:p}=c,g=[...this.getState().columns],x=this.getColumn(d).header,v=Array.isArray(x)?x[h]:x;typeof v=="object"&&(v.collapsed=p??!v.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:v,tree:y}=this.getState(),w=v.findIndex(M=>M.id===d);let C;if(g==="up"||g==="down"){if(g==="up"){if(w===0)return;C=w-1,g="before"}else if(g==="down"){if(w===v.length-1)return;C=w+1,g="after"}p=v[C]&&v[C].id}else C=v.findIndex(M=>M.id===p);if(w===-1||C===-1||h===!1)return;let j;y||(j=this.moveItem(d,p,x,g)),this.setState({data:y?this.normalizeTreeRows(j):j})}),r.on("copy-row",c=>{const{id:d,target:h,mode:p="after"}=c,g=this.getState(),{flatData:x,_filterIds:v}=g;let{data:y}=g;const w=this.getRow(d);if(!w)return;const C={...w,id:ou()};c.id=C.id;const j=x.findIndex(T=>T.id===h);if(j===-1)return;y.splice(j+(p==="after"?1:0),0,C),y=[...y];const M={data:y};v&&(M._filterIds=[...v,C.id]),this.setState(M)}),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=c1(this.getState(),c.csv||{});c.download!==!1?o1(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 v=g?g.column:this._getFirstVisibleColumn()?.id,y=g?this.getPrevRow(g.row)?.id:p[p.length-1]?.id;v&&y&&(this.in.exec("focus-cell",{row:y,column:v,eventSource:"key"}),x&&this.in.exec("select-row",{id:y}));break}case"arrowdown":{const{flatData:p,focusCell:g,select:x}=this.getState();if(d.preventDefault(),h)return;const v=g?g.column:this._getFirstVisibleColumn()?.id,y=g?this.getNextRow(g.row)?.id:p[0]?.id;v&&y&&(this.in.exec("focus-cell",{row:y,column:v,eventSource:"key"}),x&&this.in.exec("select-row",{id:y}));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 v=p.column;let y=p.id,w=this.getNextEditor(this.getRow(y),this.getColumn(v));if(!w){const C=this.getNextRow(y);C&&(y=C.id,w=this.getNextEditor(C))}w&&(this.in.exec("open-editor",{id:y,column:w.id}),this.in.exec("focus-cell",{row:y,column:w.id,eventSource:"key"}),x&&!this.isSelected(y)&&this.in.exec("select-row",{id:y}))}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 v=p.column;let y=p.id,w=this.getPrevEditor(this.getRow(y),this.getColumn(v));if(!w){const C=this.getPrevRow(y);C&&(y=C.id,w=this.getPrevEditor(C))}w&&(this.in.exec("open-editor",{id:y,column:w.id}),this.in.exec("focus-cell",{row:y,column:w.id,eventSource:"key"}),x&&!this.isSelected(y)&&this.in.exec("select-row",{id:y}))}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:v}=this.getState();if(!p&&g){d.preventDefault();const y=x[0]?.id,w=this._getFirstVisibleColumn()?.id;y&&w&&(this.in.exec("focus-cell",{row:y,column:w,eventSource:"key"}),v&&!this.isSelected(y)&&this.in.exec("select-row",{id:y}))}break}case"end":{const{editor:p,focusCell:g}=this.getState();if(!p&&g){d.preventDefault();const x=this._getLastVisibleColumn()?.id,v=g.row;this.in.exec("focus-cell",{row:v,column:x,eventSource:"key"})}break}case"ctrl+end":{const{editor:p,focusCell:g,flatData:x,select:v}=this.getState();if(!p&&g){d.preventDefault();const y=x.at(-1).id,w=this._getLastVisibleColumn()?.id;y&&w&&(this.in.exec("focus-cell",{row:y,column:w,eventSource:"key"}),v&&!this.isSelected(y)&&this.in.exec("select-row",{id:y}))}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:v}=this.getState();let y=-1,w=-1,C=0,j=0;if(c.column){y=0;const M=d.findIndex(T=>T.id===c.column);C=d[M].width;for(let T=h.left??0;T<M;T++){const k=d[T];k.hidden||(y+=k.width)}}if(c.row&&!x){const M=g.findIndex(T=>T.id===c.row);M>=0&&(v?(w=g.slice(0,M).reduce((T,k)=>T+(k.rowHeight||p.rowHeight),0),j=g[M].rowHeight):w=p.rowHeight*M)}this.setState({scroll:{top:w,left:y,width:C,height:j||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=x1(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=A1()),l.columns&&l.columns.forEach(s=>{s.options&&(s.optionsMap=new Map(s.options.map(r=>[r.id,r.label])))}),Iu(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 S1(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 v=x;v<p;v++){const y=r[s+v];y&&(y.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 v=p[x];v.id=h.id,x===p.length-1&&(v.rowspan=v.rowspan?Math.min(v.rowspan,c-x):c-x);for(let y=1;y<v.rowspan;y++){p.splice(x+y,0,{_hidden:!0});for(let w=1;w<v.colspan;w++)l[s+w][r].splice(x+y,0,{})}if(v.rowspan){const y=(v.rowspan===c?g:g.slice(x,v.rowspan+x)).reduce((w,C)=>w+C,0);v.height=y,x+v.rowspan!=c&&v.height--}if(v.colspan){let y=h.width,w=h.flexgrow||0;const C=v.colspan;for(let j=1;j<C;j++){const M=l[s+j];M&&(M.hidden?v.colspan-=1:M.flexgrow?w+=M.flexgrow:y+=M.width||d.columnWidth),w?v.flexgrow=w:v.width=y}}else v.width=h.width,v.flexgrow=h.flexgrow;r==="header"&&v.filter&&typeof v.filter=="string"&&(v.filter={type:v.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=ou());return l}normalizeTreeRows(l,s,r){return!s&&!r&&(this._branches={0:{data:l}}),l.forEach(c=>{c.id||(c.id=ou()),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 v=bi(x,d);return h?.handler?h.handler(v,g):av(p)(v,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 v=vi(p,x);String(v).toLowerCase().includes(l)&&(g[x.id]=!0)}),Object.keys(g).length&&(r[p.id]=g)}),r}normalizeSizes(l,s,r,c,d){const h=Bx(l,"header",r,s.headerHeight,d),p=Bx(l,"footer",c,s.footerHeight,d),g=h.reduce((v,y)=>v+y,0),x=p.reduce((v,y)=>v+y,0);return{...s,headerRowHeights:h,footerRowHeights:p,headerHeight:g,footerHeight:x}}},z1=new Date().valueOf();function ou(){return"temp://"+z1++}function _1(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 O1=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)}}},nr=[],B1={subscribe:a=>{H1();const l=new O1;return nr.push(l),a(l),()=>{const s=nr.findIndex(r=>r===l);s>=0&&nr.splice(s,1)}}},Hx=!1;function H1(){Hx||(Hx=!0,document.addEventListener("keydown",a=>{if(nr.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=nr.length-1;c>=0;c--){const d=nr[c],h=d.store.get(r)||d.store.get(s);h&&d.node.contains(a.target)&&h(a,{key:r,evKey:s})}}}))}const I1={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 F1(a,{keys:l,exec:s}){if(!l)return;function r(h){const p=h.target;return p.tagName==="INPUT"||p.tagName==="TEXTAREA"||_1(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=B1.subscribe(h=>{h.configure(c,a)});return{destroy:()=>{d()}}}function U1(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(),v=l.getScrollMargin();if(d>=0){const y=a.scrollTop;d<y?a.scrollTop=d:d+h>y+g&&(a.scrollTop=d-g+h)}if(c>=0){const y=a.scrollLeft;c<y?a.scrollLeft=c:c+p>y+x-v&&(a.scrollLeft=c-x+p+v)}}),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 $1(a,l){const s=new ResizeObserver(r=>{requestAnimationFrame(()=>l(r[0].contentRect))});return s.observe(a.parentNode),{destroy(){s.disconnect()}}}const Ix=5,q1=700;function yu(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 Sm(a,l){const s=yu(l);return{x:a.clientX-s.x,y:a.clientY-s.y}}function G1(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 v(E){const ee=lr(E);ee&&(r={container:g,sourceNode:E.target,from:Ou(ee),pos:Sm(E,a)},d=r.pos,y(E))}function y(E){if(!r)return;const ee=r.pos=Sm(E,a);if(!h){if(!p&&!E?.target?.getAttribute("draggable-data")&&Math.abs(d.x-ee.x)<Ix&&Math.abs(d.y-ee.y)<Ix)return;if(D(E)===!1)return $()}if(p){const de=window.scrollX||document.documentElement.scrollLeft||document.body.scrollLeft,V=window.scrollY||document.documentElement.scrollTop||document.body.scrollTop;r.targetNode=document.elementFromPoint(E.pageX-de,E.pageY-V)}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,$()}function C(E){s.getReorder&&!s.getReorder()||E.button===0&&(q(E),window.addEventListener("mousemove",j),window.addEventListener("mouseup",M),v(E))}function j(E){y(E)}function M(E){w(E)}function T(E){if(s.getReorder&&!s.getReorder())return;c=setTimeout(()=>{p=!0,v(E.touches[0])},q1),q(E);function ee(){c&&x(),E.target.removeEventListener("touchmove",k),E.target.removeEventListener("touchend",ee),w(E)}E.target.addEventListener("touchmove",k),E.target.addEventListener("touchend",ee),a.addEventListener("contextmenu",A)}function k(E){h?(E.preventDefault(),y(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:ee}=s.getDraggableInfo();(!ee||E.target.getAttribute("draggable-data"))&&(document.body.style.userSelect="none",document.body.style.webkitUserSelect="none")}function D(E){if(h=!0,s.start){if(s.start(E,r)===!1)return!1;a.appendChild(g),document.body.style.cursor="move"}}function $(E){h=p=!1,document.body.style.cursor="",document.body.style.userSelect="",document.body.style.webkitUserSelect="",window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",M),E&&(a.removeEventListener("mousedown",C),a.removeEventListener("touchstart",T),a.removeEventListener("dragstart",L))}return a.addEventListener("mousedown",C),a.addEventListener("touchstart",T),a.addEventListener("dragstart",L),{destroy(){$(!0)}}}const P1=.004;function Y1(){return{dirX:0,dirY:0,scrollSpeedFactor:1}}function V1(a,l,s,r){const{node:c,left:d,top:h,bottom:p,sense:g,xScroll:x,yScroll:v}=r,y=Sm(a,c);s.scrollState||(s.scrollState=Y1());let w=0,C=0;y.x<d+g?w=-1:y.x>l.width-g&&(w=1),y.y<h+Math.round(g/2)?C=-1:y.y>l.height-p-Math.round(g/2)&&(C=1),(s.scrollState.dirX!==w||s.scrollState.dirY!==C)&&(lv(s),s.scrollState.dirX=w,s.scrollState.dirY=C),(x&&s.scrollState.dirX!==0||v&&s.scrollState.dirY!==0)&&Q1(s,r,{x:s.scrollState.dirX,y:s.scrollState.dirY})}function Q1(a,l,s){a.autoScrollTimer||(a.autoScrollTimer=setTimeout(()=>{a.activeAutoScroll=setInterval(K1,15,a,l,s)},250))}function lv(a){a.scrollSpeedFactor=1,a.autoScrollTimer&&(a.autoScrollTimer=clearTimeout(a.autoScrollTimer),a.activeAutoScroll=clearInterval(a.activeAutoScroll))}function K1(a,l,s){const{x:r,y:c}=s;a.scrollSpeedFactor+=P1,r!==0&&Z1(a,l,r),c!==0&&X1(a,l,c)}function X1(a,l,s){const r=l.node.scrollTop;iv(r+Math.round(l.sense/3)*a.scrollSpeedFactor*s,"scrollTop",l)}function Z1(a,l,s){const r=l.node.scrollLeft;iv(r+Math.round(l.sense/3)*a.scrollSpeedFactor*s,"scrollLeft",l)}function iv(a,l,s){s.node[l]=a}function Fu(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 sv(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 W1(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"),v=Ue(p,"reorder"),y=m.useMemo(()=>x?.rows[l.id]&&x.rows[l.id][s.id],[x,l.id,s.id]),w=m.useMemo(()=>Fu(s.width,s.flexgrow,s.fixed,s.left,s.right),[s.width,s.flexgrow,s.fixed,s.left,s.right]);function C(D,$){let E="wx-cell";return E+=s.fixed?" "+(s.fixed===-1?"wx-shadow":"wx-fixed"):"",E+=D?" "+D(s):"",E+=$?" "+$(l,s):"",E+=s.treetoggle?" wx-tree-cell":"",E}const j=m.useMemo(()=>C(c,r),[c,r,s,l]),M=m.useMemo(()=>typeof s.draggable=="function"?s.draggable(l,s)!==!1:s.draggable,[s,l]),T=m.useRef(null);m.useEffect(()=>{T.current&&h&&g?.row===l.id&&g?.column===s.id&&T.current.focus()},[g,h,l.id,s.id]);const k=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(D){const $=new RegExp(`(${x.value.trim()})`,"gi");return String(D).split($).map(E=>({text:E,highlight:$.test(E)}))}const L=m.useMemo(()=>{const D=s.fixed&&s.fixed.left===-1||s.fixed.right===-1,$=s.fixed&&s.fixed.right;return[j,D?"wx-shadow":"",$?"wx-fixed-right":""].filter(Boolean).join(" ")},[j,s]),q=s.cell;return o.jsxs("div",{className:"wx-TSCaXsGV "+L,ref:T,onFocus:k,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:[v&&s.draggable?M?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:D,data:$})=>p.exec(D,$)}):d?d():y?o.jsx("span",{children:A(vi(l,s)).map(({highlight:D,text:$},E)=>D?o.jsx("mark",{className:"wx-TSCaXsGV wx-search",children:$},E):o.jsx("span",{children:$},E))}):vi(l,s)]})}function Fx(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 J1({filter:a,column:l,action:s,filterValue:r}){function c({value:d}){s({value:d,key:l.id})}return o.jsx($m,{...a.config??{},value:r,onChange:c})}function eC({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 y=[];return d.forEach(w=>{const C=bi(w,l);y.includes(C)||y.push(C)}),y.map(w=>({id:w,label:w}))}function x({value:y}){s({value:y,key:l.id})}function v(y){y.key!=="Tab"&&y.preventDefault()}return o.jsx("div",{style:{width:"100%"},onKeyDown:v,children:o.jsx(hS,{placeholder:"",clear:!0,...a?.config??{},options:h,value:r,onChange:x,children:y=>p?p(y):y.label})})}function tC({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(mS,{placeholder:"",clear:!0,...a?.config??{},value:r,onChange:c})})}function rv(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:v,onAction:y}=a,[w,C]=Py(l||[]),j=m.useMemo(()=>(w||[]).map(V=>s.find(J=>J.id===V)).filter(Boolean),[w,s]),M=m.useRef(null),T=m.useRef(null),[k,A]=m.useState(null),L=()=>{const V=w||[];if(!V.length)return 0;const J=s.find(B=>V.includes(B.id));return J?s.indexOf(J):0};function q(V){T.current=V.navigate,A(()=>V.keydown),x&&V.navigate(L())}m.useEffect(()=>{x&&(M.current?.focus(),typeof window<"u"&&window.getSelection&&window.getSelection().removeAllRanges())},[]);function D({id:V}){C(V),v&&v({value:V})}function $(V){V.stopPropagation(),C([]),v&&v({value:[]})}function E(){T.current?.(L())}function ee(){T.current?.(null)}function de(V){k?.(V,L())}return o.jsxs("div",{ref:M,className:"wx-multiselect wx-aadNNOwy",onClick:E,onKeyDown:de,tabIndex:0,children:[o.jsx("div",{className:"wx-label wx-aadNNOwy",children:h?h(j):p?o.jsx(p,{data:j,onAction:y}):d?o.jsx("span",{className:"wx-text wx-aadNNOwy",children:d}):j.length?o.jsx("span",{className:"wx-text wx-aadNNOwy",children:j.map(V=>V.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:$}):o.jsx("i",{className:"wx-icon wxi-angle-down wx-aadNNOwy"}),o.jsx(Hu,{items:s,onReady:q,onSelect:D,multiselect:!0,checkboxes:!0,value:w||[],onCancel:ee,...g,children:({option:V})=>o.jsx("div",{className:"wx-option wx-aadNNOwy",children:h?h(V):p?o.jsx(p,{data:V,onAction:y}):V.label})})]})}function nC({filter:a,column:l,action:s,filterValue:r}){const c=m.useContext(an.i18n)?.getGroup("grid")||Lo(Pm).getGroup("grid"),d=m.useMemo(()=>({clear:!0,...a?.config||{}}),[a]),h=m.useMemo(()=>d.options||l.options,[d,l]),p=m.useMemo(()=>{const v=r?.length;return v?v<3?r.map(y=>l.optionsMap.get(y)).join(", "):v+" "+c("selected"):""},[r,l,c]);function g({value:v}){s({value:v,key:l.id})}function x(v){v.key!=="Tab"&&v.preventDefault()}return o.jsx("div",{style:{width:"100%"},onKeyDown:x,children:o.jsx(rv,{placeholder:"",...d,options:h,value:r||[],text:p,onChange:g})})}const aC={text:J1,richselect:eC,datepicker:tC,multiselect:nC};function lC({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(()=>aC[a.type],[a.type]);return o.jsx(d,{filter:a,column:l,action:c,filterValue:r[l.id]})}function iC(a){const{cell:l,column:s,row:r,lastRow:c,sortRow:d,columnStyle:h,bodyHeight:p,hasSplit:g}=a,x=m.useContext(ia),v=Ue(x,"sortMarks"),y=m.useMemo(()=>v?v[s.id]:void 0,[v,s.id]),w=m.useRef(),C=m.useCallback(K=>{w.current=l.flexgrow?K.parentNode.clientWidth:l.width},[l.flexgrow,l.width]),j=m.useCallback((K,fe)=>{x.exec("resize-column",{id:l.id,width:Math.max(1,(w.current||0)+K),inProgress:fe})},[x,l.id]),M=m.useCallback(K=>j(K,!0),[j]),T=m.useCallback(K=>j(K,!1),[j]),k=m.useCallback(K=>{if(!s.sort||l.filter)return;let fe=y?.order;fe&&(fe=fe==="asc"?"desc":"asc"),x.exec("sort-rows",{key:l.id,add:K.ctrlKey||K.metaKey,order:fe})},[x,l.id,l.filter,s.sort,y?.order]),A=m.useCallback(K=>{K&&K.stopPropagation(),x.exec("collapse-column",{id:l.id,row:r})},[x,l.id,r]),L=m.useCallback(K=>{K.key==="Enter"&&A()},[A]),q=m.useCallback(K=>{K.key==="Enter"&&!l.filter&&k(K)},[k,l.filter]),D=m.useMemo(()=>l.collapsed&&s.collapsed,[l.collapsed,s.collapsed]),$=m.useMemo(()=>D&&!g&&l.collapsible!=="header",[D,g,l.collapsible]),E=m.useMemo(()=>$?{top:-p/2,position:"absolute"}:{},[$,p]),ee=m.useMemo(()=>Fu(l.width,l.flexgrow,s.fixed,s.left,l.right??s.right,l.height+(D&&$?p:0)),[l.width,l.flexgrow,s.fixed,s.left,l.right,s.right,l.height,D,$,p]),de=m.useMemo(()=>sv(s,l,h),[s,l,h]),V=m.useCallback(()=>Object.fromEntries(Object.entries(l).filter(([K])=>K!=="cell")),[l]),J=`wx-cell ${de} ${l.css||""} wx-collapsed`,B=["wx-cell",de,l.css||"",l.filter?"wx-filter":"",s.fixed&&s.fixed.right?"wx-fixed-right":""].filter(Boolean).join(" "),ie=m.useRef(null);return m.useEffect(()=>{const K=ie.current;if(!K)return;const fe=Fx(K,{down:C,move:M,up:T});return()=>{typeof fe=="function"&&fe()}},[C,M,T,Fx]),D?o.jsx("div",{className:"wx-RsQD74qC "+J,style:ee,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 "+B,style:ee,onClick:k,"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":!y?.order||l.filter?"none":y?.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 K=l.cell;return o.jsx(K,{api:x,cell:V(),column:s,row:r,onAction:({action:fe,data:I})=>x.exec(fe,I)})})():l.filter?o.jsx(lC,{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:ie,onClick:K=>K.stopPropagation(),children:o.jsx("div",{})}):null,d?o.jsx("div",{className:"wx-RsQD74qC wx-sort",children:y?o.jsxs(o.Fragment,{children:[typeof y.index<"u"?o.jsx("div",{className:"wx-RsQD74qC wx-order",children:y.index+1}):null,o.jsx("i",{className:`wx-RsQD74qC wxi-arrow-${y.order==="asc"?"up":"down"}`})]}):null}):null]})}function sC({cell:a,column:l,row:s,columnStyle:r}){const c=m.useContext(ia),d=m.useMemo(()=>Fu(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(()=>sv(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?Dm.createElement(a.cell,{api:c,cell:p(),column:l,row:s,onAction:({action:x,data:v})=>c.exec(x,v)}):o.jsx("div",{className:"wx-6Sdi3Dfd wx-text",children:a?.text||""}):null})}function Ux({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]),v=m.useMemo(()=>{let M=[];if(s&&s.length){const T=s[0][r].length;for(let k=0;k<T;k++){let A=0;M.push([]),s.forEach((L,q)=>{const D={...L[r][k]};A||M[k].push(D),D.colspan>1?A=D.colspan-1:A&&A--})}}return M},[s,r]),y=m.useMemo(()=>g?.left||g?.right,[g]);function w(M){return s.find(T=>T.id===M)}function C(M,T){let k=T;return M.rowspan&&(k+=M.rowspan-1),k===v.length-1}function j(M,T,k){if(!k.sort)return!1;for(let A=v.length-1;A>=0;A--){const L=k.header[A];if(!L.filter&&!L._hidden)return T===A}return C(M,T)}return o.jsx("div",{className:`wx-sAsPVaUK wx-${r}`,style:{paddingLeft:`${a}px`,width:`${l}px`},role:"rowgroup",children:v.map((M,T)=>o.jsx("div",{className:r==="header"?"wx-sAsPVaUK wx-h-row":"wx-sAsPVaUK wx-f-row",style:{height:`${x?.[T]}px`,display:"flex"},role:"row",children:M.map(k=>{const A=w(k.id);return r==="header"?o.jsx(iC,{cell:k,columnStyle:c,column:A,row:T,lastRow:C(k,T),bodyHeight:d,sortRow:j(k,T,A),hasSplit:y},k.id):o.jsx(sC,{cell:k,columnStyle:c,column:w(k.id),row:T},k.id)})},T))})}function rC({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 oC(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 v=Ja(p.current,()=>s(!0));return()=>v.destroy()},[s]);function g(){p.current&&(d(p.current.value),r(p.current.value))}function x({key:v}){v==="Enter"&&s()}return o.jsx("input",{className:"wx-e7Ao5ejY wx-text",onInput:g,onKeyDown:x,ref:p,type:h,value:c})}function cC({editor:a,onAction:l,onSave:s,onApply:r,onCancel:c}){const[d,h]=m.useState(a?.value),[p,g]=m.useState(a?.renderedValue),[x,v]=m.useState(a?.options||[]),y=m.useMemo(()=>a?.config?.template,[a]),w=m.useMemo(()=>a?.config?.cell,[a]),C=m.useMemo(()=>a?.config?.dropdown||{},[a]),j=m.useMemo(()=>({trackScroll:!0,...C}),[C]),M=m.useMemo(()=>(x||[]).findIndex(E=>E.id===d),[x,d]),T=m.useRef(null),k=m.useRef(null),A=m.useCallback(E=>{T.current=E.navigate,k.current=E.keydown,T.current(M)},[M,T]),L=m.useCallback(E=>{const ee=E?.target?.value??"";g(ee);const de=ee?(a?.options||[]).filter(V=>(V.label||"").toLowerCase().includes(ee.toLowerCase())):a?.options||[];v(de),de.length?T.current(-1/0):T.current(null)},[a]),q=m.useRef(null);m.useEffect(()=>{q.current&&q.current.focus()},[]);const D=m.useRef(s);m.useEffect(()=>{D.current=s},[s]),m.useEffect(()=>{if(!q.current)return;const E=Ja(q.current,()=>D.current(!0));return()=>E.destroy()},[]),m.useEffect(()=>{h(a?.value),g(a?.renderedValue),v(a?.options||[])},[a]);const $=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=>k.current?k.current(E,M):void 0}),o.jsx(Hu,{items:x,onReady:A,onSelect:$,...j,onCancel:c,children:({option:E})=>y?y(E):w?o.jsx(w,{data:E,onAction:l}):E.label})]})}function uC({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 v({value:j}){r(j),s()}const y=m.useRef(null),[w,C]=m.useState(null);return m.useEffect(()=>{y.current&&y.current.focus(),typeof window<"u"&&window.getSelection&&window.getSelection().removeAllRanges()},[]),m.useEffect(()=>{if(!w)return;const j=Ja(w,()=>s(!0));return()=>j.destroy()},[w,s]),o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"wx-lNWNYUb6 wx-value",ref:y,tabIndex:0,onClick:c,onKeyDown:j=>j.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(Um,{...x,onCancel:c,children:o.jsx("div",{ref:C,className:"wx-lNWNYUb6",children:o.jsx(Fy,{value:d,onChange:v,buttons:a.config?.buttons})})})]})}function dC(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)),[v]=m.useState(l.value),[y]=m.useState(l.options),w=m.useMemo(()=>y.findIndex(L=>L.id===v),[y,v]);function C({id:L}){c(L),r()}let j;const[M,T]=m.useState();function k(L){j=L.navigate,T(()=>L.keydown),j(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=>{M(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(Hu,{items:y,onReady:k,onSelect:C,...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 fC(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 v({value:w}){c(w)}const y=m.useRef(null);return m.useEffect(()=>{if(!y.current)return;const w=Ja(y.current,()=>r(!0));return()=>w.destroy()},[r]),o.jsx("div",{ref:y,className:"wx-value wx-aacZ4gNU",onClick:()=>r(!0),children:o.jsx(rv,{value:p,options:h,text:g,template:d.template,cell:d.cell,clear:d.clear,dropdown:x,autoOpen:!0,onChange:v,onAction:s})})}const mC={text:oC,combo:cC,datepicker:uC,richselect:dC,multiselect:fC};function hC({column:a,row:l}){const s=m.useContext(ia),r=Ue(s,"editor"),c=m.useCallback((j,M)=>{s.exec("close-editor",{ignore:j}),M&&s.exec("focus-cell",{...M,eventSource:"click"})},[s]),d=m.useCallback(j=>{const M=j?null:{row:r?.id,column:r?.column};c(!1,M)},[r,c]),h=m.useCallback(()=>{c(!0,{row:r?.id,column:r?.column})},[r,c]),p=m.useCallback(j=>{s.exec("editor",{value:j})},[s]),g=m.useCallback(j=>{j.key==="Enter"&&r&&(a.editor.type==="multiselect"?p(r.value):h())},[r,a.editor,h,p]),x=m.useMemo(()=>Fu(a.width,a.flexgrow,a.fixed,a.left,a.right),[a.width,a.flexgrow,a.fixed,a.left,a.right]),v=m.useMemo(()=>{let j=a.editor;if(typeof j=="function"&&(j=j(l,a)),!j)return null;let M=typeof j=="string"?j:j.type;return mC[M]},[a,l]),y=m.useRef(null);m.useEffect(()=>{y.current&&typeof x=="string"&&y.current.setAttribute("style",x)},[x]);const w=typeof l.$parent<"u"?"gridcell":"cell",C=typeof l.$parent<"u"?!a.editor:void 0;return o.jsx("div",{className:"wx-8l724t2g wx-cell wx-editor",ref:y,style:typeof x=="object"&&x!==null?x:void 0,role:w,"aria-readonly":C,tabIndex:-1,onClick:j=>j.stopPropagation(),onDoubleClick:j=>j.stopPropagation(),onKeyDown:g,children:v?o.jsx(v,{editor:r,onSave:d,onApply:p,onCancel:h,onAction:({action:j,data:M})=>s.exec(j,M)}):null})}function $x(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,v)=>o.jsx("tr",{children:x.map(y=>{const w=h.find(M=>M.id===y.id),C=`wx-print-cell-${s}${g(w)}${y.filter?" wx-print-cell-filter":""}${y.vertical?" wx-vertical":""}`,j=y.cell;return o.jsx("th",{style:Yy(tv(y,p.columnWidth)),className:"wx-Gy81xq2u "+C,rowSpan:y.rowspan,colSpan:y.colspan,children:j?o.jsx(j,{api:c,cell:Object.fromEntries(Object.entries(y).filter(([M])=>M!=="cell")),column:w,row:v}):y.filter?o.jsx("div",{className:"wx-Gy81xq2u wx-print-filter",children:y1(d,h,y)}):o.jsx("div",{className:"wx-Gy81xq2u wx-text",children:y.text??""})},y.id)})},v))})}function pC(a){const{columns:l,rowStyle:s,columnStyle:r,cellStyle:c,header:d,footer:h,reorder:p}=a,g=m.useContext(ia),{flatData:x,_sizes:v}=g.getState(),y=d&&_x(l,"header",v.headerRowHeights),w=h&&_x(l,"footer",v.footerRowHeights);function C(M,T){let k="";return k+=r?" "+r(T):"",k+=c?" "+c(M,T):"",k}function j(M,T){return typeof T.draggable=="function"?T.draggable(M,T)!==!1:T.draggable}return o.jsxs("table",{className:`wx-8NTMLH0z wx-print-grid ${l.some(M=>M.flexgrow)?"wx-flex-columns":""}`,children:[d?o.jsx("thead",{children:o.jsx($x,{columns:y,type:"header",columnStyle:r})}):null,o.jsx("tbody",{children:x.map((M,T)=>o.jsx("tr",{className:"wx-8NTMLH0z wx-row"+(s?" "+s(M):""),style:{height:`${M.rowHeight||v.rowHeight}px`},children:l.map(k=>k.collapsed?null:o.jsxs("td",{className:`wx-8NTMLH0z wx-print-cell wx-cell ${C(M,k)}`,style:Yy(tv(k,v.columnWidth)),children:[p&&k.draggable?o.jsx("span",{className:"wx-8NTMLH0z wx-print-draggable",children:j(M,k)?o.jsx("i",{className:"wx-8NTMLH0z wxi-drag"}):null}):null,k.treetoggle?o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{marginLeft:M.$level*28+"px"}}),M.$count?o.jsx("i",{className:`wx-8NTMLH0z wx-print-grid-tree-toggle wxi-menu-${M.open!==!1?"down":"right"}`}):null]}):null,k.cell?(()=>{const A=k.cell;return o.jsx(A,{api:g,row:M,column:k})})():o.jsx("span",{children:vi(M,k)})]},k.id))},T))}),h?o.jsx("tfoot",{children:o.jsx($x,{columns:w,type:"footer",columnStyle:r})}):null]})}function gC(a){const{config:l,...s}=a,r=m.useContext(ia),{_skin:c,_columns:d}=r.getState(),h=m.useMemo(()=>h1(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 v=x.cloneNode(!0);g.appendChild(v);const y=`@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(y)),window.print(),w.remove(),g.classList.remove("wx-print"),v.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(pC,{columns:g,...s})},x))})}function xC(a){const{header:l,footer:s,overlay:r,multiselect:c,onreorder:d,rowStyle:h,columnStyle:p,cellStyle:g,autoRowHeight:x,resize:v,clientWidth:y,clientHeight:w,responsiveLevel:C,hotkeys:j}=a,M=m.useContext(ia),T=Ue(M,"dynamic"),k=Ue(M,"_columns"),A=Ue(M,"flatData"),L=Ue(M,"split"),q=Ue(M,"_sizes"),[D,$]=Ma(M,"selectedRows"),E=Ue(M,"select"),ee=Ue(M,"editor"),de=Ue(M,"scrollLeft"),V=Ue(M,"scrollTop"),J=Ue(M,"tree"),B=Ue(M,"focusCell"),ie=Ue(M,"_print"),K=Ue(M,"undo"),fe=Ue(M,"reorder"),I=Ue(M,"_rowHeightFromData"),[Z,ne]=m.useState(0);m.useEffect(()=>{ne(Aa())},[]);const[O,le]=m.useState(0),me=m.useMemo(()=>(k||[]).some(P=>!P.hidden&&P.flexgrow),[k]),_=m.useMemo(()=>q?.rowHeight||0,[q]),ge=m.useRef(null),[be,Ce]=m.useState(null),[Ie,Ve]=m.useState(null),Le=m.useMemo(()=>{let P=[],he=0;return L&&L.left&&(P=(k||[]).slice(0,L.left).filter(Se=>!Se.hidden).map(Se=>({...Se})),P.forEach(Se=>{Se.fixed={left:1,leftSize:L.left},Se.left=he,he+=Se.width}),P.length&&(P[P.length-1].fixed.left=-1)),{columns:P,width:he}},[L,k]),Ee=m.useMemo(()=>{let P=[],he=0;if(L&&L.right){P=(k||[]).slice(L.right*-1).filter(Se=>!Se.hidden).map(Se=>({...Se}));for(let Se=P.length-1;Se>=0;Se--){const $e=P[Se];$e.fixed={right:1},$e.right=he,he+=$e.width}P.length&&(P[0].fixed={right:-1})}return{columns:P,width:he}},[L,k]),qe=m.useMemo(()=>{const P=(k||[]).slice(L?.left||0,(k||[]).length-(L?.right??0)).filter(he=>!he.hidden);return P.forEach(he=>{he.fixed=0}),P},[k,L]),Te=m.useMemo(()=>(k||[]).reduce((P,he)=>(he.hidden||(P+=he.width),P),0),[k]),gt=1;function re(P,he,Se){let $e=he,dt=P;if(qe.length){let ft=qe.length;for(let _e=P;_e>=0;_e--)qe[_e][Se].forEach(st=>{st.colspan>1&&_e>P-st.colspan&&_e<ft&&(ft=_e)});if(ft!==qe.length&&ft<P){for(let _e=ft;_e<P;_e++)$e-=qe[_e].width;dt=ft}}return{index:dt,delta:$e}}const ye=m.useMemo(()=>{let P,he,Se;const $e=de||0,dt=(de||0)+(y||0);let ft=0,_e=0,st=0,ln=0;qe.forEach((qt,kt)=>{$e>st&&(ft=kt,ln=st),st=st+qt.width,dt>st&&(_e=kt+gt)});const Ut={header:0,footer:0};for(let qt=_e;qt>=ft;qt--)["header","footer"].forEach(kt=>{qe[qt]&&qe[qt][kt].forEach(ca=>{const Ta=ca.colspan;if(Ta&&Ta>1){const zl=Ta-(_e-qt+1);zl>0&&(Ut[kt]=Math.max(Ut[kt],zl))}})});const Jt=re(ft,ln,"header"),wt=re(ft,ln,"footer"),$t=Jt.delta,Ct=Jt.index,il=wt.delta,ka=wt.index;return me&&Te>(y||0)?P=he=Se=[...Le.columns,...qe,...Ee.columns]:(P=[...Le.columns,...qe.slice(ft,_e+1),...Ee.columns],he=[...Le.columns,...qe.slice(Ct,_e+Ut.header+1),...Ee.columns],Se=[...Le.columns,...qe.slice(ka,_e+Ut.footer+1),...Ee.columns]),{data:P||[],header:he||[],footer:Se||[],d:ln,df:il,dh:$t}},[qe,Le,Ee,de,y,me,Te]),ke=m.useMemo(()=>l&&q?.headerHeight||0,[l,q]),De=m.useMemo(()=>s&&q?.footerHeight||0,[s,q]),oe=m.useMemo(()=>y&&w?Te>=y:!1,[y,w,Te]),[et,Me]=m.useState(!1),Ft=m.useMemo(()=>(w||0)-ke-De-(oe?Z:0),[w,ke,De,oe,Z]),Rt=m.useMemo(()=>Math.ceil((Ft||0)/(_||1))+1,[Ft,_]),xe=m.useRef([]),[He,ze]=m.useState(0),[lt,Cn]=m.useState(void 0),it=m.useMemo(()=>{let P=0,he=0;const Se=2,$e=V||0;if(x){let _e=$e;for(;_e>0;)_e-=xe.current[P]||_,P++;he=$e-_e;for(let st=Math.max(0,P-Se-1);st<P;st++)he-=xe.current[P-st]||_;P=Math.max(0,P-Se)}else{if(I){let _e=0,st=0;for(let wt=0;wt<(A||[]).length;wt++){const $t=A[wt].rowHeight||_;if(st+$t>$e){_e=wt;break}st+=$t}P=Math.max(0,_e-Se);for(let wt=0;wt<P;wt++)he+=A[wt].rowHeight||_;let ln=0,Ut=0;for(let wt=_e+1;wt<(A||[]).length;wt++){const $t=A[wt].rowHeight||_;if(ln++,Ut+$t>Ft)break;Ut+=$t}const Jt=Math.min(T?T.rowCount:(A||[]).length,_e+ln+Se);return{d:he,start:P,end:Jt}}P=Math.floor($e/(_||1)),P=Math.max(0,P-Se),he=P*(_||0)}const dt=T?T.rowCount:(A||[]).length,ft=Math.min(dt,P+(Rt||0)+Se);return{d:he,start:P,end:ft}},[x,I,V,_,T,A,Rt,Ft]),Nn=m.useMemo(()=>{const P=T?T.rowCount:(A||[]).length;if(x)return He+it.d+(P-(lt||0))*(_||0);if(!I)return P*(_||0);let he=0;for(let Se=0;Se<P;Se++)he+=A[Se]?.rowHeight||_;return he},[T,A,_,x,I,He,it.d,lt]),ja=m.useRef({});ja.current={clientWidth:y,clientHeight:w,fullHeight:Nn,headerHeight:ke,footerHeight:De,fullWidth:Te,SCROLLSIZE:Z};const Na=m.useCallback(()=>{const P=ja.current;Me(P.clientWidth&&P.clientHeight?P.fullHeight+P.headerHeight+P.footerHeight>=P.clientHeight-(P.fullWidth>=P.clientWidth?P.SCROLLSIZE:0):!1)},[]);m.useEffect(()=>{const P=requestAnimationFrame(Na);return()=>window.cancelAnimationFrame(P)},[O,Na]),m.useEffect(()=>{Na()},[w,Na]);const An=m.useMemo(()=>me&&Te<=(y||0)?(y||0)-0-(et?Z:0):Te,[me,Te,y,et,Z,oe]),el=m.useMemo(()=>me&&Te<=(y||0)?y||0:An<(y||0)?Te+(et?Z:0):-1,[me,Te,y,An,et,Z]),Qn=m.useRef({});m.useEffect(()=>{if(T&&(Qn.current.start!==it.start||Qn.current.end!==it.end)){const{start:P,end:he}=it;Qn.current={start:P,end:he},M&&M.exec&&M.exec("request-data",{row:{start:P,end:he}})}},[T,it,M]);const ut=m.useMemo(()=>T?A||[]:(A||[]).slice(it.start,it.end),[T,A,it]),hn=m.useMemo(()=>(D||[]).filter(P=>(ut||[]).some(he=>he.id===P)),[$,ut]),Ot=m.useMemo(()=>it.start,[it.start]),Rl=m.useRef({top:V,left:de});Rl.current={top:V,left:de};const sr=m.useCallback(P=>{const he=P.target.scrollTop,Se=P.target.scrollLeft,$e=Rl.current;(he!==$e.top||Se!==$e.left)&&M.exec("scroll-to",{top:he,left:Se})},[M]),Wi=m.useCallback(P=>{P.shiftKey&&P.preventDefault(),ge.current&&ge.current.focus&&ge.current.focus()},[]),Ha=m.useCallback(()=>!!(k||[]).find(P=>!!P.draggable),[k]),sa=m.useRef(null),pn=m.useRef(null),kn=m.useRef({dblclick:(P,he)=>{const Se={id:P,column:Eo(he,"data-col-id")};M.exec("open-editor",Se)},click:(P,he)=>{if(he.target.closest("input")||sa.current)return;const Se=Eo(he,"data-col-id");if(B?.id!==P&&M.exec("focus-cell",{row:P,column:Se,eventSource:"click"}),E===!1)return;const $e=c&&(he.ctrlKey||he.metaKey),dt=c&&he.shiftKey;($e||D.length>1||!D.includes(P))&&M.exec("select-row",{id:P,toggle:$e,range:dt})},"toggle-row":P=>{const he=M.getRow(P);M.exec(he.open!==!1?"close-row":"open-row",{id:P})},"ignore-click":()=>!1}),Tn=m.useMemo(()=>({top:ke,bottom:De,left:Le.width,xScroll:oe,yScroll:et,sense:x&&Ie?Ie.offsetHeight:Math.max(q?.rowHeight||0,40),node:ge.current&&ge.current.firstElementChild}),[ke,De,Le.width,oe,et,x,Ie,q]);function ra(P,he){const{container:Se,sourceNode:$e,from:dt}=he;if(Ha()&&!$e.getAttribute("draggable-data"))return!1;Ce(dt),J&&M.getRow(dt).open&&M.exec("close-row",{id:dt,nested:!0});const ft=lr($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=(de||0)-ye.d,ln=et?Z:0;Se.style.width=Math.min((y||0)-ln,me&&Te<=(y||0)?An:An-ln)+st+"px";const Ut=yu(ft);he.offset={x:st,y:-Math.round(Ut.height/2)},pn.current||(pn.current=P.clientY)}function tl(P,he){const{from:Se}=he,$e=he.pos,dt=yu(ge.current);$e.x=dt.x;const ft=Tn.top;if($e.y<ft)$e.y=ft;else{const _e=dt.height-(oe&&Z>0?Z:Math.round(Tn.sense/2))-Tn.bottom;$e.y>_e&&($e.y=_e)}if(ge.current.contains(he.targetNode)){const _e=lr(he.targetNode),st=_e&&Ou(_e);if(st&&st!==Se){he.to=st;const ln=x?Ie?.offsetHeight:q?.rowHeight;if(Ie&&((V||0)===0||$e.y>ft+ln-1)){const Ut=_e.getBoundingClientRect(),Jt=yu(Ie).y,wt=Ut.y,$t=Jt>wt?-1:1,Ct=$t===1?"after":"before",il=M.getState().flatData,ka=Math.abs(il.findIndex(kt=>kt.id===Se)-il.findIndex(kt=>kt.id===st)),qt=ka!==1?Ct==="before"?"after":"before":Ct;if(ka===1&&($t===-1&&P.clientY>pn.current||$t===1&&P.clientY<pn.current))return;pn.current=P.clientY,M.exec("move-item",{id:Se,target:st,mode:qt,inProgress:!0})}}d&&d({event:P,context:he})}V1(P,dt,he,Tn)}function Ll(P,he){const{from:Se,to:$e}=he;M.exec("move-item",{id:Se,target:$e,inProgress:!1}),sa.current=setTimeout(()=>{sa.current=0},1),Ce(null),Ve(null),pn.current=null,lv(he)}function Aa(){const P=document.createElement("div");P.style.cssText="position:absolute;left:-1000px;width:100px;padding:0px;margin:0px;min-height:100px;overflow-y:scroll;",document.body.appendChild(P);const he=P.offsetWidth-P.clientWidth;return document.body.removeChild(P),he}const oa=m.useMemo(()=>el>0?{width:`${el}px`}:void 0,[el]),nl=m.useRef(null);function al(){Promise.resolve().then(()=>{let P=0,he=Ot;const Se=nl.current;Se&&(Array.from(Se.children).forEach(($e,dt)=>{xe.current[Ot+dt]=$e.offsetHeight,P+=$e.offsetHeight,he++}),ze(P),Cn(he))})}m.useEffect(()=>{ut&&x&&al()},[ut,x,Ot]);let[Kn,ll]=m.useState();m.useEffect(()=>{if(B&&(!E||!hn.length||hn.includes(B.row)))ll({...B});else if(ut.length&&ye.data.length){if(!Kn||hn.length&&!hn.includes(Kn.row)||ut.findIndex(P=>P.id===Kn.row)===-1||ye.data.findIndex(P=>P.id===Kn.column&&!P.collapsed)===-1){const P=hn[0]||ut[0].id,he=ye.data.findIndex(Se=>!Se.collapsed);ll(he!==-1?{row:P,column:ye.data[he].id}:null)}}else ll(null)},[B]);const En=m.useRef(null);m.useEffect(()=>{const P=ge.current;if(!P)return;const he=$1(P,v);return()=>{typeof he=="function"&&he()}},[v]);const Dn=m.useRef({});Object.assign(Dn.current,{start:ra,move:tl,end:Ll,getReorder:()=>fe,getDraggableInfo:()=>({hasDraggable:Ha()})}),m.useEffect(()=>{const P=ge.current;return P?G1(P,Dn).destroy:void 0},[fe,ge.current]),m.useEffect(()=>{const P=ge.current;return P?F1(P,{keys:j!==!1&&{...I1,"ctrl+z":K,"ctrl+y":K,...j},exec:he=>M.exec("hotkey",he)}).destroy:void 0},[M,K,j]);const gn=m.useRef({scroll:M.getReactiveState().scroll,scrollLeft:M.getReactiveState().scrollLeft,scrollTop:M.getReactiveState().scrollTop});gn.current.getWidth=()=>(y||0)-(et?Z:0),gn.current.getHeight=()=>Ft,gn.current.getScrollMargin=()=>Le.width+Ee.width,m.useEffect(()=>{U1(En.current,gn.current)},[]);const wi=m.useRef(null);m.useEffect(()=>{const P=wi.current;if(!P)return;const he=[];he.push(Ja(P,()=>B&&M.exec("focus-cell",{eventSource:"click"})).destroy),he.push(GS(P,kn.current)),le(P.clientHeight);const Se=new ResizeObserver(()=>{le(P.clientHeight)});return Se.observe(P),he.push(()=>Se.disconnect()),()=>he.forEach($e=>$e())},[]);const Rn=`wx-grid ${C?`wx-responsive-${C}`:""}`;return m.useEffect(()=>{B&&(ut.some(P=>P.id===B.row)&&ye.data.some(P=>P.id===B.column&&!P.collapsed)||M.exec("focus-cell",{eventSource:"destroy"}))},[B,ut,ye.data,M]),o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"wx-4VuBwK2D "+Rn,style:{"--header-height":`${ke}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:J?"treegrid":"grid","aria-colcount":ye.data.length,"aria-rowcount":ut.length,"aria-multiselectable":J&&c?!0:void 0,tabIndex:-1,children:o.jsxs("div",{ref:En,className:"wx-4VuBwK2D wx-scroll",style:{overflowX:oe?"scroll":"hidden",overflowY:et?"scroll":"hidden"},onScroll:sr,children:[l?o.jsx("div",{className:"wx-4VuBwK2D wx-header-wrapper",children:o.jsx(Ux,{contentWidth:An,deltaLeft:ye.dh,columns:ye.header,columnStyle:p,bodyHeight:Ft-+s})}):null,o.jsxs("div",{ref:wi,className:"wx-4VuBwK2D wx-body",style:{width:`${An}px`,height:`${Nn}px`},onMouseDown:P=>Wi(P),children:[r?o.jsx(rC,{overlay:r}):null,o.jsx("div",{ref:nl,className:"wx-4VuBwK2D wx-data",style:{paddingTop:`${it.d}px`,paddingLeft:`${ye.d}px`},children:ut.map((P,he)=>{const Se=D.indexOf(P.id)!==-1,$e=be===P.id,dt="wx-row"+(x?" wx-autoheight":"")+(h?" "+h(P):"")+(Se?" wx-selected":"")+($e?" wx-inactive":""),ft=x?{minHeight:`${P.rowHeight||_}px`}:{height:`${P.rowHeight||_}px`};return o.jsx("div",{className:"wx-4VuBwK2D "+dt,"data-id":tn(P.id),"data-context-id":tn(P.id),style:ft,role:"row","aria-rowindex":he,"aria-expanded":P.open,"aria-level":J?P.$level+1:void 0,"aria-selected":J?Se:void 0,tabIndex:-1,children:ye.data.map(_e=>_e.collapsed?o.jsx("div",{className:"wx-4VuBwK2D wx-cell wx-collapsed"},_e.id):ee?.id===P.id&&ee.column===_e.id?o.jsx(hC,{row:P,column:_e},_e.id):o.jsx(W1,{row:P,column:_e,columnStyle:p,cellStyle:g,reorder:fe,focusable:Kn?.row===P.id&&Kn?.column===_e.id},_e.id))},P.id)})})]}),s&&(A||[]).length?o.jsx(Ux,{type:"footer",contentWidth:An,deltaLeft:ye.df,columns:ye.footer,columnStyle:p}):null]})})}),ie?o.jsx(gC,{config:ie,rowStyle:h,columnStyle:p,cellStyle:g,header:l,footer:s,reorder:fe}):null]})}const yC=a=>a.split("-").map(l=>l?l.charAt(0).toUpperCase()+l.slice(1):"").join(""),vC=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:v=null,overlay:y=null,reorder:w=!1,onReorder:C=null,autoRowHeight:j=!1,sizes:M,split:T,tree:k=!1,autoConfig:A=!1,init:L=null,responsive:q=null,sortMarks:D,undo:$=!1,hotkeys:E=null,filterValues:ee,...de},V){const J=m.useRef();J.current=de;const B=m.useMemo(()=>new L1(Vy),[]),ie=m.useMemo(()=>B.in,[B]),K=m.useRef(null);K.current===null&&(K.current=new Uy((Ee,qe)=>{const Te="on"+yC(Ee);J.current&&J.current[Te]&&J.current[Te](qe)}),ie.setNext(K.current));const fe=m.useMemo(()=>({getState:B.getState.bind(B),getReactiveState:B.getReactive.bind(B),getStores:()=>({data:B}),exec:ie.exec,setNext:Ee=>(K.current=K.current.setNext(Ee),K.current),intercept:ie.intercept.bind(ie),on:ie.on.bind(ie),detach:ie.detach.bind(ie),getRow:B.getRow.bind(B),getColumn:B.getColumn.bind(B)}),[B,ie]),[I,Z]=m.useState(0),[ne,O]=m.useState(0),[le,me]=m.useState(null),[_,ge]=m.useState(null),be=m.useMemo(()=>{if(A&&!l.length&&a.length){const Ee=a[0],qe=[];for(let Te in Ee)if(Te!=="id"&&Te[0]!=="$"){let gt={id:Te,header:Te[0].toUpperCase()+Te.slice(1)};typeof A=="object"&&(gt={...gt,...A}),qe.push(gt)}return qe}return(_&&_.columns)??l},[A,l,a,_]),Ce=m.useMemo(()=>(_&&_.sizes)??M,[_,M]),Ie=m.useCallback(Ee=>{if(Z(Ee.width),O(Ee.height),q){const qe=Object.keys(q).map(Number).sort((Te,gt)=>Te-gt).find(Te=>Ee.width<=Te)??null;qe!==le&&(ge(q[qe]),me(qe))}},[q,le]),Ve=m.useContext(an.theme),Le=m.useRef(0);return m.useEffect(()=>{if(!Le.current)L&&L(fe);else{const Ee=B.getState();B.init({data:a,columns:be,split:T||Ee.split,sizes:Ce||Ee.sizes,selectedRows:d||Ee.selectedRows,dynamic:v,tree:k,sortMarks:D||Ee.sortMarks,filterValues:ee||Ee.filterValues,undo:$,reorder:w,_skin:Ve,_select:h})}Le.current++},[B,a,be,T,Ce,d,v,k,D,ee,$,w,Ve,h,L,fe]),Le.current===0&&B.init({data:a,columns:be,split:T||{left:0},sizes:Ce||{},selectedRows:d||[],dynamic:v,tree:k,sortMarks:D||{},filterValues:ee||{},undo:$,reorder:w,_skin:Ve,select:h}),m.useImperativeHandle(V,()=>({...fe}),[fe]),o.jsx(ia.Provider,{value:fe,children:o.jsx(Gm,{words:Pm,optional:!0,children:o.jsx(xC,{header:g,footer:x,overlay:y,rowStyle:s,columnStyle:r,cellStyle:c,onReorder:C,multiselect:p,autoRowHeight:j,clientWidth:I,clientHeight:ne,responsiveLevel:le,resize:Ie,hotkeys:E})})})});Bm(Vn);const nn=m.createContext(null),Qm=m.createContext(null),Km=m.createContext(null);function bC({children:a}){const l=m.useContext(an.i18n),s=m.useMemo(()=>l.getGroup("filemanager"),[l]),r=m.useContext(nn),[c]=Ma(r,"panels"),d=Ue(r,"activePanel"),h=c[d].path,[p,g]=m.useState(null),[x,v]=m.useState(null),[y,w]=m.useState(""),[C,j]=m.useState(""),[M,T]=m.useState(!1);function k(){const D=y.trim();if(!D){T(!0);return}p.add?r.exec("create-file",{file:{...p.item,name:D},parent:h}):C!==D&&r.exec("rename-file",{id:p.item.id,name:D}),A()}function A(){g(null),T(null),j(""),w("")}function L(){r.exec("delete-files",{ids:x.selected}),v(null)}const q=m.useMemo(()=>({showPrompt(D){const $=D.item.name||(D.item.type==="folder"?s("New folder"):`${s("New file")}.txt`);j($),w($),g({...D})},showConfirm(D){v({...D})}}),[s]);return o.jsxs(Qm.Provider,{value:q,children:[o.jsx(bS,{children:a}),p?o.jsx(bm,{title:s(`Enter ${p.item.type} name`),onConfirm:k,onCancel:A,children:o.jsx($m,{error:M,select:!0,focus:!0,value:y,onChange:({value:D})=>w(D)})}):null,x?o.jsx(bm,{title:s("Are you sure you want to delete these items:"),onConfirm:L,onCancel:()=>v(null),children:x.selected?o.jsx("ul",{className:"wx-gq7BMzEP wx-list",children:x.selected.map((D,$)=>o.jsx("li",{children:D},$))}):null}):null]})}let qx={"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 wC(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 SC({item:a}){const l=m.useContext(nn),s=m.useContext(an.i18n).getGroup("filemanager"),r=m.useContext(nn).templates,[c]=Ma(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]),[v,y]=m.useMemo(()=>wC(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:v}),o.jsx("span",{children:y})]})]}),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:v}),o.jsx("span",{children:y})]})}),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 ov(){const a=m.useContext(nn),l=m.useContext(an.i18n),s=m.useMemo(()=>l.getGroup("filemanager"),[l]),[r]=Ma(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,v=r[c]._selectNavigation,y=m.useCallback((A,L)=>{const q=L&&(L.ctrlKey||L.metaKey),D=L&&L.shiftKey;if(A==="/wx-filemanager-parent-link"){if(p.length&&(q||D))return;a.exec("select-file",{type:"navigation"});return}let $=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:$,toggle:q&&!E,range:D&&!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]),C=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]),j=m.useCallback((A,L)=>{(!p?.length||!p.filter(q=>q?.id===A).length>0)&&y(A,L)},[p,y]),M=m.useMemo(()=>g!=="/"?[{id:"/wx-filemanager-parent-link",name:s("Back to parent folder"),navigation:v},...h]:h,[g,s,v,h]),T=m.useRef(null),k=m.useRef();return m.useEffect(()=>{T.current&&(k.current?(k.current.click=y,k.current._dblclick=C,k.current.context=j):(k.current={click:y,dblclick:A=>k.current._dblclick(A),_dblclick:C,context:j},ir(T.current,k.current)))},[y,C,j]),d=="search"&&!M.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:T,children:M.map(A=>o.jsx(SC,{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 CC(){const a=m.useContext(an.i18n).getGroup("filemanager"),l=m.useContext(nn),s=Ue(l,"activePanel"),[r]=Ma(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(ov,{})]})}function Yf({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(()=>tr("%D, %d %F %Y, %H:%i",d.getRaw().calendar),[d]),[g,x]=Ma(s,"panels"),v=Ue(s,"activePanel"),y=Ue(s,"preview"),w=Ue(s,"search"),C=m.useMemo(()=>{const E=g&&v!=null&&g[v]?._selected?.length||0;return w&&!E},[w,x,v]),j=m.useMemo(()=>{const E=g&&v!=null?g[v]:null;return E?C?E._files:E._selected:[]},[C,x,v]),M=m.useCallback((E,ee)=>(E?`${E} ${h(E>1?"folders":"folder")} `:"")+(ee?`${ee} ${h(ee>1?"files":"file")}`:""),[h]),T=m.useCallback(()=>{s.exec("show-preview",{mode:!y})},[s,y]),k=m.useCallback(E=>E.type==="folder"?h("Folder"):E.ext||h("Unknown file"),[h]),A=m.useMemo(()=>{let E,ee,de,V,J,B,ie,K;if(j.length===1&&!C){ee=j[0],E=ee.name;const fe=r(ee,400,500);fe?(de=fe,V=""):(V=c(ee,"big"),de=""),J=ee.type!=="folder"}else{if(ee=J=null,E="",j.length){let fe=0,I=0,Z=0,ne=[],O;j.forEach(me=>{typeof me.size>"u"&&(O=!0,fe=void 0),O||(fe+=me.size),ne.push(k(me)),me.type==="folder"?I++:Z++});const le=new Set(ne);B=le.size>1?h("multiple"):[...le][0],ie=M(I,Z),K=fe,C||(E=h("Multiple files"))}V=c({type:C?"search":j.length?"multiple":"none"},"big"),de=""}return{name:E,item:ee,previewSrc:de,iconSrc:V,showDownloadIcon:J,type:B,totalCount:ie,totalSize:K}},[j,C,r,c,h,k,M]),L=m.useCallback(()=>{s.exec("download-file",{id:j[0].id})},[s,j]),q=m.useCallback(async E=>{if(!l||!E)return null;try{return await l(E)}catch(ee){return console.log(ee),null}},[l]),[D,$]=m.useState(null);return m.useEffect(()=>{let E=!1;return $(null),Promise.resolve(q(A.item)).then(ee=>{E||$(ee)}).catch(()=>{E||$(null)}),()=>{E=!0}},[q,A.item]),o.jsx("div",{className:"wx-O0BTtRrH wx-wrapper",children:j&&j.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:T}):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-${C?"search":"file-multiple-outline"}`})})]}),o.jsxs("div",{className:"wx-O0BTtRrH wx-info-panel",children:[o.jsx("div",{className:"wx-O0BTtRrH wx-title",children:h(C?"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:k(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:Do(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:Do(A.totalSize)})]}):null]}),D?Object.entries(D).map(([E,ee])=>o.jsxs(Dm.Fragment,{children:[o.jsx("span",{className:"wx-O0BTtRrH wx-name",children:E}),o.jsx("span",{className:"wx-O0BTtRrH wx-value",children:ee})]},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:T}):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-${C?"search":"message-question-outline"}`})}),o.jsx("span",{className:"wx-O0BTtRrH wx-text",children:C?"":h("Select file or folder to view details")})]})})]})})}function cv({panel:a}){const l=m.useContext(nn),s=m.useContext(an.i18n),r=m.useMemo(()=>s.getGroup("filemanager"),[s]),[c,d]=Ma(l,"panels"),h=m.useMemo(()=>c[a]._files,[d,a]),p=m.useMemo(()=>c[a]._crumbs||[],[d,a]);function g(j){const M=Ym(j,p);l.exec("set-path",{id:j,panel:a,...M&&{selected:[M]}})}const[x,v]=m.useState(null);m.useEffect(()=>{h&&v(null)},[h]);function y(){v(!0),l.exec("request-data",{id:p[p.length-1].id}),setTimeout(()=>{v(null)},5e3)}const w=m.useRef(null),C=m.useRef();return m.useEffect(()=>{C.current?C.current.click=g:(C.current={click:g},ir(w.current,C.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:y})}),p.map((j,M)=>o.jsxs(Dm.Fragment,{children:[M?o.jsx(Xi,{name:"angle-right"}):null,o.jsx("div",{className:"wx-SNY5LTYx wx-item","data-id":tn(j.id),"data-menu-ignore":"true",children:j.id=="/"?r(j.name):j.name})]},M))]})}function MC({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 uv({children:a}){const l=m.useContext(nn),s=Ue(l,"activePanel"),r=m.useContext(Km),c=m.useRef(null);let d=m.useRef({});return d.current.drop=()=>{const h=c.current,p=A0(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 Cm({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(()=>tr("%d %M %Y",d.getRaw().calendar),[d]),[g]=Ma(c,"panels"),x=g[a].selected,v=g[a].path,y=g[a]._crumbs,w=g[a]._sorts,C=g[a]._selectNavigation,j=g[a]._files,M=m.useMemo(()=>[{id:"name",header:h("Name"),flexgrow:3,sort:!0,resize:!0,cell:MC},{id:"size",header:h("Size"),width:100,sort:!0,resize:!0,template:B=>typeof B=="number"?Do(B):""},{id:"date",header:h("Date"),width:120,sort:!0,resize:!0,template:B=>B?p(B):""}],[h,p]),T=m.useRef(null),k=m.useRef(null),A=m.useMemo(()=>C?["/wx-filemanager-parent-link"]:[...x],[C,x]);function L(B,ie){if(ie&&ie.target&&ie.target.className&&ie.target.className.indexOf("wx-grip")!==-1)return;const K=ie&&(ie.ctrlKey||ie.metaKey),fe=ie&&ie.shiftKey;if(B==="/wx-filemanager-parent-link"){if(x.length&&(K||fe))return;c.exec("select-file",{type:"navigation"});return}let I=B==="body"&&ie?null:B;!T.current&&!k.current?c.exec("select-file",{id:I,toggle:K,range:fe,panel:a}):(T.current=null,k.current=null)}function q(){y.length>1&&c.exec("set-path",{id:y[y.length-2].id,panel:a,selected:[y[y.length-1].id]})}function D(B){if(B==="/wx-filemanager-parent-link")return q();const ie=j.find(K=>K.id===B);ie&&(ie.type==="folder"?c.exec("set-path",{id:ie.id,panel:a}):c.exec("open-file",{id:ie.id}))}function $(B){const ie=B.key,K=w[v];let fe=K?"asc":"desc";K&&K.key===ie&&(fe=K.order==="asc"?"desc":"asc"),c.exec("sort-files",{key:ie,order:fe,panel:a,path:v})}function E(B){B.intercept("sort-rows",ie=>(T.current=!0,$(ie),!1)),B.intercept("select-row",()=>!1),B.on("resize-column",()=>k.current=!0),B.intercept("hotkey",()=>!1)}const ee=m.useMemo(()=>v!=="/"?[{id:"/wx-filemanager-parent-link",name:h("Back to parent folder")},...j]:j,[v,j,h]),de=m.useMemo(()=>{if(ee&&w&&w[v]){const{key:B,order:ie}=w[v];return{[B]:{order:ie}}}},[ee,w,v]),V=m.useRef(null),J=m.useRef();return m.useEffect(()=>{J.current?(J.current.click=L,J.current._dblclick=D):(J.current={click:L,dblclick:B=>J.current._dblclick(B),_dblclick:D},ir(V.current,J.current))},[L,D]),o.jsxs("div",{onClick:s,onContextMenu:r,className:"wx-SSaVhET7 wx-wrapper",children:[o.jsx(cv,{panel:a}),o.jsx("div",{"data-id":tn("body"),className:`wx-SSaVhET7 wx-list ${l?"wx-active":""}`,ref:V,children:o.jsx(uv,{children:o.jsx(vC,{init:E,data:ee,columns:M,selectedRows:A,columnStyle:()=>"wx-SSaVhET7 wx-each-cell",sizes:{rowHeight:42,headerHeight:42},sortMarks:de})})})]})}function jC(){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(Cm,{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(Cm,{panel:1,active:l==1,onClick:()=>s(1),onContextMenu:()=>s(1)})})]})}function dv({folderIcon:a=!1,folder:l={}}){const s=m.useContext(nn),[r,c]=Ma(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(C=>C.type==="folder"),[l]),v=m.useMemo(()=>l.id=="/"?g(l.name):l.name,[l,g]),y=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:`${y}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:[" ",v," "]})]}),w&&l.data&&l.data.length&&x?o.jsx(o.Fragment,{children:l.data.map(C=>C.type==="folder"?o.jsx(dv,{folder:C},C.id):null)}):null]})}function NC(){const a=m.useContext(nn),[l,s]=Ma(a,"data"),[r,c]=Ma(a,"panels"),d=Ue(a,"activePanel"),h=m.useMemo(()=>r[d]._crumbs,[c,d]),p=m.useCallback(C=>{a.exec("open-tree-folder",{id:C,mode:!l.byId(C).open})},[a,s]),g=m.useCallback(C=>{const j=Ym(C,h);a.exec("set-path",{id:C,panel:d,...j&&{selected:[j]}})},[a,h,d]),[x,v]=m.useState([]);m.useEffect(()=>{v(l.byId(0).data)},[s]);const y=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},ir(y.current,w.current))},[g,p]),o.jsx("ul",{ref:y,className:"wx-LyHJ6R6A",children:x.map(C=>C.type==="folder"?o.jsx(dv,{folder:C},C.id):null)})}function AC(){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:[Do(c)," ",s("of")," ",Do(d)," ",s("used")]})]}):null}function kC({option:a}){const l=m.useContext(an.i18n).getGroup("filemanager"),s=m.useContext(Km),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 TC({readonly:a,menuOptions:l}){const s=m.useContext(an.i18n).getGroup("filemanager"),{showPrompt:r}=m.useContext(Qm);m.useEffect(()=>{VS("upload",kC)},[]);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(KS,{options:d,at:"bottom-fit",onClick:c,children:o.jsx(Mo,{type:"primary block",children:s("Add New")})})}),o.jsx("div",{className:"wx-FlucfALM wx-tree",children:o.jsx(NC,{})}),o.jsx(AC,{})]})}function EC({value:a="",onSearch:l}){const[s,r]=Py(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 v=x.target.value;r(v),l&&l({value:v})}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 DC({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:y}){s.exec("set-mode",{mode:y})}function x(y){y.preventDefault(),s.exec("show-preview",{mode:!d})}function v(y){s.exec("filter-files",{text:y.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(EC,{onSearch:v,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(wS,{onClick:x,value:d,children:o.jsx("i",{className:"wx-5PZQQztG wxi-eye"})})}),o.jsx("div",{className:"wx-5PZQQztG wx-modes",children:o.jsx(pS,{value:c,options:p,onChange:g})})]})]})}function RC(){const a=m.useContext(nn),l=Ue(a,"activePanel");return o.jsxs("div",{className:"wx-NwohNJzN wx-wrapper",children:[o.jsx(cv,{panel:l}),o.jsx(uv,{children:o.jsx(ov,{})})]})}function LC({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,v]=m.useState(!1),y=Wy(),w=m.useContext(nn),{showPrompt:C,showConfirm:j}=m.useContext(Qm),M=m.useContext(an.i18n),T=m.useMemo(()=>M.getGroup("filemanager"),[M]),k=Ue(w,"mode"),A=Ue(w,"preview"),L=Ue(w,"activePanel"),[q,D]=Ma(w,"panels"),$=m.useMemo(()=>(q&&L!=null?q[L]:null)?.selected??[],[D,L]),E=m.useMemo(()=>(q&&L!=null?q[L]:null)?.path,[D,L]),[ee,de]=m.useState([]);m.useEffect(()=>{const le=r.current;if(!le)return;const me=new ResizeObserver(_=>{const ge=_[0]?.borderBoxSize?.[0]?.inlineSize;typeof ge=="number"&&g(ge<768)});return me.observe(le),()=>{me.disconnect()}},[]);const V=m.useCallback(()=>{v(le=>!le)},[]),J=m.useCallback(le=>{p&&Eo(le)!=="toggle-tree"&&v(!1)},[p]);m.useEffect(()=>{const le=c.current;if(le)return Ja(le,J).destroy},[J]),m.useEffect(()=>{const le=c.current;if(!le)return;const me=new ResizeObserver(()=>{le&&h(le.clientWidth)});return me.observe(le),le&&h(le.clientWidth),()=>{me.disconnect()}},[]);const B=m.useMemo(()=>({icon:"wxi-eye",text:"Preview",id:"preview"}),[]),ie=m.useCallback(le=>{let me=p?[B]:[];return le==="file"&&(me=[...me,...l().filter(_=>_.id==="download")]),me},[p,B,l]),K=m.useRef(null),fe=m.useCallback((le,me,_)=>{const ge=_?[me.id]:$;switch(le){case"download":w.exec("download-file",{id:me.id});break;case"copy":case"move":K.current={action:le,ids:ge};break;case"paste":K.current&&w.exec(K.current.action==="copy"?"copy-files":"move-files",{ids:K.current.ids,target:me?.type==="folder"?me.id:E});break;case"rename":C({item:me});break;case"delete":j({selected:ge});break;case"preview":w.exec("show-preview",{mode:!A});break}},[w,$,E,C,j,A]),I=m.useCallback(()=>q?.[L],[q,L]);m.useEffect(()=>{const le=r.current;if(!le)return;const me=OS(le,{api:w,menuOptions:a?ie:l,performAction:fe,getPanel:I});return()=>{typeof me=="function"?me():me&&typeof me.destroy=="function"&&me.destroy()}},[w,a,ie,l,fe,I]);const Z=m.useCallback((le,me)=>{const _=le?w.getFile(le):null,ge=me.target.closest(".tree-item.folder");let be;if(a)be=ie(_?.type);else{switch(le){case"body":be=l(le);break;default:if(_)if(!ge&&$.length>1)be=p?[B,...l("multiselect")]:l("multiselect");else if(le==="/")be=l("folder",_).filter(Ce=>Ce.id==="paste");else{const Ce=l(_.type,_);Ce&&(be=p?[B,...Ce]:Ce)}}k==="search"&&(be=be?.filter(Ce=>Ce.id!=="paste"))}if(_?.id&&(!$.length||!$.some(Ce=>Ce===_.id))&&!ge&&w.exec("select-file",{id:_.id}),be?.length)return be.forEach(Ce=>{ge&&(Ce.hotkey=""),Ce.text&&(Ce.text=T(Ce.text)),Ce.hotkey&&(Ce.subtext=Ce.hotkey)}),de(be),_||{}},[w,a,ie,l,$,p,B,k,T]),ne=m.useCallback(le=>{const{action:me,context:_}=le;me&&fe(me.id,_,!me.hotkey)},[fe]);async function O(le){await Promise.resolve();const{name:me,size:_}=le.file;w.exec("create-file",{file:{name:me,size:_,date:new Date,file:le.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(Yf,{narrowMode:p,extraInfo:s})}):o.jsxs(o.Fragment,{children:[o.jsx(DC,{narrowMode:p,onShowTree:V}),o.jsx(XS,{dataKey:"id",at:"point",options:ee,resolver:Z,onClick:ne,children:o.jsxs(Zy,{dataKey:"actionId",options:ee,resolver:Z,onClick:ne,children:[o.jsx(t1,{data:y,apiOnly:!0,uploadURL:O}),o.jsx(Km.Provider,{value:y,children:o.jsx("div",{className:"wx-RJbNonjJ wx-content-wrapper wx-flex",children:k!=="panels"&&k!=="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(TC,{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:k==="table"?o.jsx(Cm,{panel:L}):o.jsx(RC,{})}),A?o.jsx("div",{className:"wx-RJbNonjJ wx-info",children:o.jsx(Yf,{extraInfo:s})}):null]})]}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`wx-RJbNonjJ wx-content-item${A?"":"-fit"}`,children:k==="panels"?o.jsx(jC,{}):o.jsx(CC,{})}),A?o.jsx("div",{className:"wx-RJbNonjJ wx-info",children:o.jsx(Yf,{extraInfo:s})}):null]})})})]})})]})})}const zC=a=>a.split("-").map(l=>l?l.charAt(0).toUpperCase()+l.slice(1):"").join("");function _C(a,l){const{type:s,ext:r}=a;if(s==="folder")return!1;let c;return s&&s!=="file"&&qx[s]?c=s:r?c=qx[r]?r:"file":c="unknown",`https://cdn.svar.dev/icons/filemanager/vivid/${l}/${c}.svg`}const OC=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=LS,extraInfo:v=null,init:y=null,icons:w=_C,previews:C=null,...j}=a,M=m.useRef();M.current=j;const T=m.useMemo(()=>new RS(Vy),[]),k=m.useMemo(()=>T.in,[T]),A=m.useRef(null);A.current===null&&(A.current=new Uy((D,$)=>{const E="on"+zC(D);M.current&&M.current[E]&&M.current[E]($)}),k.setNext(A.current));const L=m.useMemo(()=>({getState:T.getState.bind(T),getReactiveState:T.getReactive.bind(T),getStores:()=>({data:T}),exec:k.exec,setNext:D=>(A.current=A.current.setNext(D),A.current),intercept:k.intercept.bind(k),on:k.on.bind(k),detach:k.detach.bind(k),getFile:T.getFile.bind(T),serialize:T.serialize.bind(T),templates:{preview:C||(()=>null),icon:w==="simple"?(()=>null):w}}),[T,k]),q=m.useRef(0);return m.useEffect(()=>{if(!q.current)y&&y(L);else{const D=T.getState();T.init({data:s,mode:r,drive:c,preview:d,panels:h||D.panels||[],activePanel:p})}q.current++},[T,s,r,c,d,h,p,y,L]),q.current===0&&T.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(Gm,{words:Pm,optional:!0,children:o.jsx(bC,{children:o.jsx(LC,{readonly:g,menuOptions:x,extraInfo:v})})})})});function BC({fonts:a=!0,children:l}){return l?o.jsx(kx,{fonts:a,children:l}):o.jsx(kx,{fonts:a})}Bm(Vn);function Xm(a,l){if(!a||typeof a!="object"||Array.isArray(a))throw new Error(`Invalid Hub ${l} response.`);return a}function zo(a,l,s){const r=Xm(a,s);if(!Array.isArray(r[l]))throw new Error(`Invalid Hub ${s} response: ${l} must be an array.`);return r[l]}function HC(a,l,s){const r=Xm(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 Gx(a,l=!1){return zo(await ct(`/api/remote/filesystem/roots${l?"?refresh=1":""}`,void 0,a),"roots","filesystem roots")}async function Vf(a,l){const s=await ct(`/api/remote/filesystem/entries?id=${encodeURIComponent(a)}`,void 0,l);return{folder:HC(s,"folder","filesystem entries"),entries:zo(s,"entries","filesystem entries")}}async function IC(a,l){return ct("/api/remote/filesystem/selection/scan",{method:"POST",body:JSON.stringify({itemIds:a})},l)}async function FC(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 UC(a,l=!1){const s=await ct(`/api/remote/files/jobs?active=${l?"1":"0"}`,void 0,a);return{jobs:zo(s,"jobs","file transfer jobs")}}async function $C(a,l){return ct(`/api/remote/files/jobs/${encodeURIComponent(a)}`,void 0,l)}async function qC(a,l){return ct(`/api/remote/files/jobs/${encodeURIComponent(a)}/cancel`,{method:"POST"},l)}async function Px(a){return zo(await ct("/api/remote/filesystem/shared-folders",void 0,a),"folders","shared folders")}async function GC(a,l){return ct("/api/remote/filesystem/shared-folders",{method:"POST",body:JSON.stringify({sourceId:a})},l)}async function PC(a,l,s){return ct(`/api/remote/filesystem/shared-folders/${encodeURIComponent(a)}`,{method:"PATCH",body:JSON.stringify(l)},s)}async function YC(a,l){return ct(`/api/remote/filesystem/shared-folders/${encodeURIComponent(a)}`,{method:"DELETE"},l)}async function VC(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=Xm(c,"shared folder sync");return{ok:d.ok===!0,jobs:zo(c,"jobs","shared folder sync"),files:Number(d.files||0),totalBytes:Number(d.totalBytes||0)}}function QC(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 Yx(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 vu(a){return a.driveType==="network"?"network":a.driveType==="removable"?"removable":"local"}function KC(a){const l=a.filter(s=>vu(s)==="local");return l.find(s=>/\bC:/i.test(`${s.name} ${s.displayPath||""}`))||l[0]||a[0]||null}function XC({hubUrl:a,roots:l,loading:s,error:r,onRefreshRoots:c,onImportFiles:d,onImportFolder:h,onSelectionChange:p,onShareItem:g,onAddSyncFolder:x,onNotice:v}){const y=m.useRef(null),w=m.useRef("/"),C=m.useRef(0),j=m.useRef([]),M=m.useRef(new Map),[T,k]=m.useState(null),[A,L]=m.useState([]),[q,D]=m.useState([]),[$,E]=m.useState(0),[ee,de]=m.useState(null),[V,J]=m.useState(!1),[B,ie]=m.useState(""),[K,fe]=m.useState(new Set),I=l.find(re=>re.id===T)||null,Z=A[A.length-1]||null,ne=I?Z?.svarPath||`/${I.name}`:null,O=ne;m.useEffect(()=>{j.current=A,w.current=O||"/"},[O,A]);const le=m.useMemo(()=>(M.current.clear(),!I||!O||A.length===0?[]:(A.forEach(re=>M.current.set(re.svarPath,re.hubId)),[...A.map((re,ye)=>({id:re.svarPath,parent:ye===0?"/":A[ye-1].svarPath,type:"folder",name:re.name,date:re.modifiedAt?new Date(re.modifiedAt):void 0,lazy:!1})),...q.map(re=>{const ye=`${O}/${re.name}`;return M.current.set(ye,re.id),{id:ye,parent:O,name:re.name,type:re.type==="file"?"file":"folder",...re.type==="file"?{size:re.size}:{},date:re.modifiedAt?new Date(re.modifiedAt):void 0,lazy:re.type!=="file"&&re.hasChildren===!0,displayPath:re.displayPath,locked:re.locked,driveType:re.driveType,totalBytes:re.totalBytes,freeBytes:re.freeBytes}})])),[I,q,O,A]),me=re=>M.current.get(String(re))||String(re),_=re=>QC({...re,id:me(String(re.id)),parent:me(String(re.parent))}),ge=async(re,ye)=>{const ke=re[re.length-1];if(!ke)return;const De=++C.current;J(!0),ie("");try{const oe=await Vf(ke.hubId,a);if(De!==C.current)return;if(!Array.isArray(oe.entries))throw new Error("Invalid Hub filesystem entries response.");const et={...ke,displayPath:oe.folder.displayPath||ke.displayPath,modifiedAt:oe.folder.modifiedAt||ke.modifiedAt},Me=[...re.slice(0,-1),et];j.current=Me,L(Me),D(oe.entries),E(Ft=>Ft+1)}catch(oe){if(De!==C.current)return;console.error("[LiveDesk FS] folder navigation failed",{folderId:ke.hubId,error:oe}),ie(oe instanceof Error?`${ye}: ${oe.message}`:`${ye}: Unable to read this folder.`)}finally{De===C.current&&J(!1)}},be=async re=>{const ye={svarPath:`/${re.name}`,hubId:re.id,name:re.name,displayPath:re.displayPath,modifiedAt:re.modifiedAt},ke=++C.current;k(re.id),j.current=[ye],L([ye]),w.current=ye.svarPath,D([]),ie(""),J(!0),de(re.id),fe(De=>{const oe=new Set(De);return oe.delete(re.id),oe});try{const De=await Vf(re.id,a);if(ke!==C.current)return;if(!Array.isArray(De.entries))throw new Error("Invalid Hub filesystem entries response.");const oe={...ye,displayPath:De.folder.displayPath||ye.displayPath,modifiedAt:De.folder.modifiedAt||ye.modifiedAt};j.current=[oe],L([oe]),D(De.entries),E(et=>et+1)}catch(De){if(ke!==C.current)return;console.error("[LiveDesk FS] getEntries failed",{rootId:re.id,error:De}),fe(oe=>new Set(oe).add(re.id)),ie(De instanceof Error?`${re.name}: ${De.message}`:`${re.name}: Unable to read this drive.`),v(De instanceof Error?`${re.name}: ${De.message}`:`${re.name}: Unable to read this drive.`)}finally{ke===C.current&&(de(null),J(!1))}},Ce=re=>{const ye=j.current;re<0||re>=ye.length||re===ye.length-1||ge(ye.slice(0,re+1),ye[re].name)},Ie=(re,ye)=>{if(re.type!=="folder")return;const ke=j.current,De=ke.findIndex(et=>et.svarPath===ye);if(De<0)return;const oe={svarPath:`${ye}/${re.name}`,hubId:re.id,name:re.name,displayPath:re.displayPath,modifiedAt:re.modifiedAt};ge([...ke.slice(0,De+1),oe],re.name)},Ve=()=>Ce(j.current.length-2),Le=re=>{if(re.key!=="Enter"&&re.code!=="Enter"&&re.code!=="NumpadEnter"||re.target?.closest('button, input, textarea, [contenteditable="true"]'))return;const ke=y.current;if(!ke)return;const De=ke.getState().panels?.flatMap(et=>et.selected||[])||[];if(De.length!==1)return;const oe=ke.getFile(String(De[0]));oe?.type==="folder"&&(re.preventDefault(),re.stopPropagation(),Ie(_(oe),String(oe.parent||w.current)))};m.useEffect(()=>{const re=l.find(ye=>ye.id===T)||KC(l);if(fe(ye=>new Set([...ye].filter(ke=>l.some(De=>De.id===ke)))),!re){k(null),j.current=[],L([]),D([]);return}be(re)},[l]);const Ee=re=>{y.current=re,re.on("request-data",async({id:ye})=>{const ke=String(ye),De=me(ke);try{const oe=await Vf(De,a);if(!Array.isArray(oe.entries))throw new Error("Invalid Hub filesystem entries response.");const et=oe.entries.map(Me=>{const Ft=`${ke}/${Me.name}`;return M.current.set(Ft,Me.id),{id:Ft,parent:ke,name:Me.name,type:Me.type==="file"?"file":"folder",...Me.type==="file"?{size:Me.size}:{},date:Me.modifiedAt?new Date(Me.modifiedAt):void 0,lazy:Me.type!=="file"&&Me.hasChildren===!0,displayPath:Me.displayPath,locked:Me.locked,driveType:Me.driveType,totalBytes:Me.totalBytes,freeBytes:Me.freeBytes}});await re.exec("provide-data",{id:ke,data:et})}catch(oe){console.error("[LiveDesk FS] nested getEntries failed",{id:De,error:oe}),v(oe instanceof Error?oe.message:"Unable to read this folder.")}}),re.intercept("set-path",({id:ye})=>{const ke=String(ye),De=j.current.findIndex(et=>et.svarPath===ke);if(De>=0)return Ce(De),!1;const oe=re.getFile(ke);if(oe?.type==="folder")return Ie(_(oe),String(oe.parent||w.current)),!1}),re.intercept("open-file",()=>!1),re.on("select-file",()=>{window.setTimeout(()=>{const De=(re.getState().panels?.flatMap(oe=>oe.selected||[])||[]).map(oe=>re.getFile(oe)).filter(Boolean).map(oe=>_(oe));p(De.map(oe=>oe.id),De)},0)})},qe=(re,ye)=>{const ke=ye?_(ye):null,De=()=>{const oe=ke?.type==="file"?String(ye?.parent||w.current):String(ye?.id||w.current);y.current?.exec("request-data",{id:oe})};return re==="body"?[{id:"refresh",text:"Refresh",icon:"mdi mdi-refresh",handler:De},{id:"properties",text:"Properties",icon:"mdi mdi-information-outline",handler:()=>v("Select a file or folder to view its properties.")}]:re==="multiselect"?[{id:"share",text:"Share to workstations",icon:"mdi mdi-share-variant",handler:()=>{(y.current?.getState().panels?.flatMap(et=>et.selected||[])||[]).forEach(et=>{const Me=y.current?.getFile(et);Me&&g(_(Me))})}},{id:"refresh",text:"Refresh",icon:"mdi mdi-refresh",handler:De}]:ke?[{id:"share",text:"Share to workstations",icon:"mdi mdi-share-variant",handler:()=>g(ke)},...ke.type==="folder"?[{id:"sync",text:"Add folder to Sync",icon:"mdi mdi-folder-sync-outline",handler:()=>x(ke)}]:[],{id:"copy-path",text:"Copy path",icon:"mdi mdi-content-copy",handler:()=>{Vi(ke.displayPath||ke.name)}},{id:"refresh",text:"Refresh",icon:"mdi mdi-refresh",handler:De},{id:"properties",text:"Properties",icon:"mdi mdi-information-outline",handler:()=>v(`${ke.name}
12
+ ${ke.displayPath||""}`)}]:[]},Te=async()=>{try{await c()}catch(re){v(re instanceof Error?re.message:"Unable to refresh Hub drives.")}},gt=[{id:"local",label:"Local drives",icon:er,roots:l.filter(re=>vu(re)==="local")},{id:"removable",label:"Removable drives",icon:Gb,roots:l.filter(re=>vu(re)==="removable")},{id:"network",label:"Network drives",icon:Rm,roots:l.filter(re=>vu(re)==="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(er,{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(gy,{size:16})}),o.jsx("button",{className:"icon-button",onClick:h,title:"Import folder from this browser",type:"button",children:o.jsx(Pb,{size:16})}),o.jsx("button",{className:"icon-button",onClick:()=>{Te()},title:"Refresh drives",type:"button",children:o.jsx(Lu,{size:16})})]})]}),s?o.jsxs("div",{className:"hub-file-explorer-state",children:[o.jsx(er,{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(rm,{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(er,{size:15}),o.jsx("strong",{children:"This PC"})]}),gt.map(re=>re.roots.length>0&&o.jsxs("section",{className:"hub-drive-group",children:[o.jsxs("h3",{children:[o.jsx(re.icon,{size:13}),re.label]}),o.jsx("div",{className:"hub-drive-list",children:re.roots.map(ye=>{const ke=re.icon,De=K.has(ye.id)||ye.locked===!0;return o.jsxs("button",{className:`hub-drive-item ${T===ye.id?"active":""} ${De?"unavailable":""}`,onClick:()=>{be(ye)},"aria-pressed":T===ye.id,type:"button",children:[o.jsx("span",{className:"hub-drive-item-icon",children:o.jsx(ke,{size:16})}),o.jsxs("span",{className:"hub-drive-item-copy",children:[o.jsx("strong",{children:ye.name}),o.jsx("small",{children:ye.displayPath||ye.name}),o.jsxs("em",{children:[Yx(ye.freeBytes||0)," free / ",Yx(ye.totalBytes||0)]})]}),ee===ye.id?o.jsx(Cu,{className:"hub-drive-item-status spin",size:15}):De?o.jsx(Kg,{className:"hub-drive-item-status",size:15}):null]},ye.id)})})]},re.id)),l.length===0&&o.jsxs("div",{className:"hub-drive-sidebar-empty",children:[o.jsx(rm,{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((re,ye)=>o.jsxs("span",{className:"hub-file-explorer-breadcrumb-item",children:[ye>0&&o.jsx(Lm,{size:13,"aria-hidden":"true"}),o.jsx("button",{className:`hub-file-explorer-breadcrumb ${ye===A.length-1?"current":""}`,onClick:()=>Ce(ye),"aria-current":ye===A.length-1?"location":void 0,type:"button",children:re.name})]},re.svarPath))}),o.jsxs("div",{className:"hub-file-explorer-navigation-actions",children:[V&&o.jsx(Cu,{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||V,title:"Back to parent folder",type:"button",children:o.jsx(Yb,{size:16})})]})]}),B&&o.jsxs("div",{className:"hub-file-explorer-folder-error",role:"alert",children:[o.jsx(Kg,{size:15}),o.jsx("span",{children:B})]}),o.jsx("div",{className:"hub-file-explorer-svar",onKeyDownCapture:Le,children:o.jsx(BC,{fonts:!1,children:o.jsx(OC,{data:le,panels:ne?[{path:ne,selected:[]}]:void 0,readonly:!0,mode:"table",preview:!1,init:Ee,icons:"simple",menuOptions:qe},`${I?.id||"no-root"}:${$}`)})})]})]})]})}class ZC 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(Vb,{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(Lu,{size:15})," Retry"]})]}):this.props.children}}function WC(a){return a.deviceName||a.hostname||a.deviceId}function JC({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(xy,{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:WC(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 eM(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 tM({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(mu,{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(mu,{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(mu,{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 / ",eM(x.totalBytes)," · ",x.lastSyncedAt?`Last sync ${ym(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(Lu,{size:14})," Sync now"]}),o.jsx("button",{className:"icon-button",onClick:()=>p(x),title:"Remove sync folder",type:"button",children:o.jsx(Qb,{size:15})})]},x.id))})]})}function nM(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(Mu,{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(JC,{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(Mu,{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(tM,{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 aM(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 Vx(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 Qx(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 Kx(a){return["completed","partially-failed","failed","cancelled"].includes(a)}function lM({hubUrl:a,devices:l,localFeatureAccess:s,upgradeNotice:r,notice:c,remoteDirectory:d,onRemoteDirectoryChange:h,targetMode:p,selectedTargetIds:g,onTargetModeChange:x,onTargetToggle:v,filePickerRef:y,folderPickerRef:w,onBrowserFileImport:C,onBrowserFolderImport:j,onNotice:M,onTransferChange:T}){const k=Array.isArray(l)?l:[],[A,L]=m.useState([]),[q,D]=m.useState(!0),[$,E]=m.useState(""),[ee,de]=m.useState([]),[V,J]=m.useState([]),[B,ie]=m.useState(null),[K,fe]=m.useState(!1),[I,Z]=m.useState([]),[ne,O]=m.useState(!0),[le,me]=m.useState(!1),[_,ge]=m.useState("send"),[be,Ce]=m.useState([]),Ie=m.useRef(new Set),Ve=m.useMemo(()=>p==="all"?k.map(xe=>xe.deviceId):g.filter(xe=>k.some(He=>He.deviceId===xe)),[k,g,p]),Le=be.find(xe=>!Kx(xe.state)),Ee=V.length===1&&V[0].type==="folder"?V[0]:null,qe=V.length===0?"Select files or folders from the Hub explorer.":K?"Calculating selection size...":B?`${B.files} files, ${B.folders} folders · ${aM(B.totalBytes)}`:`${V.length} item${V.length===1?"":"s"} selected`,Te=xe=>{T({id:xe.jobId,state:xe.state,progress:Vx(xe),message:Qx(xe)})},gt=m.useCallback(async()=>{const xe=await Gx(a,!0);return L(xe),E(""),xe},[a]),re=async()=>{try{const He=(await UC(a,!0)).jobs||[],ze=await Promise.all([...Ie.current].map(async it=>{try{return await $C(it,a)}catch{return null}})),lt=[...He,...ze.filter(Boolean)],Cn=[...new Map(lt.map(it=>[it.jobId,it])).values()];Ce(Cn),Cn.forEach(Te),Cn.filter(it=>Kx(it.state)).forEach(it=>Ie.current.delete(it.jobId))}catch{}};m.useEffect(()=>{let xe=!0;D(!0),E(""),Promise.all([gt(),Px(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."),M(ze instanceof Error?ze.message:"Hub file system is unavailable."))}).finally(()=>{xe&&(D(!1),O(!1))}),re();const He=window.setInterval(()=>{re()},800);return()=>{xe=!1,window.clearInterval(He)}},[a,gt]),m.useEffect(()=>{if(ee.length===0){ie(null);return}let xe=!1;return fe(!0),IC(ee,a).then(He=>{xe||ie(He)}).catch(He=>{xe||M(He instanceof Error?He.message:"Unable to calculate selected size.")}).finally(()=>{xe||fe(!1)}),()=>{xe=!0}},[a,ee.join("|")]);const ye=(xe,He)=>{de(xe),J(He)},ke=xe=>{xe.forEach(He=>Ie.current.add(He.jobId)),Ce(He=>[...new Map([...He,...xe].map(ze=>[ze.jobId,ze])).values()]),xe.forEach(Te)},De=async()=>{if(!s){M(r);return}if(ee.length===0){M("Select files or folders from the Hub explorer.");return}if(Ve.length===0){M("Choose at least one connected workstation.");return}if(Le){M("A Hub transfer is already running.");return}try{const xe=await FC(ee,Ve,d.trim(),a);Ie.current.add(xe.jobId),M("Hub transfer queued."),await re()}catch(xe){M(xe instanceof Error?xe.message:"Unable to start Hub transfer.")}},oe=async xe=>{const He=xe||Ee;if(!He||He.type!=="folder"){M("Select one folder to add it to Sync.");return}try{const ze=await GC(He.id,a);Z(lt=>[...lt.filter(Cn=>Cn.id!==ze.folder.id),ze.folder]),ge("sync"),M(`${He.name} is ready for Hub sync.`)}catch(ze){M(ze instanceof Error?ze.message:"Unable to add the Hub folder to Sync.")}},et=async xe=>{if(Ve.length===0){M("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 VC(xe.id,Ve,d.trim(),a);ke(He.jobs||[]),M(He.jobs?.length?"Hub sync queued.":"No changed files to sync.");const ze=await Px(a);Z(ze)}catch(He){M(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)}},Me=async()=>{me(!0);try{for(const xe of I)await et(xe)}finally{me(!1)}},Ft=async xe=>{try{const He=await PC(xe.id,{autoSync:!xe.autoSync},a);Z(ze=>ze.map(lt=>lt.id===xe.id?He.folder:lt))}catch(He){M(He instanceof Error?He.message:"Unable to update auto sync.")}},Rt=async xe=>{try{await YC(xe.id,a),Z(He=>He.filter(ze=>ze.id!==xe.id))}catch(He){M(He instanceof Error?He.message:"Unable to remove the sync folder.")}};return o.jsxs("section",{className:"livedesk-file-explorer",children:[o.jsx("input",{ref:y,className:"hidden-file-input",type:"file",multiple:!0,onChange:xe=>{xe.currentTarget.files&&C(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&&j(xe.currentTarget.files),xe.currentTarget.value=""}}),(c||$)&&o.jsxs("section",{className:"file-share-notice",role:$?"alert":void 0,children:[$||c,o.jsx("button",{className:"icon-button",onClick:()=>{E(""),D(!0),Gx(a).then(xe=>L(xe)).catch(()=>E("Hub file system is unavailable.")).finally(()=>D(!1))},title:"Retry",type:"button",children:o.jsx(Lu,{size:15})})]}),o.jsx("div",{className:"file-share-workspace",children:o.jsxs(ZC,{onRetry:()=>window.location.reload(),children:[o.jsx(XC,{hubUrl:a,roots:A,loading:q,error:$,onRefreshRoots:gt,onImportFiles:()=>y.current?.click(),onImportFolder:()=>w.current?.click(),onSelectionChange:ye,onShareItem:xe=>{de([xe.id]),J([xe]),ge("send")},onAddSyncFolder:xe=>{de([xe.id]),J([xe]),oe(xe)},onNotice:M}),o.jsx(nM,{devices:k,targetMode:p,selectedTargetIds:g,onTargetModeChange:x,onTargetToggle:v,remoteDirectory:d,onRemoteDirectoryChange:h,selectedEntries:V,selectedSummary:qe,canShare:s&&!Le&&ee.length>0&&Ve.length>0&&!K,onShare:()=>{De()},canAddSync:!!Ee,onAddSync:()=>{oe()},tab:_,onTabChange:ge,folders:I,foldersLoading:ne,syncBusy:le,onSyncAll:()=>{Me()},onSync:xe=>{et(xe)},onToggleAuto:xe=>{Ft(xe)},onRemove:xe=>{Rt(xe)},onAddFolder:()=>{oe()}})]})}),Le&&o.jsx("footer",{className:"file-share-workspace-footer",children:o.jsxs("span",{children:[Qx(Le)," · ",Vx(Le),"% ",o.jsx("button",{className:"icon-button",onClick:()=>{qC(Le.jobId,a).then(xe=>{Ce(He=>He.map(ze=>ze.jobId===xe.jobId?xe:ze)),Te(xe)})},title:"Cancel transfer",type:"button",children:o.jsx(Ao,{size:14})})]})})]})}const iM=m.forwardRef(function({value:l,onChange:s,onSubmit:r,onOpenSuggestedTasks:c,suggestedOpen:d=!1,disabled:h=!1},p){return o.jsxs("form",{className:"agents-composer",onSubmit:g=>{g.preventDefault(),r()},children:[o.jsx("button",{className:`agents-suggested-trigger ${d?"active":""}`,type:"button","aria-label":"Open Suggested tasks","aria-expanded":d,onClick:c,disabled:h,children:o.jsx(Kb,{size:17})}),o.jsx("textarea",{ref:p,value:l,onChange:g=>s(g.target.value.slice(0,4e3)),placeholder:"Ask LiveDesk to work across your machines...","aria-label":"Ask LiveDesk",rows:2,disabled:h}),o.jsxs("button",{className:"agents-run-button",type:"submit",disabled:h||!l.trim(),children:[h?o.jsx(Cu,{className:"spin",size:16}):o.jsx(Mu,{size:16}),h?"Running":"Run"]})]})});function fv(a){return a.deviceName?.trim()||a.hostname?.trim()||a.deviceId}function sM(a){return a==="running"||a==="completed"||a==="failed"||a==="cancelled"?a:"queued"}function rM(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 oM(a){const l=a.match(/\[([^\]]+)\]/)?.[1]?.trim();if(l)return l;if(a.includes("comfyui"))return"comfyui";if(a.includes("ollama"))return"ollama";const s=a.match(/process(?:\s+(?:named|called))?\s+([a-z0-9._-]+)/i)?.[1];return s&&!["is","running","process"].includes(s)?s:void 0}function cM(a){const l=a.trim().toLowerCase();return l?/(process|프로세스|실행 중|실행중|comfyui|running|processes)/i.test(l)?{operation:"process.list",query:oM(l)}:/(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 uM=["이 작업은 아직 지원되지 않습니다.","","현재 지원:","• 시스템 상태 확인","• GPU 상태 확인","• 디스크 상태 확인","• 프로세스 조회","• 서비스 상태 조회","• 진단 로그 수집"].join(`
13
+ `);function dM({state:a}){const l=a.status==="completed"?om:a.status==="failed"||a.status==="cancelled"?Ao:a.status==="running"?Cu:Xb,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 fM({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:rM(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(dM,{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(Zb,{size:14})," Cancel"]}),!h&&p&&c&&o.jsxs("button",{onClick:c,disabled:d,type:"button",children:[o.jsx(hu,{size:14})," Retry failed"]})]})]})}function mM({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(fM,{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)})]})}const Xx=["Recommended","System health","Processes & services","Storage & files","AI workloads","Network & connectivity","Troubleshooting"],hM=[{id:"recommended-system-health",category:"Recommended",title:"Check system health across all workstations",prompt:"Check system health across all connected workstations.",tool:"system.health",requiredCapabilities:["system.health"],permission:"read-only",keywords:["health","system","status","cpu","memory"],enabled:!0},{id:"recommended-comfyui",category:"Recommended",title:"Check whether ComfyUI is running everywhere",prompt:"Check whether ComfyUI is running everywhere.",tool:"process.list",requiredCapabilities:["process.list"],permission:"read-only",keywords:["comfyui","process","running","ai"],enabled:!0},{id:"recommended-disk",category:"Recommended",title:"Show disk status for all workstations",prompt:"Show disk status for all connected workstations.",tool:"disk.status",requiredCapabilities:["disk.status"],permission:"read-only",keywords:["disk","storage","free space","drive"],enabled:!0},{id:"recommended-diagnostics",category:"Recommended",title:"Collect diagnostics from selected workstations",prompt:"Collect diagnostics from the selected workstations.",tool:"diagnostics.collect",requiredCapabilities:["diagnostics.collect"],permission:"read-only",keywords:["diagnostics","troubleshooting","logs","failed"],enabled:!0},{id:"system-gpu",category:"System health",title:"Check GPU status across workstations",prompt:"Check GPU status across all connected workstations.",tool:"gpu.status",requiredCapabilities:["gpu.status"],permission:"read-only",keywords:["gpu","vram","graphics","temperature"],enabled:!0},{id:"process-ollama",category:"Processes & services",title:"Check whether Ollama is running everywhere",prompt:"Check whether Ollama is running everywhere.",tool:"process.list",requiredCapabilities:["process.list"],permission:"read-only",keywords:["ollama","process","running","ai"],enabled:!0},{id:"process-named",category:"Processes & services",title:"Find a running process by name",prompt:"Find a running process named [process name].",tool:"process.list",requiredCapabilities:["process.list"],permission:"read-only",keywords:["process","running","application","name"],enabled:!0},{id:"service-status",category:"Processes & services",title:"Check service status on selected workstations",prompt:"Check service status on the selected workstations.",tool:"service.status",requiredCapabilities:["service.status"],permission:"read-only",keywords:["service","windows service","status"],enabled:!0}],pM=new Set(["system.health","gpu.status","disk.status","process.list","service.status","diagnostics.collect"]),Qf="livedesk.agentPromptRecent",Kf="livedesk.agentPromptFavorites",gM={Recommended:cm,"System health":pu,"Processes & services":nw,"Storage & files":er,"AI workloads":tw,"Network & connectivity":Rm,Troubleshooting:ew};function Zx(a){if(typeof window>"u")return[];try{const l=JSON.parse(window.localStorage.getItem(a)||"[]");return Array.isArray(l)?l.filter(s=>typeof s=="string"):[]}catch{return[]}}function cu(a,l){try{window.localStorage.setItem(a,JSON.stringify(l))}catch{}}function Wx(a){return a==="all"?"All tasks":a==="recent"?"Recent":a==="favorites"?"Favorites":a}function xM(a,l){if(!l.trim())return!0;const s=l.trim().toLowerCase();return[a.title,a.prompt,a.category,...a.keywords].join(" ").toLowerCase().includes(s)}function yM({onSelectPrompt:a,onClose:l}){const[s,r]=m.useState(""),[c,d]=m.useState("all"),[h,p]=m.useState(()=>Zx(Qf)),[g,x]=m.useState(()=>Zx(Kf)),[v,y]=m.useState(0),w=m.useRef(null),C=m.useRef(null),j=m.useMemo(()=>hM.filter(D=>D.enabled&&pM.has(D.tool)),[]),M=m.useMemo(()=>{const D=j.filter($=>xM($,s));return c==="recent"?h.map($=>D.find(E=>E.id===$)).filter($=>!!$):c==="favorites"?g.map($=>D.find(E=>E.id===$)).filter($=>!!$):c==="all"?D:D.filter($=>$.category===c)},[g,c,h,s,j]),T=m.useMemo(()=>c!=="all"?[{category:c==="recent"||c==="favorites"?Wx(c):c,templates:M}]:Xx.map(D=>({category:D,templates:M.filter($=>$.category===D)})).filter(D=>D.templates.length>0),[c,M]);m.useEffect(()=>{y(D=>Math.min(D,Math.max(0,M.length-1)))},[M.length]),m.useEffect(()=>{cu(Qf,h)},[h]),m.useEffect(()=>{cu(Kf,g)},[g]),m.useEffect(()=>{C.current?.focus();const D=E=>{E.target instanceof Node&&!w.current?.contains(E.target)&&l()},$=E=>{E.key==="Escape"&&(E.preventDefault(),l())};return document.addEventListener("pointerdown",D),document.addEventListener("keydown",$),()=>{document.removeEventListener("pointerdown",D),document.removeEventListener("keydown",$)}},[l]);const k=D=>{const $=[D.id,...h.filter(E=>E!==D.id)].slice(0,10);p($),cu(Qf,$),a(D.prompt),l()},A=D=>{x($=>{const E=$.includes(D)?$.filter(ee=>ee!==D):[D,...$];return cu(Kf,E),E})},L=D=>{D.key==="ArrowDown"?(D.preventDefault(),y($=>Math.min($+1,Math.max(0,M.length-1)))):D.key==="ArrowUp"?(D.preventDefault(),y($=>Math.max($-1,0))):D.key==="Enter"&&M[v]&&(D.preventDefault(),k(M[v]))};let q=-1;return o.jsxs("section",{className:"agents-suggested-tasks",ref:w,"aria-label":"Suggested tasks",children:[o.jsxs("header",{className:"agents-suggested-header",children:[o.jsxs("div",{children:[o.jsxs("span",{className:"agents-suggested-title",children:[o.jsx(cm,{size:15})," Suggested tasks"]}),o.jsx("small",{children:"Choose a read-only task, edit it, then run it."})]}),o.jsx("button",{className:"agents-suggested-close",type:"button","aria-label":"Close suggested tasks",onClick:l,children:o.jsx(Ao,{size:16})})]}),o.jsxs("label",{className:"agents-suggested-search",children:[o.jsx(Wb,{size:15,"aria-hidden":"true"}),o.jsx("input",{ref:C,value:s,onChange:D=>r(D.target.value),onKeyDown:L,placeholder:"Search tasks...","aria-label":"Search suggested tasks"})]}),o.jsx("div",{className:"agents-suggested-filters","aria-label":"Task categories",children:["all","recent","favorites",...Xx].map(D=>{const $=D==="recent"?Jb:D==="favorites"?um:D==="all"?cm:gM[D];return o.jsxs("button",{className:c===D?"active":"",type:"button","aria-pressed":c===D,onClick:()=>{d(D),y(0)},children:[o.jsx($,{size:13})," ",Wx(D)]},D)})}),o.jsxs("div",{className:"agents-suggested-list",role:"listbox","aria-label":"Available suggested tasks",children:[T.map(D=>o.jsxs("div",{className:"agents-suggested-group",children:[o.jsx("strong",{children:D.category}),D.templates.map($=>{q+=1;const E=q===v,ee=g.includes($.id);return o.jsxs("div",{className:`agents-suggested-item ${E?"active":""}`,children:[o.jsxs("button",{className:"agents-suggested-prompt",type:"button",role:"option","aria-selected":E,onClick:()=>k($),children:[o.jsx("span",{children:$.title}),o.jsx("small",{children:$.prompt})]}),o.jsx("button",{className:`agents-suggested-favorite ${ee?"favorite":""}`,type:"button","aria-label":ee?`Remove ${$.title} from favorites`:`Add ${$.title} to favorites`,"aria-pressed":ee,onClick:()=>A($.id),children:o.jsx(um,{size:14,fill:ee?"currentColor":"none"})})]},$.id)})]},D.category)),M.length===0&&o.jsx("p",{className:"agents-suggested-empty",children:"No supported read-only tasks match this search."})]})]})}function vM({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(xy,{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(om,{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:fv(p)}),o.jsx("small",{children:p.connected?"Connected":"Offline"})]}),g&&o.jsx(om,{className:"agents-target-check",size:15,"aria-hidden":"true"})]},p.deviceId)})})]})}async function bM(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 wM(a,l){return ct(`/api/remote/tasks/${encodeURIComponent(l)}`,void 0,a)}async function SM(a,l){return ct(`/api/remote/tasks/${encodeURIComponent(l)}/cancel`,{method:"POST",body:JSON.stringify({})},a)}async function CM(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 Xf(a,l){const s=new Map(l.map(r=>[r.deviceId,fv(r)]));return a.results.map(r=>({deviceId:r.deviceId,deviceName:r.deviceName||s.get(r.deviceId)||r.deviceId,status:sM(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 MM(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 jM(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 NM({hubUrl:a,devices:l}){const[s,r]=m.useState("all"),[c,d]=m.useState([]),[h,p]=m.useState(""),[g,x]=m.useState([]),[v,y]=m.useState(""),[w,C]=m.useState(""),[j,M]=m.useState(""),[T,k]=m.useState(!1),A=m.useRef(null),L=m.useRef(new Set),q=m.useMemo(()=>l.filter(J=>J.connected).map(J=>J.deviceId),[l]),D=m.useCallback(J=>{const B=Xf(J,l);x(ie=>ie.map(K=>K.type==="task"&&K.batchId===J.batchId?{...K,states:MM(K.states,B),status:J.status}:K)),!["running","queued"].includes(J.status)&&!L.current.has(J.batchId)&&(L.current.add(J.batchId),x(ie=>[...ie,{type:"agent",id:Ks("agent-summary"),text:jM(J,B)}]),y(ie=>ie===J.batchId?"":ie))},[l]),$=m.useCallback(async J=>{const B=await wM(a,J);return D(B),B},[a,D]);m.useEffect(()=>{if(!v)return;let J=!0;const B=async()=>{try{const K=await $(v);J&&!["running","queued"].includes(K.status)&&y("")}catch(K){J&&M(K instanceof Error?K.message:String(K))}};B();const ie=window.setInterval(()=>{B()},800);return()=>{J=!1,window.clearInterval(ie)}},[v,$]);const E=async()=>{const J=h.trim();if(!J||v)return;const B=cM(J);if(x(K=>[...K,{type:"user",id:Ks("user"),text:J}]),p(""),k(!1),M(""),!B){x(K=>[...K,{type:"error",id:Ks("unsupported"),text:uM}]);return}const ie=s==="all"?q:c.filter(K=>q.includes(K));if(ie.length===0){x(K=>[...K,{type:"error",id:Ks("no-targets"),text:"연결된 대상 장비를 하나 이상 선택해 주세요."}]);return}try{const K=await bM(a,{instruction:J,deviceIds:ie,operation:B.operation,targetQuery:B.query});if(!K.ok||!K.batch||!K.batchId)throw new Error(K.error||"작업을 만들지 못했습니다.");const fe={type:"task",id:Ks("task"),batchId:K.batchId,operation:B.operation,instruction:J,states:Xf(K.batch,l),status:K.batch.status};x(I=>[...I,{type:"agent",id:Ks("agent-start"),text:`${ie.length}개 워크스테이션에서 확인하고 있습니다.`},fe]),y(K.batchId)}catch(K){M(K instanceof Error?K.message:String(K))}},ee=async J=>{C(J);try{const B=await SM(a,J);D(B),y(ie=>ie===J?"":ie)}catch(B){M(B instanceof Error?B.message:String(B))}finally{C("")}},de=async J=>{C(J);try{const B=await CM(a,J);if(!B.ok||!B.batch||!B.batchId)throw new Error(B.error||"재시도하지 못했습니다.");L.current.delete(B.batchId),x(ie=>ie.map(K=>K.type==="task"&&K.batchId===J?{...K,batchId:B.batchId,states:Xf(B.batch,l),status:B.batch.status}:K)),y(B.batchId)}catch(B){M(B instanceof Error?B.message:String(B))}finally{C("")}},V=J=>{p(J),k(!1),window.requestAnimationFrame(()=>A.current?.focus())};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: ",q.length," workstations"]}),o.jsx("strong",{children:"Read only"})]})]}),o.jsx(vM,{devices:l,mode:s,selectedIds:c,onModeChange:r,onToggle:J=>d(B=>B.includes(J)?B.filter(ie=>ie!==J):[...B,J])}),j&&o.jsx("div",{className:"agents-error",role:"alert",children:j}),o.jsx(mM,{items:g,onCancel:ee,onRetry:de,busyBatchId:w}),o.jsxs("div",{className:"agents-composer-shell",children:[T&&o.jsx(yM,{onSelectPrompt:V,onClose:()=>k(!1)}),o.jsx(iM,{ref:A,value:h,onChange:p,onSubmit:()=>{E()},onOpenSuggestedTasks:()=>k(J=>!J),suggestedOpen:T,disabled:!!v})]})]})}const AM=120,kM=999,Js=5,yo=30,TM=Number.POSITIVE_INFINITY,mv="livedesk.remoteDirectory",Mm="livedesk.localHubAccessEnabled",hv="livedesk.streamSettings",pv=15,gv="livedesk.controlStreamSettings",jm=6,Zf=512*1024,Nm="".trim(),xv="".trim(),Jx="livedesk-adsense-script",Wf=!!Nm&&!!xv,EM=1e3/60,Jf=1500,DM=650,RM=1800,LM=650,zM=2500,ey=1500,ty=15e3,ny=240,_M=1024,OM=480,BM=270;function HM(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 Tl={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:yo,audience:"Creators and homelabs",note:"30 devices, no ads, personal use."},pro:{name:"Pro",price:"$15/mo",yearly:"$120/year",ltd:"$199 LTD",limit:TM,audience:"Business and studios",note:"Commercial use and larger workstation walls."}},yv={"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:yv["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 bu(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 Zm(a,l){a.push(l),a.length>ny&&a.splice(0,a.length-ny)}function ay(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 ly(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),Zm(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 iy(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 IM(){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 v=w=>{document.visibilityState==="visible"?(c+=1,d>0&&Zm(h,Math.max(0,w-d)),d=w):d=0,s=window.requestAnimationFrame(v)};try{x=new PerformanceObserver(w=>{for(const C of w.getEntries())p+=1,g+=C.duration}),x.observe({entryTypes:["longtask"]})}catch{x=null}s=window.requestAnimationFrame(v);const y=window.setInterval(()=>{const w=performance.now(),C=Math.max(1,w-r),j=h.reduce((M,T)=>M+T,0);l({framesPerSecond:c*1e3/C,averageIntervalMs:h.length>0?j/h.length:0,p95IntervalMs:bu(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(y),x?.disconnect()}},[]),a}function sy(a){return!a||a.seqGapCount<=0?"none":`${a.seqGapCount} gaps / max ${a.maxSeqGap}`}function FM(a){return Number.isFinite(a)?String(a):"30+"}const wu=[{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"}],Am=[{id:"prefer-software",label:"Software low latency"},{id:"prefer-hardware",label:"Hardware decode"},{id:"no-preference",label:"Browser auto"}],UM=[{id:"mode3-h264-hw",label:"Mode 3 - H.264 hardware"},{id:"mode5-lzo-delta",label:"Mode 5 - LZO tile delta"}],Su=[{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}],em=Su.filter(a=>a.width>=1280),tm=[{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}],Wm=[1,2,5,8,12,20,30],$M=[20,30,60],ry=[45,60,75,90],oy={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},cy=2200,qM=8e3,GM=3500,PM=2600,YM=4200,VM=750,QM=2,uy=4200;function dy(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 KM(){return"npx -y livedesk client"}function XM(){return"npx -y livedesk"}function ZM(){try{return localStorage.getItem(mv)||""}catch{return""}}function WM(){try{return localStorage.getItem(Mm)==="1"}catch{return!1}}function Xs(a){try{a?localStorage.setItem(Mm,"1"):localStorage.removeItem(Mm)}catch{}}function Ca(a,l,s,r){const c=Number(a);return Number.isFinite(c)?Math.max(l,Math.min(s,Math.round(c))):r}function km(a){const l=String(a||"").trim();return l==="mode2-lz4"||l==="lz4"?"mode2-lzo":wu.some(s=>s.id===l)?l:qn.frameMode}function Ru(a){const l=String(a||"").trim();return Am.some(s=>s.id===l)?l:qn.h264DecodeAcceleration}function Tm(a){return a==="mode3-h264-hw"||a==="mode5-lzo-delta"?a:Gn.frameMode}function vv(a){return yv[a]||12}function bv(a){return a==="mode3-h264-hw"||a==="mode4-h264-atlas"?20:30}function Em(a,l){return Ca(a,1,bv(l),vv(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 yi(a){const l=Number(a);return Number.isFinite(l)&&l>0?Math.floor(l):0}function JM(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 wv(a,l){const s=JM(a),r=s.find(g=>Number(g.index)===l)||s[l]||s[0]||{},c=yi(r.width),d=yi(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 ej(a){const l=$n(a);return Array.from({length:l},(s,r)=>wv(a,r))}function tj(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 Sv(a,l){const s=wv(a,l);if(s.width>0&&s.height>0)return{width:s.width,height:s.height};const r=Zi(a.status),c=yi(r.screenWidth||r.width),d=yi(r.screenHeight||r.height);return c>0&&d>0?{width:c,height:d}:null}function Cv(a){if(!a)return null;const l=yi(a.sourceWidth)||yi(a.width),s=yi(a.sourceHeight)||yi(a.height);return l>0&&s>0?{width:l,height:s}:null}function nj(a,l,s){const d=((typeof l?.monitorIndex=="number"?la(l.monitorIndex,Math.max(1,l.monitorCount||1)):s)===s?Cv(l):null)||Sv(a,s);return d?Math.max(.25,Math.min(4,d.width/d.height)):16/9}const uu=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 aj(){try{const a=JSON.parse(localStorage.getItem(hv)||"{}");if(![pv,14,13,12,11].includes(Number(a.version)))return qn;const l=km(a.frameMode),s=Ca(a.maxWidth,320,3840,qn.maxWidth),r=Ca(a.maxHeight,180,2160,qn.maxHeight);return{frameMode:l,h264DecodeAcceleration:Ru(a.h264DecodeAcceleration),fps:Em(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:Ca(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 lj(a){try{localStorage.setItem(hv,JSON.stringify({...a,version:pv}))}catch{}}function ij(){try{const a=JSON.parse(localStorage.getItem(gv)||"{}"),l=Number(a.version);if(![jm,5,4,3,2,1].includes(l))return Gn;const s=Ca(a.fps,20,60,Gn.fps),r=l<jm;return{frameMode:r?Gn.frameMode:Tm(a.frameMode),h264DecodeAcceleration:r?Gn.h264DecodeAcceleration:Ru(a.h264DecodeAcceleration),fps:r?Gn.fps:s,maxWidth:Ca(a.maxWidth,1280,3840,Gn.maxWidth),maxHeight:Ca(a.maxHeight,720,2160,Gn.maxHeight),quality:Ca(a.quality,20,95,Gn.quality),showScreenStatus:typeof a.showScreenStatus=="boolean"?a.showScreenStatus:Gn.showScreenStatus}}catch{return Gn}}function sj(a){try{localStorage.setItem(gv,JSON.stringify({...a,version:jm}))}catch{}}function du(a,l){return a.length!==l.length?!1:a.every((s,r)=>s===l[r])}function nm(a){return[...new Set(a.filter(Boolean))].sort()}function rj(a){return Sn.fallbackVisibleCounts[a]||Sn.fallbackVisibleCounts.large}function oj(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=oy[l]||oy.large;return{maxWidth:Math.min(a.maxWidth,r.maxWidth),maxHeight:Math.min(a.maxHeight,r.maxHeight)}}function cj(a,l=Sn.minFps){const s=[...Wm].sort((c,d)=>c-d),r=Math.max(l,Math.floor(a/2));return[...s].reverse().find(c=>c<a&&c>=l)||r}function uj(a,l){return[...Wm].sort((r,c)=>r-c).find(r=>r>a&&r<=l)||l}function vo(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 fy(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 am(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`${fy(s)} / ${fy(a)}`}function dj(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 my(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 fj(a){return a===1?"middle":a===2?"right":"left"}function hy(a,...l){for(const s of l){const r=a?.[s];if(typeof r=="string"&&r.trim())return r.trim()}return""}function po(a){const l=Number(a);return Number.isInteger(l)&&l>=1&&l<=kM?l:0}const mj={cpu:"CPU",memory:"MEM",disk:"Disk",gpu:"GPU",vram:"VRAM",npu:"NPU",temp:"Temp",network:"Net"};function hj(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=mj[c.id]||c.label;return c.value&&c.value!=="-"?`${d} ${c.value}`:d}function Uu(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=Uu(a,s),c=Number(r);if(Number.isFinite(c))return c}}function Pn(a,...l){for(const s of l){const r=Uu(a,s);if(typeof r=="string"&&r.trim())return r.trim();if(typeof r=="number"&&Number.isFinite(r))return String(r)}return""}function pj(a,...l){for(const s of l){const r=Uu(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 lm(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 im(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 Mv(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 fu(a,l,s){const r=Uu(a,`tools.${l}`),c=Pn(a,`tools.${l}.status`,`tooling.${l}.status`,`${l}.status`).toLowerCase(),d=pj(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 jv(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"))??lm(d,h),g=Dt(l,"disk.totalBytes","rootDisk.totalBytes","storage.totalBytes"),x=Dt(l,"disk.freeBytes","rootDisk.freeBytes","storage.freeBytes"),v=El(Dt(l,"disk.usedRatio","disk.usedPct","rootDisk.usedRatio","storage.usedRatio"))??lm(g,x),y=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")),C=Pn(l,"gpu.name","gpu.model","accelerators.gpu.name"),j=Dt(l,"gpu.memory.totalBytes","gpu.totalMemoryBytes","gpu.vramTotalBytes"),M=Dt(l,"gpu.memory.freeBytes","gpu.freeMemoryBytes","gpu.vramFreeBytes"),T=El(Dt(l,"gpu.memory.usedRatio","gpu.vramUsedRatio"))??lm(j,M),k=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"),D=Dt(l,"network.rxMbps","network.receiveMbps","network.downMbps"),$=Dt(l,"network.txMbps","network.transmitMbps","network.upMbps"),E=Dt(l,"network.latencyMs","network.rttMs"),ee=El(Dt(l,"network.usedRatio","network.usageRatio","network.saturationRatio")),de=Pn(l,"network.link","network.interface","network.name"),V=y===void 0?void 0:El((y-35)/60),J=Pn(l,"workload.role","role","lane")||(jo(a,"aiAssist")?"Agent worker":jo(a,"taskDispatch")?"Task worker":"Local machine"),B=Pn(a.latestTask,"status")||Pn(l,"workload.status")||"idle",ie=Pn(a.latestTask,"title","instructionPreview")||Pn(l,"workload.title"),K=Pn(a.latestTask,"resultSummary","error","instructionPreview")||Pn(l,"workload.summary"),fe=[fu(l,"ollama","Ollama"),fu(l,"lmStudio","LM Studio"),fu(l,"comfyui","ComfyUI"),fu(l,"stableDiffusion","Stable Diffusion")],I=fe.some(_=>_.status!=="unknown"),Z=Date.parse(a.lastSeenAt||a.connectedAt||""),ne=Number.isFinite(Z)?Date.now()-Z:0;let O="online";a.connected?ne>5*6e4?O="stale":(y??0)>=86||(k??0)>=88||(c??0)>=.94||(w??0)>=.96||(T??0)>=.96||(A??0)>=.96||(p??0)>=.94||(v??0)>=.94||(E??0)>=200||B==="failed"?O="critical":(y??0)>=78||(k??0)>=80||(c??0)>=.82||(w??0)>=.86||(T??0)>=.88||(A??0)>=.86||(p??0)>=.82||(v??0)>=.86||(E??0)>=80?O="warn":(["queued","running","targeted"].includes(B)||fe.some(_=>_.status==="busy"))&&(O="busy"):O="offline";const le=fe.filter(_=>_.status==="online"||_.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:am(d,h),ratio:p,state:Yi(p,.92,.78)},{id:"disk",label:"DISK",value:Zs(v),detail:am(g,x),ratio:v,state:Yi(v,.92,.82)},{id:"gpu",label:"GPU",value:Zs(w),detail:C||(j&&M!==void 0?`${vo(M)} VRAM free`:k!==void 0?`${Math.round(k)}C`:"not reported"),ratio:w,state:k!==void 0&&k>=88?"critical":k!==void 0&&k>=80?"warn":Yi(w,.96,.86)},{id:"vram",label:"VRAM",value:Zs(T),detail:am(j,M),ratio:T,state:Yi(T,.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:y===void 0?"-":`${Math.round(y)}C`,detail:le>0?`${le} local tools`:`uptime ${Mv(Dt(l,"uptimeSec"))}`,ratio:V,state:y===void 0?"unknown":y>=86?"critical":y>=78?"warn":"good"},{id:"network",label:"NET",value:im(D)||(E!==void 0?`${Math.round(E)}ms`:de||"-"),detail:im($)?`${im($)} up`:de||"not reported",ratio:ee,state:E!==void 0&&E>=200?"critical":E!==void 0&&E>=80?"warn":Yi(ee,.9,.75)}];return{state:O,label:hj(O,me,B),role:J,taskLabel:ie||(B==="idle"?"idle":B),taskStatus:B,taskSummary:K,tools:I?fe:fe.map(_=>({..._,detail:"not reported"})),metrics:me}}const gj=[{id:"small",label:"Small"},{id:"medium",label:"Medium"},{id:"large",label:"Large"}],xj=[{id:"wall",label:"Wall",icon:dm,accent:"blue"},{id:"control",label:"Control",icon:gu,accent:"red"},{id:"share-files",label:"Share Files",icon:mu,accent:"green"},{id:"agents",label:"Agents",icon:go,accent:"violet"},{id:"doc",label:"Doc",icon:fm,accent:"amber"},{id:"pricing",label:"Pricing",icon:xo,accent:"green"}];function It(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=>It(l))}function bn(a){return{languageName:a.languageName,languageLabel:a.languageLabel,eyebrow:a.eyebrow,title:It(a.title),intro:It(a.intro),sections:[{title:It(a.managerTitle),body:It(a.managerBody),points:Ws(a.managerPoints)},{title:It(a.clientTitle),body:It(a.clientBody),points:Ws(a.clientPoints)},{title:It(a.syncTitle),body:It(a.syncBody),points:Ws(a.syncPoints)},{title:It(a.platformTitle),body:It(a.platformBody),points:Ws(a.platformPoints)}],sync:{title:It(a.syncTitle),body:It(a.syncBody),points:Ws(a.syncPoints)},firewall:{title:It(a.firewallTitle),body:It(a.firewallBody),points:Ws(a.firewallPoints)},commands:{title:It(a.commandsTitle),body:It(a.commandsBody),manager:It(a.managerCommandLabel),primary:It(a.clientCommandLabel),slot:It(a.slotCommandLabel),manual:It(a.manualCommandLabel)}}}const ar={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ı"})},yj=Object.entries(ar).map(([a,l])=>({id:a,label:l.languageName}));function vj(){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(ar[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(ar[r])return r}return"en"}function py({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 sm({device:a,frame:l,selected:s,controlEnabled:r,showStatus:c,monitorIndex:d,monitorCount:h,onSelect:p,onFocusDevice:g,onOpenControl:x,onCycleMonitor:v,onCanvasReady:y,sendInput:w,presentationReady:C}){const j=m.useRef(null),M=m.useRef(null),T=m.useRef(0),k=m.useRef(null),A=jv(a),L=["cpu","gpu","memory","vram"].map(O=>A.metrics.find(le=>le.id===O)).filter(O=>!!O),q=la(d,h),D=h>1,$=C??!!l,E=nj(a,l,q),ee=E>=uu?100:E/uu*100,de=E>=uu?uu/E*100:100,V={"--screen-aspect":E.toFixed(5),"--screen-content-width":`${Math.max(1,Math.min(100,ee)).toFixed(3)}%`,"--screen-content-height":`${Math.max(1,Math.min(100,de)).toFixed(3)}%`},J=m.useCallback(O=>{j.current=O,y(a.deviceId,O)},[a.deviceId,y]),B=O=>{const le=O.currentTarget.getBoundingClientRect();return{normalizedX:Math.max(0,Math.min(1,(O.clientX-le.left)/Math.max(1,le.width))),normalizedY:Math.max(0,Math.min(1,(O.clientY-le.top)/Math.max(1,le.height)))}},ie=O=>({shiftKey:O.shiftKey,ctrlKey:O.ctrlKey,altKey:O.altKey,metaKey:O.metaKey}),K=m.useCallback(()=>{k.current!==null&&(window.cancelAnimationFrame(k.current),k.current=null)},[]),fe=m.useCallback(()=>{const O=M.current;if(!O)return;M.current=null;const le=Number(O.input.normalizedX),me=Number(O.input.normalizedY);if(!Number.isFinite(le)||!Number.isFinite(me))return;w(a.deviceId,{...O.input,normalizedX:le,normalizedY:me})&&(T.current=performance.now())},[a.deviceId,w]),I=m.useCallback(()=>{k.current===null&&(k.current=window.requestAnimationFrame(()=>{k.current=null,fe()}))},[fe]);m.useEffect(()=>()=>{K(),M.current=null},[K]);const Z=(O,le)=>{if(!r)return;const me={type:le,monitorIndex:q,...B(O),button:fj(O.button),...ie(O)};if(le==="pointermove"){const _=performance.now();M.current={input:me},_-T.current>=EM&&(K(),fe()),I();return}M.current&&(K(),fe()),w(a.deviceId,me)},ne=m.useCallback(O=>{const le=document.activeElement;le instanceof HTMLElement&&O.contains(le)&&le.classList.contains("monitor-cycle-button")&&le.blur()},[]);return o.jsx("article",{className:`device-tile ${s?"selected":""} ${a.connected?"online":"offline"}`,"data-live-device-id":a.deviceId,style:V,children:o.jsxs("div",{className:`tile-screen ${$?"has-frame":"is-empty"}`,role:"button",tabIndex:r?-1:0,"aria-pressed":s,onClick:()=>{r||p()},onKeyDown:O=>{r||(O.key==="Enter"||O.key===" ")&&(O.preventDefault(),p())},onDoubleClick:O=>{O.preventDefault(),x()},onPointerLeave:O=>ne(O.currentTarget),children:[o.jsx("span",{className:`screen-content ${$?"has-frame":"is-empty"}`,children:o.jsx("canvas",{ref:J,className:`remote-canvas ${$?"has-frame":"is-empty"}`,tabIndex:r?0:-1,onPointerDown:O=>{r&&(O.preventDefault(),O.stopPropagation(),g(),O.currentTarget.focus(),O.currentTarget.setPointerCapture(O.pointerId),Z(O,"pointerdown"))},onPointerMove:O=>{r&&O.preventDefault(),Z(O,"pointermove")},onPointerUp:O=>{r&&(O.preventDefault(),O.stopPropagation(),Z(O,"pointerup"),O.currentTarget.hasPointerCapture(O.pointerId)&&O.currentTarget.releasePointerCapture(O.pointerId))},onPointerCancel:O=>{O.currentTarget.hasPointerCapture(O.pointerId)&&O.currentTarget.releasePointerCapture(O.pointerId)},onWheel:O=>{r&&(O.preventDefault(),w(a.deviceId,{type:"wheel",monitorIndex:q,...B(O),deltaX:O.deltaX,deltaY:O.deltaY,...ie(O)}))},onKeyDown:O=>{r&&(O.preventDefault(),O.stopPropagation(),w(a.deviceId,{type:"keydown",monitorIndex:q,key:O.key,code:O.code,keyCode:O.keyCode||O.which||0,location:O.location,text:O.key.length===1?O.key:"",repeat:O.repeat,...ie(O)}))},onKeyUp:O=>{r&&(O.preventDefault(),O.stopPropagation(),w(a.deviceId,{type:"keyup",monitorIndex:q,key:O.key,code:O.code,keyCode:O.keyCode||O.which||0,location:O.location,text:O.key.length===1?O.key:"",repeat:!1,...ie(O)}))},onContextMenu:O=>r&&O.preventDefault()})}),!$&&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=>o.jsxs("span",{className:`tile-metric state-${O.state}`,children:[o.jsx("b",{children:O.label}),o.jsx("em",{children:O.value}),O.ratio!==void 0&&o.jsx("i",{style:{width:`${Math.round(O.ratio*100)}%`}})]},O.id))})]}),D&&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:O=>{O.preventDefault(),O.stopPropagation(),v(-1),O.currentTarget.blur()},title:"Previous display",type:"button",children:o.jsx(yy,{size:18})}),o.jsxs("span",{className:"monitor-cycle-count",children:["Screen ",q+1,"/",h]}),o.jsx("button",{className:"monitor-cycle-button next",onClick:O=>{O.preventDefault(),O.stopPropagation(),v(1),O.currentTarget.blur()},title:"Next display",type:"button",children:o.jsx(Lm,{size:18})})]})]})})}function bj({visible:a}){return m.useEffect(()=>{if(!a||!Wf)return;if(!document.getElementById(Jx)){const s=document.createElement("script");s.id=Jx,s.async=!0,s.crossOrigin="anonymous",s.src=`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${encodeURIComponent(Nm)}`,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 ${Wf?"adsense-ready":"house-ad"}`,"aria-label":"Advertisement",children:[o.jsx("span",{className:"ad-label",children:"Advertisement"}),Wf?o.jsx("ins",{className:"adsbygoogle livedesk-ad-unit",style:{display:"block"},"data-ad-client":Nm,"data-ad-slot":xv,"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 wj(){const a=IM(),{session:l,loading:s}=o0(),{target:r,error:c,refresh:d}=u0(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(()=>mx(h),[h]),g=m.useMemo(()=>p.length>0?[...new Set([...p,mn])]:[mn],[p]),[x,v]=m.useState(WM),y=m.useMemo(()=>g.some(S=>!!So(S)),[g]),w=!y||x,{status:C,devices:j,error:M,refresh:T,hubBaseUrl:k}=c0(g,w),{entitlement:A,licensed:L,loading:q,error:D,refresh:$}=d0(l),[E,ee]=m.useState([]),[de,V]=m.useState([]),[J,B]=m.useState(""),[ie,K]=m.useState(""),[fe,I]=m.useState(!1),[Z,ne]=m.useState(!1),[O,le]=m.useState(""),[me,_]=m.useState(""),[ge,be]=m.useState("wall"),[Ce,Ie]=m.useState("large"),[Ve,Le]=m.useState(vj),[Ee,qe]=m.useState(!1),[Te,gt]=m.useState(!1),[re,ye]=m.useState(!1),[ke,De]=m.useState(ZM),[oe,et]=m.useState(aj),[Me,Ft]=m.useState(ij),[Rt,xe]=m.useState({}),[He,ze]=m.useState([]),[lt,Cn]=m.useState(oe.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,sr]=m.useState({}),[Wi,Ha]=m.useState(!1),sa=m.useRef(null),pn=m.useRef(new Map),kn=m.useRef(new Map),Tn=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),[P,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),Ct=m.useRef(null),il=m.useRef(!1),ka=m.useRef(!1),qt=m.useRef(0),kt=m.useRef(0),ca=m.useRef(0),Ta=ge==="settings",zl=ge==="pricing",_o=ge==="doc",Ia=ge==="share-files",Si=ge==="agents",ua=!Ta&&!zl&&!_o&&!Ia&&!Si,Oe=ge==="control",mt=oe.frameMode==="mode4-h264-atlas",rr=Me.frameMode==="mode5-lzo-delta"?Math.min(30,Me.fps):Me.fps,da=Me.frameMode==="mode5-lzo-delta"?{maxWidth:Math.min(1920,Me.maxWidth),maxHeight:Math.min(1080,Me.maxHeight)}:{maxWidth:Me.maxWidth,maxHeight:Me.maxHeight};m.useEffect(()=>{if(C?.started){if(!l?.access_token){ct("/api/remote/license",{method:"DELETE"},k).catch(()=>{});return}ct("/api/remote/license/sync",{method:"POST",headers:{Authorization:`Bearer ${l.access_token}`}},k).catch(S=>{console.warn("[LiveDesk] Hub license sync failed",S)})}},[A?.updated_at,k,l?.access_token,C?.started]);const We=m.useMemo(()=>j.filter(S=>S.connected),[j]),Ci=Se==="all"?We.length:dt.filter(S=>We.some(R=>R.deviceId===S)).length,$u=m.useMemo(()=>We.reduce((S,R)=>Math.max(S,po(R.slotNumber)),0),[We]),Tt=Math.max(AM,We.length,$u),sl=m.useMemo(()=>{const S=Array(Tt).fill(null),R=[];for(const Y of We){const F=po(Y.slotNumber);F>0&&F<=Tt&&!S[F-1]?S[F-1]=Y:R.push(Y)}for(const Y of R){const F=S.findIndex(U=>!U);F<0?S.push(Y):S[F]=Y}return S},[We,Tt]),Ji=m.useMemo(()=>We.map(S=>S.deviceId),[We]),_l=m.useMemo(()=>new Set(E),[E]),Xn=m.useMemo(()=>new Set(de),[de]),fa=m.useMemo(()=>We.filter(S=>_l.has(S.deviceId)||Xn.has(po(S.slotNumber))),[We,_l,Xn]),or=m.useMemo(()=>j.find(S=>S.deviceId===J)||fa[0]||null,[j,J,fa]),Ln=m.useMemo(()=>j.find(S=>S.deviceId===ie)||null,[ie,j]),Oo=Ln?la(Rt[Ln.deviceId],$n(Ln)):0,we=Oe?Ln:or,cr=m.useMemo(()=>new Set(dt),[dt]),ur=m.useMemo(()=>Se==="all"?We.map(S=>S.deviceId):We.filter(S=>cr.has(S.deviceId)).map(S=>S.deviceId),[We,cr,Se]),ma=m.useMemo(()=>we?jv(we):null,[we]),qu=we?jo(we,"control"):!1,Ol=we?jo(we,"audio")||jo(we,"remoteAudio"):!1,tt=L?A?.plan==="pro"?"pro":"ltd":"free",es=Tl[tt],ts=es.limit,Bl=tt==="free"&&We.length<=Js,St=We.length<=ts,rl=tt==="ltd"?`Plus includes up to ${yo} workstations. Upgrade to Pro for commercial use and larger walls.`:`Free includes up to ${Js} workstations. Upgrade to Plus for ${yo} devices and no ads.`,dr=tt==="free",fr=St&&!!we,zn=St&&!!we&&qu,ha=St&&!!we&&Ol,Hl=m.useMemo(()=>sl.filter(S=>!!S?.connected).slice(0,rj(Ce)).map(S=>S.deviceId),[sl,Ce]),pa=m.useMemo(()=>mt?Ji:oe.visibleOnlyLive?He.length>0?He:Hl:Ji,[Hl,mt,He,oe.visibleOnlyLive,Ji]),Et=m.useMemo(()=>St?nm(pa):[],[St,pa]),Fa=m.useMemo(()=>St&&Oe&&we?[we.deviceId]:[],[St,we,Oe]),ns=m.useMemo(()=>nm([...Et,...Fa]),[Fa,Et]),xn=m.useMemo(()=>oj(oe,Ce),[oe,Ce]),as=m.useCallback((S,R)=>{const Y=it.current.get(S);if(Y&&Y!==R&&Ff(Y),R){it.current.set(S,R);return}it.current.delete(S)},[]),ls=m.useCallback((S,R)=>{const Y=Nn.current.get(S);if(Y&&Y!==R&&Ff(Y),R){Nn.current.set(S,R);return}Nn.current.delete(S)},[]),Mi=m.useCallback((S,R,Y)=>{const F=performance.now(),U=Xa(S,Y.deviceId);let ae=Y;if(S==="control"&&Y.visualChanged){const je=g0(Y.deviceId),Je=ll.current.get(Y.deviceId)||0,Fe=je?F-je.sentAt:Number.POSITIVE_INFINITY;je&&je.inputSeq>Je&&Fe<=ey&&(ae={...Y,inputFeedbackSeq:je.inputSeq,inputFeedbackMs:Math.max(0,Fe),inputFeedbackAt:F},ll.current.set(Y.deviceId,je.inputSeq))}kn.current.set(U,F);const pe=Qn.current.get(U)||{totalFrames:0,totalChangedFrames:0,sampleFrames:0,sampleChangedFrames:0,sampleStartedAt:F,intervalCount:0,intervalSumMs:0,minIntervalMs:Number.POSITIVE_INFINITY,maxIntervalMs:0,intervalSamplesMs:[],seqGapCount:0,maxSeqGap:0,sampleDecoderInputBase:0,sampleDecoderOutputBase:0};S==="control"&&ae.inputFeedbackMs===void 0&&pe.lastInfo?.inputFeedbackMs!==void 0&&pe.lastInfo.inputFeedbackAt!==void 0&&F-pe.lastInfo.inputFeedbackAt<=ey&&(ae={...ae,inputFeedbackSeq:pe.lastInfo.inputFeedbackSeq,inputFeedbackMs:pe.lastInfo.inputFeedbackMs,inputFeedbackAt:pe.lastInfo.inputFeedbackAt}),pe.totalFrames+=1,pe.sampleFrames+=1,ly(pe,F,ae.frameSeq),ae.visualChanged&&(pe.totalChangedFrames+=1,pe.sampleChangedFrames+=1),pe.lastInfo=ae,Qn.current.set(U,pe)},[]),Kt=m.useCallback((S,R)=>{Mi("wall",S,R)},[Mi]),Ua=m.useCallback((S,R)=>{Mi("control",S,R);const Y=sa.current;!Y||!HM(Y,S)||Ha(!0)},[Mi]);m.useEffect(()=>{const S=window.setInterval(()=>{const R=performance.now(),Y={};for(const[F,U]of Qn.current.entries()){const ae=Math.max(1,R-U.sampleStartedAt);Y[F]={totalFrames:U.totalFrames,totalChangedFrames:U.totalChangedFrames,framesPerSecond:U.sampleFrames*1e3/ae,changedFramesPerSecond:U.sampleChangedFrames*1e3/ae,averageIntervalMs:U.intervalCount>0?U.intervalSumMs/U.intervalCount:0,minIntervalMs:Number.isFinite(U.minIntervalMs)?U.minIntervalMs:0,maxIntervalMs:U.maxIntervalMs,p95IntervalMs:bu(U.intervalSamplesMs,.95),intervalCount:U.intervalCount,seqGapCount:U.seqGapCount,maxSeqGap:U.maxSeqGap,decoderInputFps:Math.max(0,(Number(U.lastInfo?.decoderInputCount||0)-U.sampleDecoderInputBase)*1e3/ae),decoderOutputFps:Math.max(0,(Number(U.lastInfo?.decoderOutputCount||0)-U.sampleDecoderOutputBase)*1e3/ae),sampleMs:ae,lastInfo:U.lastInfo},U.sampleDecoderInputBase=Number(U.lastInfo?.decoderInputCount||0),U.sampleDecoderOutputBase=Number(U.lastInfo?.decoderOutputCount||0),U.sampleChangedFrames=0,ay(U,R)}hn(Y)},1e3);return()=>window.clearInterval(S)},[]);const Ea=m.useCallback((S,R)=>{const Y=performance.now(),F=Xa(S,R.deviceId);pn.current.set(F,Y),En.current.delete(F);const U=Ot.current.get(F)||{totalFrames:0,sampleFrames:0,sampleStartedAt:Y,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(U.totalFrames+=1,U.sampleFrames+=1,U.sampleBytes+=Math.max(0,Number(R.byteLength||0)),String(R.frameMode||R.mode||R.codec||R.mimeType||"").toLowerCase().includes("h264")){U.sampleH264Frames+=1,Number(R.byteLength||0)<=_M&&(U.sampleTinyFrames+=1);const Je=String(R.contentHash||"");Je&&U.lastContentHash===Je&&(U.sampleRepeatedFrames+=1),U.lastContentHash=Je}const je=Number(R.agentSendGapMs||0);je>0&&je<1e3&&Zm(U.sourceSendIntervalsMs,je),U.lastFrame=R,ly(U,Y,R.frameSeq),Ot.current.set(F,U)},[]);m.useEffect(()=>{const S=window.setInterval(()=>{const R=performance.now(),Y={};for(const[F,U]of Ot.current.entries()){const ae=Math.max(1,R-U.sampleStartedAt);Y[F]={totalFrames:U.totalFrames,framesPerSecond:U.sampleFrames*1e3/ae,averageIntervalMs:U.intervalCount>0?U.intervalSumMs/U.intervalCount:0,minIntervalMs:Number.isFinite(U.minIntervalMs)?U.minIntervalMs:0,maxIntervalMs:U.maxIntervalMs,p95IntervalMs:bu(U.intervalSamplesMs,.95),intervalCount:U.intervalCount,seqGapCount:U.seqGapCount,maxSeqGap:U.maxSeqGap,averageFrameBytes:U.sampleFrames>0?U.sampleBytes/U.sampleFrames:0,tinyFrameRatio:U.sampleH264Frames>0?U.sampleTinyFrames/U.sampleH264Frames:0,repeatedFrameRatio:U.sampleH264Frames>0?U.sampleRepeatedFrames/U.sampleH264Frames:0,sourceSendAverageMs:U.sourceSendIntervalsMs.length>0?U.sourceSendIntervalsMs.reduce((pe,je)=>pe+je,0)/U.sourceSendIntervalsMs.length:0,sourceSendP95Ms:bu(U.sourceSendIntervalsMs,.95),sourceSendSampleCount:U.sourceSendIntervalsMs.length,sampleMs:ae,lastFrame:U.lastFrame},U.sampleBytes=0,U.sampleH264Frames=0,U.sampleTinyFrames=0,U.sampleRepeatedFrames=0,U.sourceSendIntervalsMs.length=0,ay(U,R)}sr(Y)},1e3);return()=>window.clearInterval(S)},[]);const Il=m.useCallback(S=>{Ea("wall",S);const R=it.current.get(S.deviceId);R&&Uf(R,S,()=>it.current.get(S.deviceId)!==R,Kt,oe.h264DecodeAcceleration).catch(()=>{})},[Kt,Ea,oe.h264DecodeAcceleration]),Bo=m.useCallback(S=>{Ea("control",S);const R=Nn.current.get(S.deviceId);R&&Uf(R,S,()=>Nn.current.get(S.deviceId)!==R,Ua,Me.h264DecodeAcceleration,"interactive").catch(()=>{})},[Me.h264DecodeAcceleration,Ua,Ea]),mr=m.useCallback(S=>{const R=ja.current;R&&R!==S&&Ff(R),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,R=An.current;if(!(!S||!R||S.width<=0||S.height<=0||el.current!==R.layoutVersion))for(const Y of R.tiles){const F=Na.current.get(Y.deviceId);if(!F||Y.width<=0||Y.height<=0)continue;const U=Math.max(1,Math.round(Y.width)),ae=Math.max(1,Math.round(Y.height)),pe=OM,je=BM;(F.width!==pe||F.height!==je)&&(F.width=pe,F.height=je);const Je=F.getContext("2d",{alpha:!1});if(Je){Je.imageSmoothingEnabled=!0,Je.imageSmoothingQuality="high";try{Je.drawImage(S,Math.round(Y.x),Math.round(Y.y),U,ae,0,0,pe,je)}catch{}}}},[]),ji=m.useCallback((S,R)=>{if(R){Na.current.set(S,R),window.requestAnimationFrame($a);return}Na.current.delete(S)},[$a]),Ni=m.useCallback((S,R)=>{nl.current=performance.now(),el.current=Number(S.layoutVersion||0),$a();const Y=An.current?.tiles||[],F=Y.length>0?Math.round(S.byteLength/Y.length):S.byteLength;for(const U of Y){const ae={...S,deviceId:U.deviceId,width:U.width,height:U.height,sourceWidth:U.width,sourceHeight:U.height,byteLength:F};Kt(ae,{...R,deviceId:U.deviceId,width:U.width,height:U.height,byteLength:F})}},[Kt,$a]),Ho=m.useCallback(S=>{const R=performance.now();Aa.current<=0&&(Aa.current=R),oa.current=R;const Y=ja.current;if(!Y)return;const F=An.current?.tiles||[],U=F.length>0?Math.round(S.byteLength/F.length):S.byteLength;for(const ae of F)Ea("wall",{...S,deviceId:ae.deviceId,width:ae.width,height:ae.height,sourceWidth:ae.width,sourceHeight:ae.height,byteLength:U});Uf(Y,S,()=>ja.current!==Y,Ni).catch(()=>{})},[Ni,Ea]),Gu=m.useMemo(()=>({fps:lt,maxWidth:xn.maxWidth,maxHeight:xn.maxHeight,quality:oe.quality,mode:oe.frameMode,frameMode:oe.frameMode,streamPurpose:"wall",monitorSelections:Rt,onFrame:Il}),[lt,Il,xn,Rt,oe]),Pu=m.useMemo(()=>({fps:rr,maxWidth:da.maxWidth,maxHeight:da.maxHeight,quality:Me.quality,mode:Me.frameMode,frameMode:Me.frameMode,streamPurpose:"control",monitorSelections:Rt,onFrame:Bo}),[Me.frameMode,Me.quality,Bo,rr,da.maxHeight,da.maxWidth,Rt]),{frames:Io,state:ol,stats:qa,restartLive:is}=xx(mt?[]:Et,!mt&&oe.autoStartLive&&Et.length>0,k,Gu),{frame:Fl,layout:cl,state:hr,stats:Fo,refreshInputs:Uo}=x0(pa,mt&&oe.autoStartLive&&pa.length>0,k,{fps:20,width:1920,height:1080,tileWidth:xn.maxWidth,tileHeight:xn.maxHeight,monitorSelections:Rt,onFrame:Ho});m.useEffect(()=>{An.current=cl,cl&&window.requestAnimationFrame($a)},[cl,$a]),m.useEffect(()=>{if(!mt||hr!=="open"){Aa.current=0,oa.current=0,nl.current=0;return}const S=window.setInterval(()=>{const R=ja.current,Y=performance.now();if(!R||document.visibilityState!=="visible"||Y-Tn.current<Jf)return;const F=oa.current,U=Aa.current;if(F<=0||U<=0||Y-F>500)return;const ae=nl.current||U,pe=Y-ae;if(pe>=RM&&Y-Kn.current>=zM){fx(R)&&(Kn.current=Y,al.current=Y);return}pe>=DM&&Y-al.current>=LM&&Xw(R)&&(al.current=Y)},250);return()=>window.clearInterval(S)},[hr,mt]);const{frames:pr,state:gr,error:$o,stats:xr,restartLive:ss}=xx(Fa,Fa.length>0,k,Pu),rs=m.useMemo(()=>{const S=new Map(Io);if(mt&&Fl){const R=new Map((cl?.tiles||[]).map(F=>[F.deviceId,F])),Y=Math.max(1,R.size);for(const F of pa){const U=R.get(F);S.set(F,{...Fl,deviceId:F,width:U?.width||xn.maxWidth,height:U?.height||xn.maxHeight,sourceWidth:U?.width||xn.maxWidth,sourceHeight:U?.height||xn.maxHeight,byteLength:Math.round(Fl.byteLength/Y)})}}for(const[R,Y]of pr.entries())S.set(R,Y);return S},[Fl,cl,pr,xn,mt,Io,pa]),yr=Oe&&Fa.length>0?gr:mt?hr:ol,os=Oe&&Fa.length>0?xr:mt?Fo:qa;m.useCallback((S,R="browser-stale")=>{const Y=is(S,R),F=ss(S,R);return Y||F},[ss,is]),m.useEffect(()=>{mt&&!Oe&&Uo()},[mt,Uo,Oe]);const cs=m.useCallback((S,R,Y)=>{const F=R==="control"?Nn.current.get(S)||null:it.current.get(S)||null;if(!F||!fx(F))return!1;const U=performance.now();return Ll.current.set(Xa(R,S),U),!0},[]);m.useEffect(()=>{Ha(!1);const S=Oe?Ln:null;if(S){sa.current={deviceId:S.deviceId,monitorIndex:Oo,frameMode:Me.frameMode,startedAtEpochMs:Date.now()};const R=Xa("control",ie);tl.current.set(R,performance.now()),pn.current.delete(R),kn.current.delete(R),En.current.delete(R);return}sa.current=null},[Ln?.sessionId,ie,Me.frameMode,Oo,Oe]);const{state:us,sendInput:Ai,stats:ga}=y0(zn&&fe,k),{state:qo,error:Go}=w0(we?.deviceId||"",ha&&Z,k);m.useEffect(()=>{if(!Oe||!fe||!zn||!we)return;const S=(F,U)=>{const ae=F.target,pe=ae?.tagName?.toLowerCase();ae?.isContentEditable||pe==="input"||pe==="textarea"||pe==="select"||(F.preventDefault(),F.stopPropagation(),Ai(we.deviceId,{type:U,monitorIndex:la(Rt[we.deviceId],$n(we)),key:F.key,code:F.code,keyCode:F.keyCode||F.which||0,location:F.location,text:F.key.length===1?F.key:"",repeat:U==="keydown"?F.repeat:!1,shiftKey:F.shiftKey,ctrlKey:F.ctrlKey,altKey:F.altKey,metaKey:F.metaKey}))},R=F=>S(F,"keydown"),Y=F=>S(F,"keyup");return window.addEventListener("keydown",R),window.addEventListener("keyup",Y),()=>{window.removeEventListener("keydown",R),window.removeEventListener("keyup",Y)}},[zn,fe,Rt,we,Ai,Oe]),m.useEffect(()=>{const S=()=>{document.visibilityState==="visible"&&(Tn.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||gr!=="open")return;const S=we.deviceId,R=Xa("control",S),Y=window.setInterval(()=>{const F=performance.now();if(document.visibilityState!=="visible"||F-Tn.current<Jf)return;const U=pn.current.get(R)||0,ae=kn.current.get(R)||0,pe=ra.current.get(R)||0,je=tl.current.get(R)||F;tl.current.has(R)||tl.current.set(R,je);const Je=U<=0,Fe=Je?F-je>qM:F-U>cy,Nt=U>0&&(ae<=0||F-ae>cy);if(!Fe&&Nt){const on=Ll.current.get(R)||0;F-on>=uy&&cs(S,"control","decoder-paint-stale");return}if(!Fe)return;const rn=En.current.get(R)||0;if(F-pe<dy(GM,rn))return;ss([S],Je?"control-first-frame-timeout":"control-receive-stale")&&(ra.current.set(R,F),tl.current.set(R,F),En.current.set(R,rn+1))},650);return()=>window.clearInterval(Y)},[gr,cs,ss,we,Oe]),m.useEffect(()=>{if(mt||ol!=="open"||!oe.autoStartLive||Et.length===0)return;const S=window.setInterval(()=>{const R=performance.now();if(document.visibilityState!=="visible"||R-Tn.current<Jf)return;const Y=1e3/Math.max(1,lt||oe.fps||1),F=Math.max(PM,Math.ceil(Y*4)),U=[];for(const ae of Et){if(U.length>=QM)break;const pe=Xa("wall",ae),je=pn.current.get(pe)||0;if(je<=0)continue;const Je=ra.current.get(pe)||0,Fe=kn.current.get(pe)||0,Nt=R-je>F,rn=Fe<=0||R-Fe>F;if(!Nt&&rn){const on=Ll.current.get(pe)||0;R-on>=uy&&cs(ae,"wall","decoder-paint-stale");continue}if(!Nt)continue;const Mn=En.current.get(pe)||0;R-Je>=dy(YM,Mn)&&U.push(ae)}if(U.length>0&&is(U,"wall-frame-stale"))for(const ae of U){const pe=Xa("wall",ae);ra.current.set(pe,R),En.current.set(pe,(En.current.get(pe)||0)+1)}},VM);return()=>window.clearInterval(S)},[lt,mt,cs,is,oe.autoStartLive,oe.fps,Et,ol]),m.useEffect(()=>{Cn(oe.fps),kt.current=Date.now(),ca.current=0},[oe.fps,oe.frameMode,oe.adaptiveLoadShedding]),m.useEffect(()=>{Uw({h264DecodeAcceleration:oe.h264DecodeAcceleration})},[oe.h264DecodeAcceleration]),m.useEffect(()=>{if(!St||Oe||!oe.visibleOnlyLive){ze([]);return}const S=Jt.current;if(!S||typeof IntersectionObserver>"u"){ze(Hl);return}const R=Array.from(S.querySelectorAll("[data-live-device-id]"));if(R.length===0){ze([]);return}const Y=new Map,F=()=>{const ae=nm(R.map(pe=>String(pe.dataset.liveDeviceId||"")).filter(pe=>(Y.get(pe)||0)>0));ze(pe=>du(pe,ae)?pe:ae)},U=new IntersectionObserver(ae=>{for(const pe of ae){const je=String(pe.target.dataset.liveDeviceId||"");je&&Y.set(je,pe.isIntersecting?pe.intersectionRatio||.01:0)}F()},{root:null,rootMargin:Sn.visibleRootMargin,threshold:[0,.01,.2,.6,1]});return R.forEach(ae=>U.observe(ae)),F(),()=>U.disconnect()},[Hl,St,Oe,sl,oe.visibleOnlyLive,Ce]),m.useEffect(()=>{if(mt||!oe.adaptiveLoadShedding||!oe.autoStartLive||Et.length===0)return;const S=oe.fps;if(Et.length<=Sn.preserveConfiguredFpsDeviceCount){lt!==S&&(Cn(S),kt.current=Date.now(),ca.current=0);return}if(ol!=="open"||qa.sampleMs<500)return;const R=Date.now(),Y=Et.length*lt,F=qa.framesPerSecond,U=qa.bytesPerSecond,ae=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=Y>8&&F>0&&F<Y*.72;if(F>Sn.maxWallFramesPerSecond||U>Sn.maxWallBytesPerSecond||ae>Sn.maxFrameGapMs||pe>Sn.maxFrameGapMs||je){ca.current=0;const Nt=Sn.minFps;if(R-kt.current>=Sn.downshiftCooldownMs&&lt>Nt){const rn=Math.max(Nt,cj(lt,Nt));rn<lt&&(Cn(rn),kt.current=R)}return}const Fe=F<Sn.maxWallFramesPerSecond*Sn.lowLoadFrameRatio&&U<Sn.maxWallBytesPerSecond*Sn.lowLoadByteRatio;if(!Fe||lt>=S){Fe||(ca.current=0);return}if(!ca.current){ca.current=R;return}if(R-ca.current>=Sn.recoveryCooldownMs){const Nt=Math.min(S,uj(lt,S));Nt>lt&&(Cn(Nt),kt.current=R,ca.current=0)}},[lt,mt,ut,Rl,Et.length,Et,ol,qa.bytesPerSecond,qa.framesPerSecond,qa.lastUpdatedAt,qa.sampleMs,oe.adaptiveLoadShedding,oe.autoStartLive,oe.frameMode,oe.fps]),m.useEffect(()=>{const S=new URLSearchParams(window.location.search).get("checkout");if(S==="success"){_("Checkout returned. Waiting for Dodo confirmation."),$();const R=window.setInterval(()=>{$()},4e3),Y=window.setTimeout(()=>{window.clearInterval(R)},45e3);return()=>{window.clearInterval(R),window.clearTimeout(Y)}}S==="cancelled"&&_("Checkout cancelled.")},[$]),m.useEffect(()=>{!St&&fe&&I(!1),!St&&Z&&ne(!1)},[Z,fe,St]),m.useEffect(()=>{ne(!1)},[we?.deviceId]),m.useEffect(()=>{const S=We.map(F=>F.deviceId),R=new Set(S),Y=new Map(We.map(F=>[F.deviceId,F]));ee(F=>{const U=F.filter(ae=>R.has(ae));return du(F,U)?F:U}),B(F=>F&&R.has(F)?F:""),K(F=>F&&R.has(F)?F:""),V(F=>{const U=F.filter(ae=>ae>=1&&ae<=Tt);return du(F.map(String),U.map(String))?F:U}),xe(F=>{let U=!1;const ae={};for(const[pe,je]of Object.entries(F)){if(!R.has(pe)){U=!0;continue}const Je=Y.get(pe),Fe=la(je,Je?$n(Je):1);ae[pe]=Fe,Fe!==je&&(U=!0)}return U?ae:F}),ft(F=>{const U=F.filter(ae=>R.has(ae));return du(F,U)?F:U})},[We,Tt]),m.useEffect(()=>{he([]),Ut(!1)},[]),m.useEffect(()=>{!Ia||Se!=="selected"||dt.length>0||fa.length===0||ft(fa.map(S=>S.deviceId))},[fa,dt.length,Se,Ia]),m.useEffect(()=>{try{localStorage.setItem(mv,ke)}catch{}},[ke]),m.useEffect(()=>{lj(oe)},[oe]),m.useEffect(()=>{sj(Me)},[Me]);const vr=m.useCallback(async()=>{const S=new Set(g);S.add(mn);try{const ae=await ct("/api/remote/status",void 0,mn);mx({endpoint:ae.agentEndpoint,endpoint_candidates:[...ae.agentEndpointCandidates||[],...ae.hostTargetEndpointCandidates||[]]}).forEach(pe=>S.add(pe))}catch{}const R=[...S].sort((ae,pe)=>{const je=Je=>{const Fe=So(Je);return Fe==="local"?0:Fe==="loopback"?1:2};return je(ae)-je(pe)||ae.localeCompare(pe)});let Y=!1,F="",U=!1;try{for(const ae of R){const pe=So(ae);try{if(await ct("/api/health",void 0,ae),pe==="local")return v(!0),Xs(!0),ae;pe==="loopback"&&(Y=!0,F=ae)}catch{pe==="local"&&(U=!0)}}return Y?(U&&_("LiveDesk Hub is reachable on this PC, but not through the LAN address yet. Restart LiveDesk Hub to bind 5179 on the network."),v(!0),Xs(!0),F||mn):(v(!1),Xs(!1),"")}catch{return v(!1),Xs(!1),""}},[g]),ds=async()=>{le("auth"),gt(!1),await vr();const{error:S}=await Za.auth.signInWithOAuth({provider:"google",options:{redirectTo:window.location.origin}});S&&(_(S.message),le(""))},Yu=async()=>{le("auth"),gt(!1),await Za.auth.signOut(),le("")};m.useEffect(()=>{if(!Te)return;const S=Y=>{Y.target instanceof Element&&(Y.target.closest(".account-popover, .rail-account")||gt(!1))},R=Y=>{Y.key==="Escape"&&gt(!1)};return window.addEventListener("pointerdown",S),window.addEventListener("keydown",R),()=>{window.removeEventListener("pointerdown",S),window.removeEventListener("keydown",R)}},[Te]);const Ga=m.useCallback(async(S={})=>{const R=S.silent===!0,Y=S.takeover===!0,F=S.requestLocalAccess===!0,U=F?await vr():"";if(!l?.user){R||_("Sign in before publishing this host.");return}if(!ka.current){ka.current=!0,R||le("host");try{const ae=U||k||mn,pe=C||await ct("/api/remote/status",void 0,ae);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:Y})},ae);if(!Je.ok)throw new Error(Je.error||"host-target-failed");const Fe=await ct("/api/remote/status",void 0,ae),Nt=await ct("/api/remote/registry-credentials",void 0,ae),rn=Je.hostTarget||{},Mn=Fe.hostTargetEndpointCandidates||Fe.agentEndpointCandidates||pe.agentEndpointCandidates||[Fe.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||Fe.hostTargetLeaseId||crypto.randomUUID()),p_host_instance_id:Fe.hostInstanceId||je,p_endpoint:Fe.hostTargetEndpoint||Fe.agentEndpoint||pe.agentEndpoint,p_pair_token:Nt.pairToken||"",p_manager_package:"@livedesk/hub",p_manager_version:Fe.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:Y,p_endpoint_candidates:Mn,p_pairing_pin:Nt.pairingPin||Fe.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");R||(_("Host published."),(F||y)&&(v(!0),Xs(!0)),T()),d()}catch(ae){if(!R){const pe=ae instanceof Error?ae.message:String(ae);pe.includes("local network access")&&(v(!1),Xs(!1)),_(pe)}}finally{ka.current=!1,R||le("")}}},[k,y,T,d,vr,l,C]),ki=m.useCallback(async()=>{if(!O){le("pin");try{const R=await ct("/api/remote/pairing-pin",{method:"POST"},k||mn);if(!R.ok)throw new Error(R.error||"pin-rotation-failed");await T(),l?.user&&await Ga({silent:!0,takeover:!0}),_("New PIN published.")}catch(S){_(S instanceof Error?S.message:String(S))}finally{le("")}}},[O,k,Ga,T,l]);m.useEffect(()=>{if(!l?.user||!C?.started||M)return;const S=r?.expires_at?Date.parse(r.expires_at):Number.POSITIVE_INFINITY,R=r?.active===!0&&(!r.expires_at||!Number.isFinite(S)||S>Date.now()),Y=!!r?.host_instance_id&&!!C.hostInstanceId&&r.host_instance_id===C.hostInstanceId;if(R&&!Y)return;let F=!1;const U=()=>{if(F)return;const pe=Date.now();pe-qt.current<25e3||(qt.current=pe,Ga({silent:!0}))};U();const ae=window.setInterval(U,3e4);return()=>{F=!0,window.clearInterval(ae)}},[M,Ga,l?.user?.id,C?.agentEndpoint,C?.hostInstanceId,C?.started,r?.active,r?.expires_at,r?.host_instance_id]);const Ul=m.useCallback(S=>{S&&(B(S),ee(R=>R.includes(S)?R:[...R,S]))},[]),br=m.useCallback(S=>{if(!S)return;const R=We.find(F=>F.deviceId===S),Y=po(R?.slotNumber);B(S),Y>0&&V(F=>F.filter(U=>U!==Y)),ee(F=>F.includes(S)?F:[...F,S])},[We]),wr=m.useCallback(S=>{!Number.isInteger(S)||S<1||S>Tt||(B(""),V(R=>R.includes(S)?R.filter(Y=>Y!==S):[...R,S].sort((Y,F)=>Y-F)))},[Tt]),$l=m.useCallback(()=>{ee([]),V([]),B("")},[]),Sr=m.useCallback(()=>{ee([]),B(""),V(Array.from({length:Tt},(S,R)=>R+1))},[Tt]),fs=m.useCallback((S,R)=>{const Y=We.find(U=>U.deviceId===S);if(!Y)return;const F=$n(Y);F<=1||(xe(U=>{const pe=(la(U[S],F)+R+F)%F;return{...U,[S]:pe}}),Oe?K(S):Ul(S))},[We,Ul,Oe]);m.useEffect(()=>{const S=R=>{if(Oe&&fe&&zn)return;const Y=R.target,F=Y?.tagName?.toLowerCase();Y?.isContentEditable||F==="input"||F==="textarea"||F==="select"||((R.ctrlKey||R.metaKey)&&R.key.toLowerCase()==="a"&&(R.preventDefault(),Sr()),R.key==="Escape"&&$l())};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[zn,$l,fe,Sr,Oe]);const ul=async(S,R={})=>{if(!St){_(rl);return}const Y=R.focused||Oe;Y?K(S):Ul(S);try{const F=We.find(pe=>pe.deviceId===S),U=Y?{maxWidth:Me.maxWidth,maxHeight:Me.maxHeight}:xn,ae=la(R.monitorIndex??Rt[S],F?$n(F):1);await ct(`/api/remote/devices/${encodeURIComponent(S)}/live/start`,{method:"POST",body:JSON.stringify({fps:Y?Me.fps:lt,maxWidth:U.maxWidth,maxHeight:U.maxHeight,quality:Y?Me.quality:oe.quality,mode:Y?Me.frameMode:oe.frameMode,frameMode:Y?Me.frameMode:oe.frameMode,streamPurpose:Y?"control":"wall",monitorIndex:ae})},k),_("Live stream requested."),T()}catch(F){_(F instanceof Error?F.message:String(F))}},Vu=(S,R)=>{const Y=We.find(U=>U.deviceId===S),F=la(R,Y?$n(Y):1);xe(U=>({...U,[S]:F})),Oe?K(S):Ul(S)},Cr=async S=>{if(K(S),be("control"),!St){I(!1),_(rl);return}I(!0)},Qu=async()=>{if(!we){_("Select a workstation before playing audio.");return}if(!St){_(rl);return}if(!Ol){_("Selected workstation does not report remote audio support yet.");return}const S=!Z;ne(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})},k),_(S?"Remote audio requested.":"Remote audio stopped.")}catch(R){ne(!1),_(R instanceof Error?R.message:String(R))}},Mr=async(S,R,Y="files")=>{const F=S.filter(je=>je.file.size>=0);if(F.length===0)return{files:0,bytes:0};if(!St)throw new Error(rl);if(R.length===0)throw new Error("Select at least one connected workstation.");const U=crypto.randomUUID(),ae=F.reduce((je,Je)=>je+Je.file.size,0);let pe=0;gn({id:U,status:"reading",progress:1,message:`Preparing ${F.length} ${Y}`});try{for(let je=0;je<F.length;je+=1){const Je=F[je],Fe=Je.file,Nt=Math.max(1,Math.ceil(Fe.size/Zf));for(let rn=0;rn<Nt;rn+=1){const Mn=rn*Zf,on=Math.min(Fe.size,Mn+Zf),hl=Fe.size===0?new ArrayBuffer(0):await Fe.slice(Mn,on).arrayBuffer(),Ra=rn===Nt-1;gn({id:U,status:"sending",progress:Math.max(2,Math.min(98,Math.round(pe/Math.max(1,ae)*96))),message:`${je+1}/${F.length} ${Je.relativePath}`});const Xl=await ct("/api/remote/files/chunk",{method:"POST",body:JSON.stringify({transferId:U,deviceIds:R,remoteDirectory:ke.trim(),name:Fe.name,relativePath:Je.relativePath,size:Fe.size,type:Fe.type,lastModified:Fe.lastModified,offset:Mn,totalBytes:Fe.size,final:Ra,dataBase64:dj(hl)})},k);if(!Xl.ok||Xl.queued!==R.length)throw new Error(Xl.error||`file-chunk-not-queued-${Xl.queued}/${R.length}`);pe+=hl.byteLength,await new Promise(pl=>window.setTimeout(pl,0))}}return gn({id:U,status:"queued",progress:100,message:`Sent ${F.length} file${F.length===1?"":"s"} to ${R.length} workstation${R.length===1?"":"s"}`}),window.setTimeout(()=>{gn(je=>je?.id===U&&je.status==="queued"?null:je)},4500),{files:F.length,bytes:ae}}catch(je){throw gn({id:U,status:"failed",progress:100,message:je instanceof Error?je.message:String(je)}),je}},jr=async S=>{const R=fa.length>0?fa.map(Y=>Y.deviceId):we?[we.deviceId]:[];try{await Mr(my(S),R)}catch(Y){_(Y instanceof Error?Y.message:String(Y))}},ql=async S=>{try{await Mr(my(S),ur)}catch(R){_(R instanceof Error?R.message:String(R))}};m.useEffect(()=>{il.current=!1},[]);const Ti=S=>{S.preventDefault(),S.stopPropagation(),Rn(!1),jr(S.dataTransfer.files)},ms=async(S="ltd")=>{if(!l){_("Sign in with Google before checkout.");return}if(L&&S===tt){_("LiveDesk license is already active.");return}if(L&&tt==="pro"){_("LiveDesk Pro is already active.");return}le("checkout");try{const{data:R,error:Y}=await Za.functions.invoke("dodo-checkout",{body:{plan:S}});if(Y)throw Y;if(!R?.checkout_url)throw new Error("Checkout function did not return a checkout URL.");window.location.assign(R.checkout_url)}catch(R){_(R instanceof Error?R.message:String(R)),le("")}},Zn=KM(),Ei=XM(),Po=We.length,Di=ns.filter(S=>rs.has(S)).length,Ri=yr==="open"&&os.sampleMs>0?`${os.framesPerSecond.toFixed(1)} fps`:yr,ve=we?Oe?pr.get(we.deviceId):rs.get(we.deviceId):void 0,Li=we?la(Rt[we.deviceId],$n(we)):0,Nr=we?ej(we):[],Ku=typeof ve?.monitorIndex=="number"?la(ve.monitorIndex,Math.max(1,ve.monitorCount||1)):Li,Ar=(ve&&Ku===Li?Cv(ve):null)||(we?Sv(we,Li):null),Xu=Ar?`${Ar.width}x${Ar.height}`:"-",hs=we?Xa(Oe?"control":"wall",we.deviceId):"",rt=hs?Rl[hs]:void 0,Xt=hs?ut[hs]:void 0,Ye=Xt?.lastInfo,Yo=rt&&rt.sampleMs>0?`${rt.framesPerSecond.toFixed(1)} fps`:"waiting",Vo=rt?`#${rt.totalFrames} / ${Yo}`:"waiting",Qo=Xt&&Xt.sampleMs>0?`${Xt.framesPerSecond.toFixed(1)} fps`:"waiting",kr=Xt&&Xt.sampleMs>0?`${Xt.changedFramesPerSecond.toFixed(1)} fps`:"waiting",Zu=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",Er=Ye?.canvasPresentation||"-",Ko=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?ve?.frameMode==="mode5-lzo-delta"?`${vo(rt.averageFrameBytes)} avg / visual ${ve.deltaVisualTileCount||0} + refresh ${ve.deltaRefreshTileCount||0} / ${ve.deltaTotalTiles||0}`:`${vo(rt.averageFrameBytes)} avg / tiny ${Math.round(rt.tinyFrameRatio*100)}% / repeat ${Math.round(rt.repeatedFrameRatio*100)}%`:"waiting",Dr=rt&&rt.sourceSendSampleCount>0?`${rt.sourceSendAverageMs.toFixed(1)}ms avg / p95 ${rt.sourceSendP95Ms.toFixed(1)}ms`:"waiting",Xo=iy(rt),fl=iy(Xt),Zo=rt&&Xt?`rx ${sy(rt)} / paint ${sy(Xt)}`:"waiting",ps=ve?ve.frameMode||ve.mode||ve.codec||ve.mimeType:Oe?Me.frameMode:oe.frameMode,gs=Oe?Me.frameMode:oe.frameMode,Wu=ps!==gs?`${gs} -> ${ps}`:gs,Ju=ve?`${ve.width}x${ve.height} ${vo(ve.byteLength)}`:Oe?`${da.maxWidth}x${da.maxHeight}`:`${oe.maxWidth}x${oe.maxHeight}`,ed=ve?ve.frameMode==="mode2-lzo"?"independent":`${ve.isKeyFrame?"key":String(ve.chunkType||"delta")}`:"-",Wo=ve&&ve.monitorCount?`${(ve.monitorIndex??0)+1}/${ve.monitorCount}`:"-",Jo=ve?[`src ${Math.round(ve.sourceGapMs||0)}ms`,`gap ${Math.round(ve.agentSendGapMs||0)}ms`,`tx ${Math.round(ve.agentSendDurationMs||0)}ms`,`pace ${Math.round(ve.agentPaceMs||0)}ms`,`queue ${Math.round(ve.agentQueueBeforePaceMs||0)}ms`,`age ${Math.round(ve.agentFrameAgeMs||0)}ms`,ve.browserReceivedEpochMs&&ve.receivedAt?`hub ${Math.max(0,Math.round(ve.browserReceivedEpochMs-Date.parse(ve.receivedAt)))}ms`:"",ve.browserReceivedEpochMs&&ve.hubPacketEpochMs?`sock ${Math.max(0,Math.round(ve.browserReceivedEpochMs-ve.hubPacketEpochMs))}ms`:"",ve.droppedByAgent?`drop ${ve.droppedByAgent}`:"",ve.hubIngressDropped?`ingress-drop ${ve.hubIngressDropped}`:"",ve.hubClientDropped?`ws-drop ${ve.hubClientDropped}`:"",ve.captureStageMs?`capture ${Math.round(ve.captureStageMs)}ms`:"",ve.convertMs?`rgb565 ${Math.round(ve.convertMs)}ms`:"",ve.compressMs?`lzo ${Math.round(ve.compressMs)}ms`:"",ve.captureSourceSerial?`cap #${ve.captureSourceSerial}`:"",ve.captureSourceSkipped?`cap skip ${ve.captureSourceSkipped}`:"",ve.frameMode==="mode5-lzo-delta"?`tiles ${ve.deltaVisualTileCount||0}+${ve.deltaRefreshTileCount||0}/${ve.deltaTotalTiles||0}@${ve.deltaTileSize||0}`:"",ve.platformProfile||ve.hardwareEncoder||"-",ve.atlasComposeMs?`atlas ${ve.atlasComposeMs.toFixed(1)}ms`:"",ve.atlasPoolStarved?`pool ${ve.atlasPoolStarved}`:"",ve.atlasTileCount?`tiles ${ve.atlasReadyTiles||0}/${ve.atlasTileCount}`:"",Ye?.inputFeedbackMs!==void 0&&Ye.inputFeedbackAt!==void 0&&performance.now()-Ye.inputFeedbackAt<=ty?`feedback ${Math.round(Ye.inputFeedbackMs)}ms`:"",ve.contentHash?`enc ${ve.contentHash.slice(0,6)}`:"",Ye?.visualHash?`pix ${Ye.visualHash.slice(0,6)}`:""].filter(Boolean).join(" / "):"-",Rr=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 ${vo(ga.bufferedAmount)}`:"",ga.lastInputType||"ready"].filter(Boolean).join(" / "):us,Wn=Ye?.inputFeedbackMs!==void 0&&Ye.inputFeedbackAt!==void 0&&performance.now()-Ye.inputFeedbackAt<=ty?`${Math.round(Ye.inputFeedbackMs)}ms / input #${Ye.inputFeedbackSeq||0}`:"waiting for changed frame",xs=ve?`#${ve.frameSeq} ${ym(ve.receivedAt||ve.capturedAt)}`:"waiting",Zt=Math.max(0,os.bytesPerSecond*8/1e6),ml=Fl?.atlasReadyTiles??Di,_i=Fl?.atlasTileCount??Di,ys=ml===_i?`${_i} tiles`:`${ml}/${_i} tiles`,vs=Oe?`1 stream / ${Ri} / ${Zt.toFixed(Zt>=10?0:1)}Mbps`:mt?`1 stream / ${ys} / ${Ri} / ${Zt.toFixed(Zt>=10?0:1)}Mbps`:`${Di} screens / ${Ri} / ${Zt.toFixed(Zt>=10?0:1)}Mbps`,bs=M?"offline":C?.started?"online":"starting",xa=fa.length+de.filter(S=>!We.some(R=>po(R.slotNumber)===S)).length,ec=de.length===1?`Slot ${String(de[0]).padStart(3,"0")}`:`${de.length} slots selected`,ws=Oe?we?No(we):"No workstation":xa===0?"No workstation":xa>1?`${xa} selected`:we?No(we):ec,Lt=ar[Ve]||ar.en,Ss=Lt.sync||ar.en.sync,yn=s||q?"checking":L?tt==="pro"?"Pro LTD active":`Plus LTD ${We.length}/${yo}`:Bl?`Free ${We.length}/${Js}`:`Upgrade ${We.length}/${Js}`,Lr=tt==="pro"?"Pro active":O==="checkout"?"Opening":tt==="ltd"?"Pro $199":"Plus $79",tc=L?tt==="pro"?"Pro active":"Upgrade to Pro LTD":l?O==="checkout"?"Opening checkout":tt==="ltd"?"Buy Pro LTD":"Buy Plus LTD":O==="auth"?"Opening Google":"Sign in to buy",Cs=tt==="pro"||O==="checkout"||O==="auth"||s||q,Ya=l?.user.user_metadata,Yl=hy(Ya,"avatar_url","picture"),Vl=hy(Ya,"full_name","name")||l?.user.email||"Google",Ms=Vl.slice(0,1).toUpperCase(),nc=C?.started?"Local app ready":"Start LiveDesk",_n=r?.active?"Published":l?"Not published":"Sign in required",Ql=/^\d{6}$/.test(C?.pairingPin||"")?C?.pairingPin:"------",Kl=Su.find(S=>S.width===oe.maxWidth&&S.height===oe.maxHeight)?.id||`${oe.maxWidth}x${oe.maxHeight}`,js=oe.atlasTileSizeMode==="auto"?"auto":tm.find(S=>S.width===oe.atlasTileWidth&&S.height===oe.atlasTileHeight)?.id||"320x180",Oi=em.find(S=>S.width===Me.maxWidth&&S.height===Me.maxHeight)?.id||`${Me.maxWidth}x${Me.maxHeight}`,On=wu.find(S=>S.id===oe.frameMode)||wu[0],Mt=S=>{et(R=>{const Y=S.frameMode?km(S.frameMode):R.frameMode,F=S.frameMode!==void 0&&Y!==R.frameMode;return{...R,...S,frameMode:Y,fps:Em(S.fps??(F?vv(Y):R.fps),Y)}})},Va=S=>{const R=Su.find(Y=>Y.id===S);R&&Mt({maxWidth:R.width,maxHeight:R.height})},ya=S=>{if(S==="auto"){Mt({atlasTileSizeMode:"auto"});return}const R=tm.find(Y=>Y.id===S);!R?.width||!R?.height||Mt({atlasTileSizeMode:"fixed",atlasTileWidth:R.width,atlasTileHeight:R.height})},sn=S=>{Ft(R=>{const Y=S.frameMode?Tm(S.frameMode):R.frameMode,F=S.frameMode!==void 0&&Y!==R.frameMode,U=S.fps??(F?30:R.fps),ae=S.maxWidth??R.maxWidth,pe=S.maxHeight??R.maxHeight;return{...R,...S,frameMode:Y,fps:Ca(U,20,Y==="mode5-lzo-delta"?30:60,Y==="mode5-lzo-delta"?30:60),maxWidth:Y==="mode5-lzo-delta"?Math.min(1920,ae):ae,maxHeight:Y==="mode5-lzo-delta"?Math.min(1080,pe):pe}})},Da=S=>{const R=em.find(Y=>Y.id===S);R&&sn({maxWidth:R.width,maxHeight:R.height})},ac=S=>{if(S==="control"){const R=Ln||or;if(R&&K(R.deviceId),be(S),!St){I(!1),_(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:xj.map(S=>{const R=S.icon;return o.jsxs("button",{className:`rail-tool ${ge===S.id?"active":""} accent-${S.accent}`,onClick:()=>ac(S.id),title:S.label,type:"button",children:[o.jsx(R,{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(Rf,{size:18}),o.jsx("span",{children:"Sync Server"})]}),o.jsxs("button",{className:`rail-tool compact local-settings ${Ta?"active":""}`,onClick:()=>{be("settings"),gt(!1),I(!1),qe(!1)},title:"Settings",type:"button",children:[o.jsx(aw,{size:18}),o.jsx("span",{children:"Settings"})]}),o.jsxs("button",{className:`rail-account ${l?"signed-in":""}`,onClick:()=>{gt(S=>!S)},disabled:s||O==="auth","aria-expanded":Te,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:Ms}):o.jsx(Lf,{size:18}),o.jsx("span",{children:l?"Account":"Google"})]}),Te&&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:Ms}):o.jsx(Lf,{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:nc}),o.jsx("dt",{children:"Access"}),o.jsx("dd",{children:_n}),o.jsx("dt",{children:"Plan"}),o.jsx("dd",{children:yn}),o.jsx("dt",{children:"Ads"}),o.jsx("dd",{children:tt==="free"?"Standard banner":"Removed"})]}),l?o.jsxs("button",{className:"account-popover-action",onClick:Yu,disabled:O==="auth",type:"button",children:[o.jsx(lw,{size:16}),"Logout"]}):o.jsxs("button",{className:"account-popover-action primary",onClick:ds,disabled:O==="auth",type:"button",children:[o.jsx(Lf,{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(pu,{size:18})}),o.jsxs("div",{children:[o.jsx("h1",{children:"LiveDesk"}),o.jsx("p",{children:"Control wall for local machines"})]})]}),Ia&&!Oe&&o.jsxs("div",{className:"file-share-top-route","aria-label":"File distribution route",children:[o.jsxs("div",{children:[o.jsx(er,{size:17}),o.jsxs("span",{children:[o.jsx("small",{children:"Source"}),o.jsx("strong",{children:"LiveDesk Hub"})]})]}),o.jsx(Rm,{size:15}),o.jsx(iw,{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:[Ci," workstation",Ci===1?"":"s"]}),o.jsx("em",{children:ke.trim()||"Desktop/LiveDeskFiles"})]})]})]}),ua&&!Oe&&o.jsx("div",{className:"top-actions",children:o.jsx("div",{className:"segmented-control","aria-label":"Screen size",children:gj.map(S=>o.jsx("button",{className:Ce===S.id?"active":"",onClick:()=>Ie(S.id),type:"button",children:S.label},S.id))})})]}),_o?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(fm,{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(sw,{size:17}),Lt.languageLabel]}),o.jsx("select",{value:Ve,onChange:S=>Le(S.target.value),children:yj.map(S=>o.jsx("option",{value:S.id,children:S.label},S.id))})]})]}),o.jsx("section",{className:"doc-grid",children:Lt.sections.map((S,R)=>{const F=[Xg,go,dm,rw][R]||fm;return o.jsxs("article",{className:"doc-card",children:[o.jsx("div",{className:"doc-card-icon",children:o.jsx(F,{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(U=>o.jsx("li",{children:U},U))})]})]},S.title)})}),Ss&&o.jsxs("section",{className:"doc-sync",children:[o.jsxs("div",{className:"doc-sync-head",children:[o.jsx(Rf,{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(Zg,{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(NM,{hubUrl:k,devices:j}):Ia?o.jsx(lM,{hubUrl:k,devices:We,localFeatureAccess:St,upgradeNotice:rl,notice:me,remoteDirectory:ke,onRemoteDirectoryChange:De,targetMode:Se,selectedTargetIds:dt,onTargetModeChange:$e,onTargetToggle:S=>ft(R=>R.includes(S)?R.filter(Y=>Y!==S):[...R,S]),filePickerRef:$t,folderPickerRef:Ct,onBrowserFileImport:S=>{ql(S)},onBrowserFolderImport:S=>{ql(S)},onNotice:_,onTransferChange:S=>{if(!S){gn(null);return}const R=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:R,progress:S.progress,message:S.message}),["completed","partially-failed","failed","cancelled"].includes(S.state)&&window.setTimeout(()=>gn(Y=>Y?.id===S.id?null:Y),4500)}}):Ta?o.jsx(C0,{pin:o.jsxs(M0,{children:[(M||c||D||me)&&o.jsx("section",{className:"notice-band",children:M||c||D||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:ki,disabled:!C?.started||O==="pin",type:"button",children:[o.jsx(rm,{size:15}),O==="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:k||"-"}),o.jsx("dt",{children:"Connected workstations"}),o.jsxs("dd",{children:[Po,"/",Tt]}),o.jsx("dt",{children:"Sync access"}),o.jsx("dd",{children:C?.started?"Local app ready":"Start Hub first"}),o.jsx("dt",{children:"Plan"}),o.jsx("dd",{children:yn})]}),o.jsxs("div",{className:"settings-action-row",children:[o.jsxs("button",{className:"text-button primary",onClick:()=>Ga({takeover:!0,requestLocalAccess:!0}),disabled:!l||O==="host",type:"button",children:[o.jsx(Rf,{size:16}),"Sync access"]}),o.jsxs("button",{className:"text-button buy",onClick:()=>ms(tt==="ltd"?"pro":"ltd"),disabled:O==="checkout"||tt==="pro",type:"button",children:[o.jsx(xo,{size:16}),Lr]})]})]})]}),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:ke,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(j0,{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(dm,{size:20})]}),o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:"Frame mode"}),o.jsx("select",{value:oe.frameMode,onChange:S=>Mt({frameMode:km(S.target.value)}),children:wu.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:oe.h264DecodeAcceleration,onChange:S=>Mt({h264DecodeAcceleration:Ru(S.target.value)}),children:Am.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:oe.fps,onChange:S=>Mt({fps:Em(S.target.value,oe.frameMode)}),children:Wm.filter(S=>S<=bv(oe.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?ya(S.target.value):Va(S.target.value),children:(mt?tm:Su).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:oe.quality,onChange:S=>Mt({quality:Ca(S.target.value,20,95,qn.quality)}),children:ry.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(pu,{size:20})]}),o.jsxs("label",{className:"settings-toggle",children:[o.jsx("input",{type:"checkbox",checked:oe.autoStartLive,onChange:S=>Mt({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:oe.visibleOnlyLive,onChange:S=>Mt({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:oe.adaptiveSizeByWall,onChange:S=>Mt({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:oe.adaptiveLoadShedding,onChange:S=>Mt({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:oe.showScreenStatus,onChange:S=>Mt({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(hu,{size:15})," Reset Wall settings"]})]})]})}),control:o.jsx(N0,{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(gu,{size:20})]}),o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:"Frame mode"}),o.jsx("select",{value:Me.frameMode,onChange:S=>sn({frameMode:Tm(S.target.value)}),children:UM.map(S=>o.jsx("option",{value:S.id,children:S.label},S.id))})]}),Me.frameMode==="mode3-h264-hw"&&o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:"H.264 decode"}),o.jsx("select",{value:Me.h264DecodeAcceleration,onChange:S=>sn({h264DecodeAcceleration:Ru(S.target.value)}),children:Am.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:Me.fps,onChange:S=>sn({fps:Ca(S.target.value,20,60,Gn.fps)}),children:$M.filter(S=>Me.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:em.filter(S=>Me.frameMode==="mode3-h264-hw"||S.width<=1920).map(S=>o.jsx("option",{value:S.id,children:S.label},S.id))})]})]}),Me.frameMode==="mode3-h264-hw"&&o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:"Quality"}),o.jsx("select",{value:Me.quality,onChange:S=>sn({quality:Ca(S.target.value,20,95,Gn.quality)}),children:ry.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:Me.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:Me.frameMode==="mode5-lzo-delta"?"Mode 5 tile delta":"Mode 3 H.264"}),o.jsxs("strong",{children:[da.maxWidth,"x",da.maxHeight," / ",rr,"fps"]})]}),o.jsxs("button",{className:"settings-reset",onClick:()=>Ft(Gn),type:"button",children:[o.jsx(hu,{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(um,{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(Ao,{size:18})})]}),(D||me)&&o.jsx("section",{className:"notice-band",children:D||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,"/",FM(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:Tl.free.audience}),o.jsx("h3",{children:"Monitor your local wall"}),o.jsx("p",{children:Tl.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(ow,{size:14})," Plus"]}),o.jsx("strong",{children:"$5"})]}),o.jsx("p",{className:"pricing-plan-audience",children:Tl.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 ",yo," devices"]}),o.jsxs("li",{children:[o.jsx(Sa,{size:16})," No standard ad banner"]}),o.jsxs("li",{children:[o.jsx(Sa,{size:16})," ",Tl.ltd.yearly," or ",Tl.ltd.ltd]})]}),o.jsxs("button",{className:"pricing-plan-button",onClick:l?()=>ms("ltd"):ds,disabled:tt!=="free"||O==="checkout"||O==="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(Zg,{size:14})," Pro"]}),o.jsx("strong",{children:"$15"})]}),o.jsx("p",{className:"pricing-plan-audience",children:Tl.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})," ",Tl.pro.yearly," or ",Tl.pro.ltd]})]}),o.jsxs("button",{className:"pricing-plan-button",onClick:l?()=>ms("pro"):ds,disabled:tt==="pro"||O==="checkout"||O==="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(gu,{size:17}),o.jsx("span",{children:"Focused control"}),o.jsx("strong",{children:"Local-first"})]}),o.jsxs("div",{children:[o.jsx(Wg,{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:Cs,type:"button",children:[o.jsx(xo,{size:18}),tc]})]}):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:Ti,children:[mt&&o.jsx("canvas",{ref:mr,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&&Nr.length>1&&o.jsx("div",{className:"control-monitor-tabs","aria-label":"Select monitor",children:Nr.map(S=>o.jsxs("button",{className:S.index===Li?"active":"",onClick:()=>Vu(we.deviceId,S.index),title:tj(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(sm,{device:we,frame:ve,selected:!1,controlEnabled:zn&&fe,showStatus:Me.showScreenStatus,monitorIndex:la(Rt[we.deviceId],$n(we)),monitorCount:$n(we),onSelect:()=>{},onFocusDevice:()=>K(we.deviceId),onOpenControl:()=>Cr(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:$o?`Control stream: ${$o}`:yr==="open"?"Preparing the first control frame":"Opening the Control stream"})]})]})}):mt?o.jsx("div",{className:`screen-wall atlas-slot-wall size-${Ce}`,onClick:S=>{S.currentTarget===S.target&&$l()},children:sl.map((S,R)=>{const Y=R+1;return S?o.jsx(sm,{device:S,frame:rs.get(S.deviceId),selected:_l.has(S.deviceId)||Xn.has(Y),controlEnabled:!1,showStatus:oe.showScreenStatus,monitorIndex:la(Rt[S.deviceId],$n(S)),monitorCount:$n(S),onSelect:()=>br(S.deviceId),onFocusDevice:()=>Ul(S.deviceId),onOpenControl:()=>Cr(S.deviceId),onCycleMonitor:F=>fs(S.deviceId,F),onCanvasReady:ji,sendInput:Ai},S.deviceId):o.jsx(py,{index:R,selected:Xn.has(Y),onSelect:()=>wr(Y)},`slot-${R}`)})}):o.jsx("div",{className:`screen-wall size-${Ce}`,onClick:S=>{S.currentTarget===S.target&&$l()},children:sl.map((S,R)=>{const Y=R+1;return S?o.jsx(sm,{device:S,frame:rs.get(S.deviceId),selected:_l.has(S.deviceId)||Xn.has(Y),controlEnabled:zn&&fe&&we?.deviceId===S.deviceId,showStatus:oe.showScreenStatus,monitorIndex:la(Rt[S.deviceId],$n(S)),monitorCount:$n(S),onSelect:()=>br(S.deviceId),onFocusDevice:()=>Ul(S.deviceId),onOpenControl:()=>Cr(S.deviceId),onCycleMonitor:F=>fs(S.deviceId,F),onCanvasReady:as,sendInput:Ai},S.deviceId):o.jsx(py,{index:R,selected:Xn.has(Y),onSelect:()=>wr(Y)},`slot-${R}`)})}),o.jsx(bj,{visible:dr&&!Oe})]}),!Ta&&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(yy,{size:18}):o.jsx(Lm,{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&&jr(S.currentTarget.files),S.currentTarget.value=""}}),(M||me)&&o.jsx("div",{className:"notice-band compact",children:o.jsx("span",{children:M||me})}),o.jsxs("div",{className:"action-grid",children:[o.jsxs("button",{className:"action-tile primary",onClick:()=>we&&ul(we.deviceId),disabled:!fr,type:"button",children:[o.jsx(Jg,{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(gu,{size:21}),o.jsx("span",{children:us!=="idle"?us:"Control"})]}),o.jsxs("button",{className:`action-tile ${Z?"active":""}`,onClick:Qu,disabled:!ha,type:"button",title:Ol?"Remote PC audio":"Remote audio is not supported by this workstation yet",children:[o.jsx(Wg,{size:21}),o.jsx("span",{children:Z&&qo!=="idle"?qo:"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(hu,{size:21}),o.jsx("span",{children:"Reboot"})]}),o.jsxs("button",{className:"action-tile",disabled:!0,type:"button",title:"Power",children:[o.jsx(cw,{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(pu,{size:15}),o.jsx("span",{children:"Stream"})]}),o.jsxs("dl",{className:"facts compact",children:[o.jsx("dt",{children:"Frames"}),o.jsx("dd",{children:Vo}),o.jsx("dt",{children:Oe?"Control RX":mt?"Atlas RX":"Wall RX"}),o.jsx("dd",{children:vs}),o.jsx("dt",{children:"Painted"}),o.jsx("dd",{children:Qo}),o.jsx("dt",{children:Oe?"Encoded changes":"Visual samples"}),o.jsx("dd",{children:kr}),o.jsx("dt",{children:"Decoder"}),o.jsx("dd",{children:Zu}),o.jsx("dt",{children:"Decoder IO"}),o.jsx("dd",{children:zi}),o.jsx("dt",{children:"Canvas"}),o.jsx("dd",{children:Er}),o.jsx("dt",{children:"Control buffer"}),o.jsx("dd",{children:Ko}),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:Dr}),o.jsx("dt",{children:"Packet mix"}),o.jsx("dd",{children:Pl}),o.jsx("dt",{children:"Receive gap"}),o.jsx("dd",{children:Xo}),o.jsx("dt",{children:"Paint gap"}),o.jsx("dd",{children:fl}),o.jsx("dt",{children:"Seq gap"}),o.jsx("dd",{children:Zo}),o.jsx("dt",{children:"Selected"}),o.jsx("dd",{children:xs}),o.jsx("dt",{children:"Requested"}),o.jsx("dd",{children:Wu}),o.jsx("dt",{children:"Mode"}),o.jsx("dd",{children:ps}),o.jsx("dt",{children:"Chunk"}),o.jsx("dd",{children:ed}),o.jsx("dt",{children:"Size"}),o.jsx("dd",{children:Ju}),o.jsx("dt",{children:"Native"}),o.jsx("dd",{children:Xu}),o.jsx("dt",{children:"Monitor"}),o.jsx("dd",{children:Wo}),o.jsx("dt",{children:"Source"}),o.jsx("dd",{children:Jo}),o.jsx("dt",{children:"Input"}),o.jsx("dd",{children:Rr}),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(Mu,{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(Xg,{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:Mv(Dt(we.status,"uptimeSec"))}),o.jsx("dt",{children:"Last seen"}),o.jsx("dd",{children:ym(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||"-"})]})]}),Go&&o.jsx("p",{className:"panel-warning",children:Go}),o.jsxs("button",{className:"text-button full",onClick:()=>we&&ul(we.deviceId),disabled:!fr,type:"button",children:[o.jsx(Jg,{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(Ao,{size:18}):o.jsx(gy,{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)),"%"]})]})]})}xw.createRoot(document.getElementById("root")).render(o.jsx(m.StrictMode,{children:o.jsx(wj,{})}));