tycono 0.1.31 → 0.1.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/web/dist/assets/{index-Cu5Dju26.css → index-BUOfLjiN.css} +1 -1
- package/src/web/dist/assets/{index-D0XpW_Xh.js → index-CYBgtkj3.js} +33 -33
- package/src/web/dist/assets/{preview-app-C0mxfMCG.js → preview-app-mMmnwqgt.js} +1 -1
- package/src/web/dist/index.html +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var L2=Object.defineProperty;var $2=(t,l,r)=>l in t?L2(t,l,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[l]=r;var
|
|
1
|
+
var L2=Object.defineProperty;var $2=(t,l,r)=>l in t?L2(t,l,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[l]=r;var i1=(t,l,r)=>$2(t,typeof l!="symbol"?l+"":l,r);(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))i(c);new MutationObserver(c=>{for(const u of c)if(u.type==="childList")for(const d of u.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&i(d)}).observe(document,{childList:!0,subtree:!0});function r(c){const u={};return c.integrity&&(u.integrity=c.integrity),c.referrerPolicy&&(u.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?u.credentials="include":c.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function i(c){if(c.ep)return;c.ep=!0;const u=r(c);fetch(c.href,u)}})();function G0(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var qd={exports:{}},ms={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@ var L2=Object.defineProperty;var $2=(t,l,r)=>l in t?L2(t,l,{enumerable:!0,config
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var s1;function H2(){if(s1)return ms;s1=1;var t=Symbol.for("react.transitional.element"),l=Symbol.for("react.fragment");function r(i,c,u){var d=null;if(u!==void 0&&(d=""+u),c.key!==void 0&&(d=""+c.key),"key"in c){u={};for(var m in c)m!=="key"&&(u[m]=c[m])}else u=c;return c=u.ref,{$$typeof:t,type:i,key:d,ref:c!==void 0?c:null,props:u}}return ms.Fragment=l,ms.jsx=r,ms.jsxs=r,ms}var o1;function U2(){return o1||(o1=1,qd.exports=H2()),qd.exports}var s=U2(),Xd={exports:{}},Je={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react.production.js
|
|
12
12
|
*
|
|
@@ -14,7 +14,7 @@ var L2=Object.defineProperty;var $2=(t,l,r)=>l in t?L2(t,l,{enumerable:!0,config
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
17
|
+
*/var c1;function I2(){if(c1)return Je;c1=1;var t=Symbol.for("react.transitional.element"),l=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),d=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),b=Symbol.iterator;function v(R){return R===null||typeof R!="object"?null:(R=b&&R[b]||R["@@iterator"],typeof R=="function"?R:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,E={};function C(R,K,T){this.props=R,this.context=K,this.refs=E,this.updater=T||S}C.prototype.isReactComponent={},C.prototype.setState=function(R,K){if(typeof R!="object"&&typeof R!="function"&&R!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,R,K,"setState")},C.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function A(){}A.prototype=C.prototype;function F(R,K,T){this.props=R,this.context=K,this.refs=E,this.updater=T||S}var _=F.prototype=new A;_.constructor=F,j(_,C.prototype),_.isPureReactComponent=!0;var H=Array.isArray;function M(){}var I={H:null,A:null,T:null,S:null},W=Object.prototype.hasOwnProperty;function te(R,K,T){var fe=T.ref;return{$$typeof:t,type:R,key:K,ref:fe!==void 0?fe:null,props:T}}function D(R,K){return te(R.type,K,R.props)}function Y(R){return typeof R=="object"&&R!==null&&R.$$typeof===t}function B(R){var K={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(T){return K[T]})}var V=/\/+/g;function ne(R,K){return typeof R=="object"&&R!==null&&R.key!=null?B(""+R.key):K.toString(36)}function G(R){switch(R.status){case"fulfilled":return R.value;case"rejected":throw R.reason;default:switch(typeof R.status=="string"?R.then(M,M):(R.status="pending",R.then(function(K){R.status==="pending"&&(R.status="fulfilled",R.value=K)},function(K){R.status==="pending"&&(R.status="rejected",R.reason=K)})),R.status){case"fulfilled":return R.value;case"rejected":throw R.reason}}throw R}function L(R,K,T,fe,Ee){var Ne=typeof R;(Ne==="undefined"||Ne==="boolean")&&(R=null);var Le=!1;if(R===null)Le=!0;else switch(Ne){case"bigint":case"string":case"number":Le=!0;break;case"object":switch(R.$$typeof){case t:case l:Le=!0;break;case g:return Le=R._init,L(Le(R._payload),K,T,fe,Ee)}}if(Le)return Ee=Ee(R),Le=fe===""?"."+ne(R,0):fe,H(Ee)?(T="",Le!=null&&(T=Le.replace(V,"$&/")+"/"),L(Ee,K,T,"",function(Se){return Se})):Ee!=null&&(Y(Ee)&&(Ee=D(Ee,T+(Ee.key==null||R&&R.key===Ee.key?"":(""+Ee.key).replace(V,"$&/")+"/")+Le)),K.push(Ee)),1;Le=0;var Be=fe===""?".":fe+":";if(H(R))for(var Qe=0;Qe<R.length;Qe++)fe=R[Qe],Ne=Be+ne(fe,Qe),Le+=L(fe,K,T,Ne,Ee);else if(Qe=v(R),typeof Qe=="function")for(R=Qe.call(R),Qe=0;!(fe=R.next()).done;)fe=fe.value,Ne=Be+ne(fe,Qe++),Le+=L(fe,K,T,Ne,Ee);else if(Ne==="object"){if(typeof R.then=="function")return L(G(R),K,T,fe,Ee);throw K=String(R),Error("Objects are not valid as a React child (found: "+(K==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":K)+"). If you meant to render a collection of children, use an array instead.")}return Le}function Z(R,K,T){if(R==null)return R;var fe=[],Ee=0;return L(R,fe,"","",function(Ne){return K.call(T,Ne,Ee++)}),fe}function de(R){if(R._status===-1){var K=R._result;K=K(),K.then(function(T){(R._status===0||R._status===-1)&&(R._status=1,R._result=T)},function(T){(R._status===0||R._status===-1)&&(R._status=2,R._result=T)}),R._status===-1&&(R._status=0,R._result=K)}if(R._status===1)return R._result.default;throw R._result}var ue=typeof reportError=="function"?reportError:function(R){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var K=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof R=="object"&&R!==null&&typeof R.message=="string"?String(R.message):String(R),error:R});if(!window.dispatchEvent(K))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",R);return}console.error(R)},z={map:Z,forEach:function(R,K,T){Z(R,function(){K.apply(this,arguments)},T)},count:function(R){var K=0;return Z(R,function(){K++}),K},toArray:function(R){return Z(R,function(K){return K})||[]},only:function(R){if(!Y(R))throw Error("React.Children.only expected to receive a single React element child.");return R}};return Je.Activity=y,Je.Children=z,Je.Component=C,Je.Fragment=r,Je.Profiler=c,Je.PureComponent=F,Je.StrictMode=i,Je.Suspense=x,Je.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=I,Je.__COMPILER_RUNTIME={__proto__:null,c:function(R){return I.H.useMemoCache(R)}},Je.cache=function(R){return function(){return R.apply(null,arguments)}},Je.cacheSignal=function(){return null},Je.cloneElement=function(R,K,T){if(R==null)throw Error("The argument must be a React element, but you passed "+R+".");var fe=j({},R.props),Ee=R.key;if(K!=null)for(Ne in K.key!==void 0&&(Ee=""+K.key),K)!W.call(K,Ne)||Ne==="key"||Ne==="__self"||Ne==="__source"||Ne==="ref"&&K.ref===void 0||(fe[Ne]=K[Ne]);var Ne=arguments.length-2;if(Ne===1)fe.children=T;else if(1<Ne){for(var Le=Array(Ne),Be=0;Be<Ne;Be++)Le[Be]=arguments[Be+2];fe.children=Le}return te(R.type,Ee,fe)},Je.createContext=function(R){return R={$$typeof:d,_currentValue:R,_currentValue2:R,_threadCount:0,Provider:null,Consumer:null},R.Provider=R,R.Consumer={$$typeof:u,_context:R},R},Je.createElement=function(R,K,T){var fe,Ee={},Ne=null;if(K!=null)for(fe in K.key!==void 0&&(Ne=""+K.key),K)W.call(K,fe)&&fe!=="key"&&fe!=="__self"&&fe!=="__source"&&(Ee[fe]=K[fe]);var Le=arguments.length-2;if(Le===1)Ee.children=T;else if(1<Le){for(var Be=Array(Le),Qe=0;Qe<Le;Qe++)Be[Qe]=arguments[Qe+2];Ee.children=Be}if(R&&R.defaultProps)for(fe in Le=R.defaultProps,Le)Ee[fe]===void 0&&(Ee[fe]=Le[fe]);return te(R,Ne,Ee)},Je.createRef=function(){return{current:null}},Je.forwardRef=function(R){return{$$typeof:m,render:R}},Je.isValidElement=Y,Je.lazy=function(R){return{$$typeof:g,_payload:{_status:-1,_result:R},_init:de}},Je.memo=function(R,K){return{$$typeof:f,type:R,compare:K===void 0?null:K}},Je.startTransition=function(R){var K=I.T,T={};I.T=T;try{var fe=R(),Ee=I.S;Ee!==null&&Ee(T,fe),typeof fe=="object"&&fe!==null&&typeof fe.then=="function"&&fe.then(M,ue)}catch(Ne){ue(Ne)}finally{K!==null&&T.types!==null&&(K.types=T.types),I.T=K}},Je.unstable_useCacheRefresh=function(){return I.H.useCacheRefresh()},Je.use=function(R){return I.H.use(R)},Je.useActionState=function(R,K,T){return I.H.useActionState(R,K,T)},Je.useCallback=function(R,K){return I.H.useCallback(R,K)},Je.useContext=function(R){return I.H.useContext(R)},Je.useDebugValue=function(){},Je.useDeferredValue=function(R,K){return I.H.useDeferredValue(R,K)},Je.useEffect=function(R,K){return I.H.useEffect(R,K)},Je.useEffectEvent=function(R){return I.H.useEffectEvent(R)},Je.useId=function(){return I.H.useId()},Je.useImperativeHandle=function(R,K,T){return I.H.useImperativeHandle(R,K,T)},Je.useInsertionEffect=function(R,K){return I.H.useInsertionEffect(R,K)},Je.useLayoutEffect=function(R,K){return I.H.useLayoutEffect(R,K)},Je.useMemo=function(R,K){return I.H.useMemo(R,K)},Je.useOptimistic=function(R,K){return I.H.useOptimistic(R,K)},Je.useReducer=function(R,K,T){return I.H.useReducer(R,K,T)},Je.useRef=function(R){return I.H.useRef(R)},Je.useState=function(R){return I.H.useState(R)},Je.useSyncExternalStore=function(R,K,T){return I.H.useSyncExternalStore(R,K,T)},Je.useTransition=function(){return I.H.useTransition()},Je.version="19.2.4",Je}var u1;function nh(){return u1||(u1=1,Xd.exports=I2()),Xd.exports}var k=nh(),Vd={exports:{}},xs={},Gd={exports:{}},Kd={};/**
|
|
18
18
|
* @license React
|
|
19
19
|
* scheduler.production.js
|
|
20
20
|
*
|
|
@@ -22,7 +22,7 @@ var L2=Object.defineProperty;var $2=(t,l,r)=>l in t?L2(t,l,{enumerable:!0,config
|
|
|
22
22
|
*
|
|
23
23
|
* This source code is licensed under the MIT license found in the
|
|
24
24
|
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/var
|
|
25
|
+
*/var d1;function Y2(){return d1||(d1=1,(function(t){function l(L,Z){var de=L.length;L.push(Z);e:for(;0<de;){var ue=de-1>>>1,z=L[ue];if(0<c(z,Z))L[ue]=Z,L[de]=z,de=ue;else break e}}function r(L){return L.length===0?null:L[0]}function i(L){if(L.length===0)return null;var Z=L[0],de=L.pop();if(de!==Z){L[0]=de;e:for(var ue=0,z=L.length,R=z>>>1;ue<R;){var K=2*(ue+1)-1,T=L[K],fe=K+1,Ee=L[fe];if(0>c(T,de))fe<z&&0>c(Ee,T)?(L[ue]=Ee,L[fe]=de,ue=fe):(L[ue]=T,L[K]=de,ue=K);else if(fe<z&&0>c(Ee,de))L[ue]=Ee,L[fe]=de,ue=fe;else break e}}return Z}function c(L,Z){var de=L.sortIndex-Z.sortIndex;return de!==0?de:L.id-Z.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;t.unstable_now=function(){return u.now()}}else{var d=Date,m=d.now();t.unstable_now=function(){return d.now()-m}}var x=[],f=[],g=1,y=null,b=3,v=!1,S=!1,j=!1,E=!1,C=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,F=typeof setImmediate<"u"?setImmediate:null;function _(L){for(var Z=r(f);Z!==null;){if(Z.callback===null)i(f);else if(Z.startTime<=L)i(f),Z.sortIndex=Z.expirationTime,l(x,Z);else break;Z=r(f)}}function H(L){if(j=!1,_(L),!S)if(r(x)!==null)S=!0,M||(M=!0,B());else{var Z=r(f);Z!==null&&G(H,Z.startTime-L)}}var M=!1,I=-1,W=5,te=-1;function D(){return E?!0:!(t.unstable_now()-te<W)}function Y(){if(E=!1,M){var L=t.unstable_now();te=L;var Z=!0;try{e:{S=!1,j&&(j=!1,A(I),I=-1),v=!0;var de=b;try{t:{for(_(L),y=r(x);y!==null&&!(y.expirationTime>L&&D());){var ue=y.callback;if(typeof ue=="function"){y.callback=null,b=y.priorityLevel;var z=ue(y.expirationTime<=L);if(L=t.unstable_now(),typeof z=="function"){y.callback=z,_(L),Z=!0;break t}y===r(x)&&i(x),_(L)}else i(x);y=r(x)}if(y!==null)Z=!0;else{var R=r(f);R!==null&&G(H,R.startTime-L),Z=!1}}break e}finally{y=null,b=de,v=!1}Z=void 0}}finally{Z?B():M=!1}}}var B;if(typeof F=="function")B=function(){F(Y)};else if(typeof MessageChannel<"u"){var V=new MessageChannel,ne=V.port2;V.port1.onmessage=Y,B=function(){ne.postMessage(null)}}else B=function(){C(Y,0)};function G(L,Z){I=C(function(){L(t.unstable_now())},Z)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(L){L.callback=null},t.unstable_forceFrameRate=function(L){0>L||125<L?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):W=0<L?Math.floor(1e3/L):5},t.unstable_getCurrentPriorityLevel=function(){return b},t.unstable_next=function(L){switch(b){case 1:case 2:case 3:var Z=3;break;default:Z=b}var de=b;b=Z;try{return L()}finally{b=de}},t.unstable_requestPaint=function(){E=!0},t.unstable_runWithPriority=function(L,Z){switch(L){case 1:case 2:case 3:case 4:case 5:break;default:L=3}var de=b;b=L;try{return Z()}finally{b=de}},t.unstable_scheduleCallback=function(L,Z,de){var ue=t.unstable_now();switch(typeof de=="object"&&de!==null?(de=de.delay,de=typeof de=="number"&&0<de?ue+de:ue):de=ue,L){case 1:var z=-1;break;case 2:z=250;break;case 5:z=1073741823;break;case 4:z=1e4;break;default:z=5e3}return z=de+z,L={id:g++,callback:Z,priorityLevel:L,startTime:de,expirationTime:z,sortIndex:-1},de>ue?(L.sortIndex=de,l(f,L),r(x)===null&&L===r(f)&&(j?(A(I),I=-1):j=!0,G(H,de-ue))):(L.sortIndex=z,l(x,L),S||v||(S=!0,M||(M=!0,B()))),L},t.unstable_shouldYield=D,t.unstable_wrapCallback=function(L){var Z=b;return function(){var de=b;b=Z;try{return L.apply(this,arguments)}finally{b=de}}}})(Kd)),Kd}var f1;function q2(){return f1||(f1=1,Gd.exports=Y2()),Gd.exports}var Qd={exports:{}},bn={};/**
|
|
26
26
|
* @license React
|
|
27
27
|
* react-dom.production.js
|
|
28
28
|
*
|
|
@@ -30,7 +30,7 @@ var L2=Object.defineProperty;var $2=(t,l,r)=>l in t?L2(t,l,{enumerable:!0,config
|
|
|
30
30
|
*
|
|
31
31
|
* This source code is licensed under the MIT license found in the
|
|
32
32
|
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/var
|
|
33
|
+
*/var h1;function X2(){if(h1)return bn;h1=1;var t=nh();function l(x){var f="https://react.dev/errors/"+x;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)f+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+x+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var i={d:{f:r,r:function(){throw Error(l(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},c=Symbol.for("react.portal");function u(x,f,g){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:y==null?null:""+y,children:x,containerInfo:f,implementation:g}}var d=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(x,f){if(x==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return bn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,bn.createPortal=function(x,f){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(l(299));return u(x,f,null,g)},bn.flushSync=function(x){var f=d.T,g=i.p;try{if(d.T=null,i.p=2,x)return x()}finally{d.T=f,i.p=g,i.d.f()}},bn.preconnect=function(x,f){typeof x=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,i.d.C(x,f))},bn.prefetchDNS=function(x){typeof x=="string"&&i.d.D(x)},bn.preinit=function(x,f){if(typeof x=="string"&&f&&typeof f.as=="string"){var g=f.as,y=m(g,f.crossOrigin),b=typeof f.integrity=="string"?f.integrity:void 0,v=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;g==="style"?i.d.S(x,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:y,integrity:b,fetchPriority:v}):g==="script"&&i.d.X(x,{crossOrigin:y,integrity:b,fetchPriority:v,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},bn.preinitModule=function(x,f){if(typeof x=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var g=m(f.as,f.crossOrigin);i.d.M(x,{crossOrigin:g,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&i.d.M(x)},bn.preload=function(x,f){if(typeof x=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var g=f.as,y=m(g,f.crossOrigin);i.d.L(x,g,{crossOrigin:y,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},bn.preloadModule=function(x,f){if(typeof x=="string")if(f){var g=m(f.as,f.crossOrigin);i.d.m(x,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:g,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else i.d.m(x)},bn.requestFormReset=function(x){i.d.r(x)},bn.unstable_batchedUpdates=function(x,f){return x(f)},bn.useFormState=function(x,f,g){return d.H.useFormState(x,f,g)},bn.useFormStatus=function(){return d.H.useHostTransitionStatus()},bn.version="19.2.4",bn}var m1;function V2(){if(m1)return Qd.exports;m1=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(l){console.error(l)}}return t(),Qd.exports=X2(),Qd.exports}/**
|
|
34
34
|
* @license React
|
|
35
35
|
* react-dom-client.production.js
|
|
36
36
|
*
|
|
@@ -38,63 +38,63 @@ var L2=Object.defineProperty;var $2=(t,l,r)=>l in t?L2(t,l,{enumerable:!0,config
|
|
|
38
38
|
*
|
|
39
39
|
* This source code is licensed under the MIT license found in the
|
|
40
40
|
* LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/var
|
|
41
|
+
*/var x1;function G2(){if(x1)return xs;x1=1;var t=q2(),l=nh(),r=V2();function i(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)n+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+n+" 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 u(e){var n=e,a=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(a=n.return),e=n.return;while(e)}return n.tag===3?a:null}function d(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function m(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function x(e){if(u(e)!==e)throw Error(i(188))}function f(e){var n=e.alternate;if(!n){if(n=u(e),n===null)throw Error(i(188));return n!==e?null:e}for(var a=e,o=n;;){var h=a.return;if(h===null)break;var p=h.alternate;if(p===null){if(o=h.return,o!==null){a=o;continue}break}if(h.child===p.child){for(p=h.child;p;){if(p===a)return x(h),e;if(p===o)return x(h),n;p=p.sibling}throw Error(i(188))}if(a.return!==o.return)a=h,o=p;else{for(var w=!1,N=h.child;N;){if(N===a){w=!0,a=h,o=p;break}if(N===o){w=!0,o=h,a=p;break}N=N.sibling}if(!w){for(N=p.child;N;){if(N===a){w=!0,a=p,o=h;break}if(N===o){w=!0,o=p,a=h;break}N=N.sibling}if(!w)throw Error(i(189))}}if(a.alternate!==o)throw Error(i(190))}if(a.tag!==3)throw Error(i(188));return a.stateNode.current===a?e:n}function g(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=g(e),n!==null)return n;e=e.sibling}return null}var y=Object.assign,b=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),F=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),H=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),I=Symbol.for("react.memo"),W=Symbol.for("react.lazy"),te=Symbol.for("react.activity"),D=Symbol.for("react.memo_cache_sentinel"),Y=Symbol.iterator;function B(e){return e===null||typeof e!="object"?null:(e=Y&&e[Y]||e["@@iterator"],typeof e=="function"?e:null)}var V=Symbol.for("react.client.reference");function ne(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===V?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case j:return"Fragment";case C:return"Profiler";case E:return"StrictMode";case H:return"Suspense";case M:return"SuspenseList";case te:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case S:return"Portal";case F:return e.displayName||"Context";case A:return(e._context.displayName||"Context")+".Consumer";case _:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case I:return n=e.displayName||null,n!==null?n:ne(e.type)||"Memo";case W:n=e._payload,e=e._init;try{return ne(e(n))}catch{}}return null}var G=Array.isArray,L=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,de={pending:!1,data:null,method:null,action:null},ue=[],z=-1;function R(e){return{current:e}}function K(e){0>z||(e.current=ue[z],ue[z]=null,z--)}function T(e,n){z++,ue[z]=e.current,e.current=n}var fe=R(null),Ee=R(null),Ne=R(null),Le=R(null);function Be(e,n){switch(T(Ne,n),T(Ee,e),T(fe,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?Tp(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=Tp(n),e=Dp(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}K(fe),T(fe,e)}function Qe(){K(fe),K(Ee),K(Ne)}function Se(e){e.memoizedState!==null&&T(Le,e);var n=fe.current,a=Dp(n,e.type);n!==a&&(T(Ee,e),T(fe,a))}function tt(e){Ee.current===e&&(K(fe),K(Ee)),Le.current===e&&(K(Le),us._currentValue=de)}var me,he;function ge(e){if(me===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);me=n&&n[1]||"",he=-1<a.stack.indexOf(`
|
|
42
42
|
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
43
|
`+me+e+he}var ke=!1;function Fe(e,n){if(!e||ke)return"";ke=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(n){var ce=function(){throw Error()};if(Object.defineProperty(ce.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ce,[])}catch(le){var ee=le}Reflect.construct(e,[],ce)}else{try{ce.call()}catch(le){ee=le}e.call(ce.prototype)}}else{try{throw Error()}catch(le){ee=le}(ce=e())&&typeof ce.catch=="function"&&ce.catch(function(){})}}catch(le){if(le&&ee&&typeof le.stack=="string")return[le.stack,ee.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var h=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");h&&h.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var p=o.DetermineComponentFrameRoot(),w=p[0],N=p[1];if(w&&N){var U=w.split(`
|
|
44
44
|
`),P=N.split(`
|
|
45
45
|
`);for(h=o=0;o<U.length&&!U[o].includes("DetermineComponentFrameRoot");)o++;for(;h<P.length&&!P[h].includes("DetermineComponentFrameRoot");)h++;if(o===U.length||h===P.length)for(o=U.length-1,h=P.length-1;1<=o&&0<=h&&U[o]!==P[h];)h--;for(;1<=o&&0<=h;o--,h--)if(U[o]!==P[h]){if(o!==1||h!==1)do if(o--,h--,0>h||U[o]!==P[h]){var ie=`
|
|
46
46
|
`+U[o].replace(" at new "," at ");return e.displayName&&ie.includes("<anonymous>")&&(ie=ie.replace("<anonymous>",e.displayName)),ie}while(1<=o&&0<=h);break}}}finally{ke=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?ge(a):""}function Ae(e,n){switch(e.tag){case 26:case 27:case 5:return ge(e.type);case 16:return ge("Lazy");case 13:return e.child!==n&&n!==null?ge("Suspense Fallback"):ge("Suspense");case 19:return ge("SuspenseList");case 0:case 15:return Fe(e.type,!1);case 11:return Fe(e.type.render,!1);case 1:return Fe(e.type,!0);case 31:return ge("Activity");default:return""}}function De(e){try{var n="",a=null;do n+=Ae(e,a),a=e,e=e.return;while(e);return n}catch(o){return`
|
|
47
47
|
Error generating stack: `+o.message+`
|
|
48
|
-
`+o.stack}}var je=Object.prototype.hasOwnProperty,_e=t.unstable_scheduleCallback,Ke=t.unstable_cancelCallback,Et=t.unstable_shouldYield,Ht=t.unstable_requestPaint,gt=t.unstable_now,Rt=t.unstable_getCurrentPriorityLevel,re=t.unstable_ImmediatePriority,pe=t.unstable_UserBlockingPriority,Te=t.unstable_NormalPriority,Ye=t.unstable_LowPriority,xe=t.unstable_IdlePriority,q=t.log,ze=t.unstable_setDisableYieldValue,He=null,Xe=null;function ht(e){if(typeof q=="function"&&ze(e),Xe&&typeof Xe.setStrictMode=="function")try{Xe.setStrictMode(He,e)}catch{}}var Pe=Math.clz32?Math.clz32:$l,We=Math.log,un=Math.LN2;function $l(e){return e>>>=0,e===0?32:31-(We(e)/un|0)|0}var ur=256,ol=262144,dr=4194304;function $n(e){var n=e&42;if(n!==0)return n;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 fn(e,n,a){var o=e.pendingLanes;if(o===0)return 0;var h=0,p=e.suspendedLanes,w=e.pingedLanes;e=e.warmLanes;var N=o&134217727;return N!==0?(o=N&~p,o!==0?h=$n(o):(w&=N,w!==0?h=$n(w):a||(a=N&~e,a!==0&&(h=$n(a))))):(N=o&~p,N!==0?h=$n(N):w!==0?h=$n(w):a||(a=o&~e,a!==0&&(h=$n(a)))),h===0?0:n!==0&&n!==h&&(n&p)===0&&(p=h&-h,a=n&-n,p>=a||p===32&&(a&4194048)!==0)?n:h}function Wt(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function ve(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+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 n+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 Zt(){var e=dr;return dr<<=1,(dr&62914560)===0&&(dr=4194304),e}function Zr(e){for(var n=[],a=0;31>a;a++)n.push(e);return n}function cl(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Wn(e,n,a,o,h,p){var w=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var N=e.entanglements,U=e.expirationTimes,P=e.hiddenUpdates;for(a=w&~a;0<a;){var ie=31-Pe(a),ce=1<<ie;N[ie]=0,U[ie]=-1;var ee=P[ie];if(ee!==null)for(P[ie]=null,ie=0;ie<ee.length;ie++){var le=ee[ie];le!==null&&(le.lane&=-536870913)}a&=~ce}o!==0&&Ys(e,o,0),p!==0&&h===0&&e.tag!==0&&(e.suspendedLanes|=p&~(w&~n))}function Ys(e,n,a){e.pendingLanes|=n,e.suspendedLanes&=~n;var o=31-Pe(n);e.entangledLanes|=n,e.entanglements[o]=e.entanglements[o]|1073741824|a&261930}function Hl(e,n){var a=e.entangledLanes|=n;for(e=e.entanglements;a;){var o=31-Pe(a),h=1<<o;h&n|e[o]&n&&(e[o]|=n),a&=~h}}function Ca(e,n){var a=n&-n;return a=(a&42)!==0?1:vl(a),(a&(e.suspendedLanes|n))!==0?0:a}function vl(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 wl(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Ul(){var e=Z.p;return e!==0?e:(e=window.event,e===void 0?32:Zp(e.type))}function wi(e,n){var a=Z.p;try{return Z.p=e,n()}finally{Z.p=a}}var Sn=Math.random().toString(36).slice(2),Jt="__reactFiber$"+Sn,hn="__reactProps$"+Sn,kl="__reactContainer$"+Sn,Ea="__reactEvents$"+Sn,qs="__reactListeners$"+Sn,Il="__reactHandles$"+Sn,Na="__reactResources$"+Sn,fr="__reactMarker$"+Sn;function Aa(e){delete e[Jt],delete e[hn],delete e[Ea],delete e[qs],delete e[Il]}function hr(e){var n=e[Jt];if(n)return n;for(var a=e.parentNode;a;){if(n=a[kl]||a[Jt]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(e=_p(e);e!==null;){if(a=e[Jt])return a;e=_p(e)}return n}e=a,a=e.parentNode}return null}function jl(e){if(e=e[Jt]||e[kl]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function gn(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(i(33))}function Tn(e){var n=e[Na];return n||(n=e[Na]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Ut(e){e[fr]=!0}var Xs=new Set,Yl={};function Yt(e,n){ul(e,n),ul(e+"Capture",n)}function ul(e,n){for(Yl[e]=n,e=0;e<n.length;e++)Xs.add(n[e])}var Zn=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]*$"),mr={},Ta={};function Uc(e){return je.call(Ta,e)?!0:je.call(mr,e)?!1:Zn.test(e)?Ta[e]=!0:(mr[e]=!0,!1)}function Sl(e,n,a){if(Uc(n))if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(n);return;case"boolean":var o=n.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){e.removeAttribute(n);return}}e.setAttribute(n,""+a)}}function Cl(e,n,a){if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,""+a)}}function dl(e,n,a,o){if(o===null)e.removeAttribute(a);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(n,a,""+o)}}function yt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ki(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Ic(e,n,a){var o=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var h=o.get,p=o.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return h.call(this)},set:function(w){a=""+w,p.call(this,w)}}),Object.defineProperty(e,n,{enumerable:o.enumerable}),{getValue:function(){return a},setValue:function(w){a=""+w},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function ji(e){if(!e._valueTracker){var n=ki(e)?"checked":"value";e._valueTracker=Ic(e,n,""+e[n])}}function Si(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var a=n.getValue(),o="";return e&&(o=ki(e)?e.checked?"true":"false":e.value),e=o,e!==a?(n.setValue(e),!0):!1}function xr(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 Yc=/[\n"\\]/g;function Dn(e){return e.replace(Yc,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function Da(e,n,a,o,h,p,w,N){e.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?e.type=w:e.removeAttribute("type"),n!=null?w==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+yt(n)):e.value!==""+yt(n)&&(e.value=""+yt(n)):w!=="submit"&&w!=="reset"||e.removeAttribute("value"),n!=null?Ci(e,w,yt(n)):a!=null?Ci(e,w,yt(a)):o!=null&&e.removeAttribute("value"),h==null&&p!=null&&(e.defaultChecked=!!p),h!=null&&(e.checked=h&&typeof h!="function"&&typeof h!="symbol"),N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?e.name=""+yt(N):e.removeAttribute("name")}function Vs(e,n,a,o,h,p,w,N){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(e.type=p),n!=null||a!=null){if(!(p!=="submit"&&p!=="reset"||n!=null)){ji(e);return}a=a!=null?""+yt(a):"",n=n!=null?""+yt(n):a,N||n===e.value||(e.value=n),e.defaultValue=n}o=o??h,o=typeof o!="function"&&typeof o!="symbol"&&!!o,e.checked=N?e.checked:!!o,e.defaultChecked=!!o,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(e.name=w),ji(e)}function Ci(e,n,a){n==="number"&&xr(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function pr(e,n,a,o){if(e=e.options,n){n={};for(var h=0;h<a.length;h++)n["$"+a[h]]=!0;for(a=0;a<e.length;a++)h=n.hasOwnProperty("$"+e[a].value),e[a].selected!==h&&(e[a].selected=h),h&&o&&(e[a].defaultSelected=!0)}else{for(a=""+yt(a),n=null,h=0;h<e.length;h++){if(e[h].value===a){e[h].selected=!0,o&&(e[h].defaultSelected=!0);return}n!==null||e[h].disabled||(n=e[h])}n!==null&&(n.selected=!0)}}function Gs(e,n,a){if(n!=null&&(n=""+yt(n),n!==e.value&&(e.value=n),a==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=a!=null?""+yt(a):""}function Ks(e,n,a,o){if(n==null){if(o!=null){if(a!=null)throw Error(i(92));if(G(o)){if(1<o.length)throw Error(i(93));o=o[0]}a=o}a==null&&(a=""),n=a}a=yt(n),e.defaultValue=a,o=e.textContent,o===a&&o!==""&&o!==null&&(e.value=o),ji(e)}function yr(e,n){if(n){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=n;return}}e.textContent=n}var qc=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 fl(e,n,a){var o=n.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?o?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":o?e.setProperty(n,a):typeof a!="number"||a===0||qc.has(n)?n==="float"?e.cssFloat=a:e[n]=(""+a).trim():e[n]=a+"px"}function za(e,n,a){if(n!=null&&typeof n!="object")throw Error(i(62));if(e=e.style,a!=null){for(var o in a)!a.hasOwnProperty(o)||n!=null&&n.hasOwnProperty(o)||(o.indexOf("--")===0?e.setProperty(o,""):o==="float"?e.cssFloat="":e[o]="");for(var h in n)o=n[h],n.hasOwnProperty(h)&&a[h]!==o&&fl(e,h,o)}else for(var p in n)n.hasOwnProperty(p)&&fl(e,p,n[p])}function Ei(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 Xc=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"]]),El=/^[\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 Jr(e){return El.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function hl(){}var Ni=null;function Pt(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Jn=null,ql=null;function Ai(e){var n=jl(e);if(n&&(e=n.stateNode)){var a=e[hn]||null;e:switch(e=n.stateNode,n.type){case"input":if(Da(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),n=a.name,a.type==="radio"&&n!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Dn(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var o=a[n];if(o!==e&&o.form===e.form){var h=o[hn]||null;if(!h)throw Error(i(90));Da(o,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name)}}for(n=0;n<a.length;n++)o=a[n],o.form===e.form&&Si(o)}break e;case"textarea":Gs(e,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&pr(e,!!a.multiple,n,!1)}}}var Ma=!1;function O(e,n,a){if(Ma)return e(n,a);Ma=!0;try{var o=e(n);return o}finally{if(Ma=!1,(Jn!==null||ql!==null)&&(Fo(),Jn&&(n=Jn,e=ql,ql=Jn=null,Ai(n),e)))for(n=0;n<e.length;n++)Ai(e[n])}}function ae(e,n){var a=e.stateNode;if(a===null)return null;var o=a[hn]||null;if(o===null)return null;a=o[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(o=!o.disabled)||(e=e.type,o=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!o;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(i(231,n,typeof a));return a}var se=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ye=!1;if(se)try{var be={};Object.defineProperty(be,"passive",{get:function(){ye=!0}}),window.addEventListener("test",be,be),window.removeEventListener("test",be,be)}catch{ye=!1}var Me=null,Ie=null,nt=null;function mt(){if(nt)return nt;var e,n=Ie,a=n.length,o,h="value"in Me?Me.value:Me.textContent,p=h.length;for(e=0;e<a&&n[e]===h[e];e++);var w=a-e;for(o=1;o<=w&&n[a-o]===h[p-o];o++);return nt=h.slice(e,1<o?1-o:void 0)}function Ze(e){var n=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&n===13&&(e=13)):e=n,e===10&&(e=13),32<=e||e===13?e:0}function Ot(){return!0}function Th(){return!1}function zn(e){function n(a,o,h,p,w){this._reactName=a,this._targetInst=h,this.type=o,this.nativeEvent=p,this.target=w,this.currentTarget=null;for(var N in e)e.hasOwnProperty(N)&&(a=e[N],this[N]=a?a(p):p[N]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?Ot:Th,this.isPropagationStopped=Th,this}return y(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Ot)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Ot)},persist:function(){},isPersistent:Ot}),n}var Pr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Qs=zn(Pr),Ti=y({},Pr,{view:0,detail:0}),Og=zn(Ti),Vc,Gc,Di,Ws=y({},Ti,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Qc,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!==Di&&(Di&&e.type==="mousemove"?(Vc=e.screenX-Di.screenX,Gc=e.screenY-Di.screenY):Gc=Vc=0,Di=e),Vc)},movementY:function(e){return"movementY"in e?e.movementY:Gc}}),Dh=zn(Ws),Bg=y({},Ws,{dataTransfer:0}),Lg=zn(Bg),$g=y({},Ti,{relatedTarget:0}),Kc=zn($g),Hg=y({},Pr,{animationName:0,elapsedTime:0,pseudoElement:0}),Ug=zn(Hg),Ig=y({},Pr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Yg=zn(Ig),qg=y({},Pr,{data:0}),zh=zn(qg),Xg={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Vg={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"},Gg={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Kg(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=Gg[e])?!!n[e]:!1}function Qc(){return Kg}var Qg=y({},Ti,{key:function(e){if(e.key){var n=Xg[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=Ze(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Vg[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Qc,charCode:function(e){return e.type==="keypress"?Ze(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ze(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Wg=zn(Qg),Zg=y({},Ws,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Mh=zn(Zg),Jg=y({},Ti,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Qc}),Pg=zn(Jg),eb=y({},Pr,{propertyName:0,elapsedTime:0,pseudoElement:0}),tb=zn(eb),nb=y({},Ws,{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}),lb=zn(nb),rb=y({},Pr,{newState:0,oldState:0}),ab=zn(rb),ib=[9,13,27,32],Wc=se&&"CompositionEvent"in window,zi=null;se&&"documentMode"in document&&(zi=document.documentMode);var sb=se&&"TextEvent"in window&&!zi,Fh=se&&(!Wc||zi&&8<zi&&11>=zi),Rh=" ",_h=!1;function Oh(e,n){switch(e){case"keyup":return ib.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Bh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Fa=!1;function ob(e,n){switch(e){case"compositionend":return Bh(n);case"keypress":return n.which!==32?null:(_h=!0,Rh);case"textInput":return e=n.data,e===Rh&&_h?null:e;default:return null}}function cb(e,n){if(Fa)return e==="compositionend"||!Wc&&Oh(e,n)?(e=mt(),nt=Ie=Me=null,Fa=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return Fh&&n.locale!=="ko"?null:n.data;default:return null}}var ub={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 Lh(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!ub[e.type]:n==="textarea"}function $h(e,n,a,o){Jn?ql?ql.push(o):ql=[o]:Jn=o,n=Ho(n,"onChange"),0<n.length&&(a=new Qs("onChange","change",null,a,o),e.push({event:a,listeners:n}))}var Mi=null,Fi=null;function db(e){wp(e,0)}function Zs(e){var n=gn(e);if(Si(n))return e}function Hh(e,n){if(e==="change")return n}var Uh=!1;if(se){var Zc;if(se){var Jc="oninput"in document;if(!Jc){var Ih=document.createElement("div");Ih.setAttribute("oninput","return;"),Jc=typeof Ih.oninput=="function"}Zc=Jc}else Zc=!1;Uh=Zc&&(!document.documentMode||9<document.documentMode)}function Yh(){Mi&&(Mi.detachEvent("onpropertychange",qh),Fi=Mi=null)}function qh(e){if(e.propertyName==="value"&&Zs(Fi)){var n=[];$h(n,Fi,e,Pt(e)),O(db,n)}}function fb(e,n,a){e==="focusin"?(Yh(),Mi=n,Fi=a,Mi.attachEvent("onpropertychange",qh)):e==="focusout"&&Yh()}function hb(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Zs(Fi)}function mb(e,n){if(e==="click")return Zs(n)}function xb(e,n){if(e==="input"||e==="change")return Zs(n)}function pb(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var Hn=typeof Object.is=="function"?Object.is:pb;function Ri(e,n){if(Hn(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var a=Object.keys(e),o=Object.keys(n);if(a.length!==o.length)return!1;for(o=0;o<a.length;o++){var h=a[o];if(!je.call(n,h)||!Hn(e[h],n[h]))return!1}return!0}function Xh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Vh(e,n){var a=Xh(e);e=0;for(var o;a;){if(a.nodeType===3){if(o=e+a.textContent.length,e<=n&&o>=n)return{node:a,offset:n-e};e=o}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Xh(a)}}function Gh(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Gh(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Kh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=xr(e.document);n instanceof e.HTMLIFrameElement;){try{var a=typeof n.contentWindow.location.href=="string"}catch{a=!1}if(a)e=n.contentWindow;else break;n=xr(e.document)}return n}function Pc(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}var yb=se&&"documentMode"in document&&11>=document.documentMode,Ra=null,eu=null,_i=null,tu=!1;function Qh(e,n,a){var o=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;tu||Ra==null||Ra!==xr(o)||(o=Ra,"selectionStart"in o&&Pc(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),_i&&Ri(_i,o)||(_i=o,o=Ho(eu,"onSelect"),0<o.length&&(n=new Qs("onSelect","select",null,n,a),e.push({event:n,listeners:o}),n.target=Ra)))}function ea(e,n){var a={};return a[e.toLowerCase()]=n.toLowerCase(),a["Webkit"+e]="webkit"+n,a["Moz"+e]="moz"+n,a}var _a={animationend:ea("Animation","AnimationEnd"),animationiteration:ea("Animation","AnimationIteration"),animationstart:ea("Animation","AnimationStart"),transitionrun:ea("Transition","TransitionRun"),transitionstart:ea("Transition","TransitionStart"),transitioncancel:ea("Transition","TransitionCancel"),transitionend:ea("Transition","TransitionEnd")},nu={},Wh={};se&&(Wh=document.createElement("div").style,"AnimationEvent"in window||(delete _a.animationend.animation,delete _a.animationiteration.animation,delete _a.animationstart.animation),"TransitionEvent"in window||delete _a.transitionend.transition);function ta(e){if(nu[e])return nu[e];if(!_a[e])return e;var n=_a[e],a;for(a in n)if(n.hasOwnProperty(a)&&a in Wh)return nu[e]=n[a];return e}var Zh=ta("animationend"),Jh=ta("animationiteration"),Ph=ta("animationstart"),gb=ta("transitionrun"),bb=ta("transitionstart"),vb=ta("transitioncancel"),em=ta("transitionend"),tm=new Map,lu="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(" ");lu.push("scrollEnd");function ml(e,n){tm.set(e,n),Yt(n,[e])}var Js=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=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(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Pn=[],Oa=0,ru=0;function Ps(){for(var e=Oa,n=ru=Oa=0;n<e;){var a=Pn[n];Pn[n++]=null;var o=Pn[n];Pn[n++]=null;var h=Pn[n];Pn[n++]=null;var p=Pn[n];if(Pn[n++]=null,o!==null&&h!==null){var w=o.pending;w===null?h.next=h:(h.next=w.next,w.next=h),o.pending=h}p!==0&&nm(a,h,p)}}function eo(e,n,a,o){Pn[Oa++]=e,Pn[Oa++]=n,Pn[Oa++]=a,Pn[Oa++]=o,ru|=o,e.lanes|=o,e=e.alternate,e!==null&&(e.lanes|=o)}function au(e,n,a,o){return eo(e,n,a,o),to(e)}function na(e,n){return eo(e,null,null,n),to(e)}function nm(e,n,a){e.lanes|=a;var o=e.alternate;o!==null&&(o.lanes|=a);for(var h=!1,p=e.return;p!==null;)p.childLanes|=a,o=p.alternate,o!==null&&(o.childLanes|=a),p.tag===22&&(e=p.stateNode,e===null||e._visibility&1||(h=!0)),e=p,p=p.return;return e.tag===3?(p=e.stateNode,h&&n!==null&&(h=31-Pe(a),e=p.hiddenUpdates,o=e[h],o===null?e[h]=[n]:o.push(n),n.lane=a|536870912),p):null}function to(e){if(50<ls)throw ls=0,md=null,Error(i(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var Ba={};function wb(e,n,a,o){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Un(e,n,a,o){return new wb(e,n,a,o)}function iu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Xl(e,n){var a=e.alternate;return a===null?(a=Un(e.tag,n,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=n,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,n=e.dependencies,a.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function lm(e,n){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=n,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,n=a.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function no(e,n,a,o,h,p){var w=0;if(o=e,typeof e=="function")iu(e)&&(w=1);else if(typeof e=="string")w=E2(e,a,fe.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case te:return e=Un(31,a,n,h),e.elementType=te,e.lanes=p,e;case j:return la(a.children,h,p,n);case E:w=8,h|=24;break;case C:return e=Un(12,a,n,h|2),e.elementType=C,e.lanes=p,e;case H:return e=Un(13,a,n,h),e.elementType=H,e.lanes=p,e;case M:return e=Un(19,a,n,h),e.elementType=M,e.lanes=p,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case F:w=10;break e;case A:w=9;break e;case _:w=11;break e;case I:w=14;break e;case W:w=16,o=null;break e}w=29,a=Error(i(130,e===null?"null":typeof e,"")),o=null}return n=Un(w,a,n,h),n.elementType=e,n.type=o,n.lanes=p,n}function la(e,n,a,o){return e=Un(7,e,o,n),e.lanes=a,e}function su(e,n,a){return e=Un(6,e,null,n),e.lanes=a,e}function rm(e){var n=Un(18,null,null,0);return n.stateNode=e,n}function ou(e,n,a){return n=Un(4,e.children!==null?e.children:[],e.key,n),n.lanes=a,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var am=new WeakMap;function el(e,n){if(typeof e=="object"&&e!==null){var a=am.get(e);return a!==void 0?a:(n={value:e,source:n,stack:De(n)},am.set(e,n),n)}return{value:e,source:n,stack:De(n)}}var La=[],$a=0,lo=null,Oi=0,tl=[],nl=0,gr=null,Nl=1,Al="";function Vl(e,n){La[$a++]=Oi,La[$a++]=lo,lo=e,Oi=n}function im(e,n,a){tl[nl++]=Nl,tl[nl++]=Al,tl[nl++]=gr,gr=e;var o=Nl;e=Al;var h=32-Pe(o)-1;o&=~(1<<h),a+=1;var p=32-Pe(n)+h;if(30<p){var w=h-h%5;p=(o&(1<<w)-1).toString(32),o>>=w,h-=w,Nl=1<<32-Pe(n)+h|a<<h|o,Al=p+e}else Nl=1<<p|a<<h|o,Al=e}function cu(e){e.return!==null&&(Vl(e,1),im(e,1,0))}function uu(e){for(;e===lo;)lo=La[--$a],La[$a]=null,Oi=La[--$a],La[$a]=null;for(;e===gr;)gr=tl[--nl],tl[nl]=null,Al=tl[--nl],tl[nl]=null,Nl=tl[--nl],tl[nl]=null}function sm(e,n){tl[nl++]=Nl,tl[nl++]=Al,tl[nl++]=gr,Nl=n.id,Al=n.overflow,gr=e}var mn=null,Bt=null,xt=!1,br=null,ll=!1,du=Error(i(519));function vr(e){var n=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Bi(el(n,e)),du}function om(e){var n=e.stateNode,a=e.type,o=e.memoizedProps;switch(n[Jt]=e,n[hn]=o,a){case"dialog":ot("cancel",n),ot("close",n);break;case"iframe":case"object":case"embed":ot("load",n);break;case"video":case"audio":for(a=0;a<as.length;a++)ot(as[a],n);break;case"source":ot("error",n);break;case"img":case"image":case"link":ot("error",n),ot("load",n);break;case"details":ot("toggle",n);break;case"input":ot("invalid",n),Vs(n,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":ot("invalid",n);break;case"textarea":ot("invalid",n),Ks(n,o.value,o.defaultValue,o.children)}a=o.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||n.textContent===""+a||o.suppressHydrationWarning===!0||Cp(n.textContent,a)?(o.popover!=null&&(ot("beforetoggle",n),ot("toggle",n)),o.onScroll!=null&&ot("scroll",n),o.onScrollEnd!=null&&ot("scrollend",n),o.onClick!=null&&(n.onclick=hl),n=!0):n=!1,n||vr(e,!0)}function cm(e){for(mn=e.return;mn;)switch(mn.tag){case 5:case 31:case 13:ll=!1;return;case 27:case 3:ll=!0;return;default:mn=mn.return}}function Ha(e){if(e!==mn)return!1;if(!xt)return cm(e),xt=!0,!1;var n=e.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||Td(e.type,e.memoizedProps)),a=!a),a&&Bt&&vr(e),cm(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));Bt=Rp(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));Bt=Rp(e)}else n===27?(n=Bt,Rr(e.type)?(e=Rd,Rd=null,Bt=e):Bt=n):Bt=mn?al(e.stateNode.nextSibling):null;return!0}function ra(){Bt=mn=null,xt=!1}function fu(){var e=br;return e!==null&&(_n===null?_n=e:_n.push.apply(_n,e),br=null),e}function Bi(e){br===null?br=[e]:br.push(e)}var hu=R(null),aa=null,Gl=null;function wr(e,n,a){T(hu,n._currentValue),n._currentValue=a}function Kl(e){e._currentValue=hu.current,K(hu)}function mu(e,n,a){for(;e!==null;){var o=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,o!==null&&(o.childLanes|=n)):o!==null&&(o.childLanes&n)!==n&&(o.childLanes|=n),e===a)break;e=e.return}}function xu(e,n,a,o){var h=e.child;for(h!==null&&(h.return=e);h!==null;){var p=h.dependencies;if(p!==null){var w=h.child;p=p.firstContext;e:for(;p!==null;){var N=p;p=h;for(var U=0;U<n.length;U++)if(N.context===n[U]){p.lanes|=a,N=p.alternate,N!==null&&(N.lanes|=a),mu(p.return,a,e),o||(w=null);break e}p=N.next}}else if(h.tag===18){if(w=h.return,w===null)throw Error(i(341));w.lanes|=a,p=w.alternate,p!==null&&(p.lanes|=a),mu(w,a,e),w=null}else w=h.child;if(w!==null)w.return=h;else for(w=h;w!==null;){if(w===e){w=null;break}if(h=w.sibling,h!==null){h.return=w.return,w=h;break}w=w.return}h=w}}function Ua(e,n,a,o){e=null;for(var h=n,p=!1;h!==null;){if(!p){if((h.flags&524288)!==0)p=!0;else if((h.flags&262144)!==0)break}if(h.tag===10){var w=h.alternate;if(w===null)throw Error(i(387));if(w=w.memoizedProps,w!==null){var N=h.type;Hn(h.pendingProps.value,w.value)||(e!==null?e.push(N):e=[N])}}else if(h===Le.current){if(w=h.alternate,w===null)throw Error(i(387));w.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(e!==null?e.push(us):e=[us])}h=h.return}e!==null&&xu(n,e,a,o),n.flags|=262144}function ro(e){for(e=e.firstContext;e!==null;){if(!Hn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ia(e){aa=e,Gl=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function xn(e){return um(aa,e)}function ao(e,n){return aa===null&&ia(e),um(e,n)}function um(e,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},Gl===null){if(e===null)throw Error(i(308));Gl=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else Gl=Gl.next=n;return a}var kb=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(a,o){e.push(o)}};this.abort=function(){n.aborted=!0,e.forEach(function(a){return a()})}},jb=t.unstable_scheduleCallback,Sb=t.unstable_NormalPriority,en={$$typeof:F,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function pu(){return{controller:new kb,data:new Map,refCount:0}}function Li(e){e.refCount--,e.refCount===0&&jb(Sb,function(){e.controller.abort()})}var $i=null,yu=0,Ia=0,Ya=null;function Cb(e,n){if($i===null){var a=$i=[];yu=0,Ia=vd(),Ya={status:"pending",value:void 0,then:function(o){a.push(o)}}}return yu++,n.then(dm,dm),n}function dm(){if(--yu===0&&$i!==null){Ya!==null&&(Ya.status="fulfilled");var e=$i;$i=null,Ia=0,Ya=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function Eb(e,n){var a=[],o={status:"pending",value:null,reason:null,then:function(h){a.push(h)}};return e.then(function(){o.status="fulfilled",o.value=n;for(var h=0;h<a.length;h++)(0,a[h])(n)},function(h){for(o.status="rejected",o.reason=h,h=0;h<a.length;h++)(0,a[h])(void 0)}),o}var fm=L.S;L.S=function(e,n){Qx=gt(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&Cb(e,n),fm!==null&&fm(e,n)};var sa=R(null);function gu(){var e=sa.current;return e!==null?e:zt.pooledCache}function io(e,n){n===null?T(sa,sa.current):T(sa,n.pool)}function hm(){var e=gu();return e===null?null:{parent:en._currentValue,pool:e}}var qa=Error(i(460)),bu=Error(i(474)),so=Error(i(542)),oo={then:function(){}};function mm(e){return e=e.status,e==="fulfilled"||e==="rejected"}function xm(e,n,a){switch(a=e[a],a===void 0?e.push(n):a!==n&&(n.then(hl,hl),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,ym(e),e;default:if(typeof n.status=="string")n.then(hl,hl);else{if(e=zt,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=n,e.status="pending",e.then(function(o){if(n.status==="pending"){var h=n;h.status="fulfilled",h.value=o}},function(o){if(n.status==="pending"){var h=n;h.status="rejected",h.reason=o}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,ym(e),e}throw ca=n,qa}}function oa(e){try{var n=e._init;return n(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(ca=a,qa):a}}var ca=null;function pm(){if(ca===null)throw Error(i(459));var e=ca;return ca=null,e}function ym(e){if(e===qa||e===so)throw Error(i(483))}var Xa=null,Hi=0;function co(e){var n=Hi;return Hi+=1,Xa===null&&(Xa=[]),xm(Xa,e,n)}function Ui(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function uo(e,n){throw n.$$typeof===b?Error(i(525)):(e=Object.prototype.toString.call(n),Error(i(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function gm(e){function n(Q,X){if(e){var J=Q.deletions;J===null?(Q.deletions=[X],Q.flags|=16):J.push(X)}}function a(Q,X){if(!e)return null;for(;X!==null;)n(Q,X),X=X.sibling;return null}function o(Q){for(var X=new Map;Q!==null;)Q.key!==null?X.set(Q.key,Q):X.set(Q.index,Q),Q=Q.sibling;return X}function h(Q,X){return Q=Xl(Q,X),Q.index=0,Q.sibling=null,Q}function p(Q,X,J){return Q.index=J,e?(J=Q.alternate,J!==null?(J=J.index,J<X?(Q.flags|=67108866,X):J):(Q.flags|=67108866,X)):(Q.flags|=1048576,X)}function w(Q){return e&&Q.alternate===null&&(Q.flags|=67108866),Q}function N(Q,X,J,oe){return X===null||X.tag!==6?(X=su(J,Q.mode,oe),X.return=Q,X):(X=h(X,J),X.return=Q,X)}function U(Q,X,J,oe){var Ue=J.type;return Ue===j?ie(Q,X,J.props.children,oe,J.key):X!==null&&(X.elementType===Ue||typeof Ue=="object"&&Ue!==null&&Ue.$$typeof===W&&oa(Ue)===X.type)?(X=h(X,J.props),Ui(X,J),X.return=Q,X):(X=no(J.type,J.key,J.props,null,Q.mode,oe),Ui(X,J),X.return=Q,X)}function P(Q,X,J,oe){return X===null||X.tag!==4||X.stateNode.containerInfo!==J.containerInfo||X.stateNode.implementation!==J.implementation?(X=ou(J,Q.mode,oe),X.return=Q,X):(X=h(X,J.children||[]),X.return=Q,X)}function ie(Q,X,J,oe,Ue){return X===null||X.tag!==7?(X=la(J,Q.mode,oe,Ue),X.return=Q,X):(X=h(X,J),X.return=Q,X)}function ce(Q,X,J){if(typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint")return X=su(""+X,Q.mode,J),X.return=Q,X;if(typeof X=="object"&&X!==null){switch(X.$$typeof){case v:return J=no(X.type,X.key,X.props,null,Q.mode,J),Ui(J,X),J.return=Q,J;case S:return X=ou(X,Q.mode,J),X.return=Q,X;case W:return X=oa(X),ce(Q,X,J)}if(G(X)||B(X))return X=la(X,Q.mode,J,null),X.return=Q,X;if(typeof X.then=="function")return ce(Q,co(X),J);if(X.$$typeof===F)return ce(Q,ao(Q,X),J);uo(Q,X)}return null}function ee(Q,X,J,oe){var Ue=X!==null?X.key:null;if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return Ue!==null?null:N(Q,X,""+J,oe);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case v:return J.key===Ue?U(Q,X,J,oe):null;case S:return J.key===Ue?P(Q,X,J,oe):null;case W:return J=oa(J),ee(Q,X,J,oe)}if(G(J)||B(J))return Ue!==null?null:ie(Q,X,J,oe,null);if(typeof J.then=="function")return ee(Q,X,co(J),oe);if(J.$$typeof===F)return ee(Q,X,ao(Q,J),oe);uo(Q,J)}return null}function le(Q,X,J,oe,Ue){if(typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint")return Q=Q.get(J)||null,N(X,Q,""+oe,Ue);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case v:return Q=Q.get(oe.key===null?J:oe.key)||null,U(X,Q,oe,Ue);case S:return Q=Q.get(oe.key===null?J:oe.key)||null,P(X,Q,oe,Ue);case W:return oe=oa(oe),le(Q,X,J,oe,Ue)}if(G(oe)||B(oe))return Q=Q.get(J)||null,ie(X,Q,oe,Ue,null);if(typeof oe.then=="function")return le(Q,X,J,co(oe),Ue);if(oe.$$typeof===F)return le(Q,X,J,ao(X,oe),Ue);uo(X,oe)}return null}function Re(Q,X,J,oe){for(var Ue=null,bt=null,Oe=X,lt=X=0,dt=null;Oe!==null&<<J.length;lt++){Oe.index>lt?(dt=Oe,Oe=null):dt=Oe.sibling;var vt=ee(Q,Oe,J[lt],oe);if(vt===null){Oe===null&&(Oe=dt);break}e&&Oe&&vt.alternate===null&&n(Q,Oe),X=p(vt,X,lt),bt===null?Ue=vt:bt.sibling=vt,bt=vt,Oe=dt}if(lt===J.length)return a(Q,Oe),xt&&Vl(Q,lt),Ue;if(Oe===null){for(;lt<J.length;lt++)Oe=ce(Q,J[lt],oe),Oe!==null&&(X=p(Oe,X,lt),bt===null?Ue=Oe:bt.sibling=Oe,bt=Oe);return xt&&Vl(Q,lt),Ue}for(Oe=o(Oe);lt<J.length;lt++)dt=le(Oe,Q,lt,J[lt],oe),dt!==null&&(e&&dt.alternate!==null&&Oe.delete(dt.key===null?lt:dt.key),X=p(dt,X,lt),bt===null?Ue=dt:bt.sibling=dt,bt=dt);return e&&Oe.forEach(function($r){return n(Q,$r)}),xt&&Vl(Q,lt),Ue}function Ve(Q,X,J,oe){if(J==null)throw Error(i(151));for(var Ue=null,bt=null,Oe=X,lt=X=0,dt=null,vt=J.next();Oe!==null&&!vt.done;lt++,vt=J.next()){Oe.index>lt?(dt=Oe,Oe=null):dt=Oe.sibling;var $r=ee(Q,Oe,vt.value,oe);if($r===null){Oe===null&&(Oe=dt);break}e&&Oe&&$r.alternate===null&&n(Q,Oe),X=p($r,X,lt),bt===null?Ue=$r:bt.sibling=$r,bt=$r,Oe=dt}if(vt.done)return a(Q,Oe),xt&&Vl(Q,lt),Ue;if(Oe===null){for(;!vt.done;lt++,vt=J.next())vt=ce(Q,vt.value,oe),vt!==null&&(X=p(vt,X,lt),bt===null?Ue=vt:bt.sibling=vt,bt=vt);return xt&&Vl(Q,lt),Ue}for(Oe=o(Oe);!vt.done;lt++,vt=J.next())vt=le(Oe,Q,lt,vt.value,oe),vt!==null&&(e&&vt.alternate!==null&&Oe.delete(vt.key===null?lt:vt.key),X=p(vt,X,lt),bt===null?Ue=vt:bt.sibling=vt,bt=vt);return e&&Oe.forEach(function(B2){return n(Q,B2)}),xt&&Vl(Q,lt),Ue}function Tt(Q,X,J,oe){if(typeof J=="object"&&J!==null&&J.type===j&&J.key===null&&(J=J.props.children),typeof J=="object"&&J!==null){switch(J.$$typeof){case v:e:{for(var Ue=J.key;X!==null;){if(X.key===Ue){if(Ue=J.type,Ue===j){if(X.tag===7){a(Q,X.sibling),oe=h(X,J.props.children),oe.return=Q,Q=oe;break e}}else if(X.elementType===Ue||typeof Ue=="object"&&Ue!==null&&Ue.$$typeof===W&&oa(Ue)===X.type){a(Q,X.sibling),oe=h(X,J.props),Ui(oe,J),oe.return=Q,Q=oe;break e}a(Q,X);break}else n(Q,X);X=X.sibling}J.type===j?(oe=la(J.props.children,Q.mode,oe,J.key),oe.return=Q,Q=oe):(oe=no(J.type,J.key,J.props,null,Q.mode,oe),Ui(oe,J),oe.return=Q,Q=oe)}return w(Q);case S:e:{for(Ue=J.key;X!==null;){if(X.key===Ue)if(X.tag===4&&X.stateNode.containerInfo===J.containerInfo&&X.stateNode.implementation===J.implementation){a(Q,X.sibling),oe=h(X,J.children||[]),oe.return=Q,Q=oe;break e}else{a(Q,X);break}else n(Q,X);X=X.sibling}oe=ou(J,Q.mode,oe),oe.return=Q,Q=oe}return w(Q);case W:return J=oa(J),Tt(Q,X,J,oe)}if(G(J))return Re(Q,X,J,oe);if(B(J)){if(Ue=B(J),typeof Ue!="function")throw Error(i(150));return J=Ue.call(J),Ve(Q,X,J,oe)}if(typeof J.then=="function")return Tt(Q,X,co(J),oe);if(J.$$typeof===F)return Tt(Q,X,ao(Q,J),oe);uo(Q,J)}return typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint"?(J=""+J,X!==null&&X.tag===6?(a(Q,X.sibling),oe=h(X,J),oe.return=Q,Q=oe):(a(Q,X),oe=su(J,Q.mode,oe),oe.return=Q,Q=oe),w(Q)):a(Q,X)}return function(Q,X,J,oe){try{Hi=0;var Ue=Tt(Q,X,J,oe);return Xa=null,Ue}catch(Oe){if(Oe===qa||Oe===so)throw Oe;var bt=Un(29,Oe,null,Q.mode);return bt.lanes=oe,bt.return=Q,bt}finally{}}}var ua=gm(!0),bm=gm(!1),kr=!1;function vu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function wu(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function jr(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Sr(e,n,a){var o=e.updateQueue;if(o===null)return null;if(o=o.shared,(kt&2)!==0){var h=o.pending;return h===null?n.next=n:(n.next=h.next,h.next=n),o.pending=n,n=to(e),nm(e,null,a),n}return eo(e,o,n,a),to(e)}function Ii(e,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var o=n.lanes;o&=e.pendingLanes,a|=o,n.lanes=a,Hl(e,a)}}function ku(e,n){var a=e.updateQueue,o=e.alternate;if(o!==null&&(o=o.updateQueue,a===o)){var h=null,p=null;if(a=a.firstBaseUpdate,a!==null){do{var w={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};p===null?h=p=w:p=p.next=w,a=a.next}while(a!==null);p===null?h=p=n:p=p.next=n}else h=p=n;a={baseState:o.baseState,firstBaseUpdate:h,lastBaseUpdate:p,shared:o.shared,callbacks:o.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=n:e.next=n,a.lastBaseUpdate=n}var ju=!1;function Yi(){if(ju){var e=Ya;if(e!==null)throw e}}function qi(e,n,a,o){ju=!1;var h=e.updateQueue;kr=!1;var p=h.firstBaseUpdate,w=h.lastBaseUpdate,N=h.shared.pending;if(N!==null){h.shared.pending=null;var U=N,P=U.next;U.next=null,w===null?p=P:w.next=P,w=U;var ie=e.alternate;ie!==null&&(ie=ie.updateQueue,N=ie.lastBaseUpdate,N!==w&&(N===null?ie.firstBaseUpdate=P:N.next=P,ie.lastBaseUpdate=U))}if(p!==null){var ce=h.baseState;w=0,ie=P=U=null,N=p;do{var ee=N.lane&-536870913,le=ee!==N.lane;if(le?(ut&ee)===ee:(o&ee)===ee){ee!==0&&ee===Ia&&(ju=!0),ie!==null&&(ie=ie.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var Re=e,Ve=N;ee=n;var Tt=a;switch(Ve.tag){case 1:if(Re=Ve.payload,typeof Re=="function"){ce=Re.call(Tt,ce,ee);break e}ce=Re;break e;case 3:Re.flags=Re.flags&-65537|128;case 0:if(Re=Ve.payload,ee=typeof Re=="function"?Re.call(Tt,ce,ee):Re,ee==null)break e;ce=y({},ce,ee);break e;case 2:kr=!0}}ee=N.callback,ee!==null&&(e.flags|=64,le&&(e.flags|=8192),le=h.callbacks,le===null?h.callbacks=[ee]:le.push(ee))}else le={lane:ee,tag:N.tag,payload:N.payload,callback:N.callback,next:null},ie===null?(P=ie=le,U=ce):ie=ie.next=le,w|=ee;if(N=N.next,N===null){if(N=h.shared.pending,N===null)break;le=N,N=le.next,le.next=null,h.lastBaseUpdate=le,h.shared.pending=null}}while(!0);ie===null&&(U=ce),h.baseState=U,h.firstBaseUpdate=P,h.lastBaseUpdate=ie,p===null&&(h.shared.lanes=0),Tr|=w,e.lanes=w,e.memoizedState=ce}}function vm(e,n){if(typeof e!="function")throw Error(i(191,e));e.call(n)}function wm(e,n){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)vm(a[e],n)}var Va=R(null),fo=R(0);function km(e,n){e=lr,T(fo,e),T(Va,n),lr=e|n.baseLanes}function Su(){T(fo,lr),T(Va,Va.current)}function Cu(){lr=fo.current,K(Va),K(fo)}var In=R(null),rl=null;function Cr(e){var n=e.alternate;T(Kt,Kt.current&1),T(In,e),rl===null&&(n===null||Va.current!==null||n.memoizedState!==null)&&(rl=e)}function Eu(e){T(Kt,Kt.current),T(In,e),rl===null&&(rl=e)}function jm(e){e.tag===22?(T(Kt,Kt.current),T(In,e),rl===null&&(rl=e)):Er()}function Er(){T(Kt,Kt.current),T(In,In.current)}function Yn(e){K(In),rl===e&&(rl=null),K(Kt)}var Kt=R(0);function ho(e){for(var n=e;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Md(a)||Fd(a)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var Ql=0,et=null,Nt=null,tn=null,mo=!1,Ga=!1,da=!1,xo=0,Xi=0,Ka=null,Nb=0;function Xt(){throw Error(i(321))}function Nu(e,n){if(n===null)return!1;for(var a=0;a<n.length&&a<e.length;a++)if(!Hn(e[a],n[a]))return!1;return!0}function Au(e,n,a,o,h,p){return Ql=p,et=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,L.H=e===null||e.memoizedState===null?ix:Yu,da=!1,p=a(o,h),da=!1,Ga&&(p=Cm(n,a,o,h)),Sm(e),p}function Sm(e){L.H=Ki;var n=Nt!==null&&Nt.next!==null;if(Ql=0,tn=Nt=et=null,mo=!1,Xi=0,Ka=null,n)throw Error(i(300));e===null||nn||(e=e.dependencies,e!==null&&ro(e)&&(nn=!0))}function Cm(e,n,a,o){et=e;var h=0;do{if(Ga&&(Ka=null),Xi=0,Ga=!1,25<=h)throw Error(i(301));if(h+=1,tn=Nt=null,e.updateQueue!=null){var p=e.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}L.H=sx,p=n(a,o)}while(Ga);return p}function Ab(){var e=L.H,n=e.useState()[0];return n=typeof n.then=="function"?Vi(n):n,e=e.useState()[0],(Nt!==null?Nt.memoizedState:null)!==e&&(et.flags|=1024),n}function Tu(){var e=xo!==0;return xo=0,e}function Du(e,n,a){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~a}function zu(e){if(mo){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}mo=!1}Ql=0,tn=Nt=et=null,Ga=!1,Xi=xo=0,Ka=null}function Cn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return tn===null?et.memoizedState=tn=e:tn=tn.next=e,tn}function Qt(){if(Nt===null){var e=et.alternate;e=e!==null?e.memoizedState:null}else e=Nt.next;var n=tn===null?et.memoizedState:tn.next;if(n!==null)tn=n,Nt=e;else{if(e===null)throw et.alternate===null?Error(i(467)):Error(i(310));Nt=e,e={memoizedState:Nt.memoizedState,baseState:Nt.baseState,baseQueue:Nt.baseQueue,queue:Nt.queue,next:null},tn===null?et.memoizedState=tn=e:tn=tn.next=e}return tn}function po(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Vi(e){var n=Xi;return Xi+=1,Ka===null&&(Ka=[]),e=xm(Ka,e,n),n=et,(tn===null?n.memoizedState:tn.next)===null&&(n=n.alternate,L.H=n===null||n.memoizedState===null?ix:Yu),e}function yo(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Vi(e);if(e.$$typeof===F)return xn(e)}throw Error(i(438,String(e)))}function Mu(e){var n=null,a=et.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var o=et.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(n={data:o.data.map(function(h){return h.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),a===null&&(a=po(),et.updateQueue=a),a.memoCache=n,a=n.data[n.index],a===void 0)for(a=n.data[n.index]=Array(e),o=0;o<e;o++)a[o]=D;return n.index++,a}function Wl(e,n){return typeof n=="function"?n(e):n}function go(e){var n=Qt();return Fu(n,Nt,e)}function Fu(e,n,a){var o=e.queue;if(o===null)throw Error(i(311));o.lastRenderedReducer=a;var h=e.baseQueue,p=o.pending;if(p!==null){if(h!==null){var w=h.next;h.next=p.next,p.next=w}n.baseQueue=h=p,o.pending=null}if(p=e.baseState,h===null)e.memoizedState=p;else{n=h.next;var N=w=null,U=null,P=n,ie=!1;do{var ce=P.lane&-536870913;if(ce!==P.lane?(ut&ce)===ce:(Ql&ce)===ce){var ee=P.revertLane;if(ee===0)U!==null&&(U=U.next={lane:0,revertLane:0,gesture:null,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null}),ce===Ia&&(ie=!0);else if((Ql&ee)===ee){P=P.next,ee===Ia&&(ie=!0);continue}else ce={lane:0,revertLane:P.revertLane,gesture:null,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null},U===null?(N=U=ce,w=p):U=U.next=ce,et.lanes|=ee,Tr|=ee;ce=P.action,da&&a(p,ce),p=P.hasEagerState?P.eagerState:a(p,ce)}else ee={lane:ce,revertLane:P.revertLane,gesture:P.gesture,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null},U===null?(N=U=ee,w=p):U=U.next=ee,et.lanes|=ce,Tr|=ce;P=P.next}while(P!==null&&P!==n);if(U===null?w=p:U.next=N,!Hn(p,e.memoizedState)&&(nn=!0,ie&&(a=Ya,a!==null)))throw a;e.memoizedState=p,e.baseState=w,e.baseQueue=U,o.lastRenderedState=p}return h===null&&(o.lanes=0),[e.memoizedState,o.dispatch]}function Ru(e){var n=Qt(),a=n.queue;if(a===null)throw Error(i(311));a.lastRenderedReducer=e;var o=a.dispatch,h=a.pending,p=n.memoizedState;if(h!==null){a.pending=null;var w=h=h.next;do p=e(p,w.action),w=w.next;while(w!==h);Hn(p,n.memoizedState)||(nn=!0),n.memoizedState=p,n.baseQueue===null&&(n.baseState=p),a.lastRenderedState=p}return[p,o]}function Em(e,n,a){var o=et,h=Qt(),p=xt;if(p){if(a===void 0)throw Error(i(407));a=a()}else a=n();var w=!Hn((Nt||h).memoizedState,a);if(w&&(h.memoizedState=a,nn=!0),h=h.queue,Bu(Tm.bind(null,o,h,e),[e]),h.getSnapshot!==n||w||tn!==null&&tn.memoizedState.tag&1){if(o.flags|=2048,Qa(9,{destroy:void 0},Am.bind(null,o,h,a,n),null),zt===null)throw Error(i(349));p||(Ql&127)!==0||Nm(o,n,a)}return a}function Nm(e,n,a){e.flags|=16384,e={getSnapshot:n,value:a},n=et.updateQueue,n===null?(n=po(),et.updateQueue=n,n.stores=[e]):(a=n.stores,a===null?n.stores=[e]:a.push(e))}function Am(e,n,a,o){n.value=a,n.getSnapshot=o,Dm(n)&&zm(e)}function Tm(e,n,a){return a(function(){Dm(n)&&zm(e)})}function Dm(e){var n=e.getSnapshot;e=e.value;try{var a=n();return!Hn(e,a)}catch{return!0}}function zm(e){var n=na(e,2);n!==null&&On(n,e,2)}function _u(e){var n=Cn();if(typeof e=="function"){var a=e;if(e=a(),da){ht(!0);try{a()}finally{ht(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wl,lastRenderedState:e},n}function Mm(e,n,a,o){return e.baseState=a,Fu(e,Nt,typeof o=="function"?o:Wl)}function Tb(e,n,a,o,h){if(wo(e))throw Error(i(485));if(e=n.action,e!==null){var p={payload:h,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){p.listeners.push(w)}};L.T!==null?a(!0):p.isTransition=!1,o(p),a=n.pending,a===null?(p.next=n.pending=p,Fm(n,p)):(p.next=a.next,n.pending=a.next=p)}}function Fm(e,n){var a=n.action,o=n.payload,h=e.state;if(n.isTransition){var p=L.T,w={};L.T=w;try{var N=a(h,o),U=L.S;U!==null&&U(w,N),Rm(e,n,N)}catch(P){Ou(e,n,P)}finally{p!==null&&w.types!==null&&(p.types=w.types),L.T=p}}else try{p=a(h,o),Rm(e,n,p)}catch(P){Ou(e,n,P)}}function Rm(e,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(o){_m(e,n,o)},function(o){return Ou(e,n,o)}):_m(e,n,a)}function _m(e,n,a){n.status="fulfilled",n.value=a,Om(n),e.state=a,n=e.pending,n!==null&&(a=n.next,a===n?e.pending=null:(a=a.next,n.next=a,Fm(e,a)))}function Ou(e,n,a){var o=e.pending;if(e.pending=null,o!==null){o=o.next;do n.status="rejected",n.reason=a,Om(n),n=n.next;while(n!==o)}e.action=null}function Om(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function Bm(e,n){return n}function Lm(e,n){if(xt){var a=zt.formState;if(a!==null){e:{var o=et;if(xt){if(Bt){t:{for(var h=Bt,p=ll;h.nodeType!==8;){if(!p){h=null;break t}if(h=al(h.nextSibling),h===null){h=null;break t}}p=h.data,h=p==="F!"||p==="F"?h:null}if(h){Bt=al(h.nextSibling),o=h.data==="F!";break e}}vr(o)}o=!1}o&&(n=a[0])}}return a=Cn(),a.memoizedState=a.baseState=n,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bm,lastRenderedState:n},a.queue=o,a=lx.bind(null,et,o),o.dispatch=a,o=_u(!1),p=Iu.bind(null,et,!1,o.queue),o=Cn(),h={state:n,dispatch:null,action:e,pending:null},o.queue=h,a=Tb.bind(null,et,h,p,a),h.dispatch=a,o.memoizedState=e,[n,a,!1]}function $m(e){var n=Qt();return Hm(n,Nt,e)}function Hm(e,n,a){if(n=Fu(e,n,Bm)[0],e=go(Wl)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var o=Vi(n)}catch(w){throw w===qa?so:w}else o=n;n=Qt();var h=n.queue,p=h.dispatch;return a!==n.memoizedState&&(et.flags|=2048,Qa(9,{destroy:void 0},Db.bind(null,h,a),null)),[o,p,e]}function Db(e,n){e.action=n}function Um(e){var n=Qt(),a=Nt;if(a!==null)return Hm(n,a,e);Qt(),n=n.memoizedState,a=Qt();var o=a.queue.dispatch;return a.memoizedState=e,[n,o,!1]}function Qa(e,n,a,o){return e={tag:e,create:a,deps:o,inst:n,next:null},n=et.updateQueue,n===null&&(n=po(),et.updateQueue=n),a=n.lastEffect,a===null?n.lastEffect=e.next=e:(o=a.next,a.next=e,e.next=o,n.lastEffect=e),e}function Im(){return Qt().memoizedState}function bo(e,n,a,o){var h=Cn();et.flags|=e,h.memoizedState=Qa(1|n,{destroy:void 0},a,o===void 0?null:o)}function vo(e,n,a,o){var h=Qt();o=o===void 0?null:o;var p=h.memoizedState.inst;Nt!==null&&o!==null&&Nu(o,Nt.memoizedState.deps)?h.memoizedState=Qa(n,p,a,o):(et.flags|=e,h.memoizedState=Qa(1|n,p,a,o))}function Ym(e,n){bo(8390656,8,e,n)}function Bu(e,n){vo(2048,8,e,n)}function zb(e){et.flags|=4;var n=et.updateQueue;if(n===null)n=po(),et.updateQueue=n,n.events=[e];else{var a=n.events;a===null?n.events=[e]:a.push(e)}}function qm(e){var n=Qt().memoizedState;return zb({ref:n,nextImpl:e}),function(){if((kt&2)!==0)throw Error(i(440));return n.impl.apply(void 0,arguments)}}function Xm(e,n){return vo(4,2,e,n)}function Vm(e,n){return vo(4,4,e,n)}function Gm(e,n){if(typeof n=="function"){e=e();var a=n(e);return function(){typeof a=="function"?a():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function Km(e,n,a){a=a!=null?a.concat([e]):null,vo(4,4,Gm.bind(null,n,e),a)}function Lu(){}function Qm(e,n){var a=Qt();n=n===void 0?null:n;var o=a.memoizedState;return n!==null&&Nu(n,o[1])?o[0]:(a.memoizedState=[e,n],e)}function Wm(e,n){var a=Qt();n=n===void 0?null:n;var o=a.memoizedState;if(n!==null&&Nu(n,o[1]))return o[0];if(o=e(),da){ht(!0);try{e()}finally{ht(!1)}}return a.memoizedState=[o,n],o}function $u(e,n,a){return a===void 0||(Ql&1073741824)!==0&&(ut&261930)===0?e.memoizedState=n:(e.memoizedState=a,e=Zx(),et.lanes|=e,Tr|=e,a)}function Zm(e,n,a,o){return Hn(a,n)?a:Va.current!==null?(e=$u(e,a,o),Hn(e,n)||(nn=!0),e):(Ql&42)===0||(Ql&1073741824)!==0&&(ut&261930)===0?(nn=!0,e.memoizedState=a):(e=Zx(),et.lanes|=e,Tr|=e,n)}function Jm(e,n,a,o,h){var p=Z.p;Z.p=p!==0&&8>p?p:8;var w=L.T,N={};L.T=N,Iu(e,!1,n,a);try{var U=h(),P=L.S;if(P!==null&&P(N,U),U!==null&&typeof U=="object"&&typeof U.then=="function"){var ie=Eb(U,o);Gi(e,n,ie,Vn(e))}else Gi(e,n,o,Vn(e))}catch(ce){Gi(e,n,{then:function(){},status:"rejected",reason:ce},Vn())}finally{Z.p=p,w!==null&&N.types!==null&&(w.types=N.types),L.T=w}}function Mb(){}function Hu(e,n,a,o){if(e.tag!==5)throw Error(i(476));var h=Pm(e).queue;Jm(e,h,n,de,a===null?Mb:function(){return ex(e),a(o)})}function Pm(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:de,baseState:de,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wl,lastRenderedState:de},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wl,lastRenderedState:a},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function ex(e){var n=Pm(e);n.next===null&&(n=e.alternate.memoizedState),Gi(e,n.next.queue,{},Vn())}function Uu(){return xn(us)}function tx(){return Qt().memoizedState}function nx(){return Qt().memoizedState}function Fb(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var a=Vn();e=jr(a);var o=Sr(n,e,a);o!==null&&(On(o,n,a),Ii(o,n,a)),n={cache:pu()},e.payload=n;return}n=n.return}}function Rb(e,n,a){var o=Vn();a={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},wo(e)?rx(n,a):(a=au(e,n,a,o),a!==null&&(On(a,e,o),ax(a,n,o)))}function lx(e,n,a){var o=Vn();Gi(e,n,a,o)}function Gi(e,n,a,o){var h={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(wo(e))rx(n,h);else{var p=e.alternate;if(e.lanes===0&&(p===null||p.lanes===0)&&(p=n.lastRenderedReducer,p!==null))try{var w=n.lastRenderedState,N=p(w,a);if(h.hasEagerState=!0,h.eagerState=N,Hn(N,w))return eo(e,n,h,0),zt===null&&Ps(),!1}catch{}finally{}if(a=au(e,n,h,o),a!==null)return On(a,e,o),ax(a,n,o),!0}return!1}function Iu(e,n,a,o){if(o={lane:2,revertLane:vd(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},wo(e)){if(n)throw Error(i(479))}else n=au(e,a,o,2),n!==null&&On(n,e,2)}function wo(e){var n=e.alternate;return e===et||n!==null&&n===et}function rx(e,n){Ga=mo=!0;var a=e.pending;a===null?n.next=n:(n.next=a.next,a.next=n),e.pending=n}function ax(e,n,a){if((a&4194048)!==0){var o=n.lanes;o&=e.pendingLanes,a|=o,n.lanes=a,Hl(e,a)}}var Ki={readContext:xn,use:yo,useCallback:Xt,useContext:Xt,useEffect:Xt,useImperativeHandle:Xt,useLayoutEffect:Xt,useInsertionEffect:Xt,useMemo:Xt,useReducer:Xt,useRef:Xt,useState:Xt,useDebugValue:Xt,useDeferredValue:Xt,useTransition:Xt,useSyncExternalStore:Xt,useId:Xt,useHostTransitionStatus:Xt,useFormState:Xt,useActionState:Xt,useOptimistic:Xt,useMemoCache:Xt,useCacheRefresh:Xt};Ki.useEffectEvent=Xt;var ix={readContext:xn,use:yo,useCallback:function(e,n){return Cn().memoizedState=[e,n===void 0?null:n],e},useContext:xn,useEffect:Ym,useImperativeHandle:function(e,n,a){a=a!=null?a.concat([e]):null,bo(4194308,4,Gm.bind(null,n,e),a)},useLayoutEffect:function(e,n){return bo(4194308,4,e,n)},useInsertionEffect:function(e,n){bo(4,2,e,n)},useMemo:function(e,n){var a=Cn();n=n===void 0?null:n;var o=e();if(da){ht(!0);try{e()}finally{ht(!1)}}return a.memoizedState=[o,n],o},useReducer:function(e,n,a){var o=Cn();if(a!==void 0){var h=a(n);if(da){ht(!0);try{a(n)}finally{ht(!1)}}}else h=n;return o.memoizedState=o.baseState=h,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:h},o.queue=e,e=e.dispatch=Rb.bind(null,et,e),[o.memoizedState,e]},useRef:function(e){var n=Cn();return e={current:e},n.memoizedState=e},useState:function(e){e=_u(e);var n=e.queue,a=lx.bind(null,et,n);return n.dispatch=a,[e.memoizedState,a]},useDebugValue:Lu,useDeferredValue:function(e,n){var a=Cn();return $u(a,e,n)},useTransition:function(){var e=_u(!1);return e=Jm.bind(null,et,e.queue,!0,!1),Cn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,a){var o=et,h=Cn();if(xt){if(a===void 0)throw Error(i(407));a=a()}else{if(a=n(),zt===null)throw Error(i(349));(ut&127)!==0||Nm(o,n,a)}h.memoizedState=a;var p={value:a,getSnapshot:n};return h.queue=p,Ym(Tm.bind(null,o,p,e),[e]),o.flags|=2048,Qa(9,{destroy:void 0},Am.bind(null,o,p,a,n),null),a},useId:function(){var e=Cn(),n=zt.identifierPrefix;if(xt){var a=Al,o=Nl;a=(o&~(1<<32-Pe(o)-1)).toString(32)+a,n="_"+n+"R_"+a,a=xo++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=Nb++,n="_"+n+"r_"+a.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:Uu,useFormState:Lm,useActionState:Lm,useOptimistic:function(e){var n=Cn();n.memoizedState=n.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=Iu.bind(null,et,!0,a),a.dispatch=n,[e,n]},useMemoCache:Mu,useCacheRefresh:function(){return Cn().memoizedState=Fb.bind(null,et)},useEffectEvent:function(e){var n=Cn(),a={impl:e};return n.memoizedState=a,function(){if((kt&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}},Yu={readContext:xn,use:yo,useCallback:Qm,useContext:xn,useEffect:Bu,useImperativeHandle:Km,useInsertionEffect:Xm,useLayoutEffect:Vm,useMemo:Wm,useReducer:go,useRef:Im,useState:function(){return go(Wl)},useDebugValue:Lu,useDeferredValue:function(e,n){var a=Qt();return Zm(a,Nt.memoizedState,e,n)},useTransition:function(){var e=go(Wl)[0],n=Qt().memoizedState;return[typeof e=="boolean"?e:Vi(e),n]},useSyncExternalStore:Em,useId:tx,useHostTransitionStatus:Uu,useFormState:$m,useActionState:$m,useOptimistic:function(e,n){var a=Qt();return Mm(a,Nt,e,n)},useMemoCache:Mu,useCacheRefresh:nx};Yu.useEffectEvent=qm;var sx={readContext:xn,use:yo,useCallback:Qm,useContext:xn,useEffect:Bu,useImperativeHandle:Km,useInsertionEffect:Xm,useLayoutEffect:Vm,useMemo:Wm,useReducer:Ru,useRef:Im,useState:function(){return Ru(Wl)},useDebugValue:Lu,useDeferredValue:function(e,n){var a=Qt();return Nt===null?$u(a,e,n):Zm(a,Nt.memoizedState,e,n)},useTransition:function(){var e=Ru(Wl)[0],n=Qt().memoizedState;return[typeof e=="boolean"?e:Vi(e),n]},useSyncExternalStore:Em,useId:tx,useHostTransitionStatus:Uu,useFormState:Um,useActionState:Um,useOptimistic:function(e,n){var a=Qt();return Nt!==null?Mm(a,Nt,e,n):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:Mu,useCacheRefresh:nx};sx.useEffectEvent=qm;function qu(e,n,a,o){n=e.memoizedState,a=a(o,n),a=a==null?n:y({},n,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Xu={enqueueSetState:function(e,n,a){e=e._reactInternals;var o=Vn(),h=jr(o);h.payload=n,a!=null&&(h.callback=a),n=Sr(e,h,o),n!==null&&(On(n,e,o),Ii(n,e,o))},enqueueReplaceState:function(e,n,a){e=e._reactInternals;var o=Vn(),h=jr(o);h.tag=1,h.payload=n,a!=null&&(h.callback=a),n=Sr(e,h,o),n!==null&&(On(n,e,o),Ii(n,e,o))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var a=Vn(),o=jr(a);o.tag=2,n!=null&&(o.callback=n),n=Sr(e,o,a),n!==null&&(On(n,e,a),Ii(n,e,a))}};function ox(e,n,a,o,h,p,w){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(o,p,w):n.prototype&&n.prototype.isPureReactComponent?!Ri(a,o)||!Ri(h,p):!0}function cx(e,n,a,o){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,o),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,o),n.state!==e&&Xu.enqueueReplaceState(n,n.state,null)}function fa(e,n){var a=n;if("ref"in n){a={};for(var o in n)o!=="ref"&&(a[o]=n[o])}if(e=e.defaultProps){a===n&&(a=y({},a));for(var h in e)a[h]===void 0&&(a[h]=e[h])}return a}function ux(e){Js(e)}function dx(e){console.error(e)}function fx(e){Js(e)}function ko(e,n){try{var a=e.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(o){setTimeout(function(){throw o})}}function hx(e,n,a){try{var o=e.onCaughtError;o(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(h){setTimeout(function(){throw h})}}function Vu(e,n,a){return a=jr(a),a.tag=3,a.payload={element:null},a.callback=function(){ko(e,n)},a}function mx(e){return e=jr(e),e.tag=3,e}function xx(e,n,a,o){var h=a.type.getDerivedStateFromError;if(typeof h=="function"){var p=o.value;e.payload=function(){return h(p)},e.callback=function(){hx(n,a,o)}}var w=a.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(e.callback=function(){hx(n,a,o),typeof h!="function"&&(Dr===null?Dr=new Set([this]):Dr.add(this));var N=o.stack;this.componentDidCatch(o.value,{componentStack:N!==null?N:""})})}function _b(e,n,a,o,h){if(a.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(n=a.alternate,n!==null&&Ua(n,a,h,!0),a=In.current,a!==null){switch(a.tag){case 31:case 13:return rl===null?Ro():a.alternate===null&&Vt===0&&(Vt=3),a.flags&=-257,a.flags|=65536,a.lanes=h,o===oo?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([o]):n.add(o),yd(e,o,h)),!1;case 22:return a.flags|=65536,o===oo?a.flags|=16384:(n=a.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([o])},a.updateQueue=n):(a=n.retryQueue,a===null?n.retryQueue=new Set([o]):a.add(o)),yd(e,o,h)),!1}throw Error(i(435,a.tag))}return yd(e,o,h),Ro(),!1}if(xt)return n=In.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=h,o!==du&&(e=Error(i(422),{cause:o}),Bi(el(e,a)))):(o!==du&&(n=Error(i(423),{cause:o}),Bi(el(n,a))),e=e.current.alternate,e.flags|=65536,h&=-h,e.lanes|=h,o=el(o,a),h=Vu(e.stateNode,o,h),ku(e,h),Vt!==4&&(Vt=2)),!1;var p=Error(i(520),{cause:o});if(p=el(p,a),ns===null?ns=[p]:ns.push(p),Vt!==4&&(Vt=2),n===null)return!0;o=el(o,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,e=h&-h,a.lanes|=e,e=Vu(a.stateNode,o,e),ku(a,e),!1;case 1:if(n=a.type,p=a.stateNode,(a.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(Dr===null||!Dr.has(p))))return a.flags|=65536,h&=-h,a.lanes|=h,h=mx(h),xx(h,e,a,o),ku(a,h),!1}a=a.return}while(a!==null);return!1}var Gu=Error(i(461)),nn=!1;function pn(e,n,a,o){n.child=e===null?bm(n,null,a,o):ua(n,e.child,a,o)}function px(e,n,a,o,h){a=a.render;var p=n.ref;if("ref"in o){var w={};for(var N in o)N!=="ref"&&(w[N]=o[N])}else w=o;return ia(n),o=Au(e,n,a,w,p,h),N=Tu(),e!==null&&!nn?(Du(e,n,h),Zl(e,n,h)):(xt&&N&&cu(n),n.flags|=1,pn(e,n,o,h),n.child)}function yx(e,n,a,o,h){if(e===null){var p=a.type;return typeof p=="function"&&!iu(p)&&p.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=p,gx(e,n,p,o,h)):(e=no(a.type,null,o,n,n.mode,h),e.ref=n.ref,e.return=n,n.child=e)}if(p=e.child,!td(e,h)){var w=p.memoizedProps;if(a=a.compare,a=a!==null?a:Ri,a(w,o)&&e.ref===n.ref)return Zl(e,n,h)}return n.flags|=1,e=Xl(p,o),e.ref=n.ref,e.return=n,n.child=e}function gx(e,n,a,o,h){if(e!==null){var p=e.memoizedProps;if(Ri(p,o)&&e.ref===n.ref)if(nn=!1,n.pendingProps=o=p,td(e,h))(e.flags&131072)!==0&&(nn=!0);else return n.lanes=e.lanes,Zl(e,n,h)}return Ku(e,n,a,o,h)}function bx(e,n,a,o){var h=o.children,p=e!==null?e.memoizedState:null;if(e===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((n.flags&128)!==0){if(p=p!==null?p.baseLanes|a:a,e!==null){for(o=n.child=e.child,h=0;o!==null;)h=h|o.lanes|o.childLanes,o=o.sibling;o=h&~p}else o=0,n.child=null;return vx(e,n,p,a,o)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&io(n,p!==null?p.cachePool:null),p!==null?km(n,p):Su(),jm(n);else return o=n.lanes=536870912,vx(e,n,p!==null?p.baseLanes|a:a,a,o)}else p!==null?(io(n,p.cachePool),km(n,p),Er(),n.memoizedState=null):(e!==null&&io(n,null),Su(),Er());return pn(e,n,h,a),n.child}function Qi(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function vx(e,n,a,o,h){var p=gu();return p=p===null?null:{parent:en._currentValue,pool:p},n.memoizedState={baseLanes:a,cachePool:p},e!==null&&io(n,null),Su(),jm(n),e!==null&&Ua(e,n,o,!0),n.childLanes=h,null}function jo(e,n){return n=Co({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function wx(e,n,a){return ua(n,e.child,null,a),e=jo(n,n.pendingProps),e.flags|=2,Yn(n),n.memoizedState=null,e}function Ob(e,n,a){var o=n.pendingProps,h=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(xt){if(o.mode==="hidden")return e=jo(n,o),n.lanes=536870912,Qi(null,e);if(Eu(n),(e=Bt)?(e=Fp(e,ll),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:gr!==null?{id:Nl,overflow:Al}:null,retryLane:536870912,hydrationErrors:null},a=rm(e),a.return=n,n.child=a,mn=n,Bt=null)):e=null,e===null)throw vr(n);return n.lanes=536870912,null}return jo(n,o)}var p=e.memoizedState;if(p!==null){var w=p.dehydrated;if(Eu(n),h)if(n.flags&256)n.flags&=-257,n=wx(e,n,a);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(i(558));else if(nn||Ua(e,n,a,!1),h=(a&e.childLanes)!==0,nn||h){if(o=zt,o!==null&&(w=Ca(o,a),w!==0&&w!==p.retryLane))throw p.retryLane=w,na(e,w),On(o,e,w),Gu;Ro(),n=wx(e,n,a)}else e=p.treeContext,Bt=al(w.nextSibling),mn=n,xt=!0,br=null,ll=!1,e!==null&&sm(n,e),n=jo(n,o),n.flags|=4096;return n}return e=Xl(e.child,{mode:o.mode,children:o.children}),e.ref=n.ref,n.child=e,e.return=n,e}function So(e,n){var a=n.ref;if(a===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(i(284));(e===null||e.ref!==a)&&(n.flags|=4194816)}}function Ku(e,n,a,o,h){return ia(n),a=Au(e,n,a,o,void 0,h),o=Tu(),e!==null&&!nn?(Du(e,n,h),Zl(e,n,h)):(xt&&o&&cu(n),n.flags|=1,pn(e,n,a,h),n.child)}function kx(e,n,a,o,h,p){return ia(n),n.updateQueue=null,a=Cm(n,o,a,h),Sm(e),o=Tu(),e!==null&&!nn?(Du(e,n,p),Zl(e,n,p)):(xt&&o&&cu(n),n.flags|=1,pn(e,n,a,p),n.child)}function jx(e,n,a,o,h){if(ia(n),n.stateNode===null){var p=Ba,w=a.contextType;typeof w=="object"&&w!==null&&(p=xn(w)),p=new a(o,p),n.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=Xu,n.stateNode=p,p._reactInternals=n,p=n.stateNode,p.props=o,p.state=n.memoizedState,p.refs={},vu(n),w=a.contextType,p.context=typeof w=="object"&&w!==null?xn(w):Ba,p.state=n.memoizedState,w=a.getDerivedStateFromProps,typeof w=="function"&&(qu(n,a,w,o),p.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(w=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),w!==p.state&&Xu.enqueueReplaceState(p,p.state,null),qi(n,o,p,h),Yi(),p.state=n.memoizedState),typeof p.componentDidMount=="function"&&(n.flags|=4194308),o=!0}else if(e===null){p=n.stateNode;var N=n.memoizedProps,U=fa(a,N);p.props=U;var P=p.context,ie=a.contextType;w=Ba,typeof ie=="object"&&ie!==null&&(w=xn(ie));var ce=a.getDerivedStateFromProps;ie=typeof ce=="function"||typeof p.getSnapshotBeforeUpdate=="function",N=n.pendingProps!==N,ie||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(N||P!==w)&&cx(n,p,o,w),kr=!1;var ee=n.memoizedState;p.state=ee,qi(n,o,p,h),Yi(),P=n.memoizedState,N||ee!==P||kr?(typeof ce=="function"&&(qu(n,a,ce,o),P=n.memoizedState),(U=kr||ox(n,a,U,o,ee,P,w))?(ie||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(n.flags|=4194308)):(typeof p.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=o,n.memoizedState=P),p.props=o,p.state=P,p.context=w,o=U):(typeof p.componentDidMount=="function"&&(n.flags|=4194308),o=!1)}else{p=n.stateNode,wu(e,n),w=n.memoizedProps,ie=fa(a,w),p.props=ie,ce=n.pendingProps,ee=p.context,P=a.contextType,U=Ba,typeof P=="object"&&P!==null&&(U=xn(P)),N=a.getDerivedStateFromProps,(P=typeof N=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(w!==ce||ee!==U)&&cx(n,p,o,U),kr=!1,ee=n.memoizedState,p.state=ee,qi(n,o,p,h),Yi();var le=n.memoizedState;w!==ce||ee!==le||kr||e!==null&&e.dependencies!==null&&ro(e.dependencies)?(typeof N=="function"&&(qu(n,a,N,o),le=n.memoizedState),(ie=kr||ox(n,a,ie,o,ee,le,U)||e!==null&&e.dependencies!==null&&ro(e.dependencies))?(P||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(o,le,U),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(o,le,U)),typeof p.componentDidUpdate=="function"&&(n.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof p.componentDidUpdate!="function"||w===e.memoizedProps&&ee===e.memoizedState||(n.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||w===e.memoizedProps&&ee===e.memoizedState||(n.flags|=1024),n.memoizedProps=o,n.memoizedState=le),p.props=o,p.state=le,p.context=U,o=ie):(typeof p.componentDidUpdate!="function"||w===e.memoizedProps&&ee===e.memoizedState||(n.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||w===e.memoizedProps&&ee===e.memoizedState||(n.flags|=1024),o=!1)}return p=o,So(e,n),o=(n.flags&128)!==0,p||o?(p=n.stateNode,a=o&&typeof a.getDerivedStateFromError!="function"?null:p.render(),n.flags|=1,e!==null&&o?(n.child=ua(n,e.child,null,h),n.child=ua(n,null,a,h)):pn(e,n,a,h),n.memoizedState=p.state,e=n.child):e=Zl(e,n,h),e}function Sx(e,n,a,o){return ra(),n.flags|=256,pn(e,n,a,o),n.child}var Qu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Wu(e){return{baseLanes:e,cachePool:hm()}}function Zu(e,n,a){return e=e!==null?e.childLanes&~a:0,n&&(e|=Xn),e}function Cx(e,n,a){var o=n.pendingProps,h=!1,p=(n.flags&128)!==0,w;if((w=p)||(w=e!==null&&e.memoizedState===null?!1:(Kt.current&2)!==0),w&&(h=!0,n.flags&=-129),w=(n.flags&32)!==0,n.flags&=-33,e===null){if(xt){if(h?Cr(n):Er(),(e=Bt)?(e=Fp(e,ll),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:gr!==null?{id:Nl,overflow:Al}:null,retryLane:536870912,hydrationErrors:null},a=rm(e),a.return=n,n.child=a,mn=n,Bt=null)):e=null,e===null)throw vr(n);return Fd(e)?n.lanes=32:n.lanes=536870912,null}var N=o.children;return o=o.fallback,h?(Er(),h=n.mode,N=Co({mode:"hidden",children:N},h),o=la(o,h,a,null),N.return=n,o.return=n,N.sibling=o,n.child=N,o=n.child,o.memoizedState=Wu(a),o.childLanes=Zu(e,w,a),n.memoizedState=Qu,Qi(null,o)):(Cr(n),Ju(n,N))}var U=e.memoizedState;if(U!==null&&(N=U.dehydrated,N!==null)){if(p)n.flags&256?(Cr(n),n.flags&=-257,n=Pu(e,n,a)):n.memoizedState!==null?(Er(),n.child=e.child,n.flags|=128,n=null):(Er(),N=o.fallback,h=n.mode,o=Co({mode:"visible",children:o.children},h),N=la(N,h,a,null),N.flags|=2,o.return=n,N.return=n,o.sibling=N,n.child=o,ua(n,e.child,null,a),o=n.child,o.memoizedState=Wu(a),o.childLanes=Zu(e,w,a),n.memoizedState=Qu,n=Qi(null,o));else if(Cr(n),Fd(N)){if(w=N.nextSibling&&N.nextSibling.dataset,w)var P=w.dgst;w=P,o=Error(i(419)),o.stack="",o.digest=w,Bi({value:o,source:null,stack:null}),n=Pu(e,n,a)}else if(nn||Ua(e,n,a,!1),w=(a&e.childLanes)!==0,nn||w){if(w=zt,w!==null&&(o=Ca(w,a),o!==0&&o!==U.retryLane))throw U.retryLane=o,na(e,o),On(w,e,o),Gu;Md(N)||Ro(),n=Pu(e,n,a)}else Md(N)?(n.flags|=192,n.child=e.child,n=null):(e=U.treeContext,Bt=al(N.nextSibling),mn=n,xt=!0,br=null,ll=!1,e!==null&&sm(n,e),n=Ju(n,o.children),n.flags|=4096);return n}return h?(Er(),N=o.fallback,h=n.mode,U=e.child,P=U.sibling,o=Xl(U,{mode:"hidden",children:o.children}),o.subtreeFlags=U.subtreeFlags&65011712,P!==null?N=Xl(P,N):(N=la(N,h,a,null),N.flags|=2),N.return=n,o.return=n,o.sibling=N,n.child=o,Qi(null,o),o=n.child,N=e.child.memoizedState,N===null?N=Wu(a):(h=N.cachePool,h!==null?(U=en._currentValue,h=h.parent!==U?{parent:U,pool:U}:h):h=hm(),N={baseLanes:N.baseLanes|a,cachePool:h}),o.memoizedState=N,o.childLanes=Zu(e,w,a),n.memoizedState=Qu,Qi(e.child,o)):(Cr(n),a=e.child,e=a.sibling,a=Xl(a,{mode:"visible",children:o.children}),a.return=n,a.sibling=null,e!==null&&(w=n.deletions,w===null?(n.deletions=[e],n.flags|=16):w.push(e)),n.child=a,n.memoizedState=null,a)}function Ju(e,n){return n=Co({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function Co(e,n){return e=Un(22,e,null,n),e.lanes=0,e}function Pu(e,n,a){return ua(n,e.child,null,a),e=Ju(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function Ex(e,n,a){e.lanes|=n;var o=e.alternate;o!==null&&(o.lanes|=n),mu(e.return,n,a)}function ed(e,n,a,o,h,p){var w=e.memoizedState;w===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:o,tail:a,tailMode:h,treeForkCount:p}:(w.isBackwards=n,w.rendering=null,w.renderingStartTime=0,w.last=o,w.tail=a,w.tailMode=h,w.treeForkCount=p)}function Nx(e,n,a){var o=n.pendingProps,h=o.revealOrder,p=o.tail;o=o.children;var w=Kt.current,N=(w&2)!==0;if(N?(w=w&1|2,n.flags|=128):w&=1,T(Kt,w),pn(e,n,o,a),o=xt?Oi:0,!N&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Ex(e,a,n);else if(e.tag===19)Ex(e,a,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(h){case"forwards":for(a=n.child,h=null;a!==null;)e=a.alternate,e!==null&&ho(e)===null&&(h=a),a=a.sibling;a=h,a===null?(h=n.child,n.child=null):(h=a.sibling,a.sibling=null),ed(n,!1,h,a,p,o);break;case"backwards":case"unstable_legacy-backwards":for(a=null,h=n.child,n.child=null;h!==null;){if(e=h.alternate,e!==null&&ho(e)===null){n.child=h;break}e=h.sibling,h.sibling=a,a=h,h=e}ed(n,!0,a,null,p,o);break;case"together":ed(n,!1,null,null,void 0,o);break;default:n.memoizedState=null}return n.child}function Zl(e,n,a){if(e!==null&&(n.dependencies=e.dependencies),Tr|=n.lanes,(a&n.childLanes)===0)if(e!==null){if(Ua(e,n,a,!1),(a&n.childLanes)===0)return null}else return null;if(e!==null&&n.child!==e.child)throw Error(i(153));if(n.child!==null){for(e=n.child,a=Xl(e,e.pendingProps),n.child=a,a.return=n;e.sibling!==null;)e=e.sibling,a=a.sibling=Xl(e,e.pendingProps),a.return=n;a.sibling=null}return n.child}function td(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&ro(e)))}function Bb(e,n,a){switch(n.tag){case 3:Be(n,n.stateNode.containerInfo),wr(n,en,e.memoizedState.cache),ra();break;case 27:case 5:Se(n);break;case 4:Be(n,n.stateNode.containerInfo);break;case 10:wr(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,Eu(n),null;break;case 13:var o=n.memoizedState;if(o!==null)return o.dehydrated!==null?(Cr(n),n.flags|=128,null):(a&n.child.childLanes)!==0?Cx(e,n,a):(Cr(n),e=Zl(e,n,a),e!==null?e.sibling:null);Cr(n);break;case 19:var h=(e.flags&128)!==0;if(o=(a&n.childLanes)!==0,o||(Ua(e,n,a,!1),o=(a&n.childLanes)!==0),h){if(o)return Nx(e,n,a);n.flags|=128}if(h=n.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),T(Kt,Kt.current),o)break;return null;case 22:return n.lanes=0,bx(e,n,a,n.pendingProps);case 24:wr(n,en,e.memoizedState.cache)}return Zl(e,n,a)}function Ax(e,n,a){if(e!==null)if(e.memoizedProps!==n.pendingProps)nn=!0;else{if(!td(e,a)&&(n.flags&128)===0)return nn=!1,Bb(e,n,a);nn=(e.flags&131072)!==0}else nn=!1,xt&&(n.flags&1048576)!==0&&im(n,Oi,n.index);switch(n.lanes=0,n.tag){case 16:e:{var o=n.pendingProps;if(e=oa(n.elementType),n.type=e,typeof e=="function")iu(e)?(o=fa(e,o),n.tag=1,n=jx(null,n,e,o,a)):(n.tag=0,n=Ku(null,n,e,o,a));else{if(e!=null){var h=e.$$typeof;if(h===_){n.tag=11,n=px(null,n,e,o,a);break e}else if(h===I){n.tag=14,n=yx(null,n,e,o,a);break e}}throw n=ne(e)||e,Error(i(306,n,""))}}return n;case 0:return Ku(e,n,n.type,n.pendingProps,a);case 1:return o=n.type,h=fa(o,n.pendingProps),jx(e,n,o,h,a);case 3:e:{if(Be(n,n.stateNode.containerInfo),e===null)throw Error(i(387));o=n.pendingProps;var p=n.memoizedState;h=p.element,wu(e,n),qi(n,o,null,a);var w=n.memoizedState;if(o=w.cache,wr(n,en,o),o!==p.cache&&xu(n,[en],a,!0),Yi(),o=w.element,p.isDehydrated)if(p={element:o,isDehydrated:!1,cache:w.cache},n.updateQueue.baseState=p,n.memoizedState=p,n.flags&256){n=Sx(e,n,o,a);break e}else if(o!==h){h=el(Error(i(424)),n),Bi(h),n=Sx(e,n,o,a);break e}else{switch(e=n.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Bt=al(e.firstChild),mn=n,xt=!0,br=null,ll=!0,a=bm(n,null,o,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(ra(),o===h){n=Zl(e,n,a);break e}pn(e,n,o,a)}n=n.child}return n;case 26:return So(e,n),e===null?(a=$p(n.type,null,n.pendingProps,null))?n.memoizedState=a:xt||(a=n.type,e=n.pendingProps,o=Uo(Ne.current).createElement(a),o[Jt]=n,o[hn]=e,yn(o,a,e),Ut(o),n.stateNode=o):n.memoizedState=$p(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return Se(n),e===null&&xt&&(o=n.stateNode=Op(n.type,n.pendingProps,Ne.current),mn=n,ll=!0,h=Bt,Rr(n.type)?(Rd=h,Bt=al(o.firstChild)):Bt=h),pn(e,n,n.pendingProps.children,a),So(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&xt&&((h=o=Bt)&&(o=h2(o,n.type,n.pendingProps,ll),o!==null?(n.stateNode=o,mn=n,Bt=al(o.firstChild),ll=!1,h=!0):h=!1),h||vr(n)),Se(n),h=n.type,p=n.pendingProps,w=e!==null?e.memoizedProps:null,o=p.children,Td(h,p)?o=null:w!==null&&Td(h,w)&&(n.flags|=32),n.memoizedState!==null&&(h=Au(e,n,Ab,null,null,a),us._currentValue=h),So(e,n),pn(e,n,o,a),n.child;case 6:return e===null&&xt&&((e=a=Bt)&&(a=m2(a,n.pendingProps,ll),a!==null?(n.stateNode=a,mn=n,Bt=null,e=!0):e=!1),e||vr(n)),null;case 13:return Cx(e,n,a);case 4:return Be(n,n.stateNode.containerInfo),o=n.pendingProps,e===null?n.child=ua(n,null,o,a):pn(e,n,o,a),n.child;case 11:return px(e,n,n.type,n.pendingProps,a);case 7:return pn(e,n,n.pendingProps,a),n.child;case 8:return pn(e,n,n.pendingProps.children,a),n.child;case 12:return pn(e,n,n.pendingProps.children,a),n.child;case 10:return o=n.pendingProps,wr(n,n.type,o.value),pn(e,n,o.children,a),n.child;case 9:return h=n.type._context,o=n.pendingProps.children,ia(n),h=xn(h),o=o(h),n.flags|=1,pn(e,n,o,a),n.child;case 14:return yx(e,n,n.type,n.pendingProps,a);case 15:return gx(e,n,n.type,n.pendingProps,a);case 19:return Nx(e,n,a);case 31:return Ob(e,n,a);case 22:return bx(e,n,a,n.pendingProps);case 24:return ia(n),o=xn(en),e===null?(h=gu(),h===null&&(h=zt,p=pu(),h.pooledCache=p,p.refCount++,p!==null&&(h.pooledCacheLanes|=a),h=p),n.memoizedState={parent:o,cache:h},vu(n),wr(n,en,h)):((e.lanes&a)!==0&&(wu(e,n),qi(n,null,null,a),Yi()),h=e.memoizedState,p=n.memoizedState,h.parent!==o?(h={parent:o,cache:o},n.memoizedState=h,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=h),wr(n,en,o)):(o=p.cache,wr(n,en,o),o!==h.cache&&xu(n,[en],a,!0))),pn(e,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(i(156,n.tag))}function Jl(e){e.flags|=4}function nd(e,n,a,o,h){if((n=(e.mode&32)!==0)&&(n=!1),n){if(e.flags|=16777216,(h&335544128)===h)if(e.stateNode.complete)e.flags|=8192;else if(tp())e.flags|=8192;else throw ca=oo,bu}else e.flags&=-16777217}function Tx(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!qp(n))if(tp())e.flags|=8192;else throw ca=oo,bu}function Eo(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?Zt():536870912,e.lanes|=n,Pa|=n)}function Wi(e,n){if(!xt)switch(e.tailMode){case"hidden":n=e.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var o=null;a!==null;)a.alternate!==null&&(o=a),a=a.sibling;o===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:o.sibling=null}}function Lt(e){var n=e.alternate!==null&&e.alternate.child===e.child,a=0,o=0;if(n)for(var h=e.child;h!==null;)a|=h.lanes|h.childLanes,o|=h.subtreeFlags&65011712,o|=h.flags&65011712,h.return=e,h=h.sibling;else for(h=e.child;h!==null;)a|=h.lanes|h.childLanes,o|=h.subtreeFlags,o|=h.flags,h.return=e,h=h.sibling;return e.subtreeFlags|=o,e.childLanes=a,n}function Lb(e,n,a){var o=n.pendingProps;switch(uu(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Lt(n),null;case 1:return Lt(n),null;case 3:return a=n.stateNode,o=null,e!==null&&(o=e.memoizedState.cache),n.memoizedState.cache!==o&&(n.flags|=2048),Kl(en),Qe(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Ha(n)?Jl(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,fu())),Lt(n),null;case 26:var h=n.type,p=n.memoizedState;return e===null?(Jl(n),p!==null?(Lt(n),Tx(n,p)):(Lt(n),nd(n,h,null,o,a))):p?p!==e.memoizedState?(Jl(n),Lt(n),Tx(n,p)):(Lt(n),n.flags&=-16777217):(e=e.memoizedProps,e!==o&&Jl(n),Lt(n),nd(n,h,e,o,a)),null;case 27:if(tt(n),a=Ne.current,h=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==o&&Jl(n);else{if(!o){if(n.stateNode===null)throw Error(i(166));return Lt(n),null}e=fe.current,Ha(n)?om(n):(e=Op(h,o,a),n.stateNode=e,Jl(n))}return Lt(n),null;case 5:if(tt(n),h=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==o&&Jl(n);else{if(!o){if(n.stateNode===null)throw Error(i(166));return Lt(n),null}if(p=fe.current,Ha(n))om(n);else{var w=Uo(Ne.current);switch(p){case 1:p=w.createElementNS("http://www.w3.org/2000/svg",h);break;case 2:p=w.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;default:switch(h){case"svg":p=w.createElementNS("http://www.w3.org/2000/svg",h);break;case"math":p=w.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;case"script":p=w.createElement("div"),p.innerHTML="<script><\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof o.is=="string"?w.createElement("select",{is:o.is}):w.createElement("select"),o.multiple?p.multiple=!0:o.size&&(p.size=o.size);break;default:p=typeof o.is=="string"?w.createElement(h,{is:o.is}):w.createElement(h)}}p[Jt]=n,p[hn]=o;e:for(w=n.child;w!==null;){if(w.tag===5||w.tag===6)p.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===n)break e;for(;w.sibling===null;){if(w.return===null||w.return===n)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}n.stateNode=p;e:switch(yn(p,h,o),h){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&Jl(n)}}return Lt(n),nd(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,a),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==o&&Jl(n);else{if(typeof o!="string"&&n.stateNode===null)throw Error(i(166));if(e=Ne.current,Ha(n)){if(e=n.stateNode,a=n.memoizedProps,o=null,h=mn,h!==null)switch(h.tag){case 27:case 5:o=h.memoizedProps}e[Jt]=n,e=!!(e.nodeValue===a||o!==null&&o.suppressHydrationWarning===!0||Cp(e.nodeValue,a)),e||vr(n,!0)}else e=Uo(e).createTextNode(o),e[Jt]=n,n.stateNode=e}return Lt(n),null;case 31:if(a=n.memoizedState,e===null||e.memoizedState!==null){if(o=Ha(n),a!==null){if(e===null){if(!o)throw Error(i(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(557));e[Jt]=n}else ra(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Lt(n),e=!1}else a=fu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return n.flags&256?(Yn(n),n):(Yn(n),null);if((n.flags&128)!==0)throw Error(i(558))}return Lt(n),null;case 13:if(o=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(h=Ha(n),o!==null&&o.dehydrated!==null){if(e===null){if(!h)throw Error(i(318));if(h=n.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(i(317));h[Jt]=n}else ra(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Lt(n),h=!1}else h=fu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=h),h=!0;if(!h)return n.flags&256?(Yn(n),n):(Yn(n),null)}return Yn(n),(n.flags&128)!==0?(n.lanes=a,n):(a=o!==null,e=e!==null&&e.memoizedState!==null,a&&(o=n.child,h=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(h=o.alternate.memoizedState.cachePool.pool),p=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(p=o.memoizedState.cachePool.pool),p!==h&&(o.flags|=2048)),a!==e&&a&&(n.child.flags|=8192),Eo(n,n.updateQueue),Lt(n),null);case 4:return Qe(),e===null&&Sd(n.stateNode.containerInfo),Lt(n),null;case 10:return Kl(n.type),Lt(n),null;case 19:if(K(Kt),o=n.memoizedState,o===null)return Lt(n),null;if(h=(n.flags&128)!==0,p=o.rendering,p===null)if(h)Wi(o,!1);else{if(Vt!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(p=ho(e),p!==null){for(n.flags|=128,Wi(o,!1),e=p.updateQueue,n.updateQueue=e,Eo(n,e),n.subtreeFlags=0,e=a,a=n.child;a!==null;)lm(a,e),a=a.sibling;return T(Kt,Kt.current&1|2),xt&&Vl(n,o.treeForkCount),n.child}e=e.sibling}o.tail!==null&>()>zo&&(n.flags|=128,h=!0,Wi(o,!1),n.lanes=4194304)}else{if(!h)if(e=ho(p),e!==null){if(n.flags|=128,h=!0,e=e.updateQueue,n.updateQueue=e,Eo(n,e),Wi(o,!0),o.tail===null&&o.tailMode==="hidden"&&!p.alternate&&!xt)return Lt(n),null}else 2*gt()-o.renderingStartTime>zo&&a!==536870912&&(n.flags|=128,h=!0,Wi(o,!1),n.lanes=4194304);o.isBackwards?(p.sibling=n.child,n.child=p):(e=o.last,e!==null?e.sibling=p:n.child=p,o.last=p)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=gt(),e.sibling=null,a=Kt.current,T(Kt,h?a&1|2:a&1),xt&&Vl(n,o.treeForkCount),e):(Lt(n),null);case 22:case 23:return Yn(n),Cu(),o=n.memoizedState!==null,e!==null?e.memoizedState!==null!==o&&(n.flags|=8192):o&&(n.flags|=8192),o?(a&536870912)!==0&&(n.flags&128)===0&&(Lt(n),n.subtreeFlags&6&&(n.flags|=8192)):Lt(n),a=n.updateQueue,a!==null&&Eo(n,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),o=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),o!==a&&(n.flags|=2048),e!==null&&K(sa),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),Kl(en),Lt(n),null;case 25:return null;case 30:return null}throw Error(i(156,n.tag))}function $b(e,n){switch(uu(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return Kl(en),Qe(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return tt(n),null;case 31:if(n.memoizedState!==null){if(Yn(n),n.alternate===null)throw Error(i(340));ra()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(Yn(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(i(340));ra()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return K(Kt),null;case 4:return Qe(),null;case 10:return Kl(n.type),null;case 22:case 23:return Yn(n),Cu(),e!==null&&K(sa),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return Kl(en),null;case 25:return null;default:return null}}function Dx(e,n){switch(uu(n),n.tag){case 3:Kl(en),Qe();break;case 26:case 27:case 5:tt(n);break;case 4:Qe();break;case 31:n.memoizedState!==null&&Yn(n);break;case 13:Yn(n);break;case 19:K(Kt);break;case 10:Kl(n.type);break;case 22:case 23:Yn(n),Cu(),e!==null&&K(sa);break;case 24:Kl(en)}}function Zi(e,n){try{var a=n.updateQueue,o=a!==null?a.lastEffect:null;if(o!==null){var h=o.next;a=h;do{if((a.tag&e)===e){o=void 0;var p=a.create,w=a.inst;o=p(),w.destroy=o}a=a.next}while(a!==h)}}catch(N){Ct(n,n.return,N)}}function Nr(e,n,a){try{var o=n.updateQueue,h=o!==null?o.lastEffect:null;if(h!==null){var p=h.next;o=p;do{if((o.tag&e)===e){var w=o.inst,N=w.destroy;if(N!==void 0){w.destroy=void 0,h=n;var U=a,P=N;try{P()}catch(ie){Ct(h,U,ie)}}}o=o.next}while(o!==p)}}catch(ie){Ct(n,n.return,ie)}}function zx(e){var n=e.updateQueue;if(n!==null){var a=e.stateNode;try{wm(n,a)}catch(o){Ct(e,e.return,o)}}}function Mx(e,n,a){a.props=fa(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(o){Ct(e,n,o)}}function Ji(e,n){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var o=e.stateNode;break;case 30:o=e.stateNode;break;default:o=e.stateNode}typeof a=="function"?e.refCleanup=a(o):a.current=o}}catch(h){Ct(e,n,h)}}function Tl(e,n){var a=e.ref,o=e.refCleanup;if(a!==null)if(typeof o=="function")try{o()}catch(h){Ct(e,n,h)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(h){Ct(e,n,h)}else a.current=null}function Fx(e){var n=e.type,a=e.memoizedProps,o=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&o.focus();break e;case"img":a.src?o.src=a.src:a.srcSet&&(o.srcset=a.srcSet)}}catch(h){Ct(e,e.return,h)}}function ld(e,n,a){try{var o=e.stateNode;s2(o,e.type,a,n),o[hn]=n}catch(h){Ct(e,e.return,h)}}function Rx(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Rr(e.type)||e.tag===4}function rd(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Rx(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&&Rr(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 ad(e,n,a){var o=e.tag;if(o===5||o===6)e=e.stateNode,n?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,n):(n=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,n.appendChild(e),a=a._reactRootContainer,a!=null||n.onclick!==null||(n.onclick=hl));else if(o!==4&&(o===27&&Rr(e.type)&&(a=e.stateNode,n=null),e=e.child,e!==null))for(ad(e,n,a),e=e.sibling;e!==null;)ad(e,n,a),e=e.sibling}function No(e,n,a){var o=e.tag;if(o===5||o===6)e=e.stateNode,n?a.insertBefore(e,n):a.appendChild(e);else if(o!==4&&(o===27&&Rr(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(No(e,n,a),e=e.sibling;e!==null;)No(e,n,a),e=e.sibling}function _x(e){var n=e.stateNode,a=e.memoizedProps;try{for(var o=e.type,h=n.attributes;h.length;)n.removeAttributeNode(h[0]);yn(n,o,a),n[Jt]=e,n[hn]=a}catch(p){Ct(e,e.return,p)}}var Pl=!1,ln=!1,id=!1,Ox=typeof WeakSet=="function"?WeakSet:Set,dn=null;function Hb(e,n){if(e=e.containerInfo,Nd=Ko,e=Kh(e),Pc(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var o=a.getSelection&&a.getSelection();if(o&&o.rangeCount!==0){a=o.anchorNode;var h=o.anchorOffset,p=o.focusNode;o=o.focusOffset;try{a.nodeType,p.nodeType}catch{a=null;break e}var w=0,N=-1,U=-1,P=0,ie=0,ce=e,ee=null;t:for(;;){for(var le;ce!==a||h!==0&&ce.nodeType!==3||(N=w+h),ce!==p||o!==0&&ce.nodeType!==3||(U=w+o),ce.nodeType===3&&(w+=ce.nodeValue.length),(le=ce.firstChild)!==null;)ee=ce,ce=le;for(;;){if(ce===e)break t;if(ee===a&&++P===h&&(N=w),ee===p&&++ie===o&&(U=w),(le=ce.nextSibling)!==null)break;ce=ee,ee=ce.parentNode}ce=le}a=N===-1||U===-1?null:{start:N,end:U}}else a=null}a=a||{start:0,end:0}}else a=null;for(Ad={focusedElem:e,selectionRange:a},Ko=!1,dn=n;dn!==null;)if(n=dn,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,dn=e;else for(;dn!==null;){switch(n=dn,p=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)h=e[a],h.ref.impl=h.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&p!==null){e=void 0,a=n,h=p.memoizedProps,p=p.memoizedState,o=a.stateNode;try{var Re=fa(a.type,h);e=o.getSnapshotBeforeUpdate(Re,p),o.__reactInternalSnapshotBeforeUpdate=e}catch(Ve){Ct(a,a.return,Ve)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,a=e.nodeType,a===9)zd(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":zd(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(i(163))}if(e=n.sibling,e!==null){e.return=n.return,dn=e;break}dn=n.return}}function Bx(e,n,a){var o=a.flags;switch(a.tag){case 0:case 11:case 15:tr(e,a),o&4&&Zi(5,a);break;case 1:if(tr(e,a),o&4)if(e=a.stateNode,n===null)try{e.componentDidMount()}catch(w){Ct(a,a.return,w)}else{var h=fa(a.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(h,n,e.__reactInternalSnapshotBeforeUpdate)}catch(w){Ct(a,a.return,w)}}o&64&&zx(a),o&512&&Ji(a,a.return);break;case 3:if(tr(e,a),o&64&&(e=a.updateQueue,e!==null)){if(n=null,a.child!==null)switch(a.child.tag){case 27:case 5:n=a.child.stateNode;break;case 1:n=a.child.stateNode}try{wm(e,n)}catch(w){Ct(a,a.return,w)}}break;case 27:n===null&&o&4&&_x(a);case 26:case 5:tr(e,a),n===null&&o&4&&Fx(a),o&512&&Ji(a,a.return);break;case 12:tr(e,a);break;case 31:tr(e,a),o&4&&Hx(e,a);break;case 13:tr(e,a),o&4&&Ux(e,a),o&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=Qb.bind(null,a),x2(e,a))));break;case 22:if(o=a.memoizedState!==null||Pl,!o){n=n!==null&&n.memoizedState!==null||ln,h=Pl;var p=ln;Pl=o,(ln=n)&&!p?nr(e,a,(a.subtreeFlags&8772)!==0):tr(e,a),Pl=h,ln=p}break;case 30:break;default:tr(e,a)}}function Lx(e){var n=e.alternate;n!==null&&(e.alternate=null,Lx(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&Aa(n)),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 It=null,Mn=!1;function er(e,n,a){for(a=a.child;a!==null;)$x(e,n,a),a=a.sibling}function $x(e,n,a){if(Xe&&typeof Xe.onCommitFiberUnmount=="function")try{Xe.onCommitFiberUnmount(He,a)}catch{}switch(a.tag){case 26:ln||Tl(a,n),er(e,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:ln||Tl(a,n);var o=It,h=Mn;Rr(a.type)&&(It=a.stateNode,Mn=!1),er(e,n,a),ss(a.stateNode),It=o,Mn=h;break;case 5:ln||Tl(a,n);case 6:if(o=It,h=Mn,It=null,er(e,n,a),It=o,Mn=h,It!==null)if(Mn)try{(It.nodeType===9?It.body:It.nodeName==="HTML"?It.ownerDocument.body:It).removeChild(a.stateNode)}catch(p){Ct(a,n,p)}else try{It.removeChild(a.stateNode)}catch(p){Ct(a,n,p)}break;case 18:It!==null&&(Mn?(e=It,zp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),si(e)):zp(It,a.stateNode));break;case 4:o=It,h=Mn,It=a.stateNode.containerInfo,Mn=!0,er(e,n,a),It=o,Mn=h;break;case 0:case 11:case 14:case 15:Nr(2,a,n),ln||Nr(4,a,n),er(e,n,a);break;case 1:ln||(Tl(a,n),o=a.stateNode,typeof o.componentWillUnmount=="function"&&Mx(a,n,o)),er(e,n,a);break;case 21:er(e,n,a);break;case 22:ln=(o=ln)||a.memoizedState!==null,er(e,n,a),ln=o;break;default:er(e,n,a)}}function Hx(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{si(e)}catch(a){Ct(n,n.return,a)}}}function Ux(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{si(e)}catch(a){Ct(n,n.return,a)}}function Ub(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new Ox),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new Ox),n;default:throw Error(i(435,e.tag))}}function Ao(e,n){var a=Ub(e);n.forEach(function(o){if(!a.has(o)){a.add(o);var h=Wb.bind(null,e,o);o.then(h,h)}})}function Fn(e,n){var a=n.deletions;if(a!==null)for(var o=0;o<a.length;o++){var h=a[o],p=e,w=n,N=w;e:for(;N!==null;){switch(N.tag){case 27:if(Rr(N.type)){It=N.stateNode,Mn=!1;break e}break;case 5:It=N.stateNode,Mn=!1;break e;case 3:case 4:It=N.stateNode.containerInfo,Mn=!0;break e}N=N.return}if(It===null)throw Error(i(160));$x(p,w,h),It=null,Mn=!1,p=h.alternate,p!==null&&(p.return=null),h.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Ix(n,e),n=n.sibling}var xl=null;function Ix(e,n){var a=e.alternate,o=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Fn(n,e),Rn(e),o&4&&(Nr(3,e,e.return),Zi(3,e),Nr(5,e,e.return));break;case 1:Fn(n,e),Rn(e),o&512&&(ln||a===null||Tl(a,a.return)),o&64&&Pl&&(e=e.updateQueue,e!==null&&(o=e.callbacks,o!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?o:a.concat(o))));break;case 26:var h=xl;if(Fn(n,e),Rn(e),o&512&&(ln||a===null||Tl(a,a.return)),o&4){var p=a!==null?a.memoizedState:null;if(o=e.memoizedState,a===null)if(o===null)if(e.stateNode===null){e:{o=e.type,a=e.memoizedProps,h=h.ownerDocument||h;t:switch(o){case"title":p=h.getElementsByTagName("title")[0],(!p||p[fr]||p[Jt]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=h.createElement(o),h.head.insertBefore(p,h.querySelector("head > title"))),yn(p,o,a),p[Jt]=e,Ut(p),o=p;break e;case"link":var w=Ip("link","href",h).get(o+(a.href||""));if(w){for(var N=0;N<w.length;N++)if(p=w[N],p.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&p.getAttribute("rel")===(a.rel==null?null:a.rel)&&p.getAttribute("title")===(a.title==null?null:a.title)&&p.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){w.splice(N,1);break t}}p=h.createElement(o),yn(p,o,a),h.head.appendChild(p);break;case"meta":if(w=Ip("meta","content",h).get(o+(a.content||""))){for(N=0;N<w.length;N++)if(p=w[N],p.getAttribute("content")===(a.content==null?null:""+a.content)&&p.getAttribute("name")===(a.name==null?null:a.name)&&p.getAttribute("property")===(a.property==null?null:a.property)&&p.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&p.getAttribute("charset")===(a.charSet==null?null:a.charSet)){w.splice(N,1);break t}}p=h.createElement(o),yn(p,o,a),h.head.appendChild(p);break;default:throw Error(i(468,o))}p[Jt]=e,Ut(p),o=p}e.stateNode=o}else Yp(h,e.type,e.stateNode);else e.stateNode=Up(h,o,e.memoizedProps);else p!==o?(p===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):p.count--,o===null?Yp(h,e.type,e.stateNode):Up(h,o,e.memoizedProps)):o===null&&e.stateNode!==null&&ld(e,e.memoizedProps,a.memoizedProps)}break;case 27:Fn(n,e),Rn(e),o&512&&(ln||a===null||Tl(a,a.return)),a!==null&&o&4&&ld(e,e.memoizedProps,a.memoizedProps);break;case 5:if(Fn(n,e),Rn(e),o&512&&(ln||a===null||Tl(a,a.return)),e.flags&32){h=e.stateNode;try{yr(h,"")}catch(Re){Ct(e,e.return,Re)}}o&4&&e.stateNode!=null&&(h=e.memoizedProps,ld(e,h,a!==null?a.memoizedProps:h)),o&1024&&(id=!0);break;case 6:if(Fn(n,e),Rn(e),o&4){if(e.stateNode===null)throw Error(i(162));o=e.memoizedProps,a=e.stateNode;try{a.nodeValue=o}catch(Re){Ct(e,e.return,Re)}}break;case 3:if(qo=null,h=xl,xl=Io(n.containerInfo),Fn(n,e),xl=h,Rn(e),o&4&&a!==null&&a.memoizedState.isDehydrated)try{si(n.containerInfo)}catch(Re){Ct(e,e.return,Re)}id&&(id=!1,Yx(e));break;case 4:o=xl,xl=Io(e.stateNode.containerInfo),Fn(n,e),Rn(e),xl=o;break;case 12:Fn(n,e),Rn(e);break;case 31:Fn(n,e),Rn(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,Ao(e,o)));break;case 13:Fn(n,e),Rn(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Do=gt()),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,Ao(e,o)));break;case 22:h=e.memoizedState!==null;var U=a!==null&&a.memoizedState!==null,P=Pl,ie=ln;if(Pl=P||h,ln=ie||U,Fn(n,e),ln=ie,Pl=P,Rn(e),o&8192)e:for(n=e.stateNode,n._visibility=h?n._visibility&-2:n._visibility|1,h&&(a===null||U||Pl||ln||ha(e)),a=null,n=e;;){if(n.tag===5||n.tag===26){if(a===null){U=a=n;try{if(p=U.stateNode,h)w=p.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{N=U.stateNode;var ce=U.memoizedProps.style,ee=ce!=null&&ce.hasOwnProperty("display")?ce.display:null;N.style.display=ee==null||typeof ee=="boolean"?"":(""+ee).trim()}}catch(Re){Ct(U,U.return,Re)}}}else if(n.tag===6){if(a===null){U=n;try{U.stateNode.nodeValue=h?"":U.memoizedProps}catch(Re){Ct(U,U.return,Re)}}}else if(n.tag===18){if(a===null){U=n;try{var le=U.stateNode;h?Mp(le,!0):Mp(U.stateNode,!1)}catch(Re){Ct(U,U.return,Re)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===e)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;a===n&&(a=null),n=n.return}a===n&&(a=null),n.sibling.return=n.return,n=n.sibling}o&4&&(o=e.updateQueue,o!==null&&(a=o.retryQueue,a!==null&&(o.retryQueue=null,Ao(e,a))));break;case 19:Fn(n,e),Rn(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,Ao(e,o)));break;case 30:break;case 21:break;default:Fn(n,e),Rn(e)}}function Rn(e){var n=e.flags;if(n&2){try{for(var a,o=e.return;o!==null;){if(Rx(o)){a=o;break}o=o.return}if(a==null)throw Error(i(160));switch(a.tag){case 27:var h=a.stateNode,p=rd(e);No(e,p,h);break;case 5:var w=a.stateNode;a.flags&32&&(yr(w,""),a.flags&=-33);var N=rd(e);No(e,N,w);break;case 3:case 4:var U=a.stateNode.containerInfo,P=rd(e);ad(e,P,U);break;default:throw Error(i(161))}}catch(ie){Ct(e,e.return,ie)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function Yx(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;Yx(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function tr(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Bx(e,n.alternate,n),n=n.sibling}function ha(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:Nr(4,n,n.return),ha(n);break;case 1:Tl(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&Mx(n,n.return,a),ha(n);break;case 27:ss(n.stateNode);case 26:case 5:Tl(n,n.return),ha(n);break;case 22:n.memoizedState===null&&ha(n);break;case 30:ha(n);break;default:ha(n)}e=e.sibling}}function nr(e,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var o=n.alternate,h=e,p=n,w=p.flags;switch(p.tag){case 0:case 11:case 15:nr(h,p,a),Zi(4,p);break;case 1:if(nr(h,p,a),o=p,h=o.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(P){Ct(o,o.return,P)}if(o=p,h=o.updateQueue,h!==null){var N=o.stateNode;try{var U=h.shared.hiddenCallbacks;if(U!==null)for(h.shared.hiddenCallbacks=null,h=0;h<U.length;h++)vm(U[h],N)}catch(P){Ct(o,o.return,P)}}a&&w&64&&zx(p),Ji(p,p.return);break;case 27:_x(p);case 26:case 5:nr(h,p,a),a&&o===null&&w&4&&Fx(p),Ji(p,p.return);break;case 12:nr(h,p,a);break;case 31:nr(h,p,a),a&&w&4&&Hx(h,p);break;case 13:nr(h,p,a),a&&w&4&&Ux(h,p);break;case 22:p.memoizedState===null&&nr(h,p,a),Ji(p,p.return);break;case 30:break;default:nr(h,p,a)}n=n.sibling}}function sd(e,n){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&Li(a))}function od(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&Li(e))}function pl(e,n,a,o){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)qx(e,n,a,o),n=n.sibling}function qx(e,n,a,o){var h=n.flags;switch(n.tag){case 0:case 11:case 15:pl(e,n,a,o),h&2048&&Zi(9,n);break;case 1:pl(e,n,a,o);break;case 3:pl(e,n,a,o),h&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&Li(e)));break;case 12:if(h&2048){pl(e,n,a,o),e=n.stateNode;try{var p=n.memoizedProps,w=p.id,N=p.onPostCommit;typeof N=="function"&&N(w,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(U){Ct(n,n.return,U)}}else pl(e,n,a,o);break;case 31:pl(e,n,a,o);break;case 13:pl(e,n,a,o);break;case 23:break;case 22:p=n.stateNode,w=n.alternate,n.memoizedState!==null?p._visibility&2?pl(e,n,a,o):Pi(e,n):p._visibility&2?pl(e,n,a,o):(p._visibility|=2,Wa(e,n,a,o,(n.subtreeFlags&10256)!==0||!1)),h&2048&&sd(w,n);break;case 24:pl(e,n,a,o),h&2048&&od(n.alternate,n);break;default:pl(e,n,a,o)}}function Wa(e,n,a,o,h){for(h=h&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var p=e,w=n,N=a,U=o,P=w.flags;switch(w.tag){case 0:case 11:case 15:Wa(p,w,N,U,h),Zi(8,w);break;case 23:break;case 22:var ie=w.stateNode;w.memoizedState!==null?ie._visibility&2?Wa(p,w,N,U,h):Pi(p,w):(ie._visibility|=2,Wa(p,w,N,U,h)),h&&P&2048&&sd(w.alternate,w);break;case 24:Wa(p,w,N,U,h),h&&P&2048&&od(w.alternate,w);break;default:Wa(p,w,N,U,h)}n=n.sibling}}function Pi(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=e,o=n,h=o.flags;switch(o.tag){case 22:Pi(a,o),h&2048&&sd(o.alternate,o);break;case 24:Pi(a,o),h&2048&&od(o.alternate,o);break;default:Pi(a,o)}n=n.sibling}}var es=8192;function Za(e,n,a){if(e.subtreeFlags&es)for(e=e.child;e!==null;)Xx(e,n,a),e=e.sibling}function Xx(e,n,a){switch(e.tag){case 26:Za(e,n,a),e.flags&es&&e.memoizedState!==null&&N2(a,xl,e.memoizedState,e.memoizedProps);break;case 5:Za(e,n,a);break;case 3:case 4:var o=xl;xl=Io(e.stateNode.containerInfo),Za(e,n,a),xl=o;break;case 22:e.memoizedState===null&&(o=e.alternate,o!==null&&o.memoizedState!==null?(o=es,es=16777216,Za(e,n,a),es=o):Za(e,n,a));break;default:Za(e,n,a)}}function Vx(e){var n=e.alternate;if(n!==null&&(e=n.child,e!==null)){n.child=null;do n=e.sibling,e.sibling=null,e=n;while(e!==null)}}function ts(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var o=n[a];dn=o,Kx(o,e)}Vx(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Gx(e),e=e.sibling}function Gx(e){switch(e.tag){case 0:case 11:case 15:ts(e),e.flags&2048&&Nr(9,e,e.return);break;case 3:ts(e);break;case 12:ts(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,To(e)):ts(e);break;default:ts(e)}}function To(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var o=n[a];dn=o,Kx(o,e)}Vx(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:Nr(8,n,n.return),To(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,To(n));break;default:To(n)}e=e.sibling}}function Kx(e,n){for(;dn!==null;){var a=dn;switch(a.tag){case 0:case 11:case 15:Nr(8,a,n);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var o=a.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:Li(a.memoizedState.cache)}if(o=a.child,o!==null)o.return=a,dn=o;else e:for(a=e;dn!==null;){o=dn;var h=o.sibling,p=o.return;if(Lx(o),o===a){dn=null;break e}if(h!==null){h.return=p,dn=h;break e}dn=p}}}var Ib={getCacheForType:function(e){var n=xn(en),a=n.data.get(e);return a===void 0&&(a=e(),n.data.set(e,a)),a},cacheSignal:function(){return xn(en).controller.signal}},Yb=typeof WeakMap=="function"?WeakMap:Map,kt=0,zt=null,st=null,ut=0,St=0,qn=null,Ar=!1,Ja=!1,cd=!1,lr=0,Vt=0,Tr=0,ma=0,ud=0,Xn=0,Pa=0,ns=null,_n=null,dd=!1,Do=0,Qx=0,zo=1/0,Mo=null,Dr=null,an=0,zr=null,ei=null,rr=0,fd=0,hd=null,Wx=null,ls=0,md=null;function Vn(){return(kt&2)!==0&&ut!==0?ut&-ut:L.T!==null?vd():Ul()}function Zx(){if(Xn===0)if((ut&536870912)===0||xt){var e=ol;ol<<=1,(ol&3932160)===0&&(ol=262144),Xn=e}else Xn=536870912;return e=In.current,e!==null&&(e.flags|=32),Xn}function On(e,n,a){(e===zt&&(St===2||St===9)||e.cancelPendingCommit!==null)&&(ti(e,0),Mr(e,ut,Xn,!1)),cl(e,a),((kt&2)===0||e!==zt)&&(e===zt&&((kt&2)===0&&(ma|=a),Vt===4&&Mr(e,ut,Xn,!1)),Dl(e))}function Jx(e,n,a){if((kt&6)!==0)throw Error(i(327));var o=!a&&(n&127)===0&&(n&e.expiredLanes)===0||Wt(e,n),h=o?Vb(e,n):pd(e,n,!0),p=o;do{if(h===0){Ja&&!o&&Mr(e,n,0,!1);break}else{if(a=e.current.alternate,p&&!qb(a)){h=pd(e,n,!1),p=!1;continue}if(h===2){if(p=n,e.errorRecoveryDisabledLanes&p)var w=0;else w=e.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){n=w;e:{var N=e;h=ns;var U=N.current.memoizedState.isDehydrated;if(U&&(ti(N,w).flags|=256),w=pd(N,w,!1),w!==2){if(cd&&!U){N.errorRecoveryDisabledLanes|=p,ma|=p,h=4;break e}p=_n,_n=h,p!==null&&(_n===null?_n=p:_n.push.apply(_n,p))}h=w}if(p=!1,h!==2)continue}}if(h===1){ti(e,0),Mr(e,n,0,!0);break}e:{switch(o=e,p=h,p){case 0:case 1:throw Error(i(345));case 4:if((n&4194048)!==n)break;case 6:Mr(o,n,Xn,!Ar);break e;case 2:_n=null;break;case 3:case 5:break;default:throw Error(i(329))}if((n&62914560)===n&&(h=Do+300-gt(),10<h)){if(Mr(o,n,Xn,!Ar),fn(o,0,!0)!==0)break e;rr=n,o.timeoutHandle=Tp(Px.bind(null,o,a,_n,Mo,dd,n,Xn,ma,Pa,Ar,p,"Throttled",-0,0),h);break e}Px(o,a,_n,Mo,dd,n,Xn,ma,Pa,Ar,p,null,-0,0)}}break}while(!0);Dl(e)}function Px(e,n,a,o,h,p,w,N,U,P,ie,ce,ee,le){if(e.timeoutHandle=-1,ce=n.subtreeFlags,ce&8192||(ce&16785408)===16785408){ce={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:hl},Xx(n,p,ce);var Re=(p&62914560)===p?Do-gt():(p&4194048)===p?Qx-gt():0;if(Re=A2(ce,Re),Re!==null){rr=p,e.cancelPendingCommit=Re(sp.bind(null,e,n,p,a,o,h,w,N,U,ie,ce,null,ee,le)),Mr(e,p,w,!P);return}}sp(e,n,p,a,o,h,w,N,U)}function qb(e){for(var n=e;;){var a=n.tag;if((a===0||a===11||a===15)&&n.flags&16384&&(a=n.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var o=0;o<a.length;o++){var h=a[o],p=h.getSnapshot;h=h.value;try{if(!Hn(p(),h))return!1}catch{return!1}}if(a=n.child,n.subtreeFlags&16384&&a!==null)a.return=n,n=a;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Mr(e,n,a,o){n&=~ud,n&=~ma,e.suspendedLanes|=n,e.pingedLanes&=~n,o&&(e.warmLanes|=n),o=e.expirationTimes;for(var h=n;0<h;){var p=31-Pe(h),w=1<<p;o[p]=-1,h&=~w}a!==0&&Ys(e,a,n)}function Fo(){return(kt&6)===0?(rs(0),!1):!0}function xd(){if(st!==null){if(St===0)var e=st.return;else e=st,Gl=aa=null,zu(e),Xa=null,Hi=0,e=st;for(;e!==null;)Dx(e.alternate,e),e=e.return;st=null}}function ti(e,n){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,u2(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),rr=0,xd(),zt=e,st=a=Xl(e.current,null),ut=n,St=0,qn=null,Ar=!1,Ja=Wt(e,n),cd=!1,Pa=Xn=ud=ma=Tr=Vt=0,_n=ns=null,dd=!1,(n&8)!==0&&(n|=n&32);var o=e.entangledLanes;if(o!==0)for(e=e.entanglements,o&=n;0<o;){var h=31-Pe(o),p=1<<h;n|=e[h],o&=~p}return lr=n,Ps(),a}function ep(e,n){et=null,L.H=Ki,n===qa||n===so?(n=pm(),St=3):n===bu?(n=pm(),St=4):St=n===Gu?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,qn=n,st===null&&(Vt=1,ko(e,el(n,e.current)))}function tp(){var e=In.current;return e===null?!0:(ut&4194048)===ut?rl===null:(ut&62914560)===ut||(ut&536870912)!==0?e===rl:!1}function np(){var e=L.H;return L.H=Ki,e===null?Ki:e}function lp(){var e=L.A;return L.A=Ib,e}function Ro(){Vt=4,Ar||(ut&4194048)!==ut&&In.current!==null||(Ja=!0),(Tr&134217727)===0&&(ma&134217727)===0||zt===null||Mr(zt,ut,Xn,!1)}function pd(e,n,a){var o=kt;kt|=2;var h=np(),p=lp();(zt!==e||ut!==n)&&(Mo=null,ti(e,n)),n=!1;var w=Vt;e:do try{if(St!==0&&st!==null){var N=st,U=qn;switch(St){case 8:xd(),w=6;break e;case 3:case 2:case 9:case 6:In.current===null&&(n=!0);var P=St;if(St=0,qn=null,ni(e,N,U,P),a&&Ja){w=0;break e}break;default:P=St,St=0,qn=null,ni(e,N,U,P)}}Xb(),w=Vt;break}catch(ie){ep(e,ie)}while(!0);return n&&e.shellSuspendCounter++,Gl=aa=null,kt=o,L.H=h,L.A=p,st===null&&(zt=null,ut=0,Ps()),w}function Xb(){for(;st!==null;)rp(st)}function Vb(e,n){var a=kt;kt|=2;var o=np(),h=lp();zt!==e||ut!==n?(Mo=null,zo=gt()+500,ti(e,n)):Ja=Wt(e,n);e:do try{if(St!==0&&st!==null){n=st;var p=qn;t:switch(St){case 1:St=0,qn=null,ni(e,n,p,1);break;case 2:case 9:if(mm(p)){St=0,qn=null,ap(n);break}n=function(){St!==2&&St!==9||zt!==e||(St=7),Dl(e)},p.then(n,n);break e;case 3:St=7;break e;case 4:St=5;break e;case 7:mm(p)?(St=0,qn=null,ap(n)):(St=0,qn=null,ni(e,n,p,7));break;case 5:var w=null;switch(st.tag){case 26:w=st.memoizedState;case 5:case 27:var N=st;if(w?qp(w):N.stateNode.complete){St=0,qn=null;var U=N.sibling;if(U!==null)st=U;else{var P=N.return;P!==null?(st=P,_o(P)):st=null}break t}}St=0,qn=null,ni(e,n,p,5);break;case 6:St=0,qn=null,ni(e,n,p,6);break;case 8:xd(),Vt=6;break e;default:throw Error(i(462))}}Gb();break}catch(ie){ep(e,ie)}while(!0);return Gl=aa=null,L.H=o,L.A=h,kt=a,st!==null?0:(zt=null,ut=0,Ps(),Vt)}function Gb(){for(;st!==null&&!Et();)rp(st)}function rp(e){var n=Ax(e.alternate,e,lr);e.memoizedProps=e.pendingProps,n===null?_o(e):st=n}function ap(e){var n=e,a=n.alternate;switch(n.tag){case 15:case 0:n=kx(a,n,n.pendingProps,n.type,void 0,ut);break;case 11:n=kx(a,n,n.pendingProps,n.type.render,n.ref,ut);break;case 5:zu(n);default:Dx(a,n),n=st=lm(n,lr),n=Ax(a,n,lr)}e.memoizedProps=e.pendingProps,n===null?_o(e):st=n}function ni(e,n,a,o){Gl=aa=null,zu(n),Xa=null,Hi=0;var h=n.return;try{if(_b(e,h,n,a,ut)){Vt=1,ko(e,el(a,e.current)),st=null;return}}catch(p){if(h!==null)throw st=h,p;Vt=1,ko(e,el(a,e.current)),st=null;return}n.flags&32768?(xt||o===1?e=!0:Ja||(ut&536870912)!==0?e=!1:(Ar=e=!0,(o===2||o===9||o===3||o===6)&&(o=In.current,o!==null&&o.tag===13&&(o.flags|=16384))),ip(n,e)):_o(n)}function _o(e){var n=e;do{if((n.flags&32768)!==0){ip(n,Ar);return}e=n.return;var a=Lb(n.alternate,n,lr);if(a!==null){st=a;return}if(n=n.sibling,n!==null){st=n;return}st=n=e}while(n!==null);Vt===0&&(Vt=5)}function ip(e,n){do{var a=$b(e.alternate,e);if(a!==null){a.flags&=32767,st=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(e=e.sibling,e!==null)){st=e;return}st=e=a}while(e!==null);Vt=6,st=null}function sp(e,n,a,o,h,p,w,N,U){e.cancelPendingCommit=null;do Oo();while(an!==0);if((kt&6)!==0)throw Error(i(327));if(n!==null){if(n===e.current)throw Error(i(177));if(p=n.lanes|n.childLanes,p|=ru,Wn(e,a,p,w,N,U),e===zt&&(st=zt=null,ut=0),ei=n,zr=e,rr=a,fd=p,hd=h,Wx=o,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Zb(Te,function(){return fp(),null})):(e.callbackNode=null,e.callbackPriority=0),o=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||o){o=L.T,L.T=null,h=Z.p,Z.p=2,w=kt,kt|=4;try{Hb(e,n,a)}finally{kt=w,Z.p=h,L.T=o}}an=1,op(),cp(),up()}}function op(){if(an===1){an=0;var e=zr,n=ei,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=L.T,L.T=null;var o=Z.p;Z.p=2;var h=kt;kt|=4;try{Ix(n,e);var p=Ad,w=Kh(e.containerInfo),N=p.focusedElem,U=p.selectionRange;if(w!==N&&N&&N.ownerDocument&&Gh(N.ownerDocument.documentElement,N)){if(U!==null&&Pc(N)){var P=U.start,ie=U.end;if(ie===void 0&&(ie=P),"selectionStart"in N)N.selectionStart=P,N.selectionEnd=Math.min(ie,N.value.length);else{var ce=N.ownerDocument||document,ee=ce&&ce.defaultView||window;if(ee.getSelection){var le=ee.getSelection(),Re=N.textContent.length,Ve=Math.min(U.start,Re),Tt=U.end===void 0?Ve:Math.min(U.end,Re);!le.extend&&Ve>Tt&&(w=Tt,Tt=Ve,Ve=w);var Q=Vh(N,Ve),X=Vh(N,Tt);if(Q&&X&&(le.rangeCount!==1||le.anchorNode!==Q.node||le.anchorOffset!==Q.offset||le.focusNode!==X.node||le.focusOffset!==X.offset)){var J=ce.createRange();J.setStart(Q.node,Q.offset),le.removeAllRanges(),Ve>Tt?(le.addRange(J),le.extend(X.node,X.offset)):(J.setEnd(X.node,X.offset),le.addRange(J))}}}}for(ce=[],le=N;le=le.parentNode;)le.nodeType===1&&ce.push({element:le,left:le.scrollLeft,top:le.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<ce.length;N++){var oe=ce[N];oe.element.scrollLeft=oe.left,oe.element.scrollTop=oe.top}}Ko=!!Nd,Ad=Nd=null}finally{kt=h,Z.p=o,L.T=a}}e.current=n,an=2}}function cp(){if(an===2){an=0;var e=zr,n=ei,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=L.T,L.T=null;var o=Z.p;Z.p=2;var h=kt;kt|=4;try{Bx(e,n.alternate,n)}finally{kt=h,Z.p=o,L.T=a}}an=3}}function up(){if(an===4||an===3){an=0,Ht();var e=zr,n=ei,a=rr,o=Wx;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?an=5:(an=0,ei=zr=null,dp(e,e.pendingLanes));var h=e.pendingLanes;if(h===0&&(Dr=null),wl(a),n=n.stateNode,Xe&&typeof Xe.onCommitFiberRoot=="function")try{Xe.onCommitFiberRoot(He,n,void 0,(n.current.flags&128)===128)}catch{}if(o!==null){n=L.T,h=Z.p,Z.p=2,L.T=null;try{for(var p=e.onRecoverableError,w=0;w<o.length;w++){var N=o[w];p(N.value,{componentStack:N.stack})}}finally{L.T=n,Z.p=h}}(rr&3)!==0&&Oo(),Dl(e),h=e.pendingLanes,(a&261930)!==0&&(h&42)!==0?e===md?ls++:(ls=0,md=e):ls=0,rs(0)}}function dp(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,Li(n)))}function Oo(){return op(),cp(),up(),fp()}function fp(){if(an!==5)return!1;var e=zr,n=fd;fd=0;var a=wl(rr),o=L.T,h=Z.p;try{Z.p=32>a?32:a,L.T=null,a=hd,hd=null;var p=zr,w=rr;if(an=0,ei=zr=null,rr=0,(kt&6)!==0)throw Error(i(331));var N=kt;if(kt|=4,Gx(p.current),qx(p,p.current,w,a),kt=N,rs(0,!1),Xe&&typeof Xe.onPostCommitFiberRoot=="function")try{Xe.onPostCommitFiberRoot(He,p)}catch{}return!0}finally{Z.p=h,L.T=o,dp(e,n)}}function hp(e,n,a){n=el(a,n),n=Vu(e.stateNode,n,2),e=Sr(e,n,2),e!==null&&(cl(e,2),Dl(e))}function Ct(e,n,a){if(e.tag===3)hp(e,e,a);else for(;n!==null;){if(n.tag===3){hp(n,e,a);break}else if(n.tag===1){var o=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(Dr===null||!Dr.has(o))){e=el(a,e),a=mx(2),o=Sr(n,a,2),o!==null&&(xx(a,o,n,e),cl(o,2),Dl(o));break}}n=n.return}}function yd(e,n,a){var o=e.pingCache;if(o===null){o=e.pingCache=new Yb;var h=new Set;o.set(n,h)}else h=o.get(n),h===void 0&&(h=new Set,o.set(n,h));h.has(a)||(cd=!0,h.add(a),e=Kb.bind(null,e,n,a),n.then(e,e))}function Kb(e,n,a){var o=e.pingCache;o!==null&&o.delete(n),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,zt===e&&(ut&a)===a&&(Vt===4||Vt===3&&(ut&62914560)===ut&&300>gt()-Do?(kt&2)===0&&ti(e,0):ud|=a,Pa===ut&&(Pa=0)),Dl(e)}function mp(e,n){n===0&&(n=Zt()),e=na(e,n),e!==null&&(cl(e,n),Dl(e))}function Qb(e){var n=e.memoizedState,a=0;n!==null&&(a=n.retryLane),mp(e,a)}function Wb(e,n){var a=0;switch(e.tag){case 31:case 13:var o=e.stateNode,h=e.memoizedState;h!==null&&(a=h.retryLane);break;case 19:o=e.stateNode;break;case 22:o=e.stateNode._retryCache;break;default:throw Error(i(314))}o!==null&&o.delete(n),mp(e,a)}function Zb(e,n){return _e(e,n)}var Bo=null,li=null,gd=!1,Lo=!1,bd=!1,Fr=0;function Dl(e){e!==li&&e.next===null&&(li===null?Bo=li=e:li=li.next=e),Lo=!0,gd||(gd=!0,Pb())}function rs(e,n){if(!bd&&Lo){bd=!0;do for(var a=!1,o=Bo;o!==null;){if(e!==0){var h=o.pendingLanes;if(h===0)var p=0;else{var w=o.suspendedLanes,N=o.pingedLanes;p=(1<<31-Pe(42|e)+1)-1,p&=h&~(w&~N),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(a=!0,gp(o,p))}else p=ut,p=fn(o,o===zt?p:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(p&3)===0||Wt(o,p)||(a=!0,gp(o,p));o=o.next}while(a);bd=!1}}function Jb(){xp()}function xp(){Lo=gd=!1;var e=0;Fr!==0&&c2()&&(e=Fr);for(var n=gt(),a=null,o=Bo;o!==null;){var h=o.next,p=pp(o,n);p===0?(o.next=null,a===null?Bo=h:a.next=h,h===null&&(li=a)):(a=o,(e!==0||(p&3)!==0)&&(Lo=!0)),o=h}an!==0&&an!==5||rs(e),Fr!==0&&(Fr=0)}function pp(e,n){for(var a=e.suspendedLanes,o=e.pingedLanes,h=e.expirationTimes,p=e.pendingLanes&-62914561;0<p;){var w=31-Pe(p),N=1<<w,U=h[w];U===-1?((N&a)===0||(N&o)!==0)&&(h[w]=ve(N,n)):U<=n&&(e.expiredLanes|=N),p&=~N}if(n=zt,a=ut,a=fn(e,e===n?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o=e.callbackNode,a===0||e===n&&(St===2||St===9)||e.cancelPendingCommit!==null)return o!==null&&o!==null&&Ke(o),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||Wt(e,a)){if(n=a&-a,n===e.callbackPriority)return n;switch(o!==null&&Ke(o),wl(a)){case 2:case 8:a=pe;break;case 32:a=Te;break;case 268435456:a=xe;break;default:a=Te}return o=yp.bind(null,e),a=_e(a,o),e.callbackPriority=n,e.callbackNode=a,n}return o!==null&&o!==null&&Ke(o),e.callbackPriority=2,e.callbackNode=null,2}function yp(e,n){if(an!==0&&an!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Oo()&&e.callbackNode!==a)return null;var o=ut;return o=fn(e,e===zt?o:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o===0?null:(Jx(e,o,n),pp(e,gt()),e.callbackNode!=null&&e.callbackNode===a?yp.bind(null,e):null)}function gp(e,n){if(Oo())return null;Jx(e,n,!0)}function Pb(){d2(function(){(kt&6)!==0?_e(re,Jb):xp()})}function vd(){if(Fr===0){var e=Ia;e===0&&(e=ur,ur<<=1,(ur&261888)===0&&(ur=256)),Fr=e}return Fr}function bp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Jr(""+e)}function vp(e,n){var a=n.ownerDocument.createElement("input");return a.name=n.name,a.value=n.value,e.id&&a.setAttribute("form",e.id),n.parentNode.insertBefore(a,n),e=new FormData(e),a.parentNode.removeChild(a),e}function e2(e,n,a,o,h){if(n==="submit"&&a&&a.stateNode===h){var p=bp((h[hn]||null).action),w=o.submitter;w&&(n=(n=w[hn]||null)?bp(n.formAction):w.getAttribute("formAction"),n!==null&&(p=n,w=null));var N=new Qs("action","action",null,o,h);e.push({event:N,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(Fr!==0){var U=w?vp(h,w):new FormData(h);Hu(a,{pending:!0,data:U,method:h.method,action:p},null,U)}}else typeof p=="function"&&(N.preventDefault(),U=w?vp(h,w):new FormData(h),Hu(a,{pending:!0,data:U,method:h.method,action:p},p,U))},currentTarget:h}]})}}for(var wd=0;wd<lu.length;wd++){var kd=lu[wd],t2=kd.toLowerCase(),n2=kd[0].toUpperCase()+kd.slice(1);ml(t2,"on"+n2)}ml(Zh,"onAnimationEnd"),ml(Jh,"onAnimationIteration"),ml(Ph,"onAnimationStart"),ml("dblclick","onDoubleClick"),ml("focusin","onFocus"),ml("focusout","onBlur"),ml(gb,"onTransitionRun"),ml(bb,"onTransitionStart"),ml(vb,"onTransitionCancel"),ml(em,"onTransitionEnd"),ul("onMouseEnter",["mouseout","mouseover"]),ul("onMouseLeave",["mouseout","mouseover"]),ul("onPointerEnter",["pointerout","pointerover"]),ul("onPointerLeave",["pointerout","pointerover"]),Yt("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Yt("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Yt("onBeforeInput",["compositionend","keypress","textInput","paste"]),Yt("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Yt("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Yt("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var as="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(" "),l2=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(as));function wp(e,n){n=(n&4)!==0;for(var a=0;a<e.length;a++){var o=e[a],h=o.event;o=o.listeners;e:{var p=void 0;if(n)for(var w=o.length-1;0<=w;w--){var N=o[w],U=N.instance,P=N.currentTarget;if(N=N.listener,U!==p&&h.isPropagationStopped())break e;p=N,h.currentTarget=P;try{p(h)}catch(ie){Js(ie)}h.currentTarget=null,p=U}else for(w=0;w<o.length;w++){if(N=o[w],U=N.instance,P=N.currentTarget,N=N.listener,U!==p&&h.isPropagationStopped())break e;p=N,h.currentTarget=P;try{p(h)}catch(ie){Js(ie)}h.currentTarget=null,p=U}}}}function ot(e,n){var a=n[Ea];a===void 0&&(a=n[Ea]=new Set);var o=e+"__bubble";a.has(o)||(kp(n,e,2,!1),a.add(o))}function jd(e,n,a){var o=0;n&&(o|=4),kp(a,e,o,n)}var $o="_reactListening"+Math.random().toString(36).slice(2);function Sd(e){if(!e[$o]){e[$o]=!0,Xs.forEach(function(a){a!=="selectionchange"&&(l2.has(a)||jd(a,!1,e),jd(a,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[$o]||(n[$o]=!0,jd("selectionchange",!1,n))}}function kp(e,n,a,o){switch(Zp(n)){case 2:var h=z2;break;case 8:h=M2;break;default:h=$d}a=h.bind(null,n,a,e),h=void 0,!ye||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(h=!0),o?h!==void 0?e.addEventListener(n,a,{capture:!0,passive:h}):e.addEventListener(n,a,!0):h!==void 0?e.addEventListener(n,a,{passive:h}):e.addEventListener(n,a,!1)}function Cd(e,n,a,o,h){var p=o;if((n&1)===0&&(n&2)===0&&o!==null)e:for(;;){if(o===null)return;var w=o.tag;if(w===3||w===4){var N=o.stateNode.containerInfo;if(N===h)break;if(w===4)for(w=o.return;w!==null;){var U=w.tag;if((U===3||U===4)&&w.stateNode.containerInfo===h)return;w=w.return}for(;N!==null;){if(w=hr(N),w===null)return;if(U=w.tag,U===5||U===6||U===26||U===27){o=p=w;continue e}N=N.parentNode}}o=o.return}O(function(){var P=p,ie=Pt(a),ce=[];e:{var ee=tm.get(e);if(ee!==void 0){var le=Qs,Re=e;switch(e){case"keypress":if(Ze(a)===0)break e;case"keydown":case"keyup":le=Wg;break;case"focusin":Re="focus",le=Kc;break;case"focusout":Re="blur",le=Kc;break;case"beforeblur":case"afterblur":le=Kc;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":le=Dh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":le=Lg;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":le=Pg;break;case Zh:case Jh:case Ph:le=Ug;break;case em:le=tb;break;case"scroll":case"scrollend":le=Og;break;case"wheel":le=lb;break;case"copy":case"cut":case"paste":le=Yg;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":le=Mh;break;case"toggle":case"beforetoggle":le=ab}var Ve=(n&4)!==0,Tt=!Ve&&(e==="scroll"||e==="scrollend"),Q=Ve?ee!==null?ee+"Capture":null:ee;Ve=[];for(var X=P,J;X!==null;){var oe=X;if(J=oe.stateNode,oe=oe.tag,oe!==5&&oe!==26&&oe!==27||J===null||Q===null||(oe=ae(X,Q),oe!=null&&Ve.push(is(X,oe,J))),Tt)break;X=X.return}0<Ve.length&&(ee=new le(ee,Re,null,a,ie),ce.push({event:ee,listeners:Ve}))}}if((n&7)===0){e:{if(ee=e==="mouseover"||e==="pointerover",le=e==="mouseout"||e==="pointerout",ee&&a!==Ni&&(Re=a.relatedTarget||a.fromElement)&&(hr(Re)||Re[kl]))break e;if((le||ee)&&(ee=ie.window===ie?ie:(ee=ie.ownerDocument)?ee.defaultView||ee.parentWindow:window,le?(Re=a.relatedTarget||a.toElement,le=P,Re=Re?hr(Re):null,Re!==null&&(Tt=u(Re),Ve=Re.tag,Re!==Tt||Ve!==5&&Ve!==27&&Ve!==6)&&(Re=null)):(le=null,Re=P),le!==Re)){if(Ve=Dh,oe="onMouseLeave",Q="onMouseEnter",X="mouse",(e==="pointerout"||e==="pointerover")&&(Ve=Mh,oe="onPointerLeave",Q="onPointerEnter",X="pointer"),Tt=le==null?ee:gn(le),J=Re==null?ee:gn(Re),ee=new Ve(oe,X+"leave",le,a,ie),ee.target=Tt,ee.relatedTarget=J,oe=null,hr(ie)===P&&(Ve=new Ve(Q,X+"enter",Re,a,ie),Ve.target=J,Ve.relatedTarget=Tt,oe=Ve),Tt=oe,le&&Re)t:{for(Ve=r2,Q=le,X=Re,J=0,oe=Q;oe;oe=Ve(oe))J++;oe=0;for(var Ue=X;Ue;Ue=Ve(Ue))oe++;for(;0<J-oe;)Q=Ve(Q),J--;for(;0<oe-J;)X=Ve(X),oe--;for(;J--;){if(Q===X||X!==null&&Q===X.alternate){Ve=Q;break t}Q=Ve(Q),X=Ve(X)}Ve=null}else Ve=null;le!==null&&jp(ce,ee,le,Ve,!1),Re!==null&&Tt!==null&&jp(ce,Tt,Re,Ve,!0)}}e:{if(ee=P?gn(P):window,le=ee.nodeName&&ee.nodeName.toLowerCase(),le==="select"||le==="input"&&ee.type==="file")var bt=Hh;else if(Lh(ee))if(Uh)bt=xb;else{bt=hb;var Oe=fb}else le=ee.nodeName,!le||le.toLowerCase()!=="input"||ee.type!=="checkbox"&&ee.type!=="radio"?P&&Ei(P.elementType)&&(bt=Hh):bt=mb;if(bt&&(bt=bt(e,P))){$h(ce,bt,a,ie);break e}Oe&&Oe(e,ee,P),e==="focusout"&&P&&ee.type==="number"&&P.memoizedProps.value!=null&&Ci(ee,"number",ee.value)}switch(Oe=P?gn(P):window,e){case"focusin":(Lh(Oe)||Oe.contentEditable==="true")&&(Ra=Oe,eu=P,_i=null);break;case"focusout":_i=eu=Ra=null;break;case"mousedown":tu=!0;break;case"contextmenu":case"mouseup":case"dragend":tu=!1,Qh(ce,a,ie);break;case"selectionchange":if(yb)break;case"keydown":case"keyup":Qh(ce,a,ie)}var lt;if(Wc)e:{switch(e){case"compositionstart":var dt="onCompositionStart";break e;case"compositionend":dt="onCompositionEnd";break e;case"compositionupdate":dt="onCompositionUpdate";break e}dt=void 0}else Fa?Oh(e,a)&&(dt="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(dt="onCompositionStart");dt&&(Fh&&a.locale!=="ko"&&(Fa||dt!=="onCompositionStart"?dt==="onCompositionEnd"&&Fa&&(lt=mt()):(Me=ie,Ie="value"in Me?Me.value:Me.textContent,Fa=!0)),Oe=Ho(P,dt),0<Oe.length&&(dt=new zh(dt,e,null,a,ie),ce.push({event:dt,listeners:Oe}),lt?dt.data=lt:(lt=Bh(a),lt!==null&&(dt.data=lt)))),(lt=sb?ob(e,a):cb(e,a))&&(dt=Ho(P,"onBeforeInput"),0<dt.length&&(Oe=new zh("onBeforeInput","beforeinput",null,a,ie),ce.push({event:Oe,listeners:dt}),Oe.data=lt)),e2(ce,e,P,a,ie)}wp(ce,n)})}function is(e,n,a){return{instance:e,listener:n,currentTarget:a}}function Ho(e,n){for(var a=n+"Capture",o=[];e!==null;){var h=e,p=h.stateNode;if(h=h.tag,h!==5&&h!==26&&h!==27||p===null||(h=ae(e,a),h!=null&&o.unshift(is(e,h,p)),h=ae(e,n),h!=null&&o.push(is(e,h,p))),e.tag===3)return o;e=e.return}return[]}function r2(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function jp(e,n,a,o,h){for(var p=n._reactName,w=[];a!==null&&a!==o;){var N=a,U=N.alternate,P=N.stateNode;if(N=N.tag,U!==null&&U===o)break;N!==5&&N!==26&&N!==27||P===null||(U=P,h?(P=ae(a,p),P!=null&&w.unshift(is(a,P,U))):h||(P=ae(a,p),P!=null&&w.push(is(a,P,U)))),a=a.return}w.length!==0&&e.push({event:n,listeners:w})}var a2=/\r\n?/g,i2=/\u0000|\uFFFD/g;function Sp(e){return(typeof e=="string"?e:""+e).replace(a2,`
|
|
49
|
-
`).replace(i2,"")}function Cp(e,n){return n=Sp(n),Sp(e)===n}function At(e,n,a,o,h,p){switch(a){case"children":typeof o=="string"?n==="body"||n==="textarea"&&o===""||yr(e,o):(typeof o=="number"||typeof o=="bigint")&&n!=="body"&&yr(e,""+o);break;case"className":Cl(e,"class",o);break;case"tabIndex":Cl(e,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":Cl(e,a,o);break;case"style":za(e,o,p);break;case"data":if(n!=="object"){Cl(e,"data",o);break}case"src":case"href":if(o===""&&(n!=="a"||a!=="href")){e.removeAttribute(a);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(a);break}o=Jr(""+o),e.setAttribute(a,o);break;case"action":case"formAction":if(typeof o=="function"){e.setAttribute(a,"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 p=="function"&&(a==="formAction"?(n!=="input"&&At(e,n,"name",h.name,h,null),At(e,n,"formEncType",h.formEncType,h,null),At(e,n,"formMethod",h.formMethod,h,null),At(e,n,"formTarget",h.formTarget,h,null)):(At(e,n,"encType",h.encType,h,null),At(e,n,"method",h.method,h,null),At(e,n,"target",h.target,h,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(a);break}o=Jr(""+o),e.setAttribute(a,o);break;case"onClick":o!=null&&(e.onclick=hl);break;case"onScroll":o!=null&&ot("scroll",e);break;case"onScrollEnd":o!=null&&ot("scrollend",e);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(i(61));if(a=o.__html,a!=null){if(h.children!=null)throw Error(i(60));e.innerHTML=a}}break;case"multiple":e.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":e.muted=o&&typeof o!="function"&&typeof o!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(o==null||typeof o=="function"||typeof o=="boolean"||typeof o=="symbol"){e.removeAttribute("xlink:href");break}a=Jr(""+o),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(a,""+o):e.removeAttribute(a);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":o&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":o===!0?e.setAttribute(a,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(a,o):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?e.setAttribute(a,o):e.removeAttribute(a);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?e.removeAttribute(a):e.setAttribute(a,o);break;case"popover":ot("beforetoggle",e),ot("toggle",e),Sl(e,"popover",o);break;case"xlinkActuate":dl(e,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":dl(e,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":dl(e,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":dl(e,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":dl(e,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":dl(e,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":dl(e,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":dl(e,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":dl(e,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":Sl(e,"is",o);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=Xc.get(a)||a,Sl(e,a,o))}}function Ed(e,n,a,o,h,p){switch(a){case"style":za(e,o,p);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(i(61));if(a=o.__html,a!=null){if(h.children!=null)throw Error(i(60));e.innerHTML=a}}break;case"children":typeof o=="string"?yr(e,o):(typeof o=="number"||typeof o=="bigint")&&yr(e,""+o);break;case"onScroll":o!=null&&ot("scroll",e);break;case"onScrollEnd":o!=null&&ot("scrollend",e);break;case"onClick":o!=null&&(e.onclick=hl);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Yl.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(h=a.endsWith("Capture"),n=a.slice(2,h?a.length-7:void 0),p=e[hn]||null,p=p!=null?p[a]:null,typeof p=="function"&&e.removeEventListener(n,p,h),typeof o=="function")){typeof p!="function"&&p!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(n,o,h);break e}a in e?e[a]=o:o===!0?e.setAttribute(a,""):Sl(e,a,o)}}}function yn(e,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ot("error",e),ot("load",e);var o=!1,h=!1,p;for(p in a)if(a.hasOwnProperty(p)){var w=a[p];if(w!=null)switch(p){case"src":o=!0;break;case"srcSet":h=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:At(e,n,p,w,a,null)}}h&&At(e,n,"srcSet",a.srcSet,a,null),o&&At(e,n,"src",a.src,a,null);return;case"input":ot("invalid",e);var N=p=w=h=null,U=null,P=null;for(o in a)if(a.hasOwnProperty(o)){var ie=a[o];if(ie!=null)switch(o){case"name":h=ie;break;case"type":w=ie;break;case"checked":U=ie;break;case"defaultChecked":P=ie;break;case"value":p=ie;break;case"defaultValue":N=ie;break;case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(i(137,n));break;default:At(e,n,o,ie,a,null)}}Vs(e,p,N,U,P,w,h,!1);return;case"select":ot("invalid",e),o=w=p=null;for(h in a)if(a.hasOwnProperty(h)&&(N=a[h],N!=null))switch(h){case"value":p=N;break;case"defaultValue":w=N;break;case"multiple":o=N;default:At(e,n,h,N,a,null)}n=p,a=w,e.multiple=!!o,n!=null?pr(e,!!o,n,!1):a!=null&&pr(e,!!o,a,!0);return;case"textarea":ot("invalid",e),p=h=o=null;for(w in a)if(a.hasOwnProperty(w)&&(N=a[w],N!=null))switch(w){case"value":o=N;break;case"defaultValue":h=N;break;case"children":p=N;break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(i(91));break;default:At(e,n,w,N,a,null)}Ks(e,o,h,p);return;case"option":for(U in a)if(a.hasOwnProperty(U)&&(o=a[U],o!=null))switch(U){case"selected":e.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:At(e,n,U,o,a,null)}return;case"dialog":ot("beforetoggle",e),ot("toggle",e),ot("cancel",e),ot("close",e);break;case"iframe":case"object":ot("load",e);break;case"video":case"audio":for(o=0;o<as.length;o++)ot(as[o],e);break;case"image":ot("error",e),ot("load",e);break;case"details":ot("toggle",e);break;case"embed":case"source":case"link":ot("error",e),ot("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(P in a)if(a.hasOwnProperty(P)&&(o=a[P],o!=null))switch(P){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:At(e,n,P,o,a,null)}return;default:if(Ei(n)){for(ie in a)a.hasOwnProperty(ie)&&(o=a[ie],o!==void 0&&Ed(e,n,ie,o,a,void 0));return}}for(N in a)a.hasOwnProperty(N)&&(o=a[N],o!=null&&At(e,n,N,o,a,null))}function s2(e,n,a,o){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var h=null,p=null,w=null,N=null,U=null,P=null,ie=null;for(le in a){var ce=a[le];if(a.hasOwnProperty(le)&&ce!=null)switch(le){case"checked":break;case"value":break;case"defaultValue":U=ce;default:o.hasOwnProperty(le)||At(e,n,le,null,o,ce)}}for(var ee in o){var le=o[ee];if(ce=a[ee],o.hasOwnProperty(ee)&&(le!=null||ce!=null))switch(ee){case"type":p=le;break;case"name":h=le;break;case"checked":P=le;break;case"defaultChecked":ie=le;break;case"value":w=le;break;case"defaultValue":N=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(i(137,n));break;default:le!==ce&&At(e,n,ee,le,o,ce)}}Da(e,w,N,U,P,ie,p,h);return;case"select":le=w=N=ee=null;for(p in a)if(U=a[p],a.hasOwnProperty(p)&&U!=null)switch(p){case"value":break;case"multiple":le=U;default:o.hasOwnProperty(p)||At(e,n,p,null,o,U)}for(h in o)if(p=o[h],U=a[h],o.hasOwnProperty(h)&&(p!=null||U!=null))switch(h){case"value":ee=p;break;case"defaultValue":N=p;break;case"multiple":w=p;default:p!==U&&At(e,n,h,p,o,U)}n=N,a=w,o=le,ee!=null?pr(e,!!a,ee,!1):!!o!=!!a&&(n!=null?pr(e,!!a,n,!0):pr(e,!!a,a?[]:"",!1));return;case"textarea":le=ee=null;for(N in a)if(h=a[N],a.hasOwnProperty(N)&&h!=null&&!o.hasOwnProperty(N))switch(N){case"value":break;case"children":break;default:At(e,n,N,null,o,h)}for(w in o)if(h=o[w],p=a[w],o.hasOwnProperty(w)&&(h!=null||p!=null))switch(w){case"value":ee=h;break;case"defaultValue":le=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(i(91));break;default:h!==p&&At(e,n,w,h,o,p)}Gs(e,ee,le);return;case"option":for(var Re in a)if(ee=a[Re],a.hasOwnProperty(Re)&&ee!=null&&!o.hasOwnProperty(Re))switch(Re){case"selected":e.selected=!1;break;default:At(e,n,Re,null,o,ee)}for(U in o)if(ee=o[U],le=a[U],o.hasOwnProperty(U)&&ee!==le&&(ee!=null||le!=null))switch(U){case"selected":e.selected=ee&&typeof ee!="function"&&typeof ee!="symbol";break;default:At(e,n,U,ee,o,le)}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 Ve in a)ee=a[Ve],a.hasOwnProperty(Ve)&&ee!=null&&!o.hasOwnProperty(Ve)&&At(e,n,Ve,null,o,ee);for(P in o)if(ee=o[P],le=a[P],o.hasOwnProperty(P)&&ee!==le&&(ee!=null||le!=null))switch(P){case"children":case"dangerouslySetInnerHTML":if(ee!=null)throw Error(i(137,n));break;default:At(e,n,P,ee,o,le)}return;default:if(Ei(n)){for(var Tt in a)ee=a[Tt],a.hasOwnProperty(Tt)&&ee!==void 0&&!o.hasOwnProperty(Tt)&&Ed(e,n,Tt,void 0,o,ee);for(ie in o)ee=o[ie],le=a[ie],!o.hasOwnProperty(ie)||ee===le||ee===void 0&&le===void 0||Ed(e,n,ie,ee,o,le);return}}for(var Q in a)ee=a[Q],a.hasOwnProperty(Q)&&ee!=null&&!o.hasOwnProperty(Q)&&At(e,n,Q,null,o,ee);for(ce in o)ee=o[ce],le=a[ce],!o.hasOwnProperty(ce)||ee===le||ee==null&&le==null||At(e,n,ce,ee,o,le)}function Ep(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function o2(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,a=performance.getEntriesByType("resource"),o=0;o<a.length;o++){var h=a[o],p=h.transferSize,w=h.initiatorType,N=h.duration;if(p&&N&&Ep(w)){for(w=0,N=h.responseEnd,o+=1;o<a.length;o++){var U=a[o],P=U.startTime;if(P>N)break;var ie=U.transferSize,ce=U.initiatorType;ie&&Ep(ce)&&(U=U.responseEnd,w+=ie*(U<N?1:(N-P)/(U-P)))}if(--o,n+=8*(p+w)/(h.duration/1e3),e++,10<e)break}}if(0<e)return n/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Nd=null,Ad=null;function Uo(e){return e.nodeType===9?e:e.ownerDocument}function Np(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 Ap(e,n){if(e===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&n==="foreignObject"?0:e}function Td(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var Dd=null;function c2(){var e=window.event;return e&&e.type==="popstate"?e===Dd?!1:(Dd=e,!0):(Dd=null,!1)}var Tp=typeof setTimeout=="function"?setTimeout:void 0,u2=typeof clearTimeout=="function"?clearTimeout:void 0,Dp=typeof Promise=="function"?Promise:void 0,d2=typeof queueMicrotask=="function"?queueMicrotask:typeof Dp<"u"?function(e){return Dp.resolve(null).then(e).catch(f2)}:Tp;function f2(e){setTimeout(function(){throw e})}function Rr(e){return e==="head"}function zp(e,n){var a=n,o=0;do{var h=a.nextSibling;if(e.removeChild(a),h&&h.nodeType===8)if(a=h.data,a==="/$"||a==="/&"){if(o===0){e.removeChild(h),si(n);return}o--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")o++;else if(a==="html")ss(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,ss(a);for(var p=a.firstChild;p;){var w=p.nextSibling,N=p.nodeName;p[fr]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&p.rel.toLowerCase()==="stylesheet"||a.removeChild(p),p=w}}else a==="body"&&ss(e.ownerDocument.body);a=h}while(a);si(n)}function Mp(e,n){var a=e;e=0;do{var o=a.nextSibling;if(a.nodeType===1?n?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(n?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),o&&o.nodeType===8)if(a=o.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=o}while(a)}function zd(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var a=n;switch(n=n.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":zd(a),Aa(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function h2(e,n,a,o){for(;e.nodeType===1;){var h=a;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!o&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(o){if(!e[fr])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(p=e.getAttribute("rel"),p==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(p!==h.rel||e.getAttribute("href")!==(h.href==null||h.href===""?null:h.href)||e.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin)||e.getAttribute("title")!==(h.title==null?null:h.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(p=e.getAttribute("src"),(p!==(h.src==null?null:h.src)||e.getAttribute("type")!==(h.type==null?null:h.type)||e.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin))&&p&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var p=h.name==null?null:""+h.name;if(h.type==="hidden"&&e.getAttribute("name")===p)return e}else return e;if(e=al(e.nextSibling),e===null)break}return null}function m2(e,n,a){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=al(e.nextSibling),e===null))return null;return e}function Fp(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=al(e.nextSibling),e===null))return null;return e}function Md(e){return e.data==="$?"||e.data==="$~"}function Fd(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function x2(e,n){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||a.readyState!=="loading")n();else{var o=function(){n(),a.removeEventListener("DOMContentLoaded",o)};a.addEventListener("DOMContentLoaded",o),e._reactRetry=o}}function al(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return e}var Rd=null;function Rp(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(n===0)return al(e.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}e=e.nextSibling}return null}function _p(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(n===0)return e;n--}else a!=="/$"&&a!=="/&"||n++}e=e.previousSibling}return null}function Op(e,n,a){switch(n=Uo(a),e){case"html":if(e=n.documentElement,!e)throw Error(i(452));return e;case"head":if(e=n.head,!e)throw Error(i(453));return e;case"body":if(e=n.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function ss(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);Aa(e)}var il=new Map,Bp=new Set;function Io(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var ar=Z.d;Z.d={f:p2,r:y2,D:g2,C:b2,L:v2,m:w2,X:j2,S:k2,M:S2};function p2(){var e=ar.f(),n=Fo();return e||n}function y2(e){var n=jl(e);n!==null&&n.tag===5&&n.type==="form"?ex(n):ar.r(e)}var ri=typeof document>"u"?null:document;function Lp(e,n,a){var o=ri;if(o&&typeof n=="string"&&n){var h=Dn(n);h='link[rel="'+e+'"][href="'+h+'"]',typeof a=="string"&&(h+='[crossorigin="'+a+'"]'),Bp.has(h)||(Bp.add(h),e={rel:e,crossOrigin:a,href:n},o.querySelector(h)===null&&(n=o.createElement("link"),yn(n,"link",e),Ut(n),o.head.appendChild(n)))}}function g2(e){ar.D(e),Lp("dns-prefetch",e,null)}function b2(e,n){ar.C(e,n),Lp("preconnect",e,n)}function v2(e,n,a){ar.L(e,n,a);var o=ri;if(o&&e&&n){var h='link[rel="preload"][as="'+Dn(n)+'"]';n==="image"&&a&&a.imageSrcSet?(h+='[imagesrcset="'+Dn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(h+='[imagesizes="'+Dn(a.imageSizes)+'"]')):h+='[href="'+Dn(e)+'"]';var p=h;switch(n){case"style":p=ai(e);break;case"script":p=ii(e)}il.has(p)||(e=y({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:e,as:n},a),il.set(p,e),o.querySelector(h)!==null||n==="style"&&o.querySelector(os(p))||n==="script"&&o.querySelector(cs(p))||(n=o.createElement("link"),yn(n,"link",e),Ut(n),o.head.appendChild(n)))}}function w2(e,n){ar.m(e,n);var a=ri;if(a&&e){var o=n&&typeof n.as=="string"?n.as:"script",h='link[rel="modulepreload"][as="'+Dn(o)+'"][href="'+Dn(e)+'"]',p=h;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=ii(e)}if(!il.has(p)&&(e=y({rel:"modulepreload",href:e},n),il.set(p,e),a.querySelector(h)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(cs(p)))return}o=a.createElement("link"),yn(o,"link",e),Ut(o),a.head.appendChild(o)}}}function k2(e,n,a){ar.S(e,n,a);var o=ri;if(o&&e){var h=Tn(o).hoistableStyles,p=ai(e);n=n||"default";var w=h.get(p);if(!w){var N={loading:0,preload:null};if(w=o.querySelector(os(p)))N.loading=5;else{e=y({rel:"stylesheet",href:e,"data-precedence":n},a),(a=il.get(p))&&_d(e,a);var U=w=o.createElement("link");Ut(U),yn(U,"link",e),U._p=new Promise(function(P,ie){U.onload=P,U.onerror=ie}),U.addEventListener("load",function(){N.loading|=1}),U.addEventListener("error",function(){N.loading|=2}),N.loading|=4,Yo(w,n,o)}w={type:"stylesheet",instance:w,count:1,state:N},h.set(p,w)}}}function j2(e,n){ar.X(e,n);var a=ri;if(a&&e){var o=Tn(a).hoistableScripts,h=ii(e),p=o.get(h);p||(p=a.querySelector(cs(h)),p||(e=y({src:e,async:!0},n),(n=il.get(h))&&Od(e,n),p=a.createElement("script"),Ut(p),yn(p,"link",e),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function S2(e,n){ar.M(e,n);var a=ri;if(a&&e){var o=Tn(a).hoistableScripts,h=ii(e),p=o.get(h);p||(p=a.querySelector(cs(h)),p||(e=y({src:e,async:!0,type:"module"},n),(n=il.get(h))&&Od(e,n),p=a.createElement("script"),Ut(p),yn(p,"link",e),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function $p(e,n,a,o){var h=(h=Ne.current)?Io(h):null;if(!h)throw Error(i(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(n=ai(a.href),a=Tn(h).hoistableStyles,o=a.get(n),o||(o={type:"style",instance:null,count:0,state:null},a.set(n,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=ai(a.href);var p=Tn(h).hoistableStyles,w=p.get(e);if(w||(h=h.ownerDocument||h,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(e,w),(p=h.querySelector(os(e)))&&!p._p&&(w.instance=p,w.state.loading=5),il.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},il.set(e,a),p||C2(h,e,a,w.state))),n&&o===null)throw Error(i(528,""));return w}if(n&&o!==null)throw Error(i(529,""));return null;case"script":return n=a.async,a=a.src,typeof a=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=ii(a),a=Tn(h).hoistableScripts,o=a.get(n),o||(o={type:"script",instance:null,count:0,state:null},a.set(n,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,e))}}function ai(e){return'href="'+Dn(e)+'"'}function os(e){return'link[rel="stylesheet"]['+e+"]"}function Hp(e){return y({},e,{"data-precedence":e.precedence,precedence:null})}function C2(e,n,a,o){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?o.loading=1:(n=e.createElement("link"),o.preload=n,n.addEventListener("load",function(){return o.loading|=1}),n.addEventListener("error",function(){return o.loading|=2}),yn(n,"link",a),Ut(n),e.head.appendChild(n))}function ii(e){return'[src="'+Dn(e)+'"]'}function cs(e){return"script[async]"+e}function Up(e,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var o=e.querySelector('style[data-href~="'+Dn(a.href)+'"]');if(o)return n.instance=o,Ut(o),o;var h=y({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return o=(e.ownerDocument||e).createElement("style"),Ut(o),yn(o,"style",h),Yo(o,a.precedence,e),n.instance=o;case"stylesheet":h=ai(a.href);var p=e.querySelector(os(h));if(p)return n.state.loading|=4,n.instance=p,Ut(p),p;o=Hp(a),(h=il.get(h))&&_d(o,h),p=(e.ownerDocument||e).createElement("link"),Ut(p);var w=p;return w._p=new Promise(function(N,U){w.onload=N,w.onerror=U}),yn(p,"link",o),n.state.loading|=4,Yo(p,a.precedence,e),n.instance=p;case"script":return p=ii(a.src),(h=e.querySelector(cs(p)))?(n.instance=h,Ut(h),h):(o=a,(h=il.get(p))&&(o=y({},a),Od(o,h)),e=e.ownerDocument||e,h=e.createElement("script"),Ut(h),yn(h,"link",o),e.head.appendChild(h),n.instance=h);case"void":return null;default:throw Error(i(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(o=n.instance,n.state.loading|=4,Yo(o,a.precedence,e));return n.instance}function Yo(e,n,a){for(var o=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),h=o.length?o[o.length-1]:null,p=h,w=0;w<o.length;w++){var N=o[w];if(N.dataset.precedence===n)p=N;else if(p!==h)break}p?p.parentNode.insertBefore(e,p.nextSibling):(n=a.nodeType===9?a.head:a,n.insertBefore(e,n.firstChild))}function _d(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function Od(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var qo=null;function Ip(e,n,a){if(qo===null){var o=new Map,h=qo=new Map;h.set(a,o)}else h=qo,o=h.get(a),o||(o=new Map,h.set(a,o));if(o.has(e))return o;for(o.set(e,null),a=a.getElementsByTagName(e),h=0;h<a.length;h++){var p=a[h];if(!(p[fr]||p[Jt]||e==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var w=p.getAttribute(n)||"";w=e+w;var N=o.get(w);N?N.push(p):o.set(w,[p])}}return o}function Yp(e,n,a){e=e.ownerDocument||e,e.head.insertBefore(a,n==="title"?e.querySelector("head > title"):null)}function E2(e,n,a){if(a===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return e=n.disabled,typeof n.precedence=="string"&&e==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function qp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function N2(e,n,a,o){if(a.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var h=ai(o.href),p=n.querySelector(os(h));if(p){n=p._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=Xo.bind(e),n.then(e,e)),a.state.loading|=4,a.instance=p,Ut(p);return}p=n.ownerDocument||n,o=Hp(o),(h=il.get(h))&&_d(o,h),p=p.createElement("link"),Ut(p);var w=p;w._p=new Promise(function(N,U){w.onload=N,w.onerror=U}),yn(p,"link",o),a.instance=p}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=Xo.bind(e),n.addEventListener("load",a),n.addEventListener("error",a))}}var Bd=0;function A2(e,n){return e.stylesheets&&e.count===0&&Go(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var o=setTimeout(function(){if(e.stylesheets&&Go(e,e.stylesheets),e.unsuspend){var p=e.unsuspend;e.unsuspend=null,p()}},6e4+n);0<e.imgBytes&&Bd===0&&(Bd=62500*o2());var h=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Go(e,e.stylesheets),e.unsuspend)){var p=e.unsuspend;e.unsuspend=null,p()}},(e.imgBytes>Bd?50:800)+n);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(o),clearTimeout(h)}}:null}function Xo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Go(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Vo=null;function Go(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Vo=new Map,n.forEach(T2,e),Vo=null,Xo.call(e))}function T2(e,n){if(!(n.state.loading&4)){var a=Vo.get(e);if(a)var o=a.get(null);else{a=new Map,Vo.set(e,a);for(var h=e.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p<h.length;p++){var w=h[p];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(a.set(w.dataset.precedence,w),o=w)}o&&a.set(null,o)}h=n.instance,w=h.getAttribute("data-precedence"),p=a.get(w)||o,p===o&&a.set(null,h),a.set(w,h),this.count++,o=Xo.bind(this),h.addEventListener("load",o),h.addEventListener("error",o),p?p.parentNode.insertBefore(h,p.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(h,e.firstChild)),n.state.loading|=4}}var us={$$typeof:F,Provider:null,Consumer:null,_currentValue:de,_currentValue2:de,_threadCount:0};function D2(e,n,a,o,h,p,w,N,U){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=Zr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Zr(0),this.hiddenUpdates=Zr(null),this.identifierPrefix=o,this.onUncaughtError=h,this.onCaughtError=p,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=U,this.incompleteTransitions=new Map}function Xp(e,n,a,o,h,p,w,N,U,P,ie,ce){return e=new D2(e,n,a,w,U,P,ie,ce,N),n=1,p===!0&&(n|=24),p=Un(3,null,null,n),e.current=p,p.stateNode=e,n=pu(),n.refCount++,e.pooledCache=n,n.refCount++,p.memoizedState={element:o,isDehydrated:a,cache:n},vu(p),e}function Vp(e){return e?(e=Ba,e):Ba}function Gp(e,n,a,o,h,p){h=Vp(h),o.context===null?o.context=h:o.pendingContext=h,o=jr(n),o.payload={element:a},p=p===void 0?null:p,p!==null&&(o.callback=p),a=Sr(e,o,n),a!==null&&(On(a,e,n),Ii(a,e,n))}function Kp(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<n?a:n}}function Ld(e,n){Kp(e,n),(e=e.alternate)&&Kp(e,n)}function Qp(e){if(e.tag===13||e.tag===31){var n=na(e,67108864);n!==null&&On(n,e,67108864),Ld(e,67108864)}}function Wp(e){if(e.tag===13||e.tag===31){var n=Vn();n=vl(n);var a=na(e,n);a!==null&&On(a,e,n),Ld(e,n)}}var Ko=!0;function z2(e,n,a,o){var h=L.T;L.T=null;var p=Z.p;try{Z.p=2,$d(e,n,a,o)}finally{Z.p=p,L.T=h}}function M2(e,n,a,o){var h=L.T;L.T=null;var p=Z.p;try{Z.p=8,$d(e,n,a,o)}finally{Z.p=p,L.T=h}}function $d(e,n,a,o){if(Ko){var h=Hd(o);if(h===null)Cd(e,n,o,Qo,a),Jp(e,o);else if(R2(h,e,n,a,o))o.stopPropagation();else if(Jp(e,o),n&4&&-1<F2.indexOf(e)){for(;h!==null;){var p=jl(h);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var w=$n(p.pendingLanes);if(w!==0){var N=p;for(N.pendingLanes|=2,N.entangledLanes|=2;w;){var U=1<<31-Pe(w);N.entanglements[1]|=U,w&=~U}Dl(p),(kt&6)===0&&(zo=gt()+500,rs(0))}}break;case 31:case 13:N=na(p,2),N!==null&&On(N,p,2),Fo(),Ld(p,2)}if(p=Hd(o),p===null&&Cd(e,n,o,Qo,a),p===h)break;h=p}h!==null&&o.stopPropagation()}else Cd(e,n,o,null,a)}}function Hd(e){return e=Pt(e),Ud(e)}var Qo=null;function Ud(e){if(Qo=null,e=hr(e),e!==null){var n=u(e);if(n===null)e=null;else{var a=n.tag;if(a===13){if(e=d(n),e!==null)return e;e=null}else if(a===31){if(e=m(n),e!==null)return e;e=null}else if(a===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return Qo=e,null}function Zp(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(Rt()){case re:return 2;case pe:return 8;case Te:case Ye:return 32;case xe:return 268435456;default:return 32}default:return 32}}var Id=!1,_r=null,Or=null,Br=null,ds=new Map,fs=new Map,Lr=[],F2="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 Jp(e,n){switch(e){case"focusin":case"focusout":_r=null;break;case"dragenter":case"dragleave":Or=null;break;case"mouseover":case"mouseout":Br=null;break;case"pointerover":case"pointerout":ds.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":fs.delete(n.pointerId)}}function hs(e,n,a,o,h,p){return e===null||e.nativeEvent!==p?(e={blockedOn:n,domEventName:a,eventSystemFlags:o,nativeEvent:p,targetContainers:[h]},n!==null&&(n=jl(n),n!==null&&Qp(n)),e):(e.eventSystemFlags|=o,n=e.targetContainers,h!==null&&n.indexOf(h)===-1&&n.push(h),e)}function R2(e,n,a,o,h){switch(n){case"focusin":return _r=hs(_r,e,n,a,o,h),!0;case"dragenter":return Or=hs(Or,e,n,a,o,h),!0;case"mouseover":return Br=hs(Br,e,n,a,o,h),!0;case"pointerover":var p=h.pointerId;return ds.set(p,hs(ds.get(p)||null,e,n,a,o,h)),!0;case"gotpointercapture":return p=h.pointerId,fs.set(p,hs(fs.get(p)||null,e,n,a,o,h)),!0}return!1}function Pp(e){var n=hr(e.target);if(n!==null){var a=u(n);if(a!==null){if(n=a.tag,n===13){if(n=d(a),n!==null){e.blockedOn=n,wi(e.priority,function(){Wp(a)});return}}else if(n===31){if(n=m(a),n!==null){e.blockedOn=n,wi(e.priority,function(){Wp(a)});return}}else if(n===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Wo(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var a=Hd(e.nativeEvent);if(a===null){a=e.nativeEvent;var o=new a.constructor(a.type,a);Ni=o,a.target.dispatchEvent(o),Ni=null}else return n=jl(a),n!==null&&Qp(n),e.blockedOn=a,!1;n.shift()}return!0}function e1(e,n,a){Wo(e)&&a.delete(n)}function _2(){Id=!1,_r!==null&&Wo(_r)&&(_r=null),Or!==null&&Wo(Or)&&(Or=null),Br!==null&&Wo(Br)&&(Br=null),ds.forEach(e1),fs.forEach(e1)}function Zo(e,n){e.blockedOn===n&&(e.blockedOn=null,Id||(Id=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,_2)))}var Jo=null;function t1(e){Jo!==e&&(Jo=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Jo===e&&(Jo=null);for(var n=0;n<e.length;n+=3){var a=e[n],o=e[n+1],h=e[n+2];if(typeof o!="function"){if(Ud(o||a)===null)continue;break}var p=jl(a);p!==null&&(e.splice(n,3),n-=3,Hu(p,{pending:!0,data:h,method:a.method,action:o},o,h))}}))}function si(e){function n(U){return Zo(U,e)}_r!==null&&Zo(_r,e),Or!==null&&Zo(Or,e),Br!==null&&Zo(Br,e),ds.forEach(n),fs.forEach(n);for(var a=0;a<Lr.length;a++){var o=Lr[a];o.blockedOn===e&&(o.blockedOn=null)}for(;0<Lr.length&&(a=Lr[0],a.blockedOn===null);)Pp(a),a.blockedOn===null&&Lr.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(o=0;o<a.length;o+=3){var h=a[o],p=a[o+1],w=h[hn]||null;if(typeof p=="function")w||t1(a);else if(w){var N=null;if(p&&p.hasAttribute("formAction")){if(h=p,w=p[hn]||null)N=w.formAction;else if(Ud(h)!==null)continue}else N=w.action;typeof N=="function"?a[o+1]=N:(a.splice(o,3),o-=3),t1(a)}}}function n1(){function e(p){p.canIntercept&&p.info==="react-transition"&&p.intercept({handler:function(){return new Promise(function(w){return h=w})},focusReset:"manual",scroll:"manual"})}function n(){h!==null&&(h(),h=null),o||setTimeout(a,20)}function a(){if(!o&&!navigation.transition){var p=navigation.currentEntry;p&&p.url!=null&&navigation.navigate(p.url,{state:p.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var o=!1,h=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){o=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),h!==null&&(h(),h=null)}}}function Yd(e){this._internalRoot=e}Po.prototype.render=Yd.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(i(409));var a=n.current,o=Vn();Gp(a,o,e,n,null,null)},Po.prototype.unmount=Yd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;Gp(e.current,2,null,e,null,null),Fo(),n[kl]=null}};function Po(e){this._internalRoot=e}Po.prototype.unstable_scheduleHydration=function(e){if(e){var n=Ul();e={blockedOn:null,target:e,priority:n};for(var a=0;a<Lr.length&&n!==0&&n<Lr[a].priority;a++);Lr.splice(a,0,e),a===0&&Pp(e)}};var l1=l.version;if(l1!=="19.2.4")throw Error(i(527,l1,"19.2.4"));Z.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(i(188)):(e=Object.keys(e).join(","),Error(i(268,e)));return e=f(n),e=e!==null?g(e):null,e=e===null?null:e.stateNode,e};var O2={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:L,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ec=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ec.isDisabled&&ec.supportsFiber)try{He=ec.inject(O2),Xe=ec}catch{}}return xs.createRoot=function(e,n){if(!c(e))throw Error(i(299));var a=!1,o="",h=ux,p=dx,w=fx;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onUncaughtError!==void 0&&(h=n.onUncaughtError),n.onCaughtError!==void 0&&(p=n.onCaughtError),n.onRecoverableError!==void 0&&(w=n.onRecoverableError)),n=Xp(e,1,!1,null,null,a,o,null,h,p,w,n1),e[kl]=n.current,Sd(e),new Yd(n)},xs.hydrateRoot=function(e,n,a){if(!c(e))throw Error(i(299));var o=!1,h="",p=ux,w=dx,N=fx,U=null;return a!=null&&(a.unstable_strictMode===!0&&(o=!0),a.identifierPrefix!==void 0&&(h=a.identifierPrefix),a.onUncaughtError!==void 0&&(p=a.onUncaughtError),a.onCaughtError!==void 0&&(w=a.onCaughtError),a.onRecoverableError!==void 0&&(N=a.onRecoverableError),a.formState!==void 0&&(U=a.formState)),n=Xp(e,1,!0,n,a??null,o,h,U,p,w,N,n1),n.context=Vp(null),a=n.current,o=Vn(),o=vl(o),h=jr(o),h.callback=null,Sr(a,h,o),a=o,n.current.lanes=a,cl(n,a),Dl(n),e[kl]=n.current,Sd(e),new Po(n)},xs.version="19.2.4",xs}var m1;function K2(){if(m1)return Vd.exports;m1=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(l){console.error(l)}}return t(),Vd.exports=G2(),Vd.exports}var Q2=K2();const W2="modulepreload",Z2=function(t){return"/"+t},x1={},J2=function(l,r,i){let c=Promise.resolve();if(r&&r.length>0){let d=function(f){return Promise.all(f.map(g=>Promise.resolve(g).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};document.getElementsByTagName("link");const m=document.querySelector("meta[property=csp-nonce]"),x=(m==null?void 0:m.nonce)||(m==null?void 0:m.getAttribute("nonce"));c=d(r.map(f=>{if(f=Z2(f),f in x1)return;x1[f]=!0;const g=f.endsWith(".css"),y=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${y}`))return;const b=document.createElement("link");if(b.rel=g?"stylesheet":W2,g||(b.as="script"),b.crossOrigin="",b.href=f,x&&b.setAttribute("nonce",x),document.head.appendChild(b),g)return new Promise((v,S)=>{b.addEventListener("load",v),b.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${f}`)))})}))}function u(d){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=d,window.dispatchEvent(m),!m.defaultPrevented)throw d}return c.then(d=>{for(const m of d||[])m.status==="rejected"&&u(m.reason);return l().catch(u)})};class P2 extends k.Component{constructor(){super(...arguments);r1(this,"state",{hasError:!1,error:null})}static getDerivedStateFromError(r){return{hasError:!0,error:r}}render(){var r;return this.state.hasError?s.jsx("div",{className:"h-screen flex items-center justify-center bg-[var(--floor-light)]",children:s.jsxs("div",{className:"text-center max-w-md",children:[s.jsx("div",{className:"text-4xl mb-3",children:"🚨"}),s.jsx("div",{className:"text-gray-800 font-semibold mb-2",children:"Something went wrong"}),s.jsx("div",{className:"text-gray-500 text-sm mb-4",children:((r=this.state.error)==null?void 0:r.message)??"An unexpected error occurred."}),s.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 bg-gray-800 text-white rounded-lg text-sm hover:bg-gray-700",children:"Reload"})]})}):this.props.children}}const Ls="/api";async function Mt(t){const l=await fetch(`${Ls}${t}`);if(!l.ok)throw new Error(`API error: ${l.status}`);return l.json()}async function vn(t,l){const r=await fetch(`${Ls}${t}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!r.ok)throw new Error(`API error: ${r.status}`);return r.json()}async function Wd(t,l){const r=await fetch(`${Ls}${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!r.ok)throw new Error(`API error: ${r.status}`);return r.json()}async function Hr(t,l){const r={method:"DELETE"};l!==void 0&&(r.headers={"Content-Type":"application/json"},r.body=JSON.stringify(l));const i=await fetch(`${Ls}${t}`,r);if(!i.ok)throw new Error(`API error: ${i.status}`);return i.json()}const Ce={getCompany:()=>Mt("/company"),getRoles:()=>Mt("/roles"),getRole:t=>Mt(`/roles/${t}`),getProjects:()=>Mt("/projects"),getProject:t=>Mt(`/projects/${t}`),getStandups:()=>Mt("/operations/standups"),getWaves:()=>Mt("/operations/waves"),getDecisions:()=>Mt("/operations/decisions"),getOrgTree:()=>Mt("/engine/org"),getSkills:()=>Mt("/skills"),exportSkills:t=>Mt(`/skills/export/${t}`),getSkillRegistry:()=>Mt("/skills/registry"),installRegistrySkill:(t,l)=>vn("/skills/registry/install",{skillId:t,url:l}),createRole:t=>vn("/engine/roles",t),updateRole:(t,l)=>Wd(`/engine/roles/${t}`,l),deleteRole:t=>Hr(`/engine/roles/${t}`),getSessions:()=>Mt("/sessions"),getSession:t=>Mt(`/sessions/${t}`),createSession:(t,l="talk")=>vn("/sessions",{roleId:t,mode:l}),deleteSession:t=>Hr(`/sessions/${t}`),deleteSessions:t=>Hr("/sessions",{ids:t}),deleteEmptySessions:()=>Hr("/sessions?empty=true"),updateSession:(t,l)=>Wd(`/sessions/${t}`,l),startJob:t=>vn("/jobs",t),getJob:t=>Mt(`/jobs/${t}`),listJobs:t=>{const l=new URLSearchParams;t!=null&&t.status&&l.set("status",t.status),t!=null&&t.roleId&&l.set("roleId",t.roleId);const r=l.toString();return Mt(`/jobs${r?"?"+r:""}`)},abortJob:t=>Hr(`/jobs/${t}`),replyToJob:(t,l)=>vn(`/jobs/${t}/reply`,{message:l}),getStatus:()=>Mt("/status"),detectEngine:()=>vn("/setup/detect-engine",{}),validatePath:t=>vn("/setup/validate-path",{path:t}),scaffold:t=>vn("/setup/scaffold",t),getTeams:()=>Mt("/setup/teams"),browse:t=>vn("/setup/browse",{path:t}),connectAkb:t=>vn("/setup/connect-akb",{path:t}),getKnowledge:()=>Mt("/knowledge"),getKnowledgeDoc:t=>Mt(`/knowledge/${t}`),createKnowledgeDoc:t=>vn("/knowledge",t),updateKnowledgeDoc:(t,l)=>fetch(`${Ls}/knowledge/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:l})}).then(r=>{if(!r.ok)throw new Error(`API error: ${r.status}`);return r.json()}),deleteKnowledgeDoc:t=>Hr(`/knowledge/${t}`),getPreferences:()=>Mt("/preferences"),updatePreferences:t=>Wd("/preferences",t),chatInChannel:t=>vn("/speech/chat",t),getSaveStatus:()=>Mt("/save/status"),save:t=>vn("/save",{message:t}),getSaveHistory:(t=20)=>Mt(`/save/history?limit=${t}`),restoreSave:(t,l)=>vn("/save/restore",{sha:t,paths:l}),initGit:()=>vn("/save/init",{}),getCostSummary:()=>Mt("/cost/summary"),getSyncRoles:()=>Mt("/sync/roles"),applySyncUpdate:t=>vn("/sync/apply",t),getCompanyStats:()=>Mt("/sync/stats"),getGitStatus:()=>Mt("/git/status"),deleteWorktree:t=>Hr(`/git/worktrees/${encodeURIComponent(t)}`),deleteBranch:t=>Hr(`/git/branches/${encodeURIComponent(t)}`)};function V0(t){const[l,r]=k.useState([]),[i,c]=k.useState("idle"),[u,d]=k.useState(""),[m,x]=k.useState([]),f=k.useRef(-1),g=k.useRef(null),y=k.useRef(0),b=k.useCallback(()=>{var C;if(!t)return;(C=g.current)==null||C.abort();const S=new AbortController;g.current=S,c("connecting");const j=f.current+1,E=`/api/jobs/${t}/stream?from=${j}`;fetch(E,{signal:S.signal}).then(async A=>{if(!A.ok||!A.body){c("error");return}c("streaming");const F=A.body.getReader(),_=new TextDecoder;let H="";for(;;){const{done:M,value:I}=await F.read();if(M)break;H+=_.decode(I,{stream:!0});const W=H.split(`
|
|
50
|
-
`);H=W.pop()??"";let te="";for(const D of W)if(D.startsWith("event: "))te=D.slice(7).trim();else if(D.startsWith("data: ")){try{const Y=JSON.parse(D.slice(6));if(te==="activity"){const B=Y;B.seq>f.current&&(f.current=B.seq),r(V=>V.some(ne=>ne.seq===B.seq)?V:[...V,B]),B.type==="text"&&d(V=>V+(B.data.text??"")),B.type==="dispatch:start"&&B.data.childJobId&&x(V=>[...V,B.data.childJobId]),B.type==="job:done"?c("done"):B.type==="job:error"&&c("error")}else if(te==="stream:end"){const B=Y.reason;c(B==="done"?"done":B==="error"?"error":"done")}}catch{}te=""}}i==="streaming"&&c("done")}).catch(A=>{A.name!=="AbortError"&&(c("error"),y.current<3&&(y.current++,setTimeout(b,1e3*y.current)))})},[t]),v=k.useCallback(()=>{y.current=0,b()},[b]);return k.useEffect(()=>{if(!t){r([]),c("idle"),d(""),x([]),f.current=-1;return}return r([]),d(""),x([]),f.current=-1,y.current=0,b(),()=>{var S;(S=g.current)==null||S.abort()}},[t,b]),{events:l,status:i,textOutput:u,childJobIds:m,reconnect:v}}function ev(t,l){const r={};return(t[t.length-1]===""?[...t,""]:t).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const tv=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,nv=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,lv={};function p1(t,l){return(lv.jsx?nv:tv).test(t)}const rv=/[ \t\n\f\r]/g;function av(t){return typeof t=="object"?t.type==="text"?y1(t.value):!1:y1(t)}function y1(t){return t.replace(rv,"")===""}class $s{constructor(l,r,i){this.normal=r,this.property=l,i&&(this.space=i)}}$s.prototype.normal={};$s.prototype.property={};$s.prototype.space=void 0;function G0(t,l){const r={},i={};for(const c of t)Object.assign(r,c.property),Object.assign(i,c.normal);return new $s(r,i,l)}function Of(t){return t.toLowerCase()}class Ln{constructor(l,r){this.attribute=r,this.property=l}}Ln.prototype.attribute="";Ln.prototype.booleanish=!1;Ln.prototype.boolean=!1;Ln.prototype.commaOrSpaceSeparated=!1;Ln.prototype.commaSeparated=!1;Ln.prototype.defined=!1;Ln.prototype.mustUseProperty=!1;Ln.prototype.number=!1;Ln.prototype.overloadedBoolean=!1;Ln.prototype.property="";Ln.prototype.spaceSeparated=!1;Ln.prototype.space=void 0;let iv=0;const rt=Sa(),rn=Sa(),Bf=Sa(),we=Sa(),_t=Sa(),hi=Sa(),Gn=Sa();function Sa(){return 2**++iv}const Lf=Object.freeze(Object.defineProperty({__proto__:null,boolean:rt,booleanish:rn,commaOrSpaceSeparated:Gn,commaSeparated:hi,number:we,overloadedBoolean:Bf,spaceSeparated:_t},Symbol.toStringTag,{value:"Module"})),Zd=Object.keys(Lf);class lh extends Ln{constructor(l,r,i,c){let u=-1;if(super(l,r),g1(this,"space",c),typeof i=="number")for(;++u<Zd.length;){const d=Zd[u];g1(this,Zd[u],(i&Lf[d])===Lf[d])}}}lh.prototype.defined=!0;function g1(t,l,r){r&&(t[l]=r)}function gi(t){const l={},r={};for(const[i,c]of Object.entries(t.properties)){const u=new lh(i,t.transform(t.attributes||{},i),c,t.space);t.mustUseProperty&&t.mustUseProperty.includes(i)&&(u.mustUseProperty=!0),l[i]=u,r[Of(i)]=i,r[Of(u.attribute)]=i}return new $s(l,r,t.space)}const K0=gi({properties:{ariaActiveDescendant:null,ariaAtomic:rn,ariaAutoComplete:null,ariaBusy:rn,ariaChecked:rn,ariaColCount:we,ariaColIndex:we,ariaColSpan:we,ariaControls:_t,ariaCurrent:null,ariaDescribedBy:_t,ariaDetails:null,ariaDisabled:rn,ariaDropEffect:_t,ariaErrorMessage:null,ariaExpanded:rn,ariaFlowTo:_t,ariaGrabbed:rn,ariaHasPopup:null,ariaHidden:rn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:_t,ariaLevel:we,ariaLive:null,ariaModal:rn,ariaMultiLine:rn,ariaMultiSelectable:rn,ariaOrientation:null,ariaOwns:_t,ariaPlaceholder:null,ariaPosInSet:we,ariaPressed:rn,ariaReadOnly:rn,ariaRelevant:null,ariaRequired:rn,ariaRoleDescription:_t,ariaRowCount:we,ariaRowIndex:we,ariaRowSpan:we,ariaSelected:rn,ariaSetSize:we,ariaSort:null,ariaValueMax:we,ariaValueMin:we,ariaValueNow:we,ariaValueText:null,role:null},transform(t,l){return l==="role"?l:"aria-"+l.slice(4).toLowerCase()}});function Q0(t,l){return l in t?t[l]:l}function W0(t,l){return Q0(t,l.toLowerCase())}const sv=gi({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:hi,acceptCharset:_t,accessKey:_t,action:null,allow:null,allowFullScreen:rt,allowPaymentRequest:rt,allowUserMedia:rt,alt:null,as:null,async:rt,autoCapitalize:null,autoComplete:_t,autoFocus:rt,autoPlay:rt,blocking:_t,capture:null,charSet:null,checked:rt,cite:null,className:_t,cols:we,colSpan:null,content:null,contentEditable:rn,controls:rt,controlsList:_t,coords:we|hi,crossOrigin:null,data:null,dateTime:null,decoding:null,default:rt,defer:rt,dir:null,dirName:null,disabled:rt,download:Bf,draggable:rn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:rt,formTarget:null,headers:_t,height:we,hidden:Bf,high:we,href:null,hrefLang:null,htmlFor:_t,httpEquiv:_t,id:null,imageSizes:null,imageSrcSet:null,inert:rt,inputMode:null,integrity:null,is:null,isMap:rt,itemId:null,itemProp:_t,itemRef:_t,itemScope:rt,itemType:_t,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:rt,low:we,manifest:null,max:null,maxLength:we,media:null,method:null,min:null,minLength:we,multiple:rt,muted:rt,name:null,nonce:null,noModule:rt,noValidate:rt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:rt,optimum:we,pattern:null,ping:_t,placeholder:null,playsInline:rt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:rt,referrerPolicy:null,rel:_t,required:rt,reversed:rt,rows:we,rowSpan:we,sandbox:_t,scope:null,scoped:rt,seamless:rt,selected:rt,shadowRootClonable:rt,shadowRootDelegatesFocus:rt,shadowRootMode:null,shape:null,size:we,sizes:null,slot:null,span:we,spellCheck:rn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:we,step:null,style:null,tabIndex:we,target:null,title:null,translate:null,type:null,typeMustMatch:rt,useMap:null,value:rn,width:we,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:_t,axis:null,background:null,bgColor:null,border:we,borderColor:null,bottomMargin:we,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:rt,declare:rt,event:null,face:null,frame:null,frameBorder:null,hSpace:we,leftMargin:we,link:null,longDesc:null,lowSrc:null,marginHeight:we,marginWidth:we,noResize:rt,noHref:rt,noShade:rt,noWrap:rt,object:null,profile:null,prompt:null,rev:null,rightMargin:we,rules:null,scheme:null,scrolling:rn,standby:null,summary:null,text:null,topMargin:we,valueType:null,version:null,vAlign:null,vLink:null,vSpace:we,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:rt,disableRemotePlayback:rt,prefix:null,property:null,results:we,security:null,unselectable:null},space:"html",transform:W0}),ov=gi({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",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",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",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",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",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",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Gn,accentHeight:we,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:we,amplitude:we,arabicForm:null,ascent:we,attributeName:null,attributeType:null,azimuth:we,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:we,by:null,calcMode:null,capHeight:we,className:_t,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:we,diffuseConstant:we,direction:null,display:null,dur:null,divisor:we,dominantBaseline:null,download:rt,dx:null,dy:null,edgeMode:null,editable:null,elevation:we,enableBackground:null,end:null,event:null,exponent:we,externalResourcesRequired:null,fill:null,fillOpacity:we,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:hi,g2:hi,glyphName:hi,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:we,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:we,horizOriginX:we,horizOriginY:we,id:null,ideographic:we,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:we,k:we,k1:we,k2:we,k3:we,k4:we,kernelMatrix:Gn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:we,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:we,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:we,overlineThickness:we,paintOrder:null,panose1:null,path:null,pathLength:we,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:_t,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:we,pointsAtY:we,pointsAtZ:we,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Gn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Gn,rev:Gn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Gn,requiredFeatures:Gn,requiredFonts:Gn,requiredFormats:Gn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:we,specularExponent:we,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:we,strikethroughThickness:we,string:null,stroke:null,strokeDashArray:Gn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:we,strokeOpacity:we,strokeWidth:null,style:null,surfaceScale:we,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Gn,tabIndex:we,tableValues:null,target:null,targetX:we,targetY:we,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Gn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:we,underlineThickness:we,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:we,values:null,vAlphabetic:we,vMathematical:we,vectorEffect:null,vHanging:we,vIdeographic:we,version:null,vertAdvY:we,vertOriginX:we,vertOriginY:we,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:we,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Q0}),Z0=gi({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,l){return"xlink:"+l.slice(5).toLowerCase()}}),J0=gi({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:W0}),P0=gi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,l){return"xml:"+l.slice(3).toLowerCase()}}),cv={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},uv=/[A-Z]/g,b1=/-[a-z]/g,dv=/^data[-\w.:]+$/i;function fv(t,l){const r=Of(l);let i=l,c=Ln;if(r in t.normal)return t.property[t.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&dv.test(l)){if(l.charAt(4)==="-"){const u=l.slice(5).replace(b1,mv);i="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=l.slice(4);if(!b1.test(u)){let d=u.replace(uv,hv);d.charAt(0)!=="-"&&(d="-"+d),l="data"+d}}c=lh}return new c(i,l)}function hv(t){return"-"+t.toLowerCase()}function mv(t){return t.charAt(1).toUpperCase()}const xv=G0([K0,sv,Z0,J0,P0],"html"),rh=G0([K0,ov,Z0,J0,P0],"svg");function pv(t){return t.join(" ").trim()}var oi={},Jd,v1;function yv(){if(v1)return Jd;v1=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,l=/\n/g,r=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,c=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,d=/^[;\s]*/,m=/^\s+|\s+$/g,x=`
|
|
51
|
-
`,f="/",g="*",y="",b="comment",v="declaration";function S(E,C){if(typeof E!="string")throw new TypeError("First argument must be a string");if(!E)return[];C=C||{};var A=1,F=1;function _(ne){var G=ne.match(l);G&&(A+=G.length);var L=ne.lastIndexOf(x);F=~L?ne.length-L:F+ne.length}function H(){var ne={line:A,column:F};return function(G){return G.position=new M(ne),te(),G}}function M(ne){this.start=ne,this.end={line:A,column:F},this.source=C.source}M.prototype.content=E;function I(ne){var G=new Error(C.source+":"+A+":"+F+": "+ne);if(G.reason=ne,G.filename=C.source,G.line=A,G.column=F,G.source=E,!C.silent)throw G}function W(ne){var G=ne.exec(E);if(G){var L=G[0];return _(L),E=E.slice(L.length),G}}function te(){W(r)}function D(ne){var G;for(ne=ne||[];G=Y();)G!==!1&&ne.push(G);return ne}function Y(){var ne=H();if(!(f!=E.charAt(0)||g!=E.charAt(1))){for(var G=2;y!=E.charAt(G)&&(g!=E.charAt(G)||f!=E.charAt(G+1));)++G;if(G+=2,y===E.charAt(G-1))return I("End of comment missing");var L=E.slice(2,G-2);return F+=2,_(L),E=E.slice(G),F+=2,ne({type:b,comment:L})}}function B(){var ne=H(),G=W(i);if(G){if(Y(),!W(c))return I("property missing ':'");var L=W(u),Z=ne({type:v,property:j(G[0].replace(t,y)),value:L?j(L[0].replace(t,y)):y});return W(d),Z}}function V(){var ne=[];D(ne);for(var G;G=B();)G!==!1&&(ne.push(G),D(ne));return ne}return te(),V()}function j(E){return E?E.replace(m,y):y}return Jd=S,Jd}var w1;function gv(){if(w1)return oi;w1=1;var t=oi&&oi.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(oi,"__esModule",{value:!0}),oi.default=r;const l=t(yv());function r(i,c){let u=null;if(!i||typeof i!="string")return u;const d=(0,l.default)(i),m=typeof c=="function";return d.forEach(x=>{if(x.type!=="declaration")return;const{property:f,value:g}=x;m?c(f,g,x):g&&(u=u||{},u[f]=g)}),u}return oi}var ps={},k1;function bv(){if(k1)return ps;k1=1,Object.defineProperty(ps,"__esModule",{value:!0}),ps.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,l=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,c=/^-(ms)-/,u=function(f){return!f||r.test(f)||t.test(f)},d=function(f,g){return g.toUpperCase()},m=function(f,g){return"".concat(g,"-")},x=function(f,g){return g===void 0&&(g={}),u(f)?f:(f=f.toLowerCase(),g.reactCompat?f=f.replace(c,m):f=f.replace(i,m),f.replace(l,d))};return ps.camelCase=x,ps}var ys,j1;function vv(){if(j1)return ys;j1=1;var t=ys&&ys.__importDefault||function(c){return c&&c.__esModule?c:{default:c}},l=t(gv()),r=bv();function i(c,u){var d={};return!c||typeof c!="string"||(0,l.default)(c,function(m,x){m&&x&&(d[(0,r.camelCase)(m,u)]=x)}),d}return i.default=i,ys=i,ys}var wv=vv();const kv=X0(wv),ey=ty("end"),ah=ty("start");function ty(t){return l;function l(r){const i=r&&r.position&&r.position[t]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function jv(t){const l=ah(t),r=ey(t);if(l&&r)return{start:l,end:r}}function As(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?S1(t.position):"start"in t||"end"in t?S1(t):"line"in t||"column"in t?$f(t):""}function $f(t){return C1(t&&t.line)+":"+C1(t&&t.column)}function S1(t){return $f(t&&t.start)+"-"+$f(t&&t.end)}function C1(t){return t&&typeof t=="number"?t:1}class jn extends Error{constructor(l,r,i){super(),typeof r=="string"&&(i=r,r=void 0);let c="",u={},d=!1;if(r&&("line"in r&&"column"in r?u={place:r}:"start"in r&&"end"in r?u={place:r}:"type"in r?u={ancestors:[r],place:r.position}:u={...r}),typeof l=="string"?c=l:!u.cause&&l&&(d=!0,c=l.message,u.cause=l),!u.ruleId&&!u.source&&typeof i=="string"){const x=i.indexOf(":");x===-1?u.ruleId=i:(u.source=i.slice(0,x),u.ruleId=i.slice(x+1))}if(!u.place&&u.ancestors&&u.ancestors){const x=u.ancestors[u.ancestors.length-1];x&&(u.place=x.position)}const m=u.place&&"start"in u.place?u.place.start:u.place;this.ancestors=u.ancestors||void 0,this.cause=u.cause||void 0,this.column=m?m.column:void 0,this.fatal=void 0,this.file="",this.message=c,this.line=m?m.line:void 0,this.name=As(u.place)||"1:1",this.place=u.place||void 0,this.reason=this.message,this.ruleId=u.ruleId||void 0,this.source=u.source||void 0,this.stack=d&&u.cause&&typeof u.cause.stack=="string"?u.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}jn.prototype.file="";jn.prototype.name="";jn.prototype.reason="";jn.prototype.message="";jn.prototype.stack="";jn.prototype.column=void 0;jn.prototype.line=void 0;jn.prototype.ancestors=void 0;jn.prototype.cause=void 0;jn.prototype.fatal=void 0;jn.prototype.place=void 0;jn.prototype.ruleId=void 0;jn.prototype.source=void 0;const ih={}.hasOwnProperty,Sv=new Map,Cv=/[A-Z]/g,Ev=new Set(["table","tbody","thead","tfoot","tr"]),Nv=new Set(["td","th"]),ny="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Av(t,l){if(!l||l.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=l.filePath||void 0;let i;if(l.development){if(typeof l.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=Ov(r,l.jsxDEV)}else{if(typeof l.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof l.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=_v(r,l.jsx,l.jsxs)}const c={Fragment:l.Fragment,ancestors:[],components:l.components||{},create:i,elementAttributeNameCase:l.elementAttributeNameCase||"react",evaluater:l.createEvaluater?l.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:l.ignoreInvalidStyle||!1,passKeys:l.passKeys!==!1,passNode:l.passNode||!1,schema:l.space==="svg"?rh:xv,stylePropertyNameCase:l.stylePropertyNameCase||"dom",tableCellAlignToStyle:l.tableCellAlignToStyle!==!1},u=ly(c,t,void 0);return u&&typeof u!="string"?u:c.create(t,c.Fragment,{children:u||void 0},void 0)}function ly(t,l,r){if(l.type==="element")return Tv(t,l,r);if(l.type==="mdxFlowExpression"||l.type==="mdxTextExpression")return Dv(t,l);if(l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement")return Mv(t,l,r);if(l.type==="mdxjsEsm")return zv(t,l);if(l.type==="root")return Fv(t,l,r);if(l.type==="text")return Rv(t,l)}function Tv(t,l,r){const i=t.schema;let c=i;l.tagName.toLowerCase()==="svg"&&i.space==="html"&&(c=rh,t.schema=c),t.ancestors.push(l);const u=ay(t,l.tagName,!1),d=Bv(t,l);let m=oh(t,l);return Ev.has(l.tagName)&&(m=m.filter(function(x){return typeof x=="string"?!av(x):!0})),ry(t,d,u,l),sh(d,m),t.ancestors.pop(),t.schema=i,t.create(l,u,d,r)}function Dv(t,l){if(l.data&&l.data.estree&&t.evaluater){const i=l.data.estree.body[0];return i.type,t.evaluater.evaluateExpression(i.expression)}Ms(t,l.position)}function zv(t,l){if(l.data&&l.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(l.data.estree);Ms(t,l.position)}function Mv(t,l,r){const i=t.schema;let c=i;l.name==="svg"&&i.space==="html"&&(c=rh,t.schema=c),t.ancestors.push(l);const u=l.name===null?t.Fragment:ay(t,l.name,!0),d=Lv(t,l),m=oh(t,l);return ry(t,d,u,l),sh(d,m),t.ancestors.pop(),t.schema=i,t.create(l,u,d,r)}function Fv(t,l,r){const i={};return sh(i,oh(t,l)),t.create(l,t.Fragment,i,r)}function Rv(t,l){return l.value}function ry(t,l,r,i){typeof r!="string"&&r!==t.Fragment&&t.passNode&&(l.node=i)}function sh(t,l){if(l.length>0){const r=l.length>1?l:l[0];r&&(t.children=r)}}function _v(t,l,r){return i;function i(c,u,d,m){const f=Array.isArray(d.children)?r:l;return m?f(u,d,m):f(u,d)}}function Ov(t,l){return r;function r(i,c,u,d){const m=Array.isArray(u.children),x=ah(i);return l(c,u,d,m,{columnNumber:x?x.column-1:void 0,fileName:t,lineNumber:x?x.line:void 0},void 0)}}function Bv(t,l){const r={};let i,c;for(c in l.properties)if(c!=="children"&&ih.call(l.properties,c)){const u=$v(t,c,l.properties[c]);if(u){const[d,m]=u;t.tableCellAlignToStyle&&d==="align"&&typeof m=="string"&&Nv.has(l.tagName)?i=m:r[d]=m}}if(i){const u=r.style||(r.style={});u[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return r}function Lv(t,l){const r={};for(const i of l.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&t.evaluater){const u=i.data.estree.body[0];u.type;const d=u.expression;d.type;const m=d.properties[0];m.type,Object.assign(r,t.evaluater.evaluateExpression(m.argument))}else Ms(t,l.position);else{const c=i.name;let u;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&t.evaluater){const m=i.value.data.estree.body[0];m.type,u=t.evaluater.evaluateExpression(m.expression)}else Ms(t,l.position);else u=i.value===null?!0:i.value;r[c]=u}return r}function oh(t,l){const r=[];let i=-1;const c=t.passKeys?new Map:Sv;for(;++i<l.children.length;){const u=l.children[i];let d;if(t.passKeys){const x=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(x){const f=c.get(x)||0;d=x+"-"+f,c.set(x,f+1)}}const m=ly(t,u,d);m!==void 0&&r.push(m)}return r}function $v(t,l,r){const i=fv(t.schema,l);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=i.commaSeparated?ev(r):pv(r)),i.property==="style"){let c=typeof r=="object"?r:Hv(t,String(r));return t.stylePropertyNameCase==="css"&&(c=Uv(c)),["style",c]}return[t.elementAttributeNameCase==="react"&&i.space?cv[i.property]||i.property:i.attribute,r]}}function Hv(t,l){try{return kv(l,{reactCompat:!0})}catch(r){if(t.ignoreInvalidStyle)return{};const i=r,c=new jn("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw c.file=t.filePath||void 0,c.url=ny+"#cannot-parse-style-attribute",c}}function ay(t,l,r){let i;if(!r)i={type:"Literal",value:l};else if(l.includes(".")){const c=l.split(".");let u=-1,d;for(;++u<c.length;){const m=p1(c[u])?{type:"Identifier",name:c[u]}:{type:"Literal",value:c[u]};d=d?{type:"MemberExpression",object:d,property:m,computed:!!(u&&m.type==="Literal"),optional:!1}:m}i=d}else i=p1(l)&&!/^[a-z]/.test(l)?{type:"Identifier",name:l}:{type:"Literal",value:l};if(i.type==="Literal"){const c=i.value;return ih.call(t.components,c)?t.components[c]:c}if(t.evaluater)return t.evaluater.evaluateExpression(i);Ms(t)}function Ms(t,l){const r=new jn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:l,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=t.filePath||void 0,r.url=ny+"#cannot-handle-mdx-estrees-without-createevaluater",r}function Uv(t){const l={};let r;for(r in t)ih.call(t,r)&&(l[Iv(r)]=t[r]);return l}function Iv(t){let l=t.replace(Cv,Yv);return l.slice(0,3)==="ms-"&&(l="-"+l),l}function Yv(t){return"-"+t.toLowerCase()}const Pd={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},qv={};function ch(t,l){const r=qv,i=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,c=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return iy(t,i,c)}function iy(t,l,r){if(Xv(t)){if("value"in t)return t.type==="html"&&!r?"":t.value;if(l&&"alt"in t&&t.alt)return t.alt;if("children"in t)return E1(t.children,l,r)}return Array.isArray(t)?E1(t,l,r):""}function E1(t,l,r){const i=[];let c=-1;for(;++c<t.length;)i[c]=iy(t[c],l,r);return i.join("")}function Xv(t){return!!(t&&typeof t=="object")}const N1=document.createElement("i");function uh(t){const l="&"+t+";";N1.innerHTML=l;const r=N1.textContent;return r.charCodeAt(r.length-1)===59&&t!=="semi"||r===l?!1:r}function Qn(t,l,r,i){const c=t.length;let u=0,d;if(l<0?l=-l>c?0:c+l:l=l>c?c:l,r=r>0?r:0,i.length<1e4)d=Array.from(i),d.unshift(l,r),t.splice(...d);else for(r&&t.splice(l,r);u<i.length;)d=i.slice(u,u+1e4),d.unshift(l,0),t.splice(...d),u+=1e4,l+=1e4}function sl(t,l){return t.length>0?(Qn(t,t.length,0,l),t):l}const A1={}.hasOwnProperty;function sy(t){const l={};let r=-1;for(;++r<t.length;)Vv(l,t[r]);return l}function Vv(t,l){let r;for(r in l){const c=(A1.call(t,r)?t[r]:void 0)||(t[r]={}),u=l[r];let d;if(u)for(d in u){A1.call(c,d)||(c[d]=[]);const m=u[d];Gv(c[d],Array.isArray(m)?m:m?[m]:[])}}}function Gv(t,l){let r=-1;const i=[];for(;++r<l.length;)(l[r].add==="after"?t:i).push(l[r]);Qn(t,0,0,i)}function oy(t,l){const r=Number.parseInt(t,l);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function bl(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const En=Kr(/[A-Za-z]/),kn=Kr(/[\dA-Za-z]/),Kv=Kr(/[#-'*+\--9=?A-Z^-~]/);function Sc(t){return t!==null&&(t<32||t===127)}const Hf=Kr(/\d/),Qv=Kr(/[\dA-Fa-f]/),Wv=Kr(/[!-/:-@[-`{-~]/);function qe(t){return t!==null&&t<-2}function Ft(t){return t!==null&&(t<0||t===32)}function ct(t){return t===-2||t===-1||t===32}const Rc=Kr(new RegExp("\\p{P}|\\p{S}","u")),ka=Kr(/\s/);function Kr(t){return l;function l(r){return r!==null&&r>-1&&t.test(String.fromCharCode(r))}}function bi(t){const l=[];let r=-1,i=0,c=0;for(;++r<t.length;){const u=t.charCodeAt(r);let d="";if(u===37&&kn(t.charCodeAt(r+1))&&kn(t.charCodeAt(r+2)))c=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(d=String.fromCharCode(u));else if(u>55295&&u<57344){const m=t.charCodeAt(r+1);u<56320&&m>56319&&m<57344?(d=String.fromCharCode(u,m),c=1):d="�"}else d=String.fromCharCode(u);d&&(l.push(t.slice(i,r),encodeURIComponent(d)),i=r+c+1,d=""),c&&(r+=c,c=0)}return l.join("")+t.slice(i)}function pt(t,l,r,i){const c=i?i-1:Number.POSITIVE_INFINITY;let u=0;return d;function d(x){return ct(x)?(t.enter(r),m(x)):l(x)}function m(x){return ct(x)&&u++<c?(t.consume(x),m):(t.exit(r),l(x))}}const Zv={tokenize:Jv};function Jv(t){const l=t.attempt(this.parser.constructs.contentInitial,i,c);let r;return l;function i(m){if(m===null){t.consume(m);return}return t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),pt(t,l,"linePrefix")}function c(m){return t.enter("paragraph"),u(m)}function u(m){const x=t.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=x),r=x,d(m)}function d(m){if(m===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(m);return}return qe(m)?(t.consume(m),t.exit("chunkText"),u):(t.consume(m),d)}}const Pv={tokenize:ew},T1={tokenize:tw};function ew(t){const l=this,r=[];let i=0,c,u,d;return m;function m(F){if(i<r.length){const _=r[i];return l.containerState=_[1],t.attempt(_[0].continuation,x,f)(F)}return f(F)}function x(F){if(i++,l.containerState._closeFlow){l.containerState._closeFlow=void 0,c&&A();const _=l.events.length;let H=_,M;for(;H--;)if(l.events[H][0]==="exit"&&l.events[H][1].type==="chunkFlow"){M=l.events[H][1].end;break}C(i);let I=_;for(;I<l.events.length;)l.events[I][1].end={...M},I++;return Qn(l.events,H+1,0,l.events.slice(_)),l.events.length=I,f(F)}return m(F)}function f(F){if(i===r.length){if(!c)return b(F);if(c.currentConstruct&&c.currentConstruct.concrete)return S(F);l.interrupt=!!(c.currentConstruct&&!c._gfmTableDynamicInterruptHack)}return l.containerState={},t.check(T1,g,y)(F)}function g(F){return c&&A(),C(i),b(F)}function y(F){return l.parser.lazy[l.now().line]=i!==r.length,d=l.now().offset,S(F)}function b(F){return l.containerState={},t.attempt(T1,v,S)(F)}function v(F){return i++,r.push([l.currentConstruct,l.containerState]),b(F)}function S(F){if(F===null){c&&A(),C(0),t.consume(F);return}return c=c||l.parser.flow(l.now()),t.enter("chunkFlow",{_tokenizer:c,contentType:"flow",previous:u}),j(F)}function j(F){if(F===null){E(t.exit("chunkFlow"),!0),C(0),t.consume(F);return}return qe(F)?(t.consume(F),E(t.exit("chunkFlow")),i=0,l.interrupt=void 0,m):(t.consume(F),j)}function E(F,_){const H=l.sliceStream(F);if(_&&H.push(null),F.previous=u,u&&(u.next=F),u=F,c.defineSkip(F.start),c.write(H),l.parser.lazy[F.start.line]){let M=c.events.length;for(;M--;)if(c.events[M][1].start.offset<d&&(!c.events[M][1].end||c.events[M][1].end.offset>d))return;const I=l.events.length;let W=I,te,D;for(;W--;)if(l.events[W][0]==="exit"&&l.events[W][1].type==="chunkFlow"){if(te){D=l.events[W][1].end;break}te=!0}for(C(i),M=I;M<l.events.length;)l.events[M][1].end={...D},M++;Qn(l.events,W+1,0,l.events.slice(I)),l.events.length=M}}function C(F){let _=r.length;for(;_-- >F;){const H=r[_];l.containerState=H[1],H[0].exit.call(l,t)}r.length=F}function A(){c.write([null]),u=void 0,c=void 0,l.containerState._closeFlow=void 0}}function tw(t,l,r){return pt(t,t.attempt(this.parser.constructs.document,l,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function xi(t){if(t===null||Ft(t)||ka(t))return 1;if(Rc(t))return 2}function _c(t,l,r){const i=[];let c=-1;for(;++c<t.length;){const u=t[c].resolveAll;u&&!i.includes(u)&&(l=u(l,r),i.push(u))}return l}const Uf={name:"attention",resolveAll:nw,tokenize:lw};function nw(t,l){let r=-1,i,c,u,d,m,x,f,g;for(;++r<t.length;)if(t[r][0]==="enter"&&t[r][1].type==="attentionSequence"&&t[r][1]._close){for(i=r;i--;)if(t[i][0]==="exit"&&t[i][1].type==="attentionSequence"&&t[i][1]._open&&l.sliceSerialize(t[i][1]).charCodeAt(0)===l.sliceSerialize(t[r][1]).charCodeAt(0)){if((t[i][1]._close||t[r][1]._open)&&(t[r][1].end.offset-t[r][1].start.offset)%3&&!((t[i][1].end.offset-t[i][1].start.offset+t[r][1].end.offset-t[r][1].start.offset)%3))continue;x=t[i][1].end.offset-t[i][1].start.offset>1&&t[r][1].end.offset-t[r][1].start.offset>1?2:1;const y={...t[i][1].end},b={...t[r][1].start};D1(y,-x),D1(b,x),d={type:x>1?"strongSequence":"emphasisSequence",start:y,end:{...t[i][1].end}},m={type:x>1?"strongSequence":"emphasisSequence",start:{...t[r][1].start},end:b},u={type:x>1?"strongText":"emphasisText",start:{...t[i][1].end},end:{...t[r][1].start}},c={type:x>1?"strong":"emphasis",start:{...d.start},end:{...m.end}},t[i][1].end={...d.start},t[r][1].start={...m.end},f=[],t[i][1].end.offset-t[i][1].start.offset&&(f=sl(f,[["enter",t[i][1],l],["exit",t[i][1],l]])),f=sl(f,[["enter",c,l],["enter",d,l],["exit",d,l],["enter",u,l]]),f=sl(f,_c(l.parser.constructs.insideSpan.null,t.slice(i+1,r),l)),f=sl(f,[["exit",u,l],["enter",m,l],["exit",m,l],["exit",c,l]]),t[r][1].end.offset-t[r][1].start.offset?(g=2,f=sl(f,[["enter",t[r][1],l],["exit",t[r][1],l]])):g=0,Qn(t,i-1,r-i+3,f),r=i+f.length-g-2;break}}for(r=-1;++r<t.length;)t[r][1].type==="attentionSequence"&&(t[r][1].type="data");return t}function lw(t,l){const r=this.parser.constructs.attentionMarkers.null,i=this.previous,c=xi(i);let u;return d;function d(x){return u=x,t.enter("attentionSequence"),m(x)}function m(x){if(x===u)return t.consume(x),m;const f=t.exit("attentionSequence"),g=xi(x),y=!g||g===2&&c||r.includes(x),b=!c||c===2&&g||r.includes(i);return f._open=!!(u===42?y:y&&(c||!b)),f._close=!!(u===42?b:b&&(g||!y)),l(x)}}function D1(t,l){t.column+=l,t.offset+=l,t._bufferIndex+=l}const rw={name:"autolink",tokenize:aw};function aw(t,l,r){let i=0;return c;function c(v){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(v),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),u}function u(v){return En(v)?(t.consume(v),d):v===64?r(v):f(v)}function d(v){return v===43||v===45||v===46||kn(v)?(i=1,m(v)):f(v)}function m(v){return v===58?(t.consume(v),i=0,x):(v===43||v===45||v===46||kn(v))&&i++<32?(t.consume(v),m):(i=0,f(v))}function x(v){return v===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(v),t.exit("autolinkMarker"),t.exit("autolink"),l):v===null||v===32||v===60||Sc(v)?r(v):(t.consume(v),x)}function f(v){return v===64?(t.consume(v),g):Kv(v)?(t.consume(v),f):r(v)}function g(v){return kn(v)?y(v):r(v)}function y(v){return v===46?(t.consume(v),i=0,g):v===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(v),t.exit("autolinkMarker"),t.exit("autolink"),l):b(v)}function b(v){if((v===45||kn(v))&&i++<63){const S=v===45?b:y;return t.consume(v),S}return r(v)}}const Hs={partial:!0,tokenize:iw};function iw(t,l,r){return i;function i(u){return ct(u)?pt(t,c,"linePrefix")(u):c(u)}function c(u){return u===null||qe(u)?l(u):r(u)}}const cy={continuation:{tokenize:ow},exit:cw,name:"blockQuote",tokenize:sw};function sw(t,l,r){const i=this;return c;function c(d){if(d===62){const m=i.containerState;return m.open||(t.enter("blockQuote",{_container:!0}),m.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(d),t.exit("blockQuoteMarker"),u}return r(d)}function u(d){return ct(d)?(t.enter("blockQuotePrefixWhitespace"),t.consume(d),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),l):(t.exit("blockQuotePrefix"),l(d))}}function ow(t,l,r){const i=this;return c;function c(d){return ct(d)?pt(t,u,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d):u(d)}function u(d){return t.attempt(cy,l,r)(d)}}function cw(t){t.exit("blockQuote")}const uy={name:"characterEscape",tokenize:uw};function uw(t,l,r){return i;function i(u){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(u),t.exit("escapeMarker"),c}function c(u){return Wv(u)?(t.enter("characterEscapeValue"),t.consume(u),t.exit("characterEscapeValue"),t.exit("characterEscape"),l):r(u)}}const dy={name:"characterReference",tokenize:dw};function dw(t,l,r){const i=this;let c=0,u,d;return m;function m(y){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(y),t.exit("characterReferenceMarker"),x}function x(y){return y===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(y),t.exit("characterReferenceMarkerNumeric"),f):(t.enter("characterReferenceValue"),u=31,d=kn,g(y))}function f(y){return y===88||y===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(y),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),u=6,d=Qv,g):(t.enter("characterReferenceValue"),u=7,d=Hf,g(y))}function g(y){if(y===59&&c){const b=t.exit("characterReferenceValue");return d===kn&&!uh(i.sliceSerialize(b))?r(y):(t.enter("characterReferenceMarker"),t.consume(y),t.exit("characterReferenceMarker"),t.exit("characterReference"),l)}return d(y)&&c++<u?(t.consume(y),g):r(y)}}const z1={partial:!0,tokenize:hw},M1={concrete:!0,name:"codeFenced",tokenize:fw};function fw(t,l,r){const i=this,c={partial:!0,tokenize:H};let u=0,d=0,m;return x;function x(M){return f(M)}function f(M){const I=i.events[i.events.length-1];return u=I&&I[1].type==="linePrefix"?I[2].sliceSerialize(I[1],!0).length:0,m=M,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),g(M)}function g(M){return M===m?(d++,t.consume(M),g):d<3?r(M):(t.exit("codeFencedFenceSequence"),ct(M)?pt(t,y,"whitespace")(M):y(M))}function y(M){return M===null||qe(M)?(t.exit("codeFencedFence"),i.interrupt?l(M):t.check(z1,j,_)(M)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),b(M))}function b(M){return M===null||qe(M)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),y(M)):ct(M)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),pt(t,v,"whitespace")(M)):M===96&&M===m?r(M):(t.consume(M),b)}function v(M){return M===null||qe(M)?y(M):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),S(M))}function S(M){return M===null||qe(M)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),y(M)):M===96&&M===m?r(M):(t.consume(M),S)}function j(M){return t.attempt(c,_,E)(M)}function E(M){return t.enter("lineEnding"),t.consume(M),t.exit("lineEnding"),C}function C(M){return u>0&&ct(M)?pt(t,A,"linePrefix",u+1)(M):A(M)}function A(M){return M===null||qe(M)?t.check(z1,j,_)(M):(t.enter("codeFlowValue"),F(M))}function F(M){return M===null||qe(M)?(t.exit("codeFlowValue"),A(M)):(t.consume(M),F)}function _(M){return t.exit("codeFenced"),l(M)}function H(M,I,W){let te=0;return D;function D(G){return M.enter("lineEnding"),M.consume(G),M.exit("lineEnding"),Y}function Y(G){return M.enter("codeFencedFence"),ct(G)?pt(M,B,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(G):B(G)}function B(G){return G===m?(M.enter("codeFencedFenceSequence"),V(G)):W(G)}function V(G){return G===m?(te++,M.consume(G),V):te>=d?(M.exit("codeFencedFenceSequence"),ct(G)?pt(M,ne,"whitespace")(G):ne(G)):W(G)}function ne(G){return G===null||qe(G)?(M.exit("codeFencedFence"),I(G)):W(G)}}}function hw(t,l,r){const i=this;return c;function c(d){return d===null?r(d):(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),u)}function u(d){return i.parser.lazy[i.now().line]?r(d):l(d)}}const ef={name:"codeIndented",tokenize:xw},mw={partial:!0,tokenize:pw};function xw(t,l,r){const i=this;return c;function c(f){return t.enter("codeIndented"),pt(t,u,"linePrefix",5)(f)}function u(f){const g=i.events[i.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?d(f):r(f)}function d(f){return f===null?x(f):qe(f)?t.attempt(mw,d,x)(f):(t.enter("codeFlowValue"),m(f))}function m(f){return f===null||qe(f)?(t.exit("codeFlowValue"),d(f)):(t.consume(f),m)}function x(f){return t.exit("codeIndented"),l(f)}}function pw(t,l,r){const i=this;return c;function c(d){return i.parser.lazy[i.now().line]?r(d):qe(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),c):pt(t,u,"linePrefix",5)(d)}function u(d){const m=i.events[i.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?l(d):qe(d)?c(d):r(d)}}const yw={name:"codeText",previous:bw,resolve:gw,tokenize:vw};function gw(t){let l=t.length-4,r=3,i,c;if((t[r][1].type==="lineEnding"||t[r][1].type==="space")&&(t[l][1].type==="lineEnding"||t[l][1].type==="space")){for(i=r;++i<l;)if(t[i][1].type==="codeTextData"){t[r][1].type="codeTextPadding",t[l][1].type="codeTextPadding",r+=2,l-=2;break}}for(i=r-1,l++;++i<=l;)c===void 0?i!==l&&t[i][1].type!=="lineEnding"&&(c=i):(i===l||t[i][1].type==="lineEnding")&&(t[c][1].type="codeTextData",i!==c+2&&(t[c][1].end=t[i-1][1].end,t.splice(c+2,i-c-2),l-=i-c-2,i=c+2),c=void 0);return t}function bw(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function vw(t,l,r){let i=0,c,u;return d;function d(y){return t.enter("codeText"),t.enter("codeTextSequence"),m(y)}function m(y){return y===96?(t.consume(y),i++,m):(t.exit("codeTextSequence"),x(y))}function x(y){return y===null?r(y):y===32?(t.enter("space"),t.consume(y),t.exit("space"),x):y===96?(u=t.enter("codeTextSequence"),c=0,g(y)):qe(y)?(t.enter("lineEnding"),t.consume(y),t.exit("lineEnding"),x):(t.enter("codeTextData"),f(y))}function f(y){return y===null||y===32||y===96||qe(y)?(t.exit("codeTextData"),x(y)):(t.consume(y),f)}function g(y){return y===96?(t.consume(y),c++,g):c===i?(t.exit("codeTextSequence"),t.exit("codeText"),l(y)):(u.type="codeTextData",f(y))}}class ww{constructor(l){this.left=l?[...l]:[],this.right=[]}get(l){if(l<0||l>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+l+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return l<this.left.length?this.left[l]:this.right[this.right.length-l+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(l,r){const i=r??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(l,i):l>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-l+this.left.length).reverse():this.left.slice(l).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(l,r,i){const c=r||0;this.setCursor(Math.trunc(l));const u=this.right.splice(this.right.length-c,Number.POSITIVE_INFINITY);return i&&gs(this.left,i),u.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(l){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(l)}pushMany(l){this.setCursor(Number.POSITIVE_INFINITY),gs(this.left,l)}unshift(l){this.setCursor(0),this.right.push(l)}unshiftMany(l){this.setCursor(0),gs(this.right,l.reverse())}setCursor(l){if(!(l===this.left.length||l>this.left.length&&this.right.length===0||l<0&&this.left.length===0))if(l<this.left.length){const r=this.left.splice(l,Number.POSITIVE_INFINITY);gs(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-l,Number.POSITIVE_INFINITY);gs(this.left,r.reverse())}}}function gs(t,l){let r=0;if(l.length<1e4)t.push(...l);else for(;r<l.length;)t.push(...l.slice(r,r+1e4)),r+=1e4}function fy(t){const l={};let r=-1,i,c,u,d,m,x,f;const g=new ww(t);for(;++r<g.length;){for(;r in l;)r=l[r];if(i=g.get(r),r&&i[1].type==="chunkFlow"&&g.get(r-1)[1].type==="listItemPrefix"&&(x=i[1]._tokenizer.events,u=0,u<x.length&&x[u][1].type==="lineEndingBlank"&&(u+=2),u<x.length&&x[u][1].type==="content"))for(;++u<x.length&&x[u][1].type!=="content";)x[u][1].type==="chunkText"&&(x[u][1]._isInFirstContentOfListItem=!0,u++);if(i[0]==="enter")i[1].contentType&&(Object.assign(l,kw(g,r)),r=l[r],f=!0);else if(i[1]._container){for(u=r,c=void 0;u--;)if(d=g.get(u),d[1].type==="lineEnding"||d[1].type==="lineEndingBlank")d[0]==="enter"&&(c&&(g.get(c)[1].type="lineEndingBlank"),d[1].type="lineEnding",c=u);else if(!(d[1].type==="linePrefix"||d[1].type==="listItemIndent"))break;c&&(i[1].end={...g.get(c)[1].start},m=g.slice(c,r),m.unshift(i),g.splice(c,r-c+1,m))}}return Qn(t,0,Number.POSITIVE_INFINITY,g.slice(0)),!f}function kw(t,l){const r=t.get(l)[1],i=t.get(l)[2];let c=l-1;const u=[];let d=r._tokenizer;d||(d=i.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(d._contentTypeTextTrailing=!0));const m=d.events,x=[],f={};let g,y,b=-1,v=r,S=0,j=0;const E=[j];for(;v;){for(;t.get(++c)[1]!==v;);u.push(c),v._tokenizer||(g=i.sliceStream(v),v.next||g.push(null),y&&d.defineSkip(v.start),v._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=!0),d.write(g),v._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=void 0)),y=v,v=v.next}for(v=r;++b<m.length;)m[b][0]==="exit"&&m[b-1][0]==="enter"&&m[b][1].type===m[b-1][1].type&&m[b][1].start.line!==m[b][1].end.line&&(j=b+1,E.push(j),v._tokenizer=void 0,v.previous=void 0,v=v.next);for(d.events=[],v?(v._tokenizer=void 0,v.previous=void 0):E.pop(),b=E.length;b--;){const C=m.slice(E[b],E[b+1]),A=u.pop();x.push([A,A+C.length-1]),t.splice(A,2,C)}for(x.reverse(),b=-1;++b<x.length;)f[S+x[b][0]]=S+x[b][1],S+=x[b][1]-x[b][0]-1;return f}const jw={resolve:Cw,tokenize:Ew},Sw={partial:!0,tokenize:Nw};function Cw(t){return fy(t),t}function Ew(t,l){let r;return i;function i(m){return t.enter("content"),r=t.enter("chunkContent",{contentType:"content"}),c(m)}function c(m){return m===null?u(m):qe(m)?t.check(Sw,d,u)(m):(t.consume(m),c)}function u(m){return t.exit("chunkContent"),t.exit("content"),l(m)}function d(m){return t.consume(m),t.exit("chunkContent"),r.next=t.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,c}}function Nw(t,l,r){const i=this;return c;function c(d){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),pt(t,u,"linePrefix")}function u(d){if(d===null||qe(d))return r(d);const m=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?l(d):t.interrupt(i.parser.constructs.flow,r,l)(d)}}function hy(t,l,r,i,c,u,d,m,x){const f=x||Number.POSITIVE_INFINITY;let g=0;return y;function y(C){return C===60?(t.enter(i),t.enter(c),t.enter(u),t.consume(C),t.exit(u),b):C===null||C===32||C===41||Sc(C)?r(C):(t.enter(i),t.enter(d),t.enter(m),t.enter("chunkString",{contentType:"string"}),j(C))}function b(C){return C===62?(t.enter(u),t.consume(C),t.exit(u),t.exit(c),t.exit(i),l):(t.enter(m),t.enter("chunkString",{contentType:"string"}),v(C))}function v(C){return C===62?(t.exit("chunkString"),t.exit(m),b(C)):C===null||C===60||qe(C)?r(C):(t.consume(C),C===92?S:v)}function S(C){return C===60||C===62||C===92?(t.consume(C),v):v(C)}function j(C){return!g&&(C===null||C===41||Ft(C))?(t.exit("chunkString"),t.exit(m),t.exit(d),t.exit(i),l(C)):g<f&&C===40?(t.consume(C),g++,j):C===41?(t.consume(C),g--,j):C===null||C===32||C===40||Sc(C)?r(C):(t.consume(C),C===92?E:j)}function E(C){return C===40||C===41||C===92?(t.consume(C),j):j(C)}}function my(t,l,r,i,c,u){const d=this;let m=0,x;return f;function f(v){return t.enter(i),t.enter(c),t.consume(v),t.exit(c),t.enter(u),g}function g(v){return m>999||v===null||v===91||v===93&&!x||v===94&&!m&&"_hiddenFootnoteSupport"in d.parser.constructs?r(v):v===93?(t.exit(u),t.enter(c),t.consume(v),t.exit(c),t.exit(i),l):qe(v)?(t.enter("lineEnding"),t.consume(v),t.exit("lineEnding"),g):(t.enter("chunkString",{contentType:"string"}),y(v))}function y(v){return v===null||v===91||v===93||qe(v)||m++>999?(t.exit("chunkString"),g(v)):(t.consume(v),x||(x=!ct(v)),v===92?b:y)}function b(v){return v===91||v===92||v===93?(t.consume(v),m++,y):y(v)}}function xy(t,l,r,i,c,u){let d;return m;function m(b){return b===34||b===39||b===40?(t.enter(i),t.enter(c),t.consume(b),t.exit(c),d=b===40?41:b,x):r(b)}function x(b){return b===d?(t.enter(c),t.consume(b),t.exit(c),t.exit(i),l):(t.enter(u),f(b))}function f(b){return b===d?(t.exit(u),x(d)):b===null?r(b):qe(b)?(t.enter("lineEnding"),t.consume(b),t.exit("lineEnding"),pt(t,f,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===d||b===null||qe(b)?(t.exit("chunkString"),f(b)):(t.consume(b),b===92?y:g)}function y(b){return b===d||b===92?(t.consume(b),g):g(b)}}function Ts(t,l){let r;return i;function i(c){return qe(c)?(t.enter("lineEnding"),t.consume(c),t.exit("lineEnding"),r=!0,i):ct(c)?pt(t,i,r?"linePrefix":"lineSuffix")(c):l(c)}}const Aw={name:"definition",tokenize:Dw},Tw={partial:!0,tokenize:zw};function Dw(t,l,r){const i=this;let c;return u;function u(v){return t.enter("definition"),d(v)}function d(v){return my.call(i,t,m,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function m(v){return c=bl(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),v===58?(t.enter("definitionMarker"),t.consume(v),t.exit("definitionMarker"),x):r(v)}function x(v){return Ft(v)?Ts(t,f)(v):f(v)}function f(v){return hy(t,g,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function g(v){return t.attempt(Tw,y,y)(v)}function y(v){return ct(v)?pt(t,b,"whitespace")(v):b(v)}function b(v){return v===null||qe(v)?(t.exit("definition"),i.parser.defined.push(c),l(v)):r(v)}}function zw(t,l,r){return i;function i(m){return Ft(m)?Ts(t,c)(m):r(m)}function c(m){return xy(t,u,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(m)}function u(m){return ct(m)?pt(t,d,"whitespace")(m):d(m)}function d(m){return m===null||qe(m)?l(m):r(m)}}const Mw={name:"hardBreakEscape",tokenize:Fw};function Fw(t,l,r){return i;function i(u){return t.enter("hardBreakEscape"),t.consume(u),c}function c(u){return qe(u)?(t.exit("hardBreakEscape"),l(u)):r(u)}}const Rw={name:"headingAtx",resolve:_w,tokenize:Ow};function _w(t,l){let r=t.length-2,i=3,c,u;return t[i][1].type==="whitespace"&&(i+=2),r-2>i&&t[r][1].type==="whitespace"&&(r-=2),t[r][1].type==="atxHeadingSequence"&&(i===r-1||r-4>i&&t[r-2][1].type==="whitespace")&&(r-=i+1===r?2:4),r>i&&(c={type:"atxHeadingText",start:t[i][1].start,end:t[r][1].end},u={type:"chunkText",start:t[i][1].start,end:t[r][1].end,contentType:"text"},Qn(t,i,r-i+1,[["enter",c,l],["enter",u,l],["exit",u,l],["exit",c,l]])),t}function Ow(t,l,r){let i=0;return c;function c(g){return t.enter("atxHeading"),u(g)}function u(g){return t.enter("atxHeadingSequence"),d(g)}function d(g){return g===35&&i++<6?(t.consume(g),d):g===null||Ft(g)?(t.exit("atxHeadingSequence"),m(g)):r(g)}function m(g){return g===35?(t.enter("atxHeadingSequence"),x(g)):g===null||qe(g)?(t.exit("atxHeading"),l(g)):ct(g)?pt(t,m,"whitespace")(g):(t.enter("atxHeadingText"),f(g))}function x(g){return g===35?(t.consume(g),x):(t.exit("atxHeadingSequence"),m(g))}function f(g){return g===null||g===35||Ft(g)?(t.exit("atxHeadingText"),m(g)):(t.consume(g),f)}}const Bw=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],F1=["pre","script","style","textarea"],Lw={concrete:!0,name:"htmlFlow",resolveTo:Uw,tokenize:Iw},$w={partial:!0,tokenize:qw},Hw={partial:!0,tokenize:Yw};function Uw(t){let l=t.length;for(;l--&&!(t[l][0]==="enter"&&t[l][1].type==="htmlFlow"););return l>1&&t[l-2][1].type==="linePrefix"&&(t[l][1].start=t[l-2][1].start,t[l+1][1].start=t[l-2][1].start,t.splice(l-2,2)),t}function Iw(t,l,r){const i=this;let c,u,d,m,x;return f;function f(T){return g(T)}function g(T){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(T),y}function y(T){return T===33?(t.consume(T),b):T===47?(t.consume(T),u=!0,j):T===63?(t.consume(T),c=3,i.interrupt?l:z):En(T)?(t.consume(T),d=String.fromCharCode(T),E):r(T)}function b(T){return T===45?(t.consume(T),c=2,v):T===91?(t.consume(T),c=5,m=0,S):En(T)?(t.consume(T),c=4,i.interrupt?l:z):r(T)}function v(T){return T===45?(t.consume(T),i.interrupt?l:z):r(T)}function S(T){const fe="CDATA[";return T===fe.charCodeAt(m++)?(t.consume(T),m===fe.length?i.interrupt?l:B:S):r(T)}function j(T){return En(T)?(t.consume(T),d=String.fromCharCode(T),E):r(T)}function E(T){if(T===null||T===47||T===62||Ft(T)){const fe=T===47,Ee=d.toLowerCase();return!fe&&!u&&F1.includes(Ee)?(c=1,i.interrupt?l(T):B(T)):Bw.includes(d.toLowerCase())?(c=6,fe?(t.consume(T),C):i.interrupt?l(T):B(T)):(c=7,i.interrupt&&!i.parser.lazy[i.now().line]?r(T):u?A(T):F(T))}return T===45||kn(T)?(t.consume(T),d+=String.fromCharCode(T),E):r(T)}function C(T){return T===62?(t.consume(T),i.interrupt?l:B):r(T)}function A(T){return ct(T)?(t.consume(T),A):D(T)}function F(T){return T===47?(t.consume(T),D):T===58||T===95||En(T)?(t.consume(T),_):ct(T)?(t.consume(T),F):D(T)}function _(T){return T===45||T===46||T===58||T===95||kn(T)?(t.consume(T),_):H(T)}function H(T){return T===61?(t.consume(T),M):ct(T)?(t.consume(T),H):F(T)}function M(T){return T===null||T===60||T===61||T===62||T===96?r(T):T===34||T===39?(t.consume(T),x=T,I):ct(T)?(t.consume(T),M):W(T)}function I(T){return T===x?(t.consume(T),x=null,te):T===null||qe(T)?r(T):(t.consume(T),I)}function W(T){return T===null||T===34||T===39||T===47||T===60||T===61||T===62||T===96||Ft(T)?H(T):(t.consume(T),W)}function te(T){return T===47||T===62||ct(T)?F(T):r(T)}function D(T){return T===62?(t.consume(T),Y):r(T)}function Y(T){return T===null||qe(T)?B(T):ct(T)?(t.consume(T),Y):r(T)}function B(T){return T===45&&c===2?(t.consume(T),L):T===60&&c===1?(t.consume(T),Z):T===62&&c===4?(t.consume(T),R):T===63&&c===3?(t.consume(T),z):T===93&&c===5?(t.consume(T),ue):qe(T)&&(c===6||c===7)?(t.exit("htmlFlowData"),t.check($w,K,V)(T)):T===null||qe(T)?(t.exit("htmlFlowData"),V(T)):(t.consume(T),B)}function V(T){return t.check(Hw,ne,K)(T)}function ne(T){return t.enter("lineEnding"),t.consume(T),t.exit("lineEnding"),G}function G(T){return T===null||qe(T)?V(T):(t.enter("htmlFlowData"),B(T))}function L(T){return T===45?(t.consume(T),z):B(T)}function Z(T){return T===47?(t.consume(T),d="",de):B(T)}function de(T){if(T===62){const fe=d.toLowerCase();return F1.includes(fe)?(t.consume(T),R):B(T)}return En(T)&&d.length<8?(t.consume(T),d+=String.fromCharCode(T),de):B(T)}function ue(T){return T===93?(t.consume(T),z):B(T)}function z(T){return T===62?(t.consume(T),R):T===45&&c===2?(t.consume(T),z):B(T)}function R(T){return T===null||qe(T)?(t.exit("htmlFlowData"),K(T)):(t.consume(T),R)}function K(T){return t.exit("htmlFlow"),l(T)}}function Yw(t,l,r){const i=this;return c;function c(d){return qe(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),u):r(d)}function u(d){return i.parser.lazy[i.now().line]?r(d):l(d)}}function qw(t,l,r){return i;function i(c){return t.enter("lineEnding"),t.consume(c),t.exit("lineEnding"),t.attempt(Hs,l,r)}}const Xw={name:"htmlText",tokenize:Vw};function Vw(t,l,r){const i=this;let c,u,d;return m;function m(z){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(z),x}function x(z){return z===33?(t.consume(z),f):z===47?(t.consume(z),H):z===63?(t.consume(z),F):En(z)?(t.consume(z),W):r(z)}function f(z){return z===45?(t.consume(z),g):z===91?(t.consume(z),u=0,S):En(z)?(t.consume(z),A):r(z)}function g(z){return z===45?(t.consume(z),v):r(z)}function y(z){return z===null?r(z):z===45?(t.consume(z),b):qe(z)?(d=y,Z(z)):(t.consume(z),y)}function b(z){return z===45?(t.consume(z),v):y(z)}function v(z){return z===62?L(z):z===45?b(z):y(z)}function S(z){const R="CDATA[";return z===R.charCodeAt(u++)?(t.consume(z),u===R.length?j:S):r(z)}function j(z){return z===null?r(z):z===93?(t.consume(z),E):qe(z)?(d=j,Z(z)):(t.consume(z),j)}function E(z){return z===93?(t.consume(z),C):j(z)}function C(z){return z===62?L(z):z===93?(t.consume(z),C):j(z)}function A(z){return z===null||z===62?L(z):qe(z)?(d=A,Z(z)):(t.consume(z),A)}function F(z){return z===null?r(z):z===63?(t.consume(z),_):qe(z)?(d=F,Z(z)):(t.consume(z),F)}function _(z){return z===62?L(z):F(z)}function H(z){return En(z)?(t.consume(z),M):r(z)}function M(z){return z===45||kn(z)?(t.consume(z),M):I(z)}function I(z){return qe(z)?(d=I,Z(z)):ct(z)?(t.consume(z),I):L(z)}function W(z){return z===45||kn(z)?(t.consume(z),W):z===47||z===62||Ft(z)?te(z):r(z)}function te(z){return z===47?(t.consume(z),L):z===58||z===95||En(z)?(t.consume(z),D):qe(z)?(d=te,Z(z)):ct(z)?(t.consume(z),te):L(z)}function D(z){return z===45||z===46||z===58||z===95||kn(z)?(t.consume(z),D):Y(z)}function Y(z){return z===61?(t.consume(z),B):qe(z)?(d=Y,Z(z)):ct(z)?(t.consume(z),Y):te(z)}function B(z){return z===null||z===60||z===61||z===62||z===96?r(z):z===34||z===39?(t.consume(z),c=z,V):qe(z)?(d=B,Z(z)):ct(z)?(t.consume(z),B):(t.consume(z),ne)}function V(z){return z===c?(t.consume(z),c=void 0,G):z===null?r(z):qe(z)?(d=V,Z(z)):(t.consume(z),V)}function ne(z){return z===null||z===34||z===39||z===60||z===61||z===96?r(z):z===47||z===62||Ft(z)?te(z):(t.consume(z),ne)}function G(z){return z===47||z===62||Ft(z)?te(z):r(z)}function L(z){return z===62?(t.consume(z),t.exit("htmlTextData"),t.exit("htmlText"),l):r(z)}function Z(z){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(z),t.exit("lineEnding"),de}function de(z){return ct(z)?pt(t,ue,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):ue(z)}function ue(z){return t.enter("htmlTextData"),d(z)}}const dh={name:"labelEnd",resolveAll:Ww,resolveTo:Zw,tokenize:Jw},Gw={tokenize:Pw},Kw={tokenize:e5},Qw={tokenize:t5};function Ww(t){let l=-1;const r=[];for(;++l<t.length;){const i=t[l][1];if(r.push(t[l]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const c=i.type==="labelImage"?4:2;i.type="data",l+=c}}return t.length!==r.length&&Qn(t,0,t.length,r),t}function Zw(t,l){let r=t.length,i=0,c,u,d,m;for(;r--;)if(c=t[r][1],u){if(c.type==="link"||c.type==="labelLink"&&c._inactive)break;t[r][0]==="enter"&&c.type==="labelLink"&&(c._inactive=!0)}else if(d){if(t[r][0]==="enter"&&(c.type==="labelImage"||c.type==="labelLink")&&!c._balanced&&(u=r,c.type!=="labelLink")){i=2;break}}else c.type==="labelEnd"&&(d=r);const x={type:t[u][1].type==="labelLink"?"link":"image",start:{...t[u][1].start},end:{...t[t.length-1][1].end}},f={type:"label",start:{...t[u][1].start},end:{...t[d][1].end}},g={type:"labelText",start:{...t[u+i+2][1].end},end:{...t[d-2][1].start}};return m=[["enter",x,l],["enter",f,l]],m=sl(m,t.slice(u+1,u+i+3)),m=sl(m,[["enter",g,l]]),m=sl(m,_c(l.parser.constructs.insideSpan.null,t.slice(u+i+4,d-3),l)),m=sl(m,[["exit",g,l],t[d-2],t[d-1],["exit",f,l]]),m=sl(m,t.slice(d+1)),m=sl(m,[["exit",x,l]]),Qn(t,u,t.length,m),t}function Jw(t,l,r){const i=this;let c=i.events.length,u,d;for(;c--;)if((i.events[c][1].type==="labelImage"||i.events[c][1].type==="labelLink")&&!i.events[c][1]._balanced){u=i.events[c][1];break}return m;function m(b){return u?u._inactive?y(b):(d=i.parser.defined.includes(bl(i.sliceSerialize({start:u.end,end:i.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(b),t.exit("labelMarker"),t.exit("labelEnd"),x):r(b)}function x(b){return b===40?t.attempt(Gw,g,d?g:y)(b):b===91?t.attempt(Kw,g,d?f:y)(b):d?g(b):y(b)}function f(b){return t.attempt(Qw,g,y)(b)}function g(b){return l(b)}function y(b){return u._balanced=!0,r(b)}}function Pw(t,l,r){return i;function i(y){return t.enter("resource"),t.enter("resourceMarker"),t.consume(y),t.exit("resourceMarker"),c}function c(y){return Ft(y)?Ts(t,u)(y):u(y)}function u(y){return y===41?g(y):hy(t,d,m,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(y)}function d(y){return Ft(y)?Ts(t,x)(y):g(y)}function m(y){return r(y)}function x(y){return y===34||y===39||y===40?xy(t,f,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(y):g(y)}function f(y){return Ft(y)?Ts(t,g)(y):g(y)}function g(y){return y===41?(t.enter("resourceMarker"),t.consume(y),t.exit("resourceMarker"),t.exit("resource"),l):r(y)}}function e5(t,l,r){const i=this;return c;function c(m){return my.call(i,t,u,d,"reference","referenceMarker","referenceString")(m)}function u(m){return i.parser.defined.includes(bl(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?l(m):r(m)}function d(m){return r(m)}}function t5(t,l,r){return i;function i(u){return t.enter("reference"),t.enter("referenceMarker"),t.consume(u),t.exit("referenceMarker"),c}function c(u){return u===93?(t.enter("referenceMarker"),t.consume(u),t.exit("referenceMarker"),t.exit("reference"),l):r(u)}}const n5={name:"labelStartImage",resolveAll:dh.resolveAll,tokenize:l5};function l5(t,l,r){const i=this;return c;function c(m){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(m),t.exit("labelImageMarker"),u}function u(m){return m===91?(t.enter("labelMarker"),t.consume(m),t.exit("labelMarker"),t.exit("labelImage"),d):r(m)}function d(m){return m===94&&"_hiddenFootnoteSupport"in i.parser.constructs?r(m):l(m)}}const r5={name:"labelStartLink",resolveAll:dh.resolveAll,tokenize:a5};function a5(t,l,r){const i=this;return c;function c(d){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(d),t.exit("labelMarker"),t.exit("labelLink"),u}function u(d){return d===94&&"_hiddenFootnoteSupport"in i.parser.constructs?r(d):l(d)}}const tf={name:"lineEnding",tokenize:i5};function i5(t,l){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),pt(t,l,"linePrefix")}}const gc={name:"thematicBreak",tokenize:s5};function s5(t,l,r){let i=0,c;return u;function u(f){return t.enter("thematicBreak"),d(f)}function d(f){return c=f,m(f)}function m(f){return f===c?(t.enter("thematicBreakSequence"),x(f)):i>=3&&(f===null||qe(f))?(t.exit("thematicBreak"),l(f)):r(f)}function x(f){return f===c?(t.consume(f),i++,x):(t.exit("thematicBreakSequence"),ct(f)?pt(t,m,"whitespace")(f):m(f))}}const Bn={continuation:{tokenize:d5},exit:h5,name:"list",tokenize:u5},o5={partial:!0,tokenize:m5},c5={partial:!0,tokenize:f5};function u5(t,l,r){const i=this,c=i.events[i.events.length-1];let u=c&&c[1].type==="linePrefix"?c[2].sliceSerialize(c[1],!0).length:0,d=0;return m;function m(v){const S=i.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(S==="listUnordered"?!i.containerState.marker||v===i.containerState.marker:Hf(v)){if(i.containerState.type||(i.containerState.type=S,t.enter(S,{_container:!0})),S==="listUnordered")return t.enter("listItemPrefix"),v===42||v===45?t.check(gc,r,f)(v):f(v);if(!i.interrupt||v===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),x(v)}return r(v)}function x(v){return Hf(v)&&++d<10?(t.consume(v),x):(!i.interrupt||d<2)&&(i.containerState.marker?v===i.containerState.marker:v===41||v===46)?(t.exit("listItemValue"),f(v)):r(v)}function f(v){return t.enter("listItemMarker"),t.consume(v),t.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||v,t.check(Hs,i.interrupt?r:g,t.attempt(o5,b,y))}function g(v){return i.containerState.initialBlankLine=!0,u++,b(v)}function y(v){return ct(v)?(t.enter("listItemPrefixWhitespace"),t.consume(v),t.exit("listItemPrefixWhitespace"),b):r(v)}function b(v){return i.containerState.size=u+i.sliceSerialize(t.exit("listItemPrefix"),!0).length,l(v)}}function d5(t,l,r){const i=this;return i.containerState._closeFlow=void 0,t.check(Hs,c,u);function c(m){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,pt(t,l,"listItemIndent",i.containerState.size+1)(m)}function u(m){return i.containerState.furtherBlankLines||!ct(m)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,d(m)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,t.attempt(c5,l,d)(m))}function d(m){return i.containerState._closeFlow=!0,i.interrupt=void 0,pt(t,t.attempt(Bn,l,r),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(m)}}function f5(t,l,r){const i=this;return pt(t,c,"listItemIndent",i.containerState.size+1);function c(u){const d=i.events[i.events.length-1];return d&&d[1].type==="listItemIndent"&&d[2].sliceSerialize(d[1],!0).length===i.containerState.size?l(u):r(u)}}function h5(t){t.exit(this.containerState.type)}function m5(t,l,r){const i=this;return pt(t,c,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function c(u){const d=i.events[i.events.length-1];return!ct(u)&&d&&d[1].type==="listItemPrefixWhitespace"?l(u):r(u)}}const R1={name:"setextUnderline",resolveTo:x5,tokenize:p5};function x5(t,l){let r=t.length,i,c,u;for(;r--;)if(t[r][0]==="enter"){if(t[r][1].type==="content"){i=r;break}t[r][1].type==="paragraph"&&(c=r)}else t[r][1].type==="content"&&t.splice(r,1),!u&&t[r][1].type==="definition"&&(u=r);const d={type:"setextHeading",start:{...t[i][1].start},end:{...t[t.length-1][1].end}};return t[c][1].type="setextHeadingText",u?(t.splice(c,0,["enter",d,l]),t.splice(u+1,0,["exit",t[i][1],l]),t[i][1].end={...t[u][1].end}):t[i][1]=d,t.push(["exit",d,l]),t}function p5(t,l,r){const i=this;let c;return u;function u(f){let g=i.events.length,y;for(;g--;)if(i.events[g][1].type!=="lineEnding"&&i.events[g][1].type!=="linePrefix"&&i.events[g][1].type!=="content"){y=i.events[g][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||y)?(t.enter("setextHeadingLine"),c=f,d(f)):r(f)}function d(f){return t.enter("setextHeadingLineSequence"),m(f)}function m(f){return f===c?(t.consume(f),m):(t.exit("setextHeadingLineSequence"),ct(f)?pt(t,x,"lineSuffix")(f):x(f))}function x(f){return f===null||qe(f)?(t.exit("setextHeadingLine"),l(f)):r(f)}}const y5={tokenize:g5};function g5(t){const l=this,r=t.attempt(Hs,i,t.attempt(this.parser.constructs.flowInitial,c,pt(t,t.attempt(this.parser.constructs.flow,c,t.attempt(jw,c)),"linePrefix")));return r;function i(u){if(u===null){t.consume(u);return}return t.enter("lineEndingBlank"),t.consume(u),t.exit("lineEndingBlank"),l.currentConstruct=void 0,r}function c(u){if(u===null){t.consume(u);return}return t.enter("lineEnding"),t.consume(u),t.exit("lineEnding"),l.currentConstruct=void 0,r}}const b5={resolveAll:yy()},v5=py("string"),w5=py("text");function py(t){return{resolveAll:yy(t==="text"?k5:void 0),tokenize:l};function l(r){const i=this,c=this.parser.constructs[t],u=r.attempt(c,d,m);return d;function d(g){return f(g)?u(g):m(g)}function m(g){if(g===null){r.consume(g);return}return r.enter("data"),r.consume(g),x}function x(g){return f(g)?(r.exit("data"),u(g)):(r.consume(g),x)}function f(g){if(g===null)return!0;const y=c[g];let b=-1;if(y)for(;++b<y.length;){const v=y[b];if(!v.previous||v.previous.call(i,i.previous))return!0}return!1}}}function yy(t){return l;function l(r,i){let c=-1,u;for(;++c<=r.length;)u===void 0?r[c]&&r[c][1].type==="data"&&(u=c,c++):(!r[c]||r[c][1].type!=="data")&&(c!==u+2&&(r[u][1].end=r[c-1][1].end,r.splice(u+2,c-u-2),c=u+2),u=void 0);return t?t(r,i):r}}function k5(t,l){let r=0;for(;++r<=t.length;)if((r===t.length||t[r][1].type==="lineEnding")&&t[r-1][1].type==="data"){const i=t[r-1][1],c=l.sliceStream(i);let u=c.length,d=-1,m=0,x;for(;u--;){const f=c[u];if(typeof f=="string"){for(d=f.length;f.charCodeAt(d-1)===32;)m++,d--;if(d)break;d=-1}else if(f===-2)x=!0,m++;else if(f!==-1){u++;break}}if(l._contentTypeTextTrailing&&r===t.length&&(m=0),m){const f={type:r===t.length||x||m<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?d:i.start._bufferIndex+d,_index:i.start._index+u,line:i.end.line,column:i.end.column-m,offset:i.end.offset-m},end:{...i.end}};i.end={...f.start},i.start.offset===i.end.offset?Object.assign(i,f):(t.splice(r,0,["enter",f,l],["exit",f,l]),r+=2)}r++}return t}const j5={42:Bn,43:Bn,45:Bn,48:Bn,49:Bn,50:Bn,51:Bn,52:Bn,53:Bn,54:Bn,55:Bn,56:Bn,57:Bn,62:cy},S5={91:Aw},C5={[-2]:ef,[-1]:ef,32:ef},E5={35:Rw,42:gc,45:[R1,gc],60:Lw,61:R1,95:gc,96:M1,126:M1},N5={38:dy,92:uy},A5={[-5]:tf,[-4]:tf,[-3]:tf,33:n5,38:dy,42:Uf,60:[rw,Xw],91:r5,92:[Mw,uy],93:dh,95:Uf,96:yw},T5={null:[Uf,b5]},D5={null:[42,95]},z5={null:[]},M5=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:D5,contentInitial:S5,disable:z5,document:j5,flow:E5,flowInitial:C5,insideSpan:T5,string:N5,text:A5},Symbol.toStringTag,{value:"Module"}));function F5(t,l,r){let i={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const c={},u=[];let d=[],m=[];const x={attempt:I(H),check:I(M),consume:A,enter:F,exit:_,interrupt:I(M,{interrupt:!0})},f={code:null,containerState:{},defineSkip:j,events:[],now:S,parser:t,previous:null,sliceSerialize:b,sliceStream:v,write:y};let g=l.tokenize.call(f,x);return l.resolveAll&&u.push(l),f;function y(Y){return d=sl(d,Y),E(),d[d.length-1]!==null?[]:(W(l,0),f.events=_c(u,f.events,f),f.events)}function b(Y,B){return _5(v(Y),B)}function v(Y){return R5(d,Y)}function S(){const{_bufferIndex:Y,_index:B,line:V,column:ne,offset:G}=i;return{_bufferIndex:Y,_index:B,line:V,column:ne,offset:G}}function j(Y){c[Y.line]=Y.column,D()}function E(){let Y;for(;i._index<d.length;){const B=d[i._index];if(typeof B=="string")for(Y=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===Y&&i._bufferIndex<B.length;)C(B.charCodeAt(i._bufferIndex));else C(B)}}function C(Y){g=g(Y)}function A(Y){qe(Y)?(i.line++,i.column=1,i.offset+=Y===-3?2:1,D()):Y!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===d[i._index].length&&(i._bufferIndex=-1,i._index++)),f.previous=Y}function F(Y,B){const V=B||{};return V.type=Y,V.start=S(),f.events.push(["enter",V,f]),m.push(V),V}function _(Y){const B=m.pop();return B.end=S(),f.events.push(["exit",B,f]),B}function H(Y,B){W(Y,B.from)}function M(Y,B){B.restore()}function I(Y,B){return V;function V(ne,G,L){let Z,de,ue,z;return Array.isArray(ne)?K(ne):"tokenize"in ne?K([ne]):R(ne);function R(Ne){return Le;function Le(Be){const Qe=Be!==null&&Ne[Be],Se=Be!==null&&Ne.null,tt=[...Array.isArray(Qe)?Qe:Qe?[Qe]:[],...Array.isArray(Se)?Se:Se?[Se]:[]];return K(tt)(Be)}}function K(Ne){return Z=Ne,de=0,Ne.length===0?L:T(Ne[de])}function T(Ne){return Le;function Le(Be){return z=te(),ue=Ne,Ne.partial||(f.currentConstruct=Ne),Ne.name&&f.parser.constructs.disable.null.includes(Ne.name)?Ee():Ne.tokenize.call(B?Object.assign(Object.create(f),B):f,x,fe,Ee)(Be)}}function fe(Ne){return Y(ue,z),G}function Ee(Ne){return z.restore(),++de<Z.length?T(Z[de]):L}}}function W(Y,B){Y.resolveAll&&!u.includes(Y)&&u.push(Y),Y.resolve&&Qn(f.events,B,f.events.length-B,Y.resolve(f.events.slice(B),f)),Y.resolveTo&&(f.events=Y.resolveTo(f.events,f))}function te(){const Y=S(),B=f.previous,V=f.currentConstruct,ne=f.events.length,G=Array.from(m);return{from:ne,restore:L};function L(){i=Y,f.previous=B,f.currentConstruct=V,f.events.length=ne,m=G,D()}}function D(){i.line in c&&i.column<2&&(i.column=c[i.line],i.offset+=c[i.line]-1)}}function R5(t,l){const r=l.start._index,i=l.start._bufferIndex,c=l.end._index,u=l.end._bufferIndex;let d;if(r===c)d=[t[r].slice(i,u)];else{if(d=t.slice(r,c),i>-1){const m=d[0];typeof m=="string"?d[0]=m.slice(i):d.shift()}u>0&&d.push(t[c].slice(0,u))}return d}function _5(t,l){let r=-1;const i=[];let c;for(;++r<t.length;){const u=t[r];let d;if(typeof u=="string")d=u;else switch(u){case-5:{d="\r";break}case-4:{d=`
|
|
48
|
+
`+o.stack}}var je=Object.prototype.hasOwnProperty,_e=t.unstable_scheduleCallback,Ke=t.unstable_cancelCallback,Et=t.unstable_shouldYield,Ht=t.unstable_requestPaint,gt=t.unstable_now,Rt=t.unstable_getCurrentPriorityLevel,re=t.unstable_ImmediatePriority,pe=t.unstable_UserBlockingPriority,Te=t.unstable_NormalPriority,Ye=t.unstable_LowPriority,xe=t.unstable_IdlePriority,q=t.log,ze=t.unstable_setDisableYieldValue,He=null,Xe=null;function ht(e){if(typeof q=="function"&&ze(e),Xe&&typeof Xe.setStrictMode=="function")try{Xe.setStrictMode(He,e)}catch{}}var Pe=Math.clz32?Math.clz32:$l,We=Math.log,un=Math.LN2;function $l(e){return e>>>=0,e===0?32:31-(We(e)/un|0)|0}var ur=256,ol=262144,dr=4194304;function $n(e){var n=e&42;if(n!==0)return n;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 fn(e,n,a){var o=e.pendingLanes;if(o===0)return 0;var h=0,p=e.suspendedLanes,w=e.pingedLanes;e=e.warmLanes;var N=o&134217727;return N!==0?(o=N&~p,o!==0?h=$n(o):(w&=N,w!==0?h=$n(w):a||(a=N&~e,a!==0&&(h=$n(a))))):(N=o&~p,N!==0?h=$n(N):w!==0?h=$n(w):a||(a=o&~e,a!==0&&(h=$n(a)))),h===0?0:n!==0&&n!==h&&(n&p)===0&&(p=h&-h,a=n&-n,p>=a||p===32&&(a&4194048)!==0)?n:h}function Wt(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function ve(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+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 n+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 Zt(){var e=dr;return dr<<=1,(dr&62914560)===0&&(dr=4194304),e}function Zr(e){for(var n=[],a=0;31>a;a++)n.push(e);return n}function cl(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Wn(e,n,a,o,h,p){var w=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var N=e.entanglements,U=e.expirationTimes,P=e.hiddenUpdates;for(a=w&~a;0<a;){var ie=31-Pe(a),ce=1<<ie;N[ie]=0,U[ie]=-1;var ee=P[ie];if(ee!==null)for(P[ie]=null,ie=0;ie<ee.length;ie++){var le=ee[ie];le!==null&&(le.lane&=-536870913)}a&=~ce}o!==0&&Ys(e,o,0),p!==0&&h===0&&e.tag!==0&&(e.suspendedLanes|=p&~(w&~n))}function Ys(e,n,a){e.pendingLanes|=n,e.suspendedLanes&=~n;var o=31-Pe(n);e.entangledLanes|=n,e.entanglements[o]=e.entanglements[o]|1073741824|a&261930}function Hl(e,n){var a=e.entangledLanes|=n;for(e=e.entanglements;a;){var o=31-Pe(a),h=1<<o;h&n|e[o]&n&&(e[o]|=n),a&=~h}}function Ca(e,n){var a=n&-n;return a=(a&42)!==0?1:vl(a),(a&(e.suspendedLanes|n))!==0?0:a}function vl(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 wl(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Ul(){var e=Z.p;return e!==0?e:(e=window.event,e===void 0?32:Pp(e.type))}function wi(e,n){var a=Z.p;try{return Z.p=e,n()}finally{Z.p=a}}var Sn=Math.random().toString(36).slice(2),Jt="__reactFiber$"+Sn,hn="__reactProps$"+Sn,kl="__reactContainer$"+Sn,Ea="__reactEvents$"+Sn,qs="__reactListeners$"+Sn,Il="__reactHandles$"+Sn,Na="__reactResources$"+Sn,fr="__reactMarker$"+Sn;function Aa(e){delete e[Jt],delete e[hn],delete e[Ea],delete e[qs],delete e[Il]}function hr(e){var n=e[Jt];if(n)return n;for(var a=e.parentNode;a;){if(n=a[kl]||a[Jt]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(e=Bp(e);e!==null;){if(a=e[Jt])return a;e=Bp(e)}return n}e=a,a=e.parentNode}return null}function jl(e){if(e=e[Jt]||e[kl]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function gn(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(i(33))}function Tn(e){var n=e[Na];return n||(n=e[Na]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Ut(e){e[fr]=!0}var Xs=new Set,Yl={};function Yt(e,n){ul(e,n),ul(e+"Capture",n)}function ul(e,n){for(Yl[e]=n,e=0;e<n.length;e++)Xs.add(n[e])}var Zn=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]*$"),mr={},Ta={};function Uc(e){return je.call(Ta,e)?!0:je.call(mr,e)?!1:Zn.test(e)?Ta[e]=!0:(mr[e]=!0,!1)}function Sl(e,n,a){if(Uc(n))if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(n);return;case"boolean":var o=n.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){e.removeAttribute(n);return}}e.setAttribute(n,""+a)}}function Cl(e,n,a){if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,""+a)}}function dl(e,n,a,o){if(o===null)e.removeAttribute(a);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(n,a,""+o)}}function yt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ki(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Ic(e,n,a){var o=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var h=o.get,p=o.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return h.call(this)},set:function(w){a=""+w,p.call(this,w)}}),Object.defineProperty(e,n,{enumerable:o.enumerable}),{getValue:function(){return a},setValue:function(w){a=""+w},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function ji(e){if(!e._valueTracker){var n=ki(e)?"checked":"value";e._valueTracker=Ic(e,n,""+e[n])}}function Si(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var a=n.getValue(),o="";return e&&(o=ki(e)?e.checked?"true":"false":e.value),e=o,e!==a?(n.setValue(e),!0):!1}function xr(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 Yc=/[\n"\\]/g;function Dn(e){return e.replace(Yc,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function Da(e,n,a,o,h,p,w,N){e.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?e.type=w:e.removeAttribute("type"),n!=null?w==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+yt(n)):e.value!==""+yt(n)&&(e.value=""+yt(n)):w!=="submit"&&w!=="reset"||e.removeAttribute("value"),n!=null?Ci(e,w,yt(n)):a!=null?Ci(e,w,yt(a)):o!=null&&e.removeAttribute("value"),h==null&&p!=null&&(e.defaultChecked=!!p),h!=null&&(e.checked=h&&typeof h!="function"&&typeof h!="symbol"),N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?e.name=""+yt(N):e.removeAttribute("name")}function Vs(e,n,a,o,h,p,w,N){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(e.type=p),n!=null||a!=null){if(!(p!=="submit"&&p!=="reset"||n!=null)){ji(e);return}a=a!=null?""+yt(a):"",n=n!=null?""+yt(n):a,N||n===e.value||(e.value=n),e.defaultValue=n}o=o??h,o=typeof o!="function"&&typeof o!="symbol"&&!!o,e.checked=N?e.checked:!!o,e.defaultChecked=!!o,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(e.name=w),ji(e)}function Ci(e,n,a){n==="number"&&xr(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function pr(e,n,a,o){if(e=e.options,n){n={};for(var h=0;h<a.length;h++)n["$"+a[h]]=!0;for(a=0;a<e.length;a++)h=n.hasOwnProperty("$"+e[a].value),e[a].selected!==h&&(e[a].selected=h),h&&o&&(e[a].defaultSelected=!0)}else{for(a=""+yt(a),n=null,h=0;h<e.length;h++){if(e[h].value===a){e[h].selected=!0,o&&(e[h].defaultSelected=!0);return}n!==null||e[h].disabled||(n=e[h])}n!==null&&(n.selected=!0)}}function Gs(e,n,a){if(n!=null&&(n=""+yt(n),n!==e.value&&(e.value=n),a==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=a!=null?""+yt(a):""}function Ks(e,n,a,o){if(n==null){if(o!=null){if(a!=null)throw Error(i(92));if(G(o)){if(1<o.length)throw Error(i(93));o=o[0]}a=o}a==null&&(a=""),n=a}a=yt(n),e.defaultValue=a,o=e.textContent,o===a&&o!==""&&o!==null&&(e.value=o),ji(e)}function yr(e,n){if(n){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=n;return}}e.textContent=n}var qc=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 fl(e,n,a){var o=n.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?o?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":o?e.setProperty(n,a):typeof a!="number"||a===0||qc.has(n)?n==="float"?e.cssFloat=a:e[n]=(""+a).trim():e[n]=a+"px"}function za(e,n,a){if(n!=null&&typeof n!="object")throw Error(i(62));if(e=e.style,a!=null){for(var o in a)!a.hasOwnProperty(o)||n!=null&&n.hasOwnProperty(o)||(o.indexOf("--")===0?e.setProperty(o,""):o==="float"?e.cssFloat="":e[o]="");for(var h in n)o=n[h],n.hasOwnProperty(h)&&a[h]!==o&&fl(e,h,o)}else for(var p in n)n.hasOwnProperty(p)&&fl(e,p,n[p])}function Ei(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 Xc=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"]]),El=/^[\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 Jr(e){return El.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function hl(){}var Ni=null;function Pt(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Jn=null,ql=null;function Ai(e){var n=jl(e);if(n&&(e=n.stateNode)){var a=e[hn]||null;e:switch(e=n.stateNode,n.type){case"input":if(Da(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),n=a.name,a.type==="radio"&&n!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Dn(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var o=a[n];if(o!==e&&o.form===e.form){var h=o[hn]||null;if(!h)throw Error(i(90));Da(o,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name)}}for(n=0;n<a.length;n++)o=a[n],o.form===e.form&&Si(o)}break e;case"textarea":Gs(e,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&pr(e,!!a.multiple,n,!1)}}}var Ma=!1;function O(e,n,a){if(Ma)return e(n,a);Ma=!0;try{var o=e(n);return o}finally{if(Ma=!1,(Jn!==null||ql!==null)&&(Fo(),Jn&&(n=Jn,e=ql,ql=Jn=null,Ai(n),e)))for(n=0;n<e.length;n++)Ai(e[n])}}function ae(e,n){var a=e.stateNode;if(a===null)return null;var o=a[hn]||null;if(o===null)return null;a=o[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(o=!o.disabled)||(e=e.type,o=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!o;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(i(231,n,typeof a));return a}var se=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ye=!1;if(se)try{var be={};Object.defineProperty(be,"passive",{get:function(){ye=!0}}),window.addEventListener("test",be,be),window.removeEventListener("test",be,be)}catch{ye=!1}var Me=null,Ie=null,nt=null;function mt(){if(nt)return nt;var e,n=Ie,a=n.length,o,h="value"in Me?Me.value:Me.textContent,p=h.length;for(e=0;e<a&&n[e]===h[e];e++);var w=a-e;for(o=1;o<=w&&n[a-o]===h[p-o];o++);return nt=h.slice(e,1<o?1-o:void 0)}function Ze(e){var n=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&n===13&&(e=13)):e=n,e===10&&(e=13),32<=e||e===13?e:0}function Ot(){return!0}function zh(){return!1}function zn(e){function n(a,o,h,p,w){this._reactName=a,this._targetInst=h,this.type=o,this.nativeEvent=p,this.target=w,this.currentTarget=null;for(var N in e)e.hasOwnProperty(N)&&(a=e[N],this[N]=a?a(p):p[N]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?Ot:zh,this.isPropagationStopped=zh,this}return y(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Ot)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Ot)},persist:function(){},isPersistent:Ot}),n}var Pr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Qs=zn(Pr),Ti=y({},Pr,{view:0,detail:0}),Og=zn(Ti),Vc,Gc,Di,Ws=y({},Ti,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Qc,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!==Di&&(Di&&e.type==="mousemove"?(Vc=e.screenX-Di.screenX,Gc=e.screenY-Di.screenY):Gc=Vc=0,Di=e),Vc)},movementY:function(e){return"movementY"in e?e.movementY:Gc}}),Mh=zn(Ws),Bg=y({},Ws,{dataTransfer:0}),Lg=zn(Bg),$g=y({},Ti,{relatedTarget:0}),Kc=zn($g),Hg=y({},Pr,{animationName:0,elapsedTime:0,pseudoElement:0}),Ug=zn(Hg),Ig=y({},Pr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Yg=zn(Ig),qg=y({},Pr,{data:0}),Fh=zn(qg),Xg={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Vg={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"},Gg={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Kg(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=Gg[e])?!!n[e]:!1}function Qc(){return Kg}var Qg=y({},Ti,{key:function(e){if(e.key){var n=Xg[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=Ze(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Vg[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Qc,charCode:function(e){return e.type==="keypress"?Ze(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ze(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Wg=zn(Qg),Zg=y({},Ws,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Rh=zn(Zg),Jg=y({},Ti,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Qc}),Pg=zn(Jg),eb=y({},Pr,{propertyName:0,elapsedTime:0,pseudoElement:0}),tb=zn(eb),nb=y({},Ws,{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}),lb=zn(nb),rb=y({},Pr,{newState:0,oldState:0}),ab=zn(rb),ib=[9,13,27,32],Wc=se&&"CompositionEvent"in window,zi=null;se&&"documentMode"in document&&(zi=document.documentMode);var sb=se&&"TextEvent"in window&&!zi,_h=se&&(!Wc||zi&&8<zi&&11>=zi),Oh=" ",Bh=!1;function Lh(e,n){switch(e){case"keyup":return ib.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function $h(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Fa=!1;function ob(e,n){switch(e){case"compositionend":return $h(n);case"keypress":return n.which!==32?null:(Bh=!0,Oh);case"textInput":return e=n.data,e===Oh&&Bh?null:e;default:return null}}function cb(e,n){if(Fa)return e==="compositionend"||!Wc&&Lh(e,n)?(e=mt(),nt=Ie=Me=null,Fa=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return _h&&n.locale!=="ko"?null:n.data;default:return null}}var ub={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 Hh(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!ub[e.type]:n==="textarea"}function Uh(e,n,a,o){Jn?ql?ql.push(o):ql=[o]:Jn=o,n=Ho(n,"onChange"),0<n.length&&(a=new Qs("onChange","change",null,a,o),e.push({event:a,listeners:n}))}var Mi=null,Fi=null;function db(e){jp(e,0)}function Zs(e){var n=gn(e);if(Si(n))return e}function Ih(e,n){if(e==="change")return n}var Yh=!1;if(se){var Zc;if(se){var Jc="oninput"in document;if(!Jc){var qh=document.createElement("div");qh.setAttribute("oninput","return;"),Jc=typeof qh.oninput=="function"}Zc=Jc}else Zc=!1;Yh=Zc&&(!document.documentMode||9<document.documentMode)}function Xh(){Mi&&(Mi.detachEvent("onpropertychange",Vh),Fi=Mi=null)}function Vh(e){if(e.propertyName==="value"&&Zs(Fi)){var n=[];Uh(n,Fi,e,Pt(e)),O(db,n)}}function fb(e,n,a){e==="focusin"?(Xh(),Mi=n,Fi=a,Mi.attachEvent("onpropertychange",Vh)):e==="focusout"&&Xh()}function hb(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Zs(Fi)}function mb(e,n){if(e==="click")return Zs(n)}function xb(e,n){if(e==="input"||e==="change")return Zs(n)}function pb(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var Hn=typeof Object.is=="function"?Object.is:pb;function Ri(e,n){if(Hn(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var a=Object.keys(e),o=Object.keys(n);if(a.length!==o.length)return!1;for(o=0;o<a.length;o++){var h=a[o];if(!je.call(n,h)||!Hn(e[h],n[h]))return!1}return!0}function Gh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Kh(e,n){var a=Gh(e);e=0;for(var o;a;){if(a.nodeType===3){if(o=e+a.textContent.length,e<=n&&o>=n)return{node:a,offset:n-e};e=o}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Gh(a)}}function Qh(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Qh(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Wh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=xr(e.document);n instanceof e.HTMLIFrameElement;){try{var a=typeof n.contentWindow.location.href=="string"}catch{a=!1}if(a)e=n.contentWindow;else break;n=xr(e.document)}return n}function Pc(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}var yb=se&&"documentMode"in document&&11>=document.documentMode,Ra=null,eu=null,_i=null,tu=!1;function Zh(e,n,a){var o=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;tu||Ra==null||Ra!==xr(o)||(o=Ra,"selectionStart"in o&&Pc(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),_i&&Ri(_i,o)||(_i=o,o=Ho(eu,"onSelect"),0<o.length&&(n=new Qs("onSelect","select",null,n,a),e.push({event:n,listeners:o}),n.target=Ra)))}function ea(e,n){var a={};return a[e.toLowerCase()]=n.toLowerCase(),a["Webkit"+e]="webkit"+n,a["Moz"+e]="moz"+n,a}var _a={animationend:ea("Animation","AnimationEnd"),animationiteration:ea("Animation","AnimationIteration"),animationstart:ea("Animation","AnimationStart"),transitionrun:ea("Transition","TransitionRun"),transitionstart:ea("Transition","TransitionStart"),transitioncancel:ea("Transition","TransitionCancel"),transitionend:ea("Transition","TransitionEnd")},nu={},Jh={};se&&(Jh=document.createElement("div").style,"AnimationEvent"in window||(delete _a.animationend.animation,delete _a.animationiteration.animation,delete _a.animationstart.animation),"TransitionEvent"in window||delete _a.transitionend.transition);function ta(e){if(nu[e])return nu[e];if(!_a[e])return e;var n=_a[e],a;for(a in n)if(n.hasOwnProperty(a)&&a in Jh)return nu[e]=n[a];return e}var Ph=ta("animationend"),em=ta("animationiteration"),tm=ta("animationstart"),gb=ta("transitionrun"),bb=ta("transitionstart"),vb=ta("transitioncancel"),nm=ta("transitionend"),lm=new Map,lu="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(" ");lu.push("scrollEnd");function ml(e,n){lm.set(e,n),Yt(n,[e])}var Js=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=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(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Pn=[],Oa=0,ru=0;function Ps(){for(var e=Oa,n=ru=Oa=0;n<e;){var a=Pn[n];Pn[n++]=null;var o=Pn[n];Pn[n++]=null;var h=Pn[n];Pn[n++]=null;var p=Pn[n];if(Pn[n++]=null,o!==null&&h!==null){var w=o.pending;w===null?h.next=h:(h.next=w.next,w.next=h),o.pending=h}p!==0&&rm(a,h,p)}}function eo(e,n,a,o){Pn[Oa++]=e,Pn[Oa++]=n,Pn[Oa++]=a,Pn[Oa++]=o,ru|=o,e.lanes|=o,e=e.alternate,e!==null&&(e.lanes|=o)}function au(e,n,a,o){return eo(e,n,a,o),to(e)}function na(e,n){return eo(e,null,null,n),to(e)}function rm(e,n,a){e.lanes|=a;var o=e.alternate;o!==null&&(o.lanes|=a);for(var h=!1,p=e.return;p!==null;)p.childLanes|=a,o=p.alternate,o!==null&&(o.childLanes|=a),p.tag===22&&(e=p.stateNode,e===null||e._visibility&1||(h=!0)),e=p,p=p.return;return e.tag===3?(p=e.stateNode,h&&n!==null&&(h=31-Pe(a),e=p.hiddenUpdates,o=e[h],o===null?e[h]=[n]:o.push(n),n.lane=a|536870912),p):null}function to(e){if(50<ls)throw ls=0,md=null,Error(i(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var Ba={};function wb(e,n,a,o){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Un(e,n,a,o){return new wb(e,n,a,o)}function iu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Xl(e,n){var a=e.alternate;return a===null?(a=Un(e.tag,n,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=n,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,n=e.dependencies,a.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function am(e,n){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=n,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,n=a.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function no(e,n,a,o,h,p){var w=0;if(o=e,typeof e=="function")iu(e)&&(w=1);else if(typeof e=="string")w=E2(e,a,fe.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case te:return e=Un(31,a,n,h),e.elementType=te,e.lanes=p,e;case j:return la(a.children,h,p,n);case E:w=8,h|=24;break;case C:return e=Un(12,a,n,h|2),e.elementType=C,e.lanes=p,e;case H:return e=Un(13,a,n,h),e.elementType=H,e.lanes=p,e;case M:return e=Un(19,a,n,h),e.elementType=M,e.lanes=p,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case F:w=10;break e;case A:w=9;break e;case _:w=11;break e;case I:w=14;break e;case W:w=16,o=null;break e}w=29,a=Error(i(130,e===null?"null":typeof e,"")),o=null}return n=Un(w,a,n,h),n.elementType=e,n.type=o,n.lanes=p,n}function la(e,n,a,o){return e=Un(7,e,o,n),e.lanes=a,e}function su(e,n,a){return e=Un(6,e,null,n),e.lanes=a,e}function im(e){var n=Un(18,null,null,0);return n.stateNode=e,n}function ou(e,n,a){return n=Un(4,e.children!==null?e.children:[],e.key,n),n.lanes=a,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var sm=new WeakMap;function el(e,n){if(typeof e=="object"&&e!==null){var a=sm.get(e);return a!==void 0?a:(n={value:e,source:n,stack:De(n)},sm.set(e,n),n)}return{value:e,source:n,stack:De(n)}}var La=[],$a=0,lo=null,Oi=0,tl=[],nl=0,gr=null,Nl=1,Al="";function Vl(e,n){La[$a++]=Oi,La[$a++]=lo,lo=e,Oi=n}function om(e,n,a){tl[nl++]=Nl,tl[nl++]=Al,tl[nl++]=gr,gr=e;var o=Nl;e=Al;var h=32-Pe(o)-1;o&=~(1<<h),a+=1;var p=32-Pe(n)+h;if(30<p){var w=h-h%5;p=(o&(1<<w)-1).toString(32),o>>=w,h-=w,Nl=1<<32-Pe(n)+h|a<<h|o,Al=p+e}else Nl=1<<p|a<<h|o,Al=e}function cu(e){e.return!==null&&(Vl(e,1),om(e,1,0))}function uu(e){for(;e===lo;)lo=La[--$a],La[$a]=null,Oi=La[--$a],La[$a]=null;for(;e===gr;)gr=tl[--nl],tl[nl]=null,Al=tl[--nl],tl[nl]=null,Nl=tl[--nl],tl[nl]=null}function cm(e,n){tl[nl++]=Nl,tl[nl++]=Al,tl[nl++]=gr,Nl=n.id,Al=n.overflow,gr=e}var mn=null,Bt=null,xt=!1,br=null,ll=!1,du=Error(i(519));function vr(e){var n=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Bi(el(n,e)),du}function um(e){var n=e.stateNode,a=e.type,o=e.memoizedProps;switch(n[Jt]=e,n[hn]=o,a){case"dialog":ot("cancel",n),ot("close",n);break;case"iframe":case"object":case"embed":ot("load",n);break;case"video":case"audio":for(a=0;a<as.length;a++)ot(as[a],n);break;case"source":ot("error",n);break;case"img":case"image":case"link":ot("error",n),ot("load",n);break;case"details":ot("toggle",n);break;case"input":ot("invalid",n),Vs(n,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":ot("invalid",n);break;case"textarea":ot("invalid",n),Ks(n,o.value,o.defaultValue,o.children)}a=o.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||n.textContent===""+a||o.suppressHydrationWarning===!0||Np(n.textContent,a)?(o.popover!=null&&(ot("beforetoggle",n),ot("toggle",n)),o.onScroll!=null&&ot("scroll",n),o.onScrollEnd!=null&&ot("scrollend",n),o.onClick!=null&&(n.onclick=hl),n=!0):n=!1,n||vr(e,!0)}function dm(e){for(mn=e.return;mn;)switch(mn.tag){case 5:case 31:case 13:ll=!1;return;case 27:case 3:ll=!0;return;default:mn=mn.return}}function Ha(e){if(e!==mn)return!1;if(!xt)return dm(e),xt=!0,!1;var n=e.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||Td(e.type,e.memoizedProps)),a=!a),a&&Bt&&vr(e),dm(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));Bt=Op(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));Bt=Op(e)}else n===27?(n=Bt,Rr(e.type)?(e=Rd,Rd=null,Bt=e):Bt=n):Bt=mn?al(e.stateNode.nextSibling):null;return!0}function ra(){Bt=mn=null,xt=!1}function fu(){var e=br;return e!==null&&(_n===null?_n=e:_n.push.apply(_n,e),br=null),e}function Bi(e){br===null?br=[e]:br.push(e)}var hu=R(null),aa=null,Gl=null;function wr(e,n,a){T(hu,n._currentValue),n._currentValue=a}function Kl(e){e._currentValue=hu.current,K(hu)}function mu(e,n,a){for(;e!==null;){var o=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,o!==null&&(o.childLanes|=n)):o!==null&&(o.childLanes&n)!==n&&(o.childLanes|=n),e===a)break;e=e.return}}function xu(e,n,a,o){var h=e.child;for(h!==null&&(h.return=e);h!==null;){var p=h.dependencies;if(p!==null){var w=h.child;p=p.firstContext;e:for(;p!==null;){var N=p;p=h;for(var U=0;U<n.length;U++)if(N.context===n[U]){p.lanes|=a,N=p.alternate,N!==null&&(N.lanes|=a),mu(p.return,a,e),o||(w=null);break e}p=N.next}}else if(h.tag===18){if(w=h.return,w===null)throw Error(i(341));w.lanes|=a,p=w.alternate,p!==null&&(p.lanes|=a),mu(w,a,e),w=null}else w=h.child;if(w!==null)w.return=h;else for(w=h;w!==null;){if(w===e){w=null;break}if(h=w.sibling,h!==null){h.return=w.return,w=h;break}w=w.return}h=w}}function Ua(e,n,a,o){e=null;for(var h=n,p=!1;h!==null;){if(!p){if((h.flags&524288)!==0)p=!0;else if((h.flags&262144)!==0)break}if(h.tag===10){var w=h.alternate;if(w===null)throw Error(i(387));if(w=w.memoizedProps,w!==null){var N=h.type;Hn(h.pendingProps.value,w.value)||(e!==null?e.push(N):e=[N])}}else if(h===Le.current){if(w=h.alternate,w===null)throw Error(i(387));w.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(e!==null?e.push(us):e=[us])}h=h.return}e!==null&&xu(n,e,a,o),n.flags|=262144}function ro(e){for(e=e.firstContext;e!==null;){if(!Hn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ia(e){aa=e,Gl=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function xn(e){return fm(aa,e)}function ao(e,n){return aa===null&&ia(e),fm(e,n)}function fm(e,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},Gl===null){if(e===null)throw Error(i(308));Gl=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else Gl=Gl.next=n;return a}var kb=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(a,o){e.push(o)}};this.abort=function(){n.aborted=!0,e.forEach(function(a){return a()})}},jb=t.unstable_scheduleCallback,Sb=t.unstable_NormalPriority,en={$$typeof:F,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function pu(){return{controller:new kb,data:new Map,refCount:0}}function Li(e){e.refCount--,e.refCount===0&&jb(Sb,function(){e.controller.abort()})}var $i=null,yu=0,Ia=0,Ya=null;function Cb(e,n){if($i===null){var a=$i=[];yu=0,Ia=vd(),Ya={status:"pending",value:void 0,then:function(o){a.push(o)}}}return yu++,n.then(hm,hm),n}function hm(){if(--yu===0&&$i!==null){Ya!==null&&(Ya.status="fulfilled");var e=$i;$i=null,Ia=0,Ya=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function Eb(e,n){var a=[],o={status:"pending",value:null,reason:null,then:function(h){a.push(h)}};return e.then(function(){o.status="fulfilled",o.value=n;for(var h=0;h<a.length;h++)(0,a[h])(n)},function(h){for(o.status="rejected",o.reason=h,h=0;h<a.length;h++)(0,a[h])(void 0)}),o}var mm=L.S;L.S=function(e,n){Zx=gt(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&Cb(e,n),mm!==null&&mm(e,n)};var sa=R(null);function gu(){var e=sa.current;return e!==null?e:zt.pooledCache}function io(e,n){n===null?T(sa,sa.current):T(sa,n.pool)}function xm(){var e=gu();return e===null?null:{parent:en._currentValue,pool:e}}var qa=Error(i(460)),bu=Error(i(474)),so=Error(i(542)),oo={then:function(){}};function pm(e){return e=e.status,e==="fulfilled"||e==="rejected"}function ym(e,n,a){switch(a=e[a],a===void 0?e.push(n):a!==n&&(n.then(hl,hl),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,bm(e),e;default:if(typeof n.status=="string")n.then(hl,hl);else{if(e=zt,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=n,e.status="pending",e.then(function(o){if(n.status==="pending"){var h=n;h.status="fulfilled",h.value=o}},function(o){if(n.status==="pending"){var h=n;h.status="rejected",h.reason=o}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,bm(e),e}throw ca=n,qa}}function oa(e){try{var n=e._init;return n(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(ca=a,qa):a}}var ca=null;function gm(){if(ca===null)throw Error(i(459));var e=ca;return ca=null,e}function bm(e){if(e===qa||e===so)throw Error(i(483))}var Xa=null,Hi=0;function co(e){var n=Hi;return Hi+=1,Xa===null&&(Xa=[]),ym(Xa,e,n)}function Ui(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function uo(e,n){throw n.$$typeof===b?Error(i(525)):(e=Object.prototype.toString.call(n),Error(i(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function vm(e){function n(Q,X){if(e){var J=Q.deletions;J===null?(Q.deletions=[X],Q.flags|=16):J.push(X)}}function a(Q,X){if(!e)return null;for(;X!==null;)n(Q,X),X=X.sibling;return null}function o(Q){for(var X=new Map;Q!==null;)Q.key!==null?X.set(Q.key,Q):X.set(Q.index,Q),Q=Q.sibling;return X}function h(Q,X){return Q=Xl(Q,X),Q.index=0,Q.sibling=null,Q}function p(Q,X,J){return Q.index=J,e?(J=Q.alternate,J!==null?(J=J.index,J<X?(Q.flags|=67108866,X):J):(Q.flags|=67108866,X)):(Q.flags|=1048576,X)}function w(Q){return e&&Q.alternate===null&&(Q.flags|=67108866),Q}function N(Q,X,J,oe){return X===null||X.tag!==6?(X=su(J,Q.mode,oe),X.return=Q,X):(X=h(X,J),X.return=Q,X)}function U(Q,X,J,oe){var Ue=J.type;return Ue===j?ie(Q,X,J.props.children,oe,J.key):X!==null&&(X.elementType===Ue||typeof Ue=="object"&&Ue!==null&&Ue.$$typeof===W&&oa(Ue)===X.type)?(X=h(X,J.props),Ui(X,J),X.return=Q,X):(X=no(J.type,J.key,J.props,null,Q.mode,oe),Ui(X,J),X.return=Q,X)}function P(Q,X,J,oe){return X===null||X.tag!==4||X.stateNode.containerInfo!==J.containerInfo||X.stateNode.implementation!==J.implementation?(X=ou(J,Q.mode,oe),X.return=Q,X):(X=h(X,J.children||[]),X.return=Q,X)}function ie(Q,X,J,oe,Ue){return X===null||X.tag!==7?(X=la(J,Q.mode,oe,Ue),X.return=Q,X):(X=h(X,J),X.return=Q,X)}function ce(Q,X,J){if(typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint")return X=su(""+X,Q.mode,J),X.return=Q,X;if(typeof X=="object"&&X!==null){switch(X.$$typeof){case v:return J=no(X.type,X.key,X.props,null,Q.mode,J),Ui(J,X),J.return=Q,J;case S:return X=ou(X,Q.mode,J),X.return=Q,X;case W:return X=oa(X),ce(Q,X,J)}if(G(X)||B(X))return X=la(X,Q.mode,J,null),X.return=Q,X;if(typeof X.then=="function")return ce(Q,co(X),J);if(X.$$typeof===F)return ce(Q,ao(Q,X),J);uo(Q,X)}return null}function ee(Q,X,J,oe){var Ue=X!==null?X.key:null;if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return Ue!==null?null:N(Q,X,""+J,oe);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case v:return J.key===Ue?U(Q,X,J,oe):null;case S:return J.key===Ue?P(Q,X,J,oe):null;case W:return J=oa(J),ee(Q,X,J,oe)}if(G(J)||B(J))return Ue!==null?null:ie(Q,X,J,oe,null);if(typeof J.then=="function")return ee(Q,X,co(J),oe);if(J.$$typeof===F)return ee(Q,X,ao(Q,J),oe);uo(Q,J)}return null}function le(Q,X,J,oe,Ue){if(typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint")return Q=Q.get(J)||null,N(X,Q,""+oe,Ue);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case v:return Q=Q.get(oe.key===null?J:oe.key)||null,U(X,Q,oe,Ue);case S:return Q=Q.get(oe.key===null?J:oe.key)||null,P(X,Q,oe,Ue);case W:return oe=oa(oe),le(Q,X,J,oe,Ue)}if(G(oe)||B(oe))return Q=Q.get(J)||null,ie(X,Q,oe,Ue,null);if(typeof oe.then=="function")return le(Q,X,J,co(oe),Ue);if(oe.$$typeof===F)return le(Q,X,J,ao(X,oe),Ue);uo(X,oe)}return null}function Re(Q,X,J,oe){for(var Ue=null,bt=null,Oe=X,lt=X=0,dt=null;Oe!==null&<<J.length;lt++){Oe.index>lt?(dt=Oe,Oe=null):dt=Oe.sibling;var vt=ee(Q,Oe,J[lt],oe);if(vt===null){Oe===null&&(Oe=dt);break}e&&Oe&&vt.alternate===null&&n(Q,Oe),X=p(vt,X,lt),bt===null?Ue=vt:bt.sibling=vt,bt=vt,Oe=dt}if(lt===J.length)return a(Q,Oe),xt&&Vl(Q,lt),Ue;if(Oe===null){for(;lt<J.length;lt++)Oe=ce(Q,J[lt],oe),Oe!==null&&(X=p(Oe,X,lt),bt===null?Ue=Oe:bt.sibling=Oe,bt=Oe);return xt&&Vl(Q,lt),Ue}for(Oe=o(Oe);lt<J.length;lt++)dt=le(Oe,Q,lt,J[lt],oe),dt!==null&&(e&&dt.alternate!==null&&Oe.delete(dt.key===null?lt:dt.key),X=p(dt,X,lt),bt===null?Ue=dt:bt.sibling=dt,bt=dt);return e&&Oe.forEach(function($r){return n(Q,$r)}),xt&&Vl(Q,lt),Ue}function Ve(Q,X,J,oe){if(J==null)throw Error(i(151));for(var Ue=null,bt=null,Oe=X,lt=X=0,dt=null,vt=J.next();Oe!==null&&!vt.done;lt++,vt=J.next()){Oe.index>lt?(dt=Oe,Oe=null):dt=Oe.sibling;var $r=ee(Q,Oe,vt.value,oe);if($r===null){Oe===null&&(Oe=dt);break}e&&Oe&&$r.alternate===null&&n(Q,Oe),X=p($r,X,lt),bt===null?Ue=$r:bt.sibling=$r,bt=$r,Oe=dt}if(vt.done)return a(Q,Oe),xt&&Vl(Q,lt),Ue;if(Oe===null){for(;!vt.done;lt++,vt=J.next())vt=ce(Q,vt.value,oe),vt!==null&&(X=p(vt,X,lt),bt===null?Ue=vt:bt.sibling=vt,bt=vt);return xt&&Vl(Q,lt),Ue}for(Oe=o(Oe);!vt.done;lt++,vt=J.next())vt=le(Oe,Q,lt,vt.value,oe),vt!==null&&(e&&vt.alternate!==null&&Oe.delete(vt.key===null?lt:vt.key),X=p(vt,X,lt),bt===null?Ue=vt:bt.sibling=vt,bt=vt);return e&&Oe.forEach(function(B2){return n(Q,B2)}),xt&&Vl(Q,lt),Ue}function Tt(Q,X,J,oe){if(typeof J=="object"&&J!==null&&J.type===j&&J.key===null&&(J=J.props.children),typeof J=="object"&&J!==null){switch(J.$$typeof){case v:e:{for(var Ue=J.key;X!==null;){if(X.key===Ue){if(Ue=J.type,Ue===j){if(X.tag===7){a(Q,X.sibling),oe=h(X,J.props.children),oe.return=Q,Q=oe;break e}}else if(X.elementType===Ue||typeof Ue=="object"&&Ue!==null&&Ue.$$typeof===W&&oa(Ue)===X.type){a(Q,X.sibling),oe=h(X,J.props),Ui(oe,J),oe.return=Q,Q=oe;break e}a(Q,X);break}else n(Q,X);X=X.sibling}J.type===j?(oe=la(J.props.children,Q.mode,oe,J.key),oe.return=Q,Q=oe):(oe=no(J.type,J.key,J.props,null,Q.mode,oe),Ui(oe,J),oe.return=Q,Q=oe)}return w(Q);case S:e:{for(Ue=J.key;X!==null;){if(X.key===Ue)if(X.tag===4&&X.stateNode.containerInfo===J.containerInfo&&X.stateNode.implementation===J.implementation){a(Q,X.sibling),oe=h(X,J.children||[]),oe.return=Q,Q=oe;break e}else{a(Q,X);break}else n(Q,X);X=X.sibling}oe=ou(J,Q.mode,oe),oe.return=Q,Q=oe}return w(Q);case W:return J=oa(J),Tt(Q,X,J,oe)}if(G(J))return Re(Q,X,J,oe);if(B(J)){if(Ue=B(J),typeof Ue!="function")throw Error(i(150));return J=Ue.call(J),Ve(Q,X,J,oe)}if(typeof J.then=="function")return Tt(Q,X,co(J),oe);if(J.$$typeof===F)return Tt(Q,X,ao(Q,J),oe);uo(Q,J)}return typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint"?(J=""+J,X!==null&&X.tag===6?(a(Q,X.sibling),oe=h(X,J),oe.return=Q,Q=oe):(a(Q,X),oe=su(J,Q.mode,oe),oe.return=Q,Q=oe),w(Q)):a(Q,X)}return function(Q,X,J,oe){try{Hi=0;var Ue=Tt(Q,X,J,oe);return Xa=null,Ue}catch(Oe){if(Oe===qa||Oe===so)throw Oe;var bt=Un(29,Oe,null,Q.mode);return bt.lanes=oe,bt.return=Q,bt}finally{}}}var ua=vm(!0),wm=vm(!1),kr=!1;function vu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function wu(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function jr(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Sr(e,n,a){var o=e.updateQueue;if(o===null)return null;if(o=o.shared,(kt&2)!==0){var h=o.pending;return h===null?n.next=n:(n.next=h.next,h.next=n),o.pending=n,n=to(e),rm(e,null,a),n}return eo(e,o,n,a),to(e)}function Ii(e,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var o=n.lanes;o&=e.pendingLanes,a|=o,n.lanes=a,Hl(e,a)}}function ku(e,n){var a=e.updateQueue,o=e.alternate;if(o!==null&&(o=o.updateQueue,a===o)){var h=null,p=null;if(a=a.firstBaseUpdate,a!==null){do{var w={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};p===null?h=p=w:p=p.next=w,a=a.next}while(a!==null);p===null?h=p=n:p=p.next=n}else h=p=n;a={baseState:o.baseState,firstBaseUpdate:h,lastBaseUpdate:p,shared:o.shared,callbacks:o.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=n:e.next=n,a.lastBaseUpdate=n}var ju=!1;function Yi(){if(ju){var e=Ya;if(e!==null)throw e}}function qi(e,n,a,o){ju=!1;var h=e.updateQueue;kr=!1;var p=h.firstBaseUpdate,w=h.lastBaseUpdate,N=h.shared.pending;if(N!==null){h.shared.pending=null;var U=N,P=U.next;U.next=null,w===null?p=P:w.next=P,w=U;var ie=e.alternate;ie!==null&&(ie=ie.updateQueue,N=ie.lastBaseUpdate,N!==w&&(N===null?ie.firstBaseUpdate=P:N.next=P,ie.lastBaseUpdate=U))}if(p!==null){var ce=h.baseState;w=0,ie=P=U=null,N=p;do{var ee=N.lane&-536870913,le=ee!==N.lane;if(le?(ut&ee)===ee:(o&ee)===ee){ee!==0&&ee===Ia&&(ju=!0),ie!==null&&(ie=ie.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var Re=e,Ve=N;ee=n;var Tt=a;switch(Ve.tag){case 1:if(Re=Ve.payload,typeof Re=="function"){ce=Re.call(Tt,ce,ee);break e}ce=Re;break e;case 3:Re.flags=Re.flags&-65537|128;case 0:if(Re=Ve.payload,ee=typeof Re=="function"?Re.call(Tt,ce,ee):Re,ee==null)break e;ce=y({},ce,ee);break e;case 2:kr=!0}}ee=N.callback,ee!==null&&(e.flags|=64,le&&(e.flags|=8192),le=h.callbacks,le===null?h.callbacks=[ee]:le.push(ee))}else le={lane:ee,tag:N.tag,payload:N.payload,callback:N.callback,next:null},ie===null?(P=ie=le,U=ce):ie=ie.next=le,w|=ee;if(N=N.next,N===null){if(N=h.shared.pending,N===null)break;le=N,N=le.next,le.next=null,h.lastBaseUpdate=le,h.shared.pending=null}}while(!0);ie===null&&(U=ce),h.baseState=U,h.firstBaseUpdate=P,h.lastBaseUpdate=ie,p===null&&(h.shared.lanes=0),Tr|=w,e.lanes=w,e.memoizedState=ce}}function km(e,n){if(typeof e!="function")throw Error(i(191,e));e.call(n)}function jm(e,n){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)km(a[e],n)}var Va=R(null),fo=R(0);function Sm(e,n){e=lr,T(fo,e),T(Va,n),lr=e|n.baseLanes}function Su(){T(fo,lr),T(Va,Va.current)}function Cu(){lr=fo.current,K(Va),K(fo)}var In=R(null),rl=null;function Cr(e){var n=e.alternate;T(Kt,Kt.current&1),T(In,e),rl===null&&(n===null||Va.current!==null||n.memoizedState!==null)&&(rl=e)}function Eu(e){T(Kt,Kt.current),T(In,e),rl===null&&(rl=e)}function Cm(e){e.tag===22?(T(Kt,Kt.current),T(In,e),rl===null&&(rl=e)):Er()}function Er(){T(Kt,Kt.current),T(In,In.current)}function Yn(e){K(In),rl===e&&(rl=null),K(Kt)}var Kt=R(0);function ho(e){for(var n=e;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Md(a)||Fd(a)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var Ql=0,et=null,Nt=null,tn=null,mo=!1,Ga=!1,da=!1,xo=0,Xi=0,Ka=null,Nb=0;function Xt(){throw Error(i(321))}function Nu(e,n){if(n===null)return!1;for(var a=0;a<n.length&&a<e.length;a++)if(!Hn(e[a],n[a]))return!1;return!0}function Au(e,n,a,o,h,p){return Ql=p,et=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,L.H=e===null||e.memoizedState===null?ox:Yu,da=!1,p=a(o,h),da=!1,Ga&&(p=Nm(n,a,o,h)),Em(e),p}function Em(e){L.H=Ki;var n=Nt!==null&&Nt.next!==null;if(Ql=0,tn=Nt=et=null,mo=!1,Xi=0,Ka=null,n)throw Error(i(300));e===null||nn||(e=e.dependencies,e!==null&&ro(e)&&(nn=!0))}function Nm(e,n,a,o){et=e;var h=0;do{if(Ga&&(Ka=null),Xi=0,Ga=!1,25<=h)throw Error(i(301));if(h+=1,tn=Nt=null,e.updateQueue!=null){var p=e.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}L.H=cx,p=n(a,o)}while(Ga);return p}function Ab(){var e=L.H,n=e.useState()[0];return n=typeof n.then=="function"?Vi(n):n,e=e.useState()[0],(Nt!==null?Nt.memoizedState:null)!==e&&(et.flags|=1024),n}function Tu(){var e=xo!==0;return xo=0,e}function Du(e,n,a){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~a}function zu(e){if(mo){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}mo=!1}Ql=0,tn=Nt=et=null,Ga=!1,Xi=xo=0,Ka=null}function Cn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return tn===null?et.memoizedState=tn=e:tn=tn.next=e,tn}function Qt(){if(Nt===null){var e=et.alternate;e=e!==null?e.memoizedState:null}else e=Nt.next;var n=tn===null?et.memoizedState:tn.next;if(n!==null)tn=n,Nt=e;else{if(e===null)throw et.alternate===null?Error(i(467)):Error(i(310));Nt=e,e={memoizedState:Nt.memoizedState,baseState:Nt.baseState,baseQueue:Nt.baseQueue,queue:Nt.queue,next:null},tn===null?et.memoizedState=tn=e:tn=tn.next=e}return tn}function po(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Vi(e){var n=Xi;return Xi+=1,Ka===null&&(Ka=[]),e=ym(Ka,e,n),n=et,(tn===null?n.memoizedState:tn.next)===null&&(n=n.alternate,L.H=n===null||n.memoizedState===null?ox:Yu),e}function yo(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Vi(e);if(e.$$typeof===F)return xn(e)}throw Error(i(438,String(e)))}function Mu(e){var n=null,a=et.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var o=et.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(n={data:o.data.map(function(h){return h.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),a===null&&(a=po(),et.updateQueue=a),a.memoCache=n,a=n.data[n.index],a===void 0)for(a=n.data[n.index]=Array(e),o=0;o<e;o++)a[o]=D;return n.index++,a}function Wl(e,n){return typeof n=="function"?n(e):n}function go(e){var n=Qt();return Fu(n,Nt,e)}function Fu(e,n,a){var o=e.queue;if(o===null)throw Error(i(311));o.lastRenderedReducer=a;var h=e.baseQueue,p=o.pending;if(p!==null){if(h!==null){var w=h.next;h.next=p.next,p.next=w}n.baseQueue=h=p,o.pending=null}if(p=e.baseState,h===null)e.memoizedState=p;else{n=h.next;var N=w=null,U=null,P=n,ie=!1;do{var ce=P.lane&-536870913;if(ce!==P.lane?(ut&ce)===ce:(Ql&ce)===ce){var ee=P.revertLane;if(ee===0)U!==null&&(U=U.next={lane:0,revertLane:0,gesture:null,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null}),ce===Ia&&(ie=!0);else if((Ql&ee)===ee){P=P.next,ee===Ia&&(ie=!0);continue}else ce={lane:0,revertLane:P.revertLane,gesture:null,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null},U===null?(N=U=ce,w=p):U=U.next=ce,et.lanes|=ee,Tr|=ee;ce=P.action,da&&a(p,ce),p=P.hasEagerState?P.eagerState:a(p,ce)}else ee={lane:ce,revertLane:P.revertLane,gesture:P.gesture,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null},U===null?(N=U=ee,w=p):U=U.next=ee,et.lanes|=ce,Tr|=ce;P=P.next}while(P!==null&&P!==n);if(U===null?w=p:U.next=N,!Hn(p,e.memoizedState)&&(nn=!0,ie&&(a=Ya,a!==null)))throw a;e.memoizedState=p,e.baseState=w,e.baseQueue=U,o.lastRenderedState=p}return h===null&&(o.lanes=0),[e.memoizedState,o.dispatch]}function Ru(e){var n=Qt(),a=n.queue;if(a===null)throw Error(i(311));a.lastRenderedReducer=e;var o=a.dispatch,h=a.pending,p=n.memoizedState;if(h!==null){a.pending=null;var w=h=h.next;do p=e(p,w.action),w=w.next;while(w!==h);Hn(p,n.memoizedState)||(nn=!0),n.memoizedState=p,n.baseQueue===null&&(n.baseState=p),a.lastRenderedState=p}return[p,o]}function Am(e,n,a){var o=et,h=Qt(),p=xt;if(p){if(a===void 0)throw Error(i(407));a=a()}else a=n();var w=!Hn((Nt||h).memoizedState,a);if(w&&(h.memoizedState=a,nn=!0),h=h.queue,Bu(zm.bind(null,o,h,e),[e]),h.getSnapshot!==n||w||tn!==null&&tn.memoizedState.tag&1){if(o.flags|=2048,Qa(9,{destroy:void 0},Dm.bind(null,o,h,a,n),null),zt===null)throw Error(i(349));p||(Ql&127)!==0||Tm(o,n,a)}return a}function Tm(e,n,a){e.flags|=16384,e={getSnapshot:n,value:a},n=et.updateQueue,n===null?(n=po(),et.updateQueue=n,n.stores=[e]):(a=n.stores,a===null?n.stores=[e]:a.push(e))}function Dm(e,n,a,o){n.value=a,n.getSnapshot=o,Mm(n)&&Fm(e)}function zm(e,n,a){return a(function(){Mm(n)&&Fm(e)})}function Mm(e){var n=e.getSnapshot;e=e.value;try{var a=n();return!Hn(e,a)}catch{return!0}}function Fm(e){var n=na(e,2);n!==null&&On(n,e,2)}function _u(e){var n=Cn();if(typeof e=="function"){var a=e;if(e=a(),da){ht(!0);try{a()}finally{ht(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wl,lastRenderedState:e},n}function Rm(e,n,a,o){return e.baseState=a,Fu(e,Nt,typeof o=="function"?o:Wl)}function Tb(e,n,a,o,h){if(wo(e))throw Error(i(485));if(e=n.action,e!==null){var p={payload:h,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){p.listeners.push(w)}};L.T!==null?a(!0):p.isTransition=!1,o(p),a=n.pending,a===null?(p.next=n.pending=p,_m(n,p)):(p.next=a.next,n.pending=a.next=p)}}function _m(e,n){var a=n.action,o=n.payload,h=e.state;if(n.isTransition){var p=L.T,w={};L.T=w;try{var N=a(h,o),U=L.S;U!==null&&U(w,N),Om(e,n,N)}catch(P){Ou(e,n,P)}finally{p!==null&&w.types!==null&&(p.types=w.types),L.T=p}}else try{p=a(h,o),Om(e,n,p)}catch(P){Ou(e,n,P)}}function Om(e,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(o){Bm(e,n,o)},function(o){return Ou(e,n,o)}):Bm(e,n,a)}function Bm(e,n,a){n.status="fulfilled",n.value=a,Lm(n),e.state=a,n=e.pending,n!==null&&(a=n.next,a===n?e.pending=null:(a=a.next,n.next=a,_m(e,a)))}function Ou(e,n,a){var o=e.pending;if(e.pending=null,o!==null){o=o.next;do n.status="rejected",n.reason=a,Lm(n),n=n.next;while(n!==o)}e.action=null}function Lm(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function $m(e,n){return n}function Hm(e,n){if(xt){var a=zt.formState;if(a!==null){e:{var o=et;if(xt){if(Bt){t:{for(var h=Bt,p=ll;h.nodeType!==8;){if(!p){h=null;break t}if(h=al(h.nextSibling),h===null){h=null;break t}}p=h.data,h=p==="F!"||p==="F"?h:null}if(h){Bt=al(h.nextSibling),o=h.data==="F!";break e}}vr(o)}o=!1}o&&(n=a[0])}}return a=Cn(),a.memoizedState=a.baseState=n,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:$m,lastRenderedState:n},a.queue=o,a=ax.bind(null,et,o),o.dispatch=a,o=_u(!1),p=Iu.bind(null,et,!1,o.queue),o=Cn(),h={state:n,dispatch:null,action:e,pending:null},o.queue=h,a=Tb.bind(null,et,h,p,a),h.dispatch=a,o.memoizedState=e,[n,a,!1]}function Um(e){var n=Qt();return Im(n,Nt,e)}function Im(e,n,a){if(n=Fu(e,n,$m)[0],e=go(Wl)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var o=Vi(n)}catch(w){throw w===qa?so:w}else o=n;n=Qt();var h=n.queue,p=h.dispatch;return a!==n.memoizedState&&(et.flags|=2048,Qa(9,{destroy:void 0},Db.bind(null,h,a),null)),[o,p,e]}function Db(e,n){e.action=n}function Ym(e){var n=Qt(),a=Nt;if(a!==null)return Im(n,a,e);Qt(),n=n.memoizedState,a=Qt();var o=a.queue.dispatch;return a.memoizedState=e,[n,o,!1]}function Qa(e,n,a,o){return e={tag:e,create:a,deps:o,inst:n,next:null},n=et.updateQueue,n===null&&(n=po(),et.updateQueue=n),a=n.lastEffect,a===null?n.lastEffect=e.next=e:(o=a.next,a.next=e,e.next=o,n.lastEffect=e),e}function qm(){return Qt().memoizedState}function bo(e,n,a,o){var h=Cn();et.flags|=e,h.memoizedState=Qa(1|n,{destroy:void 0},a,o===void 0?null:o)}function vo(e,n,a,o){var h=Qt();o=o===void 0?null:o;var p=h.memoizedState.inst;Nt!==null&&o!==null&&Nu(o,Nt.memoizedState.deps)?h.memoizedState=Qa(n,p,a,o):(et.flags|=e,h.memoizedState=Qa(1|n,p,a,o))}function Xm(e,n){bo(8390656,8,e,n)}function Bu(e,n){vo(2048,8,e,n)}function zb(e){et.flags|=4;var n=et.updateQueue;if(n===null)n=po(),et.updateQueue=n,n.events=[e];else{var a=n.events;a===null?n.events=[e]:a.push(e)}}function Vm(e){var n=Qt().memoizedState;return zb({ref:n,nextImpl:e}),function(){if((kt&2)!==0)throw Error(i(440));return n.impl.apply(void 0,arguments)}}function Gm(e,n){return vo(4,2,e,n)}function Km(e,n){return vo(4,4,e,n)}function Qm(e,n){if(typeof n=="function"){e=e();var a=n(e);return function(){typeof a=="function"?a():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function Wm(e,n,a){a=a!=null?a.concat([e]):null,vo(4,4,Qm.bind(null,n,e),a)}function Lu(){}function Zm(e,n){var a=Qt();n=n===void 0?null:n;var o=a.memoizedState;return n!==null&&Nu(n,o[1])?o[0]:(a.memoizedState=[e,n],e)}function Jm(e,n){var a=Qt();n=n===void 0?null:n;var o=a.memoizedState;if(n!==null&&Nu(n,o[1]))return o[0];if(o=e(),da){ht(!0);try{e()}finally{ht(!1)}}return a.memoizedState=[o,n],o}function $u(e,n,a){return a===void 0||(Ql&1073741824)!==0&&(ut&261930)===0?e.memoizedState=n:(e.memoizedState=a,e=Px(),et.lanes|=e,Tr|=e,a)}function Pm(e,n,a,o){return Hn(a,n)?a:Va.current!==null?(e=$u(e,a,o),Hn(e,n)||(nn=!0),e):(Ql&42)===0||(Ql&1073741824)!==0&&(ut&261930)===0?(nn=!0,e.memoizedState=a):(e=Px(),et.lanes|=e,Tr|=e,n)}function ex(e,n,a,o,h){var p=Z.p;Z.p=p!==0&&8>p?p:8;var w=L.T,N={};L.T=N,Iu(e,!1,n,a);try{var U=h(),P=L.S;if(P!==null&&P(N,U),U!==null&&typeof U=="object"&&typeof U.then=="function"){var ie=Eb(U,o);Gi(e,n,ie,Vn(e))}else Gi(e,n,o,Vn(e))}catch(ce){Gi(e,n,{then:function(){},status:"rejected",reason:ce},Vn())}finally{Z.p=p,w!==null&&N.types!==null&&(w.types=N.types),L.T=w}}function Mb(){}function Hu(e,n,a,o){if(e.tag!==5)throw Error(i(476));var h=tx(e).queue;ex(e,h,n,de,a===null?Mb:function(){return nx(e),a(o)})}function tx(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:de,baseState:de,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wl,lastRenderedState:de},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wl,lastRenderedState:a},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function nx(e){var n=tx(e);n.next===null&&(n=e.alternate.memoizedState),Gi(e,n.next.queue,{},Vn())}function Uu(){return xn(us)}function lx(){return Qt().memoizedState}function rx(){return Qt().memoizedState}function Fb(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var a=Vn();e=jr(a);var o=Sr(n,e,a);o!==null&&(On(o,n,a),Ii(o,n,a)),n={cache:pu()},e.payload=n;return}n=n.return}}function Rb(e,n,a){var o=Vn();a={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},wo(e)?ix(n,a):(a=au(e,n,a,o),a!==null&&(On(a,e,o),sx(a,n,o)))}function ax(e,n,a){var o=Vn();Gi(e,n,a,o)}function Gi(e,n,a,o){var h={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(wo(e))ix(n,h);else{var p=e.alternate;if(e.lanes===0&&(p===null||p.lanes===0)&&(p=n.lastRenderedReducer,p!==null))try{var w=n.lastRenderedState,N=p(w,a);if(h.hasEagerState=!0,h.eagerState=N,Hn(N,w))return eo(e,n,h,0),zt===null&&Ps(),!1}catch{}finally{}if(a=au(e,n,h,o),a!==null)return On(a,e,o),sx(a,n,o),!0}return!1}function Iu(e,n,a,o){if(o={lane:2,revertLane:vd(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},wo(e)){if(n)throw Error(i(479))}else n=au(e,a,o,2),n!==null&&On(n,e,2)}function wo(e){var n=e.alternate;return e===et||n!==null&&n===et}function ix(e,n){Ga=mo=!0;var a=e.pending;a===null?n.next=n:(n.next=a.next,a.next=n),e.pending=n}function sx(e,n,a){if((a&4194048)!==0){var o=n.lanes;o&=e.pendingLanes,a|=o,n.lanes=a,Hl(e,a)}}var Ki={readContext:xn,use:yo,useCallback:Xt,useContext:Xt,useEffect:Xt,useImperativeHandle:Xt,useLayoutEffect:Xt,useInsertionEffect:Xt,useMemo:Xt,useReducer:Xt,useRef:Xt,useState:Xt,useDebugValue:Xt,useDeferredValue:Xt,useTransition:Xt,useSyncExternalStore:Xt,useId:Xt,useHostTransitionStatus:Xt,useFormState:Xt,useActionState:Xt,useOptimistic:Xt,useMemoCache:Xt,useCacheRefresh:Xt};Ki.useEffectEvent=Xt;var ox={readContext:xn,use:yo,useCallback:function(e,n){return Cn().memoizedState=[e,n===void 0?null:n],e},useContext:xn,useEffect:Xm,useImperativeHandle:function(e,n,a){a=a!=null?a.concat([e]):null,bo(4194308,4,Qm.bind(null,n,e),a)},useLayoutEffect:function(e,n){return bo(4194308,4,e,n)},useInsertionEffect:function(e,n){bo(4,2,e,n)},useMemo:function(e,n){var a=Cn();n=n===void 0?null:n;var o=e();if(da){ht(!0);try{e()}finally{ht(!1)}}return a.memoizedState=[o,n],o},useReducer:function(e,n,a){var o=Cn();if(a!==void 0){var h=a(n);if(da){ht(!0);try{a(n)}finally{ht(!1)}}}else h=n;return o.memoizedState=o.baseState=h,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:h},o.queue=e,e=e.dispatch=Rb.bind(null,et,e),[o.memoizedState,e]},useRef:function(e){var n=Cn();return e={current:e},n.memoizedState=e},useState:function(e){e=_u(e);var n=e.queue,a=ax.bind(null,et,n);return n.dispatch=a,[e.memoizedState,a]},useDebugValue:Lu,useDeferredValue:function(e,n){var a=Cn();return $u(a,e,n)},useTransition:function(){var e=_u(!1);return e=ex.bind(null,et,e.queue,!0,!1),Cn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,a){var o=et,h=Cn();if(xt){if(a===void 0)throw Error(i(407));a=a()}else{if(a=n(),zt===null)throw Error(i(349));(ut&127)!==0||Tm(o,n,a)}h.memoizedState=a;var p={value:a,getSnapshot:n};return h.queue=p,Xm(zm.bind(null,o,p,e),[e]),o.flags|=2048,Qa(9,{destroy:void 0},Dm.bind(null,o,p,a,n),null),a},useId:function(){var e=Cn(),n=zt.identifierPrefix;if(xt){var a=Al,o=Nl;a=(o&~(1<<32-Pe(o)-1)).toString(32)+a,n="_"+n+"R_"+a,a=xo++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=Nb++,n="_"+n+"r_"+a.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:Uu,useFormState:Hm,useActionState:Hm,useOptimistic:function(e){var n=Cn();n.memoizedState=n.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=Iu.bind(null,et,!0,a),a.dispatch=n,[e,n]},useMemoCache:Mu,useCacheRefresh:function(){return Cn().memoizedState=Fb.bind(null,et)},useEffectEvent:function(e){var n=Cn(),a={impl:e};return n.memoizedState=a,function(){if((kt&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}},Yu={readContext:xn,use:yo,useCallback:Zm,useContext:xn,useEffect:Bu,useImperativeHandle:Wm,useInsertionEffect:Gm,useLayoutEffect:Km,useMemo:Jm,useReducer:go,useRef:qm,useState:function(){return go(Wl)},useDebugValue:Lu,useDeferredValue:function(e,n){var a=Qt();return Pm(a,Nt.memoizedState,e,n)},useTransition:function(){var e=go(Wl)[0],n=Qt().memoizedState;return[typeof e=="boolean"?e:Vi(e),n]},useSyncExternalStore:Am,useId:lx,useHostTransitionStatus:Uu,useFormState:Um,useActionState:Um,useOptimistic:function(e,n){var a=Qt();return Rm(a,Nt,e,n)},useMemoCache:Mu,useCacheRefresh:rx};Yu.useEffectEvent=Vm;var cx={readContext:xn,use:yo,useCallback:Zm,useContext:xn,useEffect:Bu,useImperativeHandle:Wm,useInsertionEffect:Gm,useLayoutEffect:Km,useMemo:Jm,useReducer:Ru,useRef:qm,useState:function(){return Ru(Wl)},useDebugValue:Lu,useDeferredValue:function(e,n){var a=Qt();return Nt===null?$u(a,e,n):Pm(a,Nt.memoizedState,e,n)},useTransition:function(){var e=Ru(Wl)[0],n=Qt().memoizedState;return[typeof e=="boolean"?e:Vi(e),n]},useSyncExternalStore:Am,useId:lx,useHostTransitionStatus:Uu,useFormState:Ym,useActionState:Ym,useOptimistic:function(e,n){var a=Qt();return Nt!==null?Rm(a,Nt,e,n):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:Mu,useCacheRefresh:rx};cx.useEffectEvent=Vm;function qu(e,n,a,o){n=e.memoizedState,a=a(o,n),a=a==null?n:y({},n,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Xu={enqueueSetState:function(e,n,a){e=e._reactInternals;var o=Vn(),h=jr(o);h.payload=n,a!=null&&(h.callback=a),n=Sr(e,h,o),n!==null&&(On(n,e,o),Ii(n,e,o))},enqueueReplaceState:function(e,n,a){e=e._reactInternals;var o=Vn(),h=jr(o);h.tag=1,h.payload=n,a!=null&&(h.callback=a),n=Sr(e,h,o),n!==null&&(On(n,e,o),Ii(n,e,o))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var a=Vn(),o=jr(a);o.tag=2,n!=null&&(o.callback=n),n=Sr(e,o,a),n!==null&&(On(n,e,a),Ii(n,e,a))}};function ux(e,n,a,o,h,p,w){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(o,p,w):n.prototype&&n.prototype.isPureReactComponent?!Ri(a,o)||!Ri(h,p):!0}function dx(e,n,a,o){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,o),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,o),n.state!==e&&Xu.enqueueReplaceState(n,n.state,null)}function fa(e,n){var a=n;if("ref"in n){a={};for(var o in n)o!=="ref"&&(a[o]=n[o])}if(e=e.defaultProps){a===n&&(a=y({},a));for(var h in e)a[h]===void 0&&(a[h]=e[h])}return a}function fx(e){Js(e)}function hx(e){console.error(e)}function mx(e){Js(e)}function ko(e,n){try{var a=e.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(o){setTimeout(function(){throw o})}}function xx(e,n,a){try{var o=e.onCaughtError;o(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(h){setTimeout(function(){throw h})}}function Vu(e,n,a){return a=jr(a),a.tag=3,a.payload={element:null},a.callback=function(){ko(e,n)},a}function px(e){return e=jr(e),e.tag=3,e}function yx(e,n,a,o){var h=a.type.getDerivedStateFromError;if(typeof h=="function"){var p=o.value;e.payload=function(){return h(p)},e.callback=function(){xx(n,a,o)}}var w=a.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(e.callback=function(){xx(n,a,o),typeof h!="function"&&(Dr===null?Dr=new Set([this]):Dr.add(this));var N=o.stack;this.componentDidCatch(o.value,{componentStack:N!==null?N:""})})}function _b(e,n,a,o,h){if(a.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(n=a.alternate,n!==null&&Ua(n,a,h,!0),a=In.current,a!==null){switch(a.tag){case 31:case 13:return rl===null?Ro():a.alternate===null&&Vt===0&&(Vt=3),a.flags&=-257,a.flags|=65536,a.lanes=h,o===oo?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([o]):n.add(o),yd(e,o,h)),!1;case 22:return a.flags|=65536,o===oo?a.flags|=16384:(n=a.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([o])},a.updateQueue=n):(a=n.retryQueue,a===null?n.retryQueue=new Set([o]):a.add(o)),yd(e,o,h)),!1}throw Error(i(435,a.tag))}return yd(e,o,h),Ro(),!1}if(xt)return n=In.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=h,o!==du&&(e=Error(i(422),{cause:o}),Bi(el(e,a)))):(o!==du&&(n=Error(i(423),{cause:o}),Bi(el(n,a))),e=e.current.alternate,e.flags|=65536,h&=-h,e.lanes|=h,o=el(o,a),h=Vu(e.stateNode,o,h),ku(e,h),Vt!==4&&(Vt=2)),!1;var p=Error(i(520),{cause:o});if(p=el(p,a),ns===null?ns=[p]:ns.push(p),Vt!==4&&(Vt=2),n===null)return!0;o=el(o,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,e=h&-h,a.lanes|=e,e=Vu(a.stateNode,o,e),ku(a,e),!1;case 1:if(n=a.type,p=a.stateNode,(a.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(Dr===null||!Dr.has(p))))return a.flags|=65536,h&=-h,a.lanes|=h,h=px(h),yx(h,e,a,o),ku(a,h),!1}a=a.return}while(a!==null);return!1}var Gu=Error(i(461)),nn=!1;function pn(e,n,a,o){n.child=e===null?wm(n,null,a,o):ua(n,e.child,a,o)}function gx(e,n,a,o,h){a=a.render;var p=n.ref;if("ref"in o){var w={};for(var N in o)N!=="ref"&&(w[N]=o[N])}else w=o;return ia(n),o=Au(e,n,a,w,p,h),N=Tu(),e!==null&&!nn?(Du(e,n,h),Zl(e,n,h)):(xt&&N&&cu(n),n.flags|=1,pn(e,n,o,h),n.child)}function bx(e,n,a,o,h){if(e===null){var p=a.type;return typeof p=="function"&&!iu(p)&&p.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=p,vx(e,n,p,o,h)):(e=no(a.type,null,o,n,n.mode,h),e.ref=n.ref,e.return=n,n.child=e)}if(p=e.child,!td(e,h)){var w=p.memoizedProps;if(a=a.compare,a=a!==null?a:Ri,a(w,o)&&e.ref===n.ref)return Zl(e,n,h)}return n.flags|=1,e=Xl(p,o),e.ref=n.ref,e.return=n,n.child=e}function vx(e,n,a,o,h){if(e!==null){var p=e.memoizedProps;if(Ri(p,o)&&e.ref===n.ref)if(nn=!1,n.pendingProps=o=p,td(e,h))(e.flags&131072)!==0&&(nn=!0);else return n.lanes=e.lanes,Zl(e,n,h)}return Ku(e,n,a,o,h)}function wx(e,n,a,o){var h=o.children,p=e!==null?e.memoizedState:null;if(e===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((n.flags&128)!==0){if(p=p!==null?p.baseLanes|a:a,e!==null){for(o=n.child=e.child,h=0;o!==null;)h=h|o.lanes|o.childLanes,o=o.sibling;o=h&~p}else o=0,n.child=null;return kx(e,n,p,a,o)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&io(n,p!==null?p.cachePool:null),p!==null?Sm(n,p):Su(),Cm(n);else return o=n.lanes=536870912,kx(e,n,p!==null?p.baseLanes|a:a,a,o)}else p!==null?(io(n,p.cachePool),Sm(n,p),Er(),n.memoizedState=null):(e!==null&&io(n,null),Su(),Er());return pn(e,n,h,a),n.child}function Qi(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function kx(e,n,a,o,h){var p=gu();return p=p===null?null:{parent:en._currentValue,pool:p},n.memoizedState={baseLanes:a,cachePool:p},e!==null&&io(n,null),Su(),Cm(n),e!==null&&Ua(e,n,o,!0),n.childLanes=h,null}function jo(e,n){return n=Co({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function jx(e,n,a){return ua(n,e.child,null,a),e=jo(n,n.pendingProps),e.flags|=2,Yn(n),n.memoizedState=null,e}function Ob(e,n,a){var o=n.pendingProps,h=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(xt){if(o.mode==="hidden")return e=jo(n,o),n.lanes=536870912,Qi(null,e);if(Eu(n),(e=Bt)?(e=_p(e,ll),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:gr!==null?{id:Nl,overflow:Al}:null,retryLane:536870912,hydrationErrors:null},a=im(e),a.return=n,n.child=a,mn=n,Bt=null)):e=null,e===null)throw vr(n);return n.lanes=536870912,null}return jo(n,o)}var p=e.memoizedState;if(p!==null){var w=p.dehydrated;if(Eu(n),h)if(n.flags&256)n.flags&=-257,n=jx(e,n,a);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(i(558));else if(nn||Ua(e,n,a,!1),h=(a&e.childLanes)!==0,nn||h){if(o=zt,o!==null&&(w=Ca(o,a),w!==0&&w!==p.retryLane))throw p.retryLane=w,na(e,w),On(o,e,w),Gu;Ro(),n=jx(e,n,a)}else e=p.treeContext,Bt=al(w.nextSibling),mn=n,xt=!0,br=null,ll=!1,e!==null&&cm(n,e),n=jo(n,o),n.flags|=4096;return n}return e=Xl(e.child,{mode:o.mode,children:o.children}),e.ref=n.ref,n.child=e,e.return=n,e}function So(e,n){var a=n.ref;if(a===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(i(284));(e===null||e.ref!==a)&&(n.flags|=4194816)}}function Ku(e,n,a,o,h){return ia(n),a=Au(e,n,a,o,void 0,h),o=Tu(),e!==null&&!nn?(Du(e,n,h),Zl(e,n,h)):(xt&&o&&cu(n),n.flags|=1,pn(e,n,a,h),n.child)}function Sx(e,n,a,o,h,p){return ia(n),n.updateQueue=null,a=Nm(n,o,a,h),Em(e),o=Tu(),e!==null&&!nn?(Du(e,n,p),Zl(e,n,p)):(xt&&o&&cu(n),n.flags|=1,pn(e,n,a,p),n.child)}function Cx(e,n,a,o,h){if(ia(n),n.stateNode===null){var p=Ba,w=a.contextType;typeof w=="object"&&w!==null&&(p=xn(w)),p=new a(o,p),n.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=Xu,n.stateNode=p,p._reactInternals=n,p=n.stateNode,p.props=o,p.state=n.memoizedState,p.refs={},vu(n),w=a.contextType,p.context=typeof w=="object"&&w!==null?xn(w):Ba,p.state=n.memoizedState,w=a.getDerivedStateFromProps,typeof w=="function"&&(qu(n,a,w,o),p.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(w=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),w!==p.state&&Xu.enqueueReplaceState(p,p.state,null),qi(n,o,p,h),Yi(),p.state=n.memoizedState),typeof p.componentDidMount=="function"&&(n.flags|=4194308),o=!0}else if(e===null){p=n.stateNode;var N=n.memoizedProps,U=fa(a,N);p.props=U;var P=p.context,ie=a.contextType;w=Ba,typeof ie=="object"&&ie!==null&&(w=xn(ie));var ce=a.getDerivedStateFromProps;ie=typeof ce=="function"||typeof p.getSnapshotBeforeUpdate=="function",N=n.pendingProps!==N,ie||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(N||P!==w)&&dx(n,p,o,w),kr=!1;var ee=n.memoizedState;p.state=ee,qi(n,o,p,h),Yi(),P=n.memoizedState,N||ee!==P||kr?(typeof ce=="function"&&(qu(n,a,ce,o),P=n.memoizedState),(U=kr||ux(n,a,U,o,ee,P,w))?(ie||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(n.flags|=4194308)):(typeof p.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=o,n.memoizedState=P),p.props=o,p.state=P,p.context=w,o=U):(typeof p.componentDidMount=="function"&&(n.flags|=4194308),o=!1)}else{p=n.stateNode,wu(e,n),w=n.memoizedProps,ie=fa(a,w),p.props=ie,ce=n.pendingProps,ee=p.context,P=a.contextType,U=Ba,typeof P=="object"&&P!==null&&(U=xn(P)),N=a.getDerivedStateFromProps,(P=typeof N=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(w!==ce||ee!==U)&&dx(n,p,o,U),kr=!1,ee=n.memoizedState,p.state=ee,qi(n,o,p,h),Yi();var le=n.memoizedState;w!==ce||ee!==le||kr||e!==null&&e.dependencies!==null&&ro(e.dependencies)?(typeof N=="function"&&(qu(n,a,N,o),le=n.memoizedState),(ie=kr||ux(n,a,ie,o,ee,le,U)||e!==null&&e.dependencies!==null&&ro(e.dependencies))?(P||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(o,le,U),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(o,le,U)),typeof p.componentDidUpdate=="function"&&(n.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof p.componentDidUpdate!="function"||w===e.memoizedProps&&ee===e.memoizedState||(n.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||w===e.memoizedProps&&ee===e.memoizedState||(n.flags|=1024),n.memoizedProps=o,n.memoizedState=le),p.props=o,p.state=le,p.context=U,o=ie):(typeof p.componentDidUpdate!="function"||w===e.memoizedProps&&ee===e.memoizedState||(n.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||w===e.memoizedProps&&ee===e.memoizedState||(n.flags|=1024),o=!1)}return p=o,So(e,n),o=(n.flags&128)!==0,p||o?(p=n.stateNode,a=o&&typeof a.getDerivedStateFromError!="function"?null:p.render(),n.flags|=1,e!==null&&o?(n.child=ua(n,e.child,null,h),n.child=ua(n,null,a,h)):pn(e,n,a,h),n.memoizedState=p.state,e=n.child):e=Zl(e,n,h),e}function Ex(e,n,a,o){return ra(),n.flags|=256,pn(e,n,a,o),n.child}var Qu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Wu(e){return{baseLanes:e,cachePool:xm()}}function Zu(e,n,a){return e=e!==null?e.childLanes&~a:0,n&&(e|=Xn),e}function Nx(e,n,a){var o=n.pendingProps,h=!1,p=(n.flags&128)!==0,w;if((w=p)||(w=e!==null&&e.memoizedState===null?!1:(Kt.current&2)!==0),w&&(h=!0,n.flags&=-129),w=(n.flags&32)!==0,n.flags&=-33,e===null){if(xt){if(h?Cr(n):Er(),(e=Bt)?(e=_p(e,ll),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:gr!==null?{id:Nl,overflow:Al}:null,retryLane:536870912,hydrationErrors:null},a=im(e),a.return=n,n.child=a,mn=n,Bt=null)):e=null,e===null)throw vr(n);return Fd(e)?n.lanes=32:n.lanes=536870912,null}var N=o.children;return o=o.fallback,h?(Er(),h=n.mode,N=Co({mode:"hidden",children:N},h),o=la(o,h,a,null),N.return=n,o.return=n,N.sibling=o,n.child=N,o=n.child,o.memoizedState=Wu(a),o.childLanes=Zu(e,w,a),n.memoizedState=Qu,Qi(null,o)):(Cr(n),Ju(n,N))}var U=e.memoizedState;if(U!==null&&(N=U.dehydrated,N!==null)){if(p)n.flags&256?(Cr(n),n.flags&=-257,n=Pu(e,n,a)):n.memoizedState!==null?(Er(),n.child=e.child,n.flags|=128,n=null):(Er(),N=o.fallback,h=n.mode,o=Co({mode:"visible",children:o.children},h),N=la(N,h,a,null),N.flags|=2,o.return=n,N.return=n,o.sibling=N,n.child=o,ua(n,e.child,null,a),o=n.child,o.memoizedState=Wu(a),o.childLanes=Zu(e,w,a),n.memoizedState=Qu,n=Qi(null,o));else if(Cr(n),Fd(N)){if(w=N.nextSibling&&N.nextSibling.dataset,w)var P=w.dgst;w=P,o=Error(i(419)),o.stack="",o.digest=w,Bi({value:o,source:null,stack:null}),n=Pu(e,n,a)}else if(nn||Ua(e,n,a,!1),w=(a&e.childLanes)!==0,nn||w){if(w=zt,w!==null&&(o=Ca(w,a),o!==0&&o!==U.retryLane))throw U.retryLane=o,na(e,o),On(w,e,o),Gu;Md(N)||Ro(),n=Pu(e,n,a)}else Md(N)?(n.flags|=192,n.child=e.child,n=null):(e=U.treeContext,Bt=al(N.nextSibling),mn=n,xt=!0,br=null,ll=!1,e!==null&&cm(n,e),n=Ju(n,o.children),n.flags|=4096);return n}return h?(Er(),N=o.fallback,h=n.mode,U=e.child,P=U.sibling,o=Xl(U,{mode:"hidden",children:o.children}),o.subtreeFlags=U.subtreeFlags&65011712,P!==null?N=Xl(P,N):(N=la(N,h,a,null),N.flags|=2),N.return=n,o.return=n,o.sibling=N,n.child=o,Qi(null,o),o=n.child,N=e.child.memoizedState,N===null?N=Wu(a):(h=N.cachePool,h!==null?(U=en._currentValue,h=h.parent!==U?{parent:U,pool:U}:h):h=xm(),N={baseLanes:N.baseLanes|a,cachePool:h}),o.memoizedState=N,o.childLanes=Zu(e,w,a),n.memoizedState=Qu,Qi(e.child,o)):(Cr(n),a=e.child,e=a.sibling,a=Xl(a,{mode:"visible",children:o.children}),a.return=n,a.sibling=null,e!==null&&(w=n.deletions,w===null?(n.deletions=[e],n.flags|=16):w.push(e)),n.child=a,n.memoizedState=null,a)}function Ju(e,n){return n=Co({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function Co(e,n){return e=Un(22,e,null,n),e.lanes=0,e}function Pu(e,n,a){return ua(n,e.child,null,a),e=Ju(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function Ax(e,n,a){e.lanes|=n;var o=e.alternate;o!==null&&(o.lanes|=n),mu(e.return,n,a)}function ed(e,n,a,o,h,p){var w=e.memoizedState;w===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:o,tail:a,tailMode:h,treeForkCount:p}:(w.isBackwards=n,w.rendering=null,w.renderingStartTime=0,w.last=o,w.tail=a,w.tailMode=h,w.treeForkCount=p)}function Tx(e,n,a){var o=n.pendingProps,h=o.revealOrder,p=o.tail;o=o.children;var w=Kt.current,N=(w&2)!==0;if(N?(w=w&1|2,n.flags|=128):w&=1,T(Kt,w),pn(e,n,o,a),o=xt?Oi:0,!N&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Ax(e,a,n);else if(e.tag===19)Ax(e,a,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(h){case"forwards":for(a=n.child,h=null;a!==null;)e=a.alternate,e!==null&&ho(e)===null&&(h=a),a=a.sibling;a=h,a===null?(h=n.child,n.child=null):(h=a.sibling,a.sibling=null),ed(n,!1,h,a,p,o);break;case"backwards":case"unstable_legacy-backwards":for(a=null,h=n.child,n.child=null;h!==null;){if(e=h.alternate,e!==null&&ho(e)===null){n.child=h;break}e=h.sibling,h.sibling=a,a=h,h=e}ed(n,!0,a,null,p,o);break;case"together":ed(n,!1,null,null,void 0,o);break;default:n.memoizedState=null}return n.child}function Zl(e,n,a){if(e!==null&&(n.dependencies=e.dependencies),Tr|=n.lanes,(a&n.childLanes)===0)if(e!==null){if(Ua(e,n,a,!1),(a&n.childLanes)===0)return null}else return null;if(e!==null&&n.child!==e.child)throw Error(i(153));if(n.child!==null){for(e=n.child,a=Xl(e,e.pendingProps),n.child=a,a.return=n;e.sibling!==null;)e=e.sibling,a=a.sibling=Xl(e,e.pendingProps),a.return=n;a.sibling=null}return n.child}function td(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&ro(e)))}function Bb(e,n,a){switch(n.tag){case 3:Be(n,n.stateNode.containerInfo),wr(n,en,e.memoizedState.cache),ra();break;case 27:case 5:Se(n);break;case 4:Be(n,n.stateNode.containerInfo);break;case 10:wr(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,Eu(n),null;break;case 13:var o=n.memoizedState;if(o!==null)return o.dehydrated!==null?(Cr(n),n.flags|=128,null):(a&n.child.childLanes)!==0?Nx(e,n,a):(Cr(n),e=Zl(e,n,a),e!==null?e.sibling:null);Cr(n);break;case 19:var h=(e.flags&128)!==0;if(o=(a&n.childLanes)!==0,o||(Ua(e,n,a,!1),o=(a&n.childLanes)!==0),h){if(o)return Tx(e,n,a);n.flags|=128}if(h=n.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),T(Kt,Kt.current),o)break;return null;case 22:return n.lanes=0,wx(e,n,a,n.pendingProps);case 24:wr(n,en,e.memoizedState.cache)}return Zl(e,n,a)}function Dx(e,n,a){if(e!==null)if(e.memoizedProps!==n.pendingProps)nn=!0;else{if(!td(e,a)&&(n.flags&128)===0)return nn=!1,Bb(e,n,a);nn=(e.flags&131072)!==0}else nn=!1,xt&&(n.flags&1048576)!==0&&om(n,Oi,n.index);switch(n.lanes=0,n.tag){case 16:e:{var o=n.pendingProps;if(e=oa(n.elementType),n.type=e,typeof e=="function")iu(e)?(o=fa(e,o),n.tag=1,n=Cx(null,n,e,o,a)):(n.tag=0,n=Ku(null,n,e,o,a));else{if(e!=null){var h=e.$$typeof;if(h===_){n.tag=11,n=gx(null,n,e,o,a);break e}else if(h===I){n.tag=14,n=bx(null,n,e,o,a);break e}}throw n=ne(e)||e,Error(i(306,n,""))}}return n;case 0:return Ku(e,n,n.type,n.pendingProps,a);case 1:return o=n.type,h=fa(o,n.pendingProps),Cx(e,n,o,h,a);case 3:e:{if(Be(n,n.stateNode.containerInfo),e===null)throw Error(i(387));o=n.pendingProps;var p=n.memoizedState;h=p.element,wu(e,n),qi(n,o,null,a);var w=n.memoizedState;if(o=w.cache,wr(n,en,o),o!==p.cache&&xu(n,[en],a,!0),Yi(),o=w.element,p.isDehydrated)if(p={element:o,isDehydrated:!1,cache:w.cache},n.updateQueue.baseState=p,n.memoizedState=p,n.flags&256){n=Ex(e,n,o,a);break e}else if(o!==h){h=el(Error(i(424)),n),Bi(h),n=Ex(e,n,o,a);break e}else{switch(e=n.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Bt=al(e.firstChild),mn=n,xt=!0,br=null,ll=!0,a=wm(n,null,o,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(ra(),o===h){n=Zl(e,n,a);break e}pn(e,n,o,a)}n=n.child}return n;case 26:return So(e,n),e===null?(a=Up(n.type,null,n.pendingProps,null))?n.memoizedState=a:xt||(a=n.type,e=n.pendingProps,o=Uo(Ne.current).createElement(a),o[Jt]=n,o[hn]=e,yn(o,a,e),Ut(o),n.stateNode=o):n.memoizedState=Up(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return Se(n),e===null&&xt&&(o=n.stateNode=Lp(n.type,n.pendingProps,Ne.current),mn=n,ll=!0,h=Bt,Rr(n.type)?(Rd=h,Bt=al(o.firstChild)):Bt=h),pn(e,n,n.pendingProps.children,a),So(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&xt&&((h=o=Bt)&&(o=h2(o,n.type,n.pendingProps,ll),o!==null?(n.stateNode=o,mn=n,Bt=al(o.firstChild),ll=!1,h=!0):h=!1),h||vr(n)),Se(n),h=n.type,p=n.pendingProps,w=e!==null?e.memoizedProps:null,o=p.children,Td(h,p)?o=null:w!==null&&Td(h,w)&&(n.flags|=32),n.memoizedState!==null&&(h=Au(e,n,Ab,null,null,a),us._currentValue=h),So(e,n),pn(e,n,o,a),n.child;case 6:return e===null&&xt&&((e=a=Bt)&&(a=m2(a,n.pendingProps,ll),a!==null?(n.stateNode=a,mn=n,Bt=null,e=!0):e=!1),e||vr(n)),null;case 13:return Nx(e,n,a);case 4:return Be(n,n.stateNode.containerInfo),o=n.pendingProps,e===null?n.child=ua(n,null,o,a):pn(e,n,o,a),n.child;case 11:return gx(e,n,n.type,n.pendingProps,a);case 7:return pn(e,n,n.pendingProps,a),n.child;case 8:return pn(e,n,n.pendingProps.children,a),n.child;case 12:return pn(e,n,n.pendingProps.children,a),n.child;case 10:return o=n.pendingProps,wr(n,n.type,o.value),pn(e,n,o.children,a),n.child;case 9:return h=n.type._context,o=n.pendingProps.children,ia(n),h=xn(h),o=o(h),n.flags|=1,pn(e,n,o,a),n.child;case 14:return bx(e,n,n.type,n.pendingProps,a);case 15:return vx(e,n,n.type,n.pendingProps,a);case 19:return Tx(e,n,a);case 31:return Ob(e,n,a);case 22:return wx(e,n,a,n.pendingProps);case 24:return ia(n),o=xn(en),e===null?(h=gu(),h===null&&(h=zt,p=pu(),h.pooledCache=p,p.refCount++,p!==null&&(h.pooledCacheLanes|=a),h=p),n.memoizedState={parent:o,cache:h},vu(n),wr(n,en,h)):((e.lanes&a)!==0&&(wu(e,n),qi(n,null,null,a),Yi()),h=e.memoizedState,p=n.memoizedState,h.parent!==o?(h={parent:o,cache:o},n.memoizedState=h,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=h),wr(n,en,o)):(o=p.cache,wr(n,en,o),o!==h.cache&&xu(n,[en],a,!0))),pn(e,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(i(156,n.tag))}function Jl(e){e.flags|=4}function nd(e,n,a,o,h){if((n=(e.mode&32)!==0)&&(n=!1),n){if(e.flags|=16777216,(h&335544128)===h)if(e.stateNode.complete)e.flags|=8192;else if(lp())e.flags|=8192;else throw ca=oo,bu}else e.flags&=-16777217}function zx(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Vp(n))if(lp())e.flags|=8192;else throw ca=oo,bu}function Eo(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?Zt():536870912,e.lanes|=n,Pa|=n)}function Wi(e,n){if(!xt)switch(e.tailMode){case"hidden":n=e.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var o=null;a!==null;)a.alternate!==null&&(o=a),a=a.sibling;o===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:o.sibling=null}}function Lt(e){var n=e.alternate!==null&&e.alternate.child===e.child,a=0,o=0;if(n)for(var h=e.child;h!==null;)a|=h.lanes|h.childLanes,o|=h.subtreeFlags&65011712,o|=h.flags&65011712,h.return=e,h=h.sibling;else for(h=e.child;h!==null;)a|=h.lanes|h.childLanes,o|=h.subtreeFlags,o|=h.flags,h.return=e,h=h.sibling;return e.subtreeFlags|=o,e.childLanes=a,n}function Lb(e,n,a){var o=n.pendingProps;switch(uu(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Lt(n),null;case 1:return Lt(n),null;case 3:return a=n.stateNode,o=null,e!==null&&(o=e.memoizedState.cache),n.memoizedState.cache!==o&&(n.flags|=2048),Kl(en),Qe(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Ha(n)?Jl(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,fu())),Lt(n),null;case 26:var h=n.type,p=n.memoizedState;return e===null?(Jl(n),p!==null?(Lt(n),zx(n,p)):(Lt(n),nd(n,h,null,o,a))):p?p!==e.memoizedState?(Jl(n),Lt(n),zx(n,p)):(Lt(n),n.flags&=-16777217):(e=e.memoizedProps,e!==o&&Jl(n),Lt(n),nd(n,h,e,o,a)),null;case 27:if(tt(n),a=Ne.current,h=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==o&&Jl(n);else{if(!o){if(n.stateNode===null)throw Error(i(166));return Lt(n),null}e=fe.current,Ha(n)?um(n):(e=Lp(h,o,a),n.stateNode=e,Jl(n))}return Lt(n),null;case 5:if(tt(n),h=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==o&&Jl(n);else{if(!o){if(n.stateNode===null)throw Error(i(166));return Lt(n),null}if(p=fe.current,Ha(n))um(n);else{var w=Uo(Ne.current);switch(p){case 1:p=w.createElementNS("http://www.w3.org/2000/svg",h);break;case 2:p=w.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;default:switch(h){case"svg":p=w.createElementNS("http://www.w3.org/2000/svg",h);break;case"math":p=w.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;case"script":p=w.createElement("div"),p.innerHTML="<script><\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof o.is=="string"?w.createElement("select",{is:o.is}):w.createElement("select"),o.multiple?p.multiple=!0:o.size&&(p.size=o.size);break;default:p=typeof o.is=="string"?w.createElement(h,{is:o.is}):w.createElement(h)}}p[Jt]=n,p[hn]=o;e:for(w=n.child;w!==null;){if(w.tag===5||w.tag===6)p.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===n)break e;for(;w.sibling===null;){if(w.return===null||w.return===n)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}n.stateNode=p;e:switch(yn(p,h,o),h){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&Jl(n)}}return Lt(n),nd(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,a),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==o&&Jl(n);else{if(typeof o!="string"&&n.stateNode===null)throw Error(i(166));if(e=Ne.current,Ha(n)){if(e=n.stateNode,a=n.memoizedProps,o=null,h=mn,h!==null)switch(h.tag){case 27:case 5:o=h.memoizedProps}e[Jt]=n,e=!!(e.nodeValue===a||o!==null&&o.suppressHydrationWarning===!0||Np(e.nodeValue,a)),e||vr(n,!0)}else e=Uo(e).createTextNode(o),e[Jt]=n,n.stateNode=e}return Lt(n),null;case 31:if(a=n.memoizedState,e===null||e.memoizedState!==null){if(o=Ha(n),a!==null){if(e===null){if(!o)throw Error(i(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(557));e[Jt]=n}else ra(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Lt(n),e=!1}else a=fu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return n.flags&256?(Yn(n),n):(Yn(n),null);if((n.flags&128)!==0)throw Error(i(558))}return Lt(n),null;case 13:if(o=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(h=Ha(n),o!==null&&o.dehydrated!==null){if(e===null){if(!h)throw Error(i(318));if(h=n.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(i(317));h[Jt]=n}else ra(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Lt(n),h=!1}else h=fu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=h),h=!0;if(!h)return n.flags&256?(Yn(n),n):(Yn(n),null)}return Yn(n),(n.flags&128)!==0?(n.lanes=a,n):(a=o!==null,e=e!==null&&e.memoizedState!==null,a&&(o=n.child,h=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(h=o.alternate.memoizedState.cachePool.pool),p=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(p=o.memoizedState.cachePool.pool),p!==h&&(o.flags|=2048)),a!==e&&a&&(n.child.flags|=8192),Eo(n,n.updateQueue),Lt(n),null);case 4:return Qe(),e===null&&Sd(n.stateNode.containerInfo),Lt(n),null;case 10:return Kl(n.type),Lt(n),null;case 19:if(K(Kt),o=n.memoizedState,o===null)return Lt(n),null;if(h=(n.flags&128)!==0,p=o.rendering,p===null)if(h)Wi(o,!1);else{if(Vt!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(p=ho(e),p!==null){for(n.flags|=128,Wi(o,!1),e=p.updateQueue,n.updateQueue=e,Eo(n,e),n.subtreeFlags=0,e=a,a=n.child;a!==null;)am(a,e),a=a.sibling;return T(Kt,Kt.current&1|2),xt&&Vl(n,o.treeForkCount),n.child}e=e.sibling}o.tail!==null&>()>zo&&(n.flags|=128,h=!0,Wi(o,!1),n.lanes=4194304)}else{if(!h)if(e=ho(p),e!==null){if(n.flags|=128,h=!0,e=e.updateQueue,n.updateQueue=e,Eo(n,e),Wi(o,!0),o.tail===null&&o.tailMode==="hidden"&&!p.alternate&&!xt)return Lt(n),null}else 2*gt()-o.renderingStartTime>zo&&a!==536870912&&(n.flags|=128,h=!0,Wi(o,!1),n.lanes=4194304);o.isBackwards?(p.sibling=n.child,n.child=p):(e=o.last,e!==null?e.sibling=p:n.child=p,o.last=p)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=gt(),e.sibling=null,a=Kt.current,T(Kt,h?a&1|2:a&1),xt&&Vl(n,o.treeForkCount),e):(Lt(n),null);case 22:case 23:return Yn(n),Cu(),o=n.memoizedState!==null,e!==null?e.memoizedState!==null!==o&&(n.flags|=8192):o&&(n.flags|=8192),o?(a&536870912)!==0&&(n.flags&128)===0&&(Lt(n),n.subtreeFlags&6&&(n.flags|=8192)):Lt(n),a=n.updateQueue,a!==null&&Eo(n,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),o=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),o!==a&&(n.flags|=2048),e!==null&&K(sa),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),Kl(en),Lt(n),null;case 25:return null;case 30:return null}throw Error(i(156,n.tag))}function $b(e,n){switch(uu(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return Kl(en),Qe(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return tt(n),null;case 31:if(n.memoizedState!==null){if(Yn(n),n.alternate===null)throw Error(i(340));ra()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(Yn(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(i(340));ra()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return K(Kt),null;case 4:return Qe(),null;case 10:return Kl(n.type),null;case 22:case 23:return Yn(n),Cu(),e!==null&&K(sa),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return Kl(en),null;case 25:return null;default:return null}}function Mx(e,n){switch(uu(n),n.tag){case 3:Kl(en),Qe();break;case 26:case 27:case 5:tt(n);break;case 4:Qe();break;case 31:n.memoizedState!==null&&Yn(n);break;case 13:Yn(n);break;case 19:K(Kt);break;case 10:Kl(n.type);break;case 22:case 23:Yn(n),Cu(),e!==null&&K(sa);break;case 24:Kl(en)}}function Zi(e,n){try{var a=n.updateQueue,o=a!==null?a.lastEffect:null;if(o!==null){var h=o.next;a=h;do{if((a.tag&e)===e){o=void 0;var p=a.create,w=a.inst;o=p(),w.destroy=o}a=a.next}while(a!==h)}}catch(N){Ct(n,n.return,N)}}function Nr(e,n,a){try{var o=n.updateQueue,h=o!==null?o.lastEffect:null;if(h!==null){var p=h.next;o=p;do{if((o.tag&e)===e){var w=o.inst,N=w.destroy;if(N!==void 0){w.destroy=void 0,h=n;var U=a,P=N;try{P()}catch(ie){Ct(h,U,ie)}}}o=o.next}while(o!==p)}}catch(ie){Ct(n,n.return,ie)}}function Fx(e){var n=e.updateQueue;if(n!==null){var a=e.stateNode;try{jm(n,a)}catch(o){Ct(e,e.return,o)}}}function Rx(e,n,a){a.props=fa(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(o){Ct(e,n,o)}}function Ji(e,n){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var o=e.stateNode;break;case 30:o=e.stateNode;break;default:o=e.stateNode}typeof a=="function"?e.refCleanup=a(o):a.current=o}}catch(h){Ct(e,n,h)}}function Tl(e,n){var a=e.ref,o=e.refCleanup;if(a!==null)if(typeof o=="function")try{o()}catch(h){Ct(e,n,h)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(h){Ct(e,n,h)}else a.current=null}function _x(e){var n=e.type,a=e.memoizedProps,o=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&o.focus();break e;case"img":a.src?o.src=a.src:a.srcSet&&(o.srcset=a.srcSet)}}catch(h){Ct(e,e.return,h)}}function ld(e,n,a){try{var o=e.stateNode;s2(o,e.type,a,n),o[hn]=n}catch(h){Ct(e,e.return,h)}}function Ox(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Rr(e.type)||e.tag===4}function rd(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ox(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&&Rr(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 ad(e,n,a){var o=e.tag;if(o===5||o===6)e=e.stateNode,n?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,n):(n=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,n.appendChild(e),a=a._reactRootContainer,a!=null||n.onclick!==null||(n.onclick=hl));else if(o!==4&&(o===27&&Rr(e.type)&&(a=e.stateNode,n=null),e=e.child,e!==null))for(ad(e,n,a),e=e.sibling;e!==null;)ad(e,n,a),e=e.sibling}function No(e,n,a){var o=e.tag;if(o===5||o===6)e=e.stateNode,n?a.insertBefore(e,n):a.appendChild(e);else if(o!==4&&(o===27&&Rr(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(No(e,n,a),e=e.sibling;e!==null;)No(e,n,a),e=e.sibling}function Bx(e){var n=e.stateNode,a=e.memoizedProps;try{for(var o=e.type,h=n.attributes;h.length;)n.removeAttributeNode(h[0]);yn(n,o,a),n[Jt]=e,n[hn]=a}catch(p){Ct(e,e.return,p)}}var Pl=!1,ln=!1,id=!1,Lx=typeof WeakSet=="function"?WeakSet:Set,dn=null;function Hb(e,n){if(e=e.containerInfo,Nd=Ko,e=Wh(e),Pc(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var o=a.getSelection&&a.getSelection();if(o&&o.rangeCount!==0){a=o.anchorNode;var h=o.anchorOffset,p=o.focusNode;o=o.focusOffset;try{a.nodeType,p.nodeType}catch{a=null;break e}var w=0,N=-1,U=-1,P=0,ie=0,ce=e,ee=null;t:for(;;){for(var le;ce!==a||h!==0&&ce.nodeType!==3||(N=w+h),ce!==p||o!==0&&ce.nodeType!==3||(U=w+o),ce.nodeType===3&&(w+=ce.nodeValue.length),(le=ce.firstChild)!==null;)ee=ce,ce=le;for(;;){if(ce===e)break t;if(ee===a&&++P===h&&(N=w),ee===p&&++ie===o&&(U=w),(le=ce.nextSibling)!==null)break;ce=ee,ee=ce.parentNode}ce=le}a=N===-1||U===-1?null:{start:N,end:U}}else a=null}a=a||{start:0,end:0}}else a=null;for(Ad={focusedElem:e,selectionRange:a},Ko=!1,dn=n;dn!==null;)if(n=dn,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,dn=e;else for(;dn!==null;){switch(n=dn,p=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)h=e[a],h.ref.impl=h.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&p!==null){e=void 0,a=n,h=p.memoizedProps,p=p.memoizedState,o=a.stateNode;try{var Re=fa(a.type,h);e=o.getSnapshotBeforeUpdate(Re,p),o.__reactInternalSnapshotBeforeUpdate=e}catch(Ve){Ct(a,a.return,Ve)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,a=e.nodeType,a===9)zd(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":zd(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(i(163))}if(e=n.sibling,e!==null){e.return=n.return,dn=e;break}dn=n.return}}function $x(e,n,a){var o=a.flags;switch(a.tag){case 0:case 11:case 15:tr(e,a),o&4&&Zi(5,a);break;case 1:if(tr(e,a),o&4)if(e=a.stateNode,n===null)try{e.componentDidMount()}catch(w){Ct(a,a.return,w)}else{var h=fa(a.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(h,n,e.__reactInternalSnapshotBeforeUpdate)}catch(w){Ct(a,a.return,w)}}o&64&&Fx(a),o&512&&Ji(a,a.return);break;case 3:if(tr(e,a),o&64&&(e=a.updateQueue,e!==null)){if(n=null,a.child!==null)switch(a.child.tag){case 27:case 5:n=a.child.stateNode;break;case 1:n=a.child.stateNode}try{jm(e,n)}catch(w){Ct(a,a.return,w)}}break;case 27:n===null&&o&4&&Bx(a);case 26:case 5:tr(e,a),n===null&&o&4&&_x(a),o&512&&Ji(a,a.return);break;case 12:tr(e,a);break;case 31:tr(e,a),o&4&&Ix(e,a);break;case 13:tr(e,a),o&4&&Yx(e,a),o&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=Qb.bind(null,a),x2(e,a))));break;case 22:if(o=a.memoizedState!==null||Pl,!o){n=n!==null&&n.memoizedState!==null||ln,h=Pl;var p=ln;Pl=o,(ln=n)&&!p?nr(e,a,(a.subtreeFlags&8772)!==0):tr(e,a),Pl=h,ln=p}break;case 30:break;default:tr(e,a)}}function Hx(e){var n=e.alternate;n!==null&&(e.alternate=null,Hx(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&Aa(n)),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 It=null,Mn=!1;function er(e,n,a){for(a=a.child;a!==null;)Ux(e,n,a),a=a.sibling}function Ux(e,n,a){if(Xe&&typeof Xe.onCommitFiberUnmount=="function")try{Xe.onCommitFiberUnmount(He,a)}catch{}switch(a.tag){case 26:ln||Tl(a,n),er(e,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:ln||Tl(a,n);var o=It,h=Mn;Rr(a.type)&&(It=a.stateNode,Mn=!1),er(e,n,a),ss(a.stateNode),It=o,Mn=h;break;case 5:ln||Tl(a,n);case 6:if(o=It,h=Mn,It=null,er(e,n,a),It=o,Mn=h,It!==null)if(Mn)try{(It.nodeType===9?It.body:It.nodeName==="HTML"?It.ownerDocument.body:It).removeChild(a.stateNode)}catch(p){Ct(a,n,p)}else try{It.removeChild(a.stateNode)}catch(p){Ct(a,n,p)}break;case 18:It!==null&&(Mn?(e=It,Fp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),si(e)):Fp(It,a.stateNode));break;case 4:o=It,h=Mn,It=a.stateNode.containerInfo,Mn=!0,er(e,n,a),It=o,Mn=h;break;case 0:case 11:case 14:case 15:Nr(2,a,n),ln||Nr(4,a,n),er(e,n,a);break;case 1:ln||(Tl(a,n),o=a.stateNode,typeof o.componentWillUnmount=="function"&&Rx(a,n,o)),er(e,n,a);break;case 21:er(e,n,a);break;case 22:ln=(o=ln)||a.memoizedState!==null,er(e,n,a),ln=o;break;default:er(e,n,a)}}function Ix(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{si(e)}catch(a){Ct(n,n.return,a)}}}function Yx(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{si(e)}catch(a){Ct(n,n.return,a)}}function Ub(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new Lx),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new Lx),n;default:throw Error(i(435,e.tag))}}function Ao(e,n){var a=Ub(e);n.forEach(function(o){if(!a.has(o)){a.add(o);var h=Wb.bind(null,e,o);o.then(h,h)}})}function Fn(e,n){var a=n.deletions;if(a!==null)for(var o=0;o<a.length;o++){var h=a[o],p=e,w=n,N=w;e:for(;N!==null;){switch(N.tag){case 27:if(Rr(N.type)){It=N.stateNode,Mn=!1;break e}break;case 5:It=N.stateNode,Mn=!1;break e;case 3:case 4:It=N.stateNode.containerInfo,Mn=!0;break e}N=N.return}if(It===null)throw Error(i(160));Ux(p,w,h),It=null,Mn=!1,p=h.alternate,p!==null&&(p.return=null),h.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)qx(n,e),n=n.sibling}var xl=null;function qx(e,n){var a=e.alternate,o=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Fn(n,e),Rn(e),o&4&&(Nr(3,e,e.return),Zi(3,e),Nr(5,e,e.return));break;case 1:Fn(n,e),Rn(e),o&512&&(ln||a===null||Tl(a,a.return)),o&64&&Pl&&(e=e.updateQueue,e!==null&&(o=e.callbacks,o!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?o:a.concat(o))));break;case 26:var h=xl;if(Fn(n,e),Rn(e),o&512&&(ln||a===null||Tl(a,a.return)),o&4){var p=a!==null?a.memoizedState:null;if(o=e.memoizedState,a===null)if(o===null)if(e.stateNode===null){e:{o=e.type,a=e.memoizedProps,h=h.ownerDocument||h;t:switch(o){case"title":p=h.getElementsByTagName("title")[0],(!p||p[fr]||p[Jt]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=h.createElement(o),h.head.insertBefore(p,h.querySelector("head > title"))),yn(p,o,a),p[Jt]=e,Ut(p),o=p;break e;case"link":var w=qp("link","href",h).get(o+(a.href||""));if(w){for(var N=0;N<w.length;N++)if(p=w[N],p.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&p.getAttribute("rel")===(a.rel==null?null:a.rel)&&p.getAttribute("title")===(a.title==null?null:a.title)&&p.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){w.splice(N,1);break t}}p=h.createElement(o),yn(p,o,a),h.head.appendChild(p);break;case"meta":if(w=qp("meta","content",h).get(o+(a.content||""))){for(N=0;N<w.length;N++)if(p=w[N],p.getAttribute("content")===(a.content==null?null:""+a.content)&&p.getAttribute("name")===(a.name==null?null:a.name)&&p.getAttribute("property")===(a.property==null?null:a.property)&&p.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&p.getAttribute("charset")===(a.charSet==null?null:a.charSet)){w.splice(N,1);break t}}p=h.createElement(o),yn(p,o,a),h.head.appendChild(p);break;default:throw Error(i(468,o))}p[Jt]=e,Ut(p),o=p}e.stateNode=o}else Xp(h,e.type,e.stateNode);else e.stateNode=Yp(h,o,e.memoizedProps);else p!==o?(p===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):p.count--,o===null?Xp(h,e.type,e.stateNode):Yp(h,o,e.memoizedProps)):o===null&&e.stateNode!==null&&ld(e,e.memoizedProps,a.memoizedProps)}break;case 27:Fn(n,e),Rn(e),o&512&&(ln||a===null||Tl(a,a.return)),a!==null&&o&4&&ld(e,e.memoizedProps,a.memoizedProps);break;case 5:if(Fn(n,e),Rn(e),o&512&&(ln||a===null||Tl(a,a.return)),e.flags&32){h=e.stateNode;try{yr(h,"")}catch(Re){Ct(e,e.return,Re)}}o&4&&e.stateNode!=null&&(h=e.memoizedProps,ld(e,h,a!==null?a.memoizedProps:h)),o&1024&&(id=!0);break;case 6:if(Fn(n,e),Rn(e),o&4){if(e.stateNode===null)throw Error(i(162));o=e.memoizedProps,a=e.stateNode;try{a.nodeValue=o}catch(Re){Ct(e,e.return,Re)}}break;case 3:if(qo=null,h=xl,xl=Io(n.containerInfo),Fn(n,e),xl=h,Rn(e),o&4&&a!==null&&a.memoizedState.isDehydrated)try{si(n.containerInfo)}catch(Re){Ct(e,e.return,Re)}id&&(id=!1,Xx(e));break;case 4:o=xl,xl=Io(e.stateNode.containerInfo),Fn(n,e),Rn(e),xl=o;break;case 12:Fn(n,e),Rn(e);break;case 31:Fn(n,e),Rn(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,Ao(e,o)));break;case 13:Fn(n,e),Rn(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Do=gt()),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,Ao(e,o)));break;case 22:h=e.memoizedState!==null;var U=a!==null&&a.memoizedState!==null,P=Pl,ie=ln;if(Pl=P||h,ln=ie||U,Fn(n,e),ln=ie,Pl=P,Rn(e),o&8192)e:for(n=e.stateNode,n._visibility=h?n._visibility&-2:n._visibility|1,h&&(a===null||U||Pl||ln||ha(e)),a=null,n=e;;){if(n.tag===5||n.tag===26){if(a===null){U=a=n;try{if(p=U.stateNode,h)w=p.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{N=U.stateNode;var ce=U.memoizedProps.style,ee=ce!=null&&ce.hasOwnProperty("display")?ce.display:null;N.style.display=ee==null||typeof ee=="boolean"?"":(""+ee).trim()}}catch(Re){Ct(U,U.return,Re)}}}else if(n.tag===6){if(a===null){U=n;try{U.stateNode.nodeValue=h?"":U.memoizedProps}catch(Re){Ct(U,U.return,Re)}}}else if(n.tag===18){if(a===null){U=n;try{var le=U.stateNode;h?Rp(le,!0):Rp(U.stateNode,!1)}catch(Re){Ct(U,U.return,Re)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===e)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;a===n&&(a=null),n=n.return}a===n&&(a=null),n.sibling.return=n.return,n=n.sibling}o&4&&(o=e.updateQueue,o!==null&&(a=o.retryQueue,a!==null&&(o.retryQueue=null,Ao(e,a))));break;case 19:Fn(n,e),Rn(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,Ao(e,o)));break;case 30:break;case 21:break;default:Fn(n,e),Rn(e)}}function Rn(e){var n=e.flags;if(n&2){try{for(var a,o=e.return;o!==null;){if(Ox(o)){a=o;break}o=o.return}if(a==null)throw Error(i(160));switch(a.tag){case 27:var h=a.stateNode,p=rd(e);No(e,p,h);break;case 5:var w=a.stateNode;a.flags&32&&(yr(w,""),a.flags&=-33);var N=rd(e);No(e,N,w);break;case 3:case 4:var U=a.stateNode.containerInfo,P=rd(e);ad(e,P,U);break;default:throw Error(i(161))}}catch(ie){Ct(e,e.return,ie)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function Xx(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;Xx(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function tr(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)$x(e,n.alternate,n),n=n.sibling}function ha(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:Nr(4,n,n.return),ha(n);break;case 1:Tl(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&Rx(n,n.return,a),ha(n);break;case 27:ss(n.stateNode);case 26:case 5:Tl(n,n.return),ha(n);break;case 22:n.memoizedState===null&&ha(n);break;case 30:ha(n);break;default:ha(n)}e=e.sibling}}function nr(e,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var o=n.alternate,h=e,p=n,w=p.flags;switch(p.tag){case 0:case 11:case 15:nr(h,p,a),Zi(4,p);break;case 1:if(nr(h,p,a),o=p,h=o.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(P){Ct(o,o.return,P)}if(o=p,h=o.updateQueue,h!==null){var N=o.stateNode;try{var U=h.shared.hiddenCallbacks;if(U!==null)for(h.shared.hiddenCallbacks=null,h=0;h<U.length;h++)km(U[h],N)}catch(P){Ct(o,o.return,P)}}a&&w&64&&Fx(p),Ji(p,p.return);break;case 27:Bx(p);case 26:case 5:nr(h,p,a),a&&o===null&&w&4&&_x(p),Ji(p,p.return);break;case 12:nr(h,p,a);break;case 31:nr(h,p,a),a&&w&4&&Ix(h,p);break;case 13:nr(h,p,a),a&&w&4&&Yx(h,p);break;case 22:p.memoizedState===null&&nr(h,p,a),Ji(p,p.return);break;case 30:break;default:nr(h,p,a)}n=n.sibling}}function sd(e,n){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&Li(a))}function od(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&Li(e))}function pl(e,n,a,o){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Vx(e,n,a,o),n=n.sibling}function Vx(e,n,a,o){var h=n.flags;switch(n.tag){case 0:case 11:case 15:pl(e,n,a,o),h&2048&&Zi(9,n);break;case 1:pl(e,n,a,o);break;case 3:pl(e,n,a,o),h&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&Li(e)));break;case 12:if(h&2048){pl(e,n,a,o),e=n.stateNode;try{var p=n.memoizedProps,w=p.id,N=p.onPostCommit;typeof N=="function"&&N(w,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(U){Ct(n,n.return,U)}}else pl(e,n,a,o);break;case 31:pl(e,n,a,o);break;case 13:pl(e,n,a,o);break;case 23:break;case 22:p=n.stateNode,w=n.alternate,n.memoizedState!==null?p._visibility&2?pl(e,n,a,o):Pi(e,n):p._visibility&2?pl(e,n,a,o):(p._visibility|=2,Wa(e,n,a,o,(n.subtreeFlags&10256)!==0||!1)),h&2048&&sd(w,n);break;case 24:pl(e,n,a,o),h&2048&&od(n.alternate,n);break;default:pl(e,n,a,o)}}function Wa(e,n,a,o,h){for(h=h&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var p=e,w=n,N=a,U=o,P=w.flags;switch(w.tag){case 0:case 11:case 15:Wa(p,w,N,U,h),Zi(8,w);break;case 23:break;case 22:var ie=w.stateNode;w.memoizedState!==null?ie._visibility&2?Wa(p,w,N,U,h):Pi(p,w):(ie._visibility|=2,Wa(p,w,N,U,h)),h&&P&2048&&sd(w.alternate,w);break;case 24:Wa(p,w,N,U,h),h&&P&2048&&od(w.alternate,w);break;default:Wa(p,w,N,U,h)}n=n.sibling}}function Pi(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=e,o=n,h=o.flags;switch(o.tag){case 22:Pi(a,o),h&2048&&sd(o.alternate,o);break;case 24:Pi(a,o),h&2048&&od(o.alternate,o);break;default:Pi(a,o)}n=n.sibling}}var es=8192;function Za(e,n,a){if(e.subtreeFlags&es)for(e=e.child;e!==null;)Gx(e,n,a),e=e.sibling}function Gx(e,n,a){switch(e.tag){case 26:Za(e,n,a),e.flags&es&&e.memoizedState!==null&&N2(a,xl,e.memoizedState,e.memoizedProps);break;case 5:Za(e,n,a);break;case 3:case 4:var o=xl;xl=Io(e.stateNode.containerInfo),Za(e,n,a),xl=o;break;case 22:e.memoizedState===null&&(o=e.alternate,o!==null&&o.memoizedState!==null?(o=es,es=16777216,Za(e,n,a),es=o):Za(e,n,a));break;default:Za(e,n,a)}}function Kx(e){var n=e.alternate;if(n!==null&&(e=n.child,e!==null)){n.child=null;do n=e.sibling,e.sibling=null,e=n;while(e!==null)}}function ts(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var o=n[a];dn=o,Wx(o,e)}Kx(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Qx(e),e=e.sibling}function Qx(e){switch(e.tag){case 0:case 11:case 15:ts(e),e.flags&2048&&Nr(9,e,e.return);break;case 3:ts(e);break;case 12:ts(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,To(e)):ts(e);break;default:ts(e)}}function To(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var o=n[a];dn=o,Wx(o,e)}Kx(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:Nr(8,n,n.return),To(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,To(n));break;default:To(n)}e=e.sibling}}function Wx(e,n){for(;dn!==null;){var a=dn;switch(a.tag){case 0:case 11:case 15:Nr(8,a,n);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var o=a.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:Li(a.memoizedState.cache)}if(o=a.child,o!==null)o.return=a,dn=o;else e:for(a=e;dn!==null;){o=dn;var h=o.sibling,p=o.return;if(Hx(o),o===a){dn=null;break e}if(h!==null){h.return=p,dn=h;break e}dn=p}}}var Ib={getCacheForType:function(e){var n=xn(en),a=n.data.get(e);return a===void 0&&(a=e(),n.data.set(e,a)),a},cacheSignal:function(){return xn(en).controller.signal}},Yb=typeof WeakMap=="function"?WeakMap:Map,kt=0,zt=null,st=null,ut=0,St=0,qn=null,Ar=!1,Ja=!1,cd=!1,lr=0,Vt=0,Tr=0,ma=0,ud=0,Xn=0,Pa=0,ns=null,_n=null,dd=!1,Do=0,Zx=0,zo=1/0,Mo=null,Dr=null,an=0,zr=null,ei=null,rr=0,fd=0,hd=null,Jx=null,ls=0,md=null;function Vn(){return(kt&2)!==0&&ut!==0?ut&-ut:L.T!==null?vd():Ul()}function Px(){if(Xn===0)if((ut&536870912)===0||xt){var e=ol;ol<<=1,(ol&3932160)===0&&(ol=262144),Xn=e}else Xn=536870912;return e=In.current,e!==null&&(e.flags|=32),Xn}function On(e,n,a){(e===zt&&(St===2||St===9)||e.cancelPendingCommit!==null)&&(ti(e,0),Mr(e,ut,Xn,!1)),cl(e,a),((kt&2)===0||e!==zt)&&(e===zt&&((kt&2)===0&&(ma|=a),Vt===4&&Mr(e,ut,Xn,!1)),Dl(e))}function ep(e,n,a){if((kt&6)!==0)throw Error(i(327));var o=!a&&(n&127)===0&&(n&e.expiredLanes)===0||Wt(e,n),h=o?Vb(e,n):pd(e,n,!0),p=o;do{if(h===0){Ja&&!o&&Mr(e,n,0,!1);break}else{if(a=e.current.alternate,p&&!qb(a)){h=pd(e,n,!1),p=!1;continue}if(h===2){if(p=n,e.errorRecoveryDisabledLanes&p)var w=0;else w=e.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){n=w;e:{var N=e;h=ns;var U=N.current.memoizedState.isDehydrated;if(U&&(ti(N,w).flags|=256),w=pd(N,w,!1),w!==2){if(cd&&!U){N.errorRecoveryDisabledLanes|=p,ma|=p,h=4;break e}p=_n,_n=h,p!==null&&(_n===null?_n=p:_n.push.apply(_n,p))}h=w}if(p=!1,h!==2)continue}}if(h===1){ti(e,0),Mr(e,n,0,!0);break}e:{switch(o=e,p=h,p){case 0:case 1:throw Error(i(345));case 4:if((n&4194048)!==n)break;case 6:Mr(o,n,Xn,!Ar);break e;case 2:_n=null;break;case 3:case 5:break;default:throw Error(i(329))}if((n&62914560)===n&&(h=Do+300-gt(),10<h)){if(Mr(o,n,Xn,!Ar),fn(o,0,!0)!==0)break e;rr=n,o.timeoutHandle=zp(tp.bind(null,o,a,_n,Mo,dd,n,Xn,ma,Pa,Ar,p,"Throttled",-0,0),h);break e}tp(o,a,_n,Mo,dd,n,Xn,ma,Pa,Ar,p,null,-0,0)}}break}while(!0);Dl(e)}function tp(e,n,a,o,h,p,w,N,U,P,ie,ce,ee,le){if(e.timeoutHandle=-1,ce=n.subtreeFlags,ce&8192||(ce&16785408)===16785408){ce={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:hl},Gx(n,p,ce);var Re=(p&62914560)===p?Do-gt():(p&4194048)===p?Zx-gt():0;if(Re=A2(ce,Re),Re!==null){rr=p,e.cancelPendingCommit=Re(cp.bind(null,e,n,p,a,o,h,w,N,U,ie,ce,null,ee,le)),Mr(e,p,w,!P);return}}cp(e,n,p,a,o,h,w,N,U)}function qb(e){for(var n=e;;){var a=n.tag;if((a===0||a===11||a===15)&&n.flags&16384&&(a=n.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var o=0;o<a.length;o++){var h=a[o],p=h.getSnapshot;h=h.value;try{if(!Hn(p(),h))return!1}catch{return!1}}if(a=n.child,n.subtreeFlags&16384&&a!==null)a.return=n,n=a;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Mr(e,n,a,o){n&=~ud,n&=~ma,e.suspendedLanes|=n,e.pingedLanes&=~n,o&&(e.warmLanes|=n),o=e.expirationTimes;for(var h=n;0<h;){var p=31-Pe(h),w=1<<p;o[p]=-1,h&=~w}a!==0&&Ys(e,a,n)}function Fo(){return(kt&6)===0?(rs(0),!1):!0}function xd(){if(st!==null){if(St===0)var e=st.return;else e=st,Gl=aa=null,zu(e),Xa=null,Hi=0,e=st;for(;e!==null;)Mx(e.alternate,e),e=e.return;st=null}}function ti(e,n){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,u2(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),rr=0,xd(),zt=e,st=a=Xl(e.current,null),ut=n,St=0,qn=null,Ar=!1,Ja=Wt(e,n),cd=!1,Pa=Xn=ud=ma=Tr=Vt=0,_n=ns=null,dd=!1,(n&8)!==0&&(n|=n&32);var o=e.entangledLanes;if(o!==0)for(e=e.entanglements,o&=n;0<o;){var h=31-Pe(o),p=1<<h;n|=e[h],o&=~p}return lr=n,Ps(),a}function np(e,n){et=null,L.H=Ki,n===qa||n===so?(n=gm(),St=3):n===bu?(n=gm(),St=4):St=n===Gu?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,qn=n,st===null&&(Vt=1,ko(e,el(n,e.current)))}function lp(){var e=In.current;return e===null?!0:(ut&4194048)===ut?rl===null:(ut&62914560)===ut||(ut&536870912)!==0?e===rl:!1}function rp(){var e=L.H;return L.H=Ki,e===null?Ki:e}function ap(){var e=L.A;return L.A=Ib,e}function Ro(){Vt=4,Ar||(ut&4194048)!==ut&&In.current!==null||(Ja=!0),(Tr&134217727)===0&&(ma&134217727)===0||zt===null||Mr(zt,ut,Xn,!1)}function pd(e,n,a){var o=kt;kt|=2;var h=rp(),p=ap();(zt!==e||ut!==n)&&(Mo=null,ti(e,n)),n=!1;var w=Vt;e:do try{if(St!==0&&st!==null){var N=st,U=qn;switch(St){case 8:xd(),w=6;break e;case 3:case 2:case 9:case 6:In.current===null&&(n=!0);var P=St;if(St=0,qn=null,ni(e,N,U,P),a&&Ja){w=0;break e}break;default:P=St,St=0,qn=null,ni(e,N,U,P)}}Xb(),w=Vt;break}catch(ie){np(e,ie)}while(!0);return n&&e.shellSuspendCounter++,Gl=aa=null,kt=o,L.H=h,L.A=p,st===null&&(zt=null,ut=0,Ps()),w}function Xb(){for(;st!==null;)ip(st)}function Vb(e,n){var a=kt;kt|=2;var o=rp(),h=ap();zt!==e||ut!==n?(Mo=null,zo=gt()+500,ti(e,n)):Ja=Wt(e,n);e:do try{if(St!==0&&st!==null){n=st;var p=qn;t:switch(St){case 1:St=0,qn=null,ni(e,n,p,1);break;case 2:case 9:if(pm(p)){St=0,qn=null,sp(n);break}n=function(){St!==2&&St!==9||zt!==e||(St=7),Dl(e)},p.then(n,n);break e;case 3:St=7;break e;case 4:St=5;break e;case 7:pm(p)?(St=0,qn=null,sp(n)):(St=0,qn=null,ni(e,n,p,7));break;case 5:var w=null;switch(st.tag){case 26:w=st.memoizedState;case 5:case 27:var N=st;if(w?Vp(w):N.stateNode.complete){St=0,qn=null;var U=N.sibling;if(U!==null)st=U;else{var P=N.return;P!==null?(st=P,_o(P)):st=null}break t}}St=0,qn=null,ni(e,n,p,5);break;case 6:St=0,qn=null,ni(e,n,p,6);break;case 8:xd(),Vt=6;break e;default:throw Error(i(462))}}Gb();break}catch(ie){np(e,ie)}while(!0);return Gl=aa=null,L.H=o,L.A=h,kt=a,st!==null?0:(zt=null,ut=0,Ps(),Vt)}function Gb(){for(;st!==null&&!Et();)ip(st)}function ip(e){var n=Dx(e.alternate,e,lr);e.memoizedProps=e.pendingProps,n===null?_o(e):st=n}function sp(e){var n=e,a=n.alternate;switch(n.tag){case 15:case 0:n=Sx(a,n,n.pendingProps,n.type,void 0,ut);break;case 11:n=Sx(a,n,n.pendingProps,n.type.render,n.ref,ut);break;case 5:zu(n);default:Mx(a,n),n=st=am(n,lr),n=Dx(a,n,lr)}e.memoizedProps=e.pendingProps,n===null?_o(e):st=n}function ni(e,n,a,o){Gl=aa=null,zu(n),Xa=null,Hi=0;var h=n.return;try{if(_b(e,h,n,a,ut)){Vt=1,ko(e,el(a,e.current)),st=null;return}}catch(p){if(h!==null)throw st=h,p;Vt=1,ko(e,el(a,e.current)),st=null;return}n.flags&32768?(xt||o===1?e=!0:Ja||(ut&536870912)!==0?e=!1:(Ar=e=!0,(o===2||o===9||o===3||o===6)&&(o=In.current,o!==null&&o.tag===13&&(o.flags|=16384))),op(n,e)):_o(n)}function _o(e){var n=e;do{if((n.flags&32768)!==0){op(n,Ar);return}e=n.return;var a=Lb(n.alternate,n,lr);if(a!==null){st=a;return}if(n=n.sibling,n!==null){st=n;return}st=n=e}while(n!==null);Vt===0&&(Vt=5)}function op(e,n){do{var a=$b(e.alternate,e);if(a!==null){a.flags&=32767,st=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(e=e.sibling,e!==null)){st=e;return}st=e=a}while(e!==null);Vt=6,st=null}function cp(e,n,a,o,h,p,w,N,U){e.cancelPendingCommit=null;do Oo();while(an!==0);if((kt&6)!==0)throw Error(i(327));if(n!==null){if(n===e.current)throw Error(i(177));if(p=n.lanes|n.childLanes,p|=ru,Wn(e,a,p,w,N,U),e===zt&&(st=zt=null,ut=0),ei=n,zr=e,rr=a,fd=p,hd=h,Jx=o,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Zb(Te,function(){return mp(),null})):(e.callbackNode=null,e.callbackPriority=0),o=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||o){o=L.T,L.T=null,h=Z.p,Z.p=2,w=kt,kt|=4;try{Hb(e,n,a)}finally{kt=w,Z.p=h,L.T=o}}an=1,up(),dp(),fp()}}function up(){if(an===1){an=0;var e=zr,n=ei,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=L.T,L.T=null;var o=Z.p;Z.p=2;var h=kt;kt|=4;try{qx(n,e);var p=Ad,w=Wh(e.containerInfo),N=p.focusedElem,U=p.selectionRange;if(w!==N&&N&&N.ownerDocument&&Qh(N.ownerDocument.documentElement,N)){if(U!==null&&Pc(N)){var P=U.start,ie=U.end;if(ie===void 0&&(ie=P),"selectionStart"in N)N.selectionStart=P,N.selectionEnd=Math.min(ie,N.value.length);else{var ce=N.ownerDocument||document,ee=ce&&ce.defaultView||window;if(ee.getSelection){var le=ee.getSelection(),Re=N.textContent.length,Ve=Math.min(U.start,Re),Tt=U.end===void 0?Ve:Math.min(U.end,Re);!le.extend&&Ve>Tt&&(w=Tt,Tt=Ve,Ve=w);var Q=Kh(N,Ve),X=Kh(N,Tt);if(Q&&X&&(le.rangeCount!==1||le.anchorNode!==Q.node||le.anchorOffset!==Q.offset||le.focusNode!==X.node||le.focusOffset!==X.offset)){var J=ce.createRange();J.setStart(Q.node,Q.offset),le.removeAllRanges(),Ve>Tt?(le.addRange(J),le.extend(X.node,X.offset)):(J.setEnd(X.node,X.offset),le.addRange(J))}}}}for(ce=[],le=N;le=le.parentNode;)le.nodeType===1&&ce.push({element:le,left:le.scrollLeft,top:le.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<ce.length;N++){var oe=ce[N];oe.element.scrollLeft=oe.left,oe.element.scrollTop=oe.top}}Ko=!!Nd,Ad=Nd=null}finally{kt=h,Z.p=o,L.T=a}}e.current=n,an=2}}function dp(){if(an===2){an=0;var e=zr,n=ei,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=L.T,L.T=null;var o=Z.p;Z.p=2;var h=kt;kt|=4;try{$x(e,n.alternate,n)}finally{kt=h,Z.p=o,L.T=a}}an=3}}function fp(){if(an===4||an===3){an=0,Ht();var e=zr,n=ei,a=rr,o=Jx;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?an=5:(an=0,ei=zr=null,hp(e,e.pendingLanes));var h=e.pendingLanes;if(h===0&&(Dr=null),wl(a),n=n.stateNode,Xe&&typeof Xe.onCommitFiberRoot=="function")try{Xe.onCommitFiberRoot(He,n,void 0,(n.current.flags&128)===128)}catch{}if(o!==null){n=L.T,h=Z.p,Z.p=2,L.T=null;try{for(var p=e.onRecoverableError,w=0;w<o.length;w++){var N=o[w];p(N.value,{componentStack:N.stack})}}finally{L.T=n,Z.p=h}}(rr&3)!==0&&Oo(),Dl(e),h=e.pendingLanes,(a&261930)!==0&&(h&42)!==0?e===md?ls++:(ls=0,md=e):ls=0,rs(0)}}function hp(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,Li(n)))}function Oo(){return up(),dp(),fp(),mp()}function mp(){if(an!==5)return!1;var e=zr,n=fd;fd=0;var a=wl(rr),o=L.T,h=Z.p;try{Z.p=32>a?32:a,L.T=null,a=hd,hd=null;var p=zr,w=rr;if(an=0,ei=zr=null,rr=0,(kt&6)!==0)throw Error(i(331));var N=kt;if(kt|=4,Qx(p.current),Vx(p,p.current,w,a),kt=N,rs(0,!1),Xe&&typeof Xe.onPostCommitFiberRoot=="function")try{Xe.onPostCommitFiberRoot(He,p)}catch{}return!0}finally{Z.p=h,L.T=o,hp(e,n)}}function xp(e,n,a){n=el(a,n),n=Vu(e.stateNode,n,2),e=Sr(e,n,2),e!==null&&(cl(e,2),Dl(e))}function Ct(e,n,a){if(e.tag===3)xp(e,e,a);else for(;n!==null;){if(n.tag===3){xp(n,e,a);break}else if(n.tag===1){var o=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(Dr===null||!Dr.has(o))){e=el(a,e),a=px(2),o=Sr(n,a,2),o!==null&&(yx(a,o,n,e),cl(o,2),Dl(o));break}}n=n.return}}function yd(e,n,a){var o=e.pingCache;if(o===null){o=e.pingCache=new Yb;var h=new Set;o.set(n,h)}else h=o.get(n),h===void 0&&(h=new Set,o.set(n,h));h.has(a)||(cd=!0,h.add(a),e=Kb.bind(null,e,n,a),n.then(e,e))}function Kb(e,n,a){var o=e.pingCache;o!==null&&o.delete(n),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,zt===e&&(ut&a)===a&&(Vt===4||Vt===3&&(ut&62914560)===ut&&300>gt()-Do?(kt&2)===0&&ti(e,0):ud|=a,Pa===ut&&(Pa=0)),Dl(e)}function pp(e,n){n===0&&(n=Zt()),e=na(e,n),e!==null&&(cl(e,n),Dl(e))}function Qb(e){var n=e.memoizedState,a=0;n!==null&&(a=n.retryLane),pp(e,a)}function Wb(e,n){var a=0;switch(e.tag){case 31:case 13:var o=e.stateNode,h=e.memoizedState;h!==null&&(a=h.retryLane);break;case 19:o=e.stateNode;break;case 22:o=e.stateNode._retryCache;break;default:throw Error(i(314))}o!==null&&o.delete(n),pp(e,a)}function Zb(e,n){return _e(e,n)}var Bo=null,li=null,gd=!1,Lo=!1,bd=!1,Fr=0;function Dl(e){e!==li&&e.next===null&&(li===null?Bo=li=e:li=li.next=e),Lo=!0,gd||(gd=!0,Pb())}function rs(e,n){if(!bd&&Lo){bd=!0;do for(var a=!1,o=Bo;o!==null;){if(e!==0){var h=o.pendingLanes;if(h===0)var p=0;else{var w=o.suspendedLanes,N=o.pingedLanes;p=(1<<31-Pe(42|e)+1)-1,p&=h&~(w&~N),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(a=!0,vp(o,p))}else p=ut,p=fn(o,o===zt?p:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(p&3)===0||Wt(o,p)||(a=!0,vp(o,p));o=o.next}while(a);bd=!1}}function Jb(){yp()}function yp(){Lo=gd=!1;var e=0;Fr!==0&&c2()&&(e=Fr);for(var n=gt(),a=null,o=Bo;o!==null;){var h=o.next,p=gp(o,n);p===0?(o.next=null,a===null?Bo=h:a.next=h,h===null&&(li=a)):(a=o,(e!==0||(p&3)!==0)&&(Lo=!0)),o=h}an!==0&&an!==5||rs(e),Fr!==0&&(Fr=0)}function gp(e,n){for(var a=e.suspendedLanes,o=e.pingedLanes,h=e.expirationTimes,p=e.pendingLanes&-62914561;0<p;){var w=31-Pe(p),N=1<<w,U=h[w];U===-1?((N&a)===0||(N&o)!==0)&&(h[w]=ve(N,n)):U<=n&&(e.expiredLanes|=N),p&=~N}if(n=zt,a=ut,a=fn(e,e===n?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o=e.callbackNode,a===0||e===n&&(St===2||St===9)||e.cancelPendingCommit!==null)return o!==null&&o!==null&&Ke(o),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||Wt(e,a)){if(n=a&-a,n===e.callbackPriority)return n;switch(o!==null&&Ke(o),wl(a)){case 2:case 8:a=pe;break;case 32:a=Te;break;case 268435456:a=xe;break;default:a=Te}return o=bp.bind(null,e),a=_e(a,o),e.callbackPriority=n,e.callbackNode=a,n}return o!==null&&o!==null&&Ke(o),e.callbackPriority=2,e.callbackNode=null,2}function bp(e,n){if(an!==0&&an!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Oo()&&e.callbackNode!==a)return null;var o=ut;return o=fn(e,e===zt?o:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o===0?null:(ep(e,o,n),gp(e,gt()),e.callbackNode!=null&&e.callbackNode===a?bp.bind(null,e):null)}function vp(e,n){if(Oo())return null;ep(e,n,!0)}function Pb(){d2(function(){(kt&6)!==0?_e(re,Jb):yp()})}function vd(){if(Fr===0){var e=Ia;e===0&&(e=ur,ur<<=1,(ur&261888)===0&&(ur=256)),Fr=e}return Fr}function wp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Jr(""+e)}function kp(e,n){var a=n.ownerDocument.createElement("input");return a.name=n.name,a.value=n.value,e.id&&a.setAttribute("form",e.id),n.parentNode.insertBefore(a,n),e=new FormData(e),a.parentNode.removeChild(a),e}function e2(e,n,a,o,h){if(n==="submit"&&a&&a.stateNode===h){var p=wp((h[hn]||null).action),w=o.submitter;w&&(n=(n=w[hn]||null)?wp(n.formAction):w.getAttribute("formAction"),n!==null&&(p=n,w=null));var N=new Qs("action","action",null,o,h);e.push({event:N,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(Fr!==0){var U=w?kp(h,w):new FormData(h);Hu(a,{pending:!0,data:U,method:h.method,action:p},null,U)}}else typeof p=="function"&&(N.preventDefault(),U=w?kp(h,w):new FormData(h),Hu(a,{pending:!0,data:U,method:h.method,action:p},p,U))},currentTarget:h}]})}}for(var wd=0;wd<lu.length;wd++){var kd=lu[wd],t2=kd.toLowerCase(),n2=kd[0].toUpperCase()+kd.slice(1);ml(t2,"on"+n2)}ml(Ph,"onAnimationEnd"),ml(em,"onAnimationIteration"),ml(tm,"onAnimationStart"),ml("dblclick","onDoubleClick"),ml("focusin","onFocus"),ml("focusout","onBlur"),ml(gb,"onTransitionRun"),ml(bb,"onTransitionStart"),ml(vb,"onTransitionCancel"),ml(nm,"onTransitionEnd"),ul("onMouseEnter",["mouseout","mouseover"]),ul("onMouseLeave",["mouseout","mouseover"]),ul("onPointerEnter",["pointerout","pointerover"]),ul("onPointerLeave",["pointerout","pointerover"]),Yt("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Yt("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Yt("onBeforeInput",["compositionend","keypress","textInput","paste"]),Yt("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Yt("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Yt("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var as="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(" "),l2=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(as));function jp(e,n){n=(n&4)!==0;for(var a=0;a<e.length;a++){var o=e[a],h=o.event;o=o.listeners;e:{var p=void 0;if(n)for(var w=o.length-1;0<=w;w--){var N=o[w],U=N.instance,P=N.currentTarget;if(N=N.listener,U!==p&&h.isPropagationStopped())break e;p=N,h.currentTarget=P;try{p(h)}catch(ie){Js(ie)}h.currentTarget=null,p=U}else for(w=0;w<o.length;w++){if(N=o[w],U=N.instance,P=N.currentTarget,N=N.listener,U!==p&&h.isPropagationStopped())break e;p=N,h.currentTarget=P;try{p(h)}catch(ie){Js(ie)}h.currentTarget=null,p=U}}}}function ot(e,n){var a=n[Ea];a===void 0&&(a=n[Ea]=new Set);var o=e+"__bubble";a.has(o)||(Sp(n,e,2,!1),a.add(o))}function jd(e,n,a){var o=0;n&&(o|=4),Sp(a,e,o,n)}var $o="_reactListening"+Math.random().toString(36).slice(2);function Sd(e){if(!e[$o]){e[$o]=!0,Xs.forEach(function(a){a!=="selectionchange"&&(l2.has(a)||jd(a,!1,e),jd(a,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[$o]||(n[$o]=!0,jd("selectionchange",!1,n))}}function Sp(e,n,a,o){switch(Pp(n)){case 2:var h=z2;break;case 8:h=M2;break;default:h=$d}a=h.bind(null,n,a,e),h=void 0,!ye||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(h=!0),o?h!==void 0?e.addEventListener(n,a,{capture:!0,passive:h}):e.addEventListener(n,a,!0):h!==void 0?e.addEventListener(n,a,{passive:h}):e.addEventListener(n,a,!1)}function Cd(e,n,a,o,h){var p=o;if((n&1)===0&&(n&2)===0&&o!==null)e:for(;;){if(o===null)return;var w=o.tag;if(w===3||w===4){var N=o.stateNode.containerInfo;if(N===h)break;if(w===4)for(w=o.return;w!==null;){var U=w.tag;if((U===3||U===4)&&w.stateNode.containerInfo===h)return;w=w.return}for(;N!==null;){if(w=hr(N),w===null)return;if(U=w.tag,U===5||U===6||U===26||U===27){o=p=w;continue e}N=N.parentNode}}o=o.return}O(function(){var P=p,ie=Pt(a),ce=[];e:{var ee=lm.get(e);if(ee!==void 0){var le=Qs,Re=e;switch(e){case"keypress":if(Ze(a)===0)break e;case"keydown":case"keyup":le=Wg;break;case"focusin":Re="focus",le=Kc;break;case"focusout":Re="blur",le=Kc;break;case"beforeblur":case"afterblur":le=Kc;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":le=Mh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":le=Lg;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":le=Pg;break;case Ph:case em:case tm:le=Ug;break;case nm:le=tb;break;case"scroll":case"scrollend":le=Og;break;case"wheel":le=lb;break;case"copy":case"cut":case"paste":le=Yg;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":le=Rh;break;case"toggle":case"beforetoggle":le=ab}var Ve=(n&4)!==0,Tt=!Ve&&(e==="scroll"||e==="scrollend"),Q=Ve?ee!==null?ee+"Capture":null:ee;Ve=[];for(var X=P,J;X!==null;){var oe=X;if(J=oe.stateNode,oe=oe.tag,oe!==5&&oe!==26&&oe!==27||J===null||Q===null||(oe=ae(X,Q),oe!=null&&Ve.push(is(X,oe,J))),Tt)break;X=X.return}0<Ve.length&&(ee=new le(ee,Re,null,a,ie),ce.push({event:ee,listeners:Ve}))}}if((n&7)===0){e:{if(ee=e==="mouseover"||e==="pointerover",le=e==="mouseout"||e==="pointerout",ee&&a!==Ni&&(Re=a.relatedTarget||a.fromElement)&&(hr(Re)||Re[kl]))break e;if((le||ee)&&(ee=ie.window===ie?ie:(ee=ie.ownerDocument)?ee.defaultView||ee.parentWindow:window,le?(Re=a.relatedTarget||a.toElement,le=P,Re=Re?hr(Re):null,Re!==null&&(Tt=u(Re),Ve=Re.tag,Re!==Tt||Ve!==5&&Ve!==27&&Ve!==6)&&(Re=null)):(le=null,Re=P),le!==Re)){if(Ve=Mh,oe="onMouseLeave",Q="onMouseEnter",X="mouse",(e==="pointerout"||e==="pointerover")&&(Ve=Rh,oe="onPointerLeave",Q="onPointerEnter",X="pointer"),Tt=le==null?ee:gn(le),J=Re==null?ee:gn(Re),ee=new Ve(oe,X+"leave",le,a,ie),ee.target=Tt,ee.relatedTarget=J,oe=null,hr(ie)===P&&(Ve=new Ve(Q,X+"enter",Re,a,ie),Ve.target=J,Ve.relatedTarget=Tt,oe=Ve),Tt=oe,le&&Re)t:{for(Ve=r2,Q=le,X=Re,J=0,oe=Q;oe;oe=Ve(oe))J++;oe=0;for(var Ue=X;Ue;Ue=Ve(Ue))oe++;for(;0<J-oe;)Q=Ve(Q),J--;for(;0<oe-J;)X=Ve(X),oe--;for(;J--;){if(Q===X||X!==null&&Q===X.alternate){Ve=Q;break t}Q=Ve(Q),X=Ve(X)}Ve=null}else Ve=null;le!==null&&Cp(ce,ee,le,Ve,!1),Re!==null&&Tt!==null&&Cp(ce,Tt,Re,Ve,!0)}}e:{if(ee=P?gn(P):window,le=ee.nodeName&&ee.nodeName.toLowerCase(),le==="select"||le==="input"&&ee.type==="file")var bt=Ih;else if(Hh(ee))if(Yh)bt=xb;else{bt=hb;var Oe=fb}else le=ee.nodeName,!le||le.toLowerCase()!=="input"||ee.type!=="checkbox"&&ee.type!=="radio"?P&&Ei(P.elementType)&&(bt=Ih):bt=mb;if(bt&&(bt=bt(e,P))){Uh(ce,bt,a,ie);break e}Oe&&Oe(e,ee,P),e==="focusout"&&P&&ee.type==="number"&&P.memoizedProps.value!=null&&Ci(ee,"number",ee.value)}switch(Oe=P?gn(P):window,e){case"focusin":(Hh(Oe)||Oe.contentEditable==="true")&&(Ra=Oe,eu=P,_i=null);break;case"focusout":_i=eu=Ra=null;break;case"mousedown":tu=!0;break;case"contextmenu":case"mouseup":case"dragend":tu=!1,Zh(ce,a,ie);break;case"selectionchange":if(yb)break;case"keydown":case"keyup":Zh(ce,a,ie)}var lt;if(Wc)e:{switch(e){case"compositionstart":var dt="onCompositionStart";break e;case"compositionend":dt="onCompositionEnd";break e;case"compositionupdate":dt="onCompositionUpdate";break e}dt=void 0}else Fa?Lh(e,a)&&(dt="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(dt="onCompositionStart");dt&&(_h&&a.locale!=="ko"&&(Fa||dt!=="onCompositionStart"?dt==="onCompositionEnd"&&Fa&&(lt=mt()):(Me=ie,Ie="value"in Me?Me.value:Me.textContent,Fa=!0)),Oe=Ho(P,dt),0<Oe.length&&(dt=new Fh(dt,e,null,a,ie),ce.push({event:dt,listeners:Oe}),lt?dt.data=lt:(lt=$h(a),lt!==null&&(dt.data=lt)))),(lt=sb?ob(e,a):cb(e,a))&&(dt=Ho(P,"onBeforeInput"),0<dt.length&&(Oe=new Fh("onBeforeInput","beforeinput",null,a,ie),ce.push({event:Oe,listeners:dt}),Oe.data=lt)),e2(ce,e,P,a,ie)}jp(ce,n)})}function is(e,n,a){return{instance:e,listener:n,currentTarget:a}}function Ho(e,n){for(var a=n+"Capture",o=[];e!==null;){var h=e,p=h.stateNode;if(h=h.tag,h!==5&&h!==26&&h!==27||p===null||(h=ae(e,a),h!=null&&o.unshift(is(e,h,p)),h=ae(e,n),h!=null&&o.push(is(e,h,p))),e.tag===3)return o;e=e.return}return[]}function r2(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Cp(e,n,a,o,h){for(var p=n._reactName,w=[];a!==null&&a!==o;){var N=a,U=N.alternate,P=N.stateNode;if(N=N.tag,U!==null&&U===o)break;N!==5&&N!==26&&N!==27||P===null||(U=P,h?(P=ae(a,p),P!=null&&w.unshift(is(a,P,U))):h||(P=ae(a,p),P!=null&&w.push(is(a,P,U)))),a=a.return}w.length!==0&&e.push({event:n,listeners:w})}var a2=/\r\n?/g,i2=/\u0000|\uFFFD/g;function Ep(e){return(typeof e=="string"?e:""+e).replace(a2,`
|
|
49
|
+
`).replace(i2,"")}function Np(e,n){return n=Ep(n),Ep(e)===n}function At(e,n,a,o,h,p){switch(a){case"children":typeof o=="string"?n==="body"||n==="textarea"&&o===""||yr(e,o):(typeof o=="number"||typeof o=="bigint")&&n!=="body"&&yr(e,""+o);break;case"className":Cl(e,"class",o);break;case"tabIndex":Cl(e,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":Cl(e,a,o);break;case"style":za(e,o,p);break;case"data":if(n!=="object"){Cl(e,"data",o);break}case"src":case"href":if(o===""&&(n!=="a"||a!=="href")){e.removeAttribute(a);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(a);break}o=Jr(""+o),e.setAttribute(a,o);break;case"action":case"formAction":if(typeof o=="function"){e.setAttribute(a,"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 p=="function"&&(a==="formAction"?(n!=="input"&&At(e,n,"name",h.name,h,null),At(e,n,"formEncType",h.formEncType,h,null),At(e,n,"formMethod",h.formMethod,h,null),At(e,n,"formTarget",h.formTarget,h,null)):(At(e,n,"encType",h.encType,h,null),At(e,n,"method",h.method,h,null),At(e,n,"target",h.target,h,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(a);break}o=Jr(""+o),e.setAttribute(a,o);break;case"onClick":o!=null&&(e.onclick=hl);break;case"onScroll":o!=null&&ot("scroll",e);break;case"onScrollEnd":o!=null&&ot("scrollend",e);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(i(61));if(a=o.__html,a!=null){if(h.children!=null)throw Error(i(60));e.innerHTML=a}}break;case"multiple":e.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":e.muted=o&&typeof o!="function"&&typeof o!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(o==null||typeof o=="function"||typeof o=="boolean"||typeof o=="symbol"){e.removeAttribute("xlink:href");break}a=Jr(""+o),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(a,""+o):e.removeAttribute(a);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":o&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":o===!0?e.setAttribute(a,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(a,o):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?e.setAttribute(a,o):e.removeAttribute(a);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?e.removeAttribute(a):e.setAttribute(a,o);break;case"popover":ot("beforetoggle",e),ot("toggle",e),Sl(e,"popover",o);break;case"xlinkActuate":dl(e,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":dl(e,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":dl(e,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":dl(e,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":dl(e,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":dl(e,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":dl(e,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":dl(e,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":dl(e,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":Sl(e,"is",o);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=Xc.get(a)||a,Sl(e,a,o))}}function Ed(e,n,a,o,h,p){switch(a){case"style":za(e,o,p);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(i(61));if(a=o.__html,a!=null){if(h.children!=null)throw Error(i(60));e.innerHTML=a}}break;case"children":typeof o=="string"?yr(e,o):(typeof o=="number"||typeof o=="bigint")&&yr(e,""+o);break;case"onScroll":o!=null&&ot("scroll",e);break;case"onScrollEnd":o!=null&&ot("scrollend",e);break;case"onClick":o!=null&&(e.onclick=hl);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Yl.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(h=a.endsWith("Capture"),n=a.slice(2,h?a.length-7:void 0),p=e[hn]||null,p=p!=null?p[a]:null,typeof p=="function"&&e.removeEventListener(n,p,h),typeof o=="function")){typeof p!="function"&&p!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(n,o,h);break e}a in e?e[a]=o:o===!0?e.setAttribute(a,""):Sl(e,a,o)}}}function yn(e,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ot("error",e),ot("load",e);var o=!1,h=!1,p;for(p in a)if(a.hasOwnProperty(p)){var w=a[p];if(w!=null)switch(p){case"src":o=!0;break;case"srcSet":h=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:At(e,n,p,w,a,null)}}h&&At(e,n,"srcSet",a.srcSet,a,null),o&&At(e,n,"src",a.src,a,null);return;case"input":ot("invalid",e);var N=p=w=h=null,U=null,P=null;for(o in a)if(a.hasOwnProperty(o)){var ie=a[o];if(ie!=null)switch(o){case"name":h=ie;break;case"type":w=ie;break;case"checked":U=ie;break;case"defaultChecked":P=ie;break;case"value":p=ie;break;case"defaultValue":N=ie;break;case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(i(137,n));break;default:At(e,n,o,ie,a,null)}}Vs(e,p,N,U,P,w,h,!1);return;case"select":ot("invalid",e),o=w=p=null;for(h in a)if(a.hasOwnProperty(h)&&(N=a[h],N!=null))switch(h){case"value":p=N;break;case"defaultValue":w=N;break;case"multiple":o=N;default:At(e,n,h,N,a,null)}n=p,a=w,e.multiple=!!o,n!=null?pr(e,!!o,n,!1):a!=null&&pr(e,!!o,a,!0);return;case"textarea":ot("invalid",e),p=h=o=null;for(w in a)if(a.hasOwnProperty(w)&&(N=a[w],N!=null))switch(w){case"value":o=N;break;case"defaultValue":h=N;break;case"children":p=N;break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(i(91));break;default:At(e,n,w,N,a,null)}Ks(e,o,h,p);return;case"option":for(U in a)if(a.hasOwnProperty(U)&&(o=a[U],o!=null))switch(U){case"selected":e.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:At(e,n,U,o,a,null)}return;case"dialog":ot("beforetoggle",e),ot("toggle",e),ot("cancel",e),ot("close",e);break;case"iframe":case"object":ot("load",e);break;case"video":case"audio":for(o=0;o<as.length;o++)ot(as[o],e);break;case"image":ot("error",e),ot("load",e);break;case"details":ot("toggle",e);break;case"embed":case"source":case"link":ot("error",e),ot("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(P in a)if(a.hasOwnProperty(P)&&(o=a[P],o!=null))switch(P){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:At(e,n,P,o,a,null)}return;default:if(Ei(n)){for(ie in a)a.hasOwnProperty(ie)&&(o=a[ie],o!==void 0&&Ed(e,n,ie,o,a,void 0));return}}for(N in a)a.hasOwnProperty(N)&&(o=a[N],o!=null&&At(e,n,N,o,a,null))}function s2(e,n,a,o){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var h=null,p=null,w=null,N=null,U=null,P=null,ie=null;for(le in a){var ce=a[le];if(a.hasOwnProperty(le)&&ce!=null)switch(le){case"checked":break;case"value":break;case"defaultValue":U=ce;default:o.hasOwnProperty(le)||At(e,n,le,null,o,ce)}}for(var ee in o){var le=o[ee];if(ce=a[ee],o.hasOwnProperty(ee)&&(le!=null||ce!=null))switch(ee){case"type":p=le;break;case"name":h=le;break;case"checked":P=le;break;case"defaultChecked":ie=le;break;case"value":w=le;break;case"defaultValue":N=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(i(137,n));break;default:le!==ce&&At(e,n,ee,le,o,ce)}}Da(e,w,N,U,P,ie,p,h);return;case"select":le=w=N=ee=null;for(p in a)if(U=a[p],a.hasOwnProperty(p)&&U!=null)switch(p){case"value":break;case"multiple":le=U;default:o.hasOwnProperty(p)||At(e,n,p,null,o,U)}for(h in o)if(p=o[h],U=a[h],o.hasOwnProperty(h)&&(p!=null||U!=null))switch(h){case"value":ee=p;break;case"defaultValue":N=p;break;case"multiple":w=p;default:p!==U&&At(e,n,h,p,o,U)}n=N,a=w,o=le,ee!=null?pr(e,!!a,ee,!1):!!o!=!!a&&(n!=null?pr(e,!!a,n,!0):pr(e,!!a,a?[]:"",!1));return;case"textarea":le=ee=null;for(N in a)if(h=a[N],a.hasOwnProperty(N)&&h!=null&&!o.hasOwnProperty(N))switch(N){case"value":break;case"children":break;default:At(e,n,N,null,o,h)}for(w in o)if(h=o[w],p=a[w],o.hasOwnProperty(w)&&(h!=null||p!=null))switch(w){case"value":ee=h;break;case"defaultValue":le=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(i(91));break;default:h!==p&&At(e,n,w,h,o,p)}Gs(e,ee,le);return;case"option":for(var Re in a)if(ee=a[Re],a.hasOwnProperty(Re)&&ee!=null&&!o.hasOwnProperty(Re))switch(Re){case"selected":e.selected=!1;break;default:At(e,n,Re,null,o,ee)}for(U in o)if(ee=o[U],le=a[U],o.hasOwnProperty(U)&&ee!==le&&(ee!=null||le!=null))switch(U){case"selected":e.selected=ee&&typeof ee!="function"&&typeof ee!="symbol";break;default:At(e,n,U,ee,o,le)}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 Ve in a)ee=a[Ve],a.hasOwnProperty(Ve)&&ee!=null&&!o.hasOwnProperty(Ve)&&At(e,n,Ve,null,o,ee);for(P in o)if(ee=o[P],le=a[P],o.hasOwnProperty(P)&&ee!==le&&(ee!=null||le!=null))switch(P){case"children":case"dangerouslySetInnerHTML":if(ee!=null)throw Error(i(137,n));break;default:At(e,n,P,ee,o,le)}return;default:if(Ei(n)){for(var Tt in a)ee=a[Tt],a.hasOwnProperty(Tt)&&ee!==void 0&&!o.hasOwnProperty(Tt)&&Ed(e,n,Tt,void 0,o,ee);for(ie in o)ee=o[ie],le=a[ie],!o.hasOwnProperty(ie)||ee===le||ee===void 0&&le===void 0||Ed(e,n,ie,ee,o,le);return}}for(var Q in a)ee=a[Q],a.hasOwnProperty(Q)&&ee!=null&&!o.hasOwnProperty(Q)&&At(e,n,Q,null,o,ee);for(ce in o)ee=o[ce],le=a[ce],!o.hasOwnProperty(ce)||ee===le||ee==null&&le==null||At(e,n,ce,ee,o,le)}function Ap(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function o2(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,a=performance.getEntriesByType("resource"),o=0;o<a.length;o++){var h=a[o],p=h.transferSize,w=h.initiatorType,N=h.duration;if(p&&N&&Ap(w)){for(w=0,N=h.responseEnd,o+=1;o<a.length;o++){var U=a[o],P=U.startTime;if(P>N)break;var ie=U.transferSize,ce=U.initiatorType;ie&&Ap(ce)&&(U=U.responseEnd,w+=ie*(U<N?1:(N-P)/(U-P)))}if(--o,n+=8*(p+w)/(h.duration/1e3),e++,10<e)break}}if(0<e)return n/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Nd=null,Ad=null;function Uo(e){return e.nodeType===9?e:e.ownerDocument}function Tp(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 Dp(e,n){if(e===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&n==="foreignObject"?0:e}function Td(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var Dd=null;function c2(){var e=window.event;return e&&e.type==="popstate"?e===Dd?!1:(Dd=e,!0):(Dd=null,!1)}var zp=typeof setTimeout=="function"?setTimeout:void 0,u2=typeof clearTimeout=="function"?clearTimeout:void 0,Mp=typeof Promise=="function"?Promise:void 0,d2=typeof queueMicrotask=="function"?queueMicrotask:typeof Mp<"u"?function(e){return Mp.resolve(null).then(e).catch(f2)}:zp;function f2(e){setTimeout(function(){throw e})}function Rr(e){return e==="head"}function Fp(e,n){var a=n,o=0;do{var h=a.nextSibling;if(e.removeChild(a),h&&h.nodeType===8)if(a=h.data,a==="/$"||a==="/&"){if(o===0){e.removeChild(h),si(n);return}o--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")o++;else if(a==="html")ss(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,ss(a);for(var p=a.firstChild;p;){var w=p.nextSibling,N=p.nodeName;p[fr]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&p.rel.toLowerCase()==="stylesheet"||a.removeChild(p),p=w}}else a==="body"&&ss(e.ownerDocument.body);a=h}while(a);si(n)}function Rp(e,n){var a=e;e=0;do{var o=a.nextSibling;if(a.nodeType===1?n?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(n?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),o&&o.nodeType===8)if(a=o.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=o}while(a)}function zd(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var a=n;switch(n=n.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":zd(a),Aa(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function h2(e,n,a,o){for(;e.nodeType===1;){var h=a;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!o&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(o){if(!e[fr])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(p=e.getAttribute("rel"),p==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(p!==h.rel||e.getAttribute("href")!==(h.href==null||h.href===""?null:h.href)||e.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin)||e.getAttribute("title")!==(h.title==null?null:h.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(p=e.getAttribute("src"),(p!==(h.src==null?null:h.src)||e.getAttribute("type")!==(h.type==null?null:h.type)||e.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin))&&p&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var p=h.name==null?null:""+h.name;if(h.type==="hidden"&&e.getAttribute("name")===p)return e}else return e;if(e=al(e.nextSibling),e===null)break}return null}function m2(e,n,a){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=al(e.nextSibling),e===null))return null;return e}function _p(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=al(e.nextSibling),e===null))return null;return e}function Md(e){return e.data==="$?"||e.data==="$~"}function Fd(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function x2(e,n){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||a.readyState!=="loading")n();else{var o=function(){n(),a.removeEventListener("DOMContentLoaded",o)};a.addEventListener("DOMContentLoaded",o),e._reactRetry=o}}function al(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return e}var Rd=null;function Op(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(n===0)return al(e.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}e=e.nextSibling}return null}function Bp(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(n===0)return e;n--}else a!=="/$"&&a!=="/&"||n++}e=e.previousSibling}return null}function Lp(e,n,a){switch(n=Uo(a),e){case"html":if(e=n.documentElement,!e)throw Error(i(452));return e;case"head":if(e=n.head,!e)throw Error(i(453));return e;case"body":if(e=n.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function ss(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);Aa(e)}var il=new Map,$p=new Set;function Io(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var ar=Z.d;Z.d={f:p2,r:y2,D:g2,C:b2,L:v2,m:w2,X:j2,S:k2,M:S2};function p2(){var e=ar.f(),n=Fo();return e||n}function y2(e){var n=jl(e);n!==null&&n.tag===5&&n.type==="form"?nx(n):ar.r(e)}var ri=typeof document>"u"?null:document;function Hp(e,n,a){var o=ri;if(o&&typeof n=="string"&&n){var h=Dn(n);h='link[rel="'+e+'"][href="'+h+'"]',typeof a=="string"&&(h+='[crossorigin="'+a+'"]'),$p.has(h)||($p.add(h),e={rel:e,crossOrigin:a,href:n},o.querySelector(h)===null&&(n=o.createElement("link"),yn(n,"link",e),Ut(n),o.head.appendChild(n)))}}function g2(e){ar.D(e),Hp("dns-prefetch",e,null)}function b2(e,n){ar.C(e,n),Hp("preconnect",e,n)}function v2(e,n,a){ar.L(e,n,a);var o=ri;if(o&&e&&n){var h='link[rel="preload"][as="'+Dn(n)+'"]';n==="image"&&a&&a.imageSrcSet?(h+='[imagesrcset="'+Dn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(h+='[imagesizes="'+Dn(a.imageSizes)+'"]')):h+='[href="'+Dn(e)+'"]';var p=h;switch(n){case"style":p=ai(e);break;case"script":p=ii(e)}il.has(p)||(e=y({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:e,as:n},a),il.set(p,e),o.querySelector(h)!==null||n==="style"&&o.querySelector(os(p))||n==="script"&&o.querySelector(cs(p))||(n=o.createElement("link"),yn(n,"link",e),Ut(n),o.head.appendChild(n)))}}function w2(e,n){ar.m(e,n);var a=ri;if(a&&e){var o=n&&typeof n.as=="string"?n.as:"script",h='link[rel="modulepreload"][as="'+Dn(o)+'"][href="'+Dn(e)+'"]',p=h;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=ii(e)}if(!il.has(p)&&(e=y({rel:"modulepreload",href:e},n),il.set(p,e),a.querySelector(h)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(cs(p)))return}o=a.createElement("link"),yn(o,"link",e),Ut(o),a.head.appendChild(o)}}}function k2(e,n,a){ar.S(e,n,a);var o=ri;if(o&&e){var h=Tn(o).hoistableStyles,p=ai(e);n=n||"default";var w=h.get(p);if(!w){var N={loading:0,preload:null};if(w=o.querySelector(os(p)))N.loading=5;else{e=y({rel:"stylesheet",href:e,"data-precedence":n},a),(a=il.get(p))&&_d(e,a);var U=w=o.createElement("link");Ut(U),yn(U,"link",e),U._p=new Promise(function(P,ie){U.onload=P,U.onerror=ie}),U.addEventListener("load",function(){N.loading|=1}),U.addEventListener("error",function(){N.loading|=2}),N.loading|=4,Yo(w,n,o)}w={type:"stylesheet",instance:w,count:1,state:N},h.set(p,w)}}}function j2(e,n){ar.X(e,n);var a=ri;if(a&&e){var o=Tn(a).hoistableScripts,h=ii(e),p=o.get(h);p||(p=a.querySelector(cs(h)),p||(e=y({src:e,async:!0},n),(n=il.get(h))&&Od(e,n),p=a.createElement("script"),Ut(p),yn(p,"link",e),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function S2(e,n){ar.M(e,n);var a=ri;if(a&&e){var o=Tn(a).hoistableScripts,h=ii(e),p=o.get(h);p||(p=a.querySelector(cs(h)),p||(e=y({src:e,async:!0,type:"module"},n),(n=il.get(h))&&Od(e,n),p=a.createElement("script"),Ut(p),yn(p,"link",e),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function Up(e,n,a,o){var h=(h=Ne.current)?Io(h):null;if(!h)throw Error(i(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(n=ai(a.href),a=Tn(h).hoistableStyles,o=a.get(n),o||(o={type:"style",instance:null,count:0,state:null},a.set(n,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=ai(a.href);var p=Tn(h).hoistableStyles,w=p.get(e);if(w||(h=h.ownerDocument||h,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(e,w),(p=h.querySelector(os(e)))&&!p._p&&(w.instance=p,w.state.loading=5),il.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},il.set(e,a),p||C2(h,e,a,w.state))),n&&o===null)throw Error(i(528,""));return w}if(n&&o!==null)throw Error(i(529,""));return null;case"script":return n=a.async,a=a.src,typeof a=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=ii(a),a=Tn(h).hoistableScripts,o=a.get(n),o||(o={type:"script",instance:null,count:0,state:null},a.set(n,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,e))}}function ai(e){return'href="'+Dn(e)+'"'}function os(e){return'link[rel="stylesheet"]['+e+"]"}function Ip(e){return y({},e,{"data-precedence":e.precedence,precedence:null})}function C2(e,n,a,o){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?o.loading=1:(n=e.createElement("link"),o.preload=n,n.addEventListener("load",function(){return o.loading|=1}),n.addEventListener("error",function(){return o.loading|=2}),yn(n,"link",a),Ut(n),e.head.appendChild(n))}function ii(e){return'[src="'+Dn(e)+'"]'}function cs(e){return"script[async]"+e}function Yp(e,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var o=e.querySelector('style[data-href~="'+Dn(a.href)+'"]');if(o)return n.instance=o,Ut(o),o;var h=y({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return o=(e.ownerDocument||e).createElement("style"),Ut(o),yn(o,"style",h),Yo(o,a.precedence,e),n.instance=o;case"stylesheet":h=ai(a.href);var p=e.querySelector(os(h));if(p)return n.state.loading|=4,n.instance=p,Ut(p),p;o=Ip(a),(h=il.get(h))&&_d(o,h),p=(e.ownerDocument||e).createElement("link"),Ut(p);var w=p;return w._p=new Promise(function(N,U){w.onload=N,w.onerror=U}),yn(p,"link",o),n.state.loading|=4,Yo(p,a.precedence,e),n.instance=p;case"script":return p=ii(a.src),(h=e.querySelector(cs(p)))?(n.instance=h,Ut(h),h):(o=a,(h=il.get(p))&&(o=y({},a),Od(o,h)),e=e.ownerDocument||e,h=e.createElement("script"),Ut(h),yn(h,"link",o),e.head.appendChild(h),n.instance=h);case"void":return null;default:throw Error(i(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(o=n.instance,n.state.loading|=4,Yo(o,a.precedence,e));return n.instance}function Yo(e,n,a){for(var o=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),h=o.length?o[o.length-1]:null,p=h,w=0;w<o.length;w++){var N=o[w];if(N.dataset.precedence===n)p=N;else if(p!==h)break}p?p.parentNode.insertBefore(e,p.nextSibling):(n=a.nodeType===9?a.head:a,n.insertBefore(e,n.firstChild))}function _d(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function Od(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var qo=null;function qp(e,n,a){if(qo===null){var o=new Map,h=qo=new Map;h.set(a,o)}else h=qo,o=h.get(a),o||(o=new Map,h.set(a,o));if(o.has(e))return o;for(o.set(e,null),a=a.getElementsByTagName(e),h=0;h<a.length;h++){var p=a[h];if(!(p[fr]||p[Jt]||e==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var w=p.getAttribute(n)||"";w=e+w;var N=o.get(w);N?N.push(p):o.set(w,[p])}}return o}function Xp(e,n,a){e=e.ownerDocument||e,e.head.insertBefore(a,n==="title"?e.querySelector("head > title"):null)}function E2(e,n,a){if(a===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return e=n.disabled,typeof n.precedence=="string"&&e==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function Vp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function N2(e,n,a,o){if(a.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var h=ai(o.href),p=n.querySelector(os(h));if(p){n=p._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=Xo.bind(e),n.then(e,e)),a.state.loading|=4,a.instance=p,Ut(p);return}p=n.ownerDocument||n,o=Ip(o),(h=il.get(h))&&_d(o,h),p=p.createElement("link"),Ut(p);var w=p;w._p=new Promise(function(N,U){w.onload=N,w.onerror=U}),yn(p,"link",o),a.instance=p}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=Xo.bind(e),n.addEventListener("load",a),n.addEventListener("error",a))}}var Bd=0;function A2(e,n){return e.stylesheets&&e.count===0&&Go(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var o=setTimeout(function(){if(e.stylesheets&&Go(e,e.stylesheets),e.unsuspend){var p=e.unsuspend;e.unsuspend=null,p()}},6e4+n);0<e.imgBytes&&Bd===0&&(Bd=62500*o2());var h=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Go(e,e.stylesheets),e.unsuspend)){var p=e.unsuspend;e.unsuspend=null,p()}},(e.imgBytes>Bd?50:800)+n);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(o),clearTimeout(h)}}:null}function Xo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Go(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Vo=null;function Go(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Vo=new Map,n.forEach(T2,e),Vo=null,Xo.call(e))}function T2(e,n){if(!(n.state.loading&4)){var a=Vo.get(e);if(a)var o=a.get(null);else{a=new Map,Vo.set(e,a);for(var h=e.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p<h.length;p++){var w=h[p];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(a.set(w.dataset.precedence,w),o=w)}o&&a.set(null,o)}h=n.instance,w=h.getAttribute("data-precedence"),p=a.get(w)||o,p===o&&a.set(null,h),a.set(w,h),this.count++,o=Xo.bind(this),h.addEventListener("load",o),h.addEventListener("error",o),p?p.parentNode.insertBefore(h,p.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(h,e.firstChild)),n.state.loading|=4}}var us={$$typeof:F,Provider:null,Consumer:null,_currentValue:de,_currentValue2:de,_threadCount:0};function D2(e,n,a,o,h,p,w,N,U){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=Zr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Zr(0),this.hiddenUpdates=Zr(null),this.identifierPrefix=o,this.onUncaughtError=h,this.onCaughtError=p,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=U,this.incompleteTransitions=new Map}function Gp(e,n,a,o,h,p,w,N,U,P,ie,ce){return e=new D2(e,n,a,w,U,P,ie,ce,N),n=1,p===!0&&(n|=24),p=Un(3,null,null,n),e.current=p,p.stateNode=e,n=pu(),n.refCount++,e.pooledCache=n,n.refCount++,p.memoizedState={element:o,isDehydrated:a,cache:n},vu(p),e}function Kp(e){return e?(e=Ba,e):Ba}function Qp(e,n,a,o,h,p){h=Kp(h),o.context===null?o.context=h:o.pendingContext=h,o=jr(n),o.payload={element:a},p=p===void 0?null:p,p!==null&&(o.callback=p),a=Sr(e,o,n),a!==null&&(On(a,e,n),Ii(a,e,n))}function Wp(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<n?a:n}}function Ld(e,n){Wp(e,n),(e=e.alternate)&&Wp(e,n)}function Zp(e){if(e.tag===13||e.tag===31){var n=na(e,67108864);n!==null&&On(n,e,67108864),Ld(e,67108864)}}function Jp(e){if(e.tag===13||e.tag===31){var n=Vn();n=vl(n);var a=na(e,n);a!==null&&On(a,e,n),Ld(e,n)}}var Ko=!0;function z2(e,n,a,o){var h=L.T;L.T=null;var p=Z.p;try{Z.p=2,$d(e,n,a,o)}finally{Z.p=p,L.T=h}}function M2(e,n,a,o){var h=L.T;L.T=null;var p=Z.p;try{Z.p=8,$d(e,n,a,o)}finally{Z.p=p,L.T=h}}function $d(e,n,a,o){if(Ko){var h=Hd(o);if(h===null)Cd(e,n,o,Qo,a),e1(e,o);else if(R2(h,e,n,a,o))o.stopPropagation();else if(e1(e,o),n&4&&-1<F2.indexOf(e)){for(;h!==null;){var p=jl(h);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var w=$n(p.pendingLanes);if(w!==0){var N=p;for(N.pendingLanes|=2,N.entangledLanes|=2;w;){var U=1<<31-Pe(w);N.entanglements[1]|=U,w&=~U}Dl(p),(kt&6)===0&&(zo=gt()+500,rs(0))}}break;case 31:case 13:N=na(p,2),N!==null&&On(N,p,2),Fo(),Ld(p,2)}if(p=Hd(o),p===null&&Cd(e,n,o,Qo,a),p===h)break;h=p}h!==null&&o.stopPropagation()}else Cd(e,n,o,null,a)}}function Hd(e){return e=Pt(e),Ud(e)}var Qo=null;function Ud(e){if(Qo=null,e=hr(e),e!==null){var n=u(e);if(n===null)e=null;else{var a=n.tag;if(a===13){if(e=d(n),e!==null)return e;e=null}else if(a===31){if(e=m(n),e!==null)return e;e=null}else if(a===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return Qo=e,null}function Pp(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(Rt()){case re:return 2;case pe:return 8;case Te:case Ye:return 32;case xe:return 268435456;default:return 32}default:return 32}}var Id=!1,_r=null,Or=null,Br=null,ds=new Map,fs=new Map,Lr=[],F2="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 e1(e,n){switch(e){case"focusin":case"focusout":_r=null;break;case"dragenter":case"dragleave":Or=null;break;case"mouseover":case"mouseout":Br=null;break;case"pointerover":case"pointerout":ds.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":fs.delete(n.pointerId)}}function hs(e,n,a,o,h,p){return e===null||e.nativeEvent!==p?(e={blockedOn:n,domEventName:a,eventSystemFlags:o,nativeEvent:p,targetContainers:[h]},n!==null&&(n=jl(n),n!==null&&Zp(n)),e):(e.eventSystemFlags|=o,n=e.targetContainers,h!==null&&n.indexOf(h)===-1&&n.push(h),e)}function R2(e,n,a,o,h){switch(n){case"focusin":return _r=hs(_r,e,n,a,o,h),!0;case"dragenter":return Or=hs(Or,e,n,a,o,h),!0;case"mouseover":return Br=hs(Br,e,n,a,o,h),!0;case"pointerover":var p=h.pointerId;return ds.set(p,hs(ds.get(p)||null,e,n,a,o,h)),!0;case"gotpointercapture":return p=h.pointerId,fs.set(p,hs(fs.get(p)||null,e,n,a,o,h)),!0}return!1}function t1(e){var n=hr(e.target);if(n!==null){var a=u(n);if(a!==null){if(n=a.tag,n===13){if(n=d(a),n!==null){e.blockedOn=n,wi(e.priority,function(){Jp(a)});return}}else if(n===31){if(n=m(a),n!==null){e.blockedOn=n,wi(e.priority,function(){Jp(a)});return}}else if(n===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Wo(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var a=Hd(e.nativeEvent);if(a===null){a=e.nativeEvent;var o=new a.constructor(a.type,a);Ni=o,a.target.dispatchEvent(o),Ni=null}else return n=jl(a),n!==null&&Zp(n),e.blockedOn=a,!1;n.shift()}return!0}function n1(e,n,a){Wo(e)&&a.delete(n)}function _2(){Id=!1,_r!==null&&Wo(_r)&&(_r=null),Or!==null&&Wo(Or)&&(Or=null),Br!==null&&Wo(Br)&&(Br=null),ds.forEach(n1),fs.forEach(n1)}function Zo(e,n){e.blockedOn===n&&(e.blockedOn=null,Id||(Id=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,_2)))}var Jo=null;function l1(e){Jo!==e&&(Jo=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Jo===e&&(Jo=null);for(var n=0;n<e.length;n+=3){var a=e[n],o=e[n+1],h=e[n+2];if(typeof o!="function"){if(Ud(o||a)===null)continue;break}var p=jl(a);p!==null&&(e.splice(n,3),n-=3,Hu(p,{pending:!0,data:h,method:a.method,action:o},o,h))}}))}function si(e){function n(U){return Zo(U,e)}_r!==null&&Zo(_r,e),Or!==null&&Zo(Or,e),Br!==null&&Zo(Br,e),ds.forEach(n),fs.forEach(n);for(var a=0;a<Lr.length;a++){var o=Lr[a];o.blockedOn===e&&(o.blockedOn=null)}for(;0<Lr.length&&(a=Lr[0],a.blockedOn===null);)t1(a),a.blockedOn===null&&Lr.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(o=0;o<a.length;o+=3){var h=a[o],p=a[o+1],w=h[hn]||null;if(typeof p=="function")w||l1(a);else if(w){var N=null;if(p&&p.hasAttribute("formAction")){if(h=p,w=p[hn]||null)N=w.formAction;else if(Ud(h)!==null)continue}else N=w.action;typeof N=="function"?a[o+1]=N:(a.splice(o,3),o-=3),l1(a)}}}function r1(){function e(p){p.canIntercept&&p.info==="react-transition"&&p.intercept({handler:function(){return new Promise(function(w){return h=w})},focusReset:"manual",scroll:"manual"})}function n(){h!==null&&(h(),h=null),o||setTimeout(a,20)}function a(){if(!o&&!navigation.transition){var p=navigation.currentEntry;p&&p.url!=null&&navigation.navigate(p.url,{state:p.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var o=!1,h=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){o=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),h!==null&&(h(),h=null)}}}function Yd(e){this._internalRoot=e}Po.prototype.render=Yd.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(i(409));var a=n.current,o=Vn();Qp(a,o,e,n,null,null)},Po.prototype.unmount=Yd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;Qp(e.current,2,null,e,null,null),Fo(),n[kl]=null}};function Po(e){this._internalRoot=e}Po.prototype.unstable_scheduleHydration=function(e){if(e){var n=Ul();e={blockedOn:null,target:e,priority:n};for(var a=0;a<Lr.length&&n!==0&&n<Lr[a].priority;a++);Lr.splice(a,0,e),a===0&&t1(e)}};var a1=l.version;if(a1!=="19.2.4")throw Error(i(527,a1,"19.2.4"));Z.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(i(188)):(e=Object.keys(e).join(","),Error(i(268,e)));return e=f(n),e=e!==null?g(e):null,e=e===null?null:e.stateNode,e};var O2={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:L,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ec=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ec.isDisabled&&ec.supportsFiber)try{He=ec.inject(O2),Xe=ec}catch{}}return xs.createRoot=function(e,n){if(!c(e))throw Error(i(299));var a=!1,o="",h=fx,p=hx,w=mx;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onUncaughtError!==void 0&&(h=n.onUncaughtError),n.onCaughtError!==void 0&&(p=n.onCaughtError),n.onRecoverableError!==void 0&&(w=n.onRecoverableError)),n=Gp(e,1,!1,null,null,a,o,null,h,p,w,r1),e[kl]=n.current,Sd(e),new Yd(n)},xs.hydrateRoot=function(e,n,a){if(!c(e))throw Error(i(299));var o=!1,h="",p=fx,w=hx,N=mx,U=null;return a!=null&&(a.unstable_strictMode===!0&&(o=!0),a.identifierPrefix!==void 0&&(h=a.identifierPrefix),a.onUncaughtError!==void 0&&(p=a.onUncaughtError),a.onCaughtError!==void 0&&(w=a.onCaughtError),a.onRecoverableError!==void 0&&(N=a.onRecoverableError),a.formState!==void 0&&(U=a.formState)),n=Gp(e,1,!0,n,a??null,o,h,U,p,w,N,r1),n.context=Kp(null),a=n.current,o=Vn(),o=vl(o),h=jr(o),h.callback=null,Sr(a,h,o),a=o,n.current.lanes=a,cl(n,a),Dl(n),e[kl]=n.current,Sd(e),new Po(n)},xs.version="19.2.4",xs}var p1;function K2(){if(p1)return Vd.exports;p1=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(l){console.error(l)}}return t(),Vd.exports=G2(),Vd.exports}var Q2=K2();const W2="modulepreload",Z2=function(t){return"/"+t},y1={},J2=function(l,r,i){let c=Promise.resolve();if(r&&r.length>0){let d=function(f){return Promise.all(f.map(g=>Promise.resolve(g).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};document.getElementsByTagName("link");const m=document.querySelector("meta[property=csp-nonce]"),x=(m==null?void 0:m.nonce)||(m==null?void 0:m.getAttribute("nonce"));c=d(r.map(f=>{if(f=Z2(f),f in y1)return;y1[f]=!0;const g=f.endsWith(".css"),y=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${y}`))return;const b=document.createElement("link");if(b.rel=g?"stylesheet":W2,g||(b.as="script"),b.crossOrigin="",b.href=f,x&&b.setAttribute("nonce",x),document.head.appendChild(b),g)return new Promise((v,S)=>{b.addEventListener("load",v),b.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${f}`)))})}))}function u(d){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=d,window.dispatchEvent(m),!m.defaultPrevented)throw d}return c.then(d=>{for(const m of d||[])m.status==="rejected"&&u(m.reason);return l().catch(u)})};class P2 extends k.Component{constructor(){super(...arguments);i1(this,"state",{hasError:!1,error:null})}static getDerivedStateFromError(r){return{hasError:!0,error:r}}render(){var r;return this.state.hasError?s.jsx("div",{className:"h-screen flex items-center justify-center bg-[var(--floor-light)]",children:s.jsxs("div",{className:"text-center max-w-md",children:[s.jsx("div",{className:"text-4xl mb-3",children:"🚨"}),s.jsx("div",{className:"text-gray-800 font-semibold mb-2",children:"Something went wrong"}),s.jsx("div",{className:"text-gray-500 text-sm mb-4",children:((r=this.state.error)==null?void 0:r.message)??"An unexpected error occurred."}),s.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 bg-gray-800 text-white rounded-lg text-sm hover:bg-gray-700",children:"Reload"})]})}):this.props.children}}const Ls="/api";async function Mt(t){const l=await fetch(`${Ls}${t}`);if(!l.ok)throw new Error(`API error: ${l.status}`);return l.json()}async function vn(t,l){const r=await fetch(`${Ls}${t}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!r.ok)throw new Error(`API error: ${r.status}`);return r.json()}async function Wd(t,l){const r=await fetch(`${Ls}${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!r.ok)throw new Error(`API error: ${r.status}`);return r.json()}async function Hr(t,l){const r={method:"DELETE"};l!==void 0&&(r.headers={"Content-Type":"application/json"},r.body=JSON.stringify(l));const i=await fetch(`${Ls}${t}`,r);if(!i.ok)throw new Error(`API error: ${i.status}`);return i.json()}const Ce={getCompany:()=>Mt("/company"),getRoles:()=>Mt("/roles"),getRole:t=>Mt(`/roles/${t}`),getProjects:()=>Mt("/projects"),getProject:t=>Mt(`/projects/${t}`),getStandups:()=>Mt("/operations/standups"),getWaves:()=>Mt("/operations/waves"),getDecisions:()=>Mt("/operations/decisions"),getOrgTree:()=>Mt("/engine/org"),getSkills:()=>Mt("/skills"),exportSkills:t=>Mt(`/skills/export/${t}`),getSkillRegistry:()=>Mt("/skills/registry"),installRegistrySkill:(t,l)=>vn("/skills/registry/install",{skillId:t,url:l}),createRole:t=>vn("/engine/roles",t),updateRole:(t,l)=>Wd(`/engine/roles/${t}`,l),deleteRole:t=>Hr(`/engine/roles/${t}`),getSessions:()=>Mt("/sessions"),getSession:t=>Mt(`/sessions/${t}`),createSession:(t,l="talk")=>vn("/sessions",{roleId:t,mode:l}),deleteSession:t=>Hr(`/sessions/${t}`),deleteSessions:t=>Hr("/sessions",{ids:t}),deleteEmptySessions:()=>Hr("/sessions?empty=true"),updateSession:(t,l)=>Wd(`/sessions/${t}`,l),startJob:t=>vn("/jobs",t),getJob:t=>Mt(`/jobs/${t}`),listJobs:t=>{const l=new URLSearchParams;t!=null&&t.status&&l.set("status",t.status),t!=null&&t.roleId&&l.set("roleId",t.roleId);const r=l.toString();return Mt(`/jobs${r?"?"+r:""}`)},abortJob:t=>Hr(`/jobs/${t}`),replyToJob:(t,l)=>vn(`/jobs/${t}/reply`,{message:l}),getStatus:()=>Mt("/status"),detectEngine:()=>vn("/setup/detect-engine",{}),validatePath:t=>vn("/setup/validate-path",{path:t}),scaffold:t=>vn("/setup/scaffold",t),getTeams:()=>Mt("/setup/teams"),browse:t=>vn("/setup/browse",{path:t}),connectAkb:t=>vn("/setup/connect-akb",{path:t}),getKnowledge:()=>Mt("/knowledge"),getKnowledgeDoc:t=>Mt(`/knowledge/${t}`),createKnowledgeDoc:t=>vn("/knowledge",t),updateKnowledgeDoc:(t,l)=>fetch(`${Ls}/knowledge/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:l})}).then(r=>{if(!r.ok)throw new Error(`API error: ${r.status}`);return r.json()}),deleteKnowledgeDoc:t=>Hr(`/knowledge/${t}`),getPreferences:()=>Mt("/preferences"),updatePreferences:t=>Wd("/preferences",t),chatInChannel:t=>vn("/speech/chat",t),getSaveStatus:()=>Mt("/save/status"),save:t=>vn("/save",{message:t}),getSaveHistory:(t=20)=>Mt(`/save/history?limit=${t}`),restoreSave:(t,l)=>vn("/save/restore",{sha:t,paths:l}),initGit:()=>vn("/save/init",{}),getCostSummary:()=>Mt("/cost/summary"),getSyncRoles:()=>Mt("/sync/roles"),applySyncUpdate:t=>vn("/sync/apply",t),getCompanyStats:()=>Mt("/sync/stats"),getGitStatus:()=>Mt("/git/status"),deleteWorktree:t=>Hr(`/git/worktrees/${encodeURIComponent(t)}`),deleteBranch:t=>Hr(`/git/branches/${encodeURIComponent(t)}`)};function K0(t){const[l,r]=k.useState([]),[i,c]=k.useState("idle"),[u,d]=k.useState(""),[m,x]=k.useState([]),f=k.useRef(-1),g=k.useRef(null),y=k.useRef(0),b=k.useCallback(()=>{var C;if(!t)return;(C=g.current)==null||C.abort();const S=new AbortController;g.current=S,c("connecting");const j=f.current+1,E=`/api/jobs/${t}/stream?from=${j}`;fetch(E,{signal:S.signal}).then(async A=>{if(!A.ok||!A.body){c("error");return}c("streaming");const F=A.body.getReader(),_=new TextDecoder;let H="";for(;;){const{done:M,value:I}=await F.read();if(M)break;H+=_.decode(I,{stream:!0});const W=H.split(`
|
|
50
|
+
`);H=W.pop()??"";let te="";for(const D of W)if(D.startsWith("event: "))te=D.slice(7).trim();else if(D.startsWith("data: ")){try{const Y=JSON.parse(D.slice(6));if(te==="activity"){const B=Y;B.seq>f.current&&(f.current=B.seq),r(V=>V.some(ne=>ne.seq===B.seq)?V:[...V,B]),B.type==="text"&&d(V=>V+(B.data.text??"")),B.type==="dispatch:start"&&B.data.childJobId&&x(V=>[...V,B.data.childJobId]),B.type==="job:done"?c("done"):B.type==="job:error"&&c("error")}else if(te==="stream:end"){const B=Y.reason;c(B==="done"?"done":B==="error"?"error":"done")}}catch{}te=""}}i==="streaming"&&c("done")}).catch(A=>{A.name!=="AbortError"&&(c("error"),y.current<3&&(y.current++,setTimeout(b,1e3*y.current)))})},[t]),v=k.useCallback(()=>{y.current=0,b()},[b]);return k.useEffect(()=>{if(!t){r([]),c("idle"),d(""),x([]),f.current=-1;return}return r([]),d(""),x([]),f.current=-1,y.current=0,b(),()=>{var S;(S=g.current)==null||S.abort()}},[t,b]),{events:l,status:i,textOutput:u,childJobIds:m,reconnect:v}}function ev(t,l){const r={};return(t[t.length-1]===""?[...t,""]:t).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const tv=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,nv=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,lv={};function g1(t,l){return(lv.jsx?nv:tv).test(t)}const rv=/[ \t\n\f\r]/g;function av(t){return typeof t=="object"?t.type==="text"?b1(t.value):!1:b1(t)}function b1(t){return t.replace(rv,"")===""}class $s{constructor(l,r,i){this.normal=r,this.property=l,i&&(this.space=i)}}$s.prototype.normal={};$s.prototype.property={};$s.prototype.space=void 0;function Q0(t,l){const r={},i={};for(const c of t)Object.assign(r,c.property),Object.assign(i,c.normal);return new $s(r,i,l)}function Of(t){return t.toLowerCase()}class Ln{constructor(l,r){this.attribute=r,this.property=l}}Ln.prototype.attribute="";Ln.prototype.booleanish=!1;Ln.prototype.boolean=!1;Ln.prototype.commaOrSpaceSeparated=!1;Ln.prototype.commaSeparated=!1;Ln.prototype.defined=!1;Ln.prototype.mustUseProperty=!1;Ln.prototype.number=!1;Ln.prototype.overloadedBoolean=!1;Ln.prototype.property="";Ln.prototype.spaceSeparated=!1;Ln.prototype.space=void 0;let iv=0;const rt=Sa(),rn=Sa(),Bf=Sa(),we=Sa(),_t=Sa(),hi=Sa(),Gn=Sa();function Sa(){return 2**++iv}const Lf=Object.freeze(Object.defineProperty({__proto__:null,boolean:rt,booleanish:rn,commaOrSpaceSeparated:Gn,commaSeparated:hi,number:we,overloadedBoolean:Bf,spaceSeparated:_t},Symbol.toStringTag,{value:"Module"})),Zd=Object.keys(Lf);class lh extends Ln{constructor(l,r,i,c){let u=-1;if(super(l,r),v1(this,"space",c),typeof i=="number")for(;++u<Zd.length;){const d=Zd[u];v1(this,Zd[u],(i&Lf[d])===Lf[d])}}}lh.prototype.defined=!0;function v1(t,l,r){r&&(t[l]=r)}function gi(t){const l={},r={};for(const[i,c]of Object.entries(t.properties)){const u=new lh(i,t.transform(t.attributes||{},i),c,t.space);t.mustUseProperty&&t.mustUseProperty.includes(i)&&(u.mustUseProperty=!0),l[i]=u,r[Of(i)]=i,r[Of(u.attribute)]=i}return new $s(l,r,t.space)}const W0=gi({properties:{ariaActiveDescendant:null,ariaAtomic:rn,ariaAutoComplete:null,ariaBusy:rn,ariaChecked:rn,ariaColCount:we,ariaColIndex:we,ariaColSpan:we,ariaControls:_t,ariaCurrent:null,ariaDescribedBy:_t,ariaDetails:null,ariaDisabled:rn,ariaDropEffect:_t,ariaErrorMessage:null,ariaExpanded:rn,ariaFlowTo:_t,ariaGrabbed:rn,ariaHasPopup:null,ariaHidden:rn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:_t,ariaLevel:we,ariaLive:null,ariaModal:rn,ariaMultiLine:rn,ariaMultiSelectable:rn,ariaOrientation:null,ariaOwns:_t,ariaPlaceholder:null,ariaPosInSet:we,ariaPressed:rn,ariaReadOnly:rn,ariaRelevant:null,ariaRequired:rn,ariaRoleDescription:_t,ariaRowCount:we,ariaRowIndex:we,ariaRowSpan:we,ariaSelected:rn,ariaSetSize:we,ariaSort:null,ariaValueMax:we,ariaValueMin:we,ariaValueNow:we,ariaValueText:null,role:null},transform(t,l){return l==="role"?l:"aria-"+l.slice(4).toLowerCase()}});function Z0(t,l){return l in t?t[l]:l}function J0(t,l){return Z0(t,l.toLowerCase())}const sv=gi({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:hi,acceptCharset:_t,accessKey:_t,action:null,allow:null,allowFullScreen:rt,allowPaymentRequest:rt,allowUserMedia:rt,alt:null,as:null,async:rt,autoCapitalize:null,autoComplete:_t,autoFocus:rt,autoPlay:rt,blocking:_t,capture:null,charSet:null,checked:rt,cite:null,className:_t,cols:we,colSpan:null,content:null,contentEditable:rn,controls:rt,controlsList:_t,coords:we|hi,crossOrigin:null,data:null,dateTime:null,decoding:null,default:rt,defer:rt,dir:null,dirName:null,disabled:rt,download:Bf,draggable:rn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:rt,formTarget:null,headers:_t,height:we,hidden:Bf,high:we,href:null,hrefLang:null,htmlFor:_t,httpEquiv:_t,id:null,imageSizes:null,imageSrcSet:null,inert:rt,inputMode:null,integrity:null,is:null,isMap:rt,itemId:null,itemProp:_t,itemRef:_t,itemScope:rt,itemType:_t,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:rt,low:we,manifest:null,max:null,maxLength:we,media:null,method:null,min:null,minLength:we,multiple:rt,muted:rt,name:null,nonce:null,noModule:rt,noValidate:rt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:rt,optimum:we,pattern:null,ping:_t,placeholder:null,playsInline:rt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:rt,referrerPolicy:null,rel:_t,required:rt,reversed:rt,rows:we,rowSpan:we,sandbox:_t,scope:null,scoped:rt,seamless:rt,selected:rt,shadowRootClonable:rt,shadowRootDelegatesFocus:rt,shadowRootMode:null,shape:null,size:we,sizes:null,slot:null,span:we,spellCheck:rn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:we,step:null,style:null,tabIndex:we,target:null,title:null,translate:null,type:null,typeMustMatch:rt,useMap:null,value:rn,width:we,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:_t,axis:null,background:null,bgColor:null,border:we,borderColor:null,bottomMargin:we,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:rt,declare:rt,event:null,face:null,frame:null,frameBorder:null,hSpace:we,leftMargin:we,link:null,longDesc:null,lowSrc:null,marginHeight:we,marginWidth:we,noResize:rt,noHref:rt,noShade:rt,noWrap:rt,object:null,profile:null,prompt:null,rev:null,rightMargin:we,rules:null,scheme:null,scrolling:rn,standby:null,summary:null,text:null,topMargin:we,valueType:null,version:null,vAlign:null,vLink:null,vSpace:we,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:rt,disableRemotePlayback:rt,prefix:null,property:null,results:we,security:null,unselectable:null},space:"html",transform:J0}),ov=gi({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",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",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",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",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",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",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Gn,accentHeight:we,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:we,amplitude:we,arabicForm:null,ascent:we,attributeName:null,attributeType:null,azimuth:we,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:we,by:null,calcMode:null,capHeight:we,className:_t,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:we,diffuseConstant:we,direction:null,display:null,dur:null,divisor:we,dominantBaseline:null,download:rt,dx:null,dy:null,edgeMode:null,editable:null,elevation:we,enableBackground:null,end:null,event:null,exponent:we,externalResourcesRequired:null,fill:null,fillOpacity:we,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:hi,g2:hi,glyphName:hi,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:we,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:we,horizOriginX:we,horizOriginY:we,id:null,ideographic:we,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:we,k:we,k1:we,k2:we,k3:we,k4:we,kernelMatrix:Gn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:we,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:we,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:we,overlineThickness:we,paintOrder:null,panose1:null,path:null,pathLength:we,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:_t,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:we,pointsAtY:we,pointsAtZ:we,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Gn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Gn,rev:Gn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Gn,requiredFeatures:Gn,requiredFonts:Gn,requiredFormats:Gn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:we,specularExponent:we,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:we,strikethroughThickness:we,string:null,stroke:null,strokeDashArray:Gn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:we,strokeOpacity:we,strokeWidth:null,style:null,surfaceScale:we,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Gn,tabIndex:we,tableValues:null,target:null,targetX:we,targetY:we,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Gn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:we,underlineThickness:we,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:we,values:null,vAlphabetic:we,vMathematical:we,vectorEffect:null,vHanging:we,vIdeographic:we,version:null,vertAdvY:we,vertOriginX:we,vertOriginY:we,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:we,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Z0}),P0=gi({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,l){return"xlink:"+l.slice(5).toLowerCase()}}),ey=gi({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:J0}),ty=gi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,l){return"xml:"+l.slice(3).toLowerCase()}}),cv={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},uv=/[A-Z]/g,w1=/-[a-z]/g,dv=/^data[-\w.:]+$/i;function fv(t,l){const r=Of(l);let i=l,c=Ln;if(r in t.normal)return t.property[t.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&dv.test(l)){if(l.charAt(4)==="-"){const u=l.slice(5).replace(w1,mv);i="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=l.slice(4);if(!w1.test(u)){let d=u.replace(uv,hv);d.charAt(0)!=="-"&&(d="-"+d),l="data"+d}}c=lh}return new c(i,l)}function hv(t){return"-"+t.toLowerCase()}function mv(t){return t.charAt(1).toUpperCase()}const xv=Q0([W0,sv,P0,ey,ty],"html"),rh=Q0([W0,ov,P0,ey,ty],"svg");function pv(t){return t.join(" ").trim()}var oi={},Jd,k1;function yv(){if(k1)return Jd;k1=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,l=/\n/g,r=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,c=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,d=/^[;\s]*/,m=/^\s+|\s+$/g,x=`
|
|
51
|
+
`,f="/",g="*",y="",b="comment",v="declaration";function S(E,C){if(typeof E!="string")throw new TypeError("First argument must be a string");if(!E)return[];C=C||{};var A=1,F=1;function _(ne){var G=ne.match(l);G&&(A+=G.length);var L=ne.lastIndexOf(x);F=~L?ne.length-L:F+ne.length}function H(){var ne={line:A,column:F};return function(G){return G.position=new M(ne),te(),G}}function M(ne){this.start=ne,this.end={line:A,column:F},this.source=C.source}M.prototype.content=E;function I(ne){var G=new Error(C.source+":"+A+":"+F+": "+ne);if(G.reason=ne,G.filename=C.source,G.line=A,G.column=F,G.source=E,!C.silent)throw G}function W(ne){var G=ne.exec(E);if(G){var L=G[0];return _(L),E=E.slice(L.length),G}}function te(){W(r)}function D(ne){var G;for(ne=ne||[];G=Y();)G!==!1&&ne.push(G);return ne}function Y(){var ne=H();if(!(f!=E.charAt(0)||g!=E.charAt(1))){for(var G=2;y!=E.charAt(G)&&(g!=E.charAt(G)||f!=E.charAt(G+1));)++G;if(G+=2,y===E.charAt(G-1))return I("End of comment missing");var L=E.slice(2,G-2);return F+=2,_(L),E=E.slice(G),F+=2,ne({type:b,comment:L})}}function B(){var ne=H(),G=W(i);if(G){if(Y(),!W(c))return I("property missing ':'");var L=W(u),Z=ne({type:v,property:j(G[0].replace(t,y)),value:L?j(L[0].replace(t,y)):y});return W(d),Z}}function V(){var ne=[];D(ne);for(var G;G=B();)G!==!1&&(ne.push(G),D(ne));return ne}return te(),V()}function j(E){return E?E.replace(m,y):y}return Jd=S,Jd}var j1;function gv(){if(j1)return oi;j1=1;var t=oi&&oi.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(oi,"__esModule",{value:!0}),oi.default=r;const l=t(yv());function r(i,c){let u=null;if(!i||typeof i!="string")return u;const d=(0,l.default)(i),m=typeof c=="function";return d.forEach(x=>{if(x.type!=="declaration")return;const{property:f,value:g}=x;m?c(f,g,x):g&&(u=u||{},u[f]=g)}),u}return oi}var ps={},S1;function bv(){if(S1)return ps;S1=1,Object.defineProperty(ps,"__esModule",{value:!0}),ps.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,l=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,c=/^-(ms)-/,u=function(f){return!f||r.test(f)||t.test(f)},d=function(f,g){return g.toUpperCase()},m=function(f,g){return"".concat(g,"-")},x=function(f,g){return g===void 0&&(g={}),u(f)?f:(f=f.toLowerCase(),g.reactCompat?f=f.replace(c,m):f=f.replace(i,m),f.replace(l,d))};return ps.camelCase=x,ps}var ys,C1;function vv(){if(C1)return ys;C1=1;var t=ys&&ys.__importDefault||function(c){return c&&c.__esModule?c:{default:c}},l=t(gv()),r=bv();function i(c,u){var d={};return!c||typeof c!="string"||(0,l.default)(c,function(m,x){m&&x&&(d[(0,r.camelCase)(m,u)]=x)}),d}return i.default=i,ys=i,ys}var wv=vv();const kv=G0(wv),ny=ly("end"),ah=ly("start");function ly(t){return l;function l(r){const i=r&&r.position&&r.position[t]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function jv(t){const l=ah(t),r=ny(t);if(l&&r)return{start:l,end:r}}function As(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?E1(t.position):"start"in t||"end"in t?E1(t):"line"in t||"column"in t?$f(t):""}function $f(t){return N1(t&&t.line)+":"+N1(t&&t.column)}function E1(t){return $f(t&&t.start)+"-"+$f(t&&t.end)}function N1(t){return t&&typeof t=="number"?t:1}class jn extends Error{constructor(l,r,i){super(),typeof r=="string"&&(i=r,r=void 0);let c="",u={},d=!1;if(r&&("line"in r&&"column"in r?u={place:r}:"start"in r&&"end"in r?u={place:r}:"type"in r?u={ancestors:[r],place:r.position}:u={...r}),typeof l=="string"?c=l:!u.cause&&l&&(d=!0,c=l.message,u.cause=l),!u.ruleId&&!u.source&&typeof i=="string"){const x=i.indexOf(":");x===-1?u.ruleId=i:(u.source=i.slice(0,x),u.ruleId=i.slice(x+1))}if(!u.place&&u.ancestors&&u.ancestors){const x=u.ancestors[u.ancestors.length-1];x&&(u.place=x.position)}const m=u.place&&"start"in u.place?u.place.start:u.place;this.ancestors=u.ancestors||void 0,this.cause=u.cause||void 0,this.column=m?m.column:void 0,this.fatal=void 0,this.file="",this.message=c,this.line=m?m.line:void 0,this.name=As(u.place)||"1:1",this.place=u.place||void 0,this.reason=this.message,this.ruleId=u.ruleId||void 0,this.source=u.source||void 0,this.stack=d&&u.cause&&typeof u.cause.stack=="string"?u.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}jn.prototype.file="";jn.prototype.name="";jn.prototype.reason="";jn.prototype.message="";jn.prototype.stack="";jn.prototype.column=void 0;jn.prototype.line=void 0;jn.prototype.ancestors=void 0;jn.prototype.cause=void 0;jn.prototype.fatal=void 0;jn.prototype.place=void 0;jn.prototype.ruleId=void 0;jn.prototype.source=void 0;const ih={}.hasOwnProperty,Sv=new Map,Cv=/[A-Z]/g,Ev=new Set(["table","tbody","thead","tfoot","tr"]),Nv=new Set(["td","th"]),ry="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Av(t,l){if(!l||l.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=l.filePath||void 0;let i;if(l.development){if(typeof l.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=Ov(r,l.jsxDEV)}else{if(typeof l.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof l.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=_v(r,l.jsx,l.jsxs)}const c={Fragment:l.Fragment,ancestors:[],components:l.components||{},create:i,elementAttributeNameCase:l.elementAttributeNameCase||"react",evaluater:l.createEvaluater?l.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:l.ignoreInvalidStyle||!1,passKeys:l.passKeys!==!1,passNode:l.passNode||!1,schema:l.space==="svg"?rh:xv,stylePropertyNameCase:l.stylePropertyNameCase||"dom",tableCellAlignToStyle:l.tableCellAlignToStyle!==!1},u=ay(c,t,void 0);return u&&typeof u!="string"?u:c.create(t,c.Fragment,{children:u||void 0},void 0)}function ay(t,l,r){if(l.type==="element")return Tv(t,l,r);if(l.type==="mdxFlowExpression"||l.type==="mdxTextExpression")return Dv(t,l);if(l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement")return Mv(t,l,r);if(l.type==="mdxjsEsm")return zv(t,l);if(l.type==="root")return Fv(t,l,r);if(l.type==="text")return Rv(t,l)}function Tv(t,l,r){const i=t.schema;let c=i;l.tagName.toLowerCase()==="svg"&&i.space==="html"&&(c=rh,t.schema=c),t.ancestors.push(l);const u=sy(t,l.tagName,!1),d=Bv(t,l);let m=oh(t,l);return Ev.has(l.tagName)&&(m=m.filter(function(x){return typeof x=="string"?!av(x):!0})),iy(t,d,u,l),sh(d,m),t.ancestors.pop(),t.schema=i,t.create(l,u,d,r)}function Dv(t,l){if(l.data&&l.data.estree&&t.evaluater){const i=l.data.estree.body[0];return i.type,t.evaluater.evaluateExpression(i.expression)}Ms(t,l.position)}function zv(t,l){if(l.data&&l.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(l.data.estree);Ms(t,l.position)}function Mv(t,l,r){const i=t.schema;let c=i;l.name==="svg"&&i.space==="html"&&(c=rh,t.schema=c),t.ancestors.push(l);const u=l.name===null?t.Fragment:sy(t,l.name,!0),d=Lv(t,l),m=oh(t,l);return iy(t,d,u,l),sh(d,m),t.ancestors.pop(),t.schema=i,t.create(l,u,d,r)}function Fv(t,l,r){const i={};return sh(i,oh(t,l)),t.create(l,t.Fragment,i,r)}function Rv(t,l){return l.value}function iy(t,l,r,i){typeof r!="string"&&r!==t.Fragment&&t.passNode&&(l.node=i)}function sh(t,l){if(l.length>0){const r=l.length>1?l:l[0];r&&(t.children=r)}}function _v(t,l,r){return i;function i(c,u,d,m){const f=Array.isArray(d.children)?r:l;return m?f(u,d,m):f(u,d)}}function Ov(t,l){return r;function r(i,c,u,d){const m=Array.isArray(u.children),x=ah(i);return l(c,u,d,m,{columnNumber:x?x.column-1:void 0,fileName:t,lineNumber:x?x.line:void 0},void 0)}}function Bv(t,l){const r={};let i,c;for(c in l.properties)if(c!=="children"&&ih.call(l.properties,c)){const u=$v(t,c,l.properties[c]);if(u){const[d,m]=u;t.tableCellAlignToStyle&&d==="align"&&typeof m=="string"&&Nv.has(l.tagName)?i=m:r[d]=m}}if(i){const u=r.style||(r.style={});u[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return r}function Lv(t,l){const r={};for(const i of l.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&t.evaluater){const u=i.data.estree.body[0];u.type;const d=u.expression;d.type;const m=d.properties[0];m.type,Object.assign(r,t.evaluater.evaluateExpression(m.argument))}else Ms(t,l.position);else{const c=i.name;let u;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&t.evaluater){const m=i.value.data.estree.body[0];m.type,u=t.evaluater.evaluateExpression(m.expression)}else Ms(t,l.position);else u=i.value===null?!0:i.value;r[c]=u}return r}function oh(t,l){const r=[];let i=-1;const c=t.passKeys?new Map:Sv;for(;++i<l.children.length;){const u=l.children[i];let d;if(t.passKeys){const x=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(x){const f=c.get(x)||0;d=x+"-"+f,c.set(x,f+1)}}const m=ay(t,u,d);m!==void 0&&r.push(m)}return r}function $v(t,l,r){const i=fv(t.schema,l);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=i.commaSeparated?ev(r):pv(r)),i.property==="style"){let c=typeof r=="object"?r:Hv(t,String(r));return t.stylePropertyNameCase==="css"&&(c=Uv(c)),["style",c]}return[t.elementAttributeNameCase==="react"&&i.space?cv[i.property]||i.property:i.attribute,r]}}function Hv(t,l){try{return kv(l,{reactCompat:!0})}catch(r){if(t.ignoreInvalidStyle)return{};const i=r,c=new jn("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw c.file=t.filePath||void 0,c.url=ry+"#cannot-parse-style-attribute",c}}function sy(t,l,r){let i;if(!r)i={type:"Literal",value:l};else if(l.includes(".")){const c=l.split(".");let u=-1,d;for(;++u<c.length;){const m=g1(c[u])?{type:"Identifier",name:c[u]}:{type:"Literal",value:c[u]};d=d?{type:"MemberExpression",object:d,property:m,computed:!!(u&&m.type==="Literal"),optional:!1}:m}i=d}else i=g1(l)&&!/^[a-z]/.test(l)?{type:"Identifier",name:l}:{type:"Literal",value:l};if(i.type==="Literal"){const c=i.value;return ih.call(t.components,c)?t.components[c]:c}if(t.evaluater)return t.evaluater.evaluateExpression(i);Ms(t)}function Ms(t,l){const r=new jn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:l,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=t.filePath||void 0,r.url=ry+"#cannot-handle-mdx-estrees-without-createevaluater",r}function Uv(t){const l={};let r;for(r in t)ih.call(t,r)&&(l[Iv(r)]=t[r]);return l}function Iv(t){let l=t.replace(Cv,Yv);return l.slice(0,3)==="ms-"&&(l="-"+l),l}function Yv(t){return"-"+t.toLowerCase()}const Pd={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},qv={};function ch(t,l){const r=qv,i=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,c=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return oy(t,i,c)}function oy(t,l,r){if(Xv(t)){if("value"in t)return t.type==="html"&&!r?"":t.value;if(l&&"alt"in t&&t.alt)return t.alt;if("children"in t)return A1(t.children,l,r)}return Array.isArray(t)?A1(t,l,r):""}function A1(t,l,r){const i=[];let c=-1;for(;++c<t.length;)i[c]=oy(t[c],l,r);return i.join("")}function Xv(t){return!!(t&&typeof t=="object")}const T1=document.createElement("i");function uh(t){const l="&"+t+";";T1.innerHTML=l;const r=T1.textContent;return r.charCodeAt(r.length-1)===59&&t!=="semi"||r===l?!1:r}function Qn(t,l,r,i){const c=t.length;let u=0,d;if(l<0?l=-l>c?0:c+l:l=l>c?c:l,r=r>0?r:0,i.length<1e4)d=Array.from(i),d.unshift(l,r),t.splice(...d);else for(r&&t.splice(l,r);u<i.length;)d=i.slice(u,u+1e4),d.unshift(l,0),t.splice(...d),u+=1e4,l+=1e4}function sl(t,l){return t.length>0?(Qn(t,t.length,0,l),t):l}const D1={}.hasOwnProperty;function cy(t){const l={};let r=-1;for(;++r<t.length;)Vv(l,t[r]);return l}function Vv(t,l){let r;for(r in l){const c=(D1.call(t,r)?t[r]:void 0)||(t[r]={}),u=l[r];let d;if(u)for(d in u){D1.call(c,d)||(c[d]=[]);const m=u[d];Gv(c[d],Array.isArray(m)?m:m?[m]:[])}}}function Gv(t,l){let r=-1;const i=[];for(;++r<l.length;)(l[r].add==="after"?t:i).push(l[r]);Qn(t,0,0,i)}function uy(t,l){const r=Number.parseInt(t,l);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function bl(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const En=Kr(/[A-Za-z]/),kn=Kr(/[\dA-Za-z]/),Kv=Kr(/[#-'*+\--9=?A-Z^-~]/);function Sc(t){return t!==null&&(t<32||t===127)}const Hf=Kr(/\d/),Qv=Kr(/[\dA-Fa-f]/),Wv=Kr(/[!-/:-@[-`{-~]/);function qe(t){return t!==null&&t<-2}function Ft(t){return t!==null&&(t<0||t===32)}function ct(t){return t===-2||t===-1||t===32}const Rc=Kr(new RegExp("\\p{P}|\\p{S}","u")),ka=Kr(/\s/);function Kr(t){return l;function l(r){return r!==null&&r>-1&&t.test(String.fromCharCode(r))}}function bi(t){const l=[];let r=-1,i=0,c=0;for(;++r<t.length;){const u=t.charCodeAt(r);let d="";if(u===37&&kn(t.charCodeAt(r+1))&&kn(t.charCodeAt(r+2)))c=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(d=String.fromCharCode(u));else if(u>55295&&u<57344){const m=t.charCodeAt(r+1);u<56320&&m>56319&&m<57344?(d=String.fromCharCode(u,m),c=1):d="�"}else d=String.fromCharCode(u);d&&(l.push(t.slice(i,r),encodeURIComponent(d)),i=r+c+1,d=""),c&&(r+=c,c=0)}return l.join("")+t.slice(i)}function pt(t,l,r,i){const c=i?i-1:Number.POSITIVE_INFINITY;let u=0;return d;function d(x){return ct(x)?(t.enter(r),m(x)):l(x)}function m(x){return ct(x)&&u++<c?(t.consume(x),m):(t.exit(r),l(x))}}const Zv={tokenize:Jv};function Jv(t){const l=t.attempt(this.parser.constructs.contentInitial,i,c);let r;return l;function i(m){if(m===null){t.consume(m);return}return t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),pt(t,l,"linePrefix")}function c(m){return t.enter("paragraph"),u(m)}function u(m){const x=t.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=x),r=x,d(m)}function d(m){if(m===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(m);return}return qe(m)?(t.consume(m),t.exit("chunkText"),u):(t.consume(m),d)}}const Pv={tokenize:ew},z1={tokenize:tw};function ew(t){const l=this,r=[];let i=0,c,u,d;return m;function m(F){if(i<r.length){const _=r[i];return l.containerState=_[1],t.attempt(_[0].continuation,x,f)(F)}return f(F)}function x(F){if(i++,l.containerState._closeFlow){l.containerState._closeFlow=void 0,c&&A();const _=l.events.length;let H=_,M;for(;H--;)if(l.events[H][0]==="exit"&&l.events[H][1].type==="chunkFlow"){M=l.events[H][1].end;break}C(i);let I=_;for(;I<l.events.length;)l.events[I][1].end={...M},I++;return Qn(l.events,H+1,0,l.events.slice(_)),l.events.length=I,f(F)}return m(F)}function f(F){if(i===r.length){if(!c)return b(F);if(c.currentConstruct&&c.currentConstruct.concrete)return S(F);l.interrupt=!!(c.currentConstruct&&!c._gfmTableDynamicInterruptHack)}return l.containerState={},t.check(z1,g,y)(F)}function g(F){return c&&A(),C(i),b(F)}function y(F){return l.parser.lazy[l.now().line]=i!==r.length,d=l.now().offset,S(F)}function b(F){return l.containerState={},t.attempt(z1,v,S)(F)}function v(F){return i++,r.push([l.currentConstruct,l.containerState]),b(F)}function S(F){if(F===null){c&&A(),C(0),t.consume(F);return}return c=c||l.parser.flow(l.now()),t.enter("chunkFlow",{_tokenizer:c,contentType:"flow",previous:u}),j(F)}function j(F){if(F===null){E(t.exit("chunkFlow"),!0),C(0),t.consume(F);return}return qe(F)?(t.consume(F),E(t.exit("chunkFlow")),i=0,l.interrupt=void 0,m):(t.consume(F),j)}function E(F,_){const H=l.sliceStream(F);if(_&&H.push(null),F.previous=u,u&&(u.next=F),u=F,c.defineSkip(F.start),c.write(H),l.parser.lazy[F.start.line]){let M=c.events.length;for(;M--;)if(c.events[M][1].start.offset<d&&(!c.events[M][1].end||c.events[M][1].end.offset>d))return;const I=l.events.length;let W=I,te,D;for(;W--;)if(l.events[W][0]==="exit"&&l.events[W][1].type==="chunkFlow"){if(te){D=l.events[W][1].end;break}te=!0}for(C(i),M=I;M<l.events.length;)l.events[M][1].end={...D},M++;Qn(l.events,W+1,0,l.events.slice(I)),l.events.length=M}}function C(F){let _=r.length;for(;_-- >F;){const H=r[_];l.containerState=H[1],H[0].exit.call(l,t)}r.length=F}function A(){c.write([null]),u=void 0,c=void 0,l.containerState._closeFlow=void 0}}function tw(t,l,r){return pt(t,t.attempt(this.parser.constructs.document,l,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function xi(t){if(t===null||Ft(t)||ka(t))return 1;if(Rc(t))return 2}function _c(t,l,r){const i=[];let c=-1;for(;++c<t.length;){const u=t[c].resolveAll;u&&!i.includes(u)&&(l=u(l,r),i.push(u))}return l}const Uf={name:"attention",resolveAll:nw,tokenize:lw};function nw(t,l){let r=-1,i,c,u,d,m,x,f,g;for(;++r<t.length;)if(t[r][0]==="enter"&&t[r][1].type==="attentionSequence"&&t[r][1]._close){for(i=r;i--;)if(t[i][0]==="exit"&&t[i][1].type==="attentionSequence"&&t[i][1]._open&&l.sliceSerialize(t[i][1]).charCodeAt(0)===l.sliceSerialize(t[r][1]).charCodeAt(0)){if((t[i][1]._close||t[r][1]._open)&&(t[r][1].end.offset-t[r][1].start.offset)%3&&!((t[i][1].end.offset-t[i][1].start.offset+t[r][1].end.offset-t[r][1].start.offset)%3))continue;x=t[i][1].end.offset-t[i][1].start.offset>1&&t[r][1].end.offset-t[r][1].start.offset>1?2:1;const y={...t[i][1].end},b={...t[r][1].start};M1(y,-x),M1(b,x),d={type:x>1?"strongSequence":"emphasisSequence",start:y,end:{...t[i][1].end}},m={type:x>1?"strongSequence":"emphasisSequence",start:{...t[r][1].start},end:b},u={type:x>1?"strongText":"emphasisText",start:{...t[i][1].end},end:{...t[r][1].start}},c={type:x>1?"strong":"emphasis",start:{...d.start},end:{...m.end}},t[i][1].end={...d.start},t[r][1].start={...m.end},f=[],t[i][1].end.offset-t[i][1].start.offset&&(f=sl(f,[["enter",t[i][1],l],["exit",t[i][1],l]])),f=sl(f,[["enter",c,l],["enter",d,l],["exit",d,l],["enter",u,l]]),f=sl(f,_c(l.parser.constructs.insideSpan.null,t.slice(i+1,r),l)),f=sl(f,[["exit",u,l],["enter",m,l],["exit",m,l],["exit",c,l]]),t[r][1].end.offset-t[r][1].start.offset?(g=2,f=sl(f,[["enter",t[r][1],l],["exit",t[r][1],l]])):g=0,Qn(t,i-1,r-i+3,f),r=i+f.length-g-2;break}}for(r=-1;++r<t.length;)t[r][1].type==="attentionSequence"&&(t[r][1].type="data");return t}function lw(t,l){const r=this.parser.constructs.attentionMarkers.null,i=this.previous,c=xi(i);let u;return d;function d(x){return u=x,t.enter("attentionSequence"),m(x)}function m(x){if(x===u)return t.consume(x),m;const f=t.exit("attentionSequence"),g=xi(x),y=!g||g===2&&c||r.includes(x),b=!c||c===2&&g||r.includes(i);return f._open=!!(u===42?y:y&&(c||!b)),f._close=!!(u===42?b:b&&(g||!y)),l(x)}}function M1(t,l){t.column+=l,t.offset+=l,t._bufferIndex+=l}const rw={name:"autolink",tokenize:aw};function aw(t,l,r){let i=0;return c;function c(v){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(v),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),u}function u(v){return En(v)?(t.consume(v),d):v===64?r(v):f(v)}function d(v){return v===43||v===45||v===46||kn(v)?(i=1,m(v)):f(v)}function m(v){return v===58?(t.consume(v),i=0,x):(v===43||v===45||v===46||kn(v))&&i++<32?(t.consume(v),m):(i=0,f(v))}function x(v){return v===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(v),t.exit("autolinkMarker"),t.exit("autolink"),l):v===null||v===32||v===60||Sc(v)?r(v):(t.consume(v),x)}function f(v){return v===64?(t.consume(v),g):Kv(v)?(t.consume(v),f):r(v)}function g(v){return kn(v)?y(v):r(v)}function y(v){return v===46?(t.consume(v),i=0,g):v===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(v),t.exit("autolinkMarker"),t.exit("autolink"),l):b(v)}function b(v){if((v===45||kn(v))&&i++<63){const S=v===45?b:y;return t.consume(v),S}return r(v)}}const Hs={partial:!0,tokenize:iw};function iw(t,l,r){return i;function i(u){return ct(u)?pt(t,c,"linePrefix")(u):c(u)}function c(u){return u===null||qe(u)?l(u):r(u)}}const dy={continuation:{tokenize:ow},exit:cw,name:"blockQuote",tokenize:sw};function sw(t,l,r){const i=this;return c;function c(d){if(d===62){const m=i.containerState;return m.open||(t.enter("blockQuote",{_container:!0}),m.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(d),t.exit("blockQuoteMarker"),u}return r(d)}function u(d){return ct(d)?(t.enter("blockQuotePrefixWhitespace"),t.consume(d),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),l):(t.exit("blockQuotePrefix"),l(d))}}function ow(t,l,r){const i=this;return c;function c(d){return ct(d)?pt(t,u,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d):u(d)}function u(d){return t.attempt(dy,l,r)(d)}}function cw(t){t.exit("blockQuote")}const fy={name:"characterEscape",tokenize:uw};function uw(t,l,r){return i;function i(u){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(u),t.exit("escapeMarker"),c}function c(u){return Wv(u)?(t.enter("characterEscapeValue"),t.consume(u),t.exit("characterEscapeValue"),t.exit("characterEscape"),l):r(u)}}const hy={name:"characterReference",tokenize:dw};function dw(t,l,r){const i=this;let c=0,u,d;return m;function m(y){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(y),t.exit("characterReferenceMarker"),x}function x(y){return y===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(y),t.exit("characterReferenceMarkerNumeric"),f):(t.enter("characterReferenceValue"),u=31,d=kn,g(y))}function f(y){return y===88||y===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(y),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),u=6,d=Qv,g):(t.enter("characterReferenceValue"),u=7,d=Hf,g(y))}function g(y){if(y===59&&c){const b=t.exit("characterReferenceValue");return d===kn&&!uh(i.sliceSerialize(b))?r(y):(t.enter("characterReferenceMarker"),t.consume(y),t.exit("characterReferenceMarker"),t.exit("characterReference"),l)}return d(y)&&c++<u?(t.consume(y),g):r(y)}}const F1={partial:!0,tokenize:hw},R1={concrete:!0,name:"codeFenced",tokenize:fw};function fw(t,l,r){const i=this,c={partial:!0,tokenize:H};let u=0,d=0,m;return x;function x(M){return f(M)}function f(M){const I=i.events[i.events.length-1];return u=I&&I[1].type==="linePrefix"?I[2].sliceSerialize(I[1],!0).length:0,m=M,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),g(M)}function g(M){return M===m?(d++,t.consume(M),g):d<3?r(M):(t.exit("codeFencedFenceSequence"),ct(M)?pt(t,y,"whitespace")(M):y(M))}function y(M){return M===null||qe(M)?(t.exit("codeFencedFence"),i.interrupt?l(M):t.check(F1,j,_)(M)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),b(M))}function b(M){return M===null||qe(M)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),y(M)):ct(M)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),pt(t,v,"whitespace")(M)):M===96&&M===m?r(M):(t.consume(M),b)}function v(M){return M===null||qe(M)?y(M):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),S(M))}function S(M){return M===null||qe(M)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),y(M)):M===96&&M===m?r(M):(t.consume(M),S)}function j(M){return t.attempt(c,_,E)(M)}function E(M){return t.enter("lineEnding"),t.consume(M),t.exit("lineEnding"),C}function C(M){return u>0&&ct(M)?pt(t,A,"linePrefix",u+1)(M):A(M)}function A(M){return M===null||qe(M)?t.check(F1,j,_)(M):(t.enter("codeFlowValue"),F(M))}function F(M){return M===null||qe(M)?(t.exit("codeFlowValue"),A(M)):(t.consume(M),F)}function _(M){return t.exit("codeFenced"),l(M)}function H(M,I,W){let te=0;return D;function D(G){return M.enter("lineEnding"),M.consume(G),M.exit("lineEnding"),Y}function Y(G){return M.enter("codeFencedFence"),ct(G)?pt(M,B,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(G):B(G)}function B(G){return G===m?(M.enter("codeFencedFenceSequence"),V(G)):W(G)}function V(G){return G===m?(te++,M.consume(G),V):te>=d?(M.exit("codeFencedFenceSequence"),ct(G)?pt(M,ne,"whitespace")(G):ne(G)):W(G)}function ne(G){return G===null||qe(G)?(M.exit("codeFencedFence"),I(G)):W(G)}}}function hw(t,l,r){const i=this;return c;function c(d){return d===null?r(d):(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),u)}function u(d){return i.parser.lazy[i.now().line]?r(d):l(d)}}const ef={name:"codeIndented",tokenize:xw},mw={partial:!0,tokenize:pw};function xw(t,l,r){const i=this;return c;function c(f){return t.enter("codeIndented"),pt(t,u,"linePrefix",5)(f)}function u(f){const g=i.events[i.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?d(f):r(f)}function d(f){return f===null?x(f):qe(f)?t.attempt(mw,d,x)(f):(t.enter("codeFlowValue"),m(f))}function m(f){return f===null||qe(f)?(t.exit("codeFlowValue"),d(f)):(t.consume(f),m)}function x(f){return t.exit("codeIndented"),l(f)}}function pw(t,l,r){const i=this;return c;function c(d){return i.parser.lazy[i.now().line]?r(d):qe(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),c):pt(t,u,"linePrefix",5)(d)}function u(d){const m=i.events[i.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?l(d):qe(d)?c(d):r(d)}}const yw={name:"codeText",previous:bw,resolve:gw,tokenize:vw};function gw(t){let l=t.length-4,r=3,i,c;if((t[r][1].type==="lineEnding"||t[r][1].type==="space")&&(t[l][1].type==="lineEnding"||t[l][1].type==="space")){for(i=r;++i<l;)if(t[i][1].type==="codeTextData"){t[r][1].type="codeTextPadding",t[l][1].type="codeTextPadding",r+=2,l-=2;break}}for(i=r-1,l++;++i<=l;)c===void 0?i!==l&&t[i][1].type!=="lineEnding"&&(c=i):(i===l||t[i][1].type==="lineEnding")&&(t[c][1].type="codeTextData",i!==c+2&&(t[c][1].end=t[i-1][1].end,t.splice(c+2,i-c-2),l-=i-c-2,i=c+2),c=void 0);return t}function bw(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function vw(t,l,r){let i=0,c,u;return d;function d(y){return t.enter("codeText"),t.enter("codeTextSequence"),m(y)}function m(y){return y===96?(t.consume(y),i++,m):(t.exit("codeTextSequence"),x(y))}function x(y){return y===null?r(y):y===32?(t.enter("space"),t.consume(y),t.exit("space"),x):y===96?(u=t.enter("codeTextSequence"),c=0,g(y)):qe(y)?(t.enter("lineEnding"),t.consume(y),t.exit("lineEnding"),x):(t.enter("codeTextData"),f(y))}function f(y){return y===null||y===32||y===96||qe(y)?(t.exit("codeTextData"),x(y)):(t.consume(y),f)}function g(y){return y===96?(t.consume(y),c++,g):c===i?(t.exit("codeTextSequence"),t.exit("codeText"),l(y)):(u.type="codeTextData",f(y))}}class ww{constructor(l){this.left=l?[...l]:[],this.right=[]}get(l){if(l<0||l>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+l+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return l<this.left.length?this.left[l]:this.right[this.right.length-l+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(l,r){const i=r??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(l,i):l>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-l+this.left.length).reverse():this.left.slice(l).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(l,r,i){const c=r||0;this.setCursor(Math.trunc(l));const u=this.right.splice(this.right.length-c,Number.POSITIVE_INFINITY);return i&&gs(this.left,i),u.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(l){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(l)}pushMany(l){this.setCursor(Number.POSITIVE_INFINITY),gs(this.left,l)}unshift(l){this.setCursor(0),this.right.push(l)}unshiftMany(l){this.setCursor(0),gs(this.right,l.reverse())}setCursor(l){if(!(l===this.left.length||l>this.left.length&&this.right.length===0||l<0&&this.left.length===0))if(l<this.left.length){const r=this.left.splice(l,Number.POSITIVE_INFINITY);gs(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-l,Number.POSITIVE_INFINITY);gs(this.left,r.reverse())}}}function gs(t,l){let r=0;if(l.length<1e4)t.push(...l);else for(;r<l.length;)t.push(...l.slice(r,r+1e4)),r+=1e4}function my(t){const l={};let r=-1,i,c,u,d,m,x,f;const g=new ww(t);for(;++r<g.length;){for(;r in l;)r=l[r];if(i=g.get(r),r&&i[1].type==="chunkFlow"&&g.get(r-1)[1].type==="listItemPrefix"&&(x=i[1]._tokenizer.events,u=0,u<x.length&&x[u][1].type==="lineEndingBlank"&&(u+=2),u<x.length&&x[u][1].type==="content"))for(;++u<x.length&&x[u][1].type!=="content";)x[u][1].type==="chunkText"&&(x[u][1]._isInFirstContentOfListItem=!0,u++);if(i[0]==="enter")i[1].contentType&&(Object.assign(l,kw(g,r)),r=l[r],f=!0);else if(i[1]._container){for(u=r,c=void 0;u--;)if(d=g.get(u),d[1].type==="lineEnding"||d[1].type==="lineEndingBlank")d[0]==="enter"&&(c&&(g.get(c)[1].type="lineEndingBlank"),d[1].type="lineEnding",c=u);else if(!(d[1].type==="linePrefix"||d[1].type==="listItemIndent"))break;c&&(i[1].end={...g.get(c)[1].start},m=g.slice(c,r),m.unshift(i),g.splice(c,r-c+1,m))}}return Qn(t,0,Number.POSITIVE_INFINITY,g.slice(0)),!f}function kw(t,l){const r=t.get(l)[1],i=t.get(l)[2];let c=l-1;const u=[];let d=r._tokenizer;d||(d=i.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(d._contentTypeTextTrailing=!0));const m=d.events,x=[],f={};let g,y,b=-1,v=r,S=0,j=0;const E=[j];for(;v;){for(;t.get(++c)[1]!==v;);u.push(c),v._tokenizer||(g=i.sliceStream(v),v.next||g.push(null),y&&d.defineSkip(v.start),v._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=!0),d.write(g),v._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=void 0)),y=v,v=v.next}for(v=r;++b<m.length;)m[b][0]==="exit"&&m[b-1][0]==="enter"&&m[b][1].type===m[b-1][1].type&&m[b][1].start.line!==m[b][1].end.line&&(j=b+1,E.push(j),v._tokenizer=void 0,v.previous=void 0,v=v.next);for(d.events=[],v?(v._tokenizer=void 0,v.previous=void 0):E.pop(),b=E.length;b--;){const C=m.slice(E[b],E[b+1]),A=u.pop();x.push([A,A+C.length-1]),t.splice(A,2,C)}for(x.reverse(),b=-1;++b<x.length;)f[S+x[b][0]]=S+x[b][1],S+=x[b][1]-x[b][0]-1;return f}const jw={resolve:Cw,tokenize:Ew},Sw={partial:!0,tokenize:Nw};function Cw(t){return my(t),t}function Ew(t,l){let r;return i;function i(m){return t.enter("content"),r=t.enter("chunkContent",{contentType:"content"}),c(m)}function c(m){return m===null?u(m):qe(m)?t.check(Sw,d,u)(m):(t.consume(m),c)}function u(m){return t.exit("chunkContent"),t.exit("content"),l(m)}function d(m){return t.consume(m),t.exit("chunkContent"),r.next=t.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,c}}function Nw(t,l,r){const i=this;return c;function c(d){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),pt(t,u,"linePrefix")}function u(d){if(d===null||qe(d))return r(d);const m=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?l(d):t.interrupt(i.parser.constructs.flow,r,l)(d)}}function xy(t,l,r,i,c,u,d,m,x){const f=x||Number.POSITIVE_INFINITY;let g=0;return y;function y(C){return C===60?(t.enter(i),t.enter(c),t.enter(u),t.consume(C),t.exit(u),b):C===null||C===32||C===41||Sc(C)?r(C):(t.enter(i),t.enter(d),t.enter(m),t.enter("chunkString",{contentType:"string"}),j(C))}function b(C){return C===62?(t.enter(u),t.consume(C),t.exit(u),t.exit(c),t.exit(i),l):(t.enter(m),t.enter("chunkString",{contentType:"string"}),v(C))}function v(C){return C===62?(t.exit("chunkString"),t.exit(m),b(C)):C===null||C===60||qe(C)?r(C):(t.consume(C),C===92?S:v)}function S(C){return C===60||C===62||C===92?(t.consume(C),v):v(C)}function j(C){return!g&&(C===null||C===41||Ft(C))?(t.exit("chunkString"),t.exit(m),t.exit(d),t.exit(i),l(C)):g<f&&C===40?(t.consume(C),g++,j):C===41?(t.consume(C),g--,j):C===null||C===32||C===40||Sc(C)?r(C):(t.consume(C),C===92?E:j)}function E(C){return C===40||C===41||C===92?(t.consume(C),j):j(C)}}function py(t,l,r,i,c,u){const d=this;let m=0,x;return f;function f(v){return t.enter(i),t.enter(c),t.consume(v),t.exit(c),t.enter(u),g}function g(v){return m>999||v===null||v===91||v===93&&!x||v===94&&!m&&"_hiddenFootnoteSupport"in d.parser.constructs?r(v):v===93?(t.exit(u),t.enter(c),t.consume(v),t.exit(c),t.exit(i),l):qe(v)?(t.enter("lineEnding"),t.consume(v),t.exit("lineEnding"),g):(t.enter("chunkString",{contentType:"string"}),y(v))}function y(v){return v===null||v===91||v===93||qe(v)||m++>999?(t.exit("chunkString"),g(v)):(t.consume(v),x||(x=!ct(v)),v===92?b:y)}function b(v){return v===91||v===92||v===93?(t.consume(v),m++,y):y(v)}}function yy(t,l,r,i,c,u){let d;return m;function m(b){return b===34||b===39||b===40?(t.enter(i),t.enter(c),t.consume(b),t.exit(c),d=b===40?41:b,x):r(b)}function x(b){return b===d?(t.enter(c),t.consume(b),t.exit(c),t.exit(i),l):(t.enter(u),f(b))}function f(b){return b===d?(t.exit(u),x(d)):b===null?r(b):qe(b)?(t.enter("lineEnding"),t.consume(b),t.exit("lineEnding"),pt(t,f,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===d||b===null||qe(b)?(t.exit("chunkString"),f(b)):(t.consume(b),b===92?y:g)}function y(b){return b===d||b===92?(t.consume(b),g):g(b)}}function Ts(t,l){let r;return i;function i(c){return qe(c)?(t.enter("lineEnding"),t.consume(c),t.exit("lineEnding"),r=!0,i):ct(c)?pt(t,i,r?"linePrefix":"lineSuffix")(c):l(c)}}const Aw={name:"definition",tokenize:Dw},Tw={partial:!0,tokenize:zw};function Dw(t,l,r){const i=this;let c;return u;function u(v){return t.enter("definition"),d(v)}function d(v){return py.call(i,t,m,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function m(v){return c=bl(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),v===58?(t.enter("definitionMarker"),t.consume(v),t.exit("definitionMarker"),x):r(v)}function x(v){return Ft(v)?Ts(t,f)(v):f(v)}function f(v){return xy(t,g,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function g(v){return t.attempt(Tw,y,y)(v)}function y(v){return ct(v)?pt(t,b,"whitespace")(v):b(v)}function b(v){return v===null||qe(v)?(t.exit("definition"),i.parser.defined.push(c),l(v)):r(v)}}function zw(t,l,r){return i;function i(m){return Ft(m)?Ts(t,c)(m):r(m)}function c(m){return yy(t,u,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(m)}function u(m){return ct(m)?pt(t,d,"whitespace")(m):d(m)}function d(m){return m===null||qe(m)?l(m):r(m)}}const Mw={name:"hardBreakEscape",tokenize:Fw};function Fw(t,l,r){return i;function i(u){return t.enter("hardBreakEscape"),t.consume(u),c}function c(u){return qe(u)?(t.exit("hardBreakEscape"),l(u)):r(u)}}const Rw={name:"headingAtx",resolve:_w,tokenize:Ow};function _w(t,l){let r=t.length-2,i=3,c,u;return t[i][1].type==="whitespace"&&(i+=2),r-2>i&&t[r][1].type==="whitespace"&&(r-=2),t[r][1].type==="atxHeadingSequence"&&(i===r-1||r-4>i&&t[r-2][1].type==="whitespace")&&(r-=i+1===r?2:4),r>i&&(c={type:"atxHeadingText",start:t[i][1].start,end:t[r][1].end},u={type:"chunkText",start:t[i][1].start,end:t[r][1].end,contentType:"text"},Qn(t,i,r-i+1,[["enter",c,l],["enter",u,l],["exit",u,l],["exit",c,l]])),t}function Ow(t,l,r){let i=0;return c;function c(g){return t.enter("atxHeading"),u(g)}function u(g){return t.enter("atxHeadingSequence"),d(g)}function d(g){return g===35&&i++<6?(t.consume(g),d):g===null||Ft(g)?(t.exit("atxHeadingSequence"),m(g)):r(g)}function m(g){return g===35?(t.enter("atxHeadingSequence"),x(g)):g===null||qe(g)?(t.exit("atxHeading"),l(g)):ct(g)?pt(t,m,"whitespace")(g):(t.enter("atxHeadingText"),f(g))}function x(g){return g===35?(t.consume(g),x):(t.exit("atxHeadingSequence"),m(g))}function f(g){return g===null||g===35||Ft(g)?(t.exit("atxHeadingText"),m(g)):(t.consume(g),f)}}const Bw=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],_1=["pre","script","style","textarea"],Lw={concrete:!0,name:"htmlFlow",resolveTo:Uw,tokenize:Iw},$w={partial:!0,tokenize:qw},Hw={partial:!0,tokenize:Yw};function Uw(t){let l=t.length;for(;l--&&!(t[l][0]==="enter"&&t[l][1].type==="htmlFlow"););return l>1&&t[l-2][1].type==="linePrefix"&&(t[l][1].start=t[l-2][1].start,t[l+1][1].start=t[l-2][1].start,t.splice(l-2,2)),t}function Iw(t,l,r){const i=this;let c,u,d,m,x;return f;function f(T){return g(T)}function g(T){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(T),y}function y(T){return T===33?(t.consume(T),b):T===47?(t.consume(T),u=!0,j):T===63?(t.consume(T),c=3,i.interrupt?l:z):En(T)?(t.consume(T),d=String.fromCharCode(T),E):r(T)}function b(T){return T===45?(t.consume(T),c=2,v):T===91?(t.consume(T),c=5,m=0,S):En(T)?(t.consume(T),c=4,i.interrupt?l:z):r(T)}function v(T){return T===45?(t.consume(T),i.interrupt?l:z):r(T)}function S(T){const fe="CDATA[";return T===fe.charCodeAt(m++)?(t.consume(T),m===fe.length?i.interrupt?l:B:S):r(T)}function j(T){return En(T)?(t.consume(T),d=String.fromCharCode(T),E):r(T)}function E(T){if(T===null||T===47||T===62||Ft(T)){const fe=T===47,Ee=d.toLowerCase();return!fe&&!u&&_1.includes(Ee)?(c=1,i.interrupt?l(T):B(T)):Bw.includes(d.toLowerCase())?(c=6,fe?(t.consume(T),C):i.interrupt?l(T):B(T)):(c=7,i.interrupt&&!i.parser.lazy[i.now().line]?r(T):u?A(T):F(T))}return T===45||kn(T)?(t.consume(T),d+=String.fromCharCode(T),E):r(T)}function C(T){return T===62?(t.consume(T),i.interrupt?l:B):r(T)}function A(T){return ct(T)?(t.consume(T),A):D(T)}function F(T){return T===47?(t.consume(T),D):T===58||T===95||En(T)?(t.consume(T),_):ct(T)?(t.consume(T),F):D(T)}function _(T){return T===45||T===46||T===58||T===95||kn(T)?(t.consume(T),_):H(T)}function H(T){return T===61?(t.consume(T),M):ct(T)?(t.consume(T),H):F(T)}function M(T){return T===null||T===60||T===61||T===62||T===96?r(T):T===34||T===39?(t.consume(T),x=T,I):ct(T)?(t.consume(T),M):W(T)}function I(T){return T===x?(t.consume(T),x=null,te):T===null||qe(T)?r(T):(t.consume(T),I)}function W(T){return T===null||T===34||T===39||T===47||T===60||T===61||T===62||T===96||Ft(T)?H(T):(t.consume(T),W)}function te(T){return T===47||T===62||ct(T)?F(T):r(T)}function D(T){return T===62?(t.consume(T),Y):r(T)}function Y(T){return T===null||qe(T)?B(T):ct(T)?(t.consume(T),Y):r(T)}function B(T){return T===45&&c===2?(t.consume(T),L):T===60&&c===1?(t.consume(T),Z):T===62&&c===4?(t.consume(T),R):T===63&&c===3?(t.consume(T),z):T===93&&c===5?(t.consume(T),ue):qe(T)&&(c===6||c===7)?(t.exit("htmlFlowData"),t.check($w,K,V)(T)):T===null||qe(T)?(t.exit("htmlFlowData"),V(T)):(t.consume(T),B)}function V(T){return t.check(Hw,ne,K)(T)}function ne(T){return t.enter("lineEnding"),t.consume(T),t.exit("lineEnding"),G}function G(T){return T===null||qe(T)?V(T):(t.enter("htmlFlowData"),B(T))}function L(T){return T===45?(t.consume(T),z):B(T)}function Z(T){return T===47?(t.consume(T),d="",de):B(T)}function de(T){if(T===62){const fe=d.toLowerCase();return _1.includes(fe)?(t.consume(T),R):B(T)}return En(T)&&d.length<8?(t.consume(T),d+=String.fromCharCode(T),de):B(T)}function ue(T){return T===93?(t.consume(T),z):B(T)}function z(T){return T===62?(t.consume(T),R):T===45&&c===2?(t.consume(T),z):B(T)}function R(T){return T===null||qe(T)?(t.exit("htmlFlowData"),K(T)):(t.consume(T),R)}function K(T){return t.exit("htmlFlow"),l(T)}}function Yw(t,l,r){const i=this;return c;function c(d){return qe(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),u):r(d)}function u(d){return i.parser.lazy[i.now().line]?r(d):l(d)}}function qw(t,l,r){return i;function i(c){return t.enter("lineEnding"),t.consume(c),t.exit("lineEnding"),t.attempt(Hs,l,r)}}const Xw={name:"htmlText",tokenize:Vw};function Vw(t,l,r){const i=this;let c,u,d;return m;function m(z){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(z),x}function x(z){return z===33?(t.consume(z),f):z===47?(t.consume(z),H):z===63?(t.consume(z),F):En(z)?(t.consume(z),W):r(z)}function f(z){return z===45?(t.consume(z),g):z===91?(t.consume(z),u=0,S):En(z)?(t.consume(z),A):r(z)}function g(z){return z===45?(t.consume(z),v):r(z)}function y(z){return z===null?r(z):z===45?(t.consume(z),b):qe(z)?(d=y,Z(z)):(t.consume(z),y)}function b(z){return z===45?(t.consume(z),v):y(z)}function v(z){return z===62?L(z):z===45?b(z):y(z)}function S(z){const R="CDATA[";return z===R.charCodeAt(u++)?(t.consume(z),u===R.length?j:S):r(z)}function j(z){return z===null?r(z):z===93?(t.consume(z),E):qe(z)?(d=j,Z(z)):(t.consume(z),j)}function E(z){return z===93?(t.consume(z),C):j(z)}function C(z){return z===62?L(z):z===93?(t.consume(z),C):j(z)}function A(z){return z===null||z===62?L(z):qe(z)?(d=A,Z(z)):(t.consume(z),A)}function F(z){return z===null?r(z):z===63?(t.consume(z),_):qe(z)?(d=F,Z(z)):(t.consume(z),F)}function _(z){return z===62?L(z):F(z)}function H(z){return En(z)?(t.consume(z),M):r(z)}function M(z){return z===45||kn(z)?(t.consume(z),M):I(z)}function I(z){return qe(z)?(d=I,Z(z)):ct(z)?(t.consume(z),I):L(z)}function W(z){return z===45||kn(z)?(t.consume(z),W):z===47||z===62||Ft(z)?te(z):r(z)}function te(z){return z===47?(t.consume(z),L):z===58||z===95||En(z)?(t.consume(z),D):qe(z)?(d=te,Z(z)):ct(z)?(t.consume(z),te):L(z)}function D(z){return z===45||z===46||z===58||z===95||kn(z)?(t.consume(z),D):Y(z)}function Y(z){return z===61?(t.consume(z),B):qe(z)?(d=Y,Z(z)):ct(z)?(t.consume(z),Y):te(z)}function B(z){return z===null||z===60||z===61||z===62||z===96?r(z):z===34||z===39?(t.consume(z),c=z,V):qe(z)?(d=B,Z(z)):ct(z)?(t.consume(z),B):(t.consume(z),ne)}function V(z){return z===c?(t.consume(z),c=void 0,G):z===null?r(z):qe(z)?(d=V,Z(z)):(t.consume(z),V)}function ne(z){return z===null||z===34||z===39||z===60||z===61||z===96?r(z):z===47||z===62||Ft(z)?te(z):(t.consume(z),ne)}function G(z){return z===47||z===62||Ft(z)?te(z):r(z)}function L(z){return z===62?(t.consume(z),t.exit("htmlTextData"),t.exit("htmlText"),l):r(z)}function Z(z){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(z),t.exit("lineEnding"),de}function de(z){return ct(z)?pt(t,ue,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):ue(z)}function ue(z){return t.enter("htmlTextData"),d(z)}}const dh={name:"labelEnd",resolveAll:Ww,resolveTo:Zw,tokenize:Jw},Gw={tokenize:Pw},Kw={tokenize:e5},Qw={tokenize:t5};function Ww(t){let l=-1;const r=[];for(;++l<t.length;){const i=t[l][1];if(r.push(t[l]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const c=i.type==="labelImage"?4:2;i.type="data",l+=c}}return t.length!==r.length&&Qn(t,0,t.length,r),t}function Zw(t,l){let r=t.length,i=0,c,u,d,m;for(;r--;)if(c=t[r][1],u){if(c.type==="link"||c.type==="labelLink"&&c._inactive)break;t[r][0]==="enter"&&c.type==="labelLink"&&(c._inactive=!0)}else if(d){if(t[r][0]==="enter"&&(c.type==="labelImage"||c.type==="labelLink")&&!c._balanced&&(u=r,c.type!=="labelLink")){i=2;break}}else c.type==="labelEnd"&&(d=r);const x={type:t[u][1].type==="labelLink"?"link":"image",start:{...t[u][1].start},end:{...t[t.length-1][1].end}},f={type:"label",start:{...t[u][1].start},end:{...t[d][1].end}},g={type:"labelText",start:{...t[u+i+2][1].end},end:{...t[d-2][1].start}};return m=[["enter",x,l],["enter",f,l]],m=sl(m,t.slice(u+1,u+i+3)),m=sl(m,[["enter",g,l]]),m=sl(m,_c(l.parser.constructs.insideSpan.null,t.slice(u+i+4,d-3),l)),m=sl(m,[["exit",g,l],t[d-2],t[d-1],["exit",f,l]]),m=sl(m,t.slice(d+1)),m=sl(m,[["exit",x,l]]),Qn(t,u,t.length,m),t}function Jw(t,l,r){const i=this;let c=i.events.length,u,d;for(;c--;)if((i.events[c][1].type==="labelImage"||i.events[c][1].type==="labelLink")&&!i.events[c][1]._balanced){u=i.events[c][1];break}return m;function m(b){return u?u._inactive?y(b):(d=i.parser.defined.includes(bl(i.sliceSerialize({start:u.end,end:i.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(b),t.exit("labelMarker"),t.exit("labelEnd"),x):r(b)}function x(b){return b===40?t.attempt(Gw,g,d?g:y)(b):b===91?t.attempt(Kw,g,d?f:y)(b):d?g(b):y(b)}function f(b){return t.attempt(Qw,g,y)(b)}function g(b){return l(b)}function y(b){return u._balanced=!0,r(b)}}function Pw(t,l,r){return i;function i(y){return t.enter("resource"),t.enter("resourceMarker"),t.consume(y),t.exit("resourceMarker"),c}function c(y){return Ft(y)?Ts(t,u)(y):u(y)}function u(y){return y===41?g(y):xy(t,d,m,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(y)}function d(y){return Ft(y)?Ts(t,x)(y):g(y)}function m(y){return r(y)}function x(y){return y===34||y===39||y===40?yy(t,f,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(y):g(y)}function f(y){return Ft(y)?Ts(t,g)(y):g(y)}function g(y){return y===41?(t.enter("resourceMarker"),t.consume(y),t.exit("resourceMarker"),t.exit("resource"),l):r(y)}}function e5(t,l,r){const i=this;return c;function c(m){return py.call(i,t,u,d,"reference","referenceMarker","referenceString")(m)}function u(m){return i.parser.defined.includes(bl(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?l(m):r(m)}function d(m){return r(m)}}function t5(t,l,r){return i;function i(u){return t.enter("reference"),t.enter("referenceMarker"),t.consume(u),t.exit("referenceMarker"),c}function c(u){return u===93?(t.enter("referenceMarker"),t.consume(u),t.exit("referenceMarker"),t.exit("reference"),l):r(u)}}const n5={name:"labelStartImage",resolveAll:dh.resolveAll,tokenize:l5};function l5(t,l,r){const i=this;return c;function c(m){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(m),t.exit("labelImageMarker"),u}function u(m){return m===91?(t.enter("labelMarker"),t.consume(m),t.exit("labelMarker"),t.exit("labelImage"),d):r(m)}function d(m){return m===94&&"_hiddenFootnoteSupport"in i.parser.constructs?r(m):l(m)}}const r5={name:"labelStartLink",resolveAll:dh.resolveAll,tokenize:a5};function a5(t,l,r){const i=this;return c;function c(d){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(d),t.exit("labelMarker"),t.exit("labelLink"),u}function u(d){return d===94&&"_hiddenFootnoteSupport"in i.parser.constructs?r(d):l(d)}}const tf={name:"lineEnding",tokenize:i5};function i5(t,l){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),pt(t,l,"linePrefix")}}const gc={name:"thematicBreak",tokenize:s5};function s5(t,l,r){let i=0,c;return u;function u(f){return t.enter("thematicBreak"),d(f)}function d(f){return c=f,m(f)}function m(f){return f===c?(t.enter("thematicBreakSequence"),x(f)):i>=3&&(f===null||qe(f))?(t.exit("thematicBreak"),l(f)):r(f)}function x(f){return f===c?(t.consume(f),i++,x):(t.exit("thematicBreakSequence"),ct(f)?pt(t,m,"whitespace")(f):m(f))}}const Bn={continuation:{tokenize:d5},exit:h5,name:"list",tokenize:u5},o5={partial:!0,tokenize:m5},c5={partial:!0,tokenize:f5};function u5(t,l,r){const i=this,c=i.events[i.events.length-1];let u=c&&c[1].type==="linePrefix"?c[2].sliceSerialize(c[1],!0).length:0,d=0;return m;function m(v){const S=i.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(S==="listUnordered"?!i.containerState.marker||v===i.containerState.marker:Hf(v)){if(i.containerState.type||(i.containerState.type=S,t.enter(S,{_container:!0})),S==="listUnordered")return t.enter("listItemPrefix"),v===42||v===45?t.check(gc,r,f)(v):f(v);if(!i.interrupt||v===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),x(v)}return r(v)}function x(v){return Hf(v)&&++d<10?(t.consume(v),x):(!i.interrupt||d<2)&&(i.containerState.marker?v===i.containerState.marker:v===41||v===46)?(t.exit("listItemValue"),f(v)):r(v)}function f(v){return t.enter("listItemMarker"),t.consume(v),t.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||v,t.check(Hs,i.interrupt?r:g,t.attempt(o5,b,y))}function g(v){return i.containerState.initialBlankLine=!0,u++,b(v)}function y(v){return ct(v)?(t.enter("listItemPrefixWhitespace"),t.consume(v),t.exit("listItemPrefixWhitespace"),b):r(v)}function b(v){return i.containerState.size=u+i.sliceSerialize(t.exit("listItemPrefix"),!0).length,l(v)}}function d5(t,l,r){const i=this;return i.containerState._closeFlow=void 0,t.check(Hs,c,u);function c(m){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,pt(t,l,"listItemIndent",i.containerState.size+1)(m)}function u(m){return i.containerState.furtherBlankLines||!ct(m)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,d(m)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,t.attempt(c5,l,d)(m))}function d(m){return i.containerState._closeFlow=!0,i.interrupt=void 0,pt(t,t.attempt(Bn,l,r),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(m)}}function f5(t,l,r){const i=this;return pt(t,c,"listItemIndent",i.containerState.size+1);function c(u){const d=i.events[i.events.length-1];return d&&d[1].type==="listItemIndent"&&d[2].sliceSerialize(d[1],!0).length===i.containerState.size?l(u):r(u)}}function h5(t){t.exit(this.containerState.type)}function m5(t,l,r){const i=this;return pt(t,c,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function c(u){const d=i.events[i.events.length-1];return!ct(u)&&d&&d[1].type==="listItemPrefixWhitespace"?l(u):r(u)}}const O1={name:"setextUnderline",resolveTo:x5,tokenize:p5};function x5(t,l){let r=t.length,i,c,u;for(;r--;)if(t[r][0]==="enter"){if(t[r][1].type==="content"){i=r;break}t[r][1].type==="paragraph"&&(c=r)}else t[r][1].type==="content"&&t.splice(r,1),!u&&t[r][1].type==="definition"&&(u=r);const d={type:"setextHeading",start:{...t[i][1].start},end:{...t[t.length-1][1].end}};return t[c][1].type="setextHeadingText",u?(t.splice(c,0,["enter",d,l]),t.splice(u+1,0,["exit",t[i][1],l]),t[i][1].end={...t[u][1].end}):t[i][1]=d,t.push(["exit",d,l]),t}function p5(t,l,r){const i=this;let c;return u;function u(f){let g=i.events.length,y;for(;g--;)if(i.events[g][1].type!=="lineEnding"&&i.events[g][1].type!=="linePrefix"&&i.events[g][1].type!=="content"){y=i.events[g][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||y)?(t.enter("setextHeadingLine"),c=f,d(f)):r(f)}function d(f){return t.enter("setextHeadingLineSequence"),m(f)}function m(f){return f===c?(t.consume(f),m):(t.exit("setextHeadingLineSequence"),ct(f)?pt(t,x,"lineSuffix")(f):x(f))}function x(f){return f===null||qe(f)?(t.exit("setextHeadingLine"),l(f)):r(f)}}const y5={tokenize:g5};function g5(t){const l=this,r=t.attempt(Hs,i,t.attempt(this.parser.constructs.flowInitial,c,pt(t,t.attempt(this.parser.constructs.flow,c,t.attempt(jw,c)),"linePrefix")));return r;function i(u){if(u===null){t.consume(u);return}return t.enter("lineEndingBlank"),t.consume(u),t.exit("lineEndingBlank"),l.currentConstruct=void 0,r}function c(u){if(u===null){t.consume(u);return}return t.enter("lineEnding"),t.consume(u),t.exit("lineEnding"),l.currentConstruct=void 0,r}}const b5={resolveAll:by()},v5=gy("string"),w5=gy("text");function gy(t){return{resolveAll:by(t==="text"?k5:void 0),tokenize:l};function l(r){const i=this,c=this.parser.constructs[t],u=r.attempt(c,d,m);return d;function d(g){return f(g)?u(g):m(g)}function m(g){if(g===null){r.consume(g);return}return r.enter("data"),r.consume(g),x}function x(g){return f(g)?(r.exit("data"),u(g)):(r.consume(g),x)}function f(g){if(g===null)return!0;const y=c[g];let b=-1;if(y)for(;++b<y.length;){const v=y[b];if(!v.previous||v.previous.call(i,i.previous))return!0}return!1}}}function by(t){return l;function l(r,i){let c=-1,u;for(;++c<=r.length;)u===void 0?r[c]&&r[c][1].type==="data"&&(u=c,c++):(!r[c]||r[c][1].type!=="data")&&(c!==u+2&&(r[u][1].end=r[c-1][1].end,r.splice(u+2,c-u-2),c=u+2),u=void 0);return t?t(r,i):r}}function k5(t,l){let r=0;for(;++r<=t.length;)if((r===t.length||t[r][1].type==="lineEnding")&&t[r-1][1].type==="data"){const i=t[r-1][1],c=l.sliceStream(i);let u=c.length,d=-1,m=0,x;for(;u--;){const f=c[u];if(typeof f=="string"){for(d=f.length;f.charCodeAt(d-1)===32;)m++,d--;if(d)break;d=-1}else if(f===-2)x=!0,m++;else if(f!==-1){u++;break}}if(l._contentTypeTextTrailing&&r===t.length&&(m=0),m){const f={type:r===t.length||x||m<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?d:i.start._bufferIndex+d,_index:i.start._index+u,line:i.end.line,column:i.end.column-m,offset:i.end.offset-m},end:{...i.end}};i.end={...f.start},i.start.offset===i.end.offset?Object.assign(i,f):(t.splice(r,0,["enter",f,l],["exit",f,l]),r+=2)}r++}return t}const j5={42:Bn,43:Bn,45:Bn,48:Bn,49:Bn,50:Bn,51:Bn,52:Bn,53:Bn,54:Bn,55:Bn,56:Bn,57:Bn,62:dy},S5={91:Aw},C5={[-2]:ef,[-1]:ef,32:ef},E5={35:Rw,42:gc,45:[O1,gc],60:Lw,61:O1,95:gc,96:R1,126:R1},N5={38:hy,92:fy},A5={[-5]:tf,[-4]:tf,[-3]:tf,33:n5,38:hy,42:Uf,60:[rw,Xw],91:r5,92:[Mw,fy],93:dh,95:Uf,96:yw},T5={null:[Uf,b5]},D5={null:[42,95]},z5={null:[]},M5=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:D5,contentInitial:S5,disable:z5,document:j5,flow:E5,flowInitial:C5,insideSpan:T5,string:N5,text:A5},Symbol.toStringTag,{value:"Module"}));function F5(t,l,r){let i={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const c={},u=[];let d=[],m=[];const x={attempt:I(H),check:I(M),consume:A,enter:F,exit:_,interrupt:I(M,{interrupt:!0})},f={code:null,containerState:{},defineSkip:j,events:[],now:S,parser:t,previous:null,sliceSerialize:b,sliceStream:v,write:y};let g=l.tokenize.call(f,x);return l.resolveAll&&u.push(l),f;function y(Y){return d=sl(d,Y),E(),d[d.length-1]!==null?[]:(W(l,0),f.events=_c(u,f.events,f),f.events)}function b(Y,B){return _5(v(Y),B)}function v(Y){return R5(d,Y)}function S(){const{_bufferIndex:Y,_index:B,line:V,column:ne,offset:G}=i;return{_bufferIndex:Y,_index:B,line:V,column:ne,offset:G}}function j(Y){c[Y.line]=Y.column,D()}function E(){let Y;for(;i._index<d.length;){const B=d[i._index];if(typeof B=="string")for(Y=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===Y&&i._bufferIndex<B.length;)C(B.charCodeAt(i._bufferIndex));else C(B)}}function C(Y){g=g(Y)}function A(Y){qe(Y)?(i.line++,i.column=1,i.offset+=Y===-3?2:1,D()):Y!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===d[i._index].length&&(i._bufferIndex=-1,i._index++)),f.previous=Y}function F(Y,B){const V=B||{};return V.type=Y,V.start=S(),f.events.push(["enter",V,f]),m.push(V),V}function _(Y){const B=m.pop();return B.end=S(),f.events.push(["exit",B,f]),B}function H(Y,B){W(Y,B.from)}function M(Y,B){B.restore()}function I(Y,B){return V;function V(ne,G,L){let Z,de,ue,z;return Array.isArray(ne)?K(ne):"tokenize"in ne?K([ne]):R(ne);function R(Ne){return Le;function Le(Be){const Qe=Be!==null&&Ne[Be],Se=Be!==null&&Ne.null,tt=[...Array.isArray(Qe)?Qe:Qe?[Qe]:[],...Array.isArray(Se)?Se:Se?[Se]:[]];return K(tt)(Be)}}function K(Ne){return Z=Ne,de=0,Ne.length===0?L:T(Ne[de])}function T(Ne){return Le;function Le(Be){return z=te(),ue=Ne,Ne.partial||(f.currentConstruct=Ne),Ne.name&&f.parser.constructs.disable.null.includes(Ne.name)?Ee():Ne.tokenize.call(B?Object.assign(Object.create(f),B):f,x,fe,Ee)(Be)}}function fe(Ne){return Y(ue,z),G}function Ee(Ne){return z.restore(),++de<Z.length?T(Z[de]):L}}}function W(Y,B){Y.resolveAll&&!u.includes(Y)&&u.push(Y),Y.resolve&&Qn(f.events,B,f.events.length-B,Y.resolve(f.events.slice(B),f)),Y.resolveTo&&(f.events=Y.resolveTo(f.events,f))}function te(){const Y=S(),B=f.previous,V=f.currentConstruct,ne=f.events.length,G=Array.from(m);return{from:ne,restore:L};function L(){i=Y,f.previous=B,f.currentConstruct=V,f.events.length=ne,m=G,D()}}function D(){i.line in c&&i.column<2&&(i.column=c[i.line],i.offset+=c[i.line]-1)}}function R5(t,l){const r=l.start._index,i=l.start._bufferIndex,c=l.end._index,u=l.end._bufferIndex;let d;if(r===c)d=[t[r].slice(i,u)];else{if(d=t.slice(r,c),i>-1){const m=d[0];typeof m=="string"?d[0]=m.slice(i):d.shift()}u>0&&d.push(t[c].slice(0,u))}return d}function _5(t,l){let r=-1;const i=[];let c;for(;++r<t.length;){const u=t[r];let d;if(typeof u=="string")d=u;else switch(u){case-5:{d="\r";break}case-4:{d=`
|
|
52
52
|
`;break}case-3:{d=`\r
|
|
53
|
-
`;break}case-2:{d=l?" ":" ";break}case-1:{if(!l&&c)continue;d=" ";break}default:d=String.fromCharCode(u)}c=u===-2,i.push(d)}return i.join("")}function O5(t){const i={constructs:sy([M5,...(t||{}).extensions||[]]),content:c(Zv),defined:[],document:c(Pv),flow:c(y5),lazy:{},string:c(v5),text:c(w5)};return i;function c(u){return d;function d(m){return F5(i,u,m)}}}function B5(t){for(;!fy(t););return t}const _1=/[\0\t\n\r]/g;function L5(){let t=1,l="",r=!0,i;return c;function c(u,d,m){const x=[];let f,g,y,b,v;for(u=l+(typeof u=="string"?u.toString():new TextDecoder(d||void 0).decode(u)),y=0,l="",r&&(u.charCodeAt(0)===65279&&y++,r=void 0);y<u.length;){if(_1.lastIndex=y,f=_1.exec(u),b=f&&f.index!==void 0?f.index:u.length,v=u.charCodeAt(b),!f){l=u.slice(y);break}if(v===10&&y===b&&i)x.push(-3),i=void 0;else switch(i&&(x.push(-5),i=void 0),y<b&&(x.push(u.slice(y,b)),t+=b-y),v){case 0:{x.push(65533),t++;break}case 9:{for(g=Math.ceil(t/4)*4,x.push(-2);t++<g;)x.push(-1);break}case 10:{x.push(-4),t=1;break}default:i=!0,t=1}y=b+1}return m&&(i&&x.push(-5),l&&x.push(l),x.push(null)),x}}const $5=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function H5(t){return t.replace($5,U5)}function U5(t,l,r){if(l)return l;if(r.charCodeAt(0)===35){const c=r.charCodeAt(1),u=c===120||c===88;return oy(r.slice(u?2:1),u?16:10)}return uh(r)||t}const gy={}.hasOwnProperty;function I5(t,l,r){return l&&typeof l=="object"&&(r=l,l=void 0),Y5(r)(B5(O5(r).document().write(L5()(t,l,!0))))}function Y5(t){const l={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(je),autolinkProtocol:te,autolinkEmail:te,atxHeading:u(ke),blockQuote:u(Se),characterEscape:te,characterReference:te,codeFenced:u(tt),codeFencedFenceInfo:d,codeFencedFenceMeta:d,codeIndented:u(tt,d),codeText:u(me,d),codeTextData:te,data:te,codeFlowValue:te,definition:u(he),definitionDestinationString:d,definitionLabelString:d,definitionTitleString:d,emphasis:u(ge),hardBreakEscape:u(Fe),hardBreakTrailing:u(Fe),htmlFlow:u(Ae,d),htmlFlowData:te,htmlText:u(Ae,d),htmlTextData:te,image:u(De),label:d,link:u(je),listItem:u(Ke),listItemValue:b,listOrdered:u(_e,y),listUnordered:u(_e),paragraph:u(Et),reference:T,referenceString:d,resourceDestinationString:d,resourceTitleString:d,setextHeading:u(ke),strong:u(Ht),thematicBreak:u(Rt)},exit:{atxHeading:x(),atxHeadingSequence:H,autolink:x(),autolinkEmail:Qe,autolinkProtocol:Be,blockQuote:x(),characterEscapeValue:D,characterReferenceMarkerHexadecimal:Ee,characterReferenceMarkerNumeric:Ee,characterReferenceValue:Ne,characterReference:Le,codeFenced:x(E),codeFencedFence:j,codeFencedFenceInfo:v,codeFencedFenceMeta:S,codeFlowValue:D,codeIndented:x(C),codeText:x(G),codeTextData:D,data:D,definition:x(),definitionDestinationString:_,definitionLabelString:A,definitionTitleString:F,emphasis:x(),hardBreakEscape:x(B),hardBreakTrailing:x(B),htmlFlow:x(V),htmlFlowData:D,htmlText:x(ne),htmlTextData:D,image:x(Z),label:ue,labelText:de,lineEnding:Y,link:x(L),listItem:x(),listOrdered:x(),listUnordered:x(),paragraph:x(),referenceString:fe,resourceDestinationString:z,resourceTitleString:R,resource:K,setextHeading:x(W),setextHeadingLineSequence:I,setextHeadingText:M,strong:x(),thematicBreak:x()}};by(l,(t||{}).mdastExtensions||[]);const r={};return i;function i(re){let pe={type:"root",children:[]};const Te={stack:[pe],tokenStack:[],config:l,enter:m,exit:f,buffer:d,resume:g,data:r},Ye=[];let xe=-1;for(;++xe<re.length;)if(re[xe][1].type==="listOrdered"||re[xe][1].type==="listUnordered")if(re[xe][0]==="enter")Ye.push(xe);else{const q=Ye.pop();xe=c(re,q,xe)}for(xe=-1;++xe<re.length;){const q=l[re[xe][0]];gy.call(q,re[xe][1].type)&&q[re[xe][1].type].call(Object.assign({sliceSerialize:re[xe][2].sliceSerialize},Te),re[xe][1])}if(Te.tokenStack.length>0){const q=Te.tokenStack[Te.tokenStack.length-1];(q[1]||O1).call(Te,void 0,q[0])}for(pe.position={start:Ur(re.length>0?re[0][1].start:{line:1,column:1,offset:0}),end:Ur(re.length>0?re[re.length-2][1].end:{line:1,column:1,offset:0})},xe=-1;++xe<l.transforms.length;)pe=l.transforms[xe](pe)||pe;return pe}function c(re,pe,Te){let Ye=pe-1,xe=-1,q=!1,ze,He,Xe,ht;for(;++Ye<=Te;){const Pe=re[Ye];switch(Pe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Pe[0]==="enter"?xe++:xe--,ht=void 0;break}case"lineEndingBlank":{Pe[0]==="enter"&&(ze&&!ht&&!xe&&!Xe&&(Xe=Ye),ht=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ht=void 0}if(!xe&&Pe[0]==="enter"&&Pe[1].type==="listItemPrefix"||xe===-1&&Pe[0]==="exit"&&(Pe[1].type==="listUnordered"||Pe[1].type==="listOrdered")){if(ze){let We=Ye;for(He=void 0;We--;){const un=re[We];if(un[1].type==="lineEnding"||un[1].type==="lineEndingBlank"){if(un[0]==="exit")continue;He&&(re[He][1].type="lineEndingBlank",q=!0),un[1].type="lineEnding",He=We}else if(!(un[1].type==="linePrefix"||un[1].type==="blockQuotePrefix"||un[1].type==="blockQuotePrefixWhitespace"||un[1].type==="blockQuoteMarker"||un[1].type==="listItemIndent"))break}Xe&&(!He||Xe<He)&&(ze._spread=!0),ze.end=Object.assign({},He?re[He][1].start:Pe[1].end),re.splice(He||Ye,0,["exit",ze,Pe[2]]),Ye++,Te++}if(Pe[1].type==="listItemPrefix"){const We={type:"listItem",_spread:!1,start:Object.assign({},Pe[1].start),end:void 0};ze=We,re.splice(Ye,0,["enter",We,Pe[2]]),Ye++,Te++,Xe=void 0,ht=!0}}}return re[pe][1]._spread=q,Te}function u(re,pe){return Te;function Te(Ye){m.call(this,re(Ye),Ye),pe&&pe.call(this,Ye)}}function d(){this.stack.push({type:"fragment",children:[]})}function m(re,pe,Te){this.stack[this.stack.length-1].children.push(re),this.stack.push(re),this.tokenStack.push([pe,Te||void 0]),re.position={start:Ur(pe.start),end:void 0}}function x(re){return pe;function pe(Te){re&&re.call(this,Te),f.call(this,Te)}}function f(re,pe){const Te=this.stack.pop(),Ye=this.tokenStack.pop();if(Ye)Ye[0].type!==re.type&&(pe?pe.call(this,re,Ye[0]):(Ye[1]||O1).call(this,re,Ye[0]));else throw new Error("Cannot close `"+re.type+"` ("+As({start:re.start,end:re.end})+"): it’s not open");Te.position.end=Ur(re.end)}function g(){return ch(this.stack.pop())}function y(){this.data.expectingFirstListItemValue=!0}function b(re){if(this.data.expectingFirstListItemValue){const pe=this.stack[this.stack.length-2];pe.start=Number.parseInt(this.sliceSerialize(re),10),this.data.expectingFirstListItemValue=void 0}}function v(){const re=this.resume(),pe=this.stack[this.stack.length-1];pe.lang=re}function S(){const re=this.resume(),pe=this.stack[this.stack.length-1];pe.meta=re}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function E(){const re=this.resume(),pe=this.stack[this.stack.length-1];pe.value=re.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function C(){const re=this.resume(),pe=this.stack[this.stack.length-1];pe.value=re.replace(/(\r?\n|\r)$/g,"")}function A(re){const pe=this.resume(),Te=this.stack[this.stack.length-1];Te.label=pe,Te.identifier=bl(this.sliceSerialize(re)).toLowerCase()}function F(){const re=this.resume(),pe=this.stack[this.stack.length-1];pe.title=re}function _(){const re=this.resume(),pe=this.stack[this.stack.length-1];pe.url=re}function H(re){const pe=this.stack[this.stack.length-1];if(!pe.depth){const Te=this.sliceSerialize(re).length;pe.depth=Te}}function M(){this.data.setextHeadingSlurpLineEnding=!0}function I(re){const pe=this.stack[this.stack.length-1];pe.depth=this.sliceSerialize(re).codePointAt(0)===61?1:2}function W(){this.data.setextHeadingSlurpLineEnding=void 0}function te(re){const Te=this.stack[this.stack.length-1].children;let Ye=Te[Te.length-1];(!Ye||Ye.type!=="text")&&(Ye=gt(),Ye.position={start:Ur(re.start),end:void 0},Te.push(Ye)),this.stack.push(Ye)}function D(re){const pe=this.stack.pop();pe.value+=this.sliceSerialize(re),pe.position.end=Ur(re.end)}function Y(re){const pe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Te=pe.children[pe.children.length-1];Te.position.end=Ur(re.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&l.canContainEols.includes(pe.type)&&(te.call(this,re),D.call(this,re))}function B(){this.data.atHardBreak=!0}function V(){const re=this.resume(),pe=this.stack[this.stack.length-1];pe.value=re}function ne(){const re=this.resume(),pe=this.stack[this.stack.length-1];pe.value=re}function G(){const re=this.resume(),pe=this.stack[this.stack.length-1];pe.value=re}function L(){const re=this.stack[this.stack.length-1];if(this.data.inReference){const pe=this.data.referenceType||"shortcut";re.type+="Reference",re.referenceType=pe,delete re.url,delete re.title}else delete re.identifier,delete re.label;this.data.referenceType=void 0}function Z(){const re=this.stack[this.stack.length-1];if(this.data.inReference){const pe=this.data.referenceType||"shortcut";re.type+="Reference",re.referenceType=pe,delete re.url,delete re.title}else delete re.identifier,delete re.label;this.data.referenceType=void 0}function de(re){const pe=this.sliceSerialize(re),Te=this.stack[this.stack.length-2];Te.label=H5(pe),Te.identifier=bl(pe).toLowerCase()}function ue(){const re=this.stack[this.stack.length-1],pe=this.resume(),Te=this.stack[this.stack.length-1];if(this.data.inReference=!0,Te.type==="link"){const Ye=re.children;Te.children=Ye}else Te.alt=pe}function z(){const re=this.resume(),pe=this.stack[this.stack.length-1];pe.url=re}function R(){const re=this.resume(),pe=this.stack[this.stack.length-1];pe.title=re}function K(){this.data.inReference=void 0}function T(){this.data.referenceType="collapsed"}function fe(re){const pe=this.resume(),Te=this.stack[this.stack.length-1];Te.label=pe,Te.identifier=bl(this.sliceSerialize(re)).toLowerCase(),this.data.referenceType="full"}function Ee(re){this.data.characterReferenceType=re.type}function Ne(re){const pe=this.sliceSerialize(re),Te=this.data.characterReferenceType;let Ye;Te?(Ye=oy(pe,Te==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ye=uh(pe);const xe=this.stack[this.stack.length-1];xe.value+=Ye}function Le(re){const pe=this.stack.pop();pe.position.end=Ur(re.end)}function Be(re){D.call(this,re);const pe=this.stack[this.stack.length-1];pe.url=this.sliceSerialize(re)}function Qe(re){D.call(this,re);const pe=this.stack[this.stack.length-1];pe.url="mailto:"+this.sliceSerialize(re)}function Se(){return{type:"blockquote",children:[]}}function tt(){return{type:"code",lang:null,meta:null,value:""}}function me(){return{type:"inlineCode",value:""}}function he(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ge(){return{type:"emphasis",children:[]}}function ke(){return{type:"heading",depth:0,children:[]}}function Fe(){return{type:"break"}}function Ae(){return{type:"html",value:""}}function De(){return{type:"image",title:null,url:"",alt:null}}function je(){return{type:"link",title:null,url:"",children:[]}}function _e(re){return{type:"list",ordered:re.type==="listOrdered",start:null,spread:re._spread,children:[]}}function Ke(re){return{type:"listItem",spread:re._spread,checked:null,children:[]}}function Et(){return{type:"paragraph",children:[]}}function Ht(){return{type:"strong",children:[]}}function gt(){return{type:"text",value:""}}function Rt(){return{type:"thematicBreak"}}}function Ur(t){return{line:t.line,column:t.column,offset:t.offset}}function by(t,l){let r=-1;for(;++r<l.length;){const i=l[r];Array.isArray(i)?by(t,i):q5(t,i)}}function q5(t,l){let r;for(r in l)if(gy.call(l,r))switch(r){case"canContainEols":{const i=l[r];i&&t[r].push(...i);break}case"transforms":{const i=l[r];i&&t[r].push(...i);break}case"enter":case"exit":{const i=l[r];i&&Object.assign(t[r],i);break}}}function O1(t,l){throw t?new Error("Cannot close `"+t.type+"` ("+As({start:t.start,end:t.end})+"): a different token (`"+l.type+"`, "+As({start:l.start,end:l.end})+") is open"):new Error("Cannot close document, a token (`"+l.type+"`, "+As({start:l.start,end:l.end})+") is still open")}function X5(t){const l=this;l.parser=r;function r(i){return I5(i,{...l.data("settings"),...t,extensions:l.data("micromarkExtensions")||[],mdastExtensions:l.data("fromMarkdownExtensions")||[]})}}function V5(t,l){const r={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(l),!0)};return t.patch(l,r),t.applyData(l,r)}function G5(t,l){const r={type:"element",tagName:"br",properties:{},children:[]};return t.patch(l,r),[t.applyData(l,r),{type:"text",value:`
|
|
53
|
+
`;break}case-2:{d=l?" ":" ";break}case-1:{if(!l&&c)continue;d=" ";break}default:d=String.fromCharCode(u)}c=u===-2,i.push(d)}return i.join("")}function O5(t){const i={constructs:cy([M5,...(t||{}).extensions||[]]),content:c(Zv),defined:[],document:c(Pv),flow:c(y5),lazy:{},string:c(v5),text:c(w5)};return i;function c(u){return d;function d(m){return F5(i,u,m)}}}function B5(t){for(;!my(t););return t}const B1=/[\0\t\n\r]/g;function L5(){let t=1,l="",r=!0,i;return c;function c(u,d,m){const x=[];let f,g,y,b,v;for(u=l+(typeof u=="string"?u.toString():new TextDecoder(d||void 0).decode(u)),y=0,l="",r&&(u.charCodeAt(0)===65279&&y++,r=void 0);y<u.length;){if(B1.lastIndex=y,f=B1.exec(u),b=f&&f.index!==void 0?f.index:u.length,v=u.charCodeAt(b),!f){l=u.slice(y);break}if(v===10&&y===b&&i)x.push(-3),i=void 0;else switch(i&&(x.push(-5),i=void 0),y<b&&(x.push(u.slice(y,b)),t+=b-y),v){case 0:{x.push(65533),t++;break}case 9:{for(g=Math.ceil(t/4)*4,x.push(-2);t++<g;)x.push(-1);break}case 10:{x.push(-4),t=1;break}default:i=!0,t=1}y=b+1}return m&&(i&&x.push(-5),l&&x.push(l),x.push(null)),x}}const $5=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function H5(t){return t.replace($5,U5)}function U5(t,l,r){if(l)return l;if(r.charCodeAt(0)===35){const c=r.charCodeAt(1),u=c===120||c===88;return uy(r.slice(u?2:1),u?16:10)}return uh(r)||t}const vy={}.hasOwnProperty;function I5(t,l,r){return l&&typeof l=="object"&&(r=l,l=void 0),Y5(r)(B5(O5(r).document().write(L5()(t,l,!0))))}function Y5(t){const l={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(je),autolinkProtocol:te,autolinkEmail:te,atxHeading:u(ke),blockQuote:u(Se),characterEscape:te,characterReference:te,codeFenced:u(tt),codeFencedFenceInfo:d,codeFencedFenceMeta:d,codeIndented:u(tt,d),codeText:u(me,d),codeTextData:te,data:te,codeFlowValue:te,definition:u(he),definitionDestinationString:d,definitionLabelString:d,definitionTitleString:d,emphasis:u(ge),hardBreakEscape:u(Fe),hardBreakTrailing:u(Fe),htmlFlow:u(Ae,d),htmlFlowData:te,htmlText:u(Ae,d),htmlTextData:te,image:u(De),label:d,link:u(je),listItem:u(Ke),listItemValue:b,listOrdered:u(_e,y),listUnordered:u(_e),paragraph:u(Et),reference:T,referenceString:d,resourceDestinationString:d,resourceTitleString:d,setextHeading:u(ke),strong:u(Ht),thematicBreak:u(Rt)},exit:{atxHeading:x(),atxHeadingSequence:H,autolink:x(),autolinkEmail:Qe,autolinkProtocol:Be,blockQuote:x(),characterEscapeValue:D,characterReferenceMarkerHexadecimal:Ee,characterReferenceMarkerNumeric:Ee,characterReferenceValue:Ne,characterReference:Le,codeFenced:x(E),codeFencedFence:j,codeFencedFenceInfo:v,codeFencedFenceMeta:S,codeFlowValue:D,codeIndented:x(C),codeText:x(G),codeTextData:D,data:D,definition:x(),definitionDestinationString:_,definitionLabelString:A,definitionTitleString:F,emphasis:x(),hardBreakEscape:x(B),hardBreakTrailing:x(B),htmlFlow:x(V),htmlFlowData:D,htmlText:x(ne),htmlTextData:D,image:x(Z),label:ue,labelText:de,lineEnding:Y,link:x(L),listItem:x(),listOrdered:x(),listUnordered:x(),paragraph:x(),referenceString:fe,resourceDestinationString:z,resourceTitleString:R,resource:K,setextHeading:x(W),setextHeadingLineSequence:I,setextHeadingText:M,strong:x(),thematicBreak:x()}};wy(l,(t||{}).mdastExtensions||[]);const r={};return i;function i(re){let pe={type:"root",children:[]};const Te={stack:[pe],tokenStack:[],config:l,enter:m,exit:f,buffer:d,resume:g,data:r},Ye=[];let xe=-1;for(;++xe<re.length;)if(re[xe][1].type==="listOrdered"||re[xe][1].type==="listUnordered")if(re[xe][0]==="enter")Ye.push(xe);else{const q=Ye.pop();xe=c(re,q,xe)}for(xe=-1;++xe<re.length;){const q=l[re[xe][0]];vy.call(q,re[xe][1].type)&&q[re[xe][1].type].call(Object.assign({sliceSerialize:re[xe][2].sliceSerialize},Te),re[xe][1])}if(Te.tokenStack.length>0){const q=Te.tokenStack[Te.tokenStack.length-1];(q[1]||L1).call(Te,void 0,q[0])}for(pe.position={start:Ur(re.length>0?re[0][1].start:{line:1,column:1,offset:0}),end:Ur(re.length>0?re[re.length-2][1].end:{line:1,column:1,offset:0})},xe=-1;++xe<l.transforms.length;)pe=l.transforms[xe](pe)||pe;return pe}function c(re,pe,Te){let Ye=pe-1,xe=-1,q=!1,ze,He,Xe,ht;for(;++Ye<=Te;){const Pe=re[Ye];switch(Pe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Pe[0]==="enter"?xe++:xe--,ht=void 0;break}case"lineEndingBlank":{Pe[0]==="enter"&&(ze&&!ht&&!xe&&!Xe&&(Xe=Ye),ht=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ht=void 0}if(!xe&&Pe[0]==="enter"&&Pe[1].type==="listItemPrefix"||xe===-1&&Pe[0]==="exit"&&(Pe[1].type==="listUnordered"||Pe[1].type==="listOrdered")){if(ze){let We=Ye;for(He=void 0;We--;){const un=re[We];if(un[1].type==="lineEnding"||un[1].type==="lineEndingBlank"){if(un[0]==="exit")continue;He&&(re[He][1].type="lineEndingBlank",q=!0),un[1].type="lineEnding",He=We}else if(!(un[1].type==="linePrefix"||un[1].type==="blockQuotePrefix"||un[1].type==="blockQuotePrefixWhitespace"||un[1].type==="blockQuoteMarker"||un[1].type==="listItemIndent"))break}Xe&&(!He||Xe<He)&&(ze._spread=!0),ze.end=Object.assign({},He?re[He][1].start:Pe[1].end),re.splice(He||Ye,0,["exit",ze,Pe[2]]),Ye++,Te++}if(Pe[1].type==="listItemPrefix"){const We={type:"listItem",_spread:!1,start:Object.assign({},Pe[1].start),end:void 0};ze=We,re.splice(Ye,0,["enter",We,Pe[2]]),Ye++,Te++,Xe=void 0,ht=!0}}}return re[pe][1]._spread=q,Te}function u(re,pe){return Te;function Te(Ye){m.call(this,re(Ye),Ye),pe&&pe.call(this,Ye)}}function d(){this.stack.push({type:"fragment",children:[]})}function m(re,pe,Te){this.stack[this.stack.length-1].children.push(re),this.stack.push(re),this.tokenStack.push([pe,Te||void 0]),re.position={start:Ur(pe.start),end:void 0}}function x(re){return pe;function pe(Te){re&&re.call(this,Te),f.call(this,Te)}}function f(re,pe){const Te=this.stack.pop(),Ye=this.tokenStack.pop();if(Ye)Ye[0].type!==re.type&&(pe?pe.call(this,re,Ye[0]):(Ye[1]||L1).call(this,re,Ye[0]));else throw new Error("Cannot close `"+re.type+"` ("+As({start:re.start,end:re.end})+"): it’s not open");Te.position.end=Ur(re.end)}function g(){return ch(this.stack.pop())}function y(){this.data.expectingFirstListItemValue=!0}function b(re){if(this.data.expectingFirstListItemValue){const pe=this.stack[this.stack.length-2];pe.start=Number.parseInt(this.sliceSerialize(re),10),this.data.expectingFirstListItemValue=void 0}}function v(){const re=this.resume(),pe=this.stack[this.stack.length-1];pe.lang=re}function S(){const re=this.resume(),pe=this.stack[this.stack.length-1];pe.meta=re}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function E(){const re=this.resume(),pe=this.stack[this.stack.length-1];pe.value=re.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function C(){const re=this.resume(),pe=this.stack[this.stack.length-1];pe.value=re.replace(/(\r?\n|\r)$/g,"")}function A(re){const pe=this.resume(),Te=this.stack[this.stack.length-1];Te.label=pe,Te.identifier=bl(this.sliceSerialize(re)).toLowerCase()}function F(){const re=this.resume(),pe=this.stack[this.stack.length-1];pe.title=re}function _(){const re=this.resume(),pe=this.stack[this.stack.length-1];pe.url=re}function H(re){const pe=this.stack[this.stack.length-1];if(!pe.depth){const Te=this.sliceSerialize(re).length;pe.depth=Te}}function M(){this.data.setextHeadingSlurpLineEnding=!0}function I(re){const pe=this.stack[this.stack.length-1];pe.depth=this.sliceSerialize(re).codePointAt(0)===61?1:2}function W(){this.data.setextHeadingSlurpLineEnding=void 0}function te(re){const Te=this.stack[this.stack.length-1].children;let Ye=Te[Te.length-1];(!Ye||Ye.type!=="text")&&(Ye=gt(),Ye.position={start:Ur(re.start),end:void 0},Te.push(Ye)),this.stack.push(Ye)}function D(re){const pe=this.stack.pop();pe.value+=this.sliceSerialize(re),pe.position.end=Ur(re.end)}function Y(re){const pe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Te=pe.children[pe.children.length-1];Te.position.end=Ur(re.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&l.canContainEols.includes(pe.type)&&(te.call(this,re),D.call(this,re))}function B(){this.data.atHardBreak=!0}function V(){const re=this.resume(),pe=this.stack[this.stack.length-1];pe.value=re}function ne(){const re=this.resume(),pe=this.stack[this.stack.length-1];pe.value=re}function G(){const re=this.resume(),pe=this.stack[this.stack.length-1];pe.value=re}function L(){const re=this.stack[this.stack.length-1];if(this.data.inReference){const pe=this.data.referenceType||"shortcut";re.type+="Reference",re.referenceType=pe,delete re.url,delete re.title}else delete re.identifier,delete re.label;this.data.referenceType=void 0}function Z(){const re=this.stack[this.stack.length-1];if(this.data.inReference){const pe=this.data.referenceType||"shortcut";re.type+="Reference",re.referenceType=pe,delete re.url,delete re.title}else delete re.identifier,delete re.label;this.data.referenceType=void 0}function de(re){const pe=this.sliceSerialize(re),Te=this.stack[this.stack.length-2];Te.label=H5(pe),Te.identifier=bl(pe).toLowerCase()}function ue(){const re=this.stack[this.stack.length-1],pe=this.resume(),Te=this.stack[this.stack.length-1];if(this.data.inReference=!0,Te.type==="link"){const Ye=re.children;Te.children=Ye}else Te.alt=pe}function z(){const re=this.resume(),pe=this.stack[this.stack.length-1];pe.url=re}function R(){const re=this.resume(),pe=this.stack[this.stack.length-1];pe.title=re}function K(){this.data.inReference=void 0}function T(){this.data.referenceType="collapsed"}function fe(re){const pe=this.resume(),Te=this.stack[this.stack.length-1];Te.label=pe,Te.identifier=bl(this.sliceSerialize(re)).toLowerCase(),this.data.referenceType="full"}function Ee(re){this.data.characterReferenceType=re.type}function Ne(re){const pe=this.sliceSerialize(re),Te=this.data.characterReferenceType;let Ye;Te?(Ye=uy(pe,Te==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ye=uh(pe);const xe=this.stack[this.stack.length-1];xe.value+=Ye}function Le(re){const pe=this.stack.pop();pe.position.end=Ur(re.end)}function Be(re){D.call(this,re);const pe=this.stack[this.stack.length-1];pe.url=this.sliceSerialize(re)}function Qe(re){D.call(this,re);const pe=this.stack[this.stack.length-1];pe.url="mailto:"+this.sliceSerialize(re)}function Se(){return{type:"blockquote",children:[]}}function tt(){return{type:"code",lang:null,meta:null,value:""}}function me(){return{type:"inlineCode",value:""}}function he(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ge(){return{type:"emphasis",children:[]}}function ke(){return{type:"heading",depth:0,children:[]}}function Fe(){return{type:"break"}}function Ae(){return{type:"html",value:""}}function De(){return{type:"image",title:null,url:"",alt:null}}function je(){return{type:"link",title:null,url:"",children:[]}}function _e(re){return{type:"list",ordered:re.type==="listOrdered",start:null,spread:re._spread,children:[]}}function Ke(re){return{type:"listItem",spread:re._spread,checked:null,children:[]}}function Et(){return{type:"paragraph",children:[]}}function Ht(){return{type:"strong",children:[]}}function gt(){return{type:"text",value:""}}function Rt(){return{type:"thematicBreak"}}}function Ur(t){return{line:t.line,column:t.column,offset:t.offset}}function wy(t,l){let r=-1;for(;++r<l.length;){const i=l[r];Array.isArray(i)?wy(t,i):q5(t,i)}}function q5(t,l){let r;for(r in l)if(vy.call(l,r))switch(r){case"canContainEols":{const i=l[r];i&&t[r].push(...i);break}case"transforms":{const i=l[r];i&&t[r].push(...i);break}case"enter":case"exit":{const i=l[r];i&&Object.assign(t[r],i);break}}}function L1(t,l){throw t?new Error("Cannot close `"+t.type+"` ("+As({start:t.start,end:t.end})+"): a different token (`"+l.type+"`, "+As({start:l.start,end:l.end})+") is open"):new Error("Cannot close document, a token (`"+l.type+"`, "+As({start:l.start,end:l.end})+") is still open")}function X5(t){const l=this;l.parser=r;function r(i){return I5(i,{...l.data("settings"),...t,extensions:l.data("micromarkExtensions")||[],mdastExtensions:l.data("fromMarkdownExtensions")||[]})}}function V5(t,l){const r={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(l),!0)};return t.patch(l,r),t.applyData(l,r)}function G5(t,l){const r={type:"element",tagName:"br",properties:{},children:[]};return t.patch(l,r),[t.applyData(l,r),{type:"text",value:`
|
|
54
54
|
`}]}function K5(t,l){const r=l.value?l.value+`
|
|
55
|
-
`:"",i={},c=l.lang?l.lang.split(/\s+/):[];c.length>0&&(i.className=["language-"+c[0]]);let u={type:"element",tagName:"code",properties:i,children:[{type:"text",value:r}]};return l.meta&&(u.data={meta:l.meta}),t.patch(l,u),u=t.applyData(l,u),u={type:"element",tagName:"pre",properties:{},children:[u]},t.patch(l,u),u}function Q5(t,l){const r={type:"element",tagName:"del",properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}function W5(t,l){const r={type:"element",tagName:"em",properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}function Z5(t,l){const r=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",i=String(l.identifier).toUpperCase(),c=bi(i.toLowerCase()),u=t.footnoteOrder.indexOf(i);let d,m=t.footnoteCounts.get(i);m===void 0?(m=0,t.footnoteOrder.push(i),d=t.footnoteOrder.length):d=u+1,m+=1,t.footnoteCounts.set(i,m);const x={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+c,id:r+"fnref-"+c+(m>1?"-"+m:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(d)}]};t.patch(l,x);const f={type:"element",tagName:"sup",properties:{},children:[x]};return t.patch(l,f),t.applyData(l,f)}function J5(t,l){const r={type:"element",tagName:"h"+l.depth,properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}function P5(t,l){if(t.options.allowDangerousHtml){const r={type:"raw",value:l.value};return t.patch(l,r),t.applyData(l,r)}}function
|
|
55
|
+
`:"",i={},c=l.lang?l.lang.split(/\s+/):[];c.length>0&&(i.className=["language-"+c[0]]);let u={type:"element",tagName:"code",properties:i,children:[{type:"text",value:r}]};return l.meta&&(u.data={meta:l.meta}),t.patch(l,u),u=t.applyData(l,u),u={type:"element",tagName:"pre",properties:{},children:[u]},t.patch(l,u),u}function Q5(t,l){const r={type:"element",tagName:"del",properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}function W5(t,l){const r={type:"element",tagName:"em",properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}function Z5(t,l){const r=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",i=String(l.identifier).toUpperCase(),c=bi(i.toLowerCase()),u=t.footnoteOrder.indexOf(i);let d,m=t.footnoteCounts.get(i);m===void 0?(m=0,t.footnoteOrder.push(i),d=t.footnoteOrder.length):d=u+1,m+=1,t.footnoteCounts.set(i,m);const x={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+c,id:r+"fnref-"+c+(m>1?"-"+m:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(d)}]};t.patch(l,x);const f={type:"element",tagName:"sup",properties:{},children:[x]};return t.patch(l,f),t.applyData(l,f)}function J5(t,l){const r={type:"element",tagName:"h"+l.depth,properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}function P5(t,l){if(t.options.allowDangerousHtml){const r={type:"raw",value:l.value};return t.patch(l,r),t.applyData(l,r)}}function ky(t,l){const r=l.referenceType;let i="]";if(r==="collapsed"?i+="[]":r==="full"&&(i+="["+(l.label||l.identifier)+"]"),l.type==="imageReference")return[{type:"text",value:"!["+l.alt+i}];const c=t.all(l),u=c[0];u&&u.type==="text"?u.value="["+u.value:c.unshift({type:"text",value:"["});const d=c[c.length-1];return d&&d.type==="text"?d.value+=i:c.push({type:"text",value:i}),c}function e3(t,l){const r=String(l.identifier).toUpperCase(),i=t.definitionById.get(r);if(!i)return ky(t,l);const c={src:bi(i.url||""),alt:l.alt};i.title!==null&&i.title!==void 0&&(c.title=i.title);const u={type:"element",tagName:"img",properties:c,children:[]};return t.patch(l,u),t.applyData(l,u)}function t3(t,l){const r={src:bi(l.url)};l.alt!==null&&l.alt!==void 0&&(r.alt=l.alt),l.title!==null&&l.title!==void 0&&(r.title=l.title);const i={type:"element",tagName:"img",properties:r,children:[]};return t.patch(l,i),t.applyData(l,i)}function n3(t,l){const r={type:"text",value:l.value.replace(/\r?\n|\r/g," ")};t.patch(l,r);const i={type:"element",tagName:"code",properties:{},children:[r]};return t.patch(l,i),t.applyData(l,i)}function l3(t,l){const r=String(l.identifier).toUpperCase(),i=t.definitionById.get(r);if(!i)return ky(t,l);const c={href:bi(i.url||"")};i.title!==null&&i.title!==void 0&&(c.title=i.title);const u={type:"element",tagName:"a",properties:c,children:t.all(l)};return t.patch(l,u),t.applyData(l,u)}function r3(t,l){const r={href:bi(l.url)};l.title!==null&&l.title!==void 0&&(r.title=l.title);const i={type:"element",tagName:"a",properties:r,children:t.all(l)};return t.patch(l,i),t.applyData(l,i)}function a3(t,l,r){const i=t.all(l),c=r?i3(r):jy(l),u={},d=[];if(typeof l.checked=="boolean"){const g=i[0];let y;g&&g.type==="element"&&g.tagName==="p"?y=g:(y={type:"element",tagName:"p",properties:{},children:[]},i.unshift(y)),y.children.length>0&&y.children.unshift({type:"text",value:" "}),y.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:l.checked,disabled:!0},children:[]}),u.className=["task-list-item"]}let m=-1;for(;++m<i.length;){const g=i[m];(c||m!==0||g.type!=="element"||g.tagName!=="p")&&d.push({type:"text",value:`
|
|
56
56
|
`}),g.type==="element"&&g.tagName==="p"&&!c?d.push(...g.children):d.push(g)}const x=i[i.length-1];x&&(c||x.type!=="element"||x.tagName!=="p")&&d.push({type:"text",value:`
|
|
57
|
-
`});const f={type:"element",tagName:"li",properties:u,children:d};return t.patch(l,f),t.applyData(l,f)}function i3(t){let l=!1;if(t.type==="list"){l=t.spread||!1;const r=t.children;let i=-1;for(;!l&&++i<r.length;)l=
|
|
57
|
+
`});const f={type:"element",tagName:"li",properties:u,children:d};return t.patch(l,f),t.applyData(l,f)}function i3(t){let l=!1;if(t.type==="list"){l=t.spread||!1;const r=t.children;let i=-1;for(;!l&&++i<r.length;)l=jy(r[i])}return l}function jy(t){const l=t.spread;return l??t.children.length>1}function s3(t,l){const r={},i=t.all(l);let c=-1;for(typeof l.start=="number"&&l.start!==1&&(r.start=l.start);++c<i.length;){const d=i[c];if(d.type==="element"&&d.tagName==="li"&&d.properties&&Array.isArray(d.properties.className)&&d.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const u={type:"element",tagName:l.ordered?"ol":"ul",properties:r,children:t.wrap(i,!0)};return t.patch(l,u),t.applyData(l,u)}function o3(t,l){const r={type:"element",tagName:"p",properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}function c3(t,l){const r={type:"root",children:t.wrap(t.all(l))};return t.patch(l,r),t.applyData(l,r)}function u3(t,l){const r={type:"element",tagName:"strong",properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}function d3(t,l){const r=t.all(l),i=r.shift(),c=[];if(i){const d={type:"element",tagName:"thead",properties:{},children:t.wrap([i],!0)};t.patch(l.children[0],d),c.push(d)}if(r.length>0){const d={type:"element",tagName:"tbody",properties:{},children:t.wrap(r,!0)},m=ah(l.children[1]),x=ny(l.children[l.children.length-1]);m&&x&&(d.position={start:m,end:x}),c.push(d)}const u={type:"element",tagName:"table",properties:{},children:t.wrap(c,!0)};return t.patch(l,u),t.applyData(l,u)}function f3(t,l,r){const i=r?r.children:void 0,u=(i?i.indexOf(l):1)===0?"th":"td",d=r&&r.type==="table"?r.align:void 0,m=d?d.length:l.children.length;let x=-1;const f=[];for(;++x<m;){const y=l.children[x],b={},v=d?d[x]:void 0;v&&(b.align=v);let S={type:"element",tagName:u,properties:b,children:[]};y&&(S.children=t.all(y),t.patch(y,S),S=t.applyData(y,S)),f.push(S)}const g={type:"element",tagName:"tr",properties:{},children:t.wrap(f,!0)};return t.patch(l,g),t.applyData(l,g)}function h3(t,l){const r={type:"element",tagName:"td",properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}const $1=9,H1=32;function m3(t){const l=String(t),r=/\r?\n|\r/g;let i=r.exec(l),c=0;const u=[];for(;i;)u.push(U1(l.slice(c,i.index),c>0,!0),i[0]),c=i.index+i[0].length,i=r.exec(l);return u.push(U1(l.slice(c),c>0,!1)),u.join("")}function U1(t,l,r){let i=0,c=t.length;if(l){let u=t.codePointAt(i);for(;u===$1||u===H1;)i++,u=t.codePointAt(i)}if(r){let u=t.codePointAt(c-1);for(;u===$1||u===H1;)c--,u=t.codePointAt(c-1)}return c>i?t.slice(i,c):""}function x3(t,l){const r={type:"text",value:m3(String(l.value))};return t.patch(l,r),t.applyData(l,r)}function p3(t,l){const r={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(l,r),t.applyData(l,r)}const y3={blockquote:V5,break:G5,code:K5,delete:Q5,emphasis:W5,footnoteReference:Z5,heading:J5,html:P5,imageReference:e3,image:t3,inlineCode:n3,linkReference:l3,link:r3,listItem:a3,list:s3,paragraph:o3,root:c3,strong:u3,table:d3,tableCell:h3,tableRow:f3,text:x3,thematicBreak:p3,toml:tc,yaml:tc,definition:tc,footnoteDefinition:tc};function tc(){}const Sy=-1,Oc=0,Ds=1,Cc=2,fh=3,hh=4,mh=5,xh=6,Cy=7,Ey=8,I1=typeof self=="object"?self:globalThis,g3=(t,l)=>{const r=(c,u)=>(t.set(u,c),c),i=c=>{if(t.has(c))return t.get(c);const[u,d]=l[c];switch(u){case Oc:case Sy:return r(d,c);case Ds:{const m=r([],c);for(const x of d)m.push(i(x));return m}case Cc:{const m=r({},c);for(const[x,f]of d)m[i(x)]=i(f);return m}case fh:return r(new Date(d),c);case hh:{const{source:m,flags:x}=d;return r(new RegExp(m,x),c)}case mh:{const m=r(new Map,c);for(const[x,f]of d)m.set(i(x),i(f));return m}case xh:{const m=r(new Set,c);for(const x of d)m.add(i(x));return m}case Cy:{const{name:m,message:x}=d;return r(new I1[m](x),c)}case Ey:return r(BigInt(d),c);case"BigInt":return r(Object(BigInt(d)),c);case"ArrayBuffer":return r(new Uint8Array(d).buffer,d);case"DataView":{const{buffer:m}=new Uint8Array(d);return r(new DataView(m),d)}}return r(new I1[u](d),c)};return i},Y1=t=>g3(new Map,t)(0),ci="",{toString:b3}={},{keys:v3}=Object,bs=t=>{const l=typeof t;if(l!=="object"||!t)return[Oc,l];const r=b3.call(t).slice(8,-1);switch(r){case"Array":return[Ds,ci];case"Object":return[Cc,ci];case"Date":return[fh,ci];case"RegExp":return[hh,ci];case"Map":return[mh,ci];case"Set":return[xh,ci];case"DataView":return[Ds,r]}return r.includes("Array")?[Ds,r]:r.includes("Error")?[Cy,r]:[Cc,r]},nc=([t,l])=>t===Oc&&(l==="function"||l==="symbol"),w3=(t,l,r,i)=>{const c=(d,m)=>{const x=i.push(d)-1;return r.set(m,x),x},u=d=>{if(r.has(d))return r.get(d);let[m,x]=bs(d);switch(m){case Oc:{let g=d;switch(x){case"bigint":m=Ey,g=d.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+x);g=null;break;case"undefined":return c([Sy],d)}return c([m,g],d)}case Ds:{if(x){let b=d;return x==="DataView"?b=new Uint8Array(d.buffer):x==="ArrayBuffer"&&(b=new Uint8Array(d)),c([x,[...b]],d)}const g=[],y=c([m,g],d);for(const b of d)g.push(u(b));return y}case Cc:{if(x)switch(x){case"BigInt":return c([x,d.toString()],d);case"Boolean":case"Number":case"String":return c([x,d.valueOf()],d)}if(l&&"toJSON"in d)return u(d.toJSON());const g=[],y=c([m,g],d);for(const b of v3(d))(t||!nc(bs(d[b])))&&g.push([u(b),u(d[b])]);return y}case fh:return c([m,d.toISOString()],d);case hh:{const{source:g,flags:y}=d;return c([m,{source:g,flags:y}],d)}case mh:{const g=[],y=c([m,g],d);for(const[b,v]of d)(t||!(nc(bs(b))||nc(bs(v))))&&g.push([u(b),u(v)]);return y}case xh:{const g=[],y=c([m,g],d);for(const b of d)(t||!nc(bs(b)))&&g.push(u(b));return y}}const{message:f}=d;return c([m,{name:x,message:f}],d)};return u},q1=(t,{json:l,lossy:r}={})=>{const i=[];return w3(!(l||r),!!l,new Map,i)(t),i},Ec=typeof structuredClone=="function"?(t,l)=>l&&("json"in l||"lossy"in l)?Y1(q1(t,l)):structuredClone(t):(t,l)=>Y1(q1(t,l));function k3(t,l){const r=[{type:"text",value:"↩"}];return l>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(l)}]}),r}function j3(t,l){return"Back to reference "+(t+1)+(l>1?"-"+l:"")}function S3(t){const l=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=t.options.footnoteBackContent||k3,i=t.options.footnoteBackLabel||j3,c=t.options.footnoteLabel||"Footnotes",u=t.options.footnoteLabelTagName||"h2",d=t.options.footnoteLabelProperties||{className:["sr-only"]},m=[];let x=-1;for(;++x<t.footnoteOrder.length;){const f=t.footnoteById.get(t.footnoteOrder[x]);if(!f)continue;const g=t.all(f),y=String(f.identifier).toUpperCase(),b=bi(y.toLowerCase());let v=0;const S=[],j=t.footnoteCounts.get(y);for(;j!==void 0&&++v<=j;){S.length>0&&S.push({type:"text",value:" "});let A=typeof r=="string"?r:r(x,v);typeof A=="string"&&(A={type:"text",value:A}),S.push({type:"element",tagName:"a",properties:{href:"#"+l+"fnref-"+b+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(x,v),className:["data-footnote-backref"]},children:Array.isArray(A)?A:[A]})}const E=g[g.length-1];if(E&&E.type==="element"&&E.tagName==="p"){const A=E.children[E.children.length-1];A&&A.type==="text"?A.value+=" ":E.children.push({type:"text",value:" "}),E.children.push(...S)}else g.push(...S);const C={type:"element",tagName:"li",properties:{id:l+"fn-"+b},children:t.wrap(g,!0)};t.patch(f,C),m.push(C)}if(m.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...Ec(d),id:"footnote-label"},children:[{type:"text",value:c}]},{type:"text",value:`
|
|
58
58
|
`},{type:"element",tagName:"ol",properties:{},children:t.wrap(m,!0)},{type:"text",value:`
|
|
59
|
-
`}]}}const Bc=(function(t){if(t==null)return A3;if(typeof t=="function")return Lc(t);if(typeof t=="object")return Array.isArray(t)?C3(t):E3(t);if(typeof t=="string")return N3(t);throw new Error("Expected function, string, or object as test")});function C3(t){const l=[];let r=-1;for(;++r<t.length;)l[r]=Bc(t[r]);return Lc(i);function i(...c){let u=-1;for(;++u<l.length;)if(l[u].apply(this,c))return!0;return!1}}function E3(t){const l=t;return Lc(r);function r(i){const c=i;let u;for(u in t)if(c[u]!==l[u])return!1;return!0}}function N3(t){return Lc(l);function l(r){return r&&r.type===t}}function Lc(t){return l;function l(r,i,c){return!!(T3(r)&&t.call(this,r,typeof i=="number"?i:void 0,c||void 0))}}function A3(){return!0}function T3(t){return t!==null&&typeof t=="object"&&"type"in t}const
|
|
59
|
+
`}]}}const Bc=(function(t){if(t==null)return A3;if(typeof t=="function")return Lc(t);if(typeof t=="object")return Array.isArray(t)?C3(t):E3(t);if(typeof t=="string")return N3(t);throw new Error("Expected function, string, or object as test")});function C3(t){const l=[];let r=-1;for(;++r<t.length;)l[r]=Bc(t[r]);return Lc(i);function i(...c){let u=-1;for(;++u<l.length;)if(l[u].apply(this,c))return!0;return!1}}function E3(t){const l=t;return Lc(r);function r(i){const c=i;let u;for(u in t)if(c[u]!==l[u])return!1;return!0}}function N3(t){return Lc(l);function l(r){return r&&r.type===t}}function Lc(t){return l;function l(r,i,c){return!!(T3(r)&&t.call(this,r,typeof i=="number"?i:void 0,c||void 0))}}function A3(){return!0}function T3(t){return t!==null&&typeof t=="object"&&"type"in t}const Ny=[],D3=!0,If=!1,z3="skip";function Ay(t,l,r,i){let c;typeof l=="function"&&typeof r!="function"?(i=r,r=l):c=l;const u=Bc(c),d=i?-1:1;m(t,void 0,[])();function m(x,f,g){const y=x&&typeof x=="object"?x:{};if(typeof y.type=="string"){const v=typeof y.tagName=="string"?y.tagName:typeof y.name=="string"?y.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(x.type+(v?"<"+v+">":""))+")"})}return b;function b(){let v=Ny,S,j,E;if((!l||u(x,f,g[g.length-1]||void 0))&&(v=M3(r(x,g)),v[0]===If))return v;if("children"in x&&x.children){const C=x;if(C.children&&v[0]!==z3)for(j=(i?C.children.length:-1)+d,E=g.concat(C);j>-1&&j<C.children.length;){const A=C.children[j];if(S=m(A,j,E)(),S[0]===If)return S;j=typeof S[1]=="number"?S[1]:j+d}}return v}}}function M3(t){return Array.isArray(t)?t:typeof t=="number"?[D3,t]:t==null?Ny:[t]}function ph(t,l,r,i){let c,u,d;typeof l=="function"&&typeof r!="function"?(u=void 0,d=l,c=r):(u=l,d=r,c=i),Ay(t,u,m,c);function m(x,f){const g=f[f.length-1],y=g?g.children.indexOf(x):void 0;return d(x,y,g)}}const Yf={}.hasOwnProperty,F3={};function R3(t,l){const r=l||F3,i=new Map,c=new Map,u=new Map,d={...y3,...r.handlers},m={all:f,applyData:O3,definitionById:i,footnoteById:c,footnoteCounts:u,footnoteOrder:[],handlers:d,one:x,options:r,patch:_3,wrap:L3};return ph(t,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const y=g.type==="definition"?i:c,b=String(g.identifier).toUpperCase();y.has(b)||y.set(b,g)}}),m;function x(g,y){const b=g.type,v=m.handlers[b];if(Yf.call(m.handlers,b)&&v)return v(m,g,y);if(m.options.passThrough&&m.options.passThrough.includes(b)){if("children"in g){const{children:j,...E}=g,C=Ec(E);return C.children=m.all(g),C}return Ec(g)}return(m.options.unknownHandler||B3)(m,g,y)}function f(g){const y=[];if("children"in g){const b=g.children;let v=-1;for(;++v<b.length;){const S=m.one(b[v],g);if(S){if(v&&b[v-1].type==="break"&&(!Array.isArray(S)&&S.type==="text"&&(S.value=X1(S.value)),!Array.isArray(S)&&S.type==="element")){const j=S.children[0];j&&j.type==="text"&&(j.value=X1(j.value))}Array.isArray(S)?y.push(...S):y.push(S)}}}return y}}function _3(t,l){t.position&&(l.position=jv(t))}function O3(t,l){let r=l;if(t&&t.data){const i=t.data.hName,c=t.data.hChildren,u=t.data.hProperties;if(typeof i=="string")if(r.type==="element")r.tagName=i;else{const d="children"in r?r.children:[r];r={type:"element",tagName:i,properties:{},children:d}}r.type==="element"&&u&&Object.assign(r.properties,Ec(u)),"children"in r&&r.children&&c!==null&&c!==void 0&&(r.children=c)}return r}function B3(t,l){const r=l.data||{},i="value"in l&&!(Yf.call(r,"hProperties")||Yf.call(r,"hChildren"))?{type:"text",value:l.value}:{type:"element",tagName:"div",properties:{},children:t.all(l)};return t.patch(l,i),t.applyData(l,i)}function L3(t,l){const r=[];let i=-1;for(l&&r.push({type:"text",value:`
|
|
60
60
|
`});++i<t.length;)i&&r.push({type:"text",value:`
|
|
61
61
|
`}),r.push(t[i]);return l&&t.length>0&&r.push({type:"text",value:`
|
|
62
|
-
`}),r}function
|
|
63
|
-
`},c),u}function $3(t,l){return t&&"run"in t?async function(r,i){const c=q1(r,{file:i,...l});await t.run(c,i)}:function(r,i){return q1(r,{file:i,...t||l})}}function X1(t){if(t)throw t}var nf,V1;function H3(){if(V1)return nf;V1=1;var t=Object.prototype.hasOwnProperty,l=Object.prototype.toString,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,c=function(f){return typeof Array.isArray=="function"?Array.isArray(f):l.call(f)==="[object Array]"},u=function(f){if(!f||l.call(f)!=="[object Object]")return!1;var g=t.call(f,"constructor"),y=f.constructor&&f.constructor.prototype&&t.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!g&&!y)return!1;var b;for(b in f);return typeof b>"u"||t.call(f,b)},d=function(f,g){r&&g.name==="__proto__"?r(f,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):f[g.name]=g.newValue},m=function(f,g){if(g==="__proto__")if(t.call(f,g)){if(i)return i(f,g).value}else return;return f[g]};return nf=function x(){var f,g,y,b,v,S,j=arguments[0],E=1,C=arguments.length,A=!1;for(typeof j=="boolean"&&(A=j,j=arguments[1]||{},E=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});E<C;++E)if(f=arguments[E],f!=null)for(g in f)y=m(j,g),b=m(f,g),j!==b&&(A&&b&&(u(b)||(v=c(b)))?(v?(v=!1,S=y&&c(y)?y:[]):S=y&&u(y)?y:{},d(j,{name:g,newValue:x(A,S,b)})):typeof b<"u"&&d(j,{name:g,newValue:b}));return j},nf}var U3=H3();const lf=X0(U3);function qf(t){if(typeof t!="object"||t===null)return!1;const l=Object.getPrototypeOf(t);return(l===null||l===Object.prototype||Object.getPrototypeOf(l)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function I3(){const t=[],l={run:r,use:i};return l;function r(...c){let u=-1;const d=c.pop();if(typeof d!="function")throw new TypeError("Expected function as last argument, not "+d);m(null,...c);function m(x,...f){const g=t[++u];let y=-1;if(x){d(x);return}for(;++y<c.length;)(f[y]===null||f[y]===void 0)&&(f[y]=c[y]);c=f,g?Y3(g,m)(...f):d(null,...f)}}function i(c){if(typeof c!="function")throw new TypeError("Expected `middelware` to be a function, not "+c);return t.push(c),l}}function Y3(t,l){let r;return i;function i(...d){const m=t.length>d.length;let x;m&&d.push(c);try{x=t.apply(this,d)}catch(f){const g=f;if(m&&r)throw g;return c(g)}m||(x&&x.then&&typeof x.then=="function"?x.then(u,c):x instanceof Error?c(x):u(x))}function c(d,...m){r||(r=!0,l(d,...m))}function u(d){c(null,d)}}const Fl={basename:q3,dirname:X3,extname:V3,join:G3,sep:"/"};function q3(t,l){if(l!==void 0&&typeof l!="string")throw new TypeError('"ext" argument must be a string');Us(t);let r=0,i=-1,c=t.length,u;if(l===void 0||l.length===0||l.length>t.length){for(;c--;)if(t.codePointAt(c)===47){if(u){r=c+1;break}}else i<0&&(u=!0,i=c+1);return i<0?"":t.slice(r,i)}if(l===t)return"";let d=-1,m=l.length-1;for(;c--;)if(t.codePointAt(c)===47){if(u){r=c+1;break}}else d<0&&(u=!0,d=c+1),m>-1&&(t.codePointAt(c)===l.codePointAt(m--)?m<0&&(i=c):(m=-1,i=d));return r===i?i=d:i<0&&(i=t.length),t.slice(r,i)}function X3(t){if(Us(t),t.length===0)return".";let l=-1,r=t.length,i;for(;--r;)if(t.codePointAt(r)===47){if(i){l=r;break}}else i||(i=!0);return l<0?t.codePointAt(0)===47?"/":".":l===1&&t.codePointAt(0)===47?"//":t.slice(0,l)}function V3(t){Us(t);let l=t.length,r=-1,i=0,c=-1,u=0,d;for(;l--;){const m=t.codePointAt(l);if(m===47){if(d){i=l+1;break}continue}r<0&&(d=!0,r=l+1),m===46?c<0?c=l:u!==1&&(u=1):c>-1&&(u=-1)}return c<0||r<0||u===0||u===1&&c===r-1&&c===i+1?"":t.slice(c,r)}function G3(...t){let l=-1,r;for(;++l<t.length;)Us(t[l]),t[l]&&(r=r===void 0?t[l]:r+"/"+t[l]);return r===void 0?".":K3(r)}function K3(t){Us(t);const l=t.codePointAt(0)===47;let r=Q3(t,!l);return r.length===0&&!l&&(r="."),r.length>0&&t.codePointAt(t.length-1)===47&&(r+="/"),l?"/"+r:r}function Q3(t,l){let r="",i=0,c=-1,u=0,d=-1,m,x;for(;++d<=t.length;){if(d<t.length)m=t.codePointAt(d);else{if(m===47)break;m=47}if(m===47){if(!(c===d-1||u===1))if(c!==d-1&&u===2){if(r.length<2||i!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(x=r.lastIndexOf("/"),x!==r.length-1){x<0?(r="",i=0):(r=r.slice(0,x),i=r.length-1-r.lastIndexOf("/")),c=d,u=0;continue}}else if(r.length>0){r="",i=0,c=d,u=0;continue}}l&&(r=r.length>0?r+"/..":"..",i=2)}else r.length>0?r+="/"+t.slice(c+1,d):r=t.slice(c+1,d),i=d-c-1;c=d,u=0}else m===46&&u>-1?u++:u=-1}return r}function Us(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const W3={cwd:Z3};function Z3(){return"/"}function Xf(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function J3(t){if(typeof t=="string")t=new URL(t);else if(!Xf(t)){const l=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw l.code="ERR_INVALID_ARG_TYPE",l}if(t.protocol!=="file:"){const l=new TypeError("The URL must be of scheme file");throw l.code="ERR_INVALID_URL_SCHEME",l}return P3(t)}function P3(t){if(t.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const l=t.pathname;let r=-1;for(;++r<l.length;)if(l.codePointAt(r)===37&&l.codePointAt(r+1)===50){const i=l.codePointAt(r+2);if(i===70||i===102){const c=new TypeError("File URL path must not include encoded / characters");throw c.code="ERR_INVALID_FILE_URL_PATH",c}}return decodeURIComponent(l)}const rf=["history","path","basename","stem","extname","dirname"];class Ny{constructor(l){let r;l?Xf(l)?r={path:l}:typeof l=="string"||ek(l)?r={value:l}:r=l:r={},this.cwd="cwd"in r?"":W3.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<rf.length;){const u=rf[i];u in r&&r[u]!==void 0&&r[u]!==null&&(this[u]=u==="history"?[...r[u]]:r[u])}let c;for(c in r)rf.includes(c)||(this[c]=r[c])}get basename(){return typeof this.path=="string"?Fl.basename(this.path):void 0}set basename(l){sf(l,"basename"),af(l,"basename"),this.path=Fl.join(this.dirname||"",l)}get dirname(){return typeof this.path=="string"?Fl.dirname(this.path):void 0}set dirname(l){G1(this.basename,"dirname"),this.path=Fl.join(l||"",this.basename)}get extname(){return typeof this.path=="string"?Fl.extname(this.path):void 0}set extname(l){if(af(l,"extname"),G1(this.dirname,"extname"),l){if(l.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(l.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Fl.join(this.dirname,this.stem+(l||""))}get path(){return this.history[this.history.length-1]}set path(l){Xf(l)&&(l=J3(l)),sf(l,"path"),this.path!==l&&this.history.push(l)}get stem(){return typeof this.path=="string"?Fl.basename(this.path,this.extname):void 0}set stem(l){sf(l,"stem"),af(l,"stem"),this.path=Fl.join(this.dirname||"",l+(this.extname||""))}fail(l,r,i){const c=this.message(l,r,i);throw c.fatal=!0,c}info(l,r,i){const c=this.message(l,r,i);return c.fatal=void 0,c}message(l,r,i){const c=new jn(l,r,i);return this.path&&(c.name=this.path+":"+c.name,c.file=this.path),c.fatal=!1,this.messages.push(c),c}toString(l){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(l||void 0).decode(this.value)}}function af(t,l){if(t&&t.includes(Fl.sep))throw new Error("`"+l+"` cannot be a path: did not expect `"+Fl.sep+"`")}function sf(t,l){if(!t)throw new Error("`"+l+"` cannot be empty")}function G1(t,l){if(!t)throw new Error("Setting `"+l+"` requires `path` to be set too")}function ek(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const tk=(function(t){const i=this.constructor.prototype,c=i[t],u=function(){return c.apply(u,arguments)};return Object.setPrototypeOf(u,i),u}),nk={}.hasOwnProperty;class yh extends tk{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=I3()}copy(){const l=new yh;let r=-1;for(;++r<this.attachers.length;){const i=this.attachers[r];l.use(...i)}return l.data(lf(!0,{},this.namespace)),l}data(l,r){return typeof l=="string"?arguments.length===2?(uf("data",this.frozen),this.namespace[l]=r,this):nk.call(this.namespace,l)&&this.namespace[l]||void 0:l?(uf("data",this.frozen),this.namespace=l,this):this.namespace}freeze(){if(this.frozen)return this;const l=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...i]=this.attachers[this.freezeIndex];if(i[0]===!1)continue;i[0]===!0&&(i[0]=void 0);const c=r.call(l,...i);typeof c=="function"&&this.transformers.use(c)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(l){this.freeze();const r=lc(l),i=this.parser||this.Parser;return of("parse",i),i(String(r),r)}process(l,r){const i=this;return this.freeze(),of("process",this.parser||this.Parser),cf("process",this.compiler||this.Compiler),r?c(void 0,r):new Promise(c);function c(u,d){const m=lc(l),x=i.parse(m);i.run(x,m,function(g,y,b){if(g||!y||!b)return f(g);const v=y,S=i.stringify(v,b);ak(S)?b.value=S:b.result=S,f(g,b)});function f(g,y){g||!y?d(g):u?u(y):r(void 0,y)}}}processSync(l){let r=!1,i;return this.freeze(),of("processSync",this.parser||this.Parser),cf("processSync",this.compiler||this.Compiler),this.process(l,c),Q1("processSync","process",r),i;function c(u,d){r=!0,X1(u),i=d}}run(l,r,i){K1(l),this.freeze();const c=this.transformers;return!i&&typeof r=="function"&&(i=r,r=void 0),i?u(void 0,i):new Promise(u);function u(d,m){const x=lc(r);c.run(l,x,f);function f(g,y,b){const v=y||l;g?m(g):d?d(v):i(void 0,v,b)}}}runSync(l,r){let i=!1,c;return this.run(l,r,u),Q1("runSync","run",i),c;function u(d,m){X1(d),c=m,i=!0}}stringify(l,r){this.freeze();const i=lc(r),c=this.compiler||this.Compiler;return cf("stringify",c),K1(l),c(l,i)}use(l,...r){const i=this.attachers,c=this.namespace;if(uf("use",this.frozen),l!=null)if(typeof l=="function")x(l,r);else if(typeof l=="object")Array.isArray(l)?m(l):d(l);else throw new TypeError("Expected usable value, not `"+l+"`");return this;function u(f){if(typeof f=="function")x(f,[]);else if(typeof f=="object")if(Array.isArray(f)){const[g,...y]=f;x(g,y)}else d(f);else throw new TypeError("Expected usable value, not `"+f+"`")}function d(f){if(!("plugins"in f)&&!("settings"in f))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");m(f.plugins),f.settings&&(c.settings=lf(!0,c.settings,f.settings))}function m(f){let g=-1;if(f!=null)if(Array.isArray(f))for(;++g<f.length;){const y=f[g];u(y)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function x(f,g){let y=-1,b=-1;for(;++y<i.length;)if(i[y][0]===f){b=y;break}if(b===-1)i.push([f,...g]);else if(g.length>0){let[v,...S]=g;const j=i[b][1];qf(j)&&qf(v)&&(v=lf(!0,j,v)),i[b]=[f,v,...S]}}}}const lk=new yh().freeze();function of(t,l){if(typeof l!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function cf(t,l){if(typeof l!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function uf(t,l){if(l)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function K1(t){if(!qf(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function Q1(t,l,r){if(!r)throw new Error("`"+t+"` finished async. Use `"+l+"` instead")}function lc(t){return rk(t)?t:new Ny(t)}function rk(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function ak(t){return typeof t=="string"||ik(t)}function ik(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const sk="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",W1=[],Z1={allowDangerousHtml:!0},ok=/^(https?|ircs?|mailto|xmpp)$/i,ck=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Ay(t){const l=uk(t),r=dk(t);return fk(l.runSync(l.parse(r),r),t)}function uk(t){const l=t.rehypePlugins||W1,r=t.remarkPlugins||W1,i=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...Z1}:Z1;return lk().use(X5).use(r).use($3,i).use(l)}function dk(t){const l=t.children||"",r=new Ny;return typeof l=="string"&&(r.value=l),r}function fk(t,l){const r=l.allowedElements,i=l.allowElement,c=l.components,u=l.disallowedElements,d=l.skipHtml,m=l.unwrapDisallowed,x=l.urlTransform||hk;for(const g of ck)Object.hasOwn(l,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+sk+g.id,void 0);return ph(t,f),Av(t,{Fragment:s.Fragment,components:c,ignoreInvalidStyle:!0,jsx:s.jsx,jsxs:s.jsxs,passKeys:!0,passNode:!0});function f(g,y,b){if(g.type==="raw"&&b&&typeof y=="number")return d?b.children.splice(y,1):b.children[y]={type:"text",value:g.value},y;if(g.type==="element"){let v;for(v in Pd)if(Object.hasOwn(Pd,v)&&Object.hasOwn(g.properties,v)){const S=g.properties[v],j=Pd[v];(j===null||j.includes(g.tagName))&&(g.properties[v]=x(String(S||""),v,g))}}if(g.type==="element"){let v=r?!r.includes(g.tagName):u?u.includes(g.tagName):!1;if(!v&&i&&typeof y=="number"&&(v=!i(g,y,b)),v&&b&&typeof y=="number")return m&&g.children?b.children.splice(y,1,...g.children):b.children.splice(y,1),y}}}function hk(t){const l=t.indexOf(":"),r=t.indexOf("?"),i=t.indexOf("#"),c=t.indexOf("/");return l===-1||c!==-1&&l>c||r!==-1&&l>r||i!==-1&&l>i||ok.test(t.slice(0,l))?t:""}function J1(t,l){const r=String(t);if(typeof l!="string")throw new TypeError("Expected character");let i=0,c=r.indexOf(l);for(;c!==-1;)i++,c=r.indexOf(l,c+l.length);return i}function mk(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function xk(t,l,r){const c=Bc((r||{}).ignore||[]),u=pk(l);let d=-1;for(;++d<u.length;)Ey(t,"text",m);function m(f,g){let y=-1,b;for(;++y<g.length;){const v=g[y],S=b?b.children:void 0;if(c(v,S?S.indexOf(v):void 0,b))return;b=v}if(b)return x(f,g)}function x(f,g){const y=g[g.length-1],b=u[d][0],v=u[d][1];let S=0;const E=y.children.indexOf(f);let C=!1,A=[];b.lastIndex=0;let F=b.exec(f.value);for(;F;){const _=F.index,H={index:F.index,input:F.input,stack:[...g,f]};let M=v(...F,H);if(typeof M=="string"&&(M=M.length>0?{type:"text",value:M}:void 0),M===!1?b.lastIndex=_+1:(S!==_&&A.push({type:"text",value:f.value.slice(S,_)}),Array.isArray(M)?A.push(...M):M&&A.push(M),S=_+F[0].length,C=!0),!b.global)break;F=b.exec(f.value)}return C?(S<f.value.length&&A.push({type:"text",value:f.value.slice(S)}),y.children.splice(E,1,...A)):A=[f],E+A.length}}function pk(t){const l=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!t[0]||Array.isArray(t[0])?t:[t];let i=-1;for(;++i<r.length;){const c=r[i];l.push([yk(c[0]),gk(c[1])])}return l}function yk(t){return typeof t=="string"?new RegExp(mk(t),"g"):t}function gk(t){return typeof t=="function"?t:function(){return t}}const df="phrasing",ff=["autolink","link","image","label"];function bk(){return{transforms:[Ek],enter:{literalAutolink:wk,literalAutolinkEmail:hf,literalAutolinkHttp:hf,literalAutolinkWww:hf},exit:{literalAutolink:Ck,literalAutolinkEmail:Sk,literalAutolinkHttp:kk,literalAutolinkWww:jk}}}function vk(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:df,notInConstruct:ff},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:df,notInConstruct:ff},{character:":",before:"[ps]",after:"\\/",inConstruct:df,notInConstruct:ff}]}}function wk(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function hf(t){this.config.enter.autolinkProtocol.call(this,t)}function kk(t){this.config.exit.autolinkProtocol.call(this,t)}function jk(t){this.config.exit.data.call(this,t);const l=this.stack[this.stack.length-1];l.type,l.url="http://"+this.sliceSerialize(t)}function Sk(t){this.config.exit.autolinkEmail.call(this,t)}function Ck(t){this.exit(t)}function Ek(t){xk(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Nk],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Ak]],{ignore:["link","linkReference"]})}function Nk(t,l,r,i,c){let u="";if(!Ty(c)||(/^w/i.test(l)&&(r=l+r,l="",u="http://"),!Tk(r)))return!1;const d=Dk(r+i);if(!d[0])return!1;const m={type:"link",title:null,url:u+l+d[0],children:[{type:"text",value:l+d[0]}]};return d[1]?[m,{type:"text",value:d[1]}]:m}function Ak(t,l,r,i){return!Ty(i,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+l+"@"+r,children:[{type:"text",value:l+"@"+r}]}}function Tk(t){const l=t.split(".");return!(l.length<2||l[l.length-1]&&(/_/.test(l[l.length-1])||!/[a-zA-Z\d]/.test(l[l.length-1]))||l[l.length-2]&&(/_/.test(l[l.length-2])||!/[a-zA-Z\d]/.test(l[l.length-2])))}function Dk(t){const l=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!l)return[t,void 0];t=t.slice(0,l.index);let r=l[0],i=r.indexOf(")");const c=J1(t,"(");let u=J1(t,")");for(;i!==-1&&c>u;)t+=r.slice(0,i+1),r=r.slice(i+1),i=r.indexOf(")"),u++;return[t,r]}function Ty(t,l){const r=t.input.charCodeAt(t.index-1);return(t.index===0||ka(r)||Rc(r))&&(!l||r!==47)}Dy.peek=$k;function zk(){this.buffer()}function Mk(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function Fk(){this.buffer()}function Rk(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function _k(t){const l=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=bl(this.sliceSerialize(t)).toLowerCase(),r.label=l}function Ok(t){this.exit(t)}function Bk(t){const l=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=bl(this.sliceSerialize(t)).toLowerCase(),r.label=l}function Lk(t){this.exit(t)}function $k(){return"["}function Dy(t,l,r,i){const c=r.createTracker(i);let u=c.move("[^");const d=r.enter("footnoteReference"),m=r.enter("reference");return u+=c.move(r.safe(r.associationId(t),{after:"]",before:u})),m(),d(),u+=c.move("]"),u}function Hk(){return{enter:{gfmFootnoteCallString:zk,gfmFootnoteCall:Mk,gfmFootnoteDefinitionLabelString:Fk,gfmFootnoteDefinition:Rk},exit:{gfmFootnoteCallString:_k,gfmFootnoteCall:Ok,gfmFootnoteDefinitionLabelString:Bk,gfmFootnoteDefinition:Lk}}}function Uk(t){let l=!1;return t&&t.firstLineBlank&&(l=!0),{handlers:{footnoteDefinition:r,footnoteReference:Dy},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(i,c,u,d){const m=u.createTracker(d);let x=m.move("[^");const f=u.enter("footnoteDefinition"),g=u.enter("label");return x+=m.move(u.safe(u.associationId(i),{before:x,after:"]"})),g(),x+=m.move("]:"),i.children&&i.children.length>0&&(m.shift(4),x+=m.move((l?`
|
|
64
|
-
`:" ")+u.indentLines(u.containerFlow(i,m.current()),l?
|
|
65
|
-
`)}function Zk(t){return t==null?"":String(t)}function
|
|
62
|
+
`}),r}function X1(t){let l=0,r=t.charCodeAt(l);for(;r===9||r===32;)l++,r=t.charCodeAt(l);return t.slice(l)}function V1(t,l){const r=R3(t,l),i=r.one(t,void 0),c=S3(r),u=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return c&&u.children.push({type:"text",value:`
|
|
63
|
+
`},c),u}function $3(t,l){return t&&"run"in t?async function(r,i){const c=V1(r,{file:i,...l});await t.run(c,i)}:function(r,i){return V1(r,{file:i,...t||l})}}function G1(t){if(t)throw t}var nf,K1;function H3(){if(K1)return nf;K1=1;var t=Object.prototype.hasOwnProperty,l=Object.prototype.toString,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,c=function(f){return typeof Array.isArray=="function"?Array.isArray(f):l.call(f)==="[object Array]"},u=function(f){if(!f||l.call(f)!=="[object Object]")return!1;var g=t.call(f,"constructor"),y=f.constructor&&f.constructor.prototype&&t.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!g&&!y)return!1;var b;for(b in f);return typeof b>"u"||t.call(f,b)},d=function(f,g){r&&g.name==="__proto__"?r(f,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):f[g.name]=g.newValue},m=function(f,g){if(g==="__proto__")if(t.call(f,g)){if(i)return i(f,g).value}else return;return f[g]};return nf=function x(){var f,g,y,b,v,S,j=arguments[0],E=1,C=arguments.length,A=!1;for(typeof j=="boolean"&&(A=j,j=arguments[1]||{},E=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});E<C;++E)if(f=arguments[E],f!=null)for(g in f)y=m(j,g),b=m(f,g),j!==b&&(A&&b&&(u(b)||(v=c(b)))?(v?(v=!1,S=y&&c(y)?y:[]):S=y&&u(y)?y:{},d(j,{name:g,newValue:x(A,S,b)})):typeof b<"u"&&d(j,{name:g,newValue:b}));return j},nf}var U3=H3();const lf=G0(U3);function qf(t){if(typeof t!="object"||t===null)return!1;const l=Object.getPrototypeOf(t);return(l===null||l===Object.prototype||Object.getPrototypeOf(l)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function I3(){const t=[],l={run:r,use:i};return l;function r(...c){let u=-1;const d=c.pop();if(typeof d!="function")throw new TypeError("Expected function as last argument, not "+d);m(null,...c);function m(x,...f){const g=t[++u];let y=-1;if(x){d(x);return}for(;++y<c.length;)(f[y]===null||f[y]===void 0)&&(f[y]=c[y]);c=f,g?Y3(g,m)(...f):d(null,...f)}}function i(c){if(typeof c!="function")throw new TypeError("Expected `middelware` to be a function, not "+c);return t.push(c),l}}function Y3(t,l){let r;return i;function i(...d){const m=t.length>d.length;let x;m&&d.push(c);try{x=t.apply(this,d)}catch(f){const g=f;if(m&&r)throw g;return c(g)}m||(x&&x.then&&typeof x.then=="function"?x.then(u,c):x instanceof Error?c(x):u(x))}function c(d,...m){r||(r=!0,l(d,...m))}function u(d){c(null,d)}}const Fl={basename:q3,dirname:X3,extname:V3,join:G3,sep:"/"};function q3(t,l){if(l!==void 0&&typeof l!="string")throw new TypeError('"ext" argument must be a string');Us(t);let r=0,i=-1,c=t.length,u;if(l===void 0||l.length===0||l.length>t.length){for(;c--;)if(t.codePointAt(c)===47){if(u){r=c+1;break}}else i<0&&(u=!0,i=c+1);return i<0?"":t.slice(r,i)}if(l===t)return"";let d=-1,m=l.length-1;for(;c--;)if(t.codePointAt(c)===47){if(u){r=c+1;break}}else d<0&&(u=!0,d=c+1),m>-1&&(t.codePointAt(c)===l.codePointAt(m--)?m<0&&(i=c):(m=-1,i=d));return r===i?i=d:i<0&&(i=t.length),t.slice(r,i)}function X3(t){if(Us(t),t.length===0)return".";let l=-1,r=t.length,i;for(;--r;)if(t.codePointAt(r)===47){if(i){l=r;break}}else i||(i=!0);return l<0?t.codePointAt(0)===47?"/":".":l===1&&t.codePointAt(0)===47?"//":t.slice(0,l)}function V3(t){Us(t);let l=t.length,r=-1,i=0,c=-1,u=0,d;for(;l--;){const m=t.codePointAt(l);if(m===47){if(d){i=l+1;break}continue}r<0&&(d=!0,r=l+1),m===46?c<0?c=l:u!==1&&(u=1):c>-1&&(u=-1)}return c<0||r<0||u===0||u===1&&c===r-1&&c===i+1?"":t.slice(c,r)}function G3(...t){let l=-1,r;for(;++l<t.length;)Us(t[l]),t[l]&&(r=r===void 0?t[l]:r+"/"+t[l]);return r===void 0?".":K3(r)}function K3(t){Us(t);const l=t.codePointAt(0)===47;let r=Q3(t,!l);return r.length===0&&!l&&(r="."),r.length>0&&t.codePointAt(t.length-1)===47&&(r+="/"),l?"/"+r:r}function Q3(t,l){let r="",i=0,c=-1,u=0,d=-1,m,x;for(;++d<=t.length;){if(d<t.length)m=t.codePointAt(d);else{if(m===47)break;m=47}if(m===47){if(!(c===d-1||u===1))if(c!==d-1&&u===2){if(r.length<2||i!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(x=r.lastIndexOf("/"),x!==r.length-1){x<0?(r="",i=0):(r=r.slice(0,x),i=r.length-1-r.lastIndexOf("/")),c=d,u=0;continue}}else if(r.length>0){r="",i=0,c=d,u=0;continue}}l&&(r=r.length>0?r+"/..":"..",i=2)}else r.length>0?r+="/"+t.slice(c+1,d):r=t.slice(c+1,d),i=d-c-1;c=d,u=0}else m===46&&u>-1?u++:u=-1}return r}function Us(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const W3={cwd:Z3};function Z3(){return"/"}function Xf(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function J3(t){if(typeof t=="string")t=new URL(t);else if(!Xf(t)){const l=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw l.code="ERR_INVALID_ARG_TYPE",l}if(t.protocol!=="file:"){const l=new TypeError("The URL must be of scheme file");throw l.code="ERR_INVALID_URL_SCHEME",l}return P3(t)}function P3(t){if(t.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const l=t.pathname;let r=-1;for(;++r<l.length;)if(l.codePointAt(r)===37&&l.codePointAt(r+1)===50){const i=l.codePointAt(r+2);if(i===70||i===102){const c=new TypeError("File URL path must not include encoded / characters");throw c.code="ERR_INVALID_FILE_URL_PATH",c}}return decodeURIComponent(l)}const rf=["history","path","basename","stem","extname","dirname"];class Ty{constructor(l){let r;l?Xf(l)?r={path:l}:typeof l=="string"||ek(l)?r={value:l}:r=l:r={},this.cwd="cwd"in r?"":W3.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<rf.length;){const u=rf[i];u in r&&r[u]!==void 0&&r[u]!==null&&(this[u]=u==="history"?[...r[u]]:r[u])}let c;for(c in r)rf.includes(c)||(this[c]=r[c])}get basename(){return typeof this.path=="string"?Fl.basename(this.path):void 0}set basename(l){sf(l,"basename"),af(l,"basename"),this.path=Fl.join(this.dirname||"",l)}get dirname(){return typeof this.path=="string"?Fl.dirname(this.path):void 0}set dirname(l){Q1(this.basename,"dirname"),this.path=Fl.join(l||"",this.basename)}get extname(){return typeof this.path=="string"?Fl.extname(this.path):void 0}set extname(l){if(af(l,"extname"),Q1(this.dirname,"extname"),l){if(l.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(l.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Fl.join(this.dirname,this.stem+(l||""))}get path(){return this.history[this.history.length-1]}set path(l){Xf(l)&&(l=J3(l)),sf(l,"path"),this.path!==l&&this.history.push(l)}get stem(){return typeof this.path=="string"?Fl.basename(this.path,this.extname):void 0}set stem(l){sf(l,"stem"),af(l,"stem"),this.path=Fl.join(this.dirname||"",l+(this.extname||""))}fail(l,r,i){const c=this.message(l,r,i);throw c.fatal=!0,c}info(l,r,i){const c=this.message(l,r,i);return c.fatal=void 0,c}message(l,r,i){const c=new jn(l,r,i);return this.path&&(c.name=this.path+":"+c.name,c.file=this.path),c.fatal=!1,this.messages.push(c),c}toString(l){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(l||void 0).decode(this.value)}}function af(t,l){if(t&&t.includes(Fl.sep))throw new Error("`"+l+"` cannot be a path: did not expect `"+Fl.sep+"`")}function sf(t,l){if(!t)throw new Error("`"+l+"` cannot be empty")}function Q1(t,l){if(!t)throw new Error("Setting `"+l+"` requires `path` to be set too")}function ek(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const tk=(function(t){const i=this.constructor.prototype,c=i[t],u=function(){return c.apply(u,arguments)};return Object.setPrototypeOf(u,i),u}),nk={}.hasOwnProperty;class yh extends tk{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=I3()}copy(){const l=new yh;let r=-1;for(;++r<this.attachers.length;){const i=this.attachers[r];l.use(...i)}return l.data(lf(!0,{},this.namespace)),l}data(l,r){return typeof l=="string"?arguments.length===2?(uf("data",this.frozen),this.namespace[l]=r,this):nk.call(this.namespace,l)&&this.namespace[l]||void 0:l?(uf("data",this.frozen),this.namespace=l,this):this.namespace}freeze(){if(this.frozen)return this;const l=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...i]=this.attachers[this.freezeIndex];if(i[0]===!1)continue;i[0]===!0&&(i[0]=void 0);const c=r.call(l,...i);typeof c=="function"&&this.transformers.use(c)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(l){this.freeze();const r=lc(l),i=this.parser||this.Parser;return of("parse",i),i(String(r),r)}process(l,r){const i=this;return this.freeze(),of("process",this.parser||this.Parser),cf("process",this.compiler||this.Compiler),r?c(void 0,r):new Promise(c);function c(u,d){const m=lc(l),x=i.parse(m);i.run(x,m,function(g,y,b){if(g||!y||!b)return f(g);const v=y,S=i.stringify(v,b);ak(S)?b.value=S:b.result=S,f(g,b)});function f(g,y){g||!y?d(g):u?u(y):r(void 0,y)}}}processSync(l){let r=!1,i;return this.freeze(),of("processSync",this.parser||this.Parser),cf("processSync",this.compiler||this.Compiler),this.process(l,c),Z1("processSync","process",r),i;function c(u,d){r=!0,G1(u),i=d}}run(l,r,i){W1(l),this.freeze();const c=this.transformers;return!i&&typeof r=="function"&&(i=r,r=void 0),i?u(void 0,i):new Promise(u);function u(d,m){const x=lc(r);c.run(l,x,f);function f(g,y,b){const v=y||l;g?m(g):d?d(v):i(void 0,v,b)}}}runSync(l,r){let i=!1,c;return this.run(l,r,u),Z1("runSync","run",i),c;function u(d,m){G1(d),c=m,i=!0}}stringify(l,r){this.freeze();const i=lc(r),c=this.compiler||this.Compiler;return cf("stringify",c),W1(l),c(l,i)}use(l,...r){const i=this.attachers,c=this.namespace;if(uf("use",this.frozen),l!=null)if(typeof l=="function")x(l,r);else if(typeof l=="object")Array.isArray(l)?m(l):d(l);else throw new TypeError("Expected usable value, not `"+l+"`");return this;function u(f){if(typeof f=="function")x(f,[]);else if(typeof f=="object")if(Array.isArray(f)){const[g,...y]=f;x(g,y)}else d(f);else throw new TypeError("Expected usable value, not `"+f+"`")}function d(f){if(!("plugins"in f)&&!("settings"in f))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");m(f.plugins),f.settings&&(c.settings=lf(!0,c.settings,f.settings))}function m(f){let g=-1;if(f!=null)if(Array.isArray(f))for(;++g<f.length;){const y=f[g];u(y)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function x(f,g){let y=-1,b=-1;for(;++y<i.length;)if(i[y][0]===f){b=y;break}if(b===-1)i.push([f,...g]);else if(g.length>0){let[v,...S]=g;const j=i[b][1];qf(j)&&qf(v)&&(v=lf(!0,j,v)),i[b]=[f,v,...S]}}}}const lk=new yh().freeze();function of(t,l){if(typeof l!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function cf(t,l){if(typeof l!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function uf(t,l){if(l)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function W1(t){if(!qf(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function Z1(t,l,r){if(!r)throw new Error("`"+t+"` finished async. Use `"+l+"` instead")}function lc(t){return rk(t)?t:new Ty(t)}function rk(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function ak(t){return typeof t=="string"||ik(t)}function ik(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const sk="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",J1=[],P1={allowDangerousHtml:!0},ok=/^(https?|ircs?|mailto|xmpp)$/i,ck=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function gh(t){const l=uk(t),r=dk(t);return fk(l.runSync(l.parse(r),r),t)}function uk(t){const l=t.rehypePlugins||J1,r=t.remarkPlugins||J1,i=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...P1}:P1;return lk().use(X5).use(r).use($3,i).use(l)}function dk(t){const l=t.children||"",r=new Ty;return typeof l=="string"&&(r.value=l),r}function fk(t,l){const r=l.allowedElements,i=l.allowElement,c=l.components,u=l.disallowedElements,d=l.skipHtml,m=l.unwrapDisallowed,x=l.urlTransform||hk;for(const g of ck)Object.hasOwn(l,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+sk+g.id,void 0);return ph(t,f),Av(t,{Fragment:s.Fragment,components:c,ignoreInvalidStyle:!0,jsx:s.jsx,jsxs:s.jsxs,passKeys:!0,passNode:!0});function f(g,y,b){if(g.type==="raw"&&b&&typeof y=="number")return d?b.children.splice(y,1):b.children[y]={type:"text",value:g.value},y;if(g.type==="element"){let v;for(v in Pd)if(Object.hasOwn(Pd,v)&&Object.hasOwn(g.properties,v)){const S=g.properties[v],j=Pd[v];(j===null||j.includes(g.tagName))&&(g.properties[v]=x(String(S||""),v,g))}}if(g.type==="element"){let v=r?!r.includes(g.tagName):u?u.includes(g.tagName):!1;if(!v&&i&&typeof y=="number"&&(v=!i(g,y,b)),v&&b&&typeof y=="number")return m&&g.children?b.children.splice(y,1,...g.children):b.children.splice(y,1),y}}}function hk(t){const l=t.indexOf(":"),r=t.indexOf("?"),i=t.indexOf("#"),c=t.indexOf("/");return l===-1||c!==-1&&l>c||r!==-1&&l>r||i!==-1&&l>i||ok.test(t.slice(0,l))?t:""}function e0(t,l){const r=String(t);if(typeof l!="string")throw new TypeError("Expected character");let i=0,c=r.indexOf(l);for(;c!==-1;)i++,c=r.indexOf(l,c+l.length);return i}function mk(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function xk(t,l,r){const c=Bc((r||{}).ignore||[]),u=pk(l);let d=-1;for(;++d<u.length;)Ay(t,"text",m);function m(f,g){let y=-1,b;for(;++y<g.length;){const v=g[y],S=b?b.children:void 0;if(c(v,S?S.indexOf(v):void 0,b))return;b=v}if(b)return x(f,g)}function x(f,g){const y=g[g.length-1],b=u[d][0],v=u[d][1];let S=0;const E=y.children.indexOf(f);let C=!1,A=[];b.lastIndex=0;let F=b.exec(f.value);for(;F;){const _=F.index,H={index:F.index,input:F.input,stack:[...g,f]};let M=v(...F,H);if(typeof M=="string"&&(M=M.length>0?{type:"text",value:M}:void 0),M===!1?b.lastIndex=_+1:(S!==_&&A.push({type:"text",value:f.value.slice(S,_)}),Array.isArray(M)?A.push(...M):M&&A.push(M),S=_+F[0].length,C=!0),!b.global)break;F=b.exec(f.value)}return C?(S<f.value.length&&A.push({type:"text",value:f.value.slice(S)}),y.children.splice(E,1,...A)):A=[f],E+A.length}}function pk(t){const l=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!t[0]||Array.isArray(t[0])?t:[t];let i=-1;for(;++i<r.length;){const c=r[i];l.push([yk(c[0]),gk(c[1])])}return l}function yk(t){return typeof t=="string"?new RegExp(mk(t),"g"):t}function gk(t){return typeof t=="function"?t:function(){return t}}const df="phrasing",ff=["autolink","link","image","label"];function bk(){return{transforms:[Ek],enter:{literalAutolink:wk,literalAutolinkEmail:hf,literalAutolinkHttp:hf,literalAutolinkWww:hf},exit:{literalAutolink:Ck,literalAutolinkEmail:Sk,literalAutolinkHttp:kk,literalAutolinkWww:jk}}}function vk(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:df,notInConstruct:ff},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:df,notInConstruct:ff},{character:":",before:"[ps]",after:"\\/",inConstruct:df,notInConstruct:ff}]}}function wk(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function hf(t){this.config.enter.autolinkProtocol.call(this,t)}function kk(t){this.config.exit.autolinkProtocol.call(this,t)}function jk(t){this.config.exit.data.call(this,t);const l=this.stack[this.stack.length-1];l.type,l.url="http://"+this.sliceSerialize(t)}function Sk(t){this.config.exit.autolinkEmail.call(this,t)}function Ck(t){this.exit(t)}function Ek(t){xk(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Nk],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Ak]],{ignore:["link","linkReference"]})}function Nk(t,l,r,i,c){let u="";if(!Dy(c)||(/^w/i.test(l)&&(r=l+r,l="",u="http://"),!Tk(r)))return!1;const d=Dk(r+i);if(!d[0])return!1;const m={type:"link",title:null,url:u+l+d[0],children:[{type:"text",value:l+d[0]}]};return d[1]?[m,{type:"text",value:d[1]}]:m}function Ak(t,l,r,i){return!Dy(i,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+l+"@"+r,children:[{type:"text",value:l+"@"+r}]}}function Tk(t){const l=t.split(".");return!(l.length<2||l[l.length-1]&&(/_/.test(l[l.length-1])||!/[a-zA-Z\d]/.test(l[l.length-1]))||l[l.length-2]&&(/_/.test(l[l.length-2])||!/[a-zA-Z\d]/.test(l[l.length-2])))}function Dk(t){const l=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!l)return[t,void 0];t=t.slice(0,l.index);let r=l[0],i=r.indexOf(")");const c=e0(t,"(");let u=e0(t,")");for(;i!==-1&&c>u;)t+=r.slice(0,i+1),r=r.slice(i+1),i=r.indexOf(")"),u++;return[t,r]}function Dy(t,l){const r=t.input.charCodeAt(t.index-1);return(t.index===0||ka(r)||Rc(r))&&(!l||r!==47)}zy.peek=$k;function zk(){this.buffer()}function Mk(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function Fk(){this.buffer()}function Rk(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function _k(t){const l=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=bl(this.sliceSerialize(t)).toLowerCase(),r.label=l}function Ok(t){this.exit(t)}function Bk(t){const l=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=bl(this.sliceSerialize(t)).toLowerCase(),r.label=l}function Lk(t){this.exit(t)}function $k(){return"["}function zy(t,l,r,i){const c=r.createTracker(i);let u=c.move("[^");const d=r.enter("footnoteReference"),m=r.enter("reference");return u+=c.move(r.safe(r.associationId(t),{after:"]",before:u})),m(),d(),u+=c.move("]"),u}function Hk(){return{enter:{gfmFootnoteCallString:zk,gfmFootnoteCall:Mk,gfmFootnoteDefinitionLabelString:Fk,gfmFootnoteDefinition:Rk},exit:{gfmFootnoteCallString:_k,gfmFootnoteCall:Ok,gfmFootnoteDefinitionLabelString:Bk,gfmFootnoteDefinition:Lk}}}function Uk(t){let l=!1;return t&&t.firstLineBlank&&(l=!0),{handlers:{footnoteDefinition:r,footnoteReference:zy},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(i,c,u,d){const m=u.createTracker(d);let x=m.move("[^");const f=u.enter("footnoteDefinition"),g=u.enter("label");return x+=m.move(u.safe(u.associationId(i),{before:x,after:"]"})),g(),x+=m.move("]:"),i.children&&i.children.length>0&&(m.shift(4),x+=m.move((l?`
|
|
64
|
+
`:" ")+u.indentLines(u.containerFlow(i,m.current()),l?My:Ik))),f(),x}}function Ik(t,l,r){return l===0?t:My(t,l,r)}function My(t,l,r){return(r?"":" ")+t}const Yk=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Fy.peek=Kk;function qk(){return{canContainEols:["delete"],enter:{strikethrough:Vk},exit:{strikethrough:Gk}}}function Xk(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Yk}],handlers:{delete:Fy}}}function Vk(t){this.enter({type:"delete",children:[]},t)}function Gk(t){this.exit(t)}function Fy(t,l,r,i){const c=r.createTracker(i),u=r.enter("strikethrough");let d=c.move("~~");return d+=r.containerPhrasing(t,{...c.current(),before:d,after:"~"}),d+=c.move("~~"),u(),d}function Kk(){return"~"}function Qk(t){return t.length}function Wk(t,l){const r=l||{},i=(r.align||[]).concat(),c=r.stringLength||Qk,u=[],d=[],m=[],x=[];let f=0,g=-1;for(;++g<t.length;){const j=[],E=[];let C=-1;for(t[g].length>f&&(f=t[g].length);++C<t[g].length;){const A=Zk(t[g][C]);if(r.alignDelimiters!==!1){const F=c(A);E[C]=F,(x[C]===void 0||F>x[C])&&(x[C]=F)}j.push(A)}d[g]=j,m[g]=E}let y=-1;if(typeof i=="object"&&"length"in i)for(;++y<f;)u[y]=t0(i[y]);else{const j=t0(i);for(;++y<f;)u[y]=j}y=-1;const b=[],v=[];for(;++y<f;){const j=u[y];let E="",C="";j===99?(E=":",C=":"):j===108?E=":":j===114&&(C=":");let A=r.alignDelimiters===!1?1:Math.max(1,x[y]-E.length-C.length);const F=E+"-".repeat(A)+C;r.alignDelimiters!==!1&&(A=E.length+A+C.length,A>x[y]&&(x[y]=A),v[y]=A),b[y]=F}d.splice(1,0,b),m.splice(1,0,v),g=-1;const S=[];for(;++g<d.length;){const j=d[g],E=m[g];y=-1;const C=[];for(;++y<f;){const A=j[y]||"";let F="",_="";if(r.alignDelimiters!==!1){const H=x[y]-(E[y]||0),M=u[y];M===114?F=" ".repeat(H):M===99?H%2?(F=" ".repeat(H/2+.5),_=" ".repeat(H/2-.5)):(F=" ".repeat(H/2),_=F):_=" ".repeat(H)}r.delimiterStart!==!1&&!y&&C.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&A==="")&&(r.delimiterStart!==!1||y)&&C.push(" "),r.alignDelimiters!==!1&&C.push(F),C.push(A),r.alignDelimiters!==!1&&C.push(_),r.padding!==!1&&C.push(" "),(r.delimiterEnd!==!1||y!==f-1)&&C.push("|")}S.push(r.delimiterEnd===!1?C.join("").replace(/ +$/,""):C.join(""))}return S.join(`
|
|
65
|
+
`)}function Zk(t){return t==null?"":String(t)}function t0(t){const l=typeof t=="string"?t.codePointAt(0):0;return l===67||l===99?99:l===76||l===108?108:l===82||l===114?114:0}function Jk(t,l,r,i){const c=r.enter("blockquote"),u=r.createTracker(i);u.move("> "),u.shift(2);const d=r.indentLines(r.containerFlow(t,u.current()),Pk);return c(),d}function Pk(t,l,r){return">"+(r?"":" ")+t}function e4(t,l){return n0(t,l.inConstruct,!0)&&!n0(t,l.notInConstruct,!1)}function n0(t,l,r){if(typeof l=="string"&&(l=[l]),!l||l.length===0)return r;let i=-1;for(;++i<l.length;)if(t.includes(l[i]))return!0;return!1}function l0(t,l,r,i){let c=-1;for(;++c<r.unsafe.length;)if(r.unsafe[c].character===`
|
|
66
66
|
`&&e4(r.stack,r.unsafe[c]))return/[ \t]/.test(i.before)?"":" ";return`\\
|
|
67
67
|
`}function t4(t,l){const r=String(t);let i=r.indexOf(l),c=i,u=0,d=0;if(typeof l!="string")throw new TypeError("Expected substring");for(;i!==-1;)i===c?++u>d&&(d=u):u=1,c=i+l.length,i=r.indexOf(l,c);return d}function n4(t,l){return!!(l.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function l4(t){const l=t.options.fence||"`";if(l!=="`"&&l!=="~")throw new Error("Cannot serialize code with `"+l+"` for `options.fence`, expected `` ` `` or `~`");return l}function r4(t,l,r,i){const c=l4(r),u=t.value||"",d=c==="`"?"GraveAccent":"Tilde";if(n4(t,r)){const y=r.enter("codeIndented"),b=r.indentLines(u,a4);return y(),b}const m=r.createTracker(i),x=c.repeat(Math.max(t4(u,c)+1,3)),f=r.enter("codeFenced");let g=m.move(x);if(t.lang){const y=r.enter(`codeFencedLang${d}`);g+=m.move(r.safe(t.lang,{before:g,after:" ",encode:["`"],...m.current()})),y()}if(t.lang&&t.meta){const y=r.enter(`codeFencedMeta${d}`);g+=m.move(" "),g+=m.move(r.safe(t.meta,{before:g,after:`
|
|
68
68
|
`,encode:["`"],...m.current()})),y()}return g+=m.move(`
|
|
69
69
|
`),u&&(g+=m.move(u+`
|
|
70
|
-
`)),g+=m.move(x),f(),g}function a4(t,l,r){return(r?"":" ")+t}function
|
|
71
|
-
`,...x.current()}))),m(),t.title&&(m=r.enter(`title${u}`),f+=x.move(" "+c),f+=x.move(r.safe(t.title,{before:f,after:c,...x.current()})),f+=x.move(c),m()),d(),f}function s4(t){const l=t.options.emphasis||"*";if(l!=="*"&&l!=="_")throw new Error("Cannot serialize emphasis with `"+l+"` for `options.emphasis`, expected `*`, or `_`");return l}function Fs(t){return"&#x"+t.toString(16).toUpperCase()+";"}function Nc(t,l,r){const i=xi(t),c=xi(l);return i===void 0?c===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:c===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:i===1?c===void 0?{inside:!1,outside:!1}:c===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:c===void 0?{inside:!1,outside:!1}:c===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}
|
|
70
|
+
`)),g+=m.move(x),f(),g}function a4(t,l,r){return(r?"":" ")+t}function bh(t){const l=t.options.quote||'"';if(l!=='"'&&l!=="'")throw new Error("Cannot serialize title with `"+l+"` for `options.quote`, expected `\"`, or `'`");return l}function i4(t,l,r,i){const c=bh(r),u=c==='"'?"Quote":"Apostrophe",d=r.enter("definition");let m=r.enter("label");const x=r.createTracker(i);let f=x.move("[");return f+=x.move(r.safe(r.associationId(t),{before:f,after:"]",...x.current()})),f+=x.move("]: "),m(),!t.url||/[\0- \u007F]/.test(t.url)?(m=r.enter("destinationLiteral"),f+=x.move("<"),f+=x.move(r.safe(t.url,{before:f,after:">",...x.current()})),f+=x.move(">")):(m=r.enter("destinationRaw"),f+=x.move(r.safe(t.url,{before:f,after:t.title?" ":`
|
|
71
|
+
`,...x.current()}))),m(),t.title&&(m=r.enter(`title${u}`),f+=x.move(" "+c),f+=x.move(r.safe(t.title,{before:f,after:c,...x.current()})),f+=x.move(c),m()),d(),f}function s4(t){const l=t.options.emphasis||"*";if(l!=="*"&&l!=="_")throw new Error("Cannot serialize emphasis with `"+l+"` for `options.emphasis`, expected `*`, or `_`");return l}function Fs(t){return"&#x"+t.toString(16).toUpperCase()+";"}function Nc(t,l,r){const i=xi(t),c=xi(l);return i===void 0?c===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:c===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:i===1?c===void 0?{inside:!1,outside:!1}:c===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:c===void 0?{inside:!1,outside:!1}:c===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Ry.peek=o4;function Ry(t,l,r,i){const c=s4(r),u=r.enter("emphasis"),d=r.createTracker(i),m=d.move(c);let x=d.move(r.containerPhrasing(t,{after:c,before:m,...d.current()}));const f=x.charCodeAt(0),g=Nc(i.before.charCodeAt(i.before.length-1),f,c);g.inside&&(x=Fs(f)+x.slice(1));const y=x.charCodeAt(x.length-1),b=Nc(i.after.charCodeAt(0),y,c);b.inside&&(x=x.slice(0,-1)+Fs(y));const v=d.move(c);return u(),r.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},m+x+v}function o4(t,l,r){return r.options.emphasis||"*"}function c4(t,l){let r=!1;return ph(t,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return r=!0,If}),!!((!t.depth||t.depth<3)&&ch(t)&&(l.options.setext||r))}function u4(t,l,r,i){const c=Math.max(Math.min(6,t.depth||1),1),u=r.createTracker(i);if(c4(t,r)){const g=r.enter("headingSetext"),y=r.enter("phrasing"),b=r.containerPhrasing(t,{...u.current(),before:`
|
|
72
72
|
`,after:`
|
|
73
73
|
`});return y(),g(),b+`
|
|
74
74
|
`+(c===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(`
|
|
75
75
|
`))+1))}const d="#".repeat(c),m=r.enter("headingAtx"),x=r.enter("phrasing");u.move(d+" ");let f=r.containerPhrasing(t,{before:"# ",after:`
|
|
76
|
-
`,...u.current()});return/^[\t ]/.test(f)&&(f=Fs(f.charCodeAt(0))+f.slice(1)),f=f?d+" "+f:d,r.options.closeAtx&&(f+=" "+d),x(),m(),f}
|
|
76
|
+
`,...u.current()});return/^[\t ]/.test(f)&&(f=Fs(f.charCodeAt(0))+f.slice(1)),f=f?d+" "+f:d,r.options.closeAtx&&(f+=" "+d),x(),m(),f}_y.peek=d4;function _y(t){return t.value||""}function d4(){return"<"}Oy.peek=f4;function Oy(t,l,r,i){const c=bh(r),u=c==='"'?"Quote":"Apostrophe",d=r.enter("image");let m=r.enter("label");const x=r.createTracker(i);let f=x.move("![");return f+=x.move(r.safe(t.alt,{before:f,after:"]",...x.current()})),f+=x.move("]("),m(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(m=r.enter("destinationLiteral"),f+=x.move("<"),f+=x.move(r.safe(t.url,{before:f,after:">",...x.current()})),f+=x.move(">")):(m=r.enter("destinationRaw"),f+=x.move(r.safe(t.url,{before:f,after:t.title?" ":")",...x.current()}))),m(),t.title&&(m=r.enter(`title${u}`),f+=x.move(" "+c),f+=x.move(r.safe(t.title,{before:f,after:c,...x.current()})),f+=x.move(c),m()),f+=x.move(")"),d(),f}function f4(){return"!"}By.peek=h4;function By(t,l,r,i){const c=t.referenceType,u=r.enter("imageReference");let d=r.enter("label");const m=r.createTracker(i);let x=m.move("![");const f=r.safe(t.alt,{before:x,after:"]",...m.current()});x+=m.move(f+"]["),d();const g=r.stack;r.stack=[],d=r.enter("reference");const y=r.safe(r.associationId(t),{before:x,after:"]",...m.current()});return d(),r.stack=g,u(),c==="full"||!f||f!==y?x+=m.move(y+"]"):c==="shortcut"?x=x.slice(0,-1):x+=m.move("]"),x}function h4(){return"!"}Ly.peek=m4;function Ly(t,l,r){let i=t.value||"",c="`",u=-1;for(;new RegExp("(^|[^`])"+c+"([^`]|$)").test(i);)c+="`";for(/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++u<r.unsafe.length;){const d=r.unsafe[u],m=r.compilePattern(d);let x;if(d.atBreak)for(;x=m.exec(i);){let f=x.index;i.charCodeAt(f)===10&&i.charCodeAt(f-1)===13&&f--,i=i.slice(0,f)+" "+i.slice(x.index+1)}}return c+i+c}function m4(){return"`"}function $y(t,l){const r=ch(t);return!!(!l.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(r===t.url||"mailto:"+r===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}Hy.peek=x4;function Hy(t,l,r,i){const c=bh(r),u=c==='"'?"Quote":"Apostrophe",d=r.createTracker(i);let m,x;if($y(t,r)){const g=r.stack;r.stack=[],m=r.enter("autolink");let y=d.move("<");return y+=d.move(r.containerPhrasing(t,{before:y,after:">",...d.current()})),y+=d.move(">"),m(),r.stack=g,y}m=r.enter("link"),x=r.enter("label");let f=d.move("[");return f+=d.move(r.containerPhrasing(t,{before:f,after:"](",...d.current()})),f+=d.move("]("),x(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(x=r.enter("destinationLiteral"),f+=d.move("<"),f+=d.move(r.safe(t.url,{before:f,after:">",...d.current()})),f+=d.move(">")):(x=r.enter("destinationRaw"),f+=d.move(r.safe(t.url,{before:f,after:t.title?" ":")",...d.current()}))),x(),t.title&&(x=r.enter(`title${u}`),f+=d.move(" "+c),f+=d.move(r.safe(t.title,{before:f,after:c,...d.current()})),f+=d.move(c),x()),f+=d.move(")"),m(),f}function x4(t,l,r){return $y(t,r)?"<":"["}Uy.peek=p4;function Uy(t,l,r,i){const c=t.referenceType,u=r.enter("linkReference");let d=r.enter("label");const m=r.createTracker(i);let x=m.move("[");const f=r.containerPhrasing(t,{before:x,after:"]",...m.current()});x+=m.move(f+"]["),d();const g=r.stack;r.stack=[],d=r.enter("reference");const y=r.safe(r.associationId(t),{before:x,after:"]",...m.current()});return d(),r.stack=g,u(),c==="full"||!f||f!==y?x+=m.move(y+"]"):c==="shortcut"?x=x.slice(0,-1):x+=m.move("]"),x}function p4(){return"["}function vh(t){const l=t.options.bullet||"*";if(l!=="*"&&l!=="+"&&l!=="-")throw new Error("Cannot serialize items with `"+l+"` for `options.bullet`, expected `*`, `+`, or `-`");return l}function y4(t){const l=vh(t),r=t.options.bulletOther;if(!r)return l==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===l)throw new Error("Expected `bullet` (`"+l+"`) and `bulletOther` (`"+r+"`) to be different");return r}function g4(t){const l=t.options.bulletOrdered||".";if(l!=="."&&l!==")")throw new Error("Cannot serialize items with `"+l+"` for `options.bulletOrdered`, expected `.` or `)`");return l}function Iy(t){const l=t.options.rule||"*";if(l!=="*"&&l!=="-"&&l!=="_")throw new Error("Cannot serialize rules with `"+l+"` for `options.rule`, expected `*`, `-`, or `_`");return l}function b4(t,l,r,i){const c=r.enter("list"),u=r.bulletCurrent;let d=t.ordered?g4(r):vh(r);const m=t.ordered?d==="."?")":".":y4(r);let x=l&&r.bulletLastUsed?d===r.bulletLastUsed:!1;if(!t.ordered){const g=t.children?t.children[0]:void 0;if((d==="*"||d==="-")&&g&&(!g.children||!g.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(x=!0),Iy(r)===d&&g){let y=-1;for(;++y<t.children.length;){const b=t.children[y];if(b&&b.type==="listItem"&&b.children&&b.children[0]&&b.children[0].type==="thematicBreak"){x=!0;break}}}}x&&(d=m),r.bulletCurrent=d;const f=r.containerFlow(t,i);return r.bulletLastUsed=d,r.bulletCurrent=u,c(),f}function v4(t){const l=t.options.listItemIndent||"one";if(l!=="tab"&&l!=="one"&&l!=="mixed")throw new Error("Cannot serialize items with `"+l+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return l}function w4(t,l,r,i){const c=v4(r);let u=r.bulletCurrent||vh(r);l&&l.type==="list"&&l.ordered&&(u=(typeof l.start=="number"&&l.start>-1?l.start:1)+(r.options.incrementListMarker===!1?0:l.children.indexOf(t))+u);let d=u.length+1;(c==="tab"||c==="mixed"&&(l&&l.type==="list"&&l.spread||t.spread))&&(d=Math.ceil(d/4)*4);const m=r.createTracker(i);m.move(u+" ".repeat(d-u.length)),m.shift(d);const x=r.enter("listItem"),f=r.indentLines(r.containerFlow(t,m.current()),g);return x(),f;function g(y,b,v){return b?(v?"":" ".repeat(d))+y:(v?u:u+" ".repeat(d-u.length))+y}}function k4(t,l,r,i){const c=r.enter("paragraph"),u=r.enter("phrasing"),d=r.containerPhrasing(t,i);return u(),c(),d}const j4=Bc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function S4(t,l,r,i){return(t.children.some(function(d){return j4(d)})?r.containerPhrasing:r.containerFlow).call(r,t,i)}function C4(t){const l=t.options.strong||"*";if(l!=="*"&&l!=="_")throw new Error("Cannot serialize strong with `"+l+"` for `options.strong`, expected `*`, or `_`");return l}Yy.peek=E4;function Yy(t,l,r,i){const c=C4(r),u=r.enter("strong"),d=r.createTracker(i),m=d.move(c+c);let x=d.move(r.containerPhrasing(t,{after:c,before:m,...d.current()}));const f=x.charCodeAt(0),g=Nc(i.before.charCodeAt(i.before.length-1),f,c);g.inside&&(x=Fs(f)+x.slice(1));const y=x.charCodeAt(x.length-1),b=Nc(i.after.charCodeAt(0),y,c);b.inside&&(x=x.slice(0,-1)+Fs(y));const v=d.move(c+c);return u(),r.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},m+x+v}function E4(t,l,r){return r.options.strong||"*"}function N4(t,l,r,i){return r.safe(t.value,i)}function A4(t){const l=t.options.ruleRepetition||3;if(l<3)throw new Error("Cannot serialize rules with repetition `"+l+"` for `options.ruleRepetition`, expected `3` or more");return l}function T4(t,l,r){const i=(Iy(r)+(r.options.ruleSpaces?" ":"")).repeat(A4(r));return r.options.ruleSpaces?i.slice(0,-1):i}const qy={blockquote:Jk,break:l0,code:r4,definition:i4,emphasis:Ry,hardBreak:l0,heading:u4,html:_y,image:Oy,imageReference:By,inlineCode:Ly,link:Hy,linkReference:Uy,list:b4,listItem:w4,paragraph:k4,root:S4,strong:Yy,text:N4,thematicBreak:T4};function D4(){return{enter:{table:z4,tableData:r0,tableHeader:r0,tableRow:F4},exit:{codeText:R4,table:M4,tableData:mf,tableHeader:mf,tableRow:mf}}}function z4(t){const l=t._align;this.enter({type:"table",align:l.map(function(r){return r==="none"?null:r}),children:[]},t),this.data.inTable=!0}function M4(t){this.exit(t),this.data.inTable=void 0}function F4(t){this.enter({type:"tableRow",children:[]},t)}function mf(t){this.exit(t)}function r0(t){this.enter({type:"tableCell",children:[]},t)}function R4(t){let l=this.resume();this.data.inTable&&(l=l.replace(/\\([\\|])/g,_4));const r=this.stack[this.stack.length-1];r.type,r.value=l,this.exit(t)}function _4(t,l){return l==="|"?l:t}function O4(t){const l=t||{},r=l.tableCellPadding,i=l.tablePipeAlign,c=l.stringLength,u=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
77
77
|
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:d,tableCell:x,tableRow:m}};function d(v,S,j,E){return f(g(v,j,E),v.align)}function m(v,S,j,E){const C=y(v,j,E),A=f([C]);return A.slice(0,A.indexOf(`
|
|
78
|
-
`))}function x(v,S,j,E){const C=j.enter("tableCell"),A=j.enter("phrasing"),F=j.containerPhrasing(v,{...E,before:u,after:u});return A(),C(),F}function f(v,S){return Wk(v,{align:S,alignDelimiters:i,padding:r,stringLength:c})}function g(v,S,j){const E=v.children;let C=-1;const A=[],F=S.enter("table");for(;++C<E.length;)A[C]=y(E[C],S,j);return F(),A}function y(v,S,j){const E=v.children;let C=-1;const A=[],F=S.enter("tableRow");for(;++C<E.length;)A[C]=x(E[C],v,S,j);return F(),A}function b(v,S,j){let E=Yy.inlineCode(v,S,j);return j.stack.includes("tableCell")&&(E=E.replace(/\|/g,"\\$&")),E}}function B4(){return{exit:{taskListCheckValueChecked:l0,taskListCheckValueUnchecked:l0,paragraph:$4}}}function L4(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:H4}}}function l0(t){const l=this.stack[this.stack.length-2];l.type,l.checked=t.type==="taskListCheckValueChecked"}function $4(t){const l=this.stack[this.stack.length-2];if(l&&l.type==="listItem"&&typeof l.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const i=r.children[0];if(i&&i.type==="text"){const c=l.children;let u=-1,d;for(;++u<c.length;){const m=c[u];if(m.type==="paragraph"){d=m;break}}d===r&&(i.value=i.value.slice(1),i.value.length===0?r.children.shift():r.position&&i.position&&typeof i.position.start.offset=="number"&&(i.position.start.column++,i.position.start.offset++,r.position.start=Object.assign({},i.position.start)))}}this.exit(t)}function H4(t,l,r,i){const c=t.children[0],u=typeof t.checked=="boolean"&&c&&c.type==="paragraph",d="["+(t.checked?"x":" ")+"] ",m=r.createTracker(i);u&&m.move(d);let x=Yy.listItem(t,l,r,{...i,...m.current()});return u&&(x=x.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,f)),x;function f(g){return g+d}}function U4(){return[bk(),Hk(),qk(),D4(),B4()]}function I4(t){return{extensions:[vk(),Uk(t),Xk(),O4(t),L4()]}}const Y4={tokenize:Q4,partial:!0},qy={tokenize:W4,partial:!0},Xy={tokenize:Z4,partial:!0},Vy={tokenize:J4,partial:!0},q4={tokenize:P4,partial:!0},Gy={name:"wwwAutolink",tokenize:G4,previous:Qy},Ky={name:"protocolAutolink",tokenize:K4,previous:Wy},cr={name:"emailAutolink",tokenize:V4,previous:Zy},Bl={};function X4(){return{text:Bl}}let xa=48;for(;xa<123;)Bl[xa]=cr,xa++,xa===58?xa=65:xa===91&&(xa=97);Bl[43]=cr;Bl[45]=cr;Bl[46]=cr;Bl[95]=cr;Bl[72]=[cr,Ky];Bl[104]=[cr,Ky];Bl[87]=[cr,Gy];Bl[119]=[cr,Gy];function V4(t,l,r){const i=this;let c,u;return d;function d(y){return!Vf(y)||!Zy.call(i,i.previous)||vh(i.events)?r(y):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),m(y))}function m(y){return Vf(y)?(t.consume(y),m):y===64?(t.consume(y),x):r(y)}function x(y){return y===46?t.check(q4,g,f)(y):y===45||y===95||kn(y)?(u=!0,t.consume(y),x):g(y)}function f(y){return t.consume(y),c=!0,x}function g(y){return u&&c&&En(i.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),l(y)):r(y)}}function G4(t,l,r){const i=this;return c;function c(d){return d!==87&&d!==119||!Qy.call(i,i.previous)||vh(i.events)?r(d):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(Y4,t.attempt(qy,t.attempt(Xy,u),r),r)(d))}function u(d){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),l(d)}}function K4(t,l,r){const i=this;let c="",u=!1;return d;function d(y){return(y===72||y===104)&&Wy.call(i,i.previous)&&!vh(i.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),c+=String.fromCodePoint(y),t.consume(y),m):r(y)}function m(y){if(En(y)&&c.length<5)return c+=String.fromCodePoint(y),t.consume(y),m;if(y===58){const b=c.toLowerCase();if(b==="http"||b==="https")return t.consume(y),x}return r(y)}function x(y){return y===47?(t.consume(y),u?f:(u=!0,x)):r(y)}function f(y){return y===null||Sc(y)||Ft(y)||ka(y)||Rc(y)?r(y):t.attempt(qy,t.attempt(Xy,g),r)(y)}function g(y){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),l(y)}}function Q4(t,l,r){let i=0;return c;function c(d){return(d===87||d===119)&&i<3?(i++,t.consume(d),c):d===46&&i===3?(t.consume(d),u):r(d)}function u(d){return d===null?r(d):l(d)}}function W4(t,l,r){let i,c,u;return d;function d(f){return f===46||f===95?t.check(Vy,x,m)(f):f===null||Ft(f)||ka(f)||f!==45&&Rc(f)?x(f):(u=!0,t.consume(f),d)}function m(f){return f===95?i=!0:(c=i,i=void 0),t.consume(f),d}function x(f){return c||i||!u?r(f):l(f)}}function Z4(t,l){let r=0,i=0;return c;function c(d){return d===40?(r++,t.consume(d),c):d===41&&i<r?u(d):d===33||d===34||d===38||d===39||d===41||d===42||d===44||d===46||d===58||d===59||d===60||d===63||d===93||d===95||d===126?t.check(Vy,l,u)(d):d===null||Ft(d)||ka(d)?l(d):(t.consume(d),c)}function u(d){return d===41&&i++,t.consume(d),c}}function J4(t,l,r){return i;function i(m){return m===33||m===34||m===39||m===41||m===42||m===44||m===46||m===58||m===59||m===63||m===95||m===126?(t.consume(m),i):m===38?(t.consume(m),u):m===93?(t.consume(m),c):m===60||m===null||Ft(m)||ka(m)?l(m):r(m)}function c(m){return m===null||m===40||m===91||Ft(m)||ka(m)?l(m):i(m)}function u(m){return En(m)?d(m):r(m)}function d(m){return m===59?(t.consume(m),i):En(m)?(t.consume(m),d):r(m)}}function P4(t,l,r){return i;function i(u){return t.consume(u),c}function c(u){return kn(u)?r(u):l(u)}}function Qy(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||Ft(t)}function Wy(t){return!En(t)}function Zy(t){return!(t===47||Vf(t))}function Vf(t){return t===43||t===45||t===46||t===95||kn(t)}function vh(t){let l=t.length,r=!1;for(;l--;){const i=t[l][1];if((i.type==="labelLink"||i.type==="labelImage")&&!i._balanced){r=!0;break}if(i._gfmAutolinkLiteralWalkedInto){r=!1;break}}return t.length>0&&!r&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const ej={tokenize:oj,partial:!0};function tj(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:aj,continuation:{tokenize:ij},exit:sj}},text:{91:{name:"gfmFootnoteCall",tokenize:rj},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:nj,resolveTo:lj}}}}function nj(t,l,r){const i=this;let c=i.events.length;const u=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let d;for(;c--;){const x=i.events[c][1];if(x.type==="labelImage"){d=x;break}if(x.type==="gfmFootnoteCall"||x.type==="labelLink"||x.type==="label"||x.type==="image"||x.type==="link")break}return m;function m(x){if(!d||!d._balanced)return r(x);const f=bl(i.sliceSerialize({start:d.end,end:i.now()}));return f.codePointAt(0)!==94||!u.includes(f.slice(1))?r(x):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(x),t.exit("gfmFootnoteCallLabelMarker"),l(x))}}function lj(t,l){let r=t.length;for(;r--;)if(t[r][1].type==="labelImage"&&t[r][0]==="enter"){t[r][1];break}t[r+1][1].type="data",t[r+3][1].type="gfmFootnoteCallLabelMarker";const i={type:"gfmFootnoteCall",start:Object.assign({},t[r+3][1].start),end:Object.assign({},t[t.length-1][1].end)},c={type:"gfmFootnoteCallMarker",start:Object.assign({},t[r+3][1].end),end:Object.assign({},t[r+3][1].end)};c.end.column++,c.end.offset++,c.end._bufferIndex++;const u={type:"gfmFootnoteCallString",start:Object.assign({},c.end),end:Object.assign({},t[t.length-1][1].start)},d={type:"chunkString",contentType:"string",start:Object.assign({},u.start),end:Object.assign({},u.end)},m=[t[r+1],t[r+2],["enter",i,l],t[r+3],t[r+4],["enter",c,l],["exit",c,l],["enter",u,l],["enter",d,l],["exit",d,l],["exit",u,l],t[t.length-2],t[t.length-1],["exit",i,l]];return t.splice(r,t.length-r+1,...m),t}function rj(t,l,r){const i=this,c=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u=0,d;return m;function m(y){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(y),t.exit("gfmFootnoteCallLabelMarker"),x}function x(y){return y!==94?r(y):(t.enter("gfmFootnoteCallMarker"),t.consume(y),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",f)}function f(y){if(u>999||y===93&&!d||y===null||y===91||Ft(y))return r(y);if(y===93){t.exit("chunkString");const b=t.exit("gfmFootnoteCallString");return c.includes(bl(i.sliceSerialize(b)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(y),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),l):r(y)}return Ft(y)||(d=!0),u++,t.consume(y),y===92?g:f}function g(y){return y===91||y===92||y===93?(t.consume(y),u++,f):f(y)}}function aj(t,l,r){const i=this,c=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u,d=0,m;return x;function x(S){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(S),t.exit("gfmFootnoteDefinitionLabelMarker"),f}function f(S){return S===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(S),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",g):r(S)}function g(S){if(d>999||S===93&&!m||S===null||S===91||Ft(S))return r(S);if(S===93){t.exit("chunkString");const j=t.exit("gfmFootnoteDefinitionLabelString");return u=bl(i.sliceSerialize(j)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(S),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),b}return Ft(S)||(m=!0),d++,t.consume(S),S===92?y:g}function y(S){return S===91||S===92||S===93?(t.consume(S),d++,g):g(S)}function b(S){return S===58?(t.enter("definitionMarker"),t.consume(S),t.exit("definitionMarker"),c.includes(u)||c.push(u),pt(t,v,"gfmFootnoteDefinitionWhitespace")):r(S)}function v(S){return l(S)}}function ij(t,l,r){return t.check(Hs,l,t.attempt(ej,l,r))}function sj(t){t.exit("gfmFootnoteDefinition")}function oj(t,l,r){const i=this;return pt(t,c,"gfmFootnoteDefinitionIndent",5);function c(u){const d=i.events[i.events.length-1];return d&&d[1].type==="gfmFootnoteDefinitionIndent"&&d[2].sliceSerialize(d[1],!0).length===4?l(u):r(u)}}function cj(t){let r=(t||{}).singleTilde;const i={name:"strikethrough",tokenize:u,resolveAll:c};return r==null&&(r=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function c(d,m){let x=-1;for(;++x<d.length;)if(d[x][0]==="enter"&&d[x][1].type==="strikethroughSequenceTemporary"&&d[x][1]._close){let f=x;for(;f--;)if(d[f][0]==="exit"&&d[f][1].type==="strikethroughSequenceTemporary"&&d[f][1]._open&&d[x][1].end.offset-d[x][1].start.offset===d[f][1].end.offset-d[f][1].start.offset){d[x][1].type="strikethroughSequence",d[f][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},d[f][1].start),end:Object.assign({},d[x][1].end)},y={type:"strikethroughText",start:Object.assign({},d[f][1].end),end:Object.assign({},d[x][1].start)},b=[["enter",g,m],["enter",d[f][1],m],["exit",d[f][1],m],["enter",y,m]],v=m.parser.constructs.insideSpan.null;v&&Qn(b,b.length,0,_c(v,d.slice(f+1,x),m)),Qn(b,b.length,0,[["exit",y,m],["enter",d[x][1],m],["exit",d[x][1],m],["exit",g,m]]),Qn(d,f-1,x-f+3,b),x=f+b.length-2;break}}for(x=-1;++x<d.length;)d[x][1].type==="strikethroughSequenceTemporary"&&(d[x][1].type="data");return d}function u(d,m,x){const f=this.previous,g=this.events;let y=0;return b;function b(S){return f===126&&g[g.length-1][1].type!=="characterEscape"?x(S):(d.enter("strikethroughSequenceTemporary"),v(S))}function v(S){const j=xi(f);if(S===126)return y>1?x(S):(d.consume(S),y++,v);if(y<2&&!r)return x(S);const E=d.exit("strikethroughSequenceTemporary"),C=xi(S);return E._open=!C||C===2&&!!j,E._close=!j||j===2&&!!C,m(S)}}}class uj{constructor(){this.map=[]}add(l,r,i){dj(this,l,r,i)}consume(l){if(this.map.sort(function(u,d){return u[0]-d[0]}),this.map.length===0)return;let r=this.map.length;const i=[];for(;r>0;)r-=1,i.push(l.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),l.length=this.map[r][0];i.push(l.slice()),l.length=0;let c=i.pop();for(;c;){for(const u of c)l.push(u);c=i.pop()}this.map.length=0}}function dj(t,l,r,i){let c=0;if(!(r===0&&i.length===0)){for(;c<t.map.length;){if(t.map[c][0]===l){t.map[c][1]+=r,t.map[c][2].push(...i);return}c+=1}t.map.push([l,r,i])}}function fj(t,l){let r=!1;const i=[];for(;l<t.length;){const c=t[l];if(r){if(c[0]==="enter")c[1].type==="tableContent"&&i.push(t[l+1][1].type==="tableDelimiterMarker"?"left":"none");else if(c[1].type==="tableContent"){if(t[l-1][1].type==="tableDelimiterMarker"){const u=i.length-1;i[u]=i[u]==="left"?"center":"right"}}else if(c[1].type==="tableDelimiterRow")break}else c[0]==="enter"&&c[1].type==="tableDelimiterRow"&&(r=!0);l+=1}return i}function hj(){return{flow:{null:{name:"table",tokenize:mj,resolveAll:xj}}}}function mj(t,l,r){const i=this;let c=0,u=0,d;return m;function m(D){let Y=i.events.length-1;for(;Y>-1;){const ne=i.events[Y][1].type;if(ne==="lineEnding"||ne==="linePrefix")Y--;else break}const B=Y>-1?i.events[Y][1].type:null,V=B==="tableHead"||B==="tableRow"?M:x;return V===M&&i.parser.lazy[i.now().line]?r(D):V(D)}function x(D){return t.enter("tableHead"),t.enter("tableRow"),f(D)}function f(D){return D===124||(d=!0,u+=1),g(D)}function g(D){return D===null?r(D):qe(D)?u>1?(u=0,i.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(D),t.exit("lineEnding"),v):r(D):ct(D)?pt(t,g,"whitespace")(D):(u+=1,d&&(d=!1,c+=1),D===124?(t.enter("tableCellDivider"),t.consume(D),t.exit("tableCellDivider"),d=!0,g):(t.enter("data"),y(D)))}function y(D){return D===null||D===124||Ft(D)?(t.exit("data"),g(D)):(t.consume(D),D===92?b:y)}function b(D){return D===92||D===124?(t.consume(D),y):y(D)}function v(D){return i.interrupt=!1,i.parser.lazy[i.now().line]?r(D):(t.enter("tableDelimiterRow"),d=!1,ct(D)?pt(t,S,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):S(D))}function S(D){return D===45||D===58?E(D):D===124?(d=!0,t.enter("tableCellDivider"),t.consume(D),t.exit("tableCellDivider"),j):H(D)}function j(D){return ct(D)?pt(t,E,"whitespace")(D):E(D)}function E(D){return D===58?(u+=1,d=!0,t.enter("tableDelimiterMarker"),t.consume(D),t.exit("tableDelimiterMarker"),C):D===45?(u+=1,C(D)):D===null||qe(D)?_(D):H(D)}function C(D){return D===45?(t.enter("tableDelimiterFiller"),A(D)):H(D)}function A(D){return D===45?(t.consume(D),A):D===58?(d=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(D),t.exit("tableDelimiterMarker"),F):(t.exit("tableDelimiterFiller"),F(D))}function F(D){return ct(D)?pt(t,_,"whitespace")(D):_(D)}function _(D){return D===124?S(D):D===null||qe(D)?!d||c!==u?H(D):(t.exit("tableDelimiterRow"),t.exit("tableHead"),l(D)):H(D)}function H(D){return r(D)}function M(D){return t.enter("tableRow"),I(D)}function I(D){return D===124?(t.enter("tableCellDivider"),t.consume(D),t.exit("tableCellDivider"),I):D===null||qe(D)?(t.exit("tableRow"),l(D)):ct(D)?pt(t,I,"whitespace")(D):(t.enter("data"),W(D))}function W(D){return D===null||D===124||Ft(D)?(t.exit("data"),I(D)):(t.consume(D),D===92?te:W)}function te(D){return D===92||D===124?(t.consume(D),W):W(D)}}function xj(t,l){let r=-1,i=!0,c=0,u=[0,0,0,0],d=[0,0,0,0],m=!1,x=0,f,g,y;const b=new uj;for(;++r<t.length;){const v=t[r],S=v[1];v[0]==="enter"?S.type==="tableHead"?(m=!1,x!==0&&(r0(b,l,x,f,g),g=void 0,x=0),f={type:"table",start:Object.assign({},S.start),end:Object.assign({},S.end)},b.add(r,0,[["enter",f,l]])):S.type==="tableRow"||S.type==="tableDelimiterRow"?(i=!0,y=void 0,u=[0,0,0,0],d=[0,r+1,0,0],m&&(m=!1,g={type:"tableBody",start:Object.assign({},S.start),end:Object.assign({},S.end)},b.add(r,0,[["enter",g,l]])),c=S.type==="tableDelimiterRow"?2:g?3:1):c&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")?(i=!1,d[2]===0&&(u[1]!==0&&(d[0]=d[1],y=rc(b,l,u,c,void 0,y),u=[0,0,0,0]),d[2]=r)):S.type==="tableCellDivider"&&(i?i=!1:(u[1]!==0&&(d[0]=d[1],y=rc(b,l,u,c,void 0,y)),u=d,d=[u[1],r,0,0])):S.type==="tableHead"?(m=!0,x=r):S.type==="tableRow"||S.type==="tableDelimiterRow"?(x=r,u[1]!==0?(d[0]=d[1],y=rc(b,l,u,c,r,y)):d[1]!==0&&(y=rc(b,l,d,c,r,y)),c=0):c&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")&&(d[3]=r)}for(x!==0&&r0(b,l,x,f,g),b.consume(l.events),r=-1;++r<l.events.length;){const v=l.events[r];v[0]==="enter"&&v[1].type==="table"&&(v[1]._align=fj(l.events,r))}return t}function rc(t,l,r,i,c,u){const d=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",m="tableContent";r[0]!==0&&(u.end=Object.assign({},di(l.events,r[0])),t.add(r[0],0,[["exit",u,l]]));const x=di(l.events,r[1]);if(u={type:d,start:Object.assign({},x),end:Object.assign({},x)},t.add(r[1],0,[["enter",u,l]]),r[2]!==0){const f=di(l.events,r[2]),g=di(l.events,r[3]),y={type:m,start:Object.assign({},f),end:Object.assign({},g)};if(t.add(r[2],0,[["enter",y,l]]),i!==2){const b=l.events[r[2]],v=l.events[r[3]];if(b[1].end=Object.assign({},v[1].end),b[1].type="chunkText",b[1].contentType="text",r[3]>r[2]+1){const S=r[2]+1,j=r[3]-r[2]-1;t.add(S,j,[])}}t.add(r[3]+1,0,[["exit",y,l]])}return c!==void 0&&(u.end=Object.assign({},di(l.events,c)),t.add(c,0,[["exit",u,l]]),u=void 0),u}function r0(t,l,r,i,c){const u=[],d=di(l.events,r);c&&(c.end=Object.assign({},d),u.push(["exit",c,l])),i.end=Object.assign({},d),u.push(["exit",i,l]),t.add(r+1,0,u)}function di(t,l){const r=t[l],i=r[0]==="enter"?"start":"end";return r[1][i]}const pj={name:"tasklistCheck",tokenize:gj};function yj(){return{text:{91:pj}}}function gj(t,l,r){const i=this;return c;function c(x){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?r(x):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(x),t.exit("taskListCheckMarker"),u)}function u(x){return Ft(x)?(t.enter("taskListCheckValueUnchecked"),t.consume(x),t.exit("taskListCheckValueUnchecked"),d):x===88||x===120?(t.enter("taskListCheckValueChecked"),t.consume(x),t.exit("taskListCheckValueChecked"),d):r(x)}function d(x){return x===93?(t.enter("taskListCheckMarker"),t.consume(x),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),m):r(x)}function m(x){return qe(x)?l(x):ct(x)?t.check({tokenize:bj},l,r)(x):r(x)}}function bj(t,l,r){return pt(t,i,"whitespace");function i(c){return c===null?r(c):l(c)}}function vj(t){return sy([X4(),tj(),cj(t),hj(),yj()])}const wj={};function Jy(t){const l=this,r=t||wj,i=l.data(),c=i.micromarkExtensions||(i.micromarkExtensions=[]),u=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),d=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);c.push(vj(r)),u.push(U4()),d.push(I4(r))}function Is({content:t,className:l=""}){return s.jsx("div",{className:`office-markdown ${l}`,children:s.jsx(Ay,{remarkPlugins:[Jy],components:{code:kj,table:({children:r})=>s.jsx("div",{className:"overflow-x-auto my-2",children:s.jsx("table",{className:"office-table",children:r})})},children:t})})}function kj({className:t,children:l,...r}){const i=/language-(\w+)/.exec(t??"");return i||typeof l=="string"&&l.includes(`
|
|
79
|
-
`)?s.jsx(jj,{language:i==null?void 0:i[1],children:l}):s.jsx("code",{className:"bg-gray-100 text-gray-700 px-1 py-0.5 rounded text-[0.9em] font-mono",...r,children:l})}function jj({children:t,language:l}){const[r,i]=k.useState(!1),c=String(t).replace(/\n$/,""),u=()=>{navigator.clipboard.writeText(c),i(!0),setTimeout(()=>i(!1),1500)};return s.jsxs("div",{className:"office-code-block group relative my-2",children:[l&&s.jsx("div",{className:"text-[10px] text-gray-400 px-3 pt-1.5",children:l}),s.jsx("button",{onClick:u,className:"absolute top-1.5 right-2 text-[10px] text-gray-400 hover:text-gray-600 opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",children:r?"Copied!":"Copy"}),s.jsx("pre",{className:"overflow-x-auto p-3 text-xs leading-relaxed",children:s.jsx("code",{children:c})})]})}const a0={$skin:"skinColor",$hair:"hairColor",$shirt:"shirtColor",$pants:"pantsColor",$shoes:"shoeColor"},Sj=/^(darken|lighten)\((\$\w+),\s*(\d+)\)$/;function Cj(t,l){const r=parseInt(t.replace("#",""),16),i=Math.max(0,(r>>16&255)-l),c=Math.max(0,(r>>8&255)-l),u=Math.max(0,(r&255)-l);return`#${(i<<16|c<<8|u).toString(16).padStart(6,"0")}`}function Ej(t,l){const r=parseInt(t.replace("#",""),16),i=Math.min(255,(r>>16&255)+l),c=Math.min(255,(r>>8&255)+l),u=Math.min(255,(r&255)+l);return`#${(i<<16|c<<8|u).toString(16).padStart(6,"0")}`}function Py(t,l){const r=a0[t];if(r&&l)return l[r];const i=Sj.exec(t);if(i){const[,c,u,d]=i,m=a0[u],x=m&&l?l[m]:u,f=parseInt(d,10);return c==="darken"?Cj(x,f):Ej(x,f)}return t}function i0(t,l=12){return t.map(r=>({...r,x:l-r.x-r.w}))}function Nj(t,l){return l==="down"?t.down:l==="up"&&t.up?t.up:l==="left"&&t.left?t.left:l==="right"&&t.right?t.right:l==="right"&&t.left?{name:t.left.name,pixels:i0(t.left.pixels)}:l==="left"&&t.right?{name:t.right.name,pixels:i0(t.right.pixels)}:t.down}function Aj(t,l){return Gf(t,"hair",l,1)}function Gf(t,l,r,i){const c=t.layers.findIndex(d=>d.name===l),u=[...t.layers];if(c>=0)u[c]={...r,name:l};else{const d=i??u.length;u.splice(d,0,{...r,name:l})}return{...t,layers:u}}const wh=new Map,kh=new Map;function eg(t,l){wh.set(t,l)}function $c(t,l){kh.set(t,l)}function Kf(t){return wh.get(t)}function Tj(t){return kh.get(t)}function vN(){return Array.from(wh.keys())}function wN(){return Array.from(kh.keys())}function Dj(t,l,r,i,c=2){t.clearRect(0,0,l.width*c,l.height*c);for(const u of l.layers)tg(t,u.pixels,c,r,i)}function Qf(t,l,r,i,c){for(const u of l){const d=Py(u.c,c);u.a!==void 0&&u.a!==1&&(t.globalAlpha=u.a),t.fillStyle=d,t.fillRect(r+u.x,i+u.y,u.w,u.h),u.a!==void 0&&u.a!==1&&(t.globalAlpha=1)}}function zj(t,l){const r=l.scale;t.clearRect(0,0,l.canvasWidth,l.canvasHeight),tg(t,l.pixels,r,0)}function tg(t,l,r,i,c){for(const u of l){const d=Py(u.c,c);u.a!==void 0&&u.a!==1&&(t.globalAlpha=u.a),t.fillStyle=d,t.fillRect(u.x*r,(u.y+i)*r,u.w*r,u.h*r),u.a!==void 0&&u.a!==1&&(t.globalAlpha=1)}}const Ac=new Map;function Qr(t,l,r){if("down"in r&&!("pixels"in r)){const c=r;Ac.set(t,{id:t,name:l,layer:{...c.down,name:"hair"},directions:{down:{...c.down,name:"hair"},up:c.up?{...c.up,name:"hair"}:void 0,left:c.left?{...c.left,name:"hair"}:void 0,right:c.right?{...c.right,name:"hair"}:void 0}})}else{const c=r;Ac.set(t,{id:t,name:l,layer:{...c,name:"hair"}})}}function Mj(t){return Ac.get(t)}function ng(){return Array.from(Ac.values())}Qr("short","Short",{down:{name:"hair",pixels:[{x:1,y:0,w:10,h:2,c:"$hair"},{x:0,y:1,w:2,h:2,c:"$hair"},{x:10,y:1,w:2,h:2,c:"$hair"},{x:2,y:0,w:8,h:1,c:"lighten($hair, 25)",a:.3}]},up:{name:"hair",pixels:[{x:1,y:0,w:10,h:3,c:"$hair"},{x:0,y:1,w:2,h:2,c:"$hair"},{x:10,y:1,w:2,h:2,c:"$hair"}]},left:{name:"hair",pixels:[{x:1,y:0,w:9,h:2,c:"$hair"},{x:0,y:1,w:2,h:2,c:"$hair"},{x:2,y:0,w:6,h:1,c:"lighten($hair, 25)",a:.3}]}});Qr("messy","Messy",{down:{name:"hair",pixels:[{x:1,y:0,w:10,h:3,c:"$hair"},{x:0,y:1,w:2,h:3,c:"$hair"},{x:10,y:0,w:2,h:4,c:"$hair"},{x:3,y:-1,w:3,h:2,c:"$hair"},{x:7,y:-1,w:2,h:2,c:"lighten($hair, 20)"},{x:2,y:0,w:4,h:1,c:"lighten($hair, 30)",a:.3}]},up:{name:"hair",pixels:[{x:1,y:0,w:10,h:4,c:"$hair"},{x:0,y:1,w:2,h:3,c:"$hair"},{x:10,y:0,w:2,h:4,c:"$hair"},{x:3,y:-1,w:3,h:2,c:"$hair"},{x:7,y:-1,w:2,h:2,c:"$hair"}]},left:{name:"hair",pixels:[{x:1,y:0,w:9,h:3,c:"$hair"},{x:0,y:1,w:2,h:3,c:"$hair"},{x:3,y:-1,w:3,h:2,c:"$hair"},{x:2,y:0,w:4,h:1,c:"lighten($hair, 30)",a:.3}]}});Qr("bun","Bun",{down:{name:"hair",pixels:[{x:1,y:0,w:10,h:2,c:"$hair"},{x:0,y:1,w:2,h:2,c:"$hair"},{x:10,y:1,w:2,h:2,c:"$hair"},{x:4,y:-2,w:4,h:3,c:"$hair"},{x:5,y:-2,w:2,h:1,c:"lighten($hair, 30)",a:.4}]},up:{name:"hair",pixels:[{x:1,y:0,w:10,h:3,c:"$hair"},{x:0,y:1,w:2,h:2,c:"$hair"},{x:10,y:1,w:2,h:2,c:"$hair"},{x:4,y:-2,w:4,h:3,c:"$hair"},{x:5,y:-2,w:2,h:1,c:"lighten($hair, 30)",a:.4}]},left:{name:"hair",pixels:[{x:1,y:0,w:9,h:2,c:"$hair"},{x:0,y:1,w:2,h:2,c:"$hair"},{x:4,y:-2,w:4,h:3,c:"$hair"},{x:5,y:-2,w:2,h:1,c:"lighten($hair, 30)",a:.4}]}});Qr("long","Long",{down:{name:"hair",pixels:[{x:0,y:0,w:12,h:3,c:"$hair"},{x:-1,y:1,w:2,h:7,c:"$hair"},{x:11,y:1,w:2,h:7,c:"$hair"},{x:-1,y:6,w:2,h:3,c:"darken($hair, 15)",a:.5},{x:11,y:6,w:2,h:3,c:"darken($hair, 15)",a:.5},{x:2,y:0,w:8,h:1,c:"lighten($hair, 25)",a:.3}]},up:{name:"hair",pixels:[{x:0,y:0,w:12,h:3,c:"$hair"},{x:-1,y:1,w:2,h:7,c:"$hair"},{x:11,y:1,w:2,h:7,c:"$hair"},{x:1,y:2,w:10,h:6,c:"$hair"},{x:2,y:6,w:8,h:2,c:"darken($hair, 10)",a:.3}]},left:{name:"hair",pixels:[{x:0,y:0,w:10,h:3,c:"$hair"},{x:-1,y:1,w:2,h:7,c:"$hair"},{x:-1,y:6,w:2,h:3,c:"darken($hair, 15)",a:.5},{x:2,y:0,w:6,h:1,c:"lighten($hair, 25)",a:.3}]}});Qr("mohawk","Mohawk",{down:{name:"hair",pixels:[{x:4,y:-2,w:4,h:4,c:"$hair"},{x:5,y:-3,w:2,h:2,c:"lighten($hair, 20)"},{x:1,y:1,w:3,h:2,c:"$hair"},{x:8,y:1,w:3,h:2,c:"$hair"}]},up:{name:"hair",pixels:[{x:4,y:-2,w:4,h:4,c:"$hair"},{x:5,y:-3,w:2,h:2,c:"lighten($hair, 20)"},{x:1,y:1,w:3,h:2,c:"$hair"},{x:8,y:1,w:3,h:2,c:"$hair"}]},left:{name:"hair",pixels:[{x:4,y:-2,w:3,h:4,c:"$hair"},{x:5,y:-3,w:2,h:2,c:"lighten($hair, 20)"},{x:1,y:1,w:3,h:2,c:"$hair"}]}});Qr("slicked","Slicked Back",{down:{name:"hair",pixels:[{x:1,y:0,w:10,h:2,c:"$hair"},{x:0,y:1,w:2,h:2,c:"$hair"},{x:10,y:1,w:2,h:2,c:"$hair"},{x:2,y:0,w:8,h:1,c:"lighten($hair, 15)",a:.4},{x:3,y:1,w:6,h:1,c:"lighten($hair, 10)",a:.2}]},up:{name:"hair",pixels:[{x:1,y:0,w:10,h:3,c:"$hair"},{x:0,y:1,w:2,h:2,c:"$hair"},{x:10,y:1,w:2,h:2,c:"$hair"},{x:2,y:0,w:8,h:1,c:"lighten($hair, 15)",a:.4}]},left:{name:"hair",pixels:[{x:1,y:0,w:9,h:2,c:"$hair"},{x:0,y:1,w:2,h:2,c:"$hair"},{x:2,y:0,w:6,h:1,c:"lighten($hair, 15)",a:.4}]}});Qr("bob","Bob Cut",{down:{name:"hair",pixels:[{x:0,y:0,w:12,h:3,c:"$hair"},{x:-1,y:1,w:2,h:5,c:"$hair"},{x:11,y:1,w:2,h:5,c:"$hair"},{x:-1,y:5,w:2,h:1,c:"darken($hair, 15)",a:.4},{x:11,y:5,w:2,h:1,c:"darken($hair, 15)",a:.4},{x:2,y:0,w:8,h:1,c:"lighten($hair, 25)",a:.3}]},up:{name:"hair",pixels:[{x:0,y:0,w:12,h:3,c:"$hair"},{x:-1,y:1,w:2,h:5,c:"$hair"},{x:11,y:1,w:2,h:5,c:"$hair"},{x:1,y:2,w:10,h:4,c:"$hair"},{x:2,y:5,w:8,h:1,c:"darken($hair, 10)",a:.3}]},left:{name:"hair",pixels:[{x:0,y:0,w:10,h:3,c:"$hair"},{x:-1,y:1,w:2,h:5,c:"$hair"},{x:-1,y:5,w:2,h:1,c:"darken($hair, 15)",a:.4},{x:2,y:0,w:6,h:1,c:"lighten($hair, 25)",a:.3}]}});Qr("curly","Curly",{down:{name:"hair",pixels:[{x:0,y:0,w:12,h:4,c:"$hair"},{x:-1,y:1,w:2,h:5,c:"$hair"},{x:11,y:1,w:2,h:5,c:"$hair"},{x:2,y:0,w:2,h:1,c:"lighten($hair, 25)",a:.4},{x:6,y:0,w:2,h:1,c:"lighten($hair, 25)",a:.4},{x:4,y:2,w:2,h:1,c:"lighten($hair, 15)",a:.3},{x:8,y:2,w:2,h:1,c:"lighten($hair, 15)",a:.3}]},up:{name:"hair",pixels:[{x:0,y:0,w:12,h:4,c:"$hair"},{x:-1,y:1,w:2,h:5,c:"$hair"},{x:11,y:1,w:2,h:5,c:"$hair"},{x:1,y:2,w:10,h:4,c:"$hair"},{x:3,y:1,w:2,h:1,c:"lighten($hair, 15)",a:.3},{x:7,y:1,w:2,h:1,c:"lighten($hair, 15)",a:.3}]},left:{name:"hair",pixels:[{x:0,y:0,w:10,h:4,c:"$hair"},{x:-1,y:1,w:2,h:5,c:"$hair"},{x:2,y:0,w:2,h:1,c:"lighten($hair, 25)",a:.4},{x:5,y:0,w:2,h:1,c:"lighten($hair, 25)",a:.4},{x:3,y:2,w:2,h:1,c:"lighten($hair, 15)",a:.3}]}});const Tc=new Map;function Ll(t,l,r){if("down"in r&&!("pixels"in r)){const c=r;Tc.set(t,{id:t,name:l,layer:{...c.down,name:"torso"},directions:{down:{...c.down,name:"torso"},up:c.up?{...c.up,name:"torso"}:void 0,left:c.left?{...c.left,name:"torso"}:void 0,right:c.right?{...c.right,name:"torso"}:void 0}})}else{const c=r;Tc.set(t,{id:t,name:l,layer:{...c,name:"torso"}})}}function Fj(t){return Tc.get(t)}function lg(){return Array.from(Tc.values())}Ll("tshirt","T-Shirt",{down:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:2,y:10,w:8,h:1,c:"lighten($shirt, 18)",a:.3},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:5,y:10,w:2,h:3,c:"darken($shirt, 10)",a:.15},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:1,y:10,w:9,h:6,c:"$shirt"},{x:2,y:10,w:7,h:1,c:"lighten($shirt, 18)",a:.3},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:-1,y:11,w:3,h:5,c:"$shirt"},{x:-1,y:15,w:3,h:1,c:"$skin"}]}});Ll("suit","Suit",{down:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:2,y:10,w:8,h:1,c:"lighten($shirt, 12)",a:.3},{x:1,y:10,w:1,h:5,c:"darken($shirt, 30)",a:.3},{x:10,y:10,w:1,h:5,c:"darken($shirt, 30)",a:.3},{x:2,y:10,w:3,h:3,c:"darken($shirt, 20)",a:.3},{x:7,y:10,w:3,h:3,c:"darken($shirt, 20)",a:.3},{x:5,y:10,w:2,h:5,c:"#E8E8E8",a:.5},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:11,w:2,h:1,c:"darken($shirt, 20)",a:.2},{x:11,y:11,w:2,h:1,c:"darken($shirt, 20)",a:.2},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 30)",a:.3},{x:10,y:10,w:1,h:5,c:"darken($shirt, 30)",a:.3},{x:5,y:12,w:2,h:4,c:"darken($shirt, 10)",a:.15},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:1,y:10,w:9,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 30)",a:.3},{x:2,y:10,w:3,h:3,c:"darken($shirt, 20)",a:.3},{x:-1,y:11,w:3,h:5,c:"$shirt"},{x:-1,y:11,w:3,h:1,c:"darken($shirt, 20)",a:.2},{x:-1,y:15,w:3,h:1,c:"$skin"}]}});Ll("hoodie","Hoodie",{down:{name:"torso",pixels:[{x:0,y:10,w:12,h:6,c:"$shirt"},{x:1,y:10,w:10,h:1,c:"lighten($shirt, 15)",a:.25},{x:0,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.3},{x:11,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.3},{x:2,y:8,w:8,h:2,c:"$shirt",a:.4},{x:3,y:13,w:6,h:2,c:"darken($shirt, 15)",a:.2},{x:5,y:10,w:1,h:2,c:"#DDD",a:.3},{x:6,y:10,w:1,h:2,c:"#DDD",a:.3},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:0,y:10,w:12,h:6,c:"$shirt"},{x:0,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.3},{x:11,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.3},{x:2,y:7,w:8,h:3,c:"$shirt",a:.5},{x:3,y:7,w:6,h:1,c:"darken($shirt, 10)",a:.3},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:0,y:10,w:10,h:6,c:"$shirt"},{x:1,y:10,w:8,h:1,c:"lighten($shirt, 15)",a:.25},{x:0,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.3},{x:2,y:8,w:6,h:2,c:"$shirt",a:.4},{x:-1,y:11,w:3,h:5,c:"$shirt"},{x:-1,y:15,w:3,h:1,c:"$skin"}]}});Ll("vest","Vest",{down:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:2,y:10,w:8,h:1,c:"lighten($shirt, 18)",a:.3},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:5,y:10,w:2,h:2,c:"$skin",a:.6},{x:-1,y:11,w:2,h:5,c:"$skin"},{x:11,y:11,w:2,h:5,c:"$skin"},{x:-1,y:15,w:2,h:1,c:"darken($skin, 10)"},{x:11,y:15,w:2,h:1,c:"darken($skin, 10)"}]},up:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:-1,y:11,w:2,h:5,c:"$skin"},{x:11,y:11,w:2,h:5,c:"$skin"},{x:-1,y:15,w:2,h:1,c:"darken($skin, 10)"},{x:11,y:15,w:2,h:1,c:"darken($skin, 10)"}]},left:{name:"torso",pixels:[{x:1,y:10,w:9,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:-1,y:11,w:3,h:5,c:"$skin"},{x:-1,y:15,w:3,h:1,c:"darken($skin, 10)"}]}});Ll("tank","Tank Top",{down:{name:"torso",pixels:[{x:2,y:10,w:8,h:6,c:"$shirt"},{x:3,y:10,w:6,h:1,c:"lighten($shirt, 18)",a:.3},{x:2,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:9,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:0,y:10,w:2,h:2,c:"$skin"},{x:10,y:10,w:2,h:2,c:"$skin"},{x:-1,y:11,w:2,h:5,c:"$skin"},{x:11,y:11,w:2,h:5,c:"$skin"},{x:-1,y:15,w:2,h:1,c:"darken($skin, 10)"},{x:11,y:15,w:2,h:1,c:"darken($skin, 10)"}]},up:{name:"torso",pixels:[{x:2,y:10,w:8,h:6,c:"$shirt"},{x:2,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:9,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:0,y:10,w:2,h:2,c:"$skin"},{x:10,y:10,w:2,h:2,c:"$skin"},{x:-1,y:11,w:2,h:5,c:"$skin"},{x:11,y:11,w:2,h:5,c:"$skin"},{x:-1,y:15,w:2,h:1,c:"darken($skin, 10)"},{x:11,y:15,w:2,h:1,c:"darken($skin, 10)"}]},left:{name:"torso",pixels:[{x:2,y:10,w:7,h:6,c:"$shirt"},{x:2,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:0,y:10,w:2,h:2,c:"$skin"},{x:-1,y:11,w:3,h:5,c:"$skin"},{x:-1,y:15,w:3,h:1,c:"darken($skin, 10)"}]}});Ll("polo","Polo",{down:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:2,y:10,w:8,h:1,c:"lighten($shirt, 18)",a:.3},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:3,y:9,w:6,h:2,c:"lighten($shirt, 25)",a:.5},{x:5,y:9,w:2,h:1,c:"$skin",a:.4},{x:5,y:10,w:2,h:3,c:"darken($shirt, 15)",a:.15},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:3,y:9,w:6,h:1,c:"lighten($shirt, 25)",a:.5},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:1,y:10,w:9,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:3,y:9,w:4,h:2,c:"lighten($shirt, 25)",a:.5},{x:-1,y:11,w:3,h:5,c:"$shirt"},{x:-1,y:15,w:3,h:1,c:"$skin"}]}});Ll("labcoat","Lab Coat",{down:{name:"torso",pixels:[{x:4,y:10,w:4,h:5,c:"$shirt"},{x:0,y:10,w:4,h:7,c:"#F0F0F0"},{x:8,y:10,w:4,h:7,c:"#F0F0F0"},{x:1,y:10,w:10,h:1,c:"#FAFAFA"},{x:0,y:10,w:1,h:7,c:"#DDD",a:.5},{x:11,y:10,w:1,h:7,c:"#DDD",a:.5},{x:1,y:13,w:2,h:2,c:"#E0E0E0",a:.4},{x:9,y:13,w:2,h:2,c:"#E0E0E0",a:.4},{x:-1,y:11,w:2,h:5,c:"#F0F0F0"},{x:11,y:11,w:2,h:5,c:"#F0F0F0"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:0,y:10,w:12,h:7,c:"#F0F0F0"},{x:0,y:10,w:1,h:7,c:"#DDD",a:.5},{x:11,y:10,w:1,h:7,c:"#DDD",a:.5},{x:5,y:11,w:2,h:5,c:"#E8E8E8",a:.3},{x:-1,y:11,w:2,h:5,c:"#F0F0F0"},{x:11,y:11,w:2,h:5,c:"#F0F0F0"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:3,y:10,w:3,h:5,c:"$shirt"},{x:0,y:10,w:3,h:7,c:"#F0F0F0"},{x:6,y:10,w:4,h:7,c:"#F0F0F0"},{x:1,y:10,w:8,h:1,c:"#FAFAFA"},{x:0,y:10,w:1,h:7,c:"#DDD",a:.5},{x:1,y:13,w:2,h:2,c:"#E0E0E0",a:.4},{x:-1,y:11,w:3,h:5,c:"#F0F0F0"},{x:-1,y:15,w:3,h:1,c:"$skin"}]}});Ll("overalls","Overalls",{down:{name:"torso",pixels:[{x:1,y:10,w:10,h:3,c:"$shirt"},{x:2,y:10,w:8,h:1,c:"lighten($shirt, 18)",a:.3},{x:3,y:11,w:6,h:5,c:"#3D6B99"},{x:3,y:10,w:2,h:1,c:"#3D6B99"},{x:7,y:10,w:2,h:1,c:"#3D6B99"},{x:3,y:11,w:1,h:1,c:"#FFD700",a:.6},{x:8,y:11,w:1,h:1,c:"#FFD700",a:.6},{x:1,y:13,w:2,h:3,c:"#3D6B99"},{x:9,y:13,w:2,h:3,c:"#3D6B99"},{x:5,y:13,w:2,h:2,c:"#345E87",a:.4},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:1,y:10,w:10,h:3,c:"$shirt"},{x:3,y:10,w:2,h:1,c:"#3D6B99"},{x:7,y:10,w:2,h:1,c:"#3D6B99"},{x:1,y:13,w:10,h:3,c:"#3D6B99"},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:1,y:10,w:9,h:3,c:"$shirt"},{x:3,y:11,w:5,h:5,c:"#3D6B99"},{x:3,y:10,w:2,h:1,c:"#3D6B99"},{x:3,y:11,w:1,h:1,c:"#FFD700",a:.6},{x:1,y:13,w:2,h:3,c:"#3D6B99"},{x:-1,y:11,w:3,h:5,c:"$shirt"},{x:-1,y:15,w:3,h:1,c:"$skin"}]}});Ll("turtleneck","Turtleneck",{down:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:3,y:8,w:6,h:2,c:"$shirt"},{x:4,y:8,w:4,h:1,c:"lighten($shirt, 12)",a:.3},{x:3,y:9,w:1,h:1,c:"darken($shirt, 15)",a:.2},{x:8,y:9,w:1,h:1,c:"darken($shirt, 15)",a:.2},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:3,y:8,w:6,h:2,c:"$shirt"},{x:4,y:8,w:4,h:1,c:"lighten($shirt, 12)",a:.3},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:1,y:10,w:9,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:3,y:8,w:4,h:2,c:"$shirt"},{x:3,y:8,w:3,h:1,c:"lighten($shirt, 12)",a:.3},{x:-1,y:11,w:3,h:5,c:"$shirt"},{x:-1,y:15,w:3,h:1,c:"$skin"}]}});Ll("robe","Robe",{down:{name:"torso",pixels:[{x:0,y:10,w:12,h:7,c:"$shirt"},{x:0,y:10,w:1,h:6,c:"darken($shirt, 25)",a:.3},{x:11,y:10,w:1,h:6,c:"darken($shirt, 25)",a:.3},{x:3,y:10,w:3,h:4,c:"lighten($shirt, 15)",a:.25},{x:6,y:10,w:3,h:4,c:"darken($shirt, 10)",a:.2},{x:1,y:14,w:10,h:1,c:"darken($shirt, 35)"},{x:2,y:14,w:8,h:1,c:"darken($shirt, 25)",a:.4},{x:-2,y:11,w:3,h:5,c:"$shirt"},{x:11,y:11,w:3,h:5,c:"$shirt"},{x:-2,y:15,w:3,h:1,c:"darken($shirt, 15)",a:.3},{x:11,y:15,w:3,h:1,c:"darken($shirt, 15)",a:.3},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:0,y:10,w:12,h:7,c:"$shirt"},{x:0,y:10,w:1,h:6,c:"darken($shirt, 25)",a:.3},{x:11,y:10,w:1,h:6,c:"darken($shirt, 25)",a:.3},{x:1,y:14,w:10,h:1,c:"darken($shirt, 35)"},{x:-2,y:11,w:3,h:5,c:"$shirt"},{x:11,y:11,w:3,h:5,c:"$shirt"},{x:-2,y:15,w:3,h:1,c:"darken($shirt, 15)",a:.3},{x:11,y:15,w:3,h:1,c:"darken($shirt, 15)",a:.3},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:0,y:10,w:10,h:7,c:"$shirt"},{x:0,y:10,w:1,h:6,c:"darken($shirt, 25)",a:.3},{x:1,y:14,w:8,h:1,c:"darken($shirt, 35)"},{x:-2,y:11,w:4,h:5,c:"$shirt"},{x:-2,y:15,w:4,h:1,c:"darken($shirt, 15)",a:.3},{x:-1,y:15,w:2,h:1,c:"$skin"}]}});const Rs=new Map;function jt(t,l,r){if("down"in r&&!("pixels"in r)){const c=r;Rs.set(t,{id:t,name:l,layer:{...c.down,name:"accessory"},directions:{down:{...c.down,name:"accessory"},up:c.up?{...c.up,name:"accessory"}:void 0,left:c.left?{...c.left,name:"accessory"}:void 0,right:c.right?{...c.right,name:"accessory"}:void 0}})}else{const c=r;Rs.set(t,{id:t,name:l,layer:{...c,name:"accessory"}})}}function Rj(t){return Rs.get(t)}function _j(t,l){const r=Rs.get(t);if(!r)return;if(r.directions)return Nj(r.directions,l);if(l==="down")return r.layer;const i=r.layer.pixels.filter(u=>u.y<2);if(i.length===0)return;const c=l==="right"?1:l==="left"?-1:0;return{name:r.layer.name,pixels:c?i.map(u=>({...u,x:u.x+c})):i}}function rg(){return Array.from(Rs.values())}jt("none","None",{name:"accessory",pixels:[]});jt("glasses","Glasses",{down:{name:"accessory",pixels:[{x:2,y:4,w:3,h:2,c:"#2A3A50",a:.5},{x:7,y:4,w:3,h:2,c:"#2A3A50",a:.5},{x:5,y:4,w:2,h:1,c:"#2A3A50",a:.3}]},up:{name:"accessory",pixels:[{x:0,y:3,w:2,h:1,c:"#2A3A50",a:.4},{x:10,y:3,w:2,h:1,c:"#2A3A50",a:.4}]},left:{name:"accessory",pixels:[{x:2,y:4,w:3,h:2,c:"#2A3A50",a:.5},{x:5,y:4,w:6,h:1,c:"#2A3A50",a:.3}]}});jt("round-glasses","Round Glasses",{down:{name:"accessory",pixels:[{x:2,y:3,w:3,h:3,c:"#8B7355",a:.4},{x:7,y:3,w:3,h:3,c:"#8B7355",a:.4},{x:3,y:4,w:1,h:1,c:"#B0E0FF",a:.15},{x:8,y:4,w:1,h:1,c:"#B0E0FF",a:.15},{x:5,y:4,w:2,h:1,c:"#8B7355",a:.3}]},up:{name:"accessory",pixels:[{x:0,y:3,w:2,h:1,c:"#8B7355",a:.3},{x:10,y:3,w:2,h:1,c:"#8B7355",a:.3}]},left:{name:"accessory",pixels:[{x:2,y:3,w:3,h:3,c:"#8B7355",a:.4},{x:3,y:4,w:1,h:1,c:"#B0E0FF",a:.15},{x:5,y:4,w:6,h:1,c:"#8B7355",a:.25}]}});jt("sunglasses","Sunglasses",{down:{name:"accessory",pixels:[{x:2,y:4,w:3,h:2,c:"#1A1A2E",a:.7},{x:7,y:4,w:3,h:2,c:"#1A1A2E",a:.7},{x:5,y:4,w:2,h:1,c:"#1A1A2E",a:.4},{x:3,y:4,w:1,h:1,c:"#334",a:.3},{x:8,y:4,w:1,h:1,c:"#334",a:.3}]},up:{name:"accessory",pixels:[{x:0,y:3,w:2,h:1,c:"#1A1A2E",a:.4},{x:10,y:3,w:2,h:1,c:"#1A1A2E",a:.4}]},left:{name:"accessory",pixels:[{x:2,y:4,w:3,h:2,c:"#1A1A2E",a:.7},{x:3,y:4,w:1,h:1,c:"#334",a:.3},{x:5,y:4,w:6,h:1,c:"#1A1A2E",a:.35}]}});jt("headphones","Headphones",{down:{name:"accessory",pixels:[{x:0,y:0,w:12,h:1,c:"#333",a:.7},{x:-1,y:1,w:2,h:5,c:"#444"},{x:11,y:1,w:2,h:5,c:"#444"},{x:-1,y:2,w:2,h:3,c:"#555",a:.3},{x:11,y:2,w:2,h:3,c:"#555",a:.3}]},up:{name:"accessory",pixels:[{x:0,y:0,w:12,h:1,c:"#333",a:.7},{x:-1,y:1,w:2,h:5,c:"#444"},{x:11,y:1,w:2,h:5,c:"#444"},{x:-1,y:2,w:2,h:3,c:"#555",a:.3},{x:11,y:2,w:2,h:3,c:"#555",a:.3}]},left:{name:"accessory",pixels:[{x:1,y:0,w:10,h:1,c:"#333",a:.7},{x:-1,y:1,w:3,h:5,c:"#444"},{x:-1,y:2,w:3,h:3,c:"#555",a:.3}]}});jt("beret","Beret",{down:{name:"accessory",pixels:[{x:2,y:-1,w:8,h:2,c:"#E91E63"},{x:1,y:0,w:2,h:1,c:"#E91E63",a:.6},{x:4,y:-1,w:4,h:1,c:"#F06292",a:.3}]},up:{name:"accessory",pixels:[{x:2,y:-1,w:8,h:2,c:"#E91E63"},{x:9,y:0,w:2,h:1,c:"#E91E63",a:.6}]},left:{name:"accessory",pixels:[{x:0,y:-1,w:8,h:2,c:"#E91E63"},{x:2,y:-1,w:4,h:1,c:"#F06292",a:.3}]}});jt("cap","Cap",{down:{name:"accessory",pixels:[{x:1,y:-1,w:10,h:2,c:"#1565C0"},{x:0,y:1,w:12,h:1,c:"#0D47A1"},{x:3,y:-1,w:6,h:1,c:"#1E88E5",a:.3}]},up:{name:"accessory",pixels:[{x:1,y:-1,w:10,h:2,c:"#1565C0"},{x:3,y:-1,w:6,h:1,c:"#1E88E5",a:.3},{x:5,y:1,w:2,h:1,c:"#0D47A1",a:.5}]},left:{name:"accessory",pixels:[{x:0,y:-1,w:9,h:2,c:"#1565C0"},{x:-2,y:1,w:6,h:1,c:"#0D47A1"},{x:2,y:-1,w:5,h:1,c:"#1E88E5",a:.3}]}});jt("badge","Badge",{down:{name:"accessory",pixels:[{x:5,y:8,w:2,h:3,c:"#2196F3",a:.4},{x:4,y:11,w:4,h:3,c:"#FFF",a:.5},{x:5,y:12,w:2,h:1,c:"#333",a:.3}]},up:{name:"accessory",pixels:[]},left:{name:"accessory",pixels:[{x:3,y:8,w:1,h:3,c:"#2196F3",a:.4},{x:2,y:11,w:3,h:3,c:"#FFF",a:.5}]}});jt("lapels","Lapels",{down:{name:"accessory",pixels:[{x:1,y:10,w:3,h:2,c:"#1A1A2E",a:.4},{x:8,y:10,w:3,h:2,c:"#1A1A2E",a:.4}]},up:{name:"accessory",pixels:[]},left:{name:"accessory",pixels:[{x:1,y:10,w:3,h:2,c:"#1A1A2E",a:.4}]}});jt("blush","Blush",{down:{name:"accessory",pixels:[{x:2,y:6,w:1,h:1,c:"#FFCDD2",a:.3},{x:9,y:6,w:1,h:1,c:"#FFCDD2",a:.3}]},up:{name:"accessory",pixels:[]},left:{name:"accessory",pixels:[{x:2,y:6,w:1,h:1,c:"#FFCDD2",a:.3}]}});jt("scarf","Scarf",{down:{name:"accessory",pixels:[{x:2,y:9,w:8,h:2,c:"#E53935",a:.6},{x:3,y:9,w:6,h:1,c:"#EF5350",a:.3},{x:3,y:11,w:2,h:3,c:"#E53935",a:.5}]},up:{name:"accessory",pixels:[{x:2,y:9,w:8,h:2,c:"#E53935",a:.6},{x:3,y:9,w:6,h:1,c:"#EF5350",a:.3}]},left:{name:"accessory",pixels:[{x:1,y:9,w:8,h:2,c:"#E53935",a:.6},{x:2,y:9,w:5,h:1,c:"#EF5350",a:.3},{x:1,y:11,w:2,h:3,c:"#E53935",a:.5}]}});jt("tie","Tie",{down:{name:"accessory",pixels:[{x:5,y:9,w:2,h:1,c:"#B71C1C"},{x:5,y:10,w:2,h:4,c:"#D32F2F"},{x:5,y:10,w:1,h:4,c:"#E53935",a:.3},{x:5,y:14,w:2,h:1,c:"#B71C1C",a:.8}]},up:{name:"accessory",pixels:[]},left:{name:"accessory",pixels:[{x:4,y:9,w:2,h:1,c:"#B71C1C"},{x:4,y:10,w:2,h:4,c:"#D32F2F"},{x:4,y:14,w:2,h:1,c:"#B71C1C",a:.8}]}});jt("bowtie","Bowtie",{down:{name:"accessory",pixels:[{x:3,y:9,w:2,h:1,c:"#D32F2F"},{x:7,y:9,w:2,h:1,c:"#D32F2F"},{x:5,y:9,w:2,h:1,c:"#B71C1C"},{x:4,y:9,w:1,h:1,c:"#E53935",a:.3},{x:7,y:9,w:1,h:1,c:"#E53935",a:.3}]},up:{name:"accessory",pixels:[]},left:{name:"accessory",pixels:[{x:3,y:9,w:3,h:1,c:"#D32F2F"},{x:4,y:9,w:1,h:1,c:"#B71C1C"}]}});jt("cat-ears","Cat Ears",{down:{name:"accessory",pixels:[{x:1,y:-3,w:2,h:1,c:"#555"},{x:0,y:-2,w:3,h:1,c:"#555"},{x:0,y:-1,w:3,h:1,c:"#555"},{x:1,y:-2,w:1,h:1,c:"#FFB0C0",a:.6},{x:9,y:-3,w:2,h:1,c:"#555"},{x:9,y:-2,w:3,h:1,c:"#555"},{x:9,y:-1,w:3,h:1,c:"#555"},{x:10,y:-2,w:1,h:1,c:"#FFB0C0",a:.6}]},up:{name:"accessory",pixels:[{x:1,y:-3,w:2,h:1,c:"#555"},{x:0,y:-2,w:3,h:1,c:"#555"},{x:0,y:-1,w:3,h:1,c:"#555"},{x:9,y:-3,w:2,h:1,c:"#555"},{x:9,y:-2,w:3,h:1,c:"#555"},{x:9,y:-1,w:3,h:1,c:"#555"}]},left:{name:"accessory",pixels:[{x:2,y:-3,w:2,h:1,c:"#555"},{x:1,y:-2,w:3,h:1,c:"#555"},{x:1,y:-1,w:3,h:1,c:"#555"},{x:2,y:-2,w:1,h:1,c:"#FFB0C0",a:.6}]}});jt("bear-ears","Bear Ears",{down:{name:"accessory",pixels:[{x:0,y:-2,w:3,h:2,c:"#8B6914"},{x:1,y:-1,w:1,h:1,c:"#C4A24A",a:.5},{x:9,y:-2,w:3,h:2,c:"#8B6914"},{x:10,y:-1,w:1,h:1,c:"#C4A24A",a:.5}]},up:{name:"accessory",pixels:[{x:0,y:-2,w:3,h:2,c:"#8B6914"},{x:9,y:-2,w:3,h:2,c:"#8B6914"}]},left:{name:"accessory",pixels:[{x:1,y:-2,w:3,h:2,c:"#8B6914"},{x:2,y:-1,w:1,h:1,c:"#C4A24A",a:.5}]}});jt("bunny-ears","Bunny Ears",{down:{name:"accessory",pixels:[{x:2,y:-5,w:2,h:4,c:"#F5F5F5"},{x:2,y:-4,w:1,h:2,c:"#FFB0C0",a:.5},{x:8,y:-5,w:2,h:4,c:"#F5F5F5"},{x:9,y:-4,w:1,h:2,c:"#FFB0C0",a:.5},{x:9,y:-6,w:2,h:1,c:"#F5F5F5"}]},up:{name:"accessory",pixels:[{x:2,y:-5,w:2,h:4,c:"#F5F5F5"},{x:8,y:-5,w:2,h:4,c:"#F5F5F5"},{x:9,y:-6,w:2,h:1,c:"#F5F5F5"}]},left:{name:"accessory",pixels:[{x:3,y:-5,w:2,h:4,c:"#F5F5F5"},{x:3,y:-4,w:1,h:2,c:"#FFB0C0",a:.5},{x:4,y:-6,w:2,h:1,c:"#F5F5F5"}]}});jt("dog-nose","Dog Nose",{down:{name:"accessory",pixels:[{x:4,y:5,w:4,h:3,c:"#D2B48C",a:.5},{x:5,y:5,w:2,h:1,c:"#222"},{x:6,y:7,w:1,h:1,c:"#FF6B8A",a:.7}]},up:{name:"accessory",pixels:[]},left:{name:"accessory",pixels:[{x:0,y:5,w:4,h:2,c:"#D2B48C",a:.5},{x:0,y:5,w:2,h:1,c:"#222"},{x:1,y:7,w:1,h:1,c:"#FF6B8A",a:.7}]}});jt("fox-mask","Fox Mask",{down:{name:"accessory",pixels:[{x:0,y:-3,w:2,h:1,c:"#E65100"},{x:-1,y:-2,w:3,h:1,c:"#E65100"},{x:0,y:-1,w:3,h:1,c:"#E65100"},{x:10,y:-3,w:2,h:1,c:"#E65100"},{x:10,y:-2,w:3,h:1,c:"#E65100"},{x:9,y:-1,w:3,h:1,c:"#E65100"},{x:0,y:-2,w:1,h:1,c:"#FFF",a:.4},{x:11,y:-2,w:1,h:1,c:"#FFF",a:.4},{x:1,y:5,w:2,h:2,c:"#FFF",a:.25},{x:9,y:5,w:2,h:2,c:"#FFF",a:.25},{x:5,y:6,w:2,h:1,c:"#222",a:.6}]},up:{name:"accessory",pixels:[{x:0,y:-3,w:2,h:1,c:"#E65100"},{x:-1,y:-2,w:3,h:1,c:"#E65100"},{x:0,y:-1,w:3,h:1,c:"#E65100"},{x:10,y:-3,w:2,h:1,c:"#E65100"},{x:10,y:-2,w:3,h:1,c:"#E65100"},{x:9,y:-1,w:3,h:1,c:"#E65100"}]},left:{name:"accessory",pixels:[{x:1,y:-3,w:2,h:1,c:"#E65100"},{x:0,y:-2,w:3,h:1,c:"#E65100"},{x:1,y:-1,w:3,h:1,c:"#E65100"},{x:1,y:-2,w:1,h:1,c:"#FFF",a:.4},{x:1,y:5,w:2,h:2,c:"#FFF",a:.25},{x:1,y:6,w:2,h:1,c:"#222",a:.6}]}});jt("crown","Crown",{down:{name:"accessory",pixels:[{x:2,y:-1,w:8,h:2,c:"#FFD700"},{x:3,y:-3,w:2,h:2,c:"#FFD700"},{x:5,y:-2,w:2,h:1,c:"#FFD700"},{x:7,y:-3,w:2,h:2,c:"#FFD700"},{x:4,y:-2,w:1,h:1,c:"#E53935",a:.8},{x:6,y:-1,w:1,h:1,c:"#42A5F5",a:.8},{x:8,y:-2,w:1,h:1,c:"#66BB6A",a:.8},{x:3,y:-1,w:6,h:1,c:"#FFF",a:.15}]},up:{name:"accessory",pixels:[{x:2,y:-1,w:8,h:2,c:"#FFD700"},{x:3,y:-3,w:2,h:2,c:"#FFD700"},{x:5,y:-2,w:2,h:1,c:"#FFD700"},{x:7,y:-3,w:2,h:2,c:"#FFD700"},{x:3,y:-1,w:6,h:1,c:"#FFF",a:.15}]},left:{name:"accessory",pixels:[{x:1,y:-1,w:7,h:2,c:"#FFD700"},{x:2,y:-3,w:2,h:2,c:"#FFD700"},{x:5,y:-2,w:2,h:1,c:"#FFD700"},{x:3,y:-2,w:1,h:1,c:"#E53935",a:.8},{x:5,y:-1,w:1,h:1,c:"#42A5F5",a:.8},{x:2,y:-1,w:5,h:1,c:"#FFF",a:.15}]}});jt("halo","Halo",{down:{name:"accessory",pixels:[{x:2,y:-3,w:8,h:1,c:"#FFE082",a:.7},{x:1,y:-2,w:1,h:1,c:"#FFE082",a:.5},{x:10,y:-2,w:1,h:1,c:"#FFE082",a:.5},{x:3,y:-4,w:6,h:1,c:"#FFF9C4",a:.4},{x:3,y:-3,w:6,h:1,c:"#FFF",a:.15}]},up:{name:"accessory",pixels:[{x:2,y:-3,w:8,h:1,c:"#FFE082",a:.7},{x:1,y:-2,w:1,h:1,c:"#FFE082",a:.5},{x:10,y:-2,w:1,h:1,c:"#FFE082",a:.5},{x:3,y:-4,w:6,h:1,c:"#FFF9C4",a:.4},{x:3,y:-3,w:6,h:1,c:"#FFF",a:.15}]},left:{name:"accessory",pixels:[{x:1,y:-3,w:7,h:1,c:"#FFE082",a:.7},{x:0,y:-2,w:1,h:1,c:"#FFE082",a:.5},{x:8,y:-2,w:1,h:1,c:"#FFE082",a:.5},{x:2,y:-4,w:5,h:1,c:"#FFF9C4",a:.4},{x:2,y:-3,w:5,h:1,c:"#FFF",a:.15}]}});jt("horns","Horns",{down:{name:"accessory",pixels:[{x:1,y:-1,w:2,h:2,c:"#8B0000"},{x:0,y:-3,w:2,h:2,c:"#A00"},{x:0,y:-4,w:1,h:1,c:"#C62828"},{x:9,y:-1,w:2,h:2,c:"#8B0000"},{x:10,y:-3,w:2,h:2,c:"#A00"},{x:11,y:-4,w:1,h:1,c:"#C62828"}]},up:{name:"accessory",pixels:[{x:1,y:-1,w:2,h:2,c:"#8B0000"},{x:0,y:-3,w:2,h:2,c:"#A00"},{x:0,y:-4,w:1,h:1,c:"#C62828"},{x:9,y:-1,w:2,h:2,c:"#8B0000"},{x:10,y:-3,w:2,h:2,c:"#A00"},{x:11,y:-4,w:1,h:1,c:"#C62828"}]},left:{name:"accessory",pixels:[{x:2,y:-1,w:2,h:2,c:"#8B0000"},{x:1,y:-3,w:2,h:2,c:"#A00"},{x:1,y:-4,w:1,h:1,c:"#C62828"}]}});jt("mask","Mask",{down:{name:"accessory",pixels:[{x:1,y:3,w:10,h:3,c:"#1A1A2E",a:.75},{x:3,y:4,w:2,h:1,c:"#000",a:0},{x:7,y:4,w:2,h:1,c:"#000",a:0},{x:1,y:3,w:10,h:1,c:"#FFD700",a:.3},{x:1,y:5,w:10,h:1,c:"#FFD700",a:.2}]},up:{name:"accessory",pixels:[{x:0,y:4,w:12,h:1,c:"#1A1A2E",a:.3}]},left:{name:"accessory",pixels:[{x:1,y:3,w:6,h:3,c:"#1A1A2E",a:.75},{x:2,y:4,w:2,h:1,c:"#000",a:0},{x:1,y:3,w:6,h:1,c:"#FFD700",a:.3},{x:1,y:5,w:6,h:1,c:"#FFD700",a:.2}]}});jt("bandana","Bandana",{down:{name:"accessory",pixels:[{x:0,y:1,w:12,h:2,c:"#E53935"},{x:1,y:1,w:10,h:1,c:"#EF5350",a:.3}]},up:{name:"accessory",pixels:[{x:0,y:1,w:12,h:2,c:"#E53935"},{x:1,y:1,w:10,h:1,c:"#EF5350",a:.3},{x:11,y:2,w:2,h:2,c:"#E53935",a:.7},{x:12,y:3,w:1,h:1,c:"#C62828",a:.5}]},left:{name:"accessory",pixels:[{x:0,y:1,w:10,h:2,c:"#E53935"},{x:1,y:1,w:8,h:1,c:"#EF5350",a:.3}]}});jt("eyepatch","Eye Patch",{down:{name:"accessory",pixels:[{x:0,y:3,w:12,h:1,c:"#222",a:.5},{x:2,y:3,w:3,h:3,c:"#1A1A1A"},{x:3,y:4,w:1,h:1,c:"#333",a:.3}]},up:{name:"accessory",pixels:[{x:0,y:3,w:12,h:1,c:"#222",a:.5}]},left:{name:"accessory",pixels:[{x:0,y:3,w:10,h:1,c:"#222",a:.5},{x:1,y:3,w:3,h:3,c:"#1A1A1A"},{x:2,y:4,w:1,h:1,c:"#333",a:.3}]}});jt("cat-face","Cat Face",{down:{name:"accessory",pixels:[{x:1,y:1,w:10,h:8,c:"#555"},{x:2,y:0,w:8,h:1,c:"#555"},{x:0,y:-2,w:3,h:2,c:"#555"},{x:1,y:-3,w:2,h:1,c:"#555"},{x:9,y:-2,w:3,h:2,c:"#555"},{x:9,y:-3,w:2,h:1,c:"#555"},{x:1,y:-1,w:1,h:1,c:"#FFB0C0",a:.7},{x:10,y:-1,w:1,h:1,c:"#FFB0C0",a:.7},{x:2,y:3,w:3,h:3,c:"#222"},{x:7,y:3,w:3,h:3,c:"#222"},{x:3,y:3,w:1,h:2,c:"#4FC3F7",a:.8},{x:8,y:3,w:1,h:2,c:"#4FC3F7",a:.8},{x:3,y:4,w:1,h:1,c:"#111"},{x:8,y:4,w:1,h:1,c:"#111"},{x:5,y:5,w:2,h:1,c:"#FFB0C0"},{x:4,y:6,w:1,h:1,c:"#444",a:.6},{x:7,y:6,w:1,h:1,c:"#444",a:.6},{x:0,y:5,w:2,h:1,c:"#888",a:.4},{x:10,y:5,w:2,h:1,c:"#888",a:.4},{x:0,y:6,w:2,h:1,c:"#888",a:.3},{x:10,y:6,w:2,h:1,c:"#888",a:.3}]},up:{name:"accessory",pixels:[{x:1,y:1,w:10,h:8,c:"#555"},{x:2,y:0,w:8,h:1,c:"#555"},{x:0,y:-2,w:3,h:2,c:"#555"},{x:1,y:-3,w:2,h:1,c:"#555"},{x:9,y:-2,w:3,h:2,c:"#555"},{x:9,y:-3,w:2,h:1,c:"#555"},{x:5,y:1,w:2,h:5,c:"#4A4A4A",a:.3},{x:9,y:8,w:2,h:2,c:"#555"},{x:10,y:7,w:1,h:1,c:"#555"}]},left:{name:"accessory",pixels:[{x:1,y:1,w:9,h:8,c:"#555"},{x:2,y:0,w:7,h:1,c:"#555"},{x:2,y:-2,w:3,h:2,c:"#555"},{x:3,y:-3,w:2,h:1,c:"#555"},{x:3,y:-1,w:1,h:1,c:"#FFB0C0",a:.7},{x:2,y:3,w:3,h:3,c:"#222"},{x:3,y:3,w:1,h:2,c:"#4FC3F7",a:.8},{x:3,y:4,w:1,h:1,c:"#111"},{x:0,y:5,w:3,h:2,c:"#555"},{x:0,y:5,w:2,h:1,c:"#FFB0C0"},{x:-1,y:5,w:2,h:1,c:"#888",a:.4},{x:-1,y:6,w:2,h:1,c:"#888",a:.3}]}});jt("bear-face","Bear Face",{down:{name:"accessory",pixels:[{x:1,y:0,w:10,h:9,c:"#8B6914"},{x:2,y:-1,w:8,h:1,c:"#8B6914"},{x:0,y:-1,w:3,h:3,c:"#8B6914"},{x:9,y:-1,w:3,h:3,c:"#8B6914"},{x:1,y:0,w:1,h:1,c:"#C4A24A",a:.6},{x:10,y:0,w:1,h:1,c:"#C4A24A",a:.6},{x:3,y:5,w:6,h:4,c:"#C4A24A",a:.7},{x:3,y:3,w:2,h:2,c:"#111"},{x:7,y:3,w:2,h:2,c:"#111"},{x:3,y:3,w:1,h:1,c:"#FFF",a:.3},{x:7,y:3,w:1,h:1,c:"#FFF",a:.3},{x:5,y:5,w:2,h:1,c:"#222"},{x:5,y:7,w:2,h:1,c:"#6B4F10",a:.5}]},up:{name:"accessory",pixels:[{x:1,y:0,w:10,h:9,c:"#8B6914"},{x:2,y:-1,w:8,h:1,c:"#8B6914"},{x:0,y:-1,w:3,h:3,c:"#8B6914"},{x:9,y:-1,w:3,h:3,c:"#8B6914"},{x:1,y:0,w:1,h:1,c:"#C4A24A",a:.6},{x:10,y:0,w:1,h:1,c:"#C4A24A",a:.6},{x:5,y:1,w:2,h:5,c:"#7A5B10",a:.3}]},left:{name:"accessory",pixels:[{x:1,y:0,w:9,h:9,c:"#8B6914"},{x:2,y:-1,w:7,h:1,c:"#8B6914"},{x:0,y:-1,w:3,h:3,c:"#8B6914"},{x:0,y:0,w:1,h:1,c:"#C4A24A",a:.6},{x:0,y:4,w:3,h:4,c:"#C4A24A",a:.7},{x:3,y:3,w:2,h:2,c:"#111"},{x:3,y:3,w:1,h:1,c:"#FFF",a:.3},{x:1,y:5,w:2,h:1,c:"#222"}]}});jt("panda-face","Panda Face",{down:{name:"accessory",pixels:[{x:1,y:0,w:10,h:9,c:"#F5F5F5"},{x:2,y:-1,w:8,h:1,c:"#F5F5F5"},{x:0,y:-2,w:3,h:3,c:"#222"},{x:9,y:-2,w:3,h:3,c:"#222"},{x:2,y:2,w:3,h:4,c:"#222"},{x:7,y:2,w:3,h:4,c:"#222"},{x:3,y:3,w:1,h:2,c:"#FFF"},{x:8,y:3,w:1,h:2,c:"#FFF"},{x:3,y:4,w:1,h:1,c:"#111"},{x:8,y:4,w:1,h:1,c:"#111"},{x:5,y:6,w:2,h:1,c:"#222"},{x:5,y:7,w:1,h:1,c:"#CCC",a:.4},{x:6,y:7,w:1,h:1,c:"#CCC",a:.4}]},up:{name:"accessory",pixels:[{x:1,y:0,w:10,h:9,c:"#F5F5F5"},{x:2,y:-1,w:8,h:1,c:"#F5F5F5"},{x:0,y:-2,w:3,h:3,c:"#222"},{x:9,y:-2,w:3,h:3,c:"#222"},{x:5,y:1,w:2,h:5,c:"#EEE",a:.3}]},left:{name:"accessory",pixels:[{x:1,y:0,w:9,h:9,c:"#F5F5F5"},{x:2,y:-1,w:7,h:1,c:"#F5F5F5"},{x:0,y:-2,w:3,h:3,c:"#222"},{x:2,y:2,w:3,h:4,c:"#222"},{x:3,y:3,w:1,h:2,c:"#FFF"},{x:3,y:4,w:1,h:1,c:"#111"},{x:0,y:5,w:3,h:2,c:"#F5F5F5"},{x:1,y:6,w:1,h:1,c:"#222"}]}});jt("frog-face","Frog Face",{down:{name:"accessory",pixels:[{x:1,y:1,w:10,h:8,c:"#4CAF50"},{x:2,y:0,w:8,h:1,c:"#4CAF50"},{x:1,y:-2,w:4,h:3,c:"#4CAF50"},{x:7,y:-2,w:4,h:3,c:"#4CAF50"},{x:2,y:-1,w:2,h:2,c:"#FFF"},{x:8,y:-1,w:2,h:2,c:"#FFF"},{x:3,y:0,w:1,h:1,c:"#111"},{x:9,y:0,w:1,h:1,c:"#111"},{x:3,y:5,w:6,h:3,c:"#81C784",a:.5},{x:2,y:7,w:8,h:1,c:"#388E3C",a:.6},{x:4,y:4,w:1,h:1,c:"#388E3C",a:.5},{x:7,y:4,w:1,h:1,c:"#388E3C",a:.5},{x:1,y:5,w:2,h:1,c:"#FF8A80",a:.25},{x:9,y:5,w:2,h:1,c:"#FF8A80",a:.25}]},up:{name:"accessory",pixels:[{x:1,y:1,w:10,h:8,c:"#4CAF50"},{x:2,y:0,w:8,h:1,c:"#4CAF50"},{x:1,y:-2,w:4,h:2,c:"#4CAF50"},{x:7,y:-2,w:4,h:2,c:"#4CAF50"},{x:5,y:2,w:2,h:4,c:"#388E3C",a:.2}]},left:{name:"accessory",pixels:[{x:1,y:1,w:9,h:8,c:"#4CAF50"},{x:2,y:0,w:7,h:1,c:"#4CAF50"},{x:0,y:-2,w:4,h:3,c:"#4CAF50"},{x:1,y:-1,w:2,h:2,c:"#FFF"},{x:2,y:0,w:1,h:1,c:"#111"},{x:0,y:5,w:3,h:3,c:"#81C784",a:.5},{x:0,y:7,w:8,h:1,c:"#388E3C",a:.6},{x:1,y:5,w:1,h:1,c:"#FF8A80",a:.25}]}});jt("rabbit-face","Rabbit Face",{down:{name:"accessory",pixels:[{x:1,y:1,w:10,h:8,c:"#F5F5F5"},{x:2,y:0,w:8,h:1,c:"#F5F5F5"},{x:2,y:-6,w:3,h:6,c:"#F5F5F5"},{x:7,y:-6,w:3,h:6,c:"#F5F5F5"},{x:3,y:-5,w:1,h:4,c:"#FFB0C0",a:.6},{x:8,y:-5,w:1,h:4,c:"#FFB0C0",a:.6},{x:2,y:3,w:3,h:3,c:"#E57373",a:.7},{x:7,y:3,w:3,h:3,c:"#E57373",a:.7},{x:3,y:3,w:1,h:1,c:"#FFF",a:.4},{x:8,y:3,w:1,h:1,c:"#FFF",a:.4},{x:5,y:5,w:2,h:1,c:"#FFB0C0"},{x:5,y:6,w:1,h:1,c:"#DDD",a:.4},{x:6,y:6,w:1,h:1,c:"#DDD",a:.4},{x:0,y:4,w:2,h:3,c:"#F5F5F5",a:.6},{x:10,y:4,w:2,h:3,c:"#F5F5F5",a:.6}]},up:{name:"accessory",pixels:[{x:1,y:1,w:10,h:8,c:"#F5F5F5"},{x:2,y:0,w:8,h:1,c:"#F5F5F5"},{x:2,y:-6,w:3,h:6,c:"#F5F5F5"},{x:7,y:-6,w:3,h:6,c:"#F5F5F5"},{x:3,y:-5,w:1,h:4,c:"#FFB0C0",a:.6},{x:8,y:-5,w:1,h:4,c:"#FFB0C0",a:.6},{x:5,y:8,w:3,h:2,c:"#FFF"}]},left:{name:"accessory",pixels:[{x:1,y:1,w:9,h:8,c:"#F5F5F5"},{x:2,y:0,w:7,h:1,c:"#F5F5F5"},{x:3,y:-6,w:3,h:6,c:"#F5F5F5"},{x:4,y:-5,w:1,h:4,c:"#FFB0C0",a:.6},{x:2,y:3,w:3,h:3,c:"#E57373",a:.7},{x:3,y:3,w:1,h:1,c:"#FFF",a:.4},{x:0,y:4,w:3,h:3,c:"#F5F5F5"},{x:1,y:5,w:1,h:1,c:"#FFB0C0"},{x:0,y:4,w:2,h:3,c:"#F5F5F5",a:.6}]}});jt("dog-face","Dog Face",{down:{name:"accessory",pixels:[{x:1,y:0,w:10,h:9,c:"#D2A25C"},{x:2,y:-1,w:8,h:1,c:"#D2A25C"},{x:-1,y:1,w:3,h:6,c:"#A67B3D"},{x:10,y:1,w:3,h:6,c:"#A67B3D"},{x:3,y:5,w:6,h:4,c:"#F5E6D0",a:.8},{x:3,y:2,w:2,h:3,c:"#3E2723"},{x:7,y:2,w:2,h:3,c:"#3E2723"},{x:3,y:2,w:1,h:1,c:"#FFF",a:.4},{x:7,y:2,w:1,h:1,c:"#FFF",a:.4},{x:5,y:5,w:2,h:2,c:"#222"},{x:5,y:7,w:2,h:2,c:"#FF6B8A",a:.8},{x:5,y:7,w:1,h:1,c:"#FF8A9E",a:.4}]},up:{name:"accessory",pixels:[{x:1,y:0,w:10,h:9,c:"#D2A25C"},{x:2,y:-1,w:8,h:1,c:"#D2A25C"},{x:-1,y:1,w:3,h:6,c:"#A67B3D"},{x:10,y:1,w:3,h:6,c:"#A67B3D"},{x:5,y:0,w:2,h:6,c:"#B8883C",a:.3},{x:2,y:8,w:8,h:1,c:"#A67B3D",a:.5}]},left:{name:"accessory",pixels:[{x:1,y:0,w:9,h:9,c:"#D2A25C"},{x:2,y:-1,w:7,h:1,c:"#D2A25C"},{x:-1,y:1,w:3,h:6,c:"#A67B3D"},{x:-1,y:4,w:3,h:4,c:"#D2A25C"},{x:-1,y:5,w:2,h:3,c:"#F5E6D0",a:.8},{x:3,y:2,w:2,h:3,c:"#3E2723"},{x:3,y:2,w:1,h:1,c:"#FFF",a:.4},{x:0,y:5,w:2,h:1,c:"#222"},{x:0,y:7,w:2,h:1,c:"#FF6B8A",a:.7}]}});const Oj={none:1,glasses:1,beret:1,cap:1,badge:1,blush:1,lapels:1,"round-glasses":2,headphones:2,scarf:3,tie:3,bowtie:3,sunglasses:4,bandana:4,eyepatch:4,crown:5,halo:5,horns:5,mask:5,"cat-ears":6,"bear-ears":6,"bunny-ears":6,"dog-nose":6,"fox-mask":6,"cat-face":7,"bear-face":7,"panda-face":7,"frog-face":8,"rabbit-face":8,"dog-face":8,"star-glasses":9};function ag(t){return Oj[t]??1}function ig(t,l){return l>=ag(t)}jt("star-glasses","Star Glasses",{down:{name:"accessory",pixels:[{x:1,y:3,w:4,h:3,c:"#FF4081",a:.6},{x:2,y:2,w:2,h:1,c:"#FF4081",a:.6},{x:2,y:6,w:2,h:1,c:"#FF4081",a:.6},{x:7,y:3,w:4,h:3,c:"#FF4081",a:.6},{x:8,y:2,w:2,h:1,c:"#FF4081",a:.6},{x:8,y:6,w:2,h:1,c:"#FF4081",a:.6},{x:5,y:4,w:2,h:1,c:"#FF4081",a:.4}]},up:{name:"accessory",pixels:[{x:0,y:3,w:2,h:1,c:"#FF4081",a:.3},{x:10,y:3,w:2,h:1,c:"#FF4081",a:.3}]},left:{name:"accessory",pixels:[{x:1,y:3,w:4,h:3,c:"#FF4081",a:.6},{x:2,y:2,w:2,h:1,c:"#FF4081",a:.6},{x:2,y:6,w:2,h:1,c:"#FF4081",a:.6},{x:5,y:4,w:6,h:1,c:"#FF4081",a:.3}]}});function vs({r:t,g:l,b:r}){return`#${(t<<16|l<<8|r).toString(16).padStart(6,"0")}`}function bc(t,l){const r=t.r-l.r,i=t.g-l.g,c=t.b-l.b;return r*r+i*i+c*c}function Bj(t,l){const r=[];r.push(t[Math.floor(Math.random()*t.length)]);for(let i=1;i<l;i++){const c=t.map(m=>{let x=1/0;for(const f of r)x=Math.min(x,bc(m,f));return x}),u=c.reduce((m,x)=>m+x,0);let d=Math.random()*u;for(let m=0;m<t.length;m++)if(d-=c[m],d<=0){r.push(t[m]);break}r.length<=i&&r.push(t[Math.floor(Math.random()*t.length)])}return r}function Lj(t,l,r=20){if(t.length===0)return[];const i=Bj(t,l);for(let u=0;u<r;u++){const d=Array.from({length:l},()=>[]);for(const x of t){let f=1/0,g=0;for(let y=0;y<l;y++){const b=bc(x,i[y]);b<f&&(f=b,g=y)}d[g].push(x)}let m=!0;for(let x=0;x<l;x++){if(d[x].length===0)continue;const f={r:0,g:0,b:0};for(const b of d[x])f.r+=b.r,f.g+=b.g,f.b+=b.b;const g=d[x].length,y={r:Math.round(f.r/g),g:Math.round(f.g/g),b:Math.round(f.b/g)};bc(y,i[x])>1&&(m=!1),i[x]=y}if(m)break}const c=new Array(l).fill(0);for(const u of t){let d=1/0,m=0;for(let x=0;x<l;x++){const f=bc(u,i[x]);f<d&&(d=f,m=x)}c[m]++}return i.map((u,d)=>({c:u,count:c[d]})).sort((u,d)=>d.count-u.count).map(u=>u.c)}function $j(t,l=1e4){const r=document.createElement("canvas"),i=t instanceof HTMLImageElement?t.naturalWidth:t.width,c=t instanceof HTMLImageElement?t.naturalHeight:t.height;r.width=i,r.height=c;const u=r.getContext("2d");u.drawImage(t,0,0);const d=u.getImageData(0,0,i,c).data,m=i*c,x=Math.max(1,Math.floor(m/l)),f=[];for(let g=0;g<m;g+=x){const y=g*4;d[y+3]<128||f.push({r:d[y],g:d[y+1],b:d[y+2]})}return f}function s0(t){return .299*t.r+.587*t.g+.114*t.b}function o0(t){const l=Math.max(t.r,t.g,t.b),r=Math.min(t.r,t.g,t.b);return l===0?0:(l-r)/l*255}function Hj(t,l=8){const r=$j(t),i=Lj(r,l);if(i.length<5)return{skinColor:"#F5CBA7",hairColor:"#2C1810",shirtColor:"#1565C0",pantsColor:"#37474F",shoeColor:"#212121"};const c=[...i].sort((y,b)=>s0(b)-s0(y)),u=[...i].sort((y,b)=>o0(b)-o0(y)),d=c[0],m=c[c.length-1],x=u[0],f=c[c.length-2],g=c[c.length-1];return{skinColor:vs(d),hairColor:vs(m),shirtColor:vs(x),pantsColor:vs(f),shoeColor:vs(g)}}const Uj=[{x:1,y:19,w:10,h:2,c:"#100A06",a:.15},{x:2,y:15,w:3,h:4,c:"$pants"},{x:7,y:15,w:3,h:4,c:"$pants"},{x:2,y:19,w:3,h:2,c:"$shoes"},{x:7,y:19,w:3,h:2,c:"$shoes"},{x:2,y:19,w:3,h:1,c:"lighten($shoes, 20)",a:.4},{x:7,y:19,w:3,h:1,c:"lighten($shoes, 20)",a:.4}],Ij=[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:2,y:10,w:8,h:1,c:"lighten($shirt, 18)",a:.3},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:4,y:10,w:4,h:2,c:"darken($shirt, 25)",a:.2},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}],Yj=[{x:4,y:8,w:4,h:3,c:"$skin"},{x:1,y:1,w:10,h:8,c:"$skin"},{x:3,y:4,w:2,h:2,c:"#1A1A2E"},{x:7,y:4,w:2,h:2,c:"#1A1A2E"},{x:3,y:4,w:1,h:1,c:"#FFF",a:.35},{x:7,y:4,w:1,h:1,c:"#FFF",a:.35},{x:5,y:7,w:2,h:1,c:"darken($skin, 25)",a:.4},{x:0,y:4,w:1,h:1,c:"$skin"},{x:11,y:4,w:1,h:1,c:"$skin"}],qj=[{x:1,y:0,w:10,h:3,c:"$hair"},{x:0,y:1,w:2,h:3,c:"$hair"},{x:10,y:1,w:2,h:3,c:"$hair"},{x:2,y:0,w:8,h:1,c:"lighten($hair, 25)",a:.3},{x:2,y:2,w:8,h:1,c:"darken($hair, 20)",a:.2}];function Xj(){return{width:12,height:22,layers:[{name:"lower",pixels:Uj},{name:"torso",pixels:Ij},{name:"head",pixels:Yj},{name:"hair",pixels:qj},{name:"accessory",pixels:[]}]}}const Vj=["cto","cbo","pm","engineer","designer","qa","data-analyst","default"];for(const t of Vj)eg(`mini:${t}`,Xj());const Gj=[{x:1,y:10,w:10,h:8,c:"$shirt"},{x:2,y:10,w:8,h:1,c:"lighten($shirt, 18)",a:.3},{x:1,y:10,w:1,h:7,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:7,c:"darken($shirt, 25)",a:.25},{x:4,y:10,w:4,h:2,c:"darken($shirt, 25)",a:.2},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"}],Kj=[{x:4,y:8,w:4,h:3,c:"$skin"},{x:1,y:1,w:10,h:8,c:"$skin"},{x:3,y:4,w:2,h:2,c:"#1A1A2E"},{x:7,y:4,w:2,h:2,c:"#1A1A2E"},{x:3,y:4,w:1,h:1,c:"#FFF",a:.35},{x:7,y:4,w:1,h:1,c:"#FFF",a:.35},{x:5,y:7,w:2,h:1,c:"darken($skin, 25)",a:.4},{x:0,y:4,w:1,h:1,c:"$skin"},{x:11,y:4,w:1,h:1,c:"$skin"}],Qj=[{x:1,y:0,w:10,h:3,c:"$hair"},{x:0,y:1,w:2,h:3,c:"$hair"},{x:10,y:1,w:2,h:3,c:"$hair"},{x:2,y:0,w:8,h:1,c:"lighten($hair, 25)",a:.3},{x:2,y:2,w:8,h:1,c:"darken($hair, 20)",a:.2}];function Wj(){return{width:12,height:22,layers:[{name:"torso",pixels:Gj},{name:"head",pixels:Kj},{name:"hair",pixels:Qj},{name:"accessory",pixels:[]}]}}eg("mini-seated:default",Wj());const Zj={canvasWidth:160,canvasHeight:80,scale:2,pixels:[{x:0,y:0,w:80,h:40,c:"#1e2030"},{x:10,y:2,w:10,h:6,c:"#78889c"},{x:10,y:2,w:10,h:1,c:"#8899ad"},{x:24,y:0,w:10,h:6,c:"#78889c"},{x:24,y:0,w:10,h:1,c:"#8899ad"},{x:38,y:2,w:10,h:6,c:"#78889c"},{x:38,y:2,w:10,h:1,c:"#8899ad"},{x:54,y:2,w:10,h:6,c:"#78889c"},{x:54,y:2,w:10,h:1,c:"#8899ad"},{x:11,y:7,w:2,h:2,c:"#2a2a2a"},{x:17,y:7,w:2,h:2,c:"#2a2a2a"},{x:25,y:5,w:2,h:2,c:"#2a2a2a"},{x:31,y:5,w:2,h:2,c:"#2a2a2a"},{x:39,y:7,w:2,h:2,c:"#2a2a2a"},{x:45,y:7,w:2,h:2,c:"#2a2a2a"},{x:55,y:7,w:2,h:2,c:"#2a2a2a"},{x:61,y:7,w:2,h:2,c:"#2a2a2a"},{x:8,y:8,w:64,h:24,c:"#6b5b4b"},{x:4,y:10,w:72,h:20,c:"#7d6d5d"},{x:2,y:12,w:76,h:16,c:"#7d6d5d"},{x:2,y:12,w:76,h:2,c:"#8b7b6b"},{x:2,y:26,w:76,h:2,c:"#4b3b2b"},{x:2,y:28,w:76,h:3,c:"#4b3b2b"},{x:4,y:28,w:72,h:1,c:"#5b4b3b"},{x:6,y:30,w:3,h:2,c:"#3a2a1a"},{x:71,y:30,w:3,h:2,c:"#3a2a1a"},{x:18,y:14,w:44,h:12,c:"#6b5b4b",a:.5},{x:28,y:14,w:14,h:8,c:"#1a1a2e"},{x:29,y:15,w:12,h:6,c:"#1565C0",a:.5},{x:30,y:16,w:8,h:1,c:"#60A5FA",a:.45},{x:30,y:18,w:5,h:1,c:"#60A5FA",a:.3},{x:58,y:16,w:5,h:5,c:"#795548"},{x:59,y:17,w:3,h:3,c:"#A67C52"},{x:63,y:18,w:2,h:2,c:"#795548"},{x:10,y:16,w:10,h:8,c:"#FFEE58",a:.7},{x:11,y:17,w:8,h:1,c:"#9E9E9E",a:.5},{x:11,y:19,w:8,h:1,c:"#9E9E9E",a:.5},{x:11,y:21,w:6,h:1,c:"#9E9E9E",a:.5},{x:10,y:32,w:10,h:6,c:"#78889c"},{x:10,y:32,w:10,h:1,c:"#8899ad"},{x:24,y:34,w:10,h:6,c:"#78889c"},{x:24,y:34,w:10,h:1,c:"#8899ad"},{x:38,y:32,w:10,h:6,c:"#78889c"},{x:38,y:32,w:10,h:1,c:"#8899ad"},{x:54,y:32,w:10,h:6,c:"#78889c"},{x:54,y:32,w:10,h:1,c:"#8899ad"},{x:11,y:37,w:2,h:2,c:"#2a2a2a"},{x:17,y:37,w:2,h:2,c:"#2a2a2a"},{x:25,y:39,w:2,h:2,c:"#2a2a2a"},{x:31,y:39,w:2,h:2,c:"#2a2a2a"},{x:39,y:37,w:2,h:2,c:"#2a2a2a"},{x:45,y:37,w:2,h:2,c:"#2a2a2a"},{x:55,y:37,w:2,h:2,c:"#2a2a2a"},{x:61,y:37,w:2,h:2,c:"#2a2a2a"}]},Jj={canvasWidth:128,canvasHeight:96,scale:2,pixels:[{x:0,y:0,w:64,h:48,c:"#4b3b2b"},{x:3,y:3,w:58,h:42,c:"#8B7355"},{x:4,y:4,w:10,h:10,c:"#A0845C",a:.5},{x:20,y:8,w:8,h:8,c:"#A0845C",a:.4},{x:40,y:6,w:12,h:6,c:"#A0845C",a:.3},{x:8,y:30,w:14,h:10,c:"#A0845C",a:.25},{x:44,y:32,w:10,h:8,c:"#A0845C",a:.3},{x:6,y:8,w:18,h:12,c:"#FFEE58"},{x:5,y:7,w:3,h:3,c:"#EF5350"},{x:6,y:7,w:2,h:2,c:"#C62828"},{x:8,y:10,w:14,h:1,c:"#9E9E9E"},{x:8,y:12,w:12,h:1,c:"#9E9E9E"},{x:8,y:14,w:10,h:1,c:"#9E9E9E"},{x:28,y:6,w:16,h:14,c:"#B3E5FC"},{x:35,y:5,w:3,h:3,c:"#42A5F5"},{x:36,y:5,w:2,h:2,c:"#1565C0"},{x:30,y:9,w:12,h:1,c:"#9E9E9E"},{x:30,y:11,w:10,h:1,c:"#9E9E9E"},{x:30,y:13,w:11,h:1,c:"#9E9E9E"},{x:8,y:24,w:16,h:14,c:"#C8E6C9"},{x:15,y:23,w:3,h:3,c:"#66BB6A"},{x:16,y:23,w:2,h:2,c:"#388E3C"},{x:10,y:27,w:12,h:1,c:"#9E9E9E"},{x:10,y:29,w:8,h:1,c:"#9E9E9E"},{x:10,y:31,w:10,h:1,c:"#9E9E9E"},{x:28,y:24,w:28,h:16,c:"#FFCDD2"},{x:43,y:23,w:3,h:3,c:"#EF5350"},{x:44,y:23,w:2,h:2,c:"#B71C1C"},{x:32,y:27,w:24,h:1,c:"#9E9E9E"},{x:32,y:29,w:20,h:1,c:"#9E9E9E"},{x:32,y:31,w:22,h:1,c:"#9E9E9E"},{x:32,y:33,w:15,h:1,c:"#9E9E9E"},{x:0,y:0,w:64,h:3,c:"#5a4a3a"},{x:0,y:45,w:64,h:3,c:"#3a2a1a"}]},Pj={canvasWidth:128,canvasHeight:96,scale:2,pixels:[{x:2,y:0,w:60,h:48,c:"#3b1f0a"},{x:4,y:2,w:56,h:44,c:"#5a3310"},{x:4,y:13,w:56,h:2,c:"#2d1508"},{x:4,y:27,w:56,h:2,c:"#2d1508"},{x:4,y:41,w:56,h:2,c:"#2d1508"},{x:5,y:3,w:4,h:10,c:"#2563EB"},{x:5,y:3,w:4,h:2,c:"#1D4ED8"},{x:10,y:4,w:3,h:9,c:"#DC2626"},{x:10,y:4,w:3,h:2,c:"#B91C1C"},{x:14,y:3,w:5,h:10,c:"#16A34A"},{x:14,y:3,w:5,h:2,c:"#15803D"},{x:20,y:4,w:3,h:9,c:"#9333EA"},{x:20,y:4,w:3,h:2,c:"#7E22CE"},{x:24,y:3,w:4,h:10,c:"#D97706"},{x:24,y:3,w:4,h:2,c:"#B45309"},{x:29,y:4,w:3,h:9,c:"#0891B2"},{x:29,y:4,w:3,h:2,c:"#0E7490"},{x:33,y:3,w:5,h:10,c:"#BE123C"},{x:33,y:3,w:5,h:2,c:"#9F1239"},{x:39,y:4,w:4,h:9,c:"#4F46E5"},{x:39,y:4,w:4,h:2,c:"#3730A3"},{x:44,y:3,w:3,h:10,c:"#065F46"},{x:44,y:3,w:3,h:2,c:"#064E3B"},{x:48,y:4,w:4,h:9,c:"#92400E"},{x:48,y:4,w:4,h:2,c:"#78350F"},{x:53,y:3,w:5,h:10,c:"#1E3A5F"},{x:53,y:3,w:5,h:2,c:"#1e3060"},{x:6,y:6,w:2,h:1,c:"#BFDBFE",a:.7},{x:11,y:7,w:1,h:1,c:"#FCA5A5",a:.7},{x:16,y:6,w:3,h:1,c:"#BBF7D0",a:.7},{x:21,y:7,w:1,h:1,c:"#D8B4FE",a:.7},{x:25,y:6,w:2,h:1,c:"#FDE68A",a:.7},{x:5,y:16,w:5,h:11,c:"#0F766E"},{x:5,y:16,w:5,h:2,c:"#0D6056"},{x:11,y:17,w:3,h:10,c:"#C2410C"},{x:11,y:17,w:3,h:2,c:"#9A3412"},{x:15,y:16,w:4,h:11,c:"#7C3AED"},{x:15,y:16,w:4,h:2,c:"#6D28D9"},{x:20,y:17,w:3,h:10,c:"#1D4ED8"},{x:20,y:17,w:3,h:2,c:"#1E40AF"},{x:24,y:16,w:5,h:11,c:"#166534"},{x:24,y:16,w:5,h:2,c:"#14532D"},{x:30,y:17,w:4,h:10,c:"#991B1B"},{x:30,y:17,w:4,h:2,c:"#7F1D1D"},{x:35,y:16,w:3,h:11,c:"#854D0E"},{x:35,y:16,w:3,h:2,c:"#713F12"},{x:39,y:17,w:4,h:10,c:"#1E40AF"},{x:39,y:17,w:4,h:2,c:"#1E3A8A"},{x:44,y:16,w:5,h:11,c:"#065F46"},{x:44,y:16,w:5,h:2,c:"#064E3B"},{x:50,y:17,w:3,h:10,c:"#831843"},{x:50,y:17,w:3,h:2,c:"#6B21A8"},{x:54,y:16,w:5,h:11,c:"#374151"},{x:54,y:16,w:5,h:2,c:"#1F2937"},{x:5,y:30,w:4,h:11,c:"#0E7490"},{x:5,y:30,w:4,h:2,c:"#0C6B7E"},{x:10,y:31,w:3,h:10,c:"#B45309"},{x:10,y:31,w:3,h:2,c:"#92400E"},{x:14,y:30,w:5,h:11,c:"#6D28D9"},{x:14,y:30,w:5,h:2,c:"#5B21B6"},{x:20,y:30,w:7,h:8,c:"#1e293b"},{x:22,y:32,w:3,h:3,c:"#3b82f6",a:.9},{x:22,y:32,w:1,h:3,c:"#60a5fa",a:.6},{x:28,y:31,w:4,h:10,c:"#DC2626"},{x:28,y:31,w:4,h:2,c:"#B91C1C"},{x:33,y:30,w:3,h:11,c:"#065F46"},{x:33,y:30,w:3,h:2,c:"#064E3B"},{x:37,y:31,w:4,h:10,c:"#1D4ED8"},{x:37,y:31,w:4,h:2,c:"#1E40AF"},{x:42,y:35,w:6,h:6,c:"#92400E"},{x:43,y:30,w:4,h:6,c:"#16a34a",a:.8},{x:43,y:29,w:2,h:3,c:"#15803d",a:.7},{x:45,y:28,w:2,h:4,c:"#16a34a",a:.6},{x:49,y:30,w:3,h:11,c:"#7C3AED"},{x:49,y:30,w:3,h:2,c:"#6D28D9"},{x:53,y:31,w:5,h:10,c:"#B45309"},{x:53,y:31,w:5,h:2,c:"#92400E"},{x:2,y:46,w:60,h:2,c:"#1a0a03"},{x:2,y:0,w:60,h:2,c:"#4a2510"},{x:2,y:0,w:2,h:48,c:"#2d1508"},{x:60,y:0,w:2,h:48,c:"#2d1508"}]},eS={canvasWidth:96,canvasHeight:120,scale:2,pixels:[{x:2,y:0,w:44,h:60,c:"#546E7A"},{x:2,y:0,w:44,h:3,c:"#78909C"},{x:2,y:57,w:44,h:3,c:"#37474F"},{x:2,y:0,w:2,h:60,c:"#455A64"},{x:44,y:0,w:2,h:60,c:"#37474F"},{x:5,y:4,w:38,h:3,c:"#FFD54F",a:.5},{x:6,y:1,w:2,h:4,c:"#FFFDE7"},{x:10,y:0,w:2,h:5,c:"#FFF9C4"},{x:14,y:1,w:2,h:3,c:"#FFFDE7"},{x:18,y:0,w:2,h:4,c:"#FFF8E1"},{x:5,y:5,w:38,h:16,c:"#607D8B"},{x:5,y:5,w:38,h:2,c:"#78909C"},{x:15,y:12,w:18,h:4,c:"#37474F"},{x:22,y:11,w:4,h:6,c:"#455A64"},{x:23,y:13,w:2,h:2,c:"#B0BEC5"},{x:7,y:14,w:8,h:5,c:"#B0BEC5"},{x:8,y:15,w:6,h:1,c:"#607D8B"},{x:8,y:17,w:5,h:1,c:"#607D8B"},{x:5,y:23,w:38,h:16,c:"#607D8B"},{x:5,y:23,w:38,h:2,c:"#78909C"},{x:15,y:30,w:18,h:4,c:"#37474F"},{x:22,y:29,w:4,h:6,c:"#455A64"},{x:23,y:31,w:2,h:2,c:"#B0BEC5"},{x:7,y:32,w:8,h:5,c:"#B0BEC5"},{x:8,y:33,w:6,h:1,c:"#607D8B"},{x:8,y:35,w:4,h:1,c:"#607D8B"},{x:5,y:41,w:38,h:16,c:"#607D8B"},{x:5,y:41,w:38,h:2,c:"#78909C"},{x:15,y:48,w:18,h:4,c:"#37474F"},{x:22,y:47,w:4,h:6,c:"#455A64"},{x:23,y:49,w:2,h:2,c:"#B0BEC5"},{x:7,y:50,w:8,h:5,c:"#B0BEC5"},{x:8,y:51,w:6,h:1,c:"#607D8B"},{x:8,y:53,w:3,h:1,c:"#607D8B"}]};$c("meeting",Zj);$c("bulletin",Jj);$c("decision",eS);$c("knowledge",Pj);const xf=16,pf=24,tS=60,nS={cbo:0,cto:8,pm:15,engineer:22,designer:5,qa:12};function sg(t,l){if(!t)return t;let r=t;if(l!=null&&l.hairStyle){const i=Mj(l.hairStyle);i&&(r=Aj(r,i.layer))}if(l!=null&&l.outfitStyle){const i=Fj(l.outfitStyle);i&&(r=Gf(r,"torso",i.layer,1))}if(l!=null&&l.accessory&&l.accessory!=="none"){const i=Rj(l.accessory);i&&(r=Gf(r,"accessory",i.layer))}return r}function _s({roleId:t,className:l,appearance:r,scale:i}){const c=k.useRef(null),u=k.useRef(0),d=k.useRef(0),m=k.useRef(r);m.current=r;const x=i??4,f=xf*x,g=pf*x,y=k.useMemo(()=>{const b=Kf(`mini:${t}`)??Kf("mini:default");return sg(b,r)},[t,r==null?void 0:r.hairStyle,r==null?void 0:r.outfitStyle,r==null?void 0:r.accessory]);return k.useEffect(()=>{const b=c.current;if(!b)return;const v=b.getContext("2d");if(!v)return;const S=nS[t]??0,j=()=>{d.current++;const E=m.current;if(!E||!y){u.current=requestAnimationFrame(j);return}const A=(d.current+S)%tS<30?1:0;v.clearRect(0,0,xf,pf),v.save(),v.translate(2,1),Dj(v,y,A,E,1),v.restore(),u.current=requestAnimationFrame(j)};return u.current=requestAnimationFrame(j),()=>cancelAnimationFrame(u.current)},[t,y]),s.jsx("canvas",{ref:c,width:xf,height:pf,className:l,style:{imageRendering:"pixelated",display:"block",width:f,height:g}})}const lS="https://api.tycono.ai",jh=lS;async function ac(t){const l=await fetch(`${jh}${t}`);if(!l.ok)throw new Error(`Cloud API error: ${l.status}`);return l.json()}async function ic(t,l){const r=await fetch(`${jh}${t}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!r.ok)throw new Error(`Cloud API error: ${r.status}`);return r.json()}const mi={health:()=>ac("/api/health"),getCharacters:()=>ac("/api/store/characters"),getCharacter:t=>ac(`/api/store/characters/${t}`),getCharacterVersion:t=>ac(`/api/store/characters/${t}/version`),syncCheck:t=>ic("/api/sync/check",{roles:t}),syncPull:t=>ic("/api/sync/pull",{sourceId:t}),publishCharacter:t=>ic("/api/store/publish",t),deleteCharacter:t=>fetch(`${jh}/api/store/characters/${t}`,{method:"DELETE"}).then(l=>l.json()),uploadTelemetry:t=>ic("/api/telemetry",t)},rS={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"},yf={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"},aS={cto:"Chief Technology Officer",cbo:"Chief Business Officer",pm:"Product Manager",engineer:"Software Engineer",designer:"UI/UX Designer",qa:"QA Engineer"},iS=500,c0=360,u0=700,sS=t=>`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`;function oS({role:t,allRoles:l,recentActivity:r,onClose:i,onFireRole:c,terminalWidth:u=0,activeJobId:d,activeTask:m,isWorking:x,jobStartedAt:f,onStopJob:g,sessions:y,streamingSessionId:b,onCreateSessionSilent:v,onSendMessage:S,onFocusTerminal:j,onCustomize:E,onUpdateRole:C,appearance:A,relationships:F,roleLevel:_}){var Te,Ye;const[H,M]=k.useState(iS),[I,W]=k.useState(!1),te=k.useRef(0),D=k.useRef(0),[Y,B]=k.useState(!1),[V,ne]=k.useState(!1),[G,L]=k.useState(!1),[Z,de]=k.useState(!1),[ue,z]=k.useState("talk"),[R,K]=k.useState(!1),[T,fe]=k.useState(""),[Ee,Ne]=k.useState(!1),Le=k.useRef(null),{events:Be,status:Qe}=V0(d??null),[Se,tt]=k.useState(0);k.useEffect(()=>{if(!x||!f){tt(0);return}const xe=new Date(f).getTime(),q=()=>tt(Math.floor((Date.now()-xe)/1e3));q();const ze=setInterval(q,1e3);return()=>clearInterval(ze)},[x,f]);const me=u>0,he=me?u:0,ge=me?Math.max(c0,window.innerWidth-u-100):u0,ke=Math.min(H,ge),Fe=k.useCallback(xe=>{xe.preventDefault(),te.current=xe.clientX,D.current=ke,W(!0);const q=He=>{const Xe=te.current-He.clientX,ht=Math.min(u0,Math.max(c0,D.current+Xe));M(ht)},ze=()=>{W(!1),document.removeEventListener("mousemove",q),document.removeEventListener("mouseup",ze)};document.addEventListener("mousemove",q),document.addEventListener("mouseup",ze)},[ke]),Ae=k.useRef(null),De=t?y.find(xe=>xe.roleId===t.id):null,je=xe=>{if(!t)return;const q=x?"talk":ue;De?(S(De.id,xe,q),j(t.id)):(Ae.current={content:xe,mode:q},v(t.id))};k.useEffect(()=>{if(De&&Ae.current){const{content:xe,mode:q}=Ae.current;Ae.current=null,S(De.id,xe,q),t&&j(t.id)}},[De==null?void 0:De.id]);const _e=(()=>{if(!Be.length)return null;const xe=[];let q=0,ze=0,He=0;for(const Xe of Be)if(Xe.type==="thinking")q++;else if(Xe.type==="text")ze++;else if(Xe.type==="tool:start"){const ht=String(Xe.data.name??"");xe.includes(ht)||xe.push(ht)}else Xe.type==="dispatch:start"&&He++;return{tools:xe,thinkCount:q,textCount:ze,dispatchCount:He,total:Be.length}})(),Ke=m||(()=>{if(!De)return null;const xe=De.messages;for(let q=xe.length-1;q>=0;q--)if(xe[q].from==="ceo")return xe[q].content;return null})(),Et=(()=>{if(!De)return null;const xe=De.messages;for(let q=xe.length-1;q>=0;q--)if(xe[q].from==="role"&&xe[q].content)return xe[q].content;return null})();if(!t)return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:he},onClick:i}),s.jsx("div",{className:"side-panel open fixed top-0 h-full z-50 flex items-center justify-center border-l-[3px]",style:{right:he,width:ke,background:"var(--terminal-bg)",borderLeftColor:"var(--pixel-border)"},children:s.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-muted)"},children:"Loading role..."})})]});const Ht=yf[t.id]??"#666",gt=rS[t.id]??"👤",Rt=l.filter(xe=>xe.reportsTo===t.id),re=De&&b===De.id,pe=t.name||aS[t.id]||t.id;return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:he},onClick:i}),s.jsxs("div",{className:`side-panel open fixed top-0 h-full z-50 flex flex-col border-l-[3px] shadow-[-4px_0_20px_rgba(0,0,0,0.4)] ${I?"resizing":""}`,style:{borderLeftColor:Ht,right:he,width:ke,background:"var(--terminal-bg)"},children:[s.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${I?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:Fe}),s.jsxs("div",{className:"relative shrink-0 overflow-hidden",style:{background:`linear-gradient(135deg, ${Ht}ee, ${Ht}99)`},children:[s.jsx("div",{className:"absolute inset-0 opacity-[0.06]",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 8px, white 8px, white 9px)"}}),s.jsxs("div",{className:"absolute top-3 right-3 flex items-center gap-1.5 z-10",children:[E&&s.jsx("button",{onClick:()=>E(t.id),className:"w-7 h-7 rounded-full bg-black/20 text-white flex items-center justify-center text-sm hover:bg-black/30 cursor-pointer backdrop-blur-sm",title:"Customize",children:"🎨"}),s.jsx("button",{onClick:i,className:"w-7 h-7 rounded-full bg-black/20 text-white flex items-center justify-center text-lg hover:bg-black/30 cursor-pointer backdrop-blur-sm",children:"×"})]}),s.jsxs("div",{className:"relative flex items-end gap-4 px-4 pt-4 pb-3",children:[s.jsx("div",{className:"shrink-0 relative",style:{marginBottom:-2},children:s.jsx("div",{className:"rounded-lg p-1",style:{background:"rgba(0,0,0,0.2)"},children:s.jsx(_s,{roleId:t.id,appearance:A,scale:8})})}),s.jsxs("div",{className:"flex-1 min-w-0 text-white pb-1",children:[s.jsxs("div",{className:"text-lg font-bold flex items-center gap-2",style:{fontFamily:"var(--pixel-font)"},children:[gt," ",t.id.toUpperCase(),x&&s.jsx("span",{className:"text-[9px] font-semibold px-2 py-0.5 rounded-full animate-pulse",style:{background:"rgba(251,191,36,0.25)",color:"#fde68a"},children:"WORKING"})]}),R?s.jsxs("form",{className:"flex items-center gap-1.5 mt-0.5",onSubmit:async xe=>{xe.preventDefault();const q=T.trim();if(!q||q===pe||!C){K(!1);return}Ne(!0);try{await C(t.id,{name:q})}catch{}Ne(!1),K(!1)},children:[s.jsx("input",{ref:Le,value:T,onChange:xe=>fe(xe.target.value),onKeyDown:xe=>{xe.key==="Escape"&&K(!1)},disabled:Ee,autoFocus:!0,className:"bg-white/20 text-white text-xs rounded px-1.5 py-0.5 outline-none focus:bg-white/30 w-full",style:{fontFamily:"inherit"}}),s.jsx("button",{type:"submit",disabled:Ee,className:"text-white/80 hover:text-white text-[10px] cursor-pointer shrink-0",children:"✓"}),s.jsx("button",{type:"button",onClick:()=>K(!1),className:"text-white/60 hover:text-white text-[10px] cursor-pointer shrink-0",children:"✕"})]}):s.jsxs("div",{className:"text-xs opacity-75 mt-0.5 group/name flex items-center gap-1 cursor-pointer hover:opacity-100 transition-opacity",onClick:()=>{C&&(fe(pe),K(!0))},title:C?"Click to edit name":void 0,children:[pe,C&&s.jsx("span",{className:"opacity-0 group-hover/name:opacity-60 text-[10px]",children:"✎"})]})]})]}),s.jsxs("div",{className:"relative flex items-center gap-3 px-4 py-2 text-[10px] font-bold text-white/80",style:{background:"rgba(0,0,0,0.2)",fontFamily:"var(--pixel-font)"},children:[s.jsxs("span",{children:["Lv.",_??1]}),s.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:x?"var(--idle-amber)":"var(--active-green)"}}),x?"Working":"Idle"]}),s.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),s.jsx("span",{children:t.level}),t.reportsTo&&s.jsxs(s.Fragment,{children:[s.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),s.jsxs("span",{className:"opacity-60",children:["→"," ",t.reportsTo]})]})]})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto flex flex-col min-h-0",children:[x&&s.jsxs("div",{className:"px-4 py-3 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)",background:"var(--hud-bg-alt)"},children:[s.jsxs("div",{className:"flex items-center justify-between mb-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-2 h-2 rounded-full animate-pulse",style:{background:"var(--idle-amber)"}}),s.jsxs("span",{className:"text-xs font-semibold",style:{color:"var(--idle-amber)"},children:["Working",Se>0?` · ${sS(Se)}`:""]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:()=>j(t.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"Open chat ↗"}),d&&g&&s.jsx("button",{onClick:()=>g(d),className:"text-[10px] px-2 py-0.5 rounded cursor-pointer font-semibold transition-colors",style:{background:"rgba(239,68,68,0.15)",color:"#ef4444"},children:"Stop"})]})]}),Ke&&s.jsx("div",{className:"text-xs truncate",style:{color:"var(--terminal-text-secondary)"},children:Ke})]}),x&&d&&_e&&s.jsxs("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[s.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[s.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)"},children:"Activity"}),s.jsx("button",{onClick:()=>j(t.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"View details ↗"})]}),s.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[_e.thinkCount>0&&s.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(168,85,247,0.15)",color:"#c084fc"},children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full",style:{background:"#a855f7"}}),"thinking ×",_e.thinkCount]}),_e.tools.map(xe=>s.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(59,130,246,0.15)",color:"#60a5fa"},children:xe},xe)),_e.dispatchCount>0&&s.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(249,115,22,0.15)",color:"#fb923c"},children:["dispatch ×",_e.dispatchCount]}),_e.textCount>0&&s.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(34,197,94,0.15)",color:"#4ade80"},children:["output ×",_e.textCount]}),(Qe==="streaming"||Qe==="connecting")&&s.jsx("span",{className:"inline-block w-1.5 h-3 animate-pulse rounded-sm",style:{background:"var(--active-green)"}})]}),s.jsxs("div",{className:"text-[10px] mt-1",style:{color:"var(--terminal-text-muted)"},children:[_e.total," events"]})]}),x&&Et&&s.jsxs("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[s.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[s.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)"},children:"Last Message"}),s.jsx("button",{onClick:()=>j(t.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"Open chat ↗"})]}),s.jsxs("div",{className:"rounded-lg p-2.5 text-xs leading-relaxed line-clamp-3 overflow-hidden",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:[Et.slice(0,200),Et.length>200&&"..."]})]}),x&&s.jsx("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:s.jsx(d0,{onSend:je,disabled:!!re,placeholder:"Ask something...",color:Ht})}),!x&&s.jsxs("div",{className:"px-4 pt-4 pb-2",children:[s.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-secondary)"},children:"Latest"}),s.jsx(uS,{icon:gt,roleId:t.id,roleName:pe,color:Ht,text:r})]}),!x&&s.jsx("div",{className:"px-4 py-3",style:{borderBottom:"1px solid var(--terminal-border)"},children:s.jsxs("div",{className:"rounded-xl overflow-hidden",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[Et&&s.jsxs("div",{className:"px-3 pt-2.5 pb-2 cursor-pointer transition-colors",style:{borderBottom:"1px solid var(--terminal-border)"},onClick:()=>j(t.id),children:[s.jsxs("div",{className:"flex items-center justify-between mb-1",children:[s.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--terminal-text-muted)"},children:"Last response"}),s.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:"View ↗"})]}),s.jsxs("div",{className:"text-xs leading-relaxed line-clamp-2 overflow-hidden",style:{color:"var(--terminal-text-secondary)"},children:[Et.slice(0,150),Et.length>150&&"..."]})]}),s.jsx("div",{className:"p-2",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"flex rounded-lg overflow-hidden shrink-0",style:{border:"1px solid var(--pixel-border)"},children:[s.jsx("button",{onClick:()=>z("talk"),className:"px-2 py-1 text-[10px] font-semibold cursor-pointer transition-colors",style:{background:ue==="talk"?"var(--accent)":"transparent",color:ue==="talk"?"#fff":"var(--terminal-text-secondary)"},children:"Talk"}),s.jsx("button",{onClick:()=>z("do"),className:"px-2 py-1 text-[10px] font-semibold cursor-pointer transition-colors",style:{background:ue==="do"?"var(--idle-amber)":"transparent",color:ue==="do"?"#fff":"var(--terminal-text-secondary)"},children:"Do"})]}),s.jsx(d0,{onSend:je,disabled:!!re,placeholder:ue==="talk"?"Ask something...":"Give a directive...",color:Ht})]})})]})}),s.jsxs("div",{className:"px-4 py-2 space-y-1",children:[s.jsxs(sc,{title:`Profile${t.persona?"":" (empty)"}`,open:Y,onToggle:()=>B(xe=>!xe),children:[t.persona&&s.jsx("div",{className:"text-xs leading-relaxed rounded-lg p-3",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:t.persona}),s.jsxs("div",{className:"space-y-0 mt-2",children:[s.jsx(gf,{label:"Level",value:t.level}),s.jsx(gf,{label:"Reports to",value:t.reportsTo}),s.jsx(gf,{label:"Status",value:t.status})]}),Rt.length>0&&s.jsxs("div",{className:"mt-3",children:[s.jsx("div",{className:"text-[11px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"Direct Reports"}),s.jsx("div",{className:"space-y-1",children:Rt.map(xe=>s.jsxs("div",{className:"flex items-center gap-2 p-1.5 rounded-lg",style:{background:"var(--hud-bg-alt)"},children:[s.jsx("div",{className:"w-6 h-6 rounded flex items-center justify-center text-white text-[10px] font-bold",style:{background:yf[xe.id]??"#666"},children:xe.id.slice(0,2).toUpperCase()}),s.jsx("div",{className:"text-xs",style:{color:"var(--terminal-text)"},children:xe.name})]},xe.id))})]})]}),t.authority&&s.jsxs(sc,{title:"Authority",open:V,onToggle:()=>ne(xe=>!xe),children:[((Te=t.authority.autonomous)==null?void 0:Te.length)>0&&s.jsxs("div",{className:"mb-2",children:[s.jsx("div",{className:"text-xs font-semibold mb-1",style:{color:"var(--active-green)"},children:"Autonomous"}),t.authority.autonomous.map((xe,q)=>s.jsxs("div",{className:"text-xs pl-3 py-0.5",style:{color:"var(--terminal-text-secondary)"},children:["- ",xe]},q))]}),((Ye=t.authority.needsApproval)==null?void 0:Ye.length)>0&&s.jsxs("div",{children:[s.jsx("div",{className:"text-xs font-semibold mb-1",style:{color:"var(--idle-amber)"},children:"Needs Approval"}),t.authority.needsApproval.map((xe,q)=>s.jsxs("div",{className:"text-xs pl-3 py-0.5",style:{color:"var(--terminal-text-secondary)"},children:["- ",xe]},q))]})]}),t&&F&&(()=>{const xe=F.filter(q=>q.roleA===t.id||q.roleB===t.id).filter(q=>q.familiarity>0).sort((q,ze)=>ze.familiarity-q.familiarity);return xe.length===0?null:s.jsx(sc,{title:`Relationships (${xe.length})`,open:G,onToggle:()=>L(q=>!q),children:s.jsx("div",{className:"space-y-1.5",children:xe.map((q,ze)=>{const He=q.roleA===t.id?q.roleB:q.roleA,Xe=l.find(We=>We.id===He),ht=q.familiarity>=80?"Best Partner":q.familiarity>=50?"Friend":q.familiarity>=20?"Colleague":"Acquaintance",Pe=q.familiarity>=80?"#4CAF50":q.familiarity>=50?"#2196F3":q.familiarity>=20?"#FF9800":"#9E9E9E";return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-xs w-20 truncate",style:{color:yf[He]??"var(--terminal-text-secondary)"},children:(Xe==null?void 0:Xe.name)??He}),s.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-white/10",children:s.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${q.familiarity}%`,background:Pe}})}),s.jsx("span",{className:"text-[10px] w-16 text-right",style:{color:"var(--terminal-text-muted)"},children:ht})]},ze)})})})})(),t.journal&&s.jsx(sc,{title:`Journal (${(t.journal.match(/### /g)??[]).length})`,open:Z,onToggle:()=>de(xe=>!xe),children:s.jsxs("div",{className:"text-xs leading-relaxed rounded-lg p-3 max-h-[300px] overflow-y-auto",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:[s.jsx(Is,{content:t.journal.slice(0,3e3)}),t.journal.length>3e3&&s.jsx("div",{className:"italic mt-2",style:{color:"var(--terminal-text-muted)"},children:"... (truncated)"})]})})]}),s.jsx(cS,{role:t,appearance:A}),c&&s.jsx("div",{className:"px-4 pb-4 mt-auto shrink-0",children:s.jsx("button",{onClick:()=>{c(t.id,t.name),i()},className:"w-full p-2 text-center text-xs font-medium border-2 border-dashed rounded-lg cursor-pointer transition-colors",style:{borderColor:"rgba(239,68,68,0.3)",color:"rgba(239,68,68,0.5)"},children:"Fire Role"})})]})]})]})}function cS({role:t,appearance:l}){const[r,i]=k.useState("idle"),[c,u]=k.useState(""),[d,m]=k.useState(!1),x=async()=>{var f,g;if(!d){m(!0);return}i("publishing");try{let y=null;try{y=await Ce.exportSkills(t.id)}catch{}const b={roleId:t.id,persona:t.persona??"",authority:t.authority??{autonomous:[],needsApproval:[]},level:t.level,tagline:((f=(t.persona??"").split(/[.\n]/)[0])==null?void 0:f.trim().slice(0,80))||t.name,chatStyle:"Professional and focused",skills:y??[],resume:{summary:((g=t.persona)==null?void 0:g.split(`
|
|
80
|
-
`)[0])??"",strengths:[],specialties:[],experience:""},author:{id:"tycono",name:"Tycono"},tags:[t.level,t.id],price:"free",installs:0,rating:0,featured:!1,randomActive:!0,randomPersonality:""};l&&(b.appearance=l);let v="1.0.0";try{const S=await mi.getCharacterVersion(t.id);if(S!=null&&S.version){const j=S.version.split(".").map(Number);j[2]=(j[2]??0)+1,v=j.join(".")}}catch{}await mi.publishCharacter({id:t.id,name:t.name||t.id,version:v,data:b}),i("done"),u(`Published v${v}`),m(!1)}catch(y){i("error"),u(y instanceof Error?y.message:"Failed"),m(!1)}};return s.jsx("div",{className:"px-4 pb-2 shrink-0",children:s.jsx("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--terminal-border)"},children:s.jsxs("div",{className:"px-3 py-2.5 flex items-center justify-between",style:{background:"var(--hud-bg-alt)"},children:[s.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},children:"Cloud Store"}),r==="done"?s.jsx("span",{className:"text-[10px] font-semibold",style:{color:"var(--active-green)"},children:c}):r==="error"?s.jsx("span",{className:"text-[10px] font-semibold",style:{color:"#ef4444"},children:c}):s.jsx("button",{onClick:x,disabled:r==="publishing",className:"text-[10px] px-2.5 py-1 rounded font-semibold cursor-pointer transition-colors disabled:opacity-50",style:{background:d?"rgba(59,130,246,0.3)":"rgba(59,130,246,0.15)",color:"#60a5fa",border:d?"1px solid rgba(59,130,246,0.5)":"1px solid transparent"},children:r==="publishing"?"Publishing...":d?"Confirm Publish?":"Publish to Store"})]})})})}function uS({icon:t,roleId:l,roleName:r,color:i,text:c}){const u=!!c;return s.jsx("div",{className:"relative",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsxs("div",{className:"shrink-0",children:[s.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center text-xl shadow-sm",style:{background:`${i}18`,border:`2px solid ${i}44`},children:t}),s.jsx("div",{className:"text-[9px] font-bold text-center mt-0.5 uppercase tracking-wide",style:{color:i},children:l})]}),s.jsx("div",{className:"flex-1 min-w-0",children:s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"absolute top-3 -left-2 w-0 h-0",style:{borderTop:"6px solid transparent",borderBottom:"6px solid transparent",borderRight:`8px solid ${i}12`}}),s.jsxs("div",{className:"rounded-xl rounded-tl-sm p-4 border",style:{background:`${i}08`,borderColor:`${i}22`},children:[s.jsx("div",{className:"text-[10px] font-semibold mb-1.5 uppercase tracking-wider",style:{color:i},children:r}),u?s.jsx("div",{className:"text-sm leading-relaxed",style:{color:"var(--terminal-text)"},children:s.jsx(Is,{content:c})}):s.jsx("div",{className:"text-sm italic",style:{color:"var(--terminal-text-muted)"},children:"No recent activity."})]})]})})]})})}function sc({title:t,open:l,onToggle:r,children:i}){return s.jsxs("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--terminal-border)"},children:[s.jsxs("button",{onClick:r,className:"w-full px-3 py-2.5 flex items-center justify-between cursor-pointer transition-colors group",style:{background:"var(--hud-bg-alt)"},children:[s.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},children:t}),s.jsx("span",{className:"text-[10px] transition-transform",style:{color:"var(--terminal-text-muted)",transform:l?"rotate(0deg)":"rotate(-90deg)"},children:"▼"})]}),l&&s.jsx("div",{className:"px-3 pb-3 pt-2",style:{borderTop:"1px solid var(--terminal-border)"},children:i})]})}function d0({onSend:t,disabled:l,placeholder:r,color:i}){const[c,u]=k.useState(""),d=()=>{const m=c.trim();!m||l||(t(m),u(""))};return s.jsxs("div",{className:"flex items-center gap-1.5 flex-1",children:[s.jsx("input",{type:"text",value:c,onChange:m=>u(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),d())},placeholder:l?"Waiting...":r,disabled:l,className:"flex-1 rounded-lg px-2.5 py-1.5 text-xs focus:outline-none disabled:opacity-40",style:{background:"var(--hud-bg)",border:"1px solid var(--pixel-border)",color:"var(--terminal-text)"}}),s.jsx("button",{onClick:d,disabled:l||!c.trim(),className:"w-7 h-7 rounded-lg flex items-center justify-center shrink-0 cursor-pointer text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors",style:{background:l||!c.trim()?"#666":i},children:s.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M22 2L11 13"}),s.jsx("path",{d:"M22 2L15 22L11 13L2 9L22 2Z"})]})})]})}function gf({label:t,value:l}){return s.jsxs("div",{className:"flex justify-between py-1.5 text-xs",style:{borderBottom:"1px solid var(--terminal-border)"},children:[s.jsx("span",{style:{color:"var(--terminal-text-muted)"},children:t}),s.jsx("span",{className:"font-semibold",style:{color:"var(--terminal-text)"},children:l})]})}function dS(t,l){var r,i=1;t==null&&(t=0),l==null&&(l=0);function c(){var u,d=r.length,m,x=0,f=0;for(u=0;u<d;++u)m=r[u],x+=m.x,f+=m.y;for(x=(x/d-t)*i,f=(f/d-l)*i,u=0;u<d;++u)m=r[u],m.x-=x,m.y-=f}return c.initialize=function(u){r=u},c.x=function(u){return arguments.length?(t=+u,c):t},c.y=function(u){return arguments.length?(l=+u,c):l},c.strength=function(u){return arguments.length?(i=+u,c):i},c}function fS(t){const l=+this._x.call(null,t),r=+this._y.call(null,t);return og(this.cover(l,r),l,r,t)}function og(t,l,r,i){if(isNaN(l)||isNaN(r))return t;var c,u=t._root,d={data:i},m=t._x0,x=t._y0,f=t._x1,g=t._y1,y,b,v,S,j,E,C,A;if(!u)return t._root=d,t;for(;u.length;)if((j=l>=(y=(m+f)/2))?m=y:f=y,(E=r>=(b=(x+g)/2))?x=b:g=b,c=u,!(u=u[C=E<<1|j]))return c[C]=d,t;if(v=+t._x.call(null,u.data),S=+t._y.call(null,u.data),l===v&&r===S)return d.next=u,c?c[C]=d:t._root=d,t;do c=c?c[C]=new Array(4):t._root=new Array(4),(j=l>=(y=(m+f)/2))?m=y:f=y,(E=r>=(b=(x+g)/2))?x=b:g=b;while((C=E<<1|j)===(A=(S>=b)<<1|v>=y));return c[A]=u,c[C]=d,t}function hS(t){var l,r,i=t.length,c,u,d=new Array(i),m=new Array(i),x=1/0,f=1/0,g=-1/0,y=-1/0;for(r=0;r<i;++r)isNaN(c=+this._x.call(null,l=t[r]))||isNaN(u=+this._y.call(null,l))||(d[r]=c,m[r]=u,c<x&&(x=c),c>g&&(g=c),u<f&&(f=u),u>y&&(y=u));if(x>g||f>y)return this;for(this.cover(x,f).cover(g,y),r=0;r<i;++r)og(this,d[r],m[r],t[r]);return this}function mS(t,l){if(isNaN(t=+t)||isNaN(l=+l))return this;var r=this._x0,i=this._y0,c=this._x1,u=this._y1;if(isNaN(r))c=(r=Math.floor(t))+1,u=(i=Math.floor(l))+1;else{for(var d=c-r||1,m=this._root,x,f;r>t||t>=c||i>l||l>=u;)switch(f=(l<i)<<1|t<r,x=new Array(4),x[f]=m,m=x,d*=2,f){case 0:c=r+d,u=i+d;break;case 1:r=c-d,u=i+d;break;case 2:c=r+d,i=u-d;break;case 3:r=c-d,i=u-d;break}this._root&&this._root.length&&(this._root=m)}return this._x0=r,this._y0=i,this._x1=c,this._y1=u,this}function xS(){var t=[];return this.visit(function(l){if(!l.length)do t.push(l.data);while(l=l.next)}),t}function pS(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function Nn(t,l,r,i,c){this.node=t,this.x0=l,this.y0=r,this.x1=i,this.y1=c}function yS(t,l,r){var i,c=this._x0,u=this._y0,d,m,x,f,g=this._x1,y=this._y1,b=[],v=this._root,S,j;for(v&&b.push(new Nn(v,c,u,g,y)),r==null?r=1/0:(c=t-r,u=l-r,g=t+r,y=l+r,r*=r);S=b.pop();)if(!(!(v=S.node)||(d=S.x0)>g||(m=S.y0)>y||(x=S.x1)<c||(f=S.y1)<u))if(v.length){var E=(d+x)/2,C=(m+f)/2;b.push(new Nn(v[3],E,C,x,f),new Nn(v[2],d,C,E,f),new Nn(v[1],E,m,x,C),new Nn(v[0],d,m,E,C)),(j=(l>=C)<<1|t>=E)&&(S=b[b.length-1],b[b.length-1]=b[b.length-1-j],b[b.length-1-j]=S)}else{var A=t-+this._x.call(null,v.data),F=l-+this._y.call(null,v.data),_=A*A+F*F;if(_<r){var H=Math.sqrt(r=_);c=t-H,u=l-H,g=t+H,y=l+H,i=v.data}}return i}function gS(t){if(isNaN(g=+this._x.call(null,t))||isNaN(y=+this._y.call(null,t)))return this;var l,r=this._root,i,c,u,d=this._x0,m=this._y0,x=this._x1,f=this._y1,g,y,b,v,S,j,E,C;if(!r)return this;if(r.length)for(;;){if((S=g>=(b=(d+x)/2))?d=b:x=b,(j=y>=(v=(m+f)/2))?m=v:f=v,l=r,!(r=r[E=j<<1|S]))return this;if(!r.length)break;(l[E+1&3]||l[E+2&3]||l[E+3&3])&&(i=l,C=E)}for(;r.data!==t;)if(c=r,!(r=r.next))return this;return(u=r.next)&&delete r.next,c?(u?c.next=u:delete c.next,this):l?(u?l[E]=u:delete l[E],(r=l[0]||l[1]||l[2]||l[3])&&r===(l[3]||l[2]||l[1]||l[0])&&!r.length&&(i?i[C]=r:this._root=r),this):(this._root=u,this)}function bS(t){for(var l=0,r=t.length;l<r;++l)this.remove(t[l]);return this}function vS(){return this._root}function wS(){var t=0;return this.visit(function(l){if(!l.length)do++t;while(l=l.next)}),t}function kS(t){var l=[],r,i=this._root,c,u,d,m,x;for(i&&l.push(new Nn(i,this._x0,this._y0,this._x1,this._y1));r=l.pop();)if(!t(i=r.node,u=r.x0,d=r.y0,m=r.x1,x=r.y1)&&i.length){var f=(u+m)/2,g=(d+x)/2;(c=i[3])&&l.push(new Nn(c,f,g,m,x)),(c=i[2])&&l.push(new Nn(c,u,g,f,x)),(c=i[1])&&l.push(new Nn(c,f,d,m,g)),(c=i[0])&&l.push(new Nn(c,u,d,f,g))}return this}function jS(t){var l=[],r=[],i;for(this._root&&l.push(new Nn(this._root,this._x0,this._y0,this._x1,this._y1));i=l.pop();){var c=i.node;if(c.length){var u,d=i.x0,m=i.y0,x=i.x1,f=i.y1,g=(d+x)/2,y=(m+f)/2;(u=c[0])&&l.push(new Nn(u,d,m,g,y)),(u=c[1])&&l.push(new Nn(u,g,m,x,y)),(u=c[2])&&l.push(new Nn(u,d,y,g,f)),(u=c[3])&&l.push(new Nn(u,g,y,x,f))}r.push(i)}for(;i=r.pop();)t(i.node,i.x0,i.y0,i.x1,i.y1);return this}function SS(t){return t[0]}function CS(t){return arguments.length?(this._x=t,this):this._x}function ES(t){return t[1]}function NS(t){return arguments.length?(this._y=t,this):this._y}function Sh(t,l,r){var i=new Ch(l??SS,r??ES,NaN,NaN,NaN,NaN);return t==null?i:i.addAll(t)}function Ch(t,l,r,i,c,u){this._x=t,this._y=l,this._x0=r,this._y0=i,this._x1=c,this._y1=u,this._root=void 0}function f0(t){for(var l={data:t.data},r=l;t=t.next;)r=r.next={data:t.data};return l}var An=Sh.prototype=Ch.prototype;An.copy=function(){var t=new Ch(this._x,this._y,this._x0,this._y0,this._x1,this._y1),l=this._root,r,i;if(!l)return t;if(!l.length)return t._root=f0(l),t;for(r=[{source:l,target:t._root=new Array(4)}];l=r.pop();)for(var c=0;c<4;++c)(i=l.source[c])&&(i.length?r.push({source:i,target:l.target[c]=new Array(4)}):l.target[c]=f0(i));return t};An.add=fS;An.addAll=hS;An.cover=mS;An.data=xS;An.extent=pS;An.find=yS;An.remove=gS;An.removeAll=bS;An.root=vS;An.size=wS;An.visit=kS;An.visitAfter=jS;An.x=CS;An.y=NS;function wa(t){return function(){return t}}function Vr(t){return(t()-.5)*1e-6}function AS(t){return t.x+t.vx}function TS(t){return t.y+t.vy}function DS(t){var l,r,i,c=1,u=1;typeof t!="function"&&(t=wa(t==null?1:+t));function d(){for(var f,g=l.length,y,b,v,S,j,E,C=0;C<u;++C)for(y=Sh(l,AS,TS).visitAfter(m),f=0;f<g;++f)b=l[f],j=r[b.index],E=j*j,v=b.x+b.vx,S=b.y+b.vy,y.visit(A);function A(F,_,H,M,I){var W=F.data,te=F.r,D=j+te;if(W){if(W.index>b.index){var Y=v-W.x-W.vx,B=S-W.y-W.vy,V=Y*Y+B*B;V<D*D&&(Y===0&&(Y=Vr(i),V+=Y*Y),B===0&&(B=Vr(i),V+=B*B),V=(D-(V=Math.sqrt(V)))/V*c,b.vx+=(Y*=V)*(D=(te*=te)/(E+te)),b.vy+=(B*=V)*D,W.vx-=Y*(D=1-D),W.vy-=B*D)}return}return _>v+D||M<v-D||H>S+D||I<S-D}}function m(f){if(f.data)return f.r=r[f.data.index];for(var g=f.r=0;g<4;++g)f[g]&&f[g].r>f.r&&(f.r=f[g].r)}function x(){if(l){var f,g=l.length,y;for(r=new Array(g),f=0;f<g;++f)y=l[f],r[y.index]=+t(y,f,l)}}return d.initialize=function(f,g){l=f,i=g,x()},d.iterations=function(f){return arguments.length?(u=+f,d):u},d.strength=function(f){return arguments.length?(c=+f,d):c},d.radius=function(f){return arguments.length?(t=typeof f=="function"?f:wa(+f),x(),d):t},d}function zS(t){return t.index}function h0(t,l){var r=t.get(l);if(!r)throw new Error("node not found: "+l);return r}function MS(t){var l=zS,r=y,i,c=wa(30),u,d,m,x,f,g=1;t==null&&(t=[]);function y(E){return 1/Math.min(m[E.source.index],m[E.target.index])}function b(E){for(var C=0,A=t.length;C<g;++C)for(var F=0,_,H,M,I,W,te,D;F<A;++F)_=t[F],H=_.source,M=_.target,I=M.x+M.vx-H.x-H.vx||Vr(f),W=M.y+M.vy-H.y-H.vy||Vr(f),te=Math.sqrt(I*I+W*W),te=(te-u[F])/te*E*i[F],I*=te,W*=te,M.vx-=I*(D=x[F]),M.vy-=W*D,H.vx+=I*(D=1-D),H.vy+=W*D}function v(){if(d){var E,C=d.length,A=t.length,F=new Map(d.map((H,M)=>[l(H,M,d),H])),_;for(E=0,m=new Array(C);E<A;++E)_=t[E],_.index=E,typeof _.source!="object"&&(_.source=h0(F,_.source)),typeof _.target!="object"&&(_.target=h0(F,_.target)),m[_.source.index]=(m[_.source.index]||0)+1,m[_.target.index]=(m[_.target.index]||0)+1;for(E=0,x=new Array(A);E<A;++E)_=t[E],x[E]=m[_.source.index]/(m[_.source.index]+m[_.target.index]);i=new Array(A),S(),u=new Array(A),j()}}function S(){if(d)for(var E=0,C=t.length;E<C;++E)i[E]=+r(t[E],E,t)}function j(){if(d)for(var E=0,C=t.length;E<C;++E)u[E]=+c(t[E],E,t)}return b.initialize=function(E,C){d=E,f=C,v()},b.links=function(E){return arguments.length?(t=E,v(),b):t},b.id=function(E){return arguments.length?(l=E,b):l},b.iterations=function(E){return arguments.length?(g=+E,b):g},b.strength=function(E){return arguments.length?(r=typeof E=="function"?E:wa(+E),S(),b):r},b.distance=function(E){return arguments.length?(c=typeof E=="function"?E:wa(+E),j(),b):c},b}var FS={value:()=>{}};function cg(){for(var t=0,l=arguments.length,r={},i;t<l;++t){if(!(i=arguments[t]+"")||i in r||/[\s.]/.test(i))throw new Error("illegal type: "+i);r[i]=[]}return new vc(r)}function vc(t){this._=t}function RS(t,l){return t.trim().split(/^|\s+/).map(function(r){var i="",c=r.indexOf(".");if(c>=0&&(i=r.slice(c+1),r=r.slice(0,c)),r&&!l.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:i}})}vc.prototype=cg.prototype={constructor:vc,on:function(t,l){var r=this._,i=RS(t+"",r),c,u=-1,d=i.length;if(arguments.length<2){for(;++u<d;)if((c=(t=i[u]).type)&&(c=_S(r[c],t.name)))return c;return}if(l!=null&&typeof l!="function")throw new Error("invalid callback: "+l);for(;++u<d;)if(c=(t=i[u]).type)r[c]=m0(r[c],t.name,l);else if(l==null)for(c in r)r[c]=m0(r[c],t.name,null);return this},copy:function(){var t={},l=this._;for(var r in l)t[r]=l[r].slice();return new vc(t)},call:function(t,l){if((c=arguments.length-2)>0)for(var r=new Array(c),i=0,c,u;i<c;++i)r[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(u=this._[t],i=0,c=u.length;i<c;++i)u[i].value.apply(l,r)},apply:function(t,l,r){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],c=0,u=i.length;c<u;++c)i[c].value.apply(l,r)}};function _S(t,l){for(var r=0,i=t.length,c;r<i;++r)if((c=t[r]).name===l)return c.value}function m0(t,l,r){for(var i=0,c=t.length;i<c;++i)if(t[i].name===l){t[i]=FS,t=t.slice(0,i).concat(t.slice(i+1));break}return r!=null&&t.push({name:l,value:r}),t}var pi=0,Cs=0,ws=0,ug=1e3,Dc,Es,zc=0,ja=0,Hc=0,Os=typeof performance=="object"&&performance.now?performance:Date,dg=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function fg(){return ja||(dg(OS),ja=Os.now()+Hc)}function OS(){ja=0}function Wf(){this._call=this._time=this._next=null}Wf.prototype=hg.prototype={constructor:Wf,restart:function(t,l,r){if(typeof t!="function")throw new TypeError("callback is not a function");r=(r==null?fg():+r)+(l==null?0:+l),!this._next&&Es!==this&&(Es?Es._next=this:Dc=this,Es=this),this._call=t,this._time=r,Zf()},stop:function(){this._call&&(this._call=null,this._time=1/0,Zf())}};function hg(t,l,r){var i=new Wf;return i.restart(t,l,r),i}function BS(){fg(),++pi;for(var t=Dc,l;t;)(l=ja-t._time)>=0&&t._call.call(void 0,l),t=t._next;--pi}function x0(){ja=(zc=Os.now())+Hc,pi=Cs=0;try{BS()}finally{pi=0,$S(),ja=0}}function LS(){var t=Os.now(),l=t-zc;l>ug&&(Hc-=l,zc=t)}function $S(){for(var t,l=Dc,r,i=1/0;l;)l._call?(i>l._time&&(i=l._time),t=l,l=l._next):(r=l._next,l._next=null,l=t?t._next=r:Dc=r);Es=t,Zf(i)}function Zf(t){if(!pi){Cs&&(Cs=clearTimeout(Cs));var l=t-ja;l>24?(t<1/0&&(Cs=setTimeout(x0,t-Os.now()-Hc)),ws&&(ws=clearInterval(ws))):(ws||(zc=Os.now(),ws=setInterval(LS,ug)),pi=1,dg(x0))}}const HS=1664525,US=1013904223,p0=4294967296;function IS(){let t=1;return()=>(t=(HS*t+US)%p0)/p0}function YS(t){return t.x}function qS(t){return t.y}var XS=10,VS=Math.PI*(3-Math.sqrt(5));function GS(t){var l,r=1,i=.001,c=1-Math.pow(i,1/300),u=0,d=.6,m=new Map,x=hg(y),f=cg("tick","end"),g=IS();t==null&&(t=[]);function y(){b(),f.call("tick",l),r<i&&(x.stop(),f.call("end",l))}function b(j){var E,C=t.length,A;j===void 0&&(j=1);for(var F=0;F<j;++F)for(r+=(u-r)*c,m.forEach(function(_){_(r)}),E=0;E<C;++E)A=t[E],A.fx==null?A.x+=A.vx*=d:(A.x=A.fx,A.vx=0),A.fy==null?A.y+=A.vy*=d:(A.y=A.fy,A.vy=0);return l}function v(){for(var j=0,E=t.length,C;j<E;++j){if(C=t[j],C.index=j,C.fx!=null&&(C.x=C.fx),C.fy!=null&&(C.y=C.fy),isNaN(C.x)||isNaN(C.y)){var A=XS*Math.sqrt(.5+j),F=j*VS;C.x=A*Math.cos(F),C.y=A*Math.sin(F)}(isNaN(C.vx)||isNaN(C.vy))&&(C.vx=C.vy=0)}}function S(j){return j.initialize&&j.initialize(t,g),j}return v(),l={tick:b,restart:function(){return x.restart(y),l},stop:function(){return x.stop(),l},nodes:function(j){return arguments.length?(t=j,v(),m.forEach(S),l):t},alpha:function(j){return arguments.length?(r=+j,l):r},alphaMin:function(j){return arguments.length?(i=+j,l):i},alphaDecay:function(j){return arguments.length?(c=+j,l):+c},alphaTarget:function(j){return arguments.length?(u=+j,l):u},velocityDecay:function(j){return arguments.length?(d=1-j,l):1-d},randomSource:function(j){return arguments.length?(g=j,m.forEach(S),l):g},force:function(j,E){return arguments.length>1?(E==null?m.delete(j):m.set(j,S(E)),l):m.get(j)},find:function(j,E,C){var A=0,F=t.length,_,H,M,I,W;for(C==null?C=1/0:C*=C,A=0;A<F;++A)I=t[A],_=j-I.x,H=E-I.y,M=_*_+H*H,M<C&&(W=I,C=M);return W},on:function(j,E){return arguments.length>1?(f.on(j,E),l):f.on(j)}}}function KS(){var t,l,r,i,c=wa(-30),u,d=1,m=1/0,x=.81;function f(v){var S,j=t.length,E=Sh(t,YS,qS).visitAfter(y);for(i=v,S=0;S<j;++S)l=t[S],E.visit(b)}function g(){if(t){var v,S=t.length,j;for(u=new Array(S),v=0;v<S;++v)j=t[v],u[j.index]=+c(j,v,t)}}function y(v){var S=0,j,E,C=0,A,F,_;if(v.length){for(A=F=_=0;_<4;++_)(j=v[_])&&(E=Math.abs(j.value))&&(S+=j.value,C+=E,A+=E*j.x,F+=E*j.y);v.x=A/C,v.y=F/C}else{j=v,j.x=j.data.x,j.y=j.data.y;do S+=u[j.data.index];while(j=j.next)}v.value=S}function b(v,S,j,E){if(!v.value)return!0;var C=v.x-l.x,A=v.y-l.y,F=E-S,_=C*C+A*A;if(F*F/x<_)return _<m&&(C===0&&(C=Vr(r),_+=C*C),A===0&&(A=Vr(r),_+=A*A),_<d&&(_=Math.sqrt(d*_)),l.vx+=C*v.value*i/_,l.vy+=A*v.value*i/_),!0;if(v.length||_>=m)return;(v.data!==l||v.next)&&(C===0&&(C=Vr(r),_+=C*C),A===0&&(A=Vr(r),_+=A*A),_<d&&(_=Math.sqrt(d*_)));do v.data!==l&&(F=u[v.data.index]*i/_,l.vx+=C*F,l.vy+=A*F);while(v=v.next)}return f.initialize=function(v,S){t=v,r=S,g()},f.strength=function(v){return arguments.length?(c=typeof v=="function"?v:wa(+v),g(),f):c},f.distanceMin=function(v){return arguments.length?(d=v*v,f):Math.sqrt(d)},f.distanceMax=function(v){return arguments.length?(m=v*v,f):Math.sqrt(m)},f.theta=function(v){return arguments.length?(x=v*v,f):Math.sqrt(x)},f}const Bs={tech:{bg:"rgba(59,130,246,0.15)",border:"#3b82f6",text:"#60a5fa"},market:{bg:"rgba(245,158,11,0.15)",border:"#f59e0b",text:"#fbbf24"},strategy:{bg:"rgba(139,92,246,0.15)",border:"#8b5cf6",text:"#a78bfa"},financial:{bg:"rgba(34,197,94,0.15)",border:"#22c55e",text:"#4ade80"},process:{bg:"rgba(236,72,153,0.15)",border:"#ec4899",text:"#f472b6"},competitor:{bg:"rgba(239,68,68,0.15)",border:"#ef4444",text:"#f87171"},domain:{bg:"rgba(14,165,233,0.15)",border:"#0ea5e9",text:"#38bdf8"},general:{bg:"rgba(148,163,184,0.12)",border:"#64748b",text:"#94a3b8"}};function QS(t){return Bs[t]??Bs.general}function WS({docs:t,onNodeClick:l,selectedDocId:r}){var Y;const i=k.useRef(null),c=k.useRef(null),[u,d]=k.useState({width:600,height:400}),[m,x]=k.useState({nodes:[],links:[]}),[f,g]=k.useState(null),[y,b]=k.useState(null),[v,S]=k.useState({x:0,y:0}),[j,E]=k.useState({x:0,y:0,w:600,h:400}),C=k.useRef(!1),A=k.useRef({x:0,y:0,vx:0,vy:0}),F=k.useRef(null),_=k.useRef(null);k.useEffect(()=>{const B=i.current;if(!B)return;const V=new ResizeObserver(ne=>{const{width:G,height:L}=ne[0].contentRect;G>0&&L>0&&(d({width:G,height:L}),E(Z=>({...Z,w:G,h:L})))});return V.observe(B),()=>V.disconnect()},[]),k.useEffect(()=>{if(t.length===0)return;const B=new Set(t.map(ue=>ue.id)),V=t.map(ue=>({id:ue.id,title:ue.title,category:ue.category,akb_type:ue.akb_type})),ne=(ue,z)=>{if(!z.startsWith(".")&&!z.startsWith("/"))return z;const R=ue.split("/");R.pop();const K=z.split("/");for(const T of K)T===".."?R.pop():T!=="."&&T!==""&&R.push(T);return R.join("/")},G=[];for(const ue of t)for(const z of ue.links){const R=ne(ue.id,z.href);B.has(R)&&R!==ue.id&&(G.some(K=>K.source===ue.id&&K.target===R||K.source===R&&K.target===ue.id)||G.push({source:ue.id,target:R,label:z.text}))}const{width:L,height:Z}=u,de=GS(V).force("link",MS(G).id(ue=>ue.id).distance(140)).force("charge",KS().strength(-400)).force("center",dS(L/2,Z/2)).force("collide",DS(50));_.current=de,de.on("tick",()=>{for(const ue of V)ue.x=Math.max(60,Math.min(L-60,ue.x??L/2)),ue.y=Math.max(60,Math.min(Z-60,ue.y??Z/2));x({nodes:[...V],links:[...G]})}),de.alpha(1).restart();for(let ue=0;ue<150;ue++)de.tick();return de.stop(),x({nodes:[...V],links:[...G]}),()=>{de.stop()}},[t,u]);const H=B=>{if(typeof B=="string"){const V=m.nodes.find(ne=>ne.id===B);return{x:(V==null?void 0:V.x)??0,y:(V==null?void 0:V.y)??0}}return{x:B.x??0,y:B.y??0}},M=k.useCallback(B=>{B.preventDefault();const V=B.deltaY>0?1.1:.9;E(ne=>{const G=Math.max(200,Math.min(u.width*3,ne.w*V)),L=Math.max(150,Math.min(u.height*3,ne.h*V)),Z=(G-ne.w)/2,de=(L-ne.h)/2;return{x:ne.x-Z,y:ne.y-de,w:G,h:L}})},[u]),I=k.useCallback(B=>{B.button===0&&(C.current=!0,A.current={x:B.clientX,y:B.clientY,vx:j.x,vy:j.y})},[j]),W=k.useCallback(B=>{var V;if(F.current){const ne=c.current;if(!ne)return;const G=ne.getBoundingClientRect(),L=j.w/G.width,Z=j.h/G.height,de=j.x+(B.clientX-G.left)*L,ue=j.y+(B.clientY-G.top)*Z;F.current.fx=de,F.current.fy=ue,(V=_.current)==null||V.alpha(.3).restart();return}if(C.current){const ne=(B.clientX-A.current.x)*(j.w/u.width),G=(B.clientY-A.current.y)*(j.h/u.height);E(L=>({...L,x:A.current.vx-ne,y:A.current.vy-G}))}},[j,u]),te=k.useCallback(()=>{C.current=!1,F.current&&(F.current.fx=null,F.current.fy=null,F.current=null)},[]),D=k.useCallback((B,V)=>{var ne;B.stopPropagation(),F.current=V,(ne=_.current)==null||ne.alpha(.3).restart()},[]);return s.jsxs("div",{ref:i,className:"relative flex-1 overflow-hidden",style:{background:"#1e1e2e"},children:[s.jsxs("svg",{ref:c,width:u.width,height:u.height,viewBox:`${j.x} ${j.y} ${j.w} ${j.h}`,style:{display:"block",cursor:C.current?"grabbing":"grab"},onWheel:M,onMouseDown:I,onMouseMove:W,onMouseUp:te,onMouseLeave:te,children:[s.jsx("defs",{children:s.jsx("pattern",{id:"grid",width:"20",height:"20",patternUnits:"userSpaceOnUse",children:s.jsx("circle",{cx:"0",cy:"0",r:"0.5",fill:"rgba(255,255,255,0.06)"})})}),s.jsx("rect",{x:j.x-100,y:j.y-100,width:j.w+200,height:j.h+200,fill:"url(#grid)",pointerEvents:"none"}),m.links.map((B,V)=>{const ne=H(B.source),G=H(B.target),L=y===V,Z=(ne.x+G.x)/2,de=(ne.y+G.y)/2;return s.jsxs("g",{children:[s.jsx("line",{x1:ne.x,y1:ne.y,x2:G.x,y2:G.y,stroke:"transparent",strokeWidth:12,style:{cursor:"default"},onMouseEnter:()=>b(V),onMouseLeave:()=>b(null)}),s.jsx("line",{x1:ne.x,y1:ne.y,x2:G.x,y2:G.y,stroke:L?"rgba(148,163,184,0.7)":"rgba(148,163,184,0.3)",strokeWidth:L?2:1.5,strokeDasharray:"4 3",pointerEvents:"none"}),L&&B.label&&s.jsx("text",{x:Z,y:de-6,textAnchor:"middle",fill:"#e2e8f0",fontSize:9,fontFamily:"monospace",style:{pointerEvents:"none"},children:s.jsx("tspan",{style:{filter:"drop-shadow(0 0 2px rgba(0,0,0,0.8))"},children:B.label.length>30?B.label.slice(0,28)+"..":B.label})})]},V)}),m.nodes.map(B=>{const V=Bs[B.category]??Bs.general,ne=B.akb_type==="hub",G=ne?24:16,L=(f==null?void 0:f.id)===B.id,Z=r===B.id,de=L?1.2:Z?1.15:1;return s.jsxs("g",{transform:`translate(${B.x??0}, ${B.y??0}) scale(${de})`,style:{cursor:"pointer",transition:"transform 0.15s ease"},onClick:ue=>{ue.stopPropagation();const z=t.find(R=>R.id===B.id);z&&l(z)},onMouseDown:ue=>D(ue,B),onMouseEnter:ue=>{var R;g(B);const z=(R=i.current)==null?void 0:R.getBoundingClientRect();z&&S({x:ue.clientX-z.left,y:ue.clientY-z.top})},onMouseLeave:()=>g(null),children:[Z&&s.jsx("rect",{x:-G/2-4,y:-G/2-4,width:G+8,height:G+8,fill:"none",stroke:"#22c55e",strokeWidth:2,rx:ne?5:2,opacity:.6}),s.jsx("rect",{x:-G/2,y:-G/2,width:G,height:G,fill:V.border,rx:ne?4:2,opacity:L?1:.9}),s.jsx("rect",{x:-G/2+3,y:-G/2+3,width:Math.max(0,G-6),height:Math.max(0,G-6),fill:V.bg,rx:ne?3:1}),s.jsx("text",{y:G/2+14,textAnchor:"middle",fill:Z?"#e2e8f0":"#94a3b8",fontSize:11,fontFamily:"monospace",fontWeight:Z?"bold":"normal",style:{pointerEvents:"none"},children:B.title.length>24?B.title.slice(0,22)+"..":B.title})]},B.id)})]}),f&&!F.current&&s.jsxs("div",{className:"absolute z-10 pointer-events-none p-2.5 rounded text-xs max-w-[240px]",style:{left:Math.min(v.x+16,u.width-250),top:Math.max(v.y-30,8),background:"var(--hud-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)",boxShadow:"0 4px 12px rgba(0,0,0,0.4)"},children:[s.jsx("div",{className:"font-bold mb-1",children:f.title}),s.jsxs("div",{className:"text-[10px] opacity-60 mb-1",children:[f.akb_type.toUpperCase()," / ",f.category]}),((Y=t.find(B=>B.id===f.id))==null?void 0:Y.tldr)&&s.jsx("div",{className:"text-[10px] opacity-80 mb-1",children:t.find(B=>B.id===f.id).tldr}),s.jsx("div",{className:"text-[10px] text-green-400",children:"Click to open | Drag to move"})]}),t.length===0&&s.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-xs",style:{color:"var(--terminal-text-muted)"},children:"No knowledge documents found"})]})}function ZS({doc:t,allDocs:l,onOpen:r,onNavigateDoc:i}){const[c,u]=k.useState(!1),d=QS(t.category),m=t.akb_type==="hub",x=new Set(l.map(f=>f.id));return s.jsxs("div",{className:"mb-2 rounded-lg overflow-hidden",style:{background:m?"rgba(22,163,106,0.08)":"var(--hud-bg-alt)",border:`2px solid ${m?"rgba(22,163,106,0.4)":"var(--terminal-border)"}`},children:[s.jsxs("div",{className:"p-3 cursor-pointer hover:bg-white/5",onClick:()=>u(!c),children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("span",{className:"shrink-0 text-sm",children:m?"🗂":t.format==="html"?"🌐":"📄"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[s.jsx("span",{className:"font-semibold text-xs truncate",style:{color:"var(--terminal-text)"},children:t.title}),s.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{background:t.status==="active"?"#16a34a":t.status==="draft"?"#f59e0b":"#94a3b8"},title:t.status})]}),s.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:t.tags.slice(0,4).map(f=>s.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-medium",style:{background:d.bg,color:d.text,border:`1px solid ${d.border}`},children:f},f))})]}),s.jsx("span",{className:"text-xs shrink-0",style:{color:"var(--terminal-text-muted)"},children:c?"▲":"▼"})]}),!c&&t.tldr&&s.jsx("div",{className:"mt-1.5 text-[10px] line-clamp-2 ml-6",style:{color:"var(--terminal-text-secondary)"},children:t.tldr})]}),c&&s.jsxs("div",{className:"px-3 pb-3",style:{borderTop:"1px solid var(--terminal-border)"},children:[t.tldr&&s.jsx("div",{className:"mt-2 text-[11px] leading-relaxed italic",style:{color:"var(--terminal-text-secondary)"},children:t.tldr}),t.links.length>0&&s.jsxs("div",{className:"mt-2",children:[s.jsx("div",{className:"text-[9px] font-bold uppercase mb-1",style:{color:"var(--terminal-text-muted)"},children:"Cross-links"}),s.jsx("div",{className:"flex flex-wrap gap-1",children:t.links.slice(0,5).map((f,g)=>{const y=f.href.replace(/^.*knowledge\//,"").replace(/^\.\.\/.*$/,"").replace(/^\.\//,""),b=x.has(y);return s.jsxs("span",{className:`px-1.5 py-0.5 text-[9px] rounded ${b?"cursor-pointer hover:opacity-70":""}`,style:{background:b?"rgba(22,163,106,0.15)":"rgba(148,163,184,0.1)",color:b?"#4ade80":"var(--terminal-text-muted)",border:`1px solid ${b?"rgba(22,163,106,0.3)":"var(--terminal-border)"}`},onClick:v=>{b&&(v.stopPropagation(),i(y))},children:["🔗"," ",f.text]},g)})})]}),s.jsxs("button",{className:"mt-2 text-[10px] font-semibold cursor-pointer hover:opacity-70",style:{color:"var(--active-green)"},onClick:f=>{f.stopPropagation(),r(t)},children:["Open full ","→"]})]})]})}function JS({docId:t,onBack:l,onDocUpdated:r,onDelete:i,onNavigateDoc:c,allDocs:u}){const[d,m]=k.useState(null),[x,f]=k.useState(!0),[g,y]=k.useState(!1),[b,v]=k.useState(""),[S,j]=k.useState(!1),E=new Set(u.map(H=>H.id)),C=k.useCallback(H=>{const M=H.split("#")[0];if(!M.match(/\.(md|html)$/))return null;const I=t.includes("/")?t.replace(/\/[^/]+$/,""):"";let W;if(M.startsWith("./"))W=I?`${I}/${M.slice(2)}`:M.slice(2);else if(M.startsWith("../")){const Y=I.split("/").filter(Boolean);let B=M;for(;B.startsWith("../");)Y.length>0&&Y.pop(),B=B.slice(3);W=Y.length>0?`${Y.join("/")}/${B}`:B}else W=M;if(E.has(W))return W;const te=W.split("/").pop()??"",D=u.find(Y=>Y.id===te||Y.id.endsWith("/"+te));return D?D.id:null},[t,E,u]),A=k.useCallback(H=>{const I=H.target.closest("a");if(!I)return;const W=I.getAttribute("href");if(!W||W.startsWith("http://")||W.startsWith("https://")||!W.match(/\.(md|html)(#.*)?$/))return;H.preventDefault(),H.stopPropagation();const te=C(W);te&&c(te)},[C,c]);k.useEffect(()=>{f(!0),Ce.getKnowledgeDoc(t).then(H=>{m(H),v(H.content)}).catch(console.error).finally(()=>f(!1))},[t]);const F=async()=>{if(d){j(!0);try{await Ce.updateKnowledgeDoc(t,b),m({...d,content:b}),y(!1),r()}catch(H){console.error("Save failed:",H)}finally{j(!1)}}},_=async()=>{if(confirm(`Delete "${d==null?void 0:d.title}"?`))try{await Ce.deleteKnowledgeDoc(t),i(t)}catch(H){console.error("Delete failed:",H)}};return x?s.jsx("div",{className:"flex-1 flex items-center justify-center text-xs",style:{color:"var(--terminal-text-muted)"},children:"Loading..."}):d?s.jsxs("div",{className:"flex-1 overflow-y-auto flex flex-col",children:[s.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[s.jsxs("button",{onClick:l,className:"text-xs font-semibold cursor-pointer hover:opacity-70",style:{color:"var(--active-green)"},children:["←"," Back"]}),s.jsx("div",{className:"flex-1"}),g?s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:()=>{y(!1),v(d.content)},className:"px-2.5 py-1 text-[10px] rounded cursor-pointer",style:{background:"var(--hud-bg-alt)",color:"var(--terminal-text-secondary)",border:"1px solid var(--terminal-border)"},children:"Cancel"}),s.jsx("button",{onClick:F,disabled:S,className:"px-2.5 py-1 text-[10px] rounded cursor-pointer font-semibold text-white",style:{background:S?"#86efac":"#16a34a"},children:S?"Saving...":"Save"})]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:()=>y(!0),className:"px-2.5 py-1 text-[10px] rounded cursor-pointer font-semibold",style:{background:"rgba(59,130,246,0.15)",color:"#60a5fa",border:"1px solid rgba(59,130,246,0.3)"},children:"Edit"}),s.jsx("button",{onClick:_,className:"px-2.5 py-1 text-[10px] rounded cursor-pointer font-semibold",style:{background:"rgba(239,68,68,0.15)",color:"#f87171",border:"1px solid rgba(239,68,68,0.3)"},children:"Delete"})]})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[s.jsx("h2",{className:"text-sm font-bold mb-1",style:{color:"var(--terminal-text)"},children:d.title}),d.tldr&&!g&&s.jsx("div",{className:"mb-3 text-xs italic",style:{color:"var(--terminal-text-secondary)"},children:d.tldr}),d.format==="html"?g?s.jsx("textarea",{className:"w-full h-full min-h-[400px] p-3 text-xs leading-relaxed rounded border resize-y",style:{fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace',background:"var(--hud-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},value:b,onChange:H=>v(H.target.value),spellCheck:!1}):s.jsx("iframe",{srcDoc:d.content,sandbox:"allow-same-origin",className:"w-full flex-1 min-h-[400px] rounded",style:{border:"1px solid var(--terminal-border)",background:"var(--hud-bg-alt)"},title:d.title}):g?s.jsx("textarea",{className:"w-full h-full min-h-[400px] p-3 text-xs leading-relaxed rounded border resize-y",style:{fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace',background:"#1e1e2e",color:"#e2e8f0",border:"1px solid #334155"},value:b,onChange:H=>v(H.target.value),spellCheck:!1}):s.jsx("div",{className:"text-xs leading-relaxed",style:{color:"var(--terminal-text-secondary)"},onClick:A,children:s.jsx(Is,{content:d.content})})]})]}):s.jsx("div",{className:"flex-1 flex items-center justify-center text-xs",style:{color:"var(--terminal-text-muted)"},children:"Failed to load document"})}function PS({onCreated:t,onCancel:l}){const[r,i]=k.useState(""),[c,u]=k.useState(""),[d,m]=k.useState(""),[x,f]=k.useState(!1),[g,y]=k.useState("");k.useEffect(()=>{if(!r){u("");return}const v=r.toLowerCase().replace(/[^a-z0-9가-힣\s-]/g,"").replace(/\s+/g,"-").slice(0,60);u(v)},[r]);const b=async()=>{if(!r.trim()||!c.trim()){y("Title and filename are required");return}f(!0),y("");try{const v=await Ce.createKnowledgeDoc({filename:c,title:r,category:d||void 0});t(v.id)}catch(v){y(v instanceof Error?v.message:"Failed to create")}finally{f(!1)}};return s.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[s.jsxs("button",{onClick:l,className:"text-xs font-semibold cursor-pointer hover:opacity-70",style:{color:"var(--active-green)"},children:["←"," Cancel"]}),s.jsx("h2",{className:"text-sm font-bold",style:{color:"var(--terminal-text)"},children:"New Document"})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"TITLE"}),s.jsx("input",{type:"text",value:r,onChange:v=>i(v.target.value),placeholder:"Document title...",className:"w-full px-3 py-2 text-xs rounded focus:outline-none",style:{background:"var(--hud-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)"}})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"FILENAME"}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("input",{type:"text",value:c,onChange:v=>u(v.target.value),className:"flex-1 px-3 py-2 text-xs rounded focus:outline-none font-mono",style:{background:"var(--hud-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)"}}),s.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:".md"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"CATEGORY (optional)"}),s.jsx("input",{type:"text",value:d,onChange:v=>m(v.target.value),placeholder:"e.g., tech, market, strategy",className:"w-full px-3 py-2 text-xs rounded focus:outline-none",style:{background:"var(--hud-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)"}})]}),g&&s.jsx("div",{className:"text-[10px] px-3 py-1.5 rounded",style:{background:"rgba(239,68,68,0.15)",color:"#f87171"},children:g}),s.jsx("button",{onClick:b,disabled:x||!r.trim(),className:"w-full py-2 text-xs font-semibold rounded cursor-pointer text-white",style:{background:x?"#86efac":"#16a34a"},children:x?"Creating...":"Create Document"})]})]})}const eC=500,y0=360,g0=700;function Eh(t){const[l,r]=k.useState(eC),[i,c]=k.useState(!1),u=k.useRef(0),d=k.useRef(0),m=t>0,x=m?t:0,f=m?Math.max(y0,window.innerWidth-t-100):g0,g=Math.min(l,f),y=k.useCallback(b=>{b.preventDefault(),u.current=b.clientX,d.current=g,c(!0);const v=j=>{const E=u.current-j.clientX,C=Math.min(g0,Math.max(y0,d.current+E));r(C)},S=()=>{c(!1),document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",S)};document.addEventListener("mousemove",v),document.addEventListener("mouseup",S)},[g]);return{panelRight:x,panelWidth:g,isResizing:i,handleResizeStart:y}}function tC({docs:t,onClose:l,onRefresh:r,terminalWidth:i=0,initialDocId:c}){const[u,d]=k.useState("list"),[m,x]=k.useState("all"),[f,g]=k.useState(c??null),[y,b]=k.useState(""),[v,S]=k.useState(!1),[j,E]=k.useState(null),{panelRight:C,panelWidth:A,isResizing:F,handleResizeStart:_}=Eh(i),H=["all",...Array.from(new Set(t.map(Y=>Y.category))).sort()],M=t.filter(Y=>{if(m!=="all"&&Y.category!==m)return!1;if(y){const B=y.toLowerCase();return Y.title.toLowerCase().includes(B)||(Y.tldr??"").toLowerCase().includes(B)||Y.tags.some(V=>V.toLowerCase().includes(B))}return!0}),I=Y=>{S(!1),r(),g(Y)},W=Y=>{g(null),r()},te=Y=>{E(Y.id)},D=j?t.find(Y=>Y.id===j):null;return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:C},onClick:l}),s.jsxs("div",{className:`side-panel open fixed top-0 h-full z-50 flex flex-col border-l-[3px] shadow-[-4px_0_20px_rgba(0,0,0,0.4)] ${F?"resizing":""}`,style:{right:C,width:A,background:"var(--terminal-bg)",borderLeftColor:"#16a34a"},children:[s.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${F?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:_}),s.jsxs("div",{className:"p-5 text-white relative",style:{background:"#16a34a"},children:[s.jsx("button",{onClick:l,className:"absolute top-3 right-3 w-7 h-7 rounded-full bg-white/20 text-white flex items-center justify-center text-lg hover:bg-white/30 cursor-pointer",children:"×"}),s.jsxs("div",{className:"text-lg font-bold",children:["📚"," Knowledge Base"]}),s.jsxs("div",{className:"text-xs opacity-80 mt-0.5",children:[t.length," documents"]})]}),s.jsxs("div",{className:"flex",style:{borderBottom:"1px solid var(--terminal-border)"},children:[s.jsx(b0,{label:"List",active:u==="list",onClick:()=>{d("list"),E(null)}}),s.jsx(b0,{label:"Graph",active:u==="graph",onClick:()=>d("graph")})]}),u==="list"&&!f&&!v&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[s.jsx("input",{type:"text",value:y,onChange:Y=>b(Y.target.value),placeholder:"Search docs...",className:"flex-1 px-2.5 py-1.5 text-[11px] rounded focus:outline-none",style:{background:"var(--hud-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)"}}),s.jsx("button",{onClick:()=>S(!0),className:"px-2.5 py-1.5 text-[10px] font-semibold rounded cursor-pointer text-white shrink-0",style:{background:"#16a34a"},children:"+ New"})]}),s.jsx("div",{className:"flex overflow-x-auto shrink-0",style:{borderBottom:"1px solid var(--terminal-border)",scrollbarWidth:"none"},children:H.map(Y=>s.jsx("button",{onClick:()=>x(Y),className:"px-3 py-1.5 text-[10px] font-medium cursor-pointer whitespace-nowrap",style:{color:m===Y?"#4ade80":"var(--terminal-text-muted)",borderBottom:m===Y?"2px solid #4ade80":"2px solid transparent"},children:Y==="all"?`All (${t.length})`:`${Y} (${t.filter(B=>B.category===Y).length})`},Y))}),s.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:M.length===0?s.jsx("div",{className:"text-center text-xs py-8",style:{color:"var(--terminal-text-muted)"},children:y?"No matching documents":"No documents in this category"}):M.map(Y=>s.jsx(ZS,{doc:Y,allDocs:t,onOpen:B=>g(B.id),onNavigateDoc:B=>g(B)},Y.id))})]}),u==="list"&&f&&!v&&s.jsx(JS,{docId:f,onBack:()=>g(null),onDocUpdated:r,onDelete:W,onNavigateDoc:Y=>g(Y),allDocs:t}),u==="list"&&v&&s.jsx(PS,{onCreated:I,onCancel:()=>S(!1)}),u==="graph"&&s.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[s.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[s.jsx(WS,{docs:t,onNodeClick:te,selectedDocId:j}),D&&s.jsxs("div",{className:"shrink-0 overflow-y-auto p-3",style:{width:200,background:"var(--hud-bg-alt)",borderLeft:"1px solid var(--terminal-border)"},children:[s.jsx("div",{className:"text-[10px] font-bold uppercase mb-1",style:{color:"var(--terminal-text-muted)"},children:"Selected"}),s.jsx("div",{className:"text-xs font-bold mb-1",style:{color:"var(--terminal-text)"},children:D.title}),s.jsx("div",{className:"w-2 h-2 rounded-full mb-2",style:{background:D.status==="active"?"#16a34a":D.status==="draft"?"#f59e0b":"#94a3b8"}}),D.tldr&&s.jsx("div",{className:"text-[10px] mb-2 leading-relaxed",style:{color:"var(--terminal-text-secondary)"},children:D.tldr}),D.links.length>0&&s.jsxs("div",{className:"mb-2",children:[s.jsx("div",{className:"text-[9px] font-bold mb-1",style:{color:"var(--terminal-text-muted)"},children:"Links"}),D.links.slice(0,5).map((Y,B)=>s.jsxs("div",{className:"text-[9px] mb-0.5 truncate",style:{color:"var(--terminal-text-secondary)"},children:["🔗"," ",Y.text]},B))]}),s.jsx("button",{className:"w-full py-1.5 text-[10px] font-semibold rounded cursor-pointer text-white",style:{background:"#16a34a"},onClick:()=>{d("list"),g(D.id),E(null)},children:"Open Document"})]})]}),s.jsx("div",{className:"shrink-0 p-2",style:{borderTop:"1px solid var(--terminal-border)"},children:s.jsx("div",{className:"flex flex-wrap gap-2",children:Object.entries(Bs).map(([Y,B])=>s.jsxs("div",{className:"flex items-center gap-1 text-[9px]",children:[s.jsx("div",{className:"w-2 h-2",style:{background:B.border}}),s.jsx("span",{style:{color:"var(--terminal-text-muted)"},children:Y})]},Y))})})]})]})]})}function b0({label:t,active:l,onClick:r}){return s.jsx("button",{onClick:r,className:"px-4 py-2.5 text-sm font-medium cursor-pointer",style:{color:l?"#4ade80":"var(--terminal-text-muted)",borderBottom:l?"2px solid #4ade80":"2px solid transparent"},children:t})}function nC({standups:t,waves:l,decisions:r,mode:i,onClose:c,terminalWidth:u=0}){const[d,m]=k.useState(i==="decisions"?"decisions":"standups"),{panelRight:x,panelWidth:f,isResizing:g,handleResizeStart:y}=Eh(u);return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:x},onClick:c}),s.jsxs("div",{className:`side-panel open fixed top-0 h-full z-50 flex flex-col border-l-[3px] shadow-[-4px_0_20px_rgba(0,0,0,0.4)] ${g?"resizing":""}`,style:{right:x,width:f,background:"var(--terminal-bg)",borderLeftColor:"var(--desk-wood)"},children:[s.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${g?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:y}),s.jsxs("div",{className:"p-5 bg-[var(--desk-wood)] text-white relative",children:[s.jsx("button",{onClick:c,className:"absolute top-3 right-3 w-7 h-7 rounded-full bg-white/20 text-white flex items-center justify-center text-lg hover:bg-white/30 cursor-pointer",children:"×"}),s.jsx("div",{className:"text-lg font-bold",children:i==="bulletin"?"📌 Bulletin Board":"📜 Decision Log"})]}),s.jsx("div",{className:"flex",style:{borderBottom:"1px solid var(--terminal-border)"},children:i==="bulletin"?s.jsxs(s.Fragment,{children:[s.jsx(bf,{label:`Standups (${t.length})`,active:d==="standups",onClick:()=>m("standups")}),s.jsx(bf,{label:`Waves (${l.length})`,active:d==="waves",onClick:()=>m("waves")})]}):s.jsx(bf,{label:`Decisions (${r.length})`,active:d==="decisions",onClick:()=>m("decisions")})}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[d==="standups"&&t.map((b,v)=>s.jsx(vf,{title:`Standup ${b.date}`,content:b.content},v)),d==="waves"&&l.map((b,v)=>s.jsx(vf,{title:`Wave ${b.id}`,subtitle:b.timestamp,content:b.content},v)),d==="decisions"&&r.map((b,v)=>s.jsx(vf,{title:`#${b.id} ${b.title}`,subtitle:b.date,content:b.content},v))]})]})]})}function bf({label:t,active:l,onClick:r}){return s.jsx("button",{onClick:r,className:"px-4 py-2.5 text-sm font-medium cursor-pointer",style:{color:l?"var(--accent)":"var(--terminal-text-muted)",borderBottom:l?"2px solid var(--accent)":"2px solid transparent"},children:t})}function lC(t){return t.replace(/^#{1,6}\s+/gm,"").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/\*([^*]+)\*/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/```[\s\S]*?```/g,"").replace(/^\s*[-*+]\s+/gm,"• ").replace(/^\s*\d+\.\s+/gm,"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/^>\s+/gm,"").replace(/^---+$/gm,"").replace(/\|[^|]*\|/g,"").replace(/\n{2,}/g," · ").replace(/\n/g," ").trim()}function vf({title:t,subtitle:l,content:r}){const[i,c]=k.useState(!1),u=r.length>100,d=lC(r).slice(0,160);return s.jsxs("div",{className:"mb-3 rounded-lg overflow-hidden",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[s.jsxs("div",{className:"p-3 cursor-pointer hover:bg-white/5",onClick:()=>c(!i),children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{className:"font-medium text-sm",style:{color:"var(--terminal-text)"},children:t}),s.jsx("span",{className:"text-xs shrink-0 ml-2",style:{color:"var(--terminal-text-muted)"},children:i?"▲":"▼"})]}),l&&s.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--terminal-text-muted)"},children:l})]}),i&&s.jsx("div",{className:"px-3 pb-3 text-xs leading-relaxed pt-2",style:{borderTop:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:s.jsx(Is,{content:r})}),!i&&u&&s.jsx("div",{className:"px-3 pb-2 text-xs line-clamp-2 leading-relaxed",style:{color:"var(--terminal-text-muted)"},children:d})]})}function rC({projectId:t,onClose:l,terminalWidth:r=0}){const[i,c]=k.useState(null),{panelRight:u,panelWidth:d,isResizing:m,handleResizeStart:x}=Eh(r);if(k.useEffect(()=>{Ce.getProject(t).then(c).catch(console.error)},[t]),!i)return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:u},onClick:l}),s.jsx("div",{className:"side-panel open fixed top-0 h-full z-50 flex items-center justify-center border-l-[3px] border-[var(--meeting-blue)]",style:{right:u,width:d,background:"var(--terminal-bg)"},children:s.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-muted)"},children:"Loading project..."})})]});const f=i.tasks.filter(b=>b.status==="done").length,g=i.tasks.length,y=g>0?Math.round(f/g*100):0;return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:u},onClick:l}),s.jsxs("div",{className:`side-panel open fixed top-0 h-full z-50 flex flex-col border-l-[3px] border-[var(--meeting-blue)] shadow-[-4px_0_20px_rgba(0,0,0,0.4)] ${m?"resizing":""}`,style:{right:u,width:d,background:"var(--terminal-bg)"},children:[s.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${m?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:x}),s.jsxs("div",{className:"p-5 bg-[var(--meeting-blue)] text-white relative",children:[s.jsx("div",{className:"text-sm opacity-70",children:"Meeting Room"}),s.jsx("button",{onClick:l,className:"absolute top-3 right-3 z-10 w-7 h-7 rounded-full bg-white/20 text-white flex items-center justify-center text-lg hover:bg-white/30 cursor-pointer",children:"×"}),s.jsx("div",{className:"text-xl font-bold mt-1",children:i.name}),s.jsxs("div",{className:"flex items-center gap-3 mt-3 text-sm",children:[s.jsxs("span",{children:["Tasks: ",g]}),s.jsxs("span",{children:["Done: ",f]}),s.jsxs("span",{children:["Progress: ",y,"%"]})]}),s.jsx("div",{className:"mt-2 h-1.5 bg-white/20 rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-white rounded-full transition-all",style:{width:`${y}%`}})})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[i.prd&&s.jsxs("div",{className:"mb-5",children:[s.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:"PRD"}),s.jsx("div",{className:"rounded-lg p-4 text-xs leading-relaxed max-h-60 overflow-y-auto",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:s.jsx(Is,{content:i.prd})})]}),s.jsxs("div",{children:[s.jsxs("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:["Tasks (",g,")"]}),s.jsx("div",{className:"space-y-2",children:i.tasks.map(b=>s.jsxs("div",{className:"rounded-lg p-3",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-sm font-medium",style:{color:"var(--terminal-text)"},children:b.title}),s.jsx(aC,{status:b.status})]}),s.jsx("div",{className:"text-xs mt-1",style:{color:"var(--terminal-text-muted)"},children:b.role}),b.description&&s.jsx("div",{className:"text-xs mt-1.5 line-clamp-2",style:{color:"var(--terminal-text-secondary)"},children:b.description})]},b.id))})]})]})]})]})}function aC({status:t}){const l={done:{bg:"rgba(34,197,94,0.15)",color:"#4ade80"},"in-progress":{bg:"rgba(59,130,246,0.15)",color:"#60a5fa"},todo:{bg:"rgba(148,163,184,0.15)",color:"var(--terminal-text-muted)"}},r=l[t]??l.todo;return s.jsx("span",{className:"text-[10px] font-semibold px-2 py-0.5 rounded-full",style:{background:r.bg,color:r.color},children:t})}const iC={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"};function sC({roleId:t,roleName:l,mode:r="assign",onClose:i,onExecutionStart:c}){const[u,d]=k.useState(""),m=k.useRef(null);k.useEffect(()=>{var y;(y=m.current)==null||y.focus()},[]);const x=()=>{u.trim()&&(c(t,u.trim()),i())},f=y=>{y.key==="Enter"&&(y.metaKey||y.ctrlKey)&&x(),y.key==="Escape"&&i()},g=iC[t]??"#666";return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:i}),s.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[520px] z-[61] bg-[var(--wall)] rounded-2xl shadow-2xl overflow-hidden",children:[s.jsxs("div",{className:"p-5 text-white",style:{background:`linear-gradient(135deg, ${g}, ${g}cc)`},children:[s.jsx("div",{className:"text-lg font-bold",children:r==="ask"?"Ask":"Assign Task"}),s.jsx("div",{className:"text-sm opacity-80 mt-0.5",children:r==="ask"?`to ${l}`:`to ${l} (${t})`})]}),s.jsxs("div",{className:"p-5",children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Task Description"}),s.jsx("textarea",{ref:m,value:u,onChange:y=>d(y.target.value),onKeyDown:f,placeholder:r==="ask"?"What would you like to ask?":"Describe the task...",className:"w-full h-32 p-3 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 placeholder-white/25 resize-none focus:outline-none focus:border-white/25 transition-colors"}),s.jsx("div",{className:"text-[10px] text-white/30 mt-1",children:"Cmd+Enter to submit"})]}),s.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[s.jsx("button",{onClick:i,className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer",children:"Cancel"}),s.jsx("button",{onClick:x,disabled:!u.trim(),className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:g},children:r==="ask"?"Ask":"Assign"})]})]})]})}const v0={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"};function mg({event:t,isThinkingCollapsed:l,onToggleThinking:r,onNavigateToJob:i,onOpenKnowledgeDoc:c,compact:u}){var m;const d=v0[t.roleId]??"#888";switch(t.type){case"text":return s.jsx("div",{className:"text-green-300/90 whitespace-pre-wrap leading-relaxed",children:u?(t.data.text??"").slice(0,300):t.data.text});case"thinking":{const x=t.data.text??"";return s.jsxs("div",{className:"group",children:[s.jsxs("button",{onClick:r,className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-[10px] cursor-pointer flex items-center gap-1",children:[s.jsx("span",{children:l?"▶":"▼"}),s.jsx("span",{className:"italic",children:"thinking..."})]}),!l&&s.jsxs("div",{className:`ml-3 text-[var(--terminal-text-muted)] italic whitespace-pre-wrap opacity-60 text-[11px] overflow-y-auto ${u?"max-h-[60px]":"max-h-[120px]"}`,children:[x.slice(0,u?200:500),x.length>(u?200:500)?"...":""]})]})}case"tool:start":{const x=String(t.data.name??""),f=t.data.input,g=typeof(f==null?void 0:f.command)=="string"?f.command.slice(0,80):"",y=typeof(f==null?void 0:f.file_path)=="string"?String(f.file_path):typeof(f==null?void 0:f.path)=="string"?String(f.path):"",b=y?y.split("/").pop()??"":"",v=/^(write_file|Write|edit_file|Edit)$/i.test(x),S=(m=y.match(/(?:^|\/)knowledge\/(.+\.md)$/))==null?void 0:m[1],j=v&&S&&c;return s.jsxs("div",{className:"flex items-center gap-2 py-0.5",children:[s.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] ${j?"text-green-400/80 bg-green-400/10":"text-blue-400/80 bg-blue-400/10"}`,children:j?v&&x.toLowerCase().includes("edit")?"Edit":"Write":x}),j?s.jsx("button",{onClick:()=>c(S),className:"text-[10px] text-green-400 hover:text-green-300 underline underline-offset-2 cursor-pointer truncate",style:{maxWidth:u?200:400},children:b}):s.jsxs(s.Fragment,{children:[g&&s.jsx("span",{className:`text-[var(--terminal-text-muted)] text-[10px] truncate ${u?"max-w-[200px]":"max-w-[400px]"}`,children:g}),b&&s.jsx("span",{className:`text-[var(--terminal-text-muted)] text-[10px] truncate ${u?"max-w-[200px]":"max-w-[400px]"}`,children:b})]})]})}case"dispatch:start":{const x=t.data.targetRoleId??t.data.roleId??"",f=t.data.task??"",g=t.data.childJobId,y=v0[x]??"#888";return s.jsx("div",{className:"my-1 p-2 rounded-lg border cursor-pointer hover:opacity-90 transition-opacity",style:{borderColor:`${y}44`,background:`${y}11`},onClick:()=>g&&(i==null?void 0:i(g)),children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{style:{color:y},className:"font-bold text-[11px]",children:["→"," ",x.toUpperCase()]}),s.jsx("span",{className:"text-[var(--terminal-text-secondary)] text-[10px] truncate flex-1",children:f.slice(0,u?60:100)}),g&&i&&s.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-white/10 text-[var(--terminal-text-muted)]",children:["View ","→"]})]})})}case"dispatch:done":return s.jsx("div",{className:"text-[var(--terminal-text-muted)] text-[10px] pl-3 border-l-2 border-[var(--terminal-border)] my-0.5",children:"Dispatch completed"});case"turn:complete":return s.jsx("div",{className:"border-t border-[var(--terminal-border)] my-2 relative",children:s.jsxs("span",{className:"absolute -top-2 left-2 bg-[var(--terminal-bg)] px-2 text-[9px] text-[var(--terminal-text-muted)]",children:["Turn ",t.data.turn]})});case"stderr":return s.jsxs("div",{className:"text-red-400/80 text-[11px]",children:["⚠"," ",t.data.message]});case"job:start":return s.jsxs("div",{className:"text-[var(--terminal-text-muted)] text-[10px] pb-1",children:[s.jsx("span",{style:{color:d},className:"font-bold",children:t.roleId.toUpperCase()})," ","started: ",(t.data.task??"").slice(0,u?50:80)]});case"job:done":{const x=t.data.turns??0,f=t.data.toolCalls??0;return s.jsx("div",{className:"mt-2 p-2 rounded-lg bg-green-900/20 border border-green-800/30",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-green-400"}),s.jsx("span",{className:"text-green-300 font-bold text-[11px]",children:"Complete"}),s.jsxs("span",{className:"text-[var(--terminal-text-muted)] text-[10px]",children:[x," turns · ",f," tools"]})]})})}case"job:error":return s.jsx("div",{className:"mt-2 p-2 rounded-lg bg-red-900/20 border border-red-800/30",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-red-400"}),s.jsx("span",{className:"text-red-300 font-bold text-[11px]",children:"Error"}),s.jsx("span",{className:"text-red-200/70 text-[10px]",children:t.data.message})]})});case"job:awaiting_input":{const x=t.data.question??"";return s.jsxs("div",{className:"mt-2 p-2 rounded-lg border",style:{background:"#F59E0B11",borderColor:"#F59E0B33"},children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:"#F59E0B",animation:"wave-pulse 1.5s ease-in-out infinite"}}),s.jsx("span",{className:"font-bold text-[11px]",style:{color:"#F59E0B"},children:"Awaiting Reply"})]}),x&&s.jsx("div",{className:"mt-1 text-[11px] text-[var(--terminal-text)] whitespace-pre-wrap",children:x})]})}case"job:reply":return s.jsx("div",{className:"mt-1 p-2 rounded-lg bg-blue-900/20 border border-blue-800/30",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-blue-300 font-bold text-[11px]",children:"CEO replied:"}),s.jsx("span",{className:"text-blue-200/80 text-[11px]",children:t.data.response??""})]})});case"import:scan":case"import:process":case"import:created":return s.jsxs("div",{className:"text-cyan-300/70 text-[11px]",children:["[",t.type,"] ",JSON.stringify(t.data)]});default:return null}}function oC({jobId:t,title:l,color:r,variant:i,style:c,onClose:u,onMinimize:d,onDone:m,onNavigateToJob:x,onOpenKnowledgeDoc:f}){const{events:g,status:y,textOutput:b,childJobIds:v}=V0(t),[S,j]=k.useState(0),[E,C]=k.useState(new Set),A=k.useRef(null),F=k.useRef(Date.now()),_=k.useRef(!1);k.useEffect(()=>{const Y=setInterval(()=>{j(Math.floor((Date.now()-F.current)/1e3))},1e3);return()=>clearInterval(Y)},[]),k.useEffect(()=>{A.current&&(A.current.scrollTop=A.current.scrollHeight)},[g]),k.useEffect(()=>{(y==="done"||y==="error")&&!_.current&&(_.current=!0,m==null||m())},[y,m]);const H=Y=>{C(B=>{const V=new Set(B);return V.has(Y)?V.delete(Y):V.add(Y),V})},M={idle:"Waiting",connecting:"Connecting...",streaming:"Working",done:"Complete",error:"Error"}[y],I={idle:"#888",connecting:"#888",streaming:r,done:"#2E7D32",error:"#C62828"}[y],W=Y=>`${Math.floor(Y/60)}:${String(Y%60).padStart(2,"0")}`,te=y==="done"||y==="error",D=s.jsxs("div",{className:i==="modal"?"fixed top-[5%] left-1/2 -translate-x-1/2 w-[720px] max-w-[95vw] h-[85vh] z-[61] bg-[var(--terminal-bg)] rounded-2xl shadow-2xl overflow-hidden flex flex-col":"bg-[var(--terminal-bg)] rounded-xl border border-[var(--terminal-border)] overflow-hidden flex flex-col max-h-[400px]",style:c,children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-[var(--terminal-border)] shrink-0",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-3 h-3 rounded-full animate-pulse",style:{background:I}}),s.jsx("div",{children:s.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-sm",children:l})})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs font-mono",children:W(S)}),s.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full font-semibold",style:{background:`${I}22`,color:I},children:M}),d&&i==="modal"&&s.jsx("button",{onClick:d,title:"Minimize",className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-sm cursor-pointer px-1",children:"–"}),te&&s.jsx("button",{onClick:u,className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-lg cursor-pointer",children:"×"})]})]}),s.jsxs("div",{ref:A,className:"flex-1 overflow-y-auto p-4 space-y-1 text-xs font-mono",children:[g.length===0&&y==="connecting"&&s.jsx("div",{className:"text-[var(--terminal-text-muted)]",children:"Connecting to activity stream..."}),g.map(Y=>s.jsx(mg,{event:Y,isThinkingCollapsed:E.has(Y.seq),onToggleThinking:()=>H(Y.seq),onNavigateToJob:x,onOpenKnowledgeDoc:f},Y.seq)),y==="streaming"&&s.jsx("span",{className:"inline-block w-2 h-4 bg-green-400 animate-pulse ml-0.5"})]}),s.jsxs("div",{className:"px-5 py-3 border-t border-[var(--terminal-border)] flex items-center justify-between shrink-0",children:[s.jsxs("div",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:[g.length>0&&`${g.length} events`,b.length>0&&` · ${b.length} chars`,v.length>0&&` · ${v.length} dispatches`]}),te&&s.jsx("button",{onClick:u,className:"px-4 py-1.5 text-xs text-white rounded-lg font-semibold cursor-pointer",style:{background:r},children:"Close"})]})]});return i==="modal"?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:te?u:void 0}),D]}):D}const wf={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};function cC({orgNodes:t,rootId:l}){const r=t[l];if(!r)return null;const c=r.children.map(m=>t[m]).filter(Boolean),u=[];for(const m of c)for(const x of m.children){const f=t[x];f&&u.push({node:f,parentId:m.id})}const d=c.length+u.length;return s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Propagation Preview"}),s.jsxs("div",{className:"bg-white/5 border border-white/10 rounded-lg p-4",children:[s.jsx("div",{className:"flex justify-center mb-2",children:s.jsx("span",{className:"px-3 py-1 text-[10px] font-bold rounded border-2 border-white/20 bg-white/5 text-white/30 uppercase",children:"CEO"})}),c.length>0&&s.jsx("div",{className:"flex justify-center mb-1",children:s.jsx("div",{className:"w-px h-3 bg-white/15"})}),c.length>1&&s.jsx("div",{className:"flex justify-center mb-1",children:s.jsx("div",{className:"h-px bg-white/15",style:{width:`${Math.min(c.length*80,320)}px`}})}),s.jsx("div",{className:"flex justify-center gap-3 mb-2 flex-wrap",children:c.map(m=>s.jsxs("div",{className:"flex flex-col items-center",children:[s.jsx("span",{className:"px-2.5 py-1 text-[10px] font-bold rounded border-2 uppercase",style:{borderColor:wf[m.id]??"#888",color:wf[m.id]??"#888",background:`${wf[m.id]??"#888"}22`},children:m.id}),s.jsx("span",{className:"text-[8px] text-white/30 mt-0.5",children:"direct"})]},m.id))}),u.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex justify-center mb-1",children:s.jsx("div",{className:"w-px h-2 bg-white/10"})}),s.jsx("div",{className:"flex justify-center gap-2 flex-wrap",children:u.map(({node:m})=>s.jsx("span",{className:"px-2 py-0.5 text-[9px] font-semibold rounded border border-white/15 text-white/40 uppercase",children:m.id},m.id))}),s.jsx("div",{className:"text-center text-[8px] text-white/30 mt-1",children:"via re-dispatch"})]})]}),s.jsxs("div",{className:"text-[10px] text-gray-400 mt-1.5",children:[d," role",d!==1?"s":""," will receive this wave"]})]})}function uC({cLevelRoles:t,orgNodes:l,rootId:r,onClose:i,onDispatch:c}){const[u,d]=k.useState(""),m=k.useRef(null);k.useEffect(()=>{var y;(y=m.current)==null||y.focus()},[]);const x=()=>{!u.trim()||t.length===0||(c(u.trim()),i())},f=y=>{y.key==="Enter"&&(y.metaKey||y.ctrlKey)&&x(),y.key==="Escape"&&i()},g=r&&Object.keys(l).length>0;return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:i}),s.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[560px] z-[61] bg-[var(--wall)] rounded-2xl shadow-2xl overflow-hidden",children:[s.jsxs("div",{className:"p-5 text-white",style:{background:"linear-gradient(135deg, #B71C1C, #D32F2F)"},children:[s.jsx("div",{className:"text-lg font-bold",children:"CEO Wave"}),s.jsx("div",{className:"text-sm opacity-80 mt-0.5",children:"Broadcast a directive to all C-Level reports"})]}),s.jsxs("div",{className:"p-5 space-y-4",children:[g&&s.jsx(cC,{orgNodes:l,rootId:r}),!g&&s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Dispatching to"}),s.jsx("div",{className:"flex gap-2 flex-wrap",children:t.length>0?t.map(y=>s.jsxs("span",{className:"px-3 py-1.5 text-xs font-semibold rounded-lg border-2 border-red-200 bg-red-50 text-red-800",children:[y.id.toUpperCase()," · ",y.name]},y.id)):s.jsx("span",{className:"text-xs text-gray-400 italic",children:"No C-Level roles found"})}),s.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"Each C-Level receives the directive and delegates to their reports"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Directive"}),s.jsx("textarea",{ref:m,value:u,onChange:y=>d(y.target.value),onKeyDown:f,placeholder:"e.g. Report current status across all departments",className:"w-full h-28 p-3 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 placeholder-white/25 resize-none focus:outline-none focus:border-white/25 transition-colors"}),s.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"Cmd+Enter to dispatch"})]})]}),s.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[s.jsx("button",{onClick:i,className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer",children:"Cancel"}),s.jsxs("button",{onClick:x,disabled:!u.trim()||t.length===0,className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#B71C1C"},children:["Dispatch to ",t.length," Role",t.length!==1?"s":""]})]})]})]})}function dC(t,l,r){const[i,c]=k.useState(new Map),[u,d]=k.useState(null),m=k.useRef(new Map),x=k.useRef(i);x.current=i,k.useEffect(()=>{if(!r||Object.keys(l).length===0)return;const b=new Map,v=j=>{const E=l[j];E&&(b.set(j,{jobId:null,roleId:j,roleName:E.name,children:E.children,status:"waiting",events:[],streamStatus:"idle"}),E.children.forEach(v))},S=l[r];S&&(b.set(r,{jobId:null,roleId:r,roleName:"CEO",children:S.children,status:"not-dispatched",events:[],streamStatus:"idle"}),S.children.forEach(v));for(const j of t){const E=b.get(j.roleId);E&&(E.jobId=j.jobId,E.status="running",E.streamStatus="connecting")}c(b),t.length>0&&d(t[0].roleId)},[t,l,r]);const f=k.useCallback((b,v)=>{const S=m.current.get(b);S&&S.controller.abort();const j=new AbortController,E={controller:j,lastSeq:-1};m.current.set(b,E);const A=`/api/jobs/${b}/stream?from=0`;fetch(A,{signal:j.signal}).then(async F=>{if(!F.ok||!F.body){c(I=>{const W=new Map(I),te=W.get(v);return te&&W.set(v,{...te,streamStatus:"error"}),W});return}c(I=>{const W=new Map(I),te=W.get(v);return te&&W.set(v,{...te,streamStatus:"streaming",status:"running"}),W});const _=F.body.getReader(),H=new TextDecoder;let M="";for(;;){const{done:I,value:W}=await _.read();if(I)break;M+=H.decode(W,{stream:!0});const te=M.split(`
|
|
81
|
-
`);M=te.pop()??"";let D="";for(const Y of te)if(Y.startsWith("event: "))D=Y.slice(7).trim();else if(Y.startsWith("data: ")){try{const B=JSON.parse(Y.slice(6));if(D==="activity"){const V=B;V.seq>E.lastSeq&&(E.lastSeq=V.seq),c(ne=>{const G=new Map(ne),L=G.get(v);if(!L||L.events.some(de=>de.seq===V.seq))return ne;const Z={...L,events:[...L.events,V]};if(V.type==="dispatch:start"&&V.data.childJobId){const de=V.data.childJobId,ue=V.data.targetRoleId??V.data.roleId;if(ue){const z=G.get(ue);z&&(G.set(ue,{...z,jobId:de,status:"running",streamStatus:"connecting"}),setTimeout(()=>f(de,ue),0))}}return V.type==="job:done"?(Z.status="done",Z.streamStatus="done"):V.type==="job:error"?(Z.status="error",Z.streamStatus="error"):V.type==="job:awaiting_input"?(Z.status="awaiting_input",Z.streamStatus="done"):V.type==="job:reply"&&(Z.status="running",Z.streamStatus="streaming"),G.set(v,Z),G})}else if(D==="stream:end"){const V=B.reason;c(ne=>{const G=new Map(ne),L=G.get(v);if(!L)return ne;const Z=V==="error"?"error":V==="awaiting_input"?"awaiting_input":"done";return G.set(v,{...L,status:L.status==="running"?Z:L.status,streamStatus:Z==="error"?"error":"done"}),G})}}catch{}D=""}}}).catch(F=>{F.name!=="AbortError"&&c(_=>{const H=new Map(_),M=H.get(v);return M&&H.set(v,{...M,streamStatus:"error"}),H})})},[]);k.useEffect(()=>{if(t.length!==0){for(const b of t)f(b.jobId,b.roleId);return()=>{for(const[,b]of m.current)b.controller.abort();m.current.clear()}}},[t,f]);const g=(()=>{let b=0,v=0,S=0,j=0;for(const[E,C]of i)E!==r&&(j++,C.status==="done"?b++:C.status==="running"?v++:C.status==="awaiting_input"&&S++);return{done:b,total:j,running:v,awaitingInput:S}})(),y=g.total>0&&g.running===0&&g.awaitingInput===0&&Array.from(i.values()).every(b=>b.status!=="running"&&b.status!=="awaiting_input"&&b.streamStatus!=="streaming"&&b.streamStatus!=="connecting");return k.useEffect(()=>{y&&c(b=>{const v=new Map(b);let S=!1;for(const[j,E]of v)E.status==="waiting"&&(v.set(j,{...E,status:"not-dispatched"}),S=!0);return S?v:b})},[y]),{nodes:i,selectedRoleId:u,selectNode:d,progress:g,allDone:y,connectStream:f}}const w0={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},ba=120,ir=44,k0=80;function fC(t,l){if(!t.get(l))return{layout:[],width:300,height:200};const i=[],c=[],u=[{id:l,depth:0,parentId:null}],d=new Set;for(;u.length>0;){const{id:g,depth:y,parentId:b}=u.shift();if(d.has(g))continue;for(d.add(g);c.length<=y;)c.push([]);c[y].push(g),i.push({roleId:g,x:0,y:y*k0+20,parentId:b});const v=t.get(g);if(v)for(const S of v.children)t.has(S)&&!d.has(S)&&u.push({id:S,depth:y+1,parentId:g})}const m=Math.max(...c.map(g=>g.length))*(ba+16),x=Math.max(m,280);for(const g of c){const y=g.length*(ba+16)-16,b=(x-y)/2;g.forEach((v,S)=>{const j=i.find(E=>E.roleId===v);j&&(j.x=b+S*(ba+16))})}const f=c.length*k0+40;return{layout:i,width:x,height:f}}function hC({nodes:t,rootId:l,selectedRoleId:r,onSelectNode:i}){const{layout:c,width:u,height:d}=fC(t,l),m=f=>{const g=c.find(y=>y.roleId===f);return g?{cx:g.x+ba/2,cy:g.y+ir/2}:{cx:0,cy:0}},x=f=>{switch(f.status){case"running":return w0[f.roleId]??"#FBBF24";case"awaiting_input":return"#F59E0B";case"done":return"#2E7D32";case"error":return"#C62828";case"not-dispatched":return"#666";default:return"#888"}};return s.jsxs("svg",{viewBox:`0 0 ${u} ${d}`,width:"100%",height:"100%",className:"block",children:[s.jsx("defs",{children:s.jsxs("filter",{id:"glow",children:[s.jsx("feGaussianBlur",{stdDeviation:"2",result:"blur"}),s.jsxs("feMerge",{children:[s.jsx("feMergeNode",{in:"blur"}),s.jsx("feMergeNode",{in:"SourceGraphic"})]})]})}),c.filter(f=>f.parentId).map(f=>{const g=m(f.parentId),y=m(f.roleId),b=t.get(f.roleId),v=t.get(f.parentId);let S="rgba(180,200,240,0.15)",j="4 4",E="";return(b==null?void 0:b.status)==="done"||(v==null?void 0:v.status)==="done"?(S="#2E7D3266",j=""):(b==null?void 0:b.status)==="awaiting_input"?(S="#F59E0B",j="6 4",E="wave-edge-flow"):(b==null?void 0:b.status)==="running"&&(S=w0[f.roleId]??"#FBBF24",j="6 4",E="wave-edge-flow"),s.jsx("line",{x1:g.cx,y1:g.cy+ir/2-4,x2:y.cx,y2:y.cy-ir/2+4,stroke:S,strokeWidth:1.5,strokeDasharray:j,className:E},`${f.parentId}-${f.roleId}`)}),c.map(f=>{const g=t.get(f.roleId);if(!g)return null;const y=x(g),b=r===f.roleId,v=f.roleId===l,S=v?.4:g.status==="not-dispatched"?.35:1;return s.jsxs("g",{transform:`translate(${f.x}, ${f.y})`,style:{cursor:v?"default":"pointer",opacity:S},onClick:()=>!v&&i(f.roleId),children:[s.jsx("rect",{x:0,y:0,width:ba,height:ir,rx:8,ry:8,fill:"var(--terminal-bg-deeper, #181825)",stroke:b?"#fff":y,strokeWidth:b?2:1.5,strokeDasharray:g.status==="not-dispatched"?"4 3":""}),s.jsx("circle",{cx:14,cy:ir/2,r:4,fill:y,filter:g.status==="running"||g.status==="awaiting_input"?"url(#glow)":void 0,children:(g.status==="running"||g.status==="awaiting_input")&&s.jsx("animate",{attributeName:"opacity",values:"1;0.4;1",dur:"1.5s",repeatCount:"indefinite"})}),s.jsx("text",{x:26,y:ir/2-4,fill:"var(--terminal-text, #fff)",fontSize:10,fontWeight:700,fontFamily:"var(--pixel-font)",children:g.roleId.toUpperCase()}),s.jsx("text",{x:26,y:ir/2+10,fill:"var(--terminal-text-muted, #888)",fontSize:8,fontFamily:"var(--pixel-font)",children:g.status==="running"?"Working...":g.status==="awaiting_input"?"Awaiting Reply":g.status==="done"?"Complete":g.status==="error"?"Error":g.status==="waiting"?"Waiting":""}),g.status==="done"&&s.jsx("text",{x:ba-18,y:ir/2+4,fontSize:14,fill:"#2E7D32",children:"✓"}),g.status==="error"&&s.jsx("text",{x:ba-18,y:ir/2+4,fontSize:14,fill:"#C62828",children:"✗"})]},f.roleId)})]})}const mC={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};function xC({directive:t,rootJobs:l,orgNodes:r,rootRoleId:i,onClose:c,onMinimize:u,onDone:d,onOpenKnowledgeDoc:m}){const{nodes:x,selectedRoleId:f,selectNode:g,progress:y,allDone:b,connectStream:v}=dC(l,r,i),[S,j]=k.useState(0),[E,C]=k.useState(new Set),[A,F]=k.useState(""),[_,H]=k.useState(!1),M=k.useRef(null),I=k.useRef(Date.now()),W=k.useRef(!1),te=k.useCallback(async()=>{if(!f||!A.trim())return;const L=x.get(f);if(!(!(L!=null&&L.jobId)||L.status!=="awaiting_input")){H(!0);try{const{jobId:Z}=await Ce.replyToJob(L.jobId,A.trim());F(""),v(Z,f)}catch(Z){console.error("Reply failed:",Z)}finally{H(!1)}}},[f,A,x,v]),D=k.useCallback(async L=>{const Z=x.get(L);if(Z!=null&&Z.jobId)try{await Ce.abortJob(Z.jobId)}catch(de){console.error("Abort failed:",de)}},[x]),Y=k.useCallback(async()=>{for(const[,L]of x)if((L.status==="running"||L.status==="awaiting_input")&&L.jobId)try{await Ce.abortJob(L.jobId)}catch{}},[x]);k.useEffect(()=>{const L=setInterval(()=>{j(Math.floor((Date.now()-I.current)/1e3))},1e3);return()=>clearInterval(L)},[]),k.useEffect(()=>{M.current&&(M.current.scrollTop=M.current.scrollHeight)},[f,x]),k.useEffect(()=>{b&&!W.current&&(W.current=!0,d==null||d())},[b,d]);const B=L=>`${Math.floor(L/60)}:${String(L%60).padStart(2,"0")}`,V=f?x.get(f):null,ne=f?mC[f]??"#888":"#888",G=L=>{C(Z=>{const de=new Set(Z);return de.has(L)?de.delete(L):de.add(L),de})};return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:b?c:void 0}),s.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[960px] max-w-[95vw] h-[85vh] z-[61] bg-[var(--terminal-bg)] rounded-2xl shadow-2xl overflow-hidden flex flex-col",children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-[var(--terminal-border)] shrink-0",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-3 h-3 rounded-full",style:{background:b?"#2E7D32":"#B71C1C",animation:b?void 0:"wave-pulse 2s ease-in-out infinite"}}),s.jsx("div",{children:s.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-sm",children:b?"WAVE COMPLETE":"WAVE COMMAND CENTER"})})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs font-mono",children:B(S)}),y.awaitingInput>0&&s.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full font-semibold",style:{background:"#F59E0B22",color:"#F59E0B"},children:[y.awaitingInput," awaiting reply"]}),s.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full font-semibold",style:{background:b?"#2E7D3222":"#B71C1C22",color:b?"#2E7D32":"#B71C1C"},children:[y.done,"/",y.total," done"]}),!b&&(y.running>0||y.awaitingInput>0)&&s.jsx("button",{onClick:Y,className:"text-xs px-2 py-0.5 rounded font-semibold cursor-pointer",style:{background:"#C6282822",color:"#C62828",border:"1px solid #C6282844"},title:"Stop all running jobs",children:"Stop All"}),s.jsx("button",{onClick:u,title:"Minimize",className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-sm cursor-pointer px-1",children:"–"}),b&&s.jsx("button",{onClick:c,className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-lg cursor-pointer",children:"×"})]})]}),s.jsx("div",{className:"px-5 py-2 border-b border-[var(--terminal-border)] shrink-0",children:s.jsxs("span",{className:"text-[var(--terminal-text-secondary)] text-xs italic",children:["“",t,"”"]})}),s.jsxs("div",{className:"flex flex-1 min-h-0",children:[s.jsxs("div",{className:"w-[280px] shrink-0 border-r border-[var(--terminal-border)] flex flex-col",children:[s.jsx("div",{className:"px-3 py-2 border-b border-[var(--terminal-border)]",children:s.jsx("span",{className:"text-[10px] font-bold text-[var(--terminal-text-secondary)] uppercase tracking-wider",children:"Org Propagation"})}),s.jsx("div",{className:"flex-1 overflow-auto p-3",children:s.jsx(hC,{nodes:x,rootId:i,selectedRoleId:f,onSelectNode:g})}),s.jsx("div",{className:"px-3 py-2 border-t border-[var(--terminal-border)] flex flex-wrap gap-x-3 gap-y-1",children:[{label:"running",color:"#FBBF24",dot:!0},{label:"awaiting",color:"#F59E0B",dot:!0},{label:"done",color:"#2E7D32",dot:!1},{label:"waiting",color:"#888",dot:!1},{label:"error",color:"#C62828",dot:!1}].map(L=>s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"w-2 h-2 rounded-full inline-block",style:{background:L.color,animation:L.dot?"wave-pulse 1.5s ease-in-out infinite":void 0}}),s.jsx("span",{className:"text-[8px] text-[var(--terminal-text-muted)]",children:L.label})]},L.label))})]}),s.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[V&&s.jsxs("div",{className:"px-4 py-2 border-b border-[var(--terminal-border)] shrink-0 flex items-center gap-2",children:[s.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:ne}}),s.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-xs",children:V.roleId.toUpperCase()}),s.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs",children:V.roleName}),s.jsx("span",{className:"ml-auto text-[10px] px-2 py-0.5 rounded-full font-semibold",style:{background:V.status==="awaiting_input"?"#F59E0B22":`${ne}22`,color:V.status==="awaiting_input"?"#F59E0B":ne},children:V.status==="running"?"Working":V.status==="done"?"Complete":V.status==="error"?"Error":V.status==="waiting"?"Waiting":V.status==="awaiting_input"?"Awaiting Reply":"Not dispatched"}),(V.status==="running"||V.status==="awaiting_input")&&V.jobId&&s.jsx("button",{onClick:()=>D(V.roleId),className:"text-[10px] px-2 py-0.5 rounded font-semibold cursor-pointer ml-1",style:{background:"#C6282822",color:"#C62828",border:"1px solid #C6282844"},title:"Force stop this job",children:"Stop"})]}),s.jsxs("div",{ref:M,className:"flex-1 overflow-y-auto p-4 space-y-1 text-xs font-mono",children:[V&&V.events.length===0&&s.jsx("div",{className:"text-[var(--terminal-text-muted)]",children:V.status==="waiting"?"Waiting for dispatch...":V.status==="running"?"Connecting to activity stream...":V.status==="not-dispatched"?"This role was not dispatched in this wave.":""}),V==null?void 0:V.events.map(L=>s.jsx(mg,{event:L,isThinkingCollapsed:E.has(L.seq),onToggleThinking:()=>G(L.seq),onNavigateToJob:Z=>{for(const[,de]of x)if(de.jobId===Z){g(de.roleId);return}},onOpenKnowledgeDoc:m},L.seq)),(V==null?void 0:V.status)==="running"&&s.jsx("span",{className:"inline-block w-2 h-4 bg-green-400 animate-pulse ml-0.5"})]}),(V==null?void 0:V.status)==="awaiting_input"&&s.jsxs("div",{className:"px-4 py-3 border-t border-[var(--terminal-border)] shrink-0",style:{background:"#F59E0B0A"},children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx("span",{className:"w-2 h-2 rounded-full inline-block",style:{background:"#F59E0B",animation:"wave-pulse 1.5s ease-in-out infinite"}}),s.jsxs("span",{className:"text-[11px] font-semibold",style:{color:"#F59E0B"},children:[V.roleName," is waiting for your response"]})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{type:"text",value:A,onChange:L=>F(L.target.value),onKeyDown:L=>{L.key==="Enter"&&!L.shiftKey&&(L.preventDefault(),te())},placeholder:"Type your response...",disabled:_,className:"flex-1 px-3 py-1.5 text-xs rounded border bg-[var(--terminal-bg)] text-[var(--terminal-text)] border-[var(--terminal-border)] outline-none focus:border-[#F59E0B]",autoFocus:!0}),s.jsx("button",{onClick:te,disabled:_||!A.trim(),className:"px-4 py-1.5 text-xs rounded font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#F59E0B",color:"#000"},children:_?"...":"Reply"})]})]}),!V&&s.jsx("div",{className:"flex-1 flex items-center justify-center text-[var(--terminal-text-muted)] text-xs",children:"Click a node in the org tree to view activity"}),s.jsxs("div",{className:"px-4 py-2 border-t border-[var(--terminal-border)] flex items-center justify-between shrink-0",children:[s.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:V&&V.events.length>0&&`${V.events.length} events`}),b&&s.jsx("button",{onClick:c,className:"px-4 py-1.5 text-xs text-white rounded-lg font-semibold cursor-pointer",style:{background:"#2E7D32"},children:"Close"})]})]})]})]})]})}const pC={cto:{skinColor:"#F5CBA7",hairColor:"#2C1810",shirtColor:"#1565C0",pantsColor:"#37474F",shoeColor:"#212121",hairStyle:"short",outfitStyle:"tshirt",accessory:"glasses"},cbo:{skinColor:"#FDEBD0",hairColor:"#1A0A00",shirtColor:"#E65100",pantsColor:"#37474F",shoeColor:"#1A1A1A",hairStyle:"slicked",outfitStyle:"suit",accessory:"lapels"},pm:{skinColor:"#FDEBD0",hairColor:"#6D4C41",shirtColor:"#2E7D32",pantsColor:"#37474F",shoeColor:"#212121",hairStyle:"bun",outfitStyle:"tshirt",accessory:"blush"},engineer:{skinColor:"#F5CBA7",hairColor:"#1A1A1A",shirtColor:"#4A148C",pantsColor:"#37474F",shoeColor:"#7B1FA2",hairStyle:"messy",outfitStyle:"hoodie",accessory:"headphones"},designer:{skinColor:"#FDEBD0",hairColor:"#AD1457",shirtColor:"#AD1457",pantsColor:"#37474F",shoeColor:"#212121",hairStyle:"bob",outfitStyle:"tshirt",accessory:"beret"},qa:{skinColor:"#F5CBA7",hairColor:"#4E342E",shirtColor:"#00695C",pantsColor:"#37474F",shoeColor:"#212121",hairStyle:"short",outfitStyle:"tshirt",accessory:"badge"},"data-analyst":{skinColor:"#F5CBA7",hairColor:"#3E2723",shirtColor:"#0277BD",pantsColor:"#37474F",shoeColor:"#212121",hairStyle:"curly",outfitStyle:"vest",accessory:"none"}};function Nh(t){return pC[t]??{skinColor:"#B0BEC5",hairColor:"#78909C",shirtColor:"#607D8B",pantsColor:"#455A64",shoeColor:"#37474F"}}const xg=["#FDEBD0","#F5CBA7","#D4A07A","#C68642","#8D5524","#5C3A1E","#F3D1C7","#E8BEAC","#B07D62","#704214"],pg=["#1A0A00","#2C1810","#4E342E","#6D4C41","#8D6E63","#D4A574","#F5E6CA","#FFD700","#B71C1C","#AD1457","#4A148C","#1A237E","#004D40","#1A1A1A","#78909C","#E0E0E0"],yg=["#1565C0","#E65100","#2E7D32","#4A148C","#AD1457","#00695C","#D32F2F","#F57F17","#1B5E20","#283593","#4E342E","#37474F","#880E4F","#00838F","#6A1B9A","#FF6F00"],gg=["#37474F","#1A237E","#3E2723","#263238","#1B5E20","#455A64","#212121","#4E342E","#0D47A1","#311B92"],bg=["#212121","#1A1A1A","#37474F","#4E342E","#7B1FA2","#D32F2F","#1565C0","#F57F17","#2E7D32","#FFFFFF"],Gr={default:{name:"MIDNIGHT",icon:"🌃",vars:{"--floor-light":"#0d1117","--floor-dark":"#0a0e14","--hud-bg":"#0d1117","--hud-bg-alt":"#161b22","--pixel-border":"#30363d","--terminal-bg":"#0d1117","--terminal-border":"#21262d","--terminal-border-hover":"#388bfd","--terminal-text":"#e6edf3","--terminal-text-secondary":"#8b949e","--terminal-text-muted":"#484f58","--accent":"#388bfd","--active-green":"#3fb950","--idle-amber":"#d29922"}},light:{name:"DAYLIGHT",icon:"☀️",vars:{"--floor-light":"#f6f8fa","--floor-dark":"#eaeef2","--hud-bg":"#24292f","--hud-bg-alt":"#32383f","--pixel-border":"#d0d7de","--terminal-bg":"#ffffff","--terminal-border":"#d0d7de","--terminal-border-hover":"#0969da","--terminal-text":"#1f2328","--terminal-text-secondary":"#656d76","--terminal-text-muted":"#8c959f","--accent":"#0969da","--active-green":"#1a7f37","--idle-amber":"#9a6700"}},retro:{name:"RETRO",icon:"🎮",vars:{"--floor-light":"#1a1410","--floor-dark":"#140f0a","--hud-bg":"#1a1410","--hud-bg-alt":"#2a2018","--pixel-border":"#5c4a32","--terminal-bg":"#1a1410","--terminal-border":"#3a2e20","--terminal-border-hover":"#d4a44e","--terminal-text":"#e8d5b0","--terminal-text-secondary":"#a08860","--terminal-text-muted":"#6b5840","--accent":"#d4a44e","--active-green":"#8bba4a","--idle-amber":"#e8a030"}},cyberpunk:{name:"NEON",icon:"🌌",vars:{"--floor-light":"#0a0014","--floor-dark":"#06000e","--hud-bg":"#0a0014","--hud-bg-alt":"#14002a","--pixel-border":"#4a1a80","--terminal-bg":"#0a0014","--terminal-border":"#2a0a50","--terminal-border-hover":"#e040fb","--terminal-text":"#e0d0ff","--terminal-text-secondary":"#9070c0","--terminal-text-muted":"#5a3a80","--accent":"#e040fb","--active-green":"#00ff88","--idle-amber":"#ffab00"}},forest:{name:"FOREST",icon:"🌲",vars:{"--floor-light":"#0a1410","--floor-dark":"#060e0a","--hud-bg":"#0a1410","--hud-bg-alt":"#142a1e","--pixel-border":"#2a5a3a","--terminal-bg":"#0a1410","--terminal-border":"#1a3a26","--terminal-border-hover":"#4ade80","--terminal-text":"#d0f0d8","--terminal-text-secondary":"#70a880","--terminal-text-muted":"#3a6848","--accent":"#4ade80","--active-green":"#86efac","--idle-amber":"#fcd34d"}},ocean:{name:"OCEAN",icon:"🌊",vars:{"--floor-light":"#0a1420","--floor-dark":"#060e18","--hud-bg":"#0a1420","--hud-bg-alt":"#142a40","--pixel-border":"#1e4a6a","--terminal-bg":"#0a1420","--terminal-border":"#163050","--terminal-border-hover":"#38bdf8","--terminal-text":"#d0e8f8","--terminal-text-secondary":"#6090b0","--terminal-text-muted":"#305070","--accent":"#38bdf8","--active-green":"#34d399","--idle-amber":"#fbbf24"}}};function yC({color:t,selected:l,onClick:r}){return s.jsx("button",{onClick:r,className:"customize-swatch",style:{background:t,outline:l?"2px solid #fff":"2px solid transparent",boxShadow:l?`0 0 0 1px ${t}, 0 0 6px ${t}88`:"none"}})}function ks({label:t,presets:l,value:r,onChange:i}){return s.jsxs("div",{className:"customize-row",children:[s.jsxs("div",{className:"customize-row-header",children:[s.jsx("span",{className:"customize-row-label",children:t}),s.jsx("div",{className:"customize-row-current",style:{background:r}})]}),s.jsx("div",{className:"customize-swatches",children:l.map(c=>s.jsx(yC,{color:c,selected:c===r,onClick:()=>i(c)},c))})]})}function kf({label:t,items:l,value:r,onChange:i,lockInfo:c}){return s.jsxs("div",{className:"customize-row",children:[s.jsx("div",{className:"customize-row-header",children:s.jsx("span",{className:"customize-row-label",children:t})}),s.jsx("div",{className:"customize-swatches",style:{gap:4},children:l.map(u=>{const d=c?c.getLockLevel(u.id):1,m=u.id===r,x=c?d>c.roleLevel&&!m:!1,f=c?m&&d>c.roleLevel:!1;return s.jsxs("button",{onClick:()=>{x||i(u.id===r?void 0:u.id)},className:"customize-swatch",style:{width:"auto",height:"auto",padding:x?"2px 6px 10px 6px":"2px 6px",fontSize:9,fontFamily:"var(--font-pixel, monospace)",background:m?"rgba(255,255,255,0.15)":x?"rgba(255,255,255,0.02)":"rgba(255,255,255,0.04)",outline:m?f?"2px solid #F59E0B":"2px solid #fff":"2px solid transparent",color:x?"rgba(255,255,255,0.25)":m?"#fff":"rgba(255,255,255,0.5)",borderRadius:4,cursor:x?"not-allowed":"pointer",opacity:x?.35:1,position:"relative"},children:[u.name,x&&s.jsxs("span",{style:{position:"absolute",bottom:1,left:"50%",transform:"translateX(-50%)",fontSize:8,color:"rgba(255,255,255,0.5)",whiteSpace:"nowrap"},children:["🔒"," Lv.",d]}),f&&s.jsxs("span",{style:{position:"absolute",bottom:-8,left:"50%",transform:"translateX(-50%)",fontSize:7,color:"#F59E0B",whiteSpace:"nowrap"},children:["⚠"," Lv.",d]})]},u.id)})})]})}function jf({label:t,active:l,onClick:r}){return s.jsx("button",{onClick:r,style:{flex:1,padding:"6px 0",fontSize:10,fontFamily:"var(--font-pixel, monospace)",fontWeight:"bold",letterSpacing:1,background:l?"rgba(255,255,255,0.08)":"transparent",color:l?"#fff":"rgba(255,255,255,0.35)",border:"none",borderBottom:l?"2px solid #3B82F6":"2px solid transparent",cursor:"pointer",transition:"all 0.15s"},children:t})}function Ir(t){return t[Math.floor(Math.random()*t.length)]}function fi(t){var c,u,d;const l=ng(),r=lg(),i=rg().filter(m=>!t||ig(m.id,t));return{skinColor:Ir(xg),hairColor:Ir(pg),shirtColor:Ir(yg),pantsColor:Ir(gg),shoeColor:Ir(bg),hairStyle:(c=Ir(l))==null?void 0:c.id,outfitStyle:(u=Ir(r))==null?void 0:u.id,accessory:(d=Ir(i))==null?void 0:d.id}}function vg({roleId:t,appearance:l,onChange:r,onRandomize:i,onReset:c,label:u,roleLevel:d}){const[m,x]=k.useState("look"),f=k.useCallback((E,C)=>{r({...l,[E]:C})},[l,r]),g=k.useRef(null),y=k.useCallback(E=>{var F;const C=(F=E.target.files)==null?void 0:F[0];if(!C)return;const A=new Image;A.onload=()=>{const _=Hj(A);r({..._,hairStyle:l.hairStyle,outfitStyle:l.outfitStyle,accessory:l.accessory}),URL.revokeObjectURL(A.src)},A.src=URL.createObjectURL(C),E.target.value=""},[l.hairStyle,l.outfitStyle,l.accessory,r]),b=ng(),v=lg(),S=rg(),j=d!==void 0?S.filter(E=>ig(E.id,d)).length:S.length;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"customize-preview",children:[s.jsx("div",{className:"customize-preview-bg",children:s.jsx(_s,{roleId:t,appearance:l,scale:12})}),u&&s.jsx("div",{className:"customize-preview-name",children:u}),s.jsxs("div",{className:"customize-preview-actions",children:[s.jsx("button",{className:"customize-btn customize-btn--random",onClick:i,children:"RANDOM"}),s.jsx("button",{className:"customize-btn customize-btn--reset",onClick:c,children:"RESET"}),s.jsx("button",{className:"customize-btn",onClick:()=>{var E;return(E=g.current)==null?void 0:E.click()},style:{fontSize:9,opacity:.7},children:"PHOTO"}),s.jsx("input",{ref:g,type:"file",accept:"image/*",onChange:y,style:{display:"none"}})]})]}),s.jsxs("div",{className:"customize-colors",children:[s.jsxs("div",{style:{display:"flex",borderBottom:"1px solid rgba(255,255,255,0.06)",marginBottom:4},children:[s.jsx(jf,{label:"LOOK",active:m==="look",onClick:()=>x("look")}),s.jsx(jf,{label:"OUTFIT",active:m==="outfit",onClick:()=>x("outfit")}),s.jsx(jf,{label:"ACCESSORY",active:m==="accessory",onClick:()=>x("accessory")})]}),m==="look"&&s.jsxs(s.Fragment,{children:[s.jsx(ks,{label:"SKIN",presets:xg,value:l.skinColor,onChange:E=>f("skinColor",E)}),s.jsx(ks,{label:"HAIR COLOR",presets:pg,value:l.hairColor,onChange:E=>f("hairColor",E)}),s.jsx(kf,{label:"HAIR STYLE",items:b,value:l.hairStyle,onChange:E=>f("hairStyle",E)})]}),m==="outfit"&&s.jsxs(s.Fragment,{children:[s.jsx(kf,{label:"STYLE",items:v,value:l.outfitStyle,onChange:E=>f("outfitStyle",E)}),s.jsx(ks,{label:"TOP",presets:yg,value:l.shirtColor,onChange:E=>f("shirtColor",E)}),s.jsx(ks,{label:"PANTS",presets:gg,value:l.pantsColor,onChange:E=>f("pantsColor",E)}),s.jsx(ks,{label:"SHOES",presets:bg,value:l.shoeColor,onChange:E=>f("shoeColor",E)})]}),m==="accessory"&&s.jsxs(s.Fragment,{children:[d!==void 0&&s.jsxs("div",{style:{padding:"4px 8px",marginBottom:4,background:"rgba(255,255,255,0.04)",borderRadius:4,fontSize:9,fontFamily:"var(--font-pixel, monospace)",color:"rgba(255,255,255,0.5)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[s.jsxs("span",{children:["Lv.",d]}),s.jsxs("span",{children:[j,"/",S.length," unlocked"]})]}),s.jsx(kf,{label:"ACCESSORY",items:S,value:l.accessory,onChange:E=>f("accessory",E),lockInfo:d!==void 0?{roleLevel:d,getLockLevel:ag}:void 0}),s.jsx("div",{style:{marginTop:12,padding:"8px 10px",background:"rgba(255,255,255,0.03)",borderRadius:6,border:"1px dashed rgba(255,255,255,0.08)",color:"rgba(255,255,255,0.25)",fontSize:9,fontFamily:"var(--font-pixel, monospace)",textAlign:"center"},children:d!==void 0&&d<10?"Level up to unlock more accessories":"More accessories coming soon"})]})]})]})}const gC=[{value:"c-level",label:"C-Level"},{value:"team-lead",label:"Team Lead"},{value:"member",label:"Member"}];function Jf(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,24)}function Sf(t){switch(t){case"c-level":return{authority:{autonomous:["Strategic decisions within domain","Task delegation to reports"],needsApproval:["Budget over $5K","External commitments"]},knowledge:{reads:["company/","operations/","projects/"],writes:["operations/","knowledge/"]},reports:{daily:"standup",weekly:"summary"}};case"team-lead":return{authority:{autonomous:["Task planning","Sprint management"],needsApproval:["Architecture changes","New tool adoption"]},knowledge:{reads:["projects/","architecture/"],writes:["projects/"]},reports:{daily:"standup",weekly:"summary"}};default:return{authority:{autonomous:["Implementation within assigned tasks"],needsApproval:["Design changes","New dependencies"]},knowledge:{reads:["projects/"],writes:[]},reports:{daily:"standup",weekly:""}}}}const js=4;function bC(t,l,r){const i=t.trim();if(!i||i.startsWith("#"))return null;const c=i.split(",").map(y=>y.trim()),u=c[0];if(!u)return null;const d=Jf(u),m=(c[1]||"member").toLowerCase(),x=m==="c-level"?"c-level":m==="team-lead"?"team-lead":"member",f=c[2]||"ceo";let g;return l.has(d)?g="ID already exists":r.has(d)&&(g="Duplicate ID in batch"),r.add(d),{name:u,id:d,level:x,reportsTo:f,error:g}}function vC({existingRoles:t,onClose:l,onHire:r}){const[i,c]=k.useState("single"),[u,d]=k.useState(""),[m,x]=k.useState(null),[f,g]=k.useState(!1),[y,b]=k.useState(""),[v,S]=k.useState("input"),[j,E]=k.useState(""),[C,A]=k.useState(""),[F,_]=k.useState("ceo"),[H,M]=k.useState(1),[I,W]=k.useState(""),[te,D]=k.useState(""),[Y,B]=k.useState(!1),[V,ne]=k.useState("member"),[G,L]=k.useState("ceo"),[Z,de]=k.useState(""),[ue,z]=k.useState(fi),[R,K]=k.useState(!1),[T,fe]=k.useState(""),[Ee,Ne]=k.useState([]),[Le,Be]=k.useState(new Set),[Qe,Se]=k.useState(""),[tt,me]=k.useState("input"),[he,ge]=k.useState({done:0,total:0}),ke=k.useRef(null),Fe=k.useRef(null),Ae=k.useRef(null);k.useEffect(()=>{Ce.getSkills().then(q=>Ne(q.filter(ze=>ze.installed))).catch(()=>{})},[]),k.useEffect(()=>{var q,ze,He;i==="single"?(H===1&&((q=ke.current)==null||q.focus()),H===2&&((ze=Fe.current)==null||ze.focus())):tt==="input"&&((He=Ae.current)==null||He.focus())},[H,i,tt]);const De=k.useMemo(()=>new Set(t.map(q=>q.id)),[t]),je=k.useMemo(()=>{const q=Qe.split(`
|
|
78
|
+
`))}function x(v,S,j,E){const C=j.enter("tableCell"),A=j.enter("phrasing"),F=j.containerPhrasing(v,{...E,before:u,after:u});return A(),C(),F}function f(v,S){return Wk(v,{align:S,alignDelimiters:i,padding:r,stringLength:c})}function g(v,S,j){const E=v.children;let C=-1;const A=[],F=S.enter("table");for(;++C<E.length;)A[C]=y(E[C],S,j);return F(),A}function y(v,S,j){const E=v.children;let C=-1;const A=[],F=S.enter("tableRow");for(;++C<E.length;)A[C]=x(E[C],v,S,j);return F(),A}function b(v,S,j){let E=qy.inlineCode(v,S,j);return j.stack.includes("tableCell")&&(E=E.replace(/\|/g,"\\$&")),E}}function B4(){return{exit:{taskListCheckValueChecked:a0,taskListCheckValueUnchecked:a0,paragraph:$4}}}function L4(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:H4}}}function a0(t){const l=this.stack[this.stack.length-2];l.type,l.checked=t.type==="taskListCheckValueChecked"}function $4(t){const l=this.stack[this.stack.length-2];if(l&&l.type==="listItem"&&typeof l.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const i=r.children[0];if(i&&i.type==="text"){const c=l.children;let u=-1,d;for(;++u<c.length;){const m=c[u];if(m.type==="paragraph"){d=m;break}}d===r&&(i.value=i.value.slice(1),i.value.length===0?r.children.shift():r.position&&i.position&&typeof i.position.start.offset=="number"&&(i.position.start.column++,i.position.start.offset++,r.position.start=Object.assign({},i.position.start)))}}this.exit(t)}function H4(t,l,r,i){const c=t.children[0],u=typeof t.checked=="boolean"&&c&&c.type==="paragraph",d="["+(t.checked?"x":" ")+"] ",m=r.createTracker(i);u&&m.move(d);let x=qy.listItem(t,l,r,{...i,...m.current()});return u&&(x=x.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,f)),x;function f(g){return g+d}}function U4(){return[bk(),Hk(),qk(),D4(),B4()]}function I4(t){return{extensions:[vk(),Uk(t),Xk(),O4(t),L4()]}}const Y4={tokenize:Q4,partial:!0},Xy={tokenize:W4,partial:!0},Vy={tokenize:Z4,partial:!0},Gy={tokenize:J4,partial:!0},q4={tokenize:P4,partial:!0},Ky={name:"wwwAutolink",tokenize:G4,previous:Wy},Qy={name:"protocolAutolink",tokenize:K4,previous:Zy},cr={name:"emailAutolink",tokenize:V4,previous:Jy},Bl={};function X4(){return{text:Bl}}let xa=48;for(;xa<123;)Bl[xa]=cr,xa++,xa===58?xa=65:xa===91&&(xa=97);Bl[43]=cr;Bl[45]=cr;Bl[46]=cr;Bl[95]=cr;Bl[72]=[cr,Qy];Bl[104]=[cr,Qy];Bl[87]=[cr,Ky];Bl[119]=[cr,Ky];function V4(t,l,r){const i=this;let c,u;return d;function d(y){return!Vf(y)||!Jy.call(i,i.previous)||wh(i.events)?r(y):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),m(y))}function m(y){return Vf(y)?(t.consume(y),m):y===64?(t.consume(y),x):r(y)}function x(y){return y===46?t.check(q4,g,f)(y):y===45||y===95||kn(y)?(u=!0,t.consume(y),x):g(y)}function f(y){return t.consume(y),c=!0,x}function g(y){return u&&c&&En(i.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),l(y)):r(y)}}function G4(t,l,r){const i=this;return c;function c(d){return d!==87&&d!==119||!Wy.call(i,i.previous)||wh(i.events)?r(d):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(Y4,t.attempt(Xy,t.attempt(Vy,u),r),r)(d))}function u(d){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),l(d)}}function K4(t,l,r){const i=this;let c="",u=!1;return d;function d(y){return(y===72||y===104)&&Zy.call(i,i.previous)&&!wh(i.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),c+=String.fromCodePoint(y),t.consume(y),m):r(y)}function m(y){if(En(y)&&c.length<5)return c+=String.fromCodePoint(y),t.consume(y),m;if(y===58){const b=c.toLowerCase();if(b==="http"||b==="https")return t.consume(y),x}return r(y)}function x(y){return y===47?(t.consume(y),u?f:(u=!0,x)):r(y)}function f(y){return y===null||Sc(y)||Ft(y)||ka(y)||Rc(y)?r(y):t.attempt(Xy,t.attempt(Vy,g),r)(y)}function g(y){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),l(y)}}function Q4(t,l,r){let i=0;return c;function c(d){return(d===87||d===119)&&i<3?(i++,t.consume(d),c):d===46&&i===3?(t.consume(d),u):r(d)}function u(d){return d===null?r(d):l(d)}}function W4(t,l,r){let i,c,u;return d;function d(f){return f===46||f===95?t.check(Gy,x,m)(f):f===null||Ft(f)||ka(f)||f!==45&&Rc(f)?x(f):(u=!0,t.consume(f),d)}function m(f){return f===95?i=!0:(c=i,i=void 0),t.consume(f),d}function x(f){return c||i||!u?r(f):l(f)}}function Z4(t,l){let r=0,i=0;return c;function c(d){return d===40?(r++,t.consume(d),c):d===41&&i<r?u(d):d===33||d===34||d===38||d===39||d===41||d===42||d===44||d===46||d===58||d===59||d===60||d===63||d===93||d===95||d===126?t.check(Gy,l,u)(d):d===null||Ft(d)||ka(d)?l(d):(t.consume(d),c)}function u(d){return d===41&&i++,t.consume(d),c}}function J4(t,l,r){return i;function i(m){return m===33||m===34||m===39||m===41||m===42||m===44||m===46||m===58||m===59||m===63||m===95||m===126?(t.consume(m),i):m===38?(t.consume(m),u):m===93?(t.consume(m),c):m===60||m===null||Ft(m)||ka(m)?l(m):r(m)}function c(m){return m===null||m===40||m===91||Ft(m)||ka(m)?l(m):i(m)}function u(m){return En(m)?d(m):r(m)}function d(m){return m===59?(t.consume(m),i):En(m)?(t.consume(m),d):r(m)}}function P4(t,l,r){return i;function i(u){return t.consume(u),c}function c(u){return kn(u)?r(u):l(u)}}function Wy(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||Ft(t)}function Zy(t){return!En(t)}function Jy(t){return!(t===47||Vf(t))}function Vf(t){return t===43||t===45||t===46||t===95||kn(t)}function wh(t){let l=t.length,r=!1;for(;l--;){const i=t[l][1];if((i.type==="labelLink"||i.type==="labelImage")&&!i._balanced){r=!0;break}if(i._gfmAutolinkLiteralWalkedInto){r=!1;break}}return t.length>0&&!r&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const ej={tokenize:oj,partial:!0};function tj(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:aj,continuation:{tokenize:ij},exit:sj}},text:{91:{name:"gfmFootnoteCall",tokenize:rj},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:nj,resolveTo:lj}}}}function nj(t,l,r){const i=this;let c=i.events.length;const u=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let d;for(;c--;){const x=i.events[c][1];if(x.type==="labelImage"){d=x;break}if(x.type==="gfmFootnoteCall"||x.type==="labelLink"||x.type==="label"||x.type==="image"||x.type==="link")break}return m;function m(x){if(!d||!d._balanced)return r(x);const f=bl(i.sliceSerialize({start:d.end,end:i.now()}));return f.codePointAt(0)!==94||!u.includes(f.slice(1))?r(x):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(x),t.exit("gfmFootnoteCallLabelMarker"),l(x))}}function lj(t,l){let r=t.length;for(;r--;)if(t[r][1].type==="labelImage"&&t[r][0]==="enter"){t[r][1];break}t[r+1][1].type="data",t[r+3][1].type="gfmFootnoteCallLabelMarker";const i={type:"gfmFootnoteCall",start:Object.assign({},t[r+3][1].start),end:Object.assign({},t[t.length-1][1].end)},c={type:"gfmFootnoteCallMarker",start:Object.assign({},t[r+3][1].end),end:Object.assign({},t[r+3][1].end)};c.end.column++,c.end.offset++,c.end._bufferIndex++;const u={type:"gfmFootnoteCallString",start:Object.assign({},c.end),end:Object.assign({},t[t.length-1][1].start)},d={type:"chunkString",contentType:"string",start:Object.assign({},u.start),end:Object.assign({},u.end)},m=[t[r+1],t[r+2],["enter",i,l],t[r+3],t[r+4],["enter",c,l],["exit",c,l],["enter",u,l],["enter",d,l],["exit",d,l],["exit",u,l],t[t.length-2],t[t.length-1],["exit",i,l]];return t.splice(r,t.length-r+1,...m),t}function rj(t,l,r){const i=this,c=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u=0,d;return m;function m(y){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(y),t.exit("gfmFootnoteCallLabelMarker"),x}function x(y){return y!==94?r(y):(t.enter("gfmFootnoteCallMarker"),t.consume(y),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",f)}function f(y){if(u>999||y===93&&!d||y===null||y===91||Ft(y))return r(y);if(y===93){t.exit("chunkString");const b=t.exit("gfmFootnoteCallString");return c.includes(bl(i.sliceSerialize(b)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(y),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),l):r(y)}return Ft(y)||(d=!0),u++,t.consume(y),y===92?g:f}function g(y){return y===91||y===92||y===93?(t.consume(y),u++,f):f(y)}}function aj(t,l,r){const i=this,c=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u,d=0,m;return x;function x(S){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(S),t.exit("gfmFootnoteDefinitionLabelMarker"),f}function f(S){return S===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(S),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",g):r(S)}function g(S){if(d>999||S===93&&!m||S===null||S===91||Ft(S))return r(S);if(S===93){t.exit("chunkString");const j=t.exit("gfmFootnoteDefinitionLabelString");return u=bl(i.sliceSerialize(j)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(S),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),b}return Ft(S)||(m=!0),d++,t.consume(S),S===92?y:g}function y(S){return S===91||S===92||S===93?(t.consume(S),d++,g):g(S)}function b(S){return S===58?(t.enter("definitionMarker"),t.consume(S),t.exit("definitionMarker"),c.includes(u)||c.push(u),pt(t,v,"gfmFootnoteDefinitionWhitespace")):r(S)}function v(S){return l(S)}}function ij(t,l,r){return t.check(Hs,l,t.attempt(ej,l,r))}function sj(t){t.exit("gfmFootnoteDefinition")}function oj(t,l,r){const i=this;return pt(t,c,"gfmFootnoteDefinitionIndent",5);function c(u){const d=i.events[i.events.length-1];return d&&d[1].type==="gfmFootnoteDefinitionIndent"&&d[2].sliceSerialize(d[1],!0).length===4?l(u):r(u)}}function cj(t){let r=(t||{}).singleTilde;const i={name:"strikethrough",tokenize:u,resolveAll:c};return r==null&&(r=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function c(d,m){let x=-1;for(;++x<d.length;)if(d[x][0]==="enter"&&d[x][1].type==="strikethroughSequenceTemporary"&&d[x][1]._close){let f=x;for(;f--;)if(d[f][0]==="exit"&&d[f][1].type==="strikethroughSequenceTemporary"&&d[f][1]._open&&d[x][1].end.offset-d[x][1].start.offset===d[f][1].end.offset-d[f][1].start.offset){d[x][1].type="strikethroughSequence",d[f][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},d[f][1].start),end:Object.assign({},d[x][1].end)},y={type:"strikethroughText",start:Object.assign({},d[f][1].end),end:Object.assign({},d[x][1].start)},b=[["enter",g,m],["enter",d[f][1],m],["exit",d[f][1],m],["enter",y,m]],v=m.parser.constructs.insideSpan.null;v&&Qn(b,b.length,0,_c(v,d.slice(f+1,x),m)),Qn(b,b.length,0,[["exit",y,m],["enter",d[x][1],m],["exit",d[x][1],m],["exit",g,m]]),Qn(d,f-1,x-f+3,b),x=f+b.length-2;break}}for(x=-1;++x<d.length;)d[x][1].type==="strikethroughSequenceTemporary"&&(d[x][1].type="data");return d}function u(d,m,x){const f=this.previous,g=this.events;let y=0;return b;function b(S){return f===126&&g[g.length-1][1].type!=="characterEscape"?x(S):(d.enter("strikethroughSequenceTemporary"),v(S))}function v(S){const j=xi(f);if(S===126)return y>1?x(S):(d.consume(S),y++,v);if(y<2&&!r)return x(S);const E=d.exit("strikethroughSequenceTemporary"),C=xi(S);return E._open=!C||C===2&&!!j,E._close=!j||j===2&&!!C,m(S)}}}class uj{constructor(){this.map=[]}add(l,r,i){dj(this,l,r,i)}consume(l){if(this.map.sort(function(u,d){return u[0]-d[0]}),this.map.length===0)return;let r=this.map.length;const i=[];for(;r>0;)r-=1,i.push(l.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),l.length=this.map[r][0];i.push(l.slice()),l.length=0;let c=i.pop();for(;c;){for(const u of c)l.push(u);c=i.pop()}this.map.length=0}}function dj(t,l,r,i){let c=0;if(!(r===0&&i.length===0)){for(;c<t.map.length;){if(t.map[c][0]===l){t.map[c][1]+=r,t.map[c][2].push(...i);return}c+=1}t.map.push([l,r,i])}}function fj(t,l){let r=!1;const i=[];for(;l<t.length;){const c=t[l];if(r){if(c[0]==="enter")c[1].type==="tableContent"&&i.push(t[l+1][1].type==="tableDelimiterMarker"?"left":"none");else if(c[1].type==="tableContent"){if(t[l-1][1].type==="tableDelimiterMarker"){const u=i.length-1;i[u]=i[u]==="left"?"center":"right"}}else if(c[1].type==="tableDelimiterRow")break}else c[0]==="enter"&&c[1].type==="tableDelimiterRow"&&(r=!0);l+=1}return i}function hj(){return{flow:{null:{name:"table",tokenize:mj,resolveAll:xj}}}}function mj(t,l,r){const i=this;let c=0,u=0,d;return m;function m(D){let Y=i.events.length-1;for(;Y>-1;){const ne=i.events[Y][1].type;if(ne==="lineEnding"||ne==="linePrefix")Y--;else break}const B=Y>-1?i.events[Y][1].type:null,V=B==="tableHead"||B==="tableRow"?M:x;return V===M&&i.parser.lazy[i.now().line]?r(D):V(D)}function x(D){return t.enter("tableHead"),t.enter("tableRow"),f(D)}function f(D){return D===124||(d=!0,u+=1),g(D)}function g(D){return D===null?r(D):qe(D)?u>1?(u=0,i.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(D),t.exit("lineEnding"),v):r(D):ct(D)?pt(t,g,"whitespace")(D):(u+=1,d&&(d=!1,c+=1),D===124?(t.enter("tableCellDivider"),t.consume(D),t.exit("tableCellDivider"),d=!0,g):(t.enter("data"),y(D)))}function y(D){return D===null||D===124||Ft(D)?(t.exit("data"),g(D)):(t.consume(D),D===92?b:y)}function b(D){return D===92||D===124?(t.consume(D),y):y(D)}function v(D){return i.interrupt=!1,i.parser.lazy[i.now().line]?r(D):(t.enter("tableDelimiterRow"),d=!1,ct(D)?pt(t,S,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):S(D))}function S(D){return D===45||D===58?E(D):D===124?(d=!0,t.enter("tableCellDivider"),t.consume(D),t.exit("tableCellDivider"),j):H(D)}function j(D){return ct(D)?pt(t,E,"whitespace")(D):E(D)}function E(D){return D===58?(u+=1,d=!0,t.enter("tableDelimiterMarker"),t.consume(D),t.exit("tableDelimiterMarker"),C):D===45?(u+=1,C(D)):D===null||qe(D)?_(D):H(D)}function C(D){return D===45?(t.enter("tableDelimiterFiller"),A(D)):H(D)}function A(D){return D===45?(t.consume(D),A):D===58?(d=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(D),t.exit("tableDelimiterMarker"),F):(t.exit("tableDelimiterFiller"),F(D))}function F(D){return ct(D)?pt(t,_,"whitespace")(D):_(D)}function _(D){return D===124?S(D):D===null||qe(D)?!d||c!==u?H(D):(t.exit("tableDelimiterRow"),t.exit("tableHead"),l(D)):H(D)}function H(D){return r(D)}function M(D){return t.enter("tableRow"),I(D)}function I(D){return D===124?(t.enter("tableCellDivider"),t.consume(D),t.exit("tableCellDivider"),I):D===null||qe(D)?(t.exit("tableRow"),l(D)):ct(D)?pt(t,I,"whitespace")(D):(t.enter("data"),W(D))}function W(D){return D===null||D===124||Ft(D)?(t.exit("data"),I(D)):(t.consume(D),D===92?te:W)}function te(D){return D===92||D===124?(t.consume(D),W):W(D)}}function xj(t,l){let r=-1,i=!0,c=0,u=[0,0,0,0],d=[0,0,0,0],m=!1,x=0,f,g,y;const b=new uj;for(;++r<t.length;){const v=t[r],S=v[1];v[0]==="enter"?S.type==="tableHead"?(m=!1,x!==0&&(i0(b,l,x,f,g),g=void 0,x=0),f={type:"table",start:Object.assign({},S.start),end:Object.assign({},S.end)},b.add(r,0,[["enter",f,l]])):S.type==="tableRow"||S.type==="tableDelimiterRow"?(i=!0,y=void 0,u=[0,0,0,0],d=[0,r+1,0,0],m&&(m=!1,g={type:"tableBody",start:Object.assign({},S.start),end:Object.assign({},S.end)},b.add(r,0,[["enter",g,l]])),c=S.type==="tableDelimiterRow"?2:g?3:1):c&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")?(i=!1,d[2]===0&&(u[1]!==0&&(d[0]=d[1],y=rc(b,l,u,c,void 0,y),u=[0,0,0,0]),d[2]=r)):S.type==="tableCellDivider"&&(i?i=!1:(u[1]!==0&&(d[0]=d[1],y=rc(b,l,u,c,void 0,y)),u=d,d=[u[1],r,0,0])):S.type==="tableHead"?(m=!0,x=r):S.type==="tableRow"||S.type==="tableDelimiterRow"?(x=r,u[1]!==0?(d[0]=d[1],y=rc(b,l,u,c,r,y)):d[1]!==0&&(y=rc(b,l,d,c,r,y)),c=0):c&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")&&(d[3]=r)}for(x!==0&&i0(b,l,x,f,g),b.consume(l.events),r=-1;++r<l.events.length;){const v=l.events[r];v[0]==="enter"&&v[1].type==="table"&&(v[1]._align=fj(l.events,r))}return t}function rc(t,l,r,i,c,u){const d=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",m="tableContent";r[0]!==0&&(u.end=Object.assign({},di(l.events,r[0])),t.add(r[0],0,[["exit",u,l]]));const x=di(l.events,r[1]);if(u={type:d,start:Object.assign({},x),end:Object.assign({},x)},t.add(r[1],0,[["enter",u,l]]),r[2]!==0){const f=di(l.events,r[2]),g=di(l.events,r[3]),y={type:m,start:Object.assign({},f),end:Object.assign({},g)};if(t.add(r[2],0,[["enter",y,l]]),i!==2){const b=l.events[r[2]],v=l.events[r[3]];if(b[1].end=Object.assign({},v[1].end),b[1].type="chunkText",b[1].contentType="text",r[3]>r[2]+1){const S=r[2]+1,j=r[3]-r[2]-1;t.add(S,j,[])}}t.add(r[3]+1,0,[["exit",y,l]])}return c!==void 0&&(u.end=Object.assign({},di(l.events,c)),t.add(c,0,[["exit",u,l]]),u=void 0),u}function i0(t,l,r,i,c){const u=[],d=di(l.events,r);c&&(c.end=Object.assign({},d),u.push(["exit",c,l])),i.end=Object.assign({},d),u.push(["exit",i,l]),t.add(r+1,0,u)}function di(t,l){const r=t[l],i=r[0]==="enter"?"start":"end";return r[1][i]}const pj={name:"tasklistCheck",tokenize:gj};function yj(){return{text:{91:pj}}}function gj(t,l,r){const i=this;return c;function c(x){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?r(x):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(x),t.exit("taskListCheckMarker"),u)}function u(x){return Ft(x)?(t.enter("taskListCheckValueUnchecked"),t.consume(x),t.exit("taskListCheckValueUnchecked"),d):x===88||x===120?(t.enter("taskListCheckValueChecked"),t.consume(x),t.exit("taskListCheckValueChecked"),d):r(x)}function d(x){return x===93?(t.enter("taskListCheckMarker"),t.consume(x),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),m):r(x)}function m(x){return qe(x)?l(x):ct(x)?t.check({tokenize:bj},l,r)(x):r(x)}}function bj(t,l,r){return pt(t,i,"whitespace");function i(c){return c===null?r(c):l(c)}}function vj(t){return cy([X4(),tj(),cj(t),hj(),yj()])}const wj={};function kh(t){const l=this,r=t||wj,i=l.data(),c=i.micromarkExtensions||(i.micromarkExtensions=[]),u=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),d=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);c.push(vj(r)),u.push(U4()),d.push(I4(r))}function Is({content:t,className:l=""}){return s.jsx("div",{className:`office-markdown ${l}`,children:s.jsx(gh,{remarkPlugins:[kh],components:{code:kj,table:({children:r})=>s.jsx("div",{className:"overflow-x-auto my-2",children:s.jsx("table",{className:"office-table",children:r})})},children:t})})}function kj({className:t,children:l,...r}){const i=/language-(\w+)/.exec(t??"");return i||typeof l=="string"&&l.includes(`
|
|
79
|
+
`)?s.jsx(jj,{language:i==null?void 0:i[1],children:l}):s.jsx("code",{className:"bg-gray-100 text-gray-700 px-1 py-0.5 rounded text-[0.9em] font-mono",...r,children:l})}function jj({children:t,language:l}){const[r,i]=k.useState(!1),c=String(t).replace(/\n$/,""),u=()=>{navigator.clipboard.writeText(c),i(!0),setTimeout(()=>i(!1),1500)};return s.jsxs("div",{className:"office-code-block group relative my-2",children:[l&&s.jsx("div",{className:"text-[10px] text-gray-400 px-3 pt-1.5",children:l}),s.jsx("button",{onClick:u,className:"absolute top-1.5 right-2 text-[10px] text-gray-400 hover:text-gray-600 opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",children:r?"Copied!":"Copy"}),s.jsx("pre",{className:"overflow-x-auto p-3 text-xs leading-relaxed",children:s.jsx("code",{children:c})})]})}const s0={$skin:"skinColor",$hair:"hairColor",$shirt:"shirtColor",$pants:"pantsColor",$shoes:"shoeColor"},Sj=/^(darken|lighten)\((\$\w+),\s*(\d+)\)$/;function Cj(t,l){const r=parseInt(t.replace("#",""),16),i=Math.max(0,(r>>16&255)-l),c=Math.max(0,(r>>8&255)-l),u=Math.max(0,(r&255)-l);return`#${(i<<16|c<<8|u).toString(16).padStart(6,"0")}`}function Ej(t,l){const r=parseInt(t.replace("#",""),16),i=Math.min(255,(r>>16&255)+l),c=Math.min(255,(r>>8&255)+l),u=Math.min(255,(r&255)+l);return`#${(i<<16|c<<8|u).toString(16).padStart(6,"0")}`}function Py(t,l){const r=s0[t];if(r&&l)return l[r];const i=Sj.exec(t);if(i){const[,c,u,d]=i,m=s0[u],x=m&&l?l[m]:u,f=parseInt(d,10);return c==="darken"?Cj(x,f):Ej(x,f)}return t}function o0(t,l=12){return t.map(r=>({...r,x:l-r.x-r.w}))}function Nj(t,l){return l==="down"?t.down:l==="up"&&t.up?t.up:l==="left"&&t.left?t.left:l==="right"&&t.right?t.right:l==="right"&&t.left?{name:t.left.name,pixels:o0(t.left.pixels)}:l==="left"&&t.right?{name:t.right.name,pixels:o0(t.right.pixels)}:t.down}function Aj(t,l){return Gf(t,"hair",l,1)}function Gf(t,l,r,i){const c=t.layers.findIndex(d=>d.name===l),u=[...t.layers];if(c>=0)u[c]={...r,name:l};else{const d=i??u.length;u.splice(d,0,{...r,name:l})}return{...t,layers:u}}const jh=new Map,Sh=new Map;function eg(t,l){jh.set(t,l)}function $c(t,l){Sh.set(t,l)}function Kf(t){return jh.get(t)}function Tj(t){return Sh.get(t)}function vN(){return Array.from(jh.keys())}function wN(){return Array.from(Sh.keys())}function Dj(t,l,r,i,c=2){t.clearRect(0,0,l.width*c,l.height*c);for(const u of l.layers)tg(t,u.pixels,c,r,i)}function Qf(t,l,r,i,c){for(const u of l){const d=Py(u.c,c);u.a!==void 0&&u.a!==1&&(t.globalAlpha=u.a),t.fillStyle=d,t.fillRect(r+u.x,i+u.y,u.w,u.h),u.a!==void 0&&u.a!==1&&(t.globalAlpha=1)}}function zj(t,l){const r=l.scale;t.clearRect(0,0,l.canvasWidth,l.canvasHeight),tg(t,l.pixels,r,0)}function tg(t,l,r,i,c){for(const u of l){const d=Py(u.c,c);u.a!==void 0&&u.a!==1&&(t.globalAlpha=u.a),t.fillStyle=d,t.fillRect(u.x*r,(u.y+i)*r,u.w*r,u.h*r),u.a!==void 0&&u.a!==1&&(t.globalAlpha=1)}}const Ac=new Map;function Qr(t,l,r){if("down"in r&&!("pixels"in r)){const c=r;Ac.set(t,{id:t,name:l,layer:{...c.down,name:"hair"},directions:{down:{...c.down,name:"hair"},up:c.up?{...c.up,name:"hair"}:void 0,left:c.left?{...c.left,name:"hair"}:void 0,right:c.right?{...c.right,name:"hair"}:void 0}})}else{const c=r;Ac.set(t,{id:t,name:l,layer:{...c,name:"hair"}})}}function Mj(t){return Ac.get(t)}function ng(){return Array.from(Ac.values())}Qr("short","Short",{down:{name:"hair",pixels:[{x:1,y:0,w:10,h:2,c:"$hair"},{x:0,y:1,w:2,h:2,c:"$hair"},{x:10,y:1,w:2,h:2,c:"$hair"},{x:2,y:0,w:8,h:1,c:"lighten($hair, 25)",a:.3}]},up:{name:"hair",pixels:[{x:1,y:0,w:10,h:3,c:"$hair"},{x:0,y:1,w:2,h:2,c:"$hair"},{x:10,y:1,w:2,h:2,c:"$hair"}]},left:{name:"hair",pixels:[{x:1,y:0,w:9,h:2,c:"$hair"},{x:0,y:1,w:2,h:2,c:"$hair"},{x:2,y:0,w:6,h:1,c:"lighten($hair, 25)",a:.3}]}});Qr("messy","Messy",{down:{name:"hair",pixels:[{x:1,y:0,w:10,h:3,c:"$hair"},{x:0,y:1,w:2,h:3,c:"$hair"},{x:10,y:0,w:2,h:4,c:"$hair"},{x:3,y:-1,w:3,h:2,c:"$hair"},{x:7,y:-1,w:2,h:2,c:"lighten($hair, 20)"},{x:2,y:0,w:4,h:1,c:"lighten($hair, 30)",a:.3}]},up:{name:"hair",pixels:[{x:1,y:0,w:10,h:4,c:"$hair"},{x:0,y:1,w:2,h:3,c:"$hair"},{x:10,y:0,w:2,h:4,c:"$hair"},{x:3,y:-1,w:3,h:2,c:"$hair"},{x:7,y:-1,w:2,h:2,c:"$hair"}]},left:{name:"hair",pixels:[{x:1,y:0,w:9,h:3,c:"$hair"},{x:0,y:1,w:2,h:3,c:"$hair"},{x:3,y:-1,w:3,h:2,c:"$hair"},{x:2,y:0,w:4,h:1,c:"lighten($hair, 30)",a:.3}]}});Qr("bun","Bun",{down:{name:"hair",pixels:[{x:1,y:0,w:10,h:2,c:"$hair"},{x:0,y:1,w:2,h:2,c:"$hair"},{x:10,y:1,w:2,h:2,c:"$hair"},{x:4,y:-2,w:4,h:3,c:"$hair"},{x:5,y:-2,w:2,h:1,c:"lighten($hair, 30)",a:.4}]},up:{name:"hair",pixels:[{x:1,y:0,w:10,h:3,c:"$hair"},{x:0,y:1,w:2,h:2,c:"$hair"},{x:10,y:1,w:2,h:2,c:"$hair"},{x:4,y:-2,w:4,h:3,c:"$hair"},{x:5,y:-2,w:2,h:1,c:"lighten($hair, 30)",a:.4}]},left:{name:"hair",pixels:[{x:1,y:0,w:9,h:2,c:"$hair"},{x:0,y:1,w:2,h:2,c:"$hair"},{x:4,y:-2,w:4,h:3,c:"$hair"},{x:5,y:-2,w:2,h:1,c:"lighten($hair, 30)",a:.4}]}});Qr("long","Long",{down:{name:"hair",pixels:[{x:0,y:0,w:12,h:3,c:"$hair"},{x:-1,y:1,w:2,h:7,c:"$hair"},{x:11,y:1,w:2,h:7,c:"$hair"},{x:-1,y:6,w:2,h:3,c:"darken($hair, 15)",a:.5},{x:11,y:6,w:2,h:3,c:"darken($hair, 15)",a:.5},{x:2,y:0,w:8,h:1,c:"lighten($hair, 25)",a:.3}]},up:{name:"hair",pixels:[{x:0,y:0,w:12,h:3,c:"$hair"},{x:-1,y:1,w:2,h:7,c:"$hair"},{x:11,y:1,w:2,h:7,c:"$hair"},{x:1,y:2,w:10,h:6,c:"$hair"},{x:2,y:6,w:8,h:2,c:"darken($hair, 10)",a:.3}]},left:{name:"hair",pixels:[{x:0,y:0,w:10,h:3,c:"$hair"},{x:-1,y:1,w:2,h:7,c:"$hair"},{x:-1,y:6,w:2,h:3,c:"darken($hair, 15)",a:.5},{x:2,y:0,w:6,h:1,c:"lighten($hair, 25)",a:.3}]}});Qr("mohawk","Mohawk",{down:{name:"hair",pixels:[{x:4,y:-2,w:4,h:4,c:"$hair"},{x:5,y:-3,w:2,h:2,c:"lighten($hair, 20)"},{x:1,y:1,w:3,h:2,c:"$hair"},{x:8,y:1,w:3,h:2,c:"$hair"}]},up:{name:"hair",pixels:[{x:4,y:-2,w:4,h:4,c:"$hair"},{x:5,y:-3,w:2,h:2,c:"lighten($hair, 20)"},{x:1,y:1,w:3,h:2,c:"$hair"},{x:8,y:1,w:3,h:2,c:"$hair"}]},left:{name:"hair",pixels:[{x:4,y:-2,w:3,h:4,c:"$hair"},{x:5,y:-3,w:2,h:2,c:"lighten($hair, 20)"},{x:1,y:1,w:3,h:2,c:"$hair"}]}});Qr("slicked","Slicked Back",{down:{name:"hair",pixels:[{x:1,y:0,w:10,h:2,c:"$hair"},{x:0,y:1,w:2,h:2,c:"$hair"},{x:10,y:1,w:2,h:2,c:"$hair"},{x:2,y:0,w:8,h:1,c:"lighten($hair, 15)",a:.4},{x:3,y:1,w:6,h:1,c:"lighten($hair, 10)",a:.2}]},up:{name:"hair",pixels:[{x:1,y:0,w:10,h:3,c:"$hair"},{x:0,y:1,w:2,h:2,c:"$hair"},{x:10,y:1,w:2,h:2,c:"$hair"},{x:2,y:0,w:8,h:1,c:"lighten($hair, 15)",a:.4}]},left:{name:"hair",pixels:[{x:1,y:0,w:9,h:2,c:"$hair"},{x:0,y:1,w:2,h:2,c:"$hair"},{x:2,y:0,w:6,h:1,c:"lighten($hair, 15)",a:.4}]}});Qr("bob","Bob Cut",{down:{name:"hair",pixels:[{x:0,y:0,w:12,h:3,c:"$hair"},{x:-1,y:1,w:2,h:5,c:"$hair"},{x:11,y:1,w:2,h:5,c:"$hair"},{x:-1,y:5,w:2,h:1,c:"darken($hair, 15)",a:.4},{x:11,y:5,w:2,h:1,c:"darken($hair, 15)",a:.4},{x:2,y:0,w:8,h:1,c:"lighten($hair, 25)",a:.3}]},up:{name:"hair",pixels:[{x:0,y:0,w:12,h:3,c:"$hair"},{x:-1,y:1,w:2,h:5,c:"$hair"},{x:11,y:1,w:2,h:5,c:"$hair"},{x:1,y:2,w:10,h:4,c:"$hair"},{x:2,y:5,w:8,h:1,c:"darken($hair, 10)",a:.3}]},left:{name:"hair",pixels:[{x:0,y:0,w:10,h:3,c:"$hair"},{x:-1,y:1,w:2,h:5,c:"$hair"},{x:-1,y:5,w:2,h:1,c:"darken($hair, 15)",a:.4},{x:2,y:0,w:6,h:1,c:"lighten($hair, 25)",a:.3}]}});Qr("curly","Curly",{down:{name:"hair",pixels:[{x:0,y:0,w:12,h:4,c:"$hair"},{x:-1,y:1,w:2,h:5,c:"$hair"},{x:11,y:1,w:2,h:5,c:"$hair"},{x:2,y:0,w:2,h:1,c:"lighten($hair, 25)",a:.4},{x:6,y:0,w:2,h:1,c:"lighten($hair, 25)",a:.4},{x:4,y:2,w:2,h:1,c:"lighten($hair, 15)",a:.3},{x:8,y:2,w:2,h:1,c:"lighten($hair, 15)",a:.3}]},up:{name:"hair",pixels:[{x:0,y:0,w:12,h:4,c:"$hair"},{x:-1,y:1,w:2,h:5,c:"$hair"},{x:11,y:1,w:2,h:5,c:"$hair"},{x:1,y:2,w:10,h:4,c:"$hair"},{x:3,y:1,w:2,h:1,c:"lighten($hair, 15)",a:.3},{x:7,y:1,w:2,h:1,c:"lighten($hair, 15)",a:.3}]},left:{name:"hair",pixels:[{x:0,y:0,w:10,h:4,c:"$hair"},{x:-1,y:1,w:2,h:5,c:"$hair"},{x:2,y:0,w:2,h:1,c:"lighten($hair, 25)",a:.4},{x:5,y:0,w:2,h:1,c:"lighten($hair, 25)",a:.4},{x:3,y:2,w:2,h:1,c:"lighten($hair, 15)",a:.3}]}});const Tc=new Map;function Ll(t,l,r){if("down"in r&&!("pixels"in r)){const c=r;Tc.set(t,{id:t,name:l,layer:{...c.down,name:"torso"},directions:{down:{...c.down,name:"torso"},up:c.up?{...c.up,name:"torso"}:void 0,left:c.left?{...c.left,name:"torso"}:void 0,right:c.right?{...c.right,name:"torso"}:void 0}})}else{const c=r;Tc.set(t,{id:t,name:l,layer:{...c,name:"torso"}})}}function Fj(t){return Tc.get(t)}function lg(){return Array.from(Tc.values())}Ll("tshirt","T-Shirt",{down:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:2,y:10,w:8,h:1,c:"lighten($shirt, 18)",a:.3},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:5,y:10,w:2,h:3,c:"darken($shirt, 10)",a:.15},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:1,y:10,w:9,h:6,c:"$shirt"},{x:2,y:10,w:7,h:1,c:"lighten($shirt, 18)",a:.3},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:-1,y:11,w:3,h:5,c:"$shirt"},{x:-1,y:15,w:3,h:1,c:"$skin"}]}});Ll("suit","Suit",{down:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:2,y:10,w:8,h:1,c:"lighten($shirt, 12)",a:.3},{x:1,y:10,w:1,h:5,c:"darken($shirt, 30)",a:.3},{x:10,y:10,w:1,h:5,c:"darken($shirt, 30)",a:.3},{x:2,y:10,w:3,h:3,c:"darken($shirt, 20)",a:.3},{x:7,y:10,w:3,h:3,c:"darken($shirt, 20)",a:.3},{x:5,y:10,w:2,h:5,c:"#E8E8E8",a:.5},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:11,w:2,h:1,c:"darken($shirt, 20)",a:.2},{x:11,y:11,w:2,h:1,c:"darken($shirt, 20)",a:.2},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 30)",a:.3},{x:10,y:10,w:1,h:5,c:"darken($shirt, 30)",a:.3},{x:5,y:12,w:2,h:4,c:"darken($shirt, 10)",a:.15},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:1,y:10,w:9,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 30)",a:.3},{x:2,y:10,w:3,h:3,c:"darken($shirt, 20)",a:.3},{x:-1,y:11,w:3,h:5,c:"$shirt"},{x:-1,y:11,w:3,h:1,c:"darken($shirt, 20)",a:.2},{x:-1,y:15,w:3,h:1,c:"$skin"}]}});Ll("hoodie","Hoodie",{down:{name:"torso",pixels:[{x:0,y:10,w:12,h:6,c:"$shirt"},{x:1,y:10,w:10,h:1,c:"lighten($shirt, 15)",a:.25},{x:0,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.3},{x:11,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.3},{x:2,y:8,w:8,h:2,c:"$shirt",a:.4},{x:3,y:13,w:6,h:2,c:"darken($shirt, 15)",a:.2},{x:5,y:10,w:1,h:2,c:"#DDD",a:.3},{x:6,y:10,w:1,h:2,c:"#DDD",a:.3},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:0,y:10,w:12,h:6,c:"$shirt"},{x:0,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.3},{x:11,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.3},{x:2,y:7,w:8,h:3,c:"$shirt",a:.5},{x:3,y:7,w:6,h:1,c:"darken($shirt, 10)",a:.3},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:0,y:10,w:10,h:6,c:"$shirt"},{x:1,y:10,w:8,h:1,c:"lighten($shirt, 15)",a:.25},{x:0,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.3},{x:2,y:8,w:6,h:2,c:"$shirt",a:.4},{x:-1,y:11,w:3,h:5,c:"$shirt"},{x:-1,y:15,w:3,h:1,c:"$skin"}]}});Ll("vest","Vest",{down:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:2,y:10,w:8,h:1,c:"lighten($shirt, 18)",a:.3},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:5,y:10,w:2,h:2,c:"$skin",a:.6},{x:-1,y:11,w:2,h:5,c:"$skin"},{x:11,y:11,w:2,h:5,c:"$skin"},{x:-1,y:15,w:2,h:1,c:"darken($skin, 10)"},{x:11,y:15,w:2,h:1,c:"darken($skin, 10)"}]},up:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:-1,y:11,w:2,h:5,c:"$skin"},{x:11,y:11,w:2,h:5,c:"$skin"},{x:-1,y:15,w:2,h:1,c:"darken($skin, 10)"},{x:11,y:15,w:2,h:1,c:"darken($skin, 10)"}]},left:{name:"torso",pixels:[{x:1,y:10,w:9,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:-1,y:11,w:3,h:5,c:"$skin"},{x:-1,y:15,w:3,h:1,c:"darken($skin, 10)"}]}});Ll("tank","Tank Top",{down:{name:"torso",pixels:[{x:2,y:10,w:8,h:6,c:"$shirt"},{x:3,y:10,w:6,h:1,c:"lighten($shirt, 18)",a:.3},{x:2,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:9,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:0,y:10,w:2,h:2,c:"$skin"},{x:10,y:10,w:2,h:2,c:"$skin"},{x:-1,y:11,w:2,h:5,c:"$skin"},{x:11,y:11,w:2,h:5,c:"$skin"},{x:-1,y:15,w:2,h:1,c:"darken($skin, 10)"},{x:11,y:15,w:2,h:1,c:"darken($skin, 10)"}]},up:{name:"torso",pixels:[{x:2,y:10,w:8,h:6,c:"$shirt"},{x:2,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:9,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:0,y:10,w:2,h:2,c:"$skin"},{x:10,y:10,w:2,h:2,c:"$skin"},{x:-1,y:11,w:2,h:5,c:"$skin"},{x:11,y:11,w:2,h:5,c:"$skin"},{x:-1,y:15,w:2,h:1,c:"darken($skin, 10)"},{x:11,y:15,w:2,h:1,c:"darken($skin, 10)"}]},left:{name:"torso",pixels:[{x:2,y:10,w:7,h:6,c:"$shirt"},{x:2,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:0,y:10,w:2,h:2,c:"$skin"},{x:-1,y:11,w:3,h:5,c:"$skin"},{x:-1,y:15,w:3,h:1,c:"darken($skin, 10)"}]}});Ll("polo","Polo",{down:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:2,y:10,w:8,h:1,c:"lighten($shirt, 18)",a:.3},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:3,y:9,w:6,h:2,c:"lighten($shirt, 25)",a:.5},{x:5,y:9,w:2,h:1,c:"$skin",a:.4},{x:5,y:10,w:2,h:3,c:"darken($shirt, 15)",a:.15},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:3,y:9,w:6,h:1,c:"lighten($shirt, 25)",a:.5},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:1,y:10,w:9,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:3,y:9,w:4,h:2,c:"lighten($shirt, 25)",a:.5},{x:-1,y:11,w:3,h:5,c:"$shirt"},{x:-1,y:15,w:3,h:1,c:"$skin"}]}});Ll("labcoat","Lab Coat",{down:{name:"torso",pixels:[{x:4,y:10,w:4,h:5,c:"$shirt"},{x:0,y:10,w:4,h:7,c:"#F0F0F0"},{x:8,y:10,w:4,h:7,c:"#F0F0F0"},{x:1,y:10,w:10,h:1,c:"#FAFAFA"},{x:0,y:10,w:1,h:7,c:"#DDD",a:.5},{x:11,y:10,w:1,h:7,c:"#DDD",a:.5},{x:1,y:13,w:2,h:2,c:"#E0E0E0",a:.4},{x:9,y:13,w:2,h:2,c:"#E0E0E0",a:.4},{x:-1,y:11,w:2,h:5,c:"#F0F0F0"},{x:11,y:11,w:2,h:5,c:"#F0F0F0"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:0,y:10,w:12,h:7,c:"#F0F0F0"},{x:0,y:10,w:1,h:7,c:"#DDD",a:.5},{x:11,y:10,w:1,h:7,c:"#DDD",a:.5},{x:5,y:11,w:2,h:5,c:"#E8E8E8",a:.3},{x:-1,y:11,w:2,h:5,c:"#F0F0F0"},{x:11,y:11,w:2,h:5,c:"#F0F0F0"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:3,y:10,w:3,h:5,c:"$shirt"},{x:0,y:10,w:3,h:7,c:"#F0F0F0"},{x:6,y:10,w:4,h:7,c:"#F0F0F0"},{x:1,y:10,w:8,h:1,c:"#FAFAFA"},{x:0,y:10,w:1,h:7,c:"#DDD",a:.5},{x:1,y:13,w:2,h:2,c:"#E0E0E0",a:.4},{x:-1,y:11,w:3,h:5,c:"#F0F0F0"},{x:-1,y:15,w:3,h:1,c:"$skin"}]}});Ll("overalls","Overalls",{down:{name:"torso",pixels:[{x:1,y:10,w:10,h:3,c:"$shirt"},{x:2,y:10,w:8,h:1,c:"lighten($shirt, 18)",a:.3},{x:3,y:11,w:6,h:5,c:"#3D6B99"},{x:3,y:10,w:2,h:1,c:"#3D6B99"},{x:7,y:10,w:2,h:1,c:"#3D6B99"},{x:3,y:11,w:1,h:1,c:"#FFD700",a:.6},{x:8,y:11,w:1,h:1,c:"#FFD700",a:.6},{x:1,y:13,w:2,h:3,c:"#3D6B99"},{x:9,y:13,w:2,h:3,c:"#3D6B99"},{x:5,y:13,w:2,h:2,c:"#345E87",a:.4},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:1,y:10,w:10,h:3,c:"$shirt"},{x:3,y:10,w:2,h:1,c:"#3D6B99"},{x:7,y:10,w:2,h:1,c:"#3D6B99"},{x:1,y:13,w:10,h:3,c:"#3D6B99"},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:1,y:10,w:9,h:3,c:"$shirt"},{x:3,y:11,w:5,h:5,c:"#3D6B99"},{x:3,y:10,w:2,h:1,c:"#3D6B99"},{x:3,y:11,w:1,h:1,c:"#FFD700",a:.6},{x:1,y:13,w:2,h:3,c:"#3D6B99"},{x:-1,y:11,w:3,h:5,c:"$shirt"},{x:-1,y:15,w:3,h:1,c:"$skin"}]}});Ll("turtleneck","Turtleneck",{down:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:3,y:8,w:6,h:2,c:"$shirt"},{x:4,y:8,w:4,h:1,c:"lighten($shirt, 12)",a:.3},{x:3,y:9,w:1,h:1,c:"darken($shirt, 15)",a:.2},{x:8,y:9,w:1,h:1,c:"darken($shirt, 15)",a:.2},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:3,y:8,w:6,h:2,c:"$shirt"},{x:4,y:8,w:4,h:1,c:"lighten($shirt, 12)",a:.3},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:1,y:10,w:9,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:3,y:8,w:4,h:2,c:"$shirt"},{x:3,y:8,w:3,h:1,c:"lighten($shirt, 12)",a:.3},{x:-1,y:11,w:3,h:5,c:"$shirt"},{x:-1,y:15,w:3,h:1,c:"$skin"}]}});Ll("robe","Robe",{down:{name:"torso",pixels:[{x:0,y:10,w:12,h:7,c:"$shirt"},{x:0,y:10,w:1,h:6,c:"darken($shirt, 25)",a:.3},{x:11,y:10,w:1,h:6,c:"darken($shirt, 25)",a:.3},{x:3,y:10,w:3,h:4,c:"lighten($shirt, 15)",a:.25},{x:6,y:10,w:3,h:4,c:"darken($shirt, 10)",a:.2},{x:1,y:14,w:10,h:1,c:"darken($shirt, 35)"},{x:2,y:14,w:8,h:1,c:"darken($shirt, 25)",a:.4},{x:-2,y:11,w:3,h:5,c:"$shirt"},{x:11,y:11,w:3,h:5,c:"$shirt"},{x:-2,y:15,w:3,h:1,c:"darken($shirt, 15)",a:.3},{x:11,y:15,w:3,h:1,c:"darken($shirt, 15)",a:.3},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:0,y:10,w:12,h:7,c:"$shirt"},{x:0,y:10,w:1,h:6,c:"darken($shirt, 25)",a:.3},{x:11,y:10,w:1,h:6,c:"darken($shirt, 25)",a:.3},{x:1,y:14,w:10,h:1,c:"darken($shirt, 35)"},{x:-2,y:11,w:3,h:5,c:"$shirt"},{x:11,y:11,w:3,h:5,c:"$shirt"},{x:-2,y:15,w:3,h:1,c:"darken($shirt, 15)",a:.3},{x:11,y:15,w:3,h:1,c:"darken($shirt, 15)",a:.3},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:0,y:10,w:10,h:7,c:"$shirt"},{x:0,y:10,w:1,h:6,c:"darken($shirt, 25)",a:.3},{x:1,y:14,w:8,h:1,c:"darken($shirt, 35)"},{x:-2,y:11,w:4,h:5,c:"$shirt"},{x:-2,y:15,w:4,h:1,c:"darken($shirt, 15)",a:.3},{x:-1,y:15,w:2,h:1,c:"$skin"}]}});const Rs=new Map;function jt(t,l,r){if("down"in r&&!("pixels"in r)){const c=r;Rs.set(t,{id:t,name:l,layer:{...c.down,name:"accessory"},directions:{down:{...c.down,name:"accessory"},up:c.up?{...c.up,name:"accessory"}:void 0,left:c.left?{...c.left,name:"accessory"}:void 0,right:c.right?{...c.right,name:"accessory"}:void 0}})}else{const c=r;Rs.set(t,{id:t,name:l,layer:{...c,name:"accessory"}})}}function Rj(t){return Rs.get(t)}function _j(t,l){const r=Rs.get(t);if(!r)return;if(r.directions)return Nj(r.directions,l);if(l==="down")return r.layer;const i=r.layer.pixels.filter(u=>u.y<2);if(i.length===0)return;const c=l==="right"?1:l==="left"?-1:0;return{name:r.layer.name,pixels:c?i.map(u=>({...u,x:u.x+c})):i}}function rg(){return Array.from(Rs.values())}jt("none","None",{name:"accessory",pixels:[]});jt("glasses","Glasses",{down:{name:"accessory",pixels:[{x:2,y:4,w:3,h:2,c:"#2A3A50",a:.5},{x:7,y:4,w:3,h:2,c:"#2A3A50",a:.5},{x:5,y:4,w:2,h:1,c:"#2A3A50",a:.3}]},up:{name:"accessory",pixels:[{x:0,y:3,w:2,h:1,c:"#2A3A50",a:.4},{x:10,y:3,w:2,h:1,c:"#2A3A50",a:.4}]},left:{name:"accessory",pixels:[{x:2,y:4,w:3,h:2,c:"#2A3A50",a:.5},{x:5,y:4,w:6,h:1,c:"#2A3A50",a:.3}]}});jt("round-glasses","Round Glasses",{down:{name:"accessory",pixels:[{x:2,y:3,w:3,h:3,c:"#8B7355",a:.4},{x:7,y:3,w:3,h:3,c:"#8B7355",a:.4},{x:3,y:4,w:1,h:1,c:"#B0E0FF",a:.15},{x:8,y:4,w:1,h:1,c:"#B0E0FF",a:.15},{x:5,y:4,w:2,h:1,c:"#8B7355",a:.3}]},up:{name:"accessory",pixels:[{x:0,y:3,w:2,h:1,c:"#8B7355",a:.3},{x:10,y:3,w:2,h:1,c:"#8B7355",a:.3}]},left:{name:"accessory",pixels:[{x:2,y:3,w:3,h:3,c:"#8B7355",a:.4},{x:3,y:4,w:1,h:1,c:"#B0E0FF",a:.15},{x:5,y:4,w:6,h:1,c:"#8B7355",a:.25}]}});jt("sunglasses","Sunglasses",{down:{name:"accessory",pixels:[{x:2,y:4,w:3,h:2,c:"#1A1A2E",a:.7},{x:7,y:4,w:3,h:2,c:"#1A1A2E",a:.7},{x:5,y:4,w:2,h:1,c:"#1A1A2E",a:.4},{x:3,y:4,w:1,h:1,c:"#334",a:.3},{x:8,y:4,w:1,h:1,c:"#334",a:.3}]},up:{name:"accessory",pixels:[{x:0,y:3,w:2,h:1,c:"#1A1A2E",a:.4},{x:10,y:3,w:2,h:1,c:"#1A1A2E",a:.4}]},left:{name:"accessory",pixels:[{x:2,y:4,w:3,h:2,c:"#1A1A2E",a:.7},{x:3,y:4,w:1,h:1,c:"#334",a:.3},{x:5,y:4,w:6,h:1,c:"#1A1A2E",a:.35}]}});jt("headphones","Headphones",{down:{name:"accessory",pixels:[{x:0,y:0,w:12,h:1,c:"#333",a:.7},{x:-1,y:1,w:2,h:5,c:"#444"},{x:11,y:1,w:2,h:5,c:"#444"},{x:-1,y:2,w:2,h:3,c:"#555",a:.3},{x:11,y:2,w:2,h:3,c:"#555",a:.3}]},up:{name:"accessory",pixels:[{x:0,y:0,w:12,h:1,c:"#333",a:.7},{x:-1,y:1,w:2,h:5,c:"#444"},{x:11,y:1,w:2,h:5,c:"#444"},{x:-1,y:2,w:2,h:3,c:"#555",a:.3},{x:11,y:2,w:2,h:3,c:"#555",a:.3}]},left:{name:"accessory",pixels:[{x:1,y:0,w:10,h:1,c:"#333",a:.7},{x:-1,y:1,w:3,h:5,c:"#444"},{x:-1,y:2,w:3,h:3,c:"#555",a:.3}]}});jt("beret","Beret",{down:{name:"accessory",pixels:[{x:2,y:-1,w:8,h:2,c:"#E91E63"},{x:1,y:0,w:2,h:1,c:"#E91E63",a:.6},{x:4,y:-1,w:4,h:1,c:"#F06292",a:.3}]},up:{name:"accessory",pixels:[{x:2,y:-1,w:8,h:2,c:"#E91E63"},{x:9,y:0,w:2,h:1,c:"#E91E63",a:.6}]},left:{name:"accessory",pixels:[{x:0,y:-1,w:8,h:2,c:"#E91E63"},{x:2,y:-1,w:4,h:1,c:"#F06292",a:.3}]}});jt("cap","Cap",{down:{name:"accessory",pixels:[{x:1,y:-1,w:10,h:2,c:"#1565C0"},{x:0,y:1,w:12,h:1,c:"#0D47A1"},{x:3,y:-1,w:6,h:1,c:"#1E88E5",a:.3}]},up:{name:"accessory",pixels:[{x:1,y:-1,w:10,h:2,c:"#1565C0"},{x:3,y:-1,w:6,h:1,c:"#1E88E5",a:.3},{x:5,y:1,w:2,h:1,c:"#0D47A1",a:.5}]},left:{name:"accessory",pixels:[{x:0,y:-1,w:9,h:2,c:"#1565C0"},{x:-2,y:1,w:6,h:1,c:"#0D47A1"},{x:2,y:-1,w:5,h:1,c:"#1E88E5",a:.3}]}});jt("badge","Badge",{down:{name:"accessory",pixels:[{x:5,y:8,w:2,h:3,c:"#2196F3",a:.4},{x:4,y:11,w:4,h:3,c:"#FFF",a:.5},{x:5,y:12,w:2,h:1,c:"#333",a:.3}]},up:{name:"accessory",pixels:[]},left:{name:"accessory",pixels:[{x:3,y:8,w:1,h:3,c:"#2196F3",a:.4},{x:2,y:11,w:3,h:3,c:"#FFF",a:.5}]}});jt("lapels","Lapels",{down:{name:"accessory",pixels:[{x:1,y:10,w:3,h:2,c:"#1A1A2E",a:.4},{x:8,y:10,w:3,h:2,c:"#1A1A2E",a:.4}]},up:{name:"accessory",pixels:[]},left:{name:"accessory",pixels:[{x:1,y:10,w:3,h:2,c:"#1A1A2E",a:.4}]}});jt("blush","Blush",{down:{name:"accessory",pixels:[{x:2,y:6,w:1,h:1,c:"#FFCDD2",a:.3},{x:9,y:6,w:1,h:1,c:"#FFCDD2",a:.3}]},up:{name:"accessory",pixels:[]},left:{name:"accessory",pixels:[{x:2,y:6,w:1,h:1,c:"#FFCDD2",a:.3}]}});jt("scarf","Scarf",{down:{name:"accessory",pixels:[{x:2,y:9,w:8,h:2,c:"#E53935",a:.6},{x:3,y:9,w:6,h:1,c:"#EF5350",a:.3},{x:3,y:11,w:2,h:3,c:"#E53935",a:.5}]},up:{name:"accessory",pixels:[{x:2,y:9,w:8,h:2,c:"#E53935",a:.6},{x:3,y:9,w:6,h:1,c:"#EF5350",a:.3}]},left:{name:"accessory",pixels:[{x:1,y:9,w:8,h:2,c:"#E53935",a:.6},{x:2,y:9,w:5,h:1,c:"#EF5350",a:.3},{x:1,y:11,w:2,h:3,c:"#E53935",a:.5}]}});jt("tie","Tie",{down:{name:"accessory",pixels:[{x:5,y:9,w:2,h:1,c:"#B71C1C"},{x:5,y:10,w:2,h:4,c:"#D32F2F"},{x:5,y:10,w:1,h:4,c:"#E53935",a:.3},{x:5,y:14,w:2,h:1,c:"#B71C1C",a:.8}]},up:{name:"accessory",pixels:[]},left:{name:"accessory",pixels:[{x:4,y:9,w:2,h:1,c:"#B71C1C"},{x:4,y:10,w:2,h:4,c:"#D32F2F"},{x:4,y:14,w:2,h:1,c:"#B71C1C",a:.8}]}});jt("bowtie","Bowtie",{down:{name:"accessory",pixels:[{x:3,y:9,w:2,h:1,c:"#D32F2F"},{x:7,y:9,w:2,h:1,c:"#D32F2F"},{x:5,y:9,w:2,h:1,c:"#B71C1C"},{x:4,y:9,w:1,h:1,c:"#E53935",a:.3},{x:7,y:9,w:1,h:1,c:"#E53935",a:.3}]},up:{name:"accessory",pixels:[]},left:{name:"accessory",pixels:[{x:3,y:9,w:3,h:1,c:"#D32F2F"},{x:4,y:9,w:1,h:1,c:"#B71C1C"}]}});jt("cat-ears","Cat Ears",{down:{name:"accessory",pixels:[{x:1,y:-3,w:2,h:1,c:"#555"},{x:0,y:-2,w:3,h:1,c:"#555"},{x:0,y:-1,w:3,h:1,c:"#555"},{x:1,y:-2,w:1,h:1,c:"#FFB0C0",a:.6},{x:9,y:-3,w:2,h:1,c:"#555"},{x:9,y:-2,w:3,h:1,c:"#555"},{x:9,y:-1,w:3,h:1,c:"#555"},{x:10,y:-2,w:1,h:1,c:"#FFB0C0",a:.6}]},up:{name:"accessory",pixels:[{x:1,y:-3,w:2,h:1,c:"#555"},{x:0,y:-2,w:3,h:1,c:"#555"},{x:0,y:-1,w:3,h:1,c:"#555"},{x:9,y:-3,w:2,h:1,c:"#555"},{x:9,y:-2,w:3,h:1,c:"#555"},{x:9,y:-1,w:3,h:1,c:"#555"}]},left:{name:"accessory",pixels:[{x:2,y:-3,w:2,h:1,c:"#555"},{x:1,y:-2,w:3,h:1,c:"#555"},{x:1,y:-1,w:3,h:1,c:"#555"},{x:2,y:-2,w:1,h:1,c:"#FFB0C0",a:.6}]}});jt("bear-ears","Bear Ears",{down:{name:"accessory",pixels:[{x:0,y:-2,w:3,h:2,c:"#8B6914"},{x:1,y:-1,w:1,h:1,c:"#C4A24A",a:.5},{x:9,y:-2,w:3,h:2,c:"#8B6914"},{x:10,y:-1,w:1,h:1,c:"#C4A24A",a:.5}]},up:{name:"accessory",pixels:[{x:0,y:-2,w:3,h:2,c:"#8B6914"},{x:9,y:-2,w:3,h:2,c:"#8B6914"}]},left:{name:"accessory",pixels:[{x:1,y:-2,w:3,h:2,c:"#8B6914"},{x:2,y:-1,w:1,h:1,c:"#C4A24A",a:.5}]}});jt("bunny-ears","Bunny Ears",{down:{name:"accessory",pixels:[{x:2,y:-5,w:2,h:4,c:"#F5F5F5"},{x:2,y:-4,w:1,h:2,c:"#FFB0C0",a:.5},{x:8,y:-5,w:2,h:4,c:"#F5F5F5"},{x:9,y:-4,w:1,h:2,c:"#FFB0C0",a:.5},{x:9,y:-6,w:2,h:1,c:"#F5F5F5"}]},up:{name:"accessory",pixels:[{x:2,y:-5,w:2,h:4,c:"#F5F5F5"},{x:8,y:-5,w:2,h:4,c:"#F5F5F5"},{x:9,y:-6,w:2,h:1,c:"#F5F5F5"}]},left:{name:"accessory",pixels:[{x:3,y:-5,w:2,h:4,c:"#F5F5F5"},{x:3,y:-4,w:1,h:2,c:"#FFB0C0",a:.5},{x:4,y:-6,w:2,h:1,c:"#F5F5F5"}]}});jt("dog-nose","Dog Nose",{down:{name:"accessory",pixels:[{x:4,y:5,w:4,h:3,c:"#D2B48C",a:.5},{x:5,y:5,w:2,h:1,c:"#222"},{x:6,y:7,w:1,h:1,c:"#FF6B8A",a:.7}]},up:{name:"accessory",pixels:[]},left:{name:"accessory",pixels:[{x:0,y:5,w:4,h:2,c:"#D2B48C",a:.5},{x:0,y:5,w:2,h:1,c:"#222"},{x:1,y:7,w:1,h:1,c:"#FF6B8A",a:.7}]}});jt("fox-mask","Fox Mask",{down:{name:"accessory",pixels:[{x:0,y:-3,w:2,h:1,c:"#E65100"},{x:-1,y:-2,w:3,h:1,c:"#E65100"},{x:0,y:-1,w:3,h:1,c:"#E65100"},{x:10,y:-3,w:2,h:1,c:"#E65100"},{x:10,y:-2,w:3,h:1,c:"#E65100"},{x:9,y:-1,w:3,h:1,c:"#E65100"},{x:0,y:-2,w:1,h:1,c:"#FFF",a:.4},{x:11,y:-2,w:1,h:1,c:"#FFF",a:.4},{x:1,y:5,w:2,h:2,c:"#FFF",a:.25},{x:9,y:5,w:2,h:2,c:"#FFF",a:.25},{x:5,y:6,w:2,h:1,c:"#222",a:.6}]},up:{name:"accessory",pixels:[{x:0,y:-3,w:2,h:1,c:"#E65100"},{x:-1,y:-2,w:3,h:1,c:"#E65100"},{x:0,y:-1,w:3,h:1,c:"#E65100"},{x:10,y:-3,w:2,h:1,c:"#E65100"},{x:10,y:-2,w:3,h:1,c:"#E65100"},{x:9,y:-1,w:3,h:1,c:"#E65100"}]},left:{name:"accessory",pixels:[{x:1,y:-3,w:2,h:1,c:"#E65100"},{x:0,y:-2,w:3,h:1,c:"#E65100"},{x:1,y:-1,w:3,h:1,c:"#E65100"},{x:1,y:-2,w:1,h:1,c:"#FFF",a:.4},{x:1,y:5,w:2,h:2,c:"#FFF",a:.25},{x:1,y:6,w:2,h:1,c:"#222",a:.6}]}});jt("crown","Crown",{down:{name:"accessory",pixels:[{x:2,y:-1,w:8,h:2,c:"#FFD700"},{x:3,y:-3,w:2,h:2,c:"#FFD700"},{x:5,y:-2,w:2,h:1,c:"#FFD700"},{x:7,y:-3,w:2,h:2,c:"#FFD700"},{x:4,y:-2,w:1,h:1,c:"#E53935",a:.8},{x:6,y:-1,w:1,h:1,c:"#42A5F5",a:.8},{x:8,y:-2,w:1,h:1,c:"#66BB6A",a:.8},{x:3,y:-1,w:6,h:1,c:"#FFF",a:.15}]},up:{name:"accessory",pixels:[{x:2,y:-1,w:8,h:2,c:"#FFD700"},{x:3,y:-3,w:2,h:2,c:"#FFD700"},{x:5,y:-2,w:2,h:1,c:"#FFD700"},{x:7,y:-3,w:2,h:2,c:"#FFD700"},{x:3,y:-1,w:6,h:1,c:"#FFF",a:.15}]},left:{name:"accessory",pixels:[{x:1,y:-1,w:7,h:2,c:"#FFD700"},{x:2,y:-3,w:2,h:2,c:"#FFD700"},{x:5,y:-2,w:2,h:1,c:"#FFD700"},{x:3,y:-2,w:1,h:1,c:"#E53935",a:.8},{x:5,y:-1,w:1,h:1,c:"#42A5F5",a:.8},{x:2,y:-1,w:5,h:1,c:"#FFF",a:.15}]}});jt("halo","Halo",{down:{name:"accessory",pixels:[{x:2,y:-3,w:8,h:1,c:"#FFE082",a:.7},{x:1,y:-2,w:1,h:1,c:"#FFE082",a:.5},{x:10,y:-2,w:1,h:1,c:"#FFE082",a:.5},{x:3,y:-4,w:6,h:1,c:"#FFF9C4",a:.4},{x:3,y:-3,w:6,h:1,c:"#FFF",a:.15}]},up:{name:"accessory",pixels:[{x:2,y:-3,w:8,h:1,c:"#FFE082",a:.7},{x:1,y:-2,w:1,h:1,c:"#FFE082",a:.5},{x:10,y:-2,w:1,h:1,c:"#FFE082",a:.5},{x:3,y:-4,w:6,h:1,c:"#FFF9C4",a:.4},{x:3,y:-3,w:6,h:1,c:"#FFF",a:.15}]},left:{name:"accessory",pixels:[{x:1,y:-3,w:7,h:1,c:"#FFE082",a:.7},{x:0,y:-2,w:1,h:1,c:"#FFE082",a:.5},{x:8,y:-2,w:1,h:1,c:"#FFE082",a:.5},{x:2,y:-4,w:5,h:1,c:"#FFF9C4",a:.4},{x:2,y:-3,w:5,h:1,c:"#FFF",a:.15}]}});jt("horns","Horns",{down:{name:"accessory",pixels:[{x:1,y:-1,w:2,h:2,c:"#8B0000"},{x:0,y:-3,w:2,h:2,c:"#A00"},{x:0,y:-4,w:1,h:1,c:"#C62828"},{x:9,y:-1,w:2,h:2,c:"#8B0000"},{x:10,y:-3,w:2,h:2,c:"#A00"},{x:11,y:-4,w:1,h:1,c:"#C62828"}]},up:{name:"accessory",pixels:[{x:1,y:-1,w:2,h:2,c:"#8B0000"},{x:0,y:-3,w:2,h:2,c:"#A00"},{x:0,y:-4,w:1,h:1,c:"#C62828"},{x:9,y:-1,w:2,h:2,c:"#8B0000"},{x:10,y:-3,w:2,h:2,c:"#A00"},{x:11,y:-4,w:1,h:1,c:"#C62828"}]},left:{name:"accessory",pixels:[{x:2,y:-1,w:2,h:2,c:"#8B0000"},{x:1,y:-3,w:2,h:2,c:"#A00"},{x:1,y:-4,w:1,h:1,c:"#C62828"}]}});jt("mask","Mask",{down:{name:"accessory",pixels:[{x:1,y:3,w:10,h:3,c:"#1A1A2E",a:.75},{x:3,y:4,w:2,h:1,c:"#000",a:0},{x:7,y:4,w:2,h:1,c:"#000",a:0},{x:1,y:3,w:10,h:1,c:"#FFD700",a:.3},{x:1,y:5,w:10,h:1,c:"#FFD700",a:.2}]},up:{name:"accessory",pixels:[{x:0,y:4,w:12,h:1,c:"#1A1A2E",a:.3}]},left:{name:"accessory",pixels:[{x:1,y:3,w:6,h:3,c:"#1A1A2E",a:.75},{x:2,y:4,w:2,h:1,c:"#000",a:0},{x:1,y:3,w:6,h:1,c:"#FFD700",a:.3},{x:1,y:5,w:6,h:1,c:"#FFD700",a:.2}]}});jt("bandana","Bandana",{down:{name:"accessory",pixels:[{x:0,y:1,w:12,h:2,c:"#E53935"},{x:1,y:1,w:10,h:1,c:"#EF5350",a:.3}]},up:{name:"accessory",pixels:[{x:0,y:1,w:12,h:2,c:"#E53935"},{x:1,y:1,w:10,h:1,c:"#EF5350",a:.3},{x:11,y:2,w:2,h:2,c:"#E53935",a:.7},{x:12,y:3,w:1,h:1,c:"#C62828",a:.5}]},left:{name:"accessory",pixels:[{x:0,y:1,w:10,h:2,c:"#E53935"},{x:1,y:1,w:8,h:1,c:"#EF5350",a:.3}]}});jt("eyepatch","Eye Patch",{down:{name:"accessory",pixels:[{x:0,y:3,w:12,h:1,c:"#222",a:.5},{x:2,y:3,w:3,h:3,c:"#1A1A1A"},{x:3,y:4,w:1,h:1,c:"#333",a:.3}]},up:{name:"accessory",pixels:[{x:0,y:3,w:12,h:1,c:"#222",a:.5}]},left:{name:"accessory",pixels:[{x:0,y:3,w:10,h:1,c:"#222",a:.5},{x:1,y:3,w:3,h:3,c:"#1A1A1A"},{x:2,y:4,w:1,h:1,c:"#333",a:.3}]}});jt("cat-face","Cat Face",{down:{name:"accessory",pixels:[{x:1,y:1,w:10,h:8,c:"#555"},{x:2,y:0,w:8,h:1,c:"#555"},{x:0,y:-2,w:3,h:2,c:"#555"},{x:1,y:-3,w:2,h:1,c:"#555"},{x:9,y:-2,w:3,h:2,c:"#555"},{x:9,y:-3,w:2,h:1,c:"#555"},{x:1,y:-1,w:1,h:1,c:"#FFB0C0",a:.7},{x:10,y:-1,w:1,h:1,c:"#FFB0C0",a:.7},{x:2,y:3,w:3,h:3,c:"#222"},{x:7,y:3,w:3,h:3,c:"#222"},{x:3,y:3,w:1,h:2,c:"#4FC3F7",a:.8},{x:8,y:3,w:1,h:2,c:"#4FC3F7",a:.8},{x:3,y:4,w:1,h:1,c:"#111"},{x:8,y:4,w:1,h:1,c:"#111"},{x:5,y:5,w:2,h:1,c:"#FFB0C0"},{x:4,y:6,w:1,h:1,c:"#444",a:.6},{x:7,y:6,w:1,h:1,c:"#444",a:.6},{x:0,y:5,w:2,h:1,c:"#888",a:.4},{x:10,y:5,w:2,h:1,c:"#888",a:.4},{x:0,y:6,w:2,h:1,c:"#888",a:.3},{x:10,y:6,w:2,h:1,c:"#888",a:.3}]},up:{name:"accessory",pixels:[{x:1,y:1,w:10,h:8,c:"#555"},{x:2,y:0,w:8,h:1,c:"#555"},{x:0,y:-2,w:3,h:2,c:"#555"},{x:1,y:-3,w:2,h:1,c:"#555"},{x:9,y:-2,w:3,h:2,c:"#555"},{x:9,y:-3,w:2,h:1,c:"#555"},{x:5,y:1,w:2,h:5,c:"#4A4A4A",a:.3},{x:9,y:8,w:2,h:2,c:"#555"},{x:10,y:7,w:1,h:1,c:"#555"}]},left:{name:"accessory",pixels:[{x:1,y:1,w:9,h:8,c:"#555"},{x:2,y:0,w:7,h:1,c:"#555"},{x:2,y:-2,w:3,h:2,c:"#555"},{x:3,y:-3,w:2,h:1,c:"#555"},{x:3,y:-1,w:1,h:1,c:"#FFB0C0",a:.7},{x:2,y:3,w:3,h:3,c:"#222"},{x:3,y:3,w:1,h:2,c:"#4FC3F7",a:.8},{x:3,y:4,w:1,h:1,c:"#111"},{x:0,y:5,w:3,h:2,c:"#555"},{x:0,y:5,w:2,h:1,c:"#FFB0C0"},{x:-1,y:5,w:2,h:1,c:"#888",a:.4},{x:-1,y:6,w:2,h:1,c:"#888",a:.3}]}});jt("bear-face","Bear Face",{down:{name:"accessory",pixels:[{x:1,y:0,w:10,h:9,c:"#8B6914"},{x:2,y:-1,w:8,h:1,c:"#8B6914"},{x:0,y:-1,w:3,h:3,c:"#8B6914"},{x:9,y:-1,w:3,h:3,c:"#8B6914"},{x:1,y:0,w:1,h:1,c:"#C4A24A",a:.6},{x:10,y:0,w:1,h:1,c:"#C4A24A",a:.6},{x:3,y:5,w:6,h:4,c:"#C4A24A",a:.7},{x:3,y:3,w:2,h:2,c:"#111"},{x:7,y:3,w:2,h:2,c:"#111"},{x:3,y:3,w:1,h:1,c:"#FFF",a:.3},{x:7,y:3,w:1,h:1,c:"#FFF",a:.3},{x:5,y:5,w:2,h:1,c:"#222"},{x:5,y:7,w:2,h:1,c:"#6B4F10",a:.5}]},up:{name:"accessory",pixels:[{x:1,y:0,w:10,h:9,c:"#8B6914"},{x:2,y:-1,w:8,h:1,c:"#8B6914"},{x:0,y:-1,w:3,h:3,c:"#8B6914"},{x:9,y:-1,w:3,h:3,c:"#8B6914"},{x:1,y:0,w:1,h:1,c:"#C4A24A",a:.6},{x:10,y:0,w:1,h:1,c:"#C4A24A",a:.6},{x:5,y:1,w:2,h:5,c:"#7A5B10",a:.3}]},left:{name:"accessory",pixels:[{x:1,y:0,w:9,h:9,c:"#8B6914"},{x:2,y:-1,w:7,h:1,c:"#8B6914"},{x:0,y:-1,w:3,h:3,c:"#8B6914"},{x:0,y:0,w:1,h:1,c:"#C4A24A",a:.6},{x:0,y:4,w:3,h:4,c:"#C4A24A",a:.7},{x:3,y:3,w:2,h:2,c:"#111"},{x:3,y:3,w:1,h:1,c:"#FFF",a:.3},{x:1,y:5,w:2,h:1,c:"#222"}]}});jt("panda-face","Panda Face",{down:{name:"accessory",pixels:[{x:1,y:0,w:10,h:9,c:"#F5F5F5"},{x:2,y:-1,w:8,h:1,c:"#F5F5F5"},{x:0,y:-2,w:3,h:3,c:"#222"},{x:9,y:-2,w:3,h:3,c:"#222"},{x:2,y:2,w:3,h:4,c:"#222"},{x:7,y:2,w:3,h:4,c:"#222"},{x:3,y:3,w:1,h:2,c:"#FFF"},{x:8,y:3,w:1,h:2,c:"#FFF"},{x:3,y:4,w:1,h:1,c:"#111"},{x:8,y:4,w:1,h:1,c:"#111"},{x:5,y:6,w:2,h:1,c:"#222"},{x:5,y:7,w:1,h:1,c:"#CCC",a:.4},{x:6,y:7,w:1,h:1,c:"#CCC",a:.4}]},up:{name:"accessory",pixels:[{x:1,y:0,w:10,h:9,c:"#F5F5F5"},{x:2,y:-1,w:8,h:1,c:"#F5F5F5"},{x:0,y:-2,w:3,h:3,c:"#222"},{x:9,y:-2,w:3,h:3,c:"#222"},{x:5,y:1,w:2,h:5,c:"#EEE",a:.3}]},left:{name:"accessory",pixels:[{x:1,y:0,w:9,h:9,c:"#F5F5F5"},{x:2,y:-1,w:7,h:1,c:"#F5F5F5"},{x:0,y:-2,w:3,h:3,c:"#222"},{x:2,y:2,w:3,h:4,c:"#222"},{x:3,y:3,w:1,h:2,c:"#FFF"},{x:3,y:4,w:1,h:1,c:"#111"},{x:0,y:5,w:3,h:2,c:"#F5F5F5"},{x:1,y:6,w:1,h:1,c:"#222"}]}});jt("frog-face","Frog Face",{down:{name:"accessory",pixels:[{x:1,y:1,w:10,h:8,c:"#4CAF50"},{x:2,y:0,w:8,h:1,c:"#4CAF50"},{x:1,y:-2,w:4,h:3,c:"#4CAF50"},{x:7,y:-2,w:4,h:3,c:"#4CAF50"},{x:2,y:-1,w:2,h:2,c:"#FFF"},{x:8,y:-1,w:2,h:2,c:"#FFF"},{x:3,y:0,w:1,h:1,c:"#111"},{x:9,y:0,w:1,h:1,c:"#111"},{x:3,y:5,w:6,h:3,c:"#81C784",a:.5},{x:2,y:7,w:8,h:1,c:"#388E3C",a:.6},{x:4,y:4,w:1,h:1,c:"#388E3C",a:.5},{x:7,y:4,w:1,h:1,c:"#388E3C",a:.5},{x:1,y:5,w:2,h:1,c:"#FF8A80",a:.25},{x:9,y:5,w:2,h:1,c:"#FF8A80",a:.25}]},up:{name:"accessory",pixels:[{x:1,y:1,w:10,h:8,c:"#4CAF50"},{x:2,y:0,w:8,h:1,c:"#4CAF50"},{x:1,y:-2,w:4,h:2,c:"#4CAF50"},{x:7,y:-2,w:4,h:2,c:"#4CAF50"},{x:5,y:2,w:2,h:4,c:"#388E3C",a:.2}]},left:{name:"accessory",pixels:[{x:1,y:1,w:9,h:8,c:"#4CAF50"},{x:2,y:0,w:7,h:1,c:"#4CAF50"},{x:0,y:-2,w:4,h:3,c:"#4CAF50"},{x:1,y:-1,w:2,h:2,c:"#FFF"},{x:2,y:0,w:1,h:1,c:"#111"},{x:0,y:5,w:3,h:3,c:"#81C784",a:.5},{x:0,y:7,w:8,h:1,c:"#388E3C",a:.6},{x:1,y:5,w:1,h:1,c:"#FF8A80",a:.25}]}});jt("rabbit-face","Rabbit Face",{down:{name:"accessory",pixels:[{x:1,y:1,w:10,h:8,c:"#F5F5F5"},{x:2,y:0,w:8,h:1,c:"#F5F5F5"},{x:2,y:-6,w:3,h:6,c:"#F5F5F5"},{x:7,y:-6,w:3,h:6,c:"#F5F5F5"},{x:3,y:-5,w:1,h:4,c:"#FFB0C0",a:.6},{x:8,y:-5,w:1,h:4,c:"#FFB0C0",a:.6},{x:2,y:3,w:3,h:3,c:"#E57373",a:.7},{x:7,y:3,w:3,h:3,c:"#E57373",a:.7},{x:3,y:3,w:1,h:1,c:"#FFF",a:.4},{x:8,y:3,w:1,h:1,c:"#FFF",a:.4},{x:5,y:5,w:2,h:1,c:"#FFB0C0"},{x:5,y:6,w:1,h:1,c:"#DDD",a:.4},{x:6,y:6,w:1,h:1,c:"#DDD",a:.4},{x:0,y:4,w:2,h:3,c:"#F5F5F5",a:.6},{x:10,y:4,w:2,h:3,c:"#F5F5F5",a:.6}]},up:{name:"accessory",pixels:[{x:1,y:1,w:10,h:8,c:"#F5F5F5"},{x:2,y:0,w:8,h:1,c:"#F5F5F5"},{x:2,y:-6,w:3,h:6,c:"#F5F5F5"},{x:7,y:-6,w:3,h:6,c:"#F5F5F5"},{x:3,y:-5,w:1,h:4,c:"#FFB0C0",a:.6},{x:8,y:-5,w:1,h:4,c:"#FFB0C0",a:.6},{x:5,y:8,w:3,h:2,c:"#FFF"}]},left:{name:"accessory",pixels:[{x:1,y:1,w:9,h:8,c:"#F5F5F5"},{x:2,y:0,w:7,h:1,c:"#F5F5F5"},{x:3,y:-6,w:3,h:6,c:"#F5F5F5"},{x:4,y:-5,w:1,h:4,c:"#FFB0C0",a:.6},{x:2,y:3,w:3,h:3,c:"#E57373",a:.7},{x:3,y:3,w:1,h:1,c:"#FFF",a:.4},{x:0,y:4,w:3,h:3,c:"#F5F5F5"},{x:1,y:5,w:1,h:1,c:"#FFB0C0"},{x:0,y:4,w:2,h:3,c:"#F5F5F5",a:.6}]}});jt("dog-face","Dog Face",{down:{name:"accessory",pixels:[{x:1,y:0,w:10,h:9,c:"#D2A25C"},{x:2,y:-1,w:8,h:1,c:"#D2A25C"},{x:-1,y:1,w:3,h:6,c:"#A67B3D"},{x:10,y:1,w:3,h:6,c:"#A67B3D"},{x:3,y:5,w:6,h:4,c:"#F5E6D0",a:.8},{x:3,y:2,w:2,h:3,c:"#3E2723"},{x:7,y:2,w:2,h:3,c:"#3E2723"},{x:3,y:2,w:1,h:1,c:"#FFF",a:.4},{x:7,y:2,w:1,h:1,c:"#FFF",a:.4},{x:5,y:5,w:2,h:2,c:"#222"},{x:5,y:7,w:2,h:2,c:"#FF6B8A",a:.8},{x:5,y:7,w:1,h:1,c:"#FF8A9E",a:.4}]},up:{name:"accessory",pixels:[{x:1,y:0,w:10,h:9,c:"#D2A25C"},{x:2,y:-1,w:8,h:1,c:"#D2A25C"},{x:-1,y:1,w:3,h:6,c:"#A67B3D"},{x:10,y:1,w:3,h:6,c:"#A67B3D"},{x:5,y:0,w:2,h:6,c:"#B8883C",a:.3},{x:2,y:8,w:8,h:1,c:"#A67B3D",a:.5}]},left:{name:"accessory",pixels:[{x:1,y:0,w:9,h:9,c:"#D2A25C"},{x:2,y:-1,w:7,h:1,c:"#D2A25C"},{x:-1,y:1,w:3,h:6,c:"#A67B3D"},{x:-1,y:4,w:3,h:4,c:"#D2A25C"},{x:-1,y:5,w:2,h:3,c:"#F5E6D0",a:.8},{x:3,y:2,w:2,h:3,c:"#3E2723"},{x:3,y:2,w:1,h:1,c:"#FFF",a:.4},{x:0,y:5,w:2,h:1,c:"#222"},{x:0,y:7,w:2,h:1,c:"#FF6B8A",a:.7}]}});const Oj={none:1,glasses:1,beret:1,cap:1,badge:1,blush:1,lapels:1,"round-glasses":2,headphones:2,scarf:3,tie:3,bowtie:3,sunglasses:4,bandana:4,eyepatch:4,crown:5,halo:5,horns:5,mask:5,"cat-ears":6,"bear-ears":6,"bunny-ears":6,"dog-nose":6,"fox-mask":6,"cat-face":7,"bear-face":7,"panda-face":7,"frog-face":8,"rabbit-face":8,"dog-face":8,"star-glasses":9};function ag(t){return Oj[t]??1}function ig(t,l){return l>=ag(t)}jt("star-glasses","Star Glasses",{down:{name:"accessory",pixels:[{x:1,y:3,w:4,h:3,c:"#FF4081",a:.6},{x:2,y:2,w:2,h:1,c:"#FF4081",a:.6},{x:2,y:6,w:2,h:1,c:"#FF4081",a:.6},{x:7,y:3,w:4,h:3,c:"#FF4081",a:.6},{x:8,y:2,w:2,h:1,c:"#FF4081",a:.6},{x:8,y:6,w:2,h:1,c:"#FF4081",a:.6},{x:5,y:4,w:2,h:1,c:"#FF4081",a:.4}]},up:{name:"accessory",pixels:[{x:0,y:3,w:2,h:1,c:"#FF4081",a:.3},{x:10,y:3,w:2,h:1,c:"#FF4081",a:.3}]},left:{name:"accessory",pixels:[{x:1,y:3,w:4,h:3,c:"#FF4081",a:.6},{x:2,y:2,w:2,h:1,c:"#FF4081",a:.6},{x:2,y:6,w:2,h:1,c:"#FF4081",a:.6},{x:5,y:4,w:6,h:1,c:"#FF4081",a:.3}]}});function vs({r:t,g:l,b:r}){return`#${(t<<16|l<<8|r).toString(16).padStart(6,"0")}`}function bc(t,l){const r=t.r-l.r,i=t.g-l.g,c=t.b-l.b;return r*r+i*i+c*c}function Bj(t,l){const r=[];r.push(t[Math.floor(Math.random()*t.length)]);for(let i=1;i<l;i++){const c=t.map(m=>{let x=1/0;for(const f of r)x=Math.min(x,bc(m,f));return x}),u=c.reduce((m,x)=>m+x,0);let d=Math.random()*u;for(let m=0;m<t.length;m++)if(d-=c[m],d<=0){r.push(t[m]);break}r.length<=i&&r.push(t[Math.floor(Math.random()*t.length)])}return r}function Lj(t,l,r=20){if(t.length===0)return[];const i=Bj(t,l);for(let u=0;u<r;u++){const d=Array.from({length:l},()=>[]);for(const x of t){let f=1/0,g=0;for(let y=0;y<l;y++){const b=bc(x,i[y]);b<f&&(f=b,g=y)}d[g].push(x)}let m=!0;for(let x=0;x<l;x++){if(d[x].length===0)continue;const f={r:0,g:0,b:0};for(const b of d[x])f.r+=b.r,f.g+=b.g,f.b+=b.b;const g=d[x].length,y={r:Math.round(f.r/g),g:Math.round(f.g/g),b:Math.round(f.b/g)};bc(y,i[x])>1&&(m=!1),i[x]=y}if(m)break}const c=new Array(l).fill(0);for(const u of t){let d=1/0,m=0;for(let x=0;x<l;x++){const f=bc(u,i[x]);f<d&&(d=f,m=x)}c[m]++}return i.map((u,d)=>({c:u,count:c[d]})).sort((u,d)=>d.count-u.count).map(u=>u.c)}function $j(t,l=1e4){const r=document.createElement("canvas"),i=t instanceof HTMLImageElement?t.naturalWidth:t.width,c=t instanceof HTMLImageElement?t.naturalHeight:t.height;r.width=i,r.height=c;const u=r.getContext("2d");u.drawImage(t,0,0);const d=u.getImageData(0,0,i,c).data,m=i*c,x=Math.max(1,Math.floor(m/l)),f=[];for(let g=0;g<m;g+=x){const y=g*4;d[y+3]<128||f.push({r:d[y],g:d[y+1],b:d[y+2]})}return f}function c0(t){return .299*t.r+.587*t.g+.114*t.b}function u0(t){const l=Math.max(t.r,t.g,t.b),r=Math.min(t.r,t.g,t.b);return l===0?0:(l-r)/l*255}function Hj(t,l=8){const r=$j(t),i=Lj(r,l);if(i.length<5)return{skinColor:"#F5CBA7",hairColor:"#2C1810",shirtColor:"#1565C0",pantsColor:"#37474F",shoeColor:"#212121"};const c=[...i].sort((y,b)=>c0(b)-c0(y)),u=[...i].sort((y,b)=>u0(b)-u0(y)),d=c[0],m=c[c.length-1],x=u[0],f=c[c.length-2],g=c[c.length-1];return{skinColor:vs(d),hairColor:vs(m),shirtColor:vs(x),pantsColor:vs(f),shoeColor:vs(g)}}const Uj=[{x:1,y:19,w:10,h:2,c:"#100A06",a:.15},{x:2,y:15,w:3,h:4,c:"$pants"},{x:7,y:15,w:3,h:4,c:"$pants"},{x:2,y:19,w:3,h:2,c:"$shoes"},{x:7,y:19,w:3,h:2,c:"$shoes"},{x:2,y:19,w:3,h:1,c:"lighten($shoes, 20)",a:.4},{x:7,y:19,w:3,h:1,c:"lighten($shoes, 20)",a:.4}],Ij=[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:2,y:10,w:8,h:1,c:"lighten($shirt, 18)",a:.3},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:4,y:10,w:4,h:2,c:"darken($shirt, 25)",a:.2},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}],Yj=[{x:4,y:8,w:4,h:3,c:"$skin"},{x:1,y:1,w:10,h:8,c:"$skin"},{x:3,y:4,w:2,h:2,c:"#1A1A2E"},{x:7,y:4,w:2,h:2,c:"#1A1A2E"},{x:3,y:4,w:1,h:1,c:"#FFF",a:.35},{x:7,y:4,w:1,h:1,c:"#FFF",a:.35},{x:5,y:7,w:2,h:1,c:"darken($skin, 25)",a:.4},{x:0,y:4,w:1,h:1,c:"$skin"},{x:11,y:4,w:1,h:1,c:"$skin"}],qj=[{x:1,y:0,w:10,h:3,c:"$hair"},{x:0,y:1,w:2,h:3,c:"$hair"},{x:10,y:1,w:2,h:3,c:"$hair"},{x:2,y:0,w:8,h:1,c:"lighten($hair, 25)",a:.3},{x:2,y:2,w:8,h:1,c:"darken($hair, 20)",a:.2}];function Xj(){return{width:12,height:22,layers:[{name:"lower",pixels:Uj},{name:"torso",pixels:Ij},{name:"head",pixels:Yj},{name:"hair",pixels:qj},{name:"accessory",pixels:[]}]}}const Vj=["cto","cbo","pm","engineer","designer","qa","data-analyst","default"];for(const t of Vj)eg(`mini:${t}`,Xj());const Gj=[{x:1,y:10,w:10,h:8,c:"$shirt"},{x:2,y:10,w:8,h:1,c:"lighten($shirt, 18)",a:.3},{x:1,y:10,w:1,h:7,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:7,c:"darken($shirt, 25)",a:.25},{x:4,y:10,w:4,h:2,c:"darken($shirt, 25)",a:.2},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"}],Kj=[{x:4,y:8,w:4,h:3,c:"$skin"},{x:1,y:1,w:10,h:8,c:"$skin"},{x:3,y:4,w:2,h:2,c:"#1A1A2E"},{x:7,y:4,w:2,h:2,c:"#1A1A2E"},{x:3,y:4,w:1,h:1,c:"#FFF",a:.35},{x:7,y:4,w:1,h:1,c:"#FFF",a:.35},{x:5,y:7,w:2,h:1,c:"darken($skin, 25)",a:.4},{x:0,y:4,w:1,h:1,c:"$skin"},{x:11,y:4,w:1,h:1,c:"$skin"}],Qj=[{x:1,y:0,w:10,h:3,c:"$hair"},{x:0,y:1,w:2,h:3,c:"$hair"},{x:10,y:1,w:2,h:3,c:"$hair"},{x:2,y:0,w:8,h:1,c:"lighten($hair, 25)",a:.3},{x:2,y:2,w:8,h:1,c:"darken($hair, 20)",a:.2}];function Wj(){return{width:12,height:22,layers:[{name:"torso",pixels:Gj},{name:"head",pixels:Kj},{name:"hair",pixels:Qj},{name:"accessory",pixels:[]}]}}eg("mini-seated:default",Wj());const Zj={canvasWidth:160,canvasHeight:80,scale:2,pixels:[{x:0,y:0,w:80,h:40,c:"#1e2030"},{x:10,y:2,w:10,h:6,c:"#78889c"},{x:10,y:2,w:10,h:1,c:"#8899ad"},{x:24,y:0,w:10,h:6,c:"#78889c"},{x:24,y:0,w:10,h:1,c:"#8899ad"},{x:38,y:2,w:10,h:6,c:"#78889c"},{x:38,y:2,w:10,h:1,c:"#8899ad"},{x:54,y:2,w:10,h:6,c:"#78889c"},{x:54,y:2,w:10,h:1,c:"#8899ad"},{x:11,y:7,w:2,h:2,c:"#2a2a2a"},{x:17,y:7,w:2,h:2,c:"#2a2a2a"},{x:25,y:5,w:2,h:2,c:"#2a2a2a"},{x:31,y:5,w:2,h:2,c:"#2a2a2a"},{x:39,y:7,w:2,h:2,c:"#2a2a2a"},{x:45,y:7,w:2,h:2,c:"#2a2a2a"},{x:55,y:7,w:2,h:2,c:"#2a2a2a"},{x:61,y:7,w:2,h:2,c:"#2a2a2a"},{x:8,y:8,w:64,h:24,c:"#6b5b4b"},{x:4,y:10,w:72,h:20,c:"#7d6d5d"},{x:2,y:12,w:76,h:16,c:"#7d6d5d"},{x:2,y:12,w:76,h:2,c:"#8b7b6b"},{x:2,y:26,w:76,h:2,c:"#4b3b2b"},{x:2,y:28,w:76,h:3,c:"#4b3b2b"},{x:4,y:28,w:72,h:1,c:"#5b4b3b"},{x:6,y:30,w:3,h:2,c:"#3a2a1a"},{x:71,y:30,w:3,h:2,c:"#3a2a1a"},{x:18,y:14,w:44,h:12,c:"#6b5b4b",a:.5},{x:28,y:14,w:14,h:8,c:"#1a1a2e"},{x:29,y:15,w:12,h:6,c:"#1565C0",a:.5},{x:30,y:16,w:8,h:1,c:"#60A5FA",a:.45},{x:30,y:18,w:5,h:1,c:"#60A5FA",a:.3},{x:58,y:16,w:5,h:5,c:"#795548"},{x:59,y:17,w:3,h:3,c:"#A67C52"},{x:63,y:18,w:2,h:2,c:"#795548"},{x:10,y:16,w:10,h:8,c:"#FFEE58",a:.7},{x:11,y:17,w:8,h:1,c:"#9E9E9E",a:.5},{x:11,y:19,w:8,h:1,c:"#9E9E9E",a:.5},{x:11,y:21,w:6,h:1,c:"#9E9E9E",a:.5},{x:10,y:32,w:10,h:6,c:"#78889c"},{x:10,y:32,w:10,h:1,c:"#8899ad"},{x:24,y:34,w:10,h:6,c:"#78889c"},{x:24,y:34,w:10,h:1,c:"#8899ad"},{x:38,y:32,w:10,h:6,c:"#78889c"},{x:38,y:32,w:10,h:1,c:"#8899ad"},{x:54,y:32,w:10,h:6,c:"#78889c"},{x:54,y:32,w:10,h:1,c:"#8899ad"},{x:11,y:37,w:2,h:2,c:"#2a2a2a"},{x:17,y:37,w:2,h:2,c:"#2a2a2a"},{x:25,y:39,w:2,h:2,c:"#2a2a2a"},{x:31,y:39,w:2,h:2,c:"#2a2a2a"},{x:39,y:37,w:2,h:2,c:"#2a2a2a"},{x:45,y:37,w:2,h:2,c:"#2a2a2a"},{x:55,y:37,w:2,h:2,c:"#2a2a2a"},{x:61,y:37,w:2,h:2,c:"#2a2a2a"}]},Jj={canvasWidth:128,canvasHeight:96,scale:2,pixels:[{x:0,y:0,w:64,h:48,c:"#4b3b2b"},{x:3,y:3,w:58,h:42,c:"#8B7355"},{x:4,y:4,w:10,h:10,c:"#A0845C",a:.5},{x:20,y:8,w:8,h:8,c:"#A0845C",a:.4},{x:40,y:6,w:12,h:6,c:"#A0845C",a:.3},{x:8,y:30,w:14,h:10,c:"#A0845C",a:.25},{x:44,y:32,w:10,h:8,c:"#A0845C",a:.3},{x:6,y:8,w:18,h:12,c:"#FFEE58"},{x:5,y:7,w:3,h:3,c:"#EF5350"},{x:6,y:7,w:2,h:2,c:"#C62828"},{x:8,y:10,w:14,h:1,c:"#9E9E9E"},{x:8,y:12,w:12,h:1,c:"#9E9E9E"},{x:8,y:14,w:10,h:1,c:"#9E9E9E"},{x:28,y:6,w:16,h:14,c:"#B3E5FC"},{x:35,y:5,w:3,h:3,c:"#42A5F5"},{x:36,y:5,w:2,h:2,c:"#1565C0"},{x:30,y:9,w:12,h:1,c:"#9E9E9E"},{x:30,y:11,w:10,h:1,c:"#9E9E9E"},{x:30,y:13,w:11,h:1,c:"#9E9E9E"},{x:8,y:24,w:16,h:14,c:"#C8E6C9"},{x:15,y:23,w:3,h:3,c:"#66BB6A"},{x:16,y:23,w:2,h:2,c:"#388E3C"},{x:10,y:27,w:12,h:1,c:"#9E9E9E"},{x:10,y:29,w:8,h:1,c:"#9E9E9E"},{x:10,y:31,w:10,h:1,c:"#9E9E9E"},{x:28,y:24,w:28,h:16,c:"#FFCDD2"},{x:43,y:23,w:3,h:3,c:"#EF5350"},{x:44,y:23,w:2,h:2,c:"#B71C1C"},{x:32,y:27,w:24,h:1,c:"#9E9E9E"},{x:32,y:29,w:20,h:1,c:"#9E9E9E"},{x:32,y:31,w:22,h:1,c:"#9E9E9E"},{x:32,y:33,w:15,h:1,c:"#9E9E9E"},{x:0,y:0,w:64,h:3,c:"#5a4a3a"},{x:0,y:45,w:64,h:3,c:"#3a2a1a"}]},Pj={canvasWidth:128,canvasHeight:96,scale:2,pixels:[{x:2,y:0,w:60,h:48,c:"#3b1f0a"},{x:4,y:2,w:56,h:44,c:"#5a3310"},{x:4,y:13,w:56,h:2,c:"#2d1508"},{x:4,y:27,w:56,h:2,c:"#2d1508"},{x:4,y:41,w:56,h:2,c:"#2d1508"},{x:5,y:3,w:4,h:10,c:"#2563EB"},{x:5,y:3,w:4,h:2,c:"#1D4ED8"},{x:10,y:4,w:3,h:9,c:"#DC2626"},{x:10,y:4,w:3,h:2,c:"#B91C1C"},{x:14,y:3,w:5,h:10,c:"#16A34A"},{x:14,y:3,w:5,h:2,c:"#15803D"},{x:20,y:4,w:3,h:9,c:"#9333EA"},{x:20,y:4,w:3,h:2,c:"#7E22CE"},{x:24,y:3,w:4,h:10,c:"#D97706"},{x:24,y:3,w:4,h:2,c:"#B45309"},{x:29,y:4,w:3,h:9,c:"#0891B2"},{x:29,y:4,w:3,h:2,c:"#0E7490"},{x:33,y:3,w:5,h:10,c:"#BE123C"},{x:33,y:3,w:5,h:2,c:"#9F1239"},{x:39,y:4,w:4,h:9,c:"#4F46E5"},{x:39,y:4,w:4,h:2,c:"#3730A3"},{x:44,y:3,w:3,h:10,c:"#065F46"},{x:44,y:3,w:3,h:2,c:"#064E3B"},{x:48,y:4,w:4,h:9,c:"#92400E"},{x:48,y:4,w:4,h:2,c:"#78350F"},{x:53,y:3,w:5,h:10,c:"#1E3A5F"},{x:53,y:3,w:5,h:2,c:"#1e3060"},{x:6,y:6,w:2,h:1,c:"#BFDBFE",a:.7},{x:11,y:7,w:1,h:1,c:"#FCA5A5",a:.7},{x:16,y:6,w:3,h:1,c:"#BBF7D0",a:.7},{x:21,y:7,w:1,h:1,c:"#D8B4FE",a:.7},{x:25,y:6,w:2,h:1,c:"#FDE68A",a:.7},{x:5,y:16,w:5,h:11,c:"#0F766E"},{x:5,y:16,w:5,h:2,c:"#0D6056"},{x:11,y:17,w:3,h:10,c:"#C2410C"},{x:11,y:17,w:3,h:2,c:"#9A3412"},{x:15,y:16,w:4,h:11,c:"#7C3AED"},{x:15,y:16,w:4,h:2,c:"#6D28D9"},{x:20,y:17,w:3,h:10,c:"#1D4ED8"},{x:20,y:17,w:3,h:2,c:"#1E40AF"},{x:24,y:16,w:5,h:11,c:"#166534"},{x:24,y:16,w:5,h:2,c:"#14532D"},{x:30,y:17,w:4,h:10,c:"#991B1B"},{x:30,y:17,w:4,h:2,c:"#7F1D1D"},{x:35,y:16,w:3,h:11,c:"#854D0E"},{x:35,y:16,w:3,h:2,c:"#713F12"},{x:39,y:17,w:4,h:10,c:"#1E40AF"},{x:39,y:17,w:4,h:2,c:"#1E3A8A"},{x:44,y:16,w:5,h:11,c:"#065F46"},{x:44,y:16,w:5,h:2,c:"#064E3B"},{x:50,y:17,w:3,h:10,c:"#831843"},{x:50,y:17,w:3,h:2,c:"#6B21A8"},{x:54,y:16,w:5,h:11,c:"#374151"},{x:54,y:16,w:5,h:2,c:"#1F2937"},{x:5,y:30,w:4,h:11,c:"#0E7490"},{x:5,y:30,w:4,h:2,c:"#0C6B7E"},{x:10,y:31,w:3,h:10,c:"#B45309"},{x:10,y:31,w:3,h:2,c:"#92400E"},{x:14,y:30,w:5,h:11,c:"#6D28D9"},{x:14,y:30,w:5,h:2,c:"#5B21B6"},{x:20,y:30,w:7,h:8,c:"#1e293b"},{x:22,y:32,w:3,h:3,c:"#3b82f6",a:.9},{x:22,y:32,w:1,h:3,c:"#60a5fa",a:.6},{x:28,y:31,w:4,h:10,c:"#DC2626"},{x:28,y:31,w:4,h:2,c:"#B91C1C"},{x:33,y:30,w:3,h:11,c:"#065F46"},{x:33,y:30,w:3,h:2,c:"#064E3B"},{x:37,y:31,w:4,h:10,c:"#1D4ED8"},{x:37,y:31,w:4,h:2,c:"#1E40AF"},{x:42,y:35,w:6,h:6,c:"#92400E"},{x:43,y:30,w:4,h:6,c:"#16a34a",a:.8},{x:43,y:29,w:2,h:3,c:"#15803d",a:.7},{x:45,y:28,w:2,h:4,c:"#16a34a",a:.6},{x:49,y:30,w:3,h:11,c:"#7C3AED"},{x:49,y:30,w:3,h:2,c:"#6D28D9"},{x:53,y:31,w:5,h:10,c:"#B45309"},{x:53,y:31,w:5,h:2,c:"#92400E"},{x:2,y:46,w:60,h:2,c:"#1a0a03"},{x:2,y:0,w:60,h:2,c:"#4a2510"},{x:2,y:0,w:2,h:48,c:"#2d1508"},{x:60,y:0,w:2,h:48,c:"#2d1508"}]},eS={canvasWidth:96,canvasHeight:120,scale:2,pixels:[{x:2,y:0,w:44,h:60,c:"#546E7A"},{x:2,y:0,w:44,h:3,c:"#78909C"},{x:2,y:57,w:44,h:3,c:"#37474F"},{x:2,y:0,w:2,h:60,c:"#455A64"},{x:44,y:0,w:2,h:60,c:"#37474F"},{x:5,y:4,w:38,h:3,c:"#FFD54F",a:.5},{x:6,y:1,w:2,h:4,c:"#FFFDE7"},{x:10,y:0,w:2,h:5,c:"#FFF9C4"},{x:14,y:1,w:2,h:3,c:"#FFFDE7"},{x:18,y:0,w:2,h:4,c:"#FFF8E1"},{x:5,y:5,w:38,h:16,c:"#607D8B"},{x:5,y:5,w:38,h:2,c:"#78909C"},{x:15,y:12,w:18,h:4,c:"#37474F"},{x:22,y:11,w:4,h:6,c:"#455A64"},{x:23,y:13,w:2,h:2,c:"#B0BEC5"},{x:7,y:14,w:8,h:5,c:"#B0BEC5"},{x:8,y:15,w:6,h:1,c:"#607D8B"},{x:8,y:17,w:5,h:1,c:"#607D8B"},{x:5,y:23,w:38,h:16,c:"#607D8B"},{x:5,y:23,w:38,h:2,c:"#78909C"},{x:15,y:30,w:18,h:4,c:"#37474F"},{x:22,y:29,w:4,h:6,c:"#455A64"},{x:23,y:31,w:2,h:2,c:"#B0BEC5"},{x:7,y:32,w:8,h:5,c:"#B0BEC5"},{x:8,y:33,w:6,h:1,c:"#607D8B"},{x:8,y:35,w:4,h:1,c:"#607D8B"},{x:5,y:41,w:38,h:16,c:"#607D8B"},{x:5,y:41,w:38,h:2,c:"#78909C"},{x:15,y:48,w:18,h:4,c:"#37474F"},{x:22,y:47,w:4,h:6,c:"#455A64"},{x:23,y:49,w:2,h:2,c:"#B0BEC5"},{x:7,y:50,w:8,h:5,c:"#B0BEC5"},{x:8,y:51,w:6,h:1,c:"#607D8B"},{x:8,y:53,w:3,h:1,c:"#607D8B"}]};$c("meeting",Zj);$c("bulletin",Jj);$c("decision",eS);$c("knowledge",Pj);const xf=16,pf=24,tS=60,nS={cbo:0,cto:8,pm:15,engineer:22,designer:5,qa:12};function sg(t,l){if(!t)return t;let r=t;if(l!=null&&l.hairStyle){const i=Mj(l.hairStyle);i&&(r=Aj(r,i.layer))}if(l!=null&&l.outfitStyle){const i=Fj(l.outfitStyle);i&&(r=Gf(r,"torso",i.layer,1))}if(l!=null&&l.accessory&&l.accessory!=="none"){const i=Rj(l.accessory);i&&(r=Gf(r,"accessory",i.layer))}return r}function _s({roleId:t,className:l,appearance:r,scale:i}){const c=k.useRef(null),u=k.useRef(0),d=k.useRef(0),m=k.useRef(r);m.current=r;const x=i??4,f=xf*x,g=pf*x,y=k.useMemo(()=>{const b=Kf(`mini:${t}`)??Kf("mini:default");return sg(b,r)},[t,r==null?void 0:r.hairStyle,r==null?void 0:r.outfitStyle,r==null?void 0:r.accessory]);return k.useEffect(()=>{const b=c.current;if(!b)return;const v=b.getContext("2d");if(!v)return;const S=nS[t]??0,j=()=>{d.current++;const E=m.current;if(!E||!y){u.current=requestAnimationFrame(j);return}const A=(d.current+S)%tS<30?1:0;v.clearRect(0,0,xf,pf),v.save(),v.translate(2,1),Dj(v,y,A,E,1),v.restore(),u.current=requestAnimationFrame(j)};return u.current=requestAnimationFrame(j),()=>cancelAnimationFrame(u.current)},[t,y]),s.jsx("canvas",{ref:c,width:xf,height:pf,className:l,style:{imageRendering:"pixelated",display:"block",width:f,height:g}})}const lS="https://api.tycono.ai",Ch=lS;async function ac(t){const l=await fetch(`${Ch}${t}`);if(!l.ok)throw new Error(`Cloud API error: ${l.status}`);return l.json()}async function ic(t,l){const r=await fetch(`${Ch}${t}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!r.ok)throw new Error(`Cloud API error: ${r.status}`);return r.json()}const mi={health:()=>ac("/api/health"),getCharacters:()=>ac("/api/store/characters"),getCharacter:t=>ac(`/api/store/characters/${t}`),getCharacterVersion:t=>ac(`/api/store/characters/${t}/version`),syncCheck:t=>ic("/api/sync/check",{roles:t}),syncPull:t=>ic("/api/sync/pull",{sourceId:t}),publishCharacter:t=>ic("/api/store/publish",t),deleteCharacter:t=>fetch(`${Ch}/api/store/characters/${t}`,{method:"DELETE"}).then(l=>l.json()),uploadTelemetry:t=>ic("/api/telemetry",t)},rS={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"},yf={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"},aS={cto:"Chief Technology Officer",cbo:"Chief Business Officer",pm:"Product Manager",engineer:"Software Engineer",designer:"UI/UX Designer",qa:"QA Engineer"},iS=500,d0=360,f0=700,sS=t=>`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`;function oS({role:t,allRoles:l,recentActivity:r,onClose:i,onFireRole:c,terminalWidth:u=0,activeJobId:d,activeTask:m,isWorking:x,jobStartedAt:f,onStopJob:g,sessions:y,streamingSessionId:b,onCreateSessionSilent:v,onSendMessage:S,onFocusTerminal:j,onCustomize:E,onUpdateRole:C,appearance:A,relationships:F,roleLevel:_}){var Te,Ye;const[H,M]=k.useState(iS),[I,W]=k.useState(!1),te=k.useRef(0),D=k.useRef(0),[Y,B]=k.useState(!1),[V,ne]=k.useState(!1),[G,L]=k.useState(!1),[Z,de]=k.useState(!1),[ue,z]=k.useState("talk"),[R,K]=k.useState(!1),[T,fe]=k.useState(""),[Ee,Ne]=k.useState(!1),Le=k.useRef(null),{events:Be,status:Qe}=K0(d??null),[Se,tt]=k.useState(0);k.useEffect(()=>{if(!x||!f){tt(0);return}const xe=new Date(f).getTime(),q=()=>tt(Math.floor((Date.now()-xe)/1e3));q();const ze=setInterval(q,1e3);return()=>clearInterval(ze)},[x,f]);const me=u>0,he=me?u:0,ge=me?Math.max(d0,window.innerWidth-u-100):f0,ke=Math.min(H,ge),Fe=k.useCallback(xe=>{xe.preventDefault(),te.current=xe.clientX,D.current=ke,W(!0);const q=He=>{const Xe=te.current-He.clientX,ht=Math.min(f0,Math.max(d0,D.current+Xe));M(ht)},ze=()=>{W(!1),document.removeEventListener("mousemove",q),document.removeEventListener("mouseup",ze)};document.addEventListener("mousemove",q),document.addEventListener("mouseup",ze)},[ke]),Ae=k.useRef(null),De=t?y.find(xe=>xe.roleId===t.id):null,je=xe=>{if(!t)return;const q=x?"talk":ue;De?(S(De.id,xe,q),j(t.id)):(Ae.current={content:xe,mode:q},v(t.id))};k.useEffect(()=>{if(De&&Ae.current){const{content:xe,mode:q}=Ae.current;Ae.current=null,S(De.id,xe,q),t&&j(t.id)}},[De==null?void 0:De.id]);const _e=(()=>{if(!Be.length)return null;const xe=[];let q=0,ze=0,He=0;for(const Xe of Be)if(Xe.type==="thinking")q++;else if(Xe.type==="text")ze++;else if(Xe.type==="tool:start"){const ht=String(Xe.data.name??"");xe.includes(ht)||xe.push(ht)}else Xe.type==="dispatch:start"&&He++;return{tools:xe,thinkCount:q,textCount:ze,dispatchCount:He,total:Be.length}})(),Ke=m||(()=>{if(!De)return null;const xe=De.messages;for(let q=xe.length-1;q>=0;q--)if(xe[q].from==="ceo")return xe[q].content;return null})(),Et=(()=>{if(!De)return null;const xe=De.messages;for(let q=xe.length-1;q>=0;q--)if(xe[q].from==="role"&&xe[q].content)return xe[q].content;return null})();if(!t)return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:he},onClick:i}),s.jsx("div",{className:"side-panel open fixed top-0 h-full z-50 flex items-center justify-center border-l-[3px]",style:{right:he,width:ke,background:"var(--terminal-bg)",borderLeftColor:"var(--pixel-border)"},children:s.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-muted)"},children:"Loading role..."})})]});const Ht=yf[t.id]??"#666",gt=rS[t.id]??"👤",Rt=l.filter(xe=>xe.reportsTo===t.id),re=De&&b===De.id,pe=t.name||aS[t.id]||t.id;return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:he},onClick:i}),s.jsxs("div",{className:`side-panel open fixed top-0 h-full z-50 flex flex-col border-l-[3px] shadow-[-4px_0_20px_rgba(0,0,0,0.4)] ${I?"resizing":""}`,style:{borderLeftColor:Ht,right:he,width:ke,background:"var(--terminal-bg)"},children:[s.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${I?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:Fe}),s.jsxs("div",{className:"relative shrink-0 overflow-hidden",style:{background:`linear-gradient(135deg, ${Ht}ee, ${Ht}99)`},children:[s.jsx("div",{className:"absolute inset-0 opacity-[0.06]",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 8px, white 8px, white 9px)"}}),s.jsxs("div",{className:"absolute top-3 right-3 flex items-center gap-1.5 z-10",children:[E&&s.jsx("button",{onClick:()=>E(t.id),className:"w-7 h-7 rounded-full bg-black/20 text-white flex items-center justify-center text-sm hover:bg-black/30 cursor-pointer backdrop-blur-sm",title:"Customize",children:"🎨"}),s.jsx("button",{onClick:i,className:"w-7 h-7 rounded-full bg-black/20 text-white flex items-center justify-center text-lg hover:bg-black/30 cursor-pointer backdrop-blur-sm",children:"×"})]}),s.jsxs("div",{className:"relative flex items-end gap-4 px-4 pt-4 pb-3",children:[s.jsx("div",{className:"shrink-0 relative",style:{marginBottom:-2},children:s.jsx("div",{className:"rounded-lg p-1",style:{background:"rgba(0,0,0,0.2)"},children:s.jsx(_s,{roleId:t.id,appearance:A,scale:8})})}),s.jsxs("div",{className:"flex-1 min-w-0 text-white pb-1",children:[s.jsxs("div",{className:"text-lg font-bold flex items-center gap-2",style:{fontFamily:"var(--pixel-font)"},children:[gt," ",t.id.toUpperCase(),x&&s.jsx("span",{className:"text-[9px] font-semibold px-2 py-0.5 rounded-full animate-pulse",style:{background:"rgba(251,191,36,0.25)",color:"#fde68a"},children:"WORKING"})]}),R?s.jsxs("form",{className:"flex items-center gap-1.5 mt-0.5",onSubmit:async xe=>{xe.preventDefault();const q=T.trim();if(!q||q===pe||!C){K(!1);return}Ne(!0);try{await C(t.id,{name:q})}catch{}Ne(!1),K(!1)},children:[s.jsx("input",{ref:Le,value:T,onChange:xe=>fe(xe.target.value),onKeyDown:xe=>{xe.key==="Escape"&&K(!1)},disabled:Ee,autoFocus:!0,className:"bg-white/20 text-white text-xs rounded px-1.5 py-0.5 outline-none focus:bg-white/30 w-full",style:{fontFamily:"inherit"}}),s.jsx("button",{type:"submit",disabled:Ee,className:"text-white/80 hover:text-white text-[10px] cursor-pointer shrink-0",children:"✓"}),s.jsx("button",{type:"button",onClick:()=>K(!1),className:"text-white/60 hover:text-white text-[10px] cursor-pointer shrink-0",children:"✕"})]}):s.jsxs("div",{className:"text-xs opacity-75 mt-0.5 group/name flex items-center gap-1 cursor-pointer hover:opacity-100 transition-opacity",onClick:()=>{C&&(fe(pe),K(!0))},title:C?"Click to edit name":void 0,children:[pe,C&&s.jsx("span",{className:"opacity-0 group-hover/name:opacity-60 text-[10px]",children:"✎"})]})]})]}),s.jsxs("div",{className:"relative flex items-center gap-3 px-4 py-2 text-[10px] font-bold text-white/80",style:{background:"rgba(0,0,0,0.2)",fontFamily:"var(--pixel-font)"},children:[s.jsxs("span",{children:["Lv.",_??1]}),s.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:x?"var(--idle-amber)":"var(--active-green)"}}),x?"Working":"Idle"]}),s.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),s.jsx("span",{children:t.level}),t.reportsTo&&s.jsxs(s.Fragment,{children:[s.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),s.jsxs("span",{className:"opacity-60",children:["→"," ",t.reportsTo]})]})]})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto flex flex-col min-h-0",children:[x&&s.jsxs("div",{className:"px-4 py-3 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)",background:"var(--hud-bg-alt)"},children:[s.jsxs("div",{className:"flex items-center justify-between mb-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-2 h-2 rounded-full animate-pulse",style:{background:"var(--idle-amber)"}}),s.jsxs("span",{className:"text-xs font-semibold",style:{color:"var(--idle-amber)"},children:["Working",Se>0?` · ${sS(Se)}`:""]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:()=>j(t.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"Open chat ↗"}),d&&g&&s.jsx("button",{onClick:()=>g(d),className:"text-[10px] px-2 py-0.5 rounded cursor-pointer font-semibold transition-colors",style:{background:"rgba(239,68,68,0.15)",color:"#ef4444"},children:"Stop"})]})]}),Ke&&s.jsx("div",{className:"text-xs truncate",style:{color:"var(--terminal-text-secondary)"},children:Ke})]}),x&&d&&_e&&s.jsxs("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[s.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[s.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)"},children:"Activity"}),s.jsx("button",{onClick:()=>j(t.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"View details ↗"})]}),s.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[_e.thinkCount>0&&s.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(168,85,247,0.15)",color:"#c084fc"},children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full",style:{background:"#a855f7"}}),"thinking ×",_e.thinkCount]}),_e.tools.map(xe=>s.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(59,130,246,0.15)",color:"#60a5fa"},children:xe},xe)),_e.dispatchCount>0&&s.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(249,115,22,0.15)",color:"#fb923c"},children:["dispatch ×",_e.dispatchCount]}),_e.textCount>0&&s.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(34,197,94,0.15)",color:"#4ade80"},children:["output ×",_e.textCount]}),(Qe==="streaming"||Qe==="connecting")&&s.jsx("span",{className:"inline-block w-1.5 h-3 animate-pulse rounded-sm",style:{background:"var(--active-green)"}})]}),s.jsxs("div",{className:"text-[10px] mt-1",style:{color:"var(--terminal-text-muted)"},children:[_e.total," events"]})]}),x&&Et&&s.jsxs("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[s.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[s.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)"},children:"Last Message"}),s.jsx("button",{onClick:()=>j(t.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"Open chat ↗"})]}),s.jsxs("div",{className:"rounded-lg p-2.5 text-xs leading-relaxed line-clamp-3 overflow-hidden",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:[Et.slice(0,200),Et.length>200&&"..."]})]}),x&&s.jsx("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:s.jsx(h0,{onSend:je,disabled:!!re,placeholder:"Ask something...",color:Ht})}),!x&&s.jsxs("div",{className:"px-4 pt-4 pb-2",children:[s.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-secondary)"},children:"Latest"}),s.jsx(uS,{icon:gt,roleId:t.id,roleName:pe,color:Ht,text:r})]}),!x&&s.jsx("div",{className:"px-4 py-3",style:{borderBottom:"1px solid var(--terminal-border)"},children:s.jsxs("div",{className:"rounded-xl overflow-hidden",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[Et&&s.jsxs("div",{className:"px-3 pt-2.5 pb-2 cursor-pointer transition-colors",style:{borderBottom:"1px solid var(--terminal-border)"},onClick:()=>j(t.id),children:[s.jsxs("div",{className:"flex items-center justify-between mb-1",children:[s.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--terminal-text-muted)"},children:"Last response"}),s.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:"View ↗"})]}),s.jsxs("div",{className:"text-xs leading-relaxed line-clamp-2 overflow-hidden",style:{color:"var(--terminal-text-secondary)"},children:[Et.slice(0,150),Et.length>150&&"..."]})]}),s.jsx("div",{className:"p-2",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"flex rounded-lg overflow-hidden shrink-0",style:{border:"1px solid var(--pixel-border)"},children:[s.jsx("button",{onClick:()=>z("talk"),className:"px-2 py-1 text-[10px] font-semibold cursor-pointer transition-colors",style:{background:ue==="talk"?"var(--accent)":"transparent",color:ue==="talk"?"#fff":"var(--terminal-text-secondary)"},children:"Talk"}),s.jsx("button",{onClick:()=>z("do"),className:"px-2 py-1 text-[10px] font-semibold cursor-pointer transition-colors",style:{background:ue==="do"?"var(--idle-amber)":"transparent",color:ue==="do"?"#fff":"var(--terminal-text-secondary)"},children:"Do"})]}),s.jsx(h0,{onSend:je,disabled:!!re,placeholder:ue==="talk"?"Ask something...":"Give a directive...",color:Ht})]})})]})}),s.jsxs("div",{className:"px-4 py-2 space-y-1",children:[s.jsxs(sc,{title:`Profile${t.persona?"":" (empty)"}`,open:Y,onToggle:()=>B(xe=>!xe),children:[t.persona&&s.jsx("div",{className:"text-xs leading-relaxed rounded-lg p-3",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:t.persona}),s.jsxs("div",{className:"space-y-0 mt-2",children:[s.jsx(gf,{label:"Level",value:t.level}),s.jsx(gf,{label:"Reports to",value:t.reportsTo}),s.jsx(gf,{label:"Status",value:t.status})]}),Rt.length>0&&s.jsxs("div",{className:"mt-3",children:[s.jsx("div",{className:"text-[11px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"Direct Reports"}),s.jsx("div",{className:"space-y-1",children:Rt.map(xe=>s.jsxs("div",{className:"flex items-center gap-2 p-1.5 rounded-lg",style:{background:"var(--hud-bg-alt)"},children:[s.jsx("div",{className:"w-6 h-6 rounded flex items-center justify-center text-white text-[10px] font-bold",style:{background:yf[xe.id]??"#666"},children:xe.id.slice(0,2).toUpperCase()}),s.jsx("div",{className:"text-xs",style:{color:"var(--terminal-text)"},children:xe.name})]},xe.id))})]})]}),t.authority&&s.jsxs(sc,{title:"Authority",open:V,onToggle:()=>ne(xe=>!xe),children:[((Te=t.authority.autonomous)==null?void 0:Te.length)>0&&s.jsxs("div",{className:"mb-2",children:[s.jsx("div",{className:"text-xs font-semibold mb-1",style:{color:"var(--active-green)"},children:"Autonomous"}),t.authority.autonomous.map((xe,q)=>s.jsxs("div",{className:"text-xs pl-3 py-0.5",style:{color:"var(--terminal-text-secondary)"},children:["- ",xe]},q))]}),((Ye=t.authority.needsApproval)==null?void 0:Ye.length)>0&&s.jsxs("div",{children:[s.jsx("div",{className:"text-xs font-semibold mb-1",style:{color:"var(--idle-amber)"},children:"Needs Approval"}),t.authority.needsApproval.map((xe,q)=>s.jsxs("div",{className:"text-xs pl-3 py-0.5",style:{color:"var(--terminal-text-secondary)"},children:["- ",xe]},q))]})]}),t&&F&&(()=>{const xe=F.filter(q=>q.roleA===t.id||q.roleB===t.id).filter(q=>q.familiarity>0).sort((q,ze)=>ze.familiarity-q.familiarity);return xe.length===0?null:s.jsx(sc,{title:`Relationships (${xe.length})`,open:G,onToggle:()=>L(q=>!q),children:s.jsx("div",{className:"space-y-1.5",children:xe.map((q,ze)=>{const He=q.roleA===t.id?q.roleB:q.roleA,Xe=l.find(We=>We.id===He),ht=q.familiarity>=80?"Best Partner":q.familiarity>=50?"Friend":q.familiarity>=20?"Colleague":"Acquaintance",Pe=q.familiarity>=80?"#4CAF50":q.familiarity>=50?"#2196F3":q.familiarity>=20?"#FF9800":"#9E9E9E";return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-xs w-20 truncate",style:{color:yf[He]??"var(--terminal-text-secondary)"},children:(Xe==null?void 0:Xe.name)??He}),s.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-white/10",children:s.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${q.familiarity}%`,background:Pe}})}),s.jsx("span",{className:"text-[10px] w-16 text-right",style:{color:"var(--terminal-text-muted)"},children:ht})]},ze)})})})})(),t.journal&&s.jsx(sc,{title:`Journal (${(t.journal.match(/### /g)??[]).length})`,open:Z,onToggle:()=>de(xe=>!xe),children:s.jsxs("div",{className:"text-xs leading-relaxed rounded-lg p-3 max-h-[300px] overflow-y-auto",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:[s.jsx(Is,{content:t.journal.slice(0,3e3)}),t.journal.length>3e3&&s.jsx("div",{className:"italic mt-2",style:{color:"var(--terminal-text-muted)"},children:"... (truncated)"})]})})]}),s.jsx(cS,{role:t,appearance:A}),c&&s.jsx("div",{className:"px-4 pb-4 mt-auto shrink-0",children:s.jsx("button",{onClick:()=>{c(t.id,t.name),i()},className:"w-full p-2 text-center text-xs font-medium border-2 border-dashed rounded-lg cursor-pointer transition-colors",style:{borderColor:"rgba(239,68,68,0.3)",color:"rgba(239,68,68,0.5)"},children:"Fire Role"})})]})]})]})}function cS({role:t,appearance:l}){const[r,i]=k.useState("idle"),[c,u]=k.useState(""),[d,m]=k.useState(!1),x=async()=>{var f,g;if(!d){m(!0);return}i("publishing");try{let y=null;try{y=await Ce.exportSkills(t.id)}catch{}const b={roleId:t.id,persona:t.persona??"",authority:t.authority??{autonomous:[],needsApproval:[]},level:t.level,tagline:((f=(t.persona??"").split(/[.\n]/)[0])==null?void 0:f.trim().slice(0,80))||t.name,chatStyle:"Professional and focused",skills:y??[],resume:{summary:((g=t.persona)==null?void 0:g.split(`
|
|
80
|
+
`)[0])??"",strengths:[],specialties:[],experience:""},author:{id:"tycono",name:"Tycono"},tags:[t.level,t.id],price:"free",installs:0,rating:0,featured:!1,randomActive:!0,randomPersonality:""};l&&(b.appearance=l);let v="1.0.0";try{const S=await mi.getCharacterVersion(t.id);if(S!=null&&S.version){const j=S.version.split(".").map(Number);j[2]=(j[2]??0)+1,v=j.join(".")}}catch{}await mi.publishCharacter({id:t.id,name:t.name||t.id,version:v,data:b}),i("done"),u(`Published v${v}`),m(!1)}catch(y){i("error"),u(y instanceof Error?y.message:"Failed"),m(!1)}};return s.jsx("div",{className:"px-4 pb-2 shrink-0",children:s.jsx("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--terminal-border)"},children:s.jsxs("div",{className:"px-3 py-2.5 flex items-center justify-between",style:{background:"var(--hud-bg-alt)"},children:[s.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},children:"Cloud Store"}),r==="done"?s.jsx("span",{className:"text-[10px] font-semibold",style:{color:"var(--active-green)"},children:c}):r==="error"?s.jsx("span",{className:"text-[10px] font-semibold",style:{color:"#ef4444"},children:c}):s.jsx("button",{onClick:x,disabled:r==="publishing",className:"text-[10px] px-2.5 py-1 rounded font-semibold cursor-pointer transition-colors disabled:opacity-50",style:{background:d?"rgba(59,130,246,0.3)":"rgba(59,130,246,0.15)",color:"#60a5fa",border:d?"1px solid rgba(59,130,246,0.5)":"1px solid transparent"},children:r==="publishing"?"Publishing...":d?"Confirm Publish?":"Publish to Store"})]})})})}function uS({icon:t,roleId:l,roleName:r,color:i,text:c}){const u=!!c;return s.jsx("div",{className:"relative",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsxs("div",{className:"shrink-0",children:[s.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center text-xl shadow-sm",style:{background:`${i}18`,border:`2px solid ${i}44`},children:t}),s.jsx("div",{className:"text-[9px] font-bold text-center mt-0.5 uppercase tracking-wide",style:{color:i},children:l})]}),s.jsx("div",{className:"flex-1 min-w-0",children:s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"absolute top-3 -left-2 w-0 h-0",style:{borderTop:"6px solid transparent",borderBottom:"6px solid transparent",borderRight:`8px solid ${i}12`}}),s.jsxs("div",{className:"rounded-xl rounded-tl-sm p-4 border",style:{background:`${i}08`,borderColor:`${i}22`},children:[s.jsx("div",{className:"text-[10px] font-semibold mb-1.5 uppercase tracking-wider",style:{color:i},children:r}),u?s.jsx("div",{className:"text-sm leading-relaxed",style:{color:"var(--terminal-text)"},children:s.jsx(Is,{content:c})}):s.jsx("div",{className:"text-sm italic",style:{color:"var(--terminal-text-muted)"},children:"No recent activity."})]})]})})]})})}function sc({title:t,open:l,onToggle:r,children:i}){return s.jsxs("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--terminal-border)"},children:[s.jsxs("button",{onClick:r,className:"w-full px-3 py-2.5 flex items-center justify-between cursor-pointer transition-colors group",style:{background:"var(--hud-bg-alt)"},children:[s.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},children:t}),s.jsx("span",{className:"text-[10px] transition-transform",style:{color:"var(--terminal-text-muted)",transform:l?"rotate(0deg)":"rotate(-90deg)"},children:"▼"})]}),l&&s.jsx("div",{className:"px-3 pb-3 pt-2",style:{borderTop:"1px solid var(--terminal-border)"},children:i})]})}function h0({onSend:t,disabled:l,placeholder:r,color:i}){const[c,u]=k.useState(""),d=()=>{const m=c.trim();!m||l||(t(m),u(""))};return s.jsxs("div",{className:"flex items-center gap-1.5 flex-1",children:[s.jsx("input",{type:"text",value:c,onChange:m=>u(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),d())},placeholder:l?"Waiting...":r,disabled:l,className:"flex-1 rounded-lg px-2.5 py-1.5 text-xs focus:outline-none disabled:opacity-40",style:{background:"var(--hud-bg)",border:"1px solid var(--pixel-border)",color:"var(--terminal-text)"}}),s.jsx("button",{onClick:d,disabled:l||!c.trim(),className:"w-7 h-7 rounded-lg flex items-center justify-center shrink-0 cursor-pointer text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors",style:{background:l||!c.trim()?"#666":i},children:s.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M22 2L11 13"}),s.jsx("path",{d:"M22 2L15 22L11 13L2 9L22 2Z"})]})})]})}function gf({label:t,value:l}){return s.jsxs("div",{className:"flex justify-between py-1.5 text-xs",style:{borderBottom:"1px solid var(--terminal-border)"},children:[s.jsx("span",{style:{color:"var(--terminal-text-muted)"},children:t}),s.jsx("span",{className:"font-semibold",style:{color:"var(--terminal-text)"},children:l})]})}function dS(t,l){var r,i=1;t==null&&(t=0),l==null&&(l=0);function c(){var u,d=r.length,m,x=0,f=0;for(u=0;u<d;++u)m=r[u],x+=m.x,f+=m.y;for(x=(x/d-t)*i,f=(f/d-l)*i,u=0;u<d;++u)m=r[u],m.x-=x,m.y-=f}return c.initialize=function(u){r=u},c.x=function(u){return arguments.length?(t=+u,c):t},c.y=function(u){return arguments.length?(l=+u,c):l},c.strength=function(u){return arguments.length?(i=+u,c):i},c}function fS(t){const l=+this._x.call(null,t),r=+this._y.call(null,t);return og(this.cover(l,r),l,r,t)}function og(t,l,r,i){if(isNaN(l)||isNaN(r))return t;var c,u=t._root,d={data:i},m=t._x0,x=t._y0,f=t._x1,g=t._y1,y,b,v,S,j,E,C,A;if(!u)return t._root=d,t;for(;u.length;)if((j=l>=(y=(m+f)/2))?m=y:f=y,(E=r>=(b=(x+g)/2))?x=b:g=b,c=u,!(u=u[C=E<<1|j]))return c[C]=d,t;if(v=+t._x.call(null,u.data),S=+t._y.call(null,u.data),l===v&&r===S)return d.next=u,c?c[C]=d:t._root=d,t;do c=c?c[C]=new Array(4):t._root=new Array(4),(j=l>=(y=(m+f)/2))?m=y:f=y,(E=r>=(b=(x+g)/2))?x=b:g=b;while((C=E<<1|j)===(A=(S>=b)<<1|v>=y));return c[A]=u,c[C]=d,t}function hS(t){var l,r,i=t.length,c,u,d=new Array(i),m=new Array(i),x=1/0,f=1/0,g=-1/0,y=-1/0;for(r=0;r<i;++r)isNaN(c=+this._x.call(null,l=t[r]))||isNaN(u=+this._y.call(null,l))||(d[r]=c,m[r]=u,c<x&&(x=c),c>g&&(g=c),u<f&&(f=u),u>y&&(y=u));if(x>g||f>y)return this;for(this.cover(x,f).cover(g,y),r=0;r<i;++r)og(this,d[r],m[r],t[r]);return this}function mS(t,l){if(isNaN(t=+t)||isNaN(l=+l))return this;var r=this._x0,i=this._y0,c=this._x1,u=this._y1;if(isNaN(r))c=(r=Math.floor(t))+1,u=(i=Math.floor(l))+1;else{for(var d=c-r||1,m=this._root,x,f;r>t||t>=c||i>l||l>=u;)switch(f=(l<i)<<1|t<r,x=new Array(4),x[f]=m,m=x,d*=2,f){case 0:c=r+d,u=i+d;break;case 1:r=c-d,u=i+d;break;case 2:c=r+d,i=u-d;break;case 3:r=c-d,i=u-d;break}this._root&&this._root.length&&(this._root=m)}return this._x0=r,this._y0=i,this._x1=c,this._y1=u,this}function xS(){var t=[];return this.visit(function(l){if(!l.length)do t.push(l.data);while(l=l.next)}),t}function pS(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function Nn(t,l,r,i,c){this.node=t,this.x0=l,this.y0=r,this.x1=i,this.y1=c}function yS(t,l,r){var i,c=this._x0,u=this._y0,d,m,x,f,g=this._x1,y=this._y1,b=[],v=this._root,S,j;for(v&&b.push(new Nn(v,c,u,g,y)),r==null?r=1/0:(c=t-r,u=l-r,g=t+r,y=l+r,r*=r);S=b.pop();)if(!(!(v=S.node)||(d=S.x0)>g||(m=S.y0)>y||(x=S.x1)<c||(f=S.y1)<u))if(v.length){var E=(d+x)/2,C=(m+f)/2;b.push(new Nn(v[3],E,C,x,f),new Nn(v[2],d,C,E,f),new Nn(v[1],E,m,x,C),new Nn(v[0],d,m,E,C)),(j=(l>=C)<<1|t>=E)&&(S=b[b.length-1],b[b.length-1]=b[b.length-1-j],b[b.length-1-j]=S)}else{var A=t-+this._x.call(null,v.data),F=l-+this._y.call(null,v.data),_=A*A+F*F;if(_<r){var H=Math.sqrt(r=_);c=t-H,u=l-H,g=t+H,y=l+H,i=v.data}}return i}function gS(t){if(isNaN(g=+this._x.call(null,t))||isNaN(y=+this._y.call(null,t)))return this;var l,r=this._root,i,c,u,d=this._x0,m=this._y0,x=this._x1,f=this._y1,g,y,b,v,S,j,E,C;if(!r)return this;if(r.length)for(;;){if((S=g>=(b=(d+x)/2))?d=b:x=b,(j=y>=(v=(m+f)/2))?m=v:f=v,l=r,!(r=r[E=j<<1|S]))return this;if(!r.length)break;(l[E+1&3]||l[E+2&3]||l[E+3&3])&&(i=l,C=E)}for(;r.data!==t;)if(c=r,!(r=r.next))return this;return(u=r.next)&&delete r.next,c?(u?c.next=u:delete c.next,this):l?(u?l[E]=u:delete l[E],(r=l[0]||l[1]||l[2]||l[3])&&r===(l[3]||l[2]||l[1]||l[0])&&!r.length&&(i?i[C]=r:this._root=r),this):(this._root=u,this)}function bS(t){for(var l=0,r=t.length;l<r;++l)this.remove(t[l]);return this}function vS(){return this._root}function wS(){var t=0;return this.visit(function(l){if(!l.length)do++t;while(l=l.next)}),t}function kS(t){var l=[],r,i=this._root,c,u,d,m,x;for(i&&l.push(new Nn(i,this._x0,this._y0,this._x1,this._y1));r=l.pop();)if(!t(i=r.node,u=r.x0,d=r.y0,m=r.x1,x=r.y1)&&i.length){var f=(u+m)/2,g=(d+x)/2;(c=i[3])&&l.push(new Nn(c,f,g,m,x)),(c=i[2])&&l.push(new Nn(c,u,g,f,x)),(c=i[1])&&l.push(new Nn(c,f,d,m,g)),(c=i[0])&&l.push(new Nn(c,u,d,f,g))}return this}function jS(t){var l=[],r=[],i;for(this._root&&l.push(new Nn(this._root,this._x0,this._y0,this._x1,this._y1));i=l.pop();){var c=i.node;if(c.length){var u,d=i.x0,m=i.y0,x=i.x1,f=i.y1,g=(d+x)/2,y=(m+f)/2;(u=c[0])&&l.push(new Nn(u,d,m,g,y)),(u=c[1])&&l.push(new Nn(u,g,m,x,y)),(u=c[2])&&l.push(new Nn(u,d,y,g,f)),(u=c[3])&&l.push(new Nn(u,g,y,x,f))}r.push(i)}for(;i=r.pop();)t(i.node,i.x0,i.y0,i.x1,i.y1);return this}function SS(t){return t[0]}function CS(t){return arguments.length?(this._x=t,this):this._x}function ES(t){return t[1]}function NS(t){return arguments.length?(this._y=t,this):this._y}function Eh(t,l,r){var i=new Nh(l??SS,r??ES,NaN,NaN,NaN,NaN);return t==null?i:i.addAll(t)}function Nh(t,l,r,i,c,u){this._x=t,this._y=l,this._x0=r,this._y0=i,this._x1=c,this._y1=u,this._root=void 0}function m0(t){for(var l={data:t.data},r=l;t=t.next;)r=r.next={data:t.data};return l}var An=Eh.prototype=Nh.prototype;An.copy=function(){var t=new Nh(this._x,this._y,this._x0,this._y0,this._x1,this._y1),l=this._root,r,i;if(!l)return t;if(!l.length)return t._root=m0(l),t;for(r=[{source:l,target:t._root=new Array(4)}];l=r.pop();)for(var c=0;c<4;++c)(i=l.source[c])&&(i.length?r.push({source:i,target:l.target[c]=new Array(4)}):l.target[c]=m0(i));return t};An.add=fS;An.addAll=hS;An.cover=mS;An.data=xS;An.extent=pS;An.find=yS;An.remove=gS;An.removeAll=bS;An.root=vS;An.size=wS;An.visit=kS;An.visitAfter=jS;An.x=CS;An.y=NS;function wa(t){return function(){return t}}function Vr(t){return(t()-.5)*1e-6}function AS(t){return t.x+t.vx}function TS(t){return t.y+t.vy}function DS(t){var l,r,i,c=1,u=1;typeof t!="function"&&(t=wa(t==null?1:+t));function d(){for(var f,g=l.length,y,b,v,S,j,E,C=0;C<u;++C)for(y=Eh(l,AS,TS).visitAfter(m),f=0;f<g;++f)b=l[f],j=r[b.index],E=j*j,v=b.x+b.vx,S=b.y+b.vy,y.visit(A);function A(F,_,H,M,I){var W=F.data,te=F.r,D=j+te;if(W){if(W.index>b.index){var Y=v-W.x-W.vx,B=S-W.y-W.vy,V=Y*Y+B*B;V<D*D&&(Y===0&&(Y=Vr(i),V+=Y*Y),B===0&&(B=Vr(i),V+=B*B),V=(D-(V=Math.sqrt(V)))/V*c,b.vx+=(Y*=V)*(D=(te*=te)/(E+te)),b.vy+=(B*=V)*D,W.vx-=Y*(D=1-D),W.vy-=B*D)}return}return _>v+D||M<v-D||H>S+D||I<S-D}}function m(f){if(f.data)return f.r=r[f.data.index];for(var g=f.r=0;g<4;++g)f[g]&&f[g].r>f.r&&(f.r=f[g].r)}function x(){if(l){var f,g=l.length,y;for(r=new Array(g),f=0;f<g;++f)y=l[f],r[y.index]=+t(y,f,l)}}return d.initialize=function(f,g){l=f,i=g,x()},d.iterations=function(f){return arguments.length?(u=+f,d):u},d.strength=function(f){return arguments.length?(c=+f,d):c},d.radius=function(f){return arguments.length?(t=typeof f=="function"?f:wa(+f),x(),d):t},d}function zS(t){return t.index}function x0(t,l){var r=t.get(l);if(!r)throw new Error("node not found: "+l);return r}function MS(t){var l=zS,r=y,i,c=wa(30),u,d,m,x,f,g=1;t==null&&(t=[]);function y(E){return 1/Math.min(m[E.source.index],m[E.target.index])}function b(E){for(var C=0,A=t.length;C<g;++C)for(var F=0,_,H,M,I,W,te,D;F<A;++F)_=t[F],H=_.source,M=_.target,I=M.x+M.vx-H.x-H.vx||Vr(f),W=M.y+M.vy-H.y-H.vy||Vr(f),te=Math.sqrt(I*I+W*W),te=(te-u[F])/te*E*i[F],I*=te,W*=te,M.vx-=I*(D=x[F]),M.vy-=W*D,H.vx+=I*(D=1-D),H.vy+=W*D}function v(){if(d){var E,C=d.length,A=t.length,F=new Map(d.map((H,M)=>[l(H,M,d),H])),_;for(E=0,m=new Array(C);E<A;++E)_=t[E],_.index=E,typeof _.source!="object"&&(_.source=x0(F,_.source)),typeof _.target!="object"&&(_.target=x0(F,_.target)),m[_.source.index]=(m[_.source.index]||0)+1,m[_.target.index]=(m[_.target.index]||0)+1;for(E=0,x=new Array(A);E<A;++E)_=t[E],x[E]=m[_.source.index]/(m[_.source.index]+m[_.target.index]);i=new Array(A),S(),u=new Array(A),j()}}function S(){if(d)for(var E=0,C=t.length;E<C;++E)i[E]=+r(t[E],E,t)}function j(){if(d)for(var E=0,C=t.length;E<C;++E)u[E]=+c(t[E],E,t)}return b.initialize=function(E,C){d=E,f=C,v()},b.links=function(E){return arguments.length?(t=E,v(),b):t},b.id=function(E){return arguments.length?(l=E,b):l},b.iterations=function(E){return arguments.length?(g=+E,b):g},b.strength=function(E){return arguments.length?(r=typeof E=="function"?E:wa(+E),S(),b):r},b.distance=function(E){return arguments.length?(c=typeof E=="function"?E:wa(+E),j(),b):c},b}var FS={value:()=>{}};function cg(){for(var t=0,l=arguments.length,r={},i;t<l;++t){if(!(i=arguments[t]+"")||i in r||/[\s.]/.test(i))throw new Error("illegal type: "+i);r[i]=[]}return new vc(r)}function vc(t){this._=t}function RS(t,l){return t.trim().split(/^|\s+/).map(function(r){var i="",c=r.indexOf(".");if(c>=0&&(i=r.slice(c+1),r=r.slice(0,c)),r&&!l.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:i}})}vc.prototype=cg.prototype={constructor:vc,on:function(t,l){var r=this._,i=RS(t+"",r),c,u=-1,d=i.length;if(arguments.length<2){for(;++u<d;)if((c=(t=i[u]).type)&&(c=_S(r[c],t.name)))return c;return}if(l!=null&&typeof l!="function")throw new Error("invalid callback: "+l);for(;++u<d;)if(c=(t=i[u]).type)r[c]=p0(r[c],t.name,l);else if(l==null)for(c in r)r[c]=p0(r[c],t.name,null);return this},copy:function(){var t={},l=this._;for(var r in l)t[r]=l[r].slice();return new vc(t)},call:function(t,l){if((c=arguments.length-2)>0)for(var r=new Array(c),i=0,c,u;i<c;++i)r[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(u=this._[t],i=0,c=u.length;i<c;++i)u[i].value.apply(l,r)},apply:function(t,l,r){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],c=0,u=i.length;c<u;++c)i[c].value.apply(l,r)}};function _S(t,l){for(var r=0,i=t.length,c;r<i;++r)if((c=t[r]).name===l)return c.value}function p0(t,l,r){for(var i=0,c=t.length;i<c;++i)if(t[i].name===l){t[i]=FS,t=t.slice(0,i).concat(t.slice(i+1));break}return r!=null&&t.push({name:l,value:r}),t}var pi=0,Cs=0,ws=0,ug=1e3,Dc,Es,zc=0,ja=0,Hc=0,Os=typeof performance=="object"&&performance.now?performance:Date,dg=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function fg(){return ja||(dg(OS),ja=Os.now()+Hc)}function OS(){ja=0}function Wf(){this._call=this._time=this._next=null}Wf.prototype=hg.prototype={constructor:Wf,restart:function(t,l,r){if(typeof t!="function")throw new TypeError("callback is not a function");r=(r==null?fg():+r)+(l==null?0:+l),!this._next&&Es!==this&&(Es?Es._next=this:Dc=this,Es=this),this._call=t,this._time=r,Zf()},stop:function(){this._call&&(this._call=null,this._time=1/0,Zf())}};function hg(t,l,r){var i=new Wf;return i.restart(t,l,r),i}function BS(){fg(),++pi;for(var t=Dc,l;t;)(l=ja-t._time)>=0&&t._call.call(void 0,l),t=t._next;--pi}function y0(){ja=(zc=Os.now())+Hc,pi=Cs=0;try{BS()}finally{pi=0,$S(),ja=0}}function LS(){var t=Os.now(),l=t-zc;l>ug&&(Hc-=l,zc=t)}function $S(){for(var t,l=Dc,r,i=1/0;l;)l._call?(i>l._time&&(i=l._time),t=l,l=l._next):(r=l._next,l._next=null,l=t?t._next=r:Dc=r);Es=t,Zf(i)}function Zf(t){if(!pi){Cs&&(Cs=clearTimeout(Cs));var l=t-ja;l>24?(t<1/0&&(Cs=setTimeout(y0,t-Os.now()-Hc)),ws&&(ws=clearInterval(ws))):(ws||(zc=Os.now(),ws=setInterval(LS,ug)),pi=1,dg(y0))}}const HS=1664525,US=1013904223,g0=4294967296;function IS(){let t=1;return()=>(t=(HS*t+US)%g0)/g0}function YS(t){return t.x}function qS(t){return t.y}var XS=10,VS=Math.PI*(3-Math.sqrt(5));function GS(t){var l,r=1,i=.001,c=1-Math.pow(i,1/300),u=0,d=.6,m=new Map,x=hg(y),f=cg("tick","end"),g=IS();t==null&&(t=[]);function y(){b(),f.call("tick",l),r<i&&(x.stop(),f.call("end",l))}function b(j){var E,C=t.length,A;j===void 0&&(j=1);for(var F=0;F<j;++F)for(r+=(u-r)*c,m.forEach(function(_){_(r)}),E=0;E<C;++E)A=t[E],A.fx==null?A.x+=A.vx*=d:(A.x=A.fx,A.vx=0),A.fy==null?A.y+=A.vy*=d:(A.y=A.fy,A.vy=0);return l}function v(){for(var j=0,E=t.length,C;j<E;++j){if(C=t[j],C.index=j,C.fx!=null&&(C.x=C.fx),C.fy!=null&&(C.y=C.fy),isNaN(C.x)||isNaN(C.y)){var A=XS*Math.sqrt(.5+j),F=j*VS;C.x=A*Math.cos(F),C.y=A*Math.sin(F)}(isNaN(C.vx)||isNaN(C.vy))&&(C.vx=C.vy=0)}}function S(j){return j.initialize&&j.initialize(t,g),j}return v(),l={tick:b,restart:function(){return x.restart(y),l},stop:function(){return x.stop(),l},nodes:function(j){return arguments.length?(t=j,v(),m.forEach(S),l):t},alpha:function(j){return arguments.length?(r=+j,l):r},alphaMin:function(j){return arguments.length?(i=+j,l):i},alphaDecay:function(j){return arguments.length?(c=+j,l):+c},alphaTarget:function(j){return arguments.length?(u=+j,l):u},velocityDecay:function(j){return arguments.length?(d=1-j,l):1-d},randomSource:function(j){return arguments.length?(g=j,m.forEach(S),l):g},force:function(j,E){return arguments.length>1?(E==null?m.delete(j):m.set(j,S(E)),l):m.get(j)},find:function(j,E,C){var A=0,F=t.length,_,H,M,I,W;for(C==null?C=1/0:C*=C,A=0;A<F;++A)I=t[A],_=j-I.x,H=E-I.y,M=_*_+H*H,M<C&&(W=I,C=M);return W},on:function(j,E){return arguments.length>1?(f.on(j,E),l):f.on(j)}}}function KS(){var t,l,r,i,c=wa(-30),u,d=1,m=1/0,x=.81;function f(v){var S,j=t.length,E=Eh(t,YS,qS).visitAfter(y);for(i=v,S=0;S<j;++S)l=t[S],E.visit(b)}function g(){if(t){var v,S=t.length,j;for(u=new Array(S),v=0;v<S;++v)j=t[v],u[j.index]=+c(j,v,t)}}function y(v){var S=0,j,E,C=0,A,F,_;if(v.length){for(A=F=_=0;_<4;++_)(j=v[_])&&(E=Math.abs(j.value))&&(S+=j.value,C+=E,A+=E*j.x,F+=E*j.y);v.x=A/C,v.y=F/C}else{j=v,j.x=j.data.x,j.y=j.data.y;do S+=u[j.data.index];while(j=j.next)}v.value=S}function b(v,S,j,E){if(!v.value)return!0;var C=v.x-l.x,A=v.y-l.y,F=E-S,_=C*C+A*A;if(F*F/x<_)return _<m&&(C===0&&(C=Vr(r),_+=C*C),A===0&&(A=Vr(r),_+=A*A),_<d&&(_=Math.sqrt(d*_)),l.vx+=C*v.value*i/_,l.vy+=A*v.value*i/_),!0;if(v.length||_>=m)return;(v.data!==l||v.next)&&(C===0&&(C=Vr(r),_+=C*C),A===0&&(A=Vr(r),_+=A*A),_<d&&(_=Math.sqrt(d*_)));do v.data!==l&&(F=u[v.data.index]*i/_,l.vx+=C*F,l.vy+=A*F);while(v=v.next)}return f.initialize=function(v,S){t=v,r=S,g()},f.strength=function(v){return arguments.length?(c=typeof v=="function"?v:wa(+v),g(),f):c},f.distanceMin=function(v){return arguments.length?(d=v*v,f):Math.sqrt(d)},f.distanceMax=function(v){return arguments.length?(m=v*v,f):Math.sqrt(m)},f.theta=function(v){return arguments.length?(x=v*v,f):Math.sqrt(x)},f}const Bs={tech:{bg:"rgba(59,130,246,0.15)",border:"#3b82f6",text:"#60a5fa"},market:{bg:"rgba(245,158,11,0.15)",border:"#f59e0b",text:"#fbbf24"},strategy:{bg:"rgba(139,92,246,0.15)",border:"#8b5cf6",text:"#a78bfa"},financial:{bg:"rgba(34,197,94,0.15)",border:"#22c55e",text:"#4ade80"},process:{bg:"rgba(236,72,153,0.15)",border:"#ec4899",text:"#f472b6"},competitor:{bg:"rgba(239,68,68,0.15)",border:"#ef4444",text:"#f87171"},domain:{bg:"rgba(14,165,233,0.15)",border:"#0ea5e9",text:"#38bdf8"},general:{bg:"rgba(148,163,184,0.12)",border:"#64748b",text:"#94a3b8"}};function QS(t){return Bs[t]??Bs.general}function WS({docs:t,onNodeClick:l,selectedDocId:r}){var Y;const i=k.useRef(null),c=k.useRef(null),[u,d]=k.useState({width:600,height:400}),[m,x]=k.useState({nodes:[],links:[]}),[f,g]=k.useState(null),[y,b]=k.useState(null),[v,S]=k.useState({x:0,y:0}),[j,E]=k.useState({x:0,y:0,w:600,h:400}),C=k.useRef(!1),A=k.useRef({x:0,y:0,vx:0,vy:0}),F=k.useRef(null),_=k.useRef(null);k.useEffect(()=>{const B=i.current;if(!B)return;const V=new ResizeObserver(ne=>{const{width:G,height:L}=ne[0].contentRect;G>0&&L>0&&(d({width:G,height:L}),E(Z=>({...Z,w:G,h:L})))});return V.observe(B),()=>V.disconnect()},[]),k.useEffect(()=>{if(t.length===0)return;const B=new Set(t.map(ue=>ue.id)),V=t.map(ue=>({id:ue.id,title:ue.title,category:ue.category,akb_type:ue.akb_type})),ne=(ue,z)=>{if(!z.startsWith(".")&&!z.startsWith("/"))return z;const R=ue.split("/");R.pop();const K=z.split("/");for(const T of K)T===".."?R.pop():T!=="."&&T!==""&&R.push(T);return R.join("/")},G=[];for(const ue of t)for(const z of ue.links){const R=ne(ue.id,z.href);B.has(R)&&R!==ue.id&&(G.some(K=>K.source===ue.id&&K.target===R||K.source===R&&K.target===ue.id)||G.push({source:ue.id,target:R,label:z.text}))}const{width:L,height:Z}=u,de=GS(V).force("link",MS(G).id(ue=>ue.id).distance(140)).force("charge",KS().strength(-400)).force("center",dS(L/2,Z/2)).force("collide",DS(50));_.current=de,de.on("tick",()=>{for(const ue of V)ue.x=Math.max(60,Math.min(L-60,ue.x??L/2)),ue.y=Math.max(60,Math.min(Z-60,ue.y??Z/2));x({nodes:[...V],links:[...G]})}),de.alpha(1).restart();for(let ue=0;ue<150;ue++)de.tick();return de.stop(),x({nodes:[...V],links:[...G]}),()=>{de.stop()}},[t,u]);const H=B=>{if(typeof B=="string"){const V=m.nodes.find(ne=>ne.id===B);return{x:(V==null?void 0:V.x)??0,y:(V==null?void 0:V.y)??0}}return{x:B.x??0,y:B.y??0}},M=k.useCallback(B=>{B.preventDefault();const V=B.deltaY>0?1.1:.9;E(ne=>{const G=Math.max(200,Math.min(u.width*3,ne.w*V)),L=Math.max(150,Math.min(u.height*3,ne.h*V)),Z=(G-ne.w)/2,de=(L-ne.h)/2;return{x:ne.x-Z,y:ne.y-de,w:G,h:L}})},[u]),I=k.useCallback(B=>{B.button===0&&(C.current=!0,A.current={x:B.clientX,y:B.clientY,vx:j.x,vy:j.y})},[j]),W=k.useCallback(B=>{var V;if(F.current){const ne=c.current;if(!ne)return;const G=ne.getBoundingClientRect(),L=j.w/G.width,Z=j.h/G.height,de=j.x+(B.clientX-G.left)*L,ue=j.y+(B.clientY-G.top)*Z;F.current.fx=de,F.current.fy=ue,(V=_.current)==null||V.alpha(.3).restart();return}if(C.current){const ne=(B.clientX-A.current.x)*(j.w/u.width),G=(B.clientY-A.current.y)*(j.h/u.height);E(L=>({...L,x:A.current.vx-ne,y:A.current.vy-G}))}},[j,u]),te=k.useCallback(()=>{C.current=!1,F.current&&(F.current.fx=null,F.current.fy=null,F.current=null)},[]),D=k.useCallback((B,V)=>{var ne;B.stopPropagation(),F.current=V,(ne=_.current)==null||ne.alpha(.3).restart()},[]);return s.jsxs("div",{ref:i,className:"relative flex-1 overflow-hidden",style:{background:"#1e1e2e"},children:[s.jsxs("svg",{ref:c,width:u.width,height:u.height,viewBox:`${j.x} ${j.y} ${j.w} ${j.h}`,style:{display:"block",cursor:C.current?"grabbing":"grab"},onWheel:M,onMouseDown:I,onMouseMove:W,onMouseUp:te,onMouseLeave:te,children:[s.jsx("defs",{children:s.jsx("pattern",{id:"grid",width:"20",height:"20",patternUnits:"userSpaceOnUse",children:s.jsx("circle",{cx:"0",cy:"0",r:"0.5",fill:"rgba(255,255,255,0.06)"})})}),s.jsx("rect",{x:j.x-100,y:j.y-100,width:j.w+200,height:j.h+200,fill:"url(#grid)",pointerEvents:"none"}),m.links.map((B,V)=>{const ne=H(B.source),G=H(B.target),L=y===V,Z=(ne.x+G.x)/2,de=(ne.y+G.y)/2;return s.jsxs("g",{children:[s.jsx("line",{x1:ne.x,y1:ne.y,x2:G.x,y2:G.y,stroke:"transparent",strokeWidth:12,style:{cursor:"default"},onMouseEnter:()=>b(V),onMouseLeave:()=>b(null)}),s.jsx("line",{x1:ne.x,y1:ne.y,x2:G.x,y2:G.y,stroke:L?"rgba(148,163,184,0.7)":"rgba(148,163,184,0.3)",strokeWidth:L?2:1.5,strokeDasharray:"4 3",pointerEvents:"none"}),L&&B.label&&s.jsx("text",{x:Z,y:de-6,textAnchor:"middle",fill:"#e2e8f0",fontSize:9,fontFamily:"monospace",style:{pointerEvents:"none"},children:s.jsx("tspan",{style:{filter:"drop-shadow(0 0 2px rgba(0,0,0,0.8))"},children:B.label.length>30?B.label.slice(0,28)+"..":B.label})})]},V)}),m.nodes.map(B=>{const V=Bs[B.category]??Bs.general,ne=B.akb_type==="hub",G=ne?24:16,L=(f==null?void 0:f.id)===B.id,Z=r===B.id,de=L?1.2:Z?1.15:1;return s.jsxs("g",{transform:`translate(${B.x??0}, ${B.y??0}) scale(${de})`,style:{cursor:"pointer",transition:"transform 0.15s ease"},onClick:ue=>{ue.stopPropagation();const z=t.find(R=>R.id===B.id);z&&l(z)},onMouseDown:ue=>D(ue,B),onMouseEnter:ue=>{var R;g(B);const z=(R=i.current)==null?void 0:R.getBoundingClientRect();z&&S({x:ue.clientX-z.left,y:ue.clientY-z.top})},onMouseLeave:()=>g(null),children:[Z&&s.jsx("rect",{x:-G/2-4,y:-G/2-4,width:G+8,height:G+8,fill:"none",stroke:"#22c55e",strokeWidth:2,rx:ne?5:2,opacity:.6}),s.jsx("rect",{x:-G/2,y:-G/2,width:G,height:G,fill:V.border,rx:ne?4:2,opacity:L?1:.9}),s.jsx("rect",{x:-G/2+3,y:-G/2+3,width:Math.max(0,G-6),height:Math.max(0,G-6),fill:V.bg,rx:ne?3:1}),s.jsx("text",{y:G/2+14,textAnchor:"middle",fill:Z?"#e2e8f0":"#94a3b8",fontSize:11,fontFamily:"monospace",fontWeight:Z?"bold":"normal",style:{pointerEvents:"none"},children:B.title.length>24?B.title.slice(0,22)+"..":B.title})]},B.id)})]}),f&&!F.current&&s.jsxs("div",{className:"absolute z-10 pointer-events-none p-2.5 rounded text-xs max-w-[240px]",style:{left:Math.min(v.x+16,u.width-250),top:Math.max(v.y-30,8),background:"var(--hud-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)",boxShadow:"0 4px 12px rgba(0,0,0,0.4)"},children:[s.jsx("div",{className:"font-bold mb-1",children:f.title}),s.jsxs("div",{className:"text-[10px] opacity-60 mb-1",children:[f.akb_type.toUpperCase()," / ",f.category]}),((Y=t.find(B=>B.id===f.id))==null?void 0:Y.tldr)&&s.jsx("div",{className:"text-[10px] opacity-80 mb-1",children:t.find(B=>B.id===f.id).tldr}),s.jsx("div",{className:"text-[10px] text-green-400",children:"Click to open | Drag to move"})]}),t.length===0&&s.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-xs",style:{color:"var(--terminal-text-muted)"},children:"No knowledge documents found"})]})}function ZS({doc:t,allDocs:l,onOpen:r,onNavigateDoc:i}){const[c,u]=k.useState(!1),d=QS(t.category),m=t.akb_type==="hub",x=new Set(l.map(f=>f.id));return s.jsxs("div",{className:"mb-2 rounded-lg overflow-hidden",style:{background:m?"rgba(22,163,106,0.08)":"var(--hud-bg-alt)",border:`2px solid ${m?"rgba(22,163,106,0.4)":"var(--terminal-border)"}`},children:[s.jsxs("div",{className:"p-3 cursor-pointer hover:bg-white/5",onClick:()=>u(!c),children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("span",{className:"shrink-0 text-sm",children:m?"🗂":t.format==="html"?"🌐":"📄"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[s.jsx("span",{className:"font-semibold text-xs truncate",style:{color:"var(--terminal-text)"},children:t.title}),s.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{background:t.status==="active"?"#16a34a":t.status==="draft"?"#f59e0b":"#94a3b8"},title:t.status})]}),s.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:t.tags.slice(0,4).map(f=>s.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-medium",style:{background:d.bg,color:d.text,border:`1px solid ${d.border}`},children:f},f))})]}),s.jsx("span",{className:"text-xs shrink-0",style:{color:"var(--terminal-text-muted)"},children:c?"▲":"▼"})]}),!c&&t.tldr&&s.jsx("div",{className:"mt-1.5 text-[10px] line-clamp-2 ml-6",style:{color:"var(--terminal-text-secondary)"},children:t.tldr})]}),c&&s.jsxs("div",{className:"px-3 pb-3",style:{borderTop:"1px solid var(--terminal-border)"},children:[t.tldr&&s.jsx("div",{className:"mt-2 text-[11px] leading-relaxed italic",style:{color:"var(--terminal-text-secondary)"},children:t.tldr}),t.links.length>0&&s.jsxs("div",{className:"mt-2",children:[s.jsx("div",{className:"text-[9px] font-bold uppercase mb-1",style:{color:"var(--terminal-text-muted)"},children:"Cross-links"}),s.jsx("div",{className:"flex flex-wrap gap-1",children:t.links.slice(0,5).map((f,g)=>{const y=f.href.replace(/^.*knowledge\//,"").replace(/^\.\.\/.*$/,"").replace(/^\.\//,""),b=x.has(y);return s.jsxs("span",{className:`px-1.5 py-0.5 text-[9px] rounded ${b?"cursor-pointer hover:opacity-70":""}`,style:{background:b?"rgba(22,163,106,0.15)":"rgba(148,163,184,0.1)",color:b?"#4ade80":"var(--terminal-text-muted)",border:`1px solid ${b?"rgba(22,163,106,0.3)":"var(--terminal-border)"}`},onClick:v=>{b&&(v.stopPropagation(),i(y))},children:["🔗"," ",f.text]},g)})})]}),s.jsxs("button",{className:"mt-2 text-[10px] font-semibold cursor-pointer hover:opacity-70",style:{color:"var(--active-green)"},onClick:f=>{f.stopPropagation(),r(t)},children:["Open full ","→"]})]})]})}function JS({docId:t,onBack:l,onDocUpdated:r,onDelete:i,onNavigateDoc:c,allDocs:u}){const[d,m]=k.useState(null),[x,f]=k.useState(!0),[g,y]=k.useState(!1),[b,v]=k.useState(""),[S,j]=k.useState(!1),E=new Set(u.map(H=>H.id)),C=k.useCallback(H=>{const M=H.split("#")[0];if(!M.match(/\.(md|html)$/))return null;const I=t.includes("/")?t.replace(/\/[^/]+$/,""):"";let W;if(M.startsWith("./"))W=I?`${I}/${M.slice(2)}`:M.slice(2);else if(M.startsWith("../")){const Y=I.split("/").filter(Boolean);let B=M;for(;B.startsWith("../");)Y.length>0&&Y.pop(),B=B.slice(3);W=Y.length>0?`${Y.join("/")}/${B}`:B}else W=M;if(E.has(W))return W;const te=W.split("/").pop()??"",D=u.find(Y=>Y.id===te||Y.id.endsWith("/"+te));return D?D.id:null},[t,E,u]),A=k.useCallback(H=>{const I=H.target.closest("a");if(!I)return;const W=I.getAttribute("href");if(!W||W.startsWith("http://")||W.startsWith("https://")||!W.match(/\.(md|html)(#.*)?$/))return;H.preventDefault(),H.stopPropagation();const te=C(W);te&&c(te)},[C,c]);k.useEffect(()=>{f(!0),Ce.getKnowledgeDoc(t).then(H=>{m(H),v(H.content)}).catch(console.error).finally(()=>f(!1))},[t]);const F=async()=>{if(d){j(!0);try{await Ce.updateKnowledgeDoc(t,b),m({...d,content:b}),y(!1),r()}catch(H){console.error("Save failed:",H)}finally{j(!1)}}},_=async()=>{if(confirm(`Delete "${d==null?void 0:d.title}"?`))try{await Ce.deleteKnowledgeDoc(t),i(t)}catch(H){console.error("Delete failed:",H)}};return x?s.jsx("div",{className:"flex-1 flex items-center justify-center text-xs",style:{color:"var(--terminal-text-muted)"},children:"Loading..."}):d?s.jsxs("div",{className:"flex-1 overflow-y-auto flex flex-col",children:[s.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[s.jsxs("button",{onClick:l,className:"text-xs font-semibold cursor-pointer hover:opacity-70",style:{color:"var(--active-green)"},children:["←"," Back"]}),s.jsx("div",{className:"flex-1"}),g?s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:()=>{y(!1),v(d.content)},className:"px-2.5 py-1 text-[10px] rounded cursor-pointer",style:{background:"var(--hud-bg-alt)",color:"var(--terminal-text-secondary)",border:"1px solid var(--terminal-border)"},children:"Cancel"}),s.jsx("button",{onClick:F,disabled:S,className:"px-2.5 py-1 text-[10px] rounded cursor-pointer font-semibold text-white",style:{background:S?"#86efac":"#16a34a"},children:S?"Saving...":"Save"})]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:()=>y(!0),className:"px-2.5 py-1 text-[10px] rounded cursor-pointer font-semibold",style:{background:"rgba(59,130,246,0.15)",color:"#60a5fa",border:"1px solid rgba(59,130,246,0.3)"},children:"Edit"}),s.jsx("button",{onClick:_,className:"px-2.5 py-1 text-[10px] rounded cursor-pointer font-semibold",style:{background:"rgba(239,68,68,0.15)",color:"#f87171",border:"1px solid rgba(239,68,68,0.3)"},children:"Delete"})]})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[s.jsx("h2",{className:"text-sm font-bold mb-1",style:{color:"var(--terminal-text)"},children:d.title}),d.tldr&&!g&&s.jsx("div",{className:"mb-3 text-xs italic",style:{color:"var(--terminal-text-secondary)"},children:d.tldr}),d.format==="html"?g?s.jsx("textarea",{className:"w-full h-full min-h-[400px] p-3 text-xs leading-relaxed rounded border resize-y",style:{fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace',background:"var(--hud-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},value:b,onChange:H=>v(H.target.value),spellCheck:!1}):s.jsx("iframe",{srcDoc:d.content,sandbox:"allow-same-origin",className:"w-full flex-1 min-h-[400px] rounded",style:{border:"1px solid var(--terminal-border)",background:"var(--hud-bg-alt)"},title:d.title}):g?s.jsx("textarea",{className:"w-full h-full min-h-[400px] p-3 text-xs leading-relaxed rounded border resize-y",style:{fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace',background:"#1e1e2e",color:"#e2e8f0",border:"1px solid #334155"},value:b,onChange:H=>v(H.target.value),spellCheck:!1}):s.jsx("div",{className:"text-xs leading-relaxed",style:{color:"var(--terminal-text-secondary)"},onClick:A,children:s.jsx(Is,{content:d.content})})]})]}):s.jsx("div",{className:"flex-1 flex items-center justify-center text-xs",style:{color:"var(--terminal-text-muted)"},children:"Failed to load document"})}function PS({onCreated:t,onCancel:l}){const[r,i]=k.useState(""),[c,u]=k.useState(""),[d,m]=k.useState(""),[x,f]=k.useState(!1),[g,y]=k.useState("");k.useEffect(()=>{if(!r){u("");return}const v=r.toLowerCase().replace(/[^a-z0-9가-힣\s-]/g,"").replace(/\s+/g,"-").slice(0,60);u(v)},[r]);const b=async()=>{if(!r.trim()||!c.trim()){y("Title and filename are required");return}f(!0),y("");try{const v=await Ce.createKnowledgeDoc({filename:c,title:r,category:d||void 0});t(v.id)}catch(v){y(v instanceof Error?v.message:"Failed to create")}finally{f(!1)}};return s.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[s.jsxs("button",{onClick:l,className:"text-xs font-semibold cursor-pointer hover:opacity-70",style:{color:"var(--active-green)"},children:["←"," Cancel"]}),s.jsx("h2",{className:"text-sm font-bold",style:{color:"var(--terminal-text)"},children:"New Document"})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"TITLE"}),s.jsx("input",{type:"text",value:r,onChange:v=>i(v.target.value),placeholder:"Document title...",className:"w-full px-3 py-2 text-xs rounded focus:outline-none",style:{background:"var(--hud-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)"}})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"FILENAME"}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("input",{type:"text",value:c,onChange:v=>u(v.target.value),className:"flex-1 px-3 py-2 text-xs rounded focus:outline-none font-mono",style:{background:"var(--hud-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)"}}),s.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:".md"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"CATEGORY (optional)"}),s.jsx("input",{type:"text",value:d,onChange:v=>m(v.target.value),placeholder:"e.g., tech, market, strategy",className:"w-full px-3 py-2 text-xs rounded focus:outline-none",style:{background:"var(--hud-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)"}})]}),g&&s.jsx("div",{className:"text-[10px] px-3 py-1.5 rounded",style:{background:"rgba(239,68,68,0.15)",color:"#f87171"},children:g}),s.jsx("button",{onClick:b,disabled:x||!r.trim(),className:"w-full py-2 text-xs font-semibold rounded cursor-pointer text-white",style:{background:x?"#86efac":"#16a34a"},children:x?"Creating...":"Create Document"})]})]})}const eC=500,b0=360,v0=700;function Ah(t){const[l,r]=k.useState(eC),[i,c]=k.useState(!1),u=k.useRef(0),d=k.useRef(0),m=t>0,x=m?t:0,f=m?Math.max(b0,window.innerWidth-t-100):v0,g=Math.min(l,f),y=k.useCallback(b=>{b.preventDefault(),u.current=b.clientX,d.current=g,c(!0);const v=j=>{const E=u.current-j.clientX,C=Math.min(v0,Math.max(b0,d.current+E));r(C)},S=()=>{c(!1),document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",S)};document.addEventListener("mousemove",v),document.addEventListener("mouseup",S)},[g]);return{panelRight:x,panelWidth:g,isResizing:i,handleResizeStart:y}}function tC({docs:t,onClose:l,onRefresh:r,terminalWidth:i=0,initialDocId:c}){const[u,d]=k.useState("list"),[m,x]=k.useState("all"),[f,g]=k.useState(c??null),[y,b]=k.useState(""),[v,S]=k.useState(!1),[j,E]=k.useState(null),{panelRight:C,panelWidth:A,isResizing:F,handleResizeStart:_}=Ah(i),H=["all",...Array.from(new Set(t.map(Y=>Y.category))).sort()],M=t.filter(Y=>{if(m!=="all"&&Y.category!==m)return!1;if(y){const B=y.toLowerCase();return Y.title.toLowerCase().includes(B)||(Y.tldr??"").toLowerCase().includes(B)||Y.tags.some(V=>V.toLowerCase().includes(B))}return!0}),I=Y=>{S(!1),r(),g(Y)},W=Y=>{g(null),r()},te=Y=>{E(Y.id)},D=j?t.find(Y=>Y.id===j):null;return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:C},onClick:l}),s.jsxs("div",{className:`side-panel open fixed top-0 h-full z-50 flex flex-col border-l-[3px] shadow-[-4px_0_20px_rgba(0,0,0,0.4)] ${F?"resizing":""}`,style:{right:C,width:A,background:"var(--terminal-bg)",borderLeftColor:"#16a34a"},children:[s.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${F?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:_}),s.jsxs("div",{className:"p-5 text-white relative",style:{background:"#16a34a"},children:[s.jsx("button",{onClick:l,className:"absolute top-3 right-3 w-7 h-7 rounded-full bg-white/20 text-white flex items-center justify-center text-lg hover:bg-white/30 cursor-pointer",children:"×"}),s.jsxs("div",{className:"text-lg font-bold",children:["📚"," Knowledge Base"]}),s.jsxs("div",{className:"text-xs opacity-80 mt-0.5",children:[t.length," documents"]})]}),s.jsxs("div",{className:"flex",style:{borderBottom:"1px solid var(--terminal-border)"},children:[s.jsx(w0,{label:"List",active:u==="list",onClick:()=>{d("list"),E(null)}}),s.jsx(w0,{label:"Graph",active:u==="graph",onClick:()=>d("graph")})]}),u==="list"&&!f&&!v&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[s.jsx("input",{type:"text",value:y,onChange:Y=>b(Y.target.value),placeholder:"Search docs...",className:"flex-1 px-2.5 py-1.5 text-[11px] rounded focus:outline-none",style:{background:"var(--hud-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)"}}),s.jsx("button",{onClick:()=>S(!0),className:"px-2.5 py-1.5 text-[10px] font-semibold rounded cursor-pointer text-white shrink-0",style:{background:"#16a34a"},children:"+ New"})]}),s.jsx("div",{className:"flex overflow-x-auto shrink-0",style:{borderBottom:"1px solid var(--terminal-border)",scrollbarWidth:"none"},children:H.map(Y=>s.jsx("button",{onClick:()=>x(Y),className:"px-3 py-1.5 text-[10px] font-medium cursor-pointer whitespace-nowrap",style:{color:m===Y?"#4ade80":"var(--terminal-text-muted)",borderBottom:m===Y?"2px solid #4ade80":"2px solid transparent"},children:Y==="all"?`All (${t.length})`:`${Y} (${t.filter(B=>B.category===Y).length})`},Y))}),s.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:M.length===0?s.jsx("div",{className:"text-center text-xs py-8",style:{color:"var(--terminal-text-muted)"},children:y?"No matching documents":"No documents in this category"}):M.map(Y=>s.jsx(ZS,{doc:Y,allDocs:t,onOpen:B=>g(B.id),onNavigateDoc:B=>g(B)},Y.id))})]}),u==="list"&&f&&!v&&s.jsx(JS,{docId:f,onBack:()=>g(null),onDocUpdated:r,onDelete:W,onNavigateDoc:Y=>g(Y),allDocs:t}),u==="list"&&v&&s.jsx(PS,{onCreated:I,onCancel:()=>S(!1)}),u==="graph"&&s.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[s.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[s.jsx(WS,{docs:t,onNodeClick:te,selectedDocId:j}),D&&s.jsxs("div",{className:"shrink-0 overflow-y-auto p-3",style:{width:200,background:"var(--hud-bg-alt)",borderLeft:"1px solid var(--terminal-border)"},children:[s.jsx("div",{className:"text-[10px] font-bold uppercase mb-1",style:{color:"var(--terminal-text-muted)"},children:"Selected"}),s.jsx("div",{className:"text-xs font-bold mb-1",style:{color:"var(--terminal-text)"},children:D.title}),s.jsx("div",{className:"w-2 h-2 rounded-full mb-2",style:{background:D.status==="active"?"#16a34a":D.status==="draft"?"#f59e0b":"#94a3b8"}}),D.tldr&&s.jsx("div",{className:"text-[10px] mb-2 leading-relaxed",style:{color:"var(--terminal-text-secondary)"},children:D.tldr}),D.links.length>0&&s.jsxs("div",{className:"mb-2",children:[s.jsx("div",{className:"text-[9px] font-bold mb-1",style:{color:"var(--terminal-text-muted)"},children:"Links"}),D.links.slice(0,5).map((Y,B)=>s.jsxs("div",{className:"text-[9px] mb-0.5 truncate",style:{color:"var(--terminal-text-secondary)"},children:["🔗"," ",Y.text]},B))]}),s.jsx("button",{className:"w-full py-1.5 text-[10px] font-semibold rounded cursor-pointer text-white",style:{background:"#16a34a"},onClick:()=>{d("list"),g(D.id),E(null)},children:"Open Document"})]})]}),s.jsx("div",{className:"shrink-0 p-2",style:{borderTop:"1px solid var(--terminal-border)"},children:s.jsx("div",{className:"flex flex-wrap gap-2",children:Object.entries(Bs).map(([Y,B])=>s.jsxs("div",{className:"flex items-center gap-1 text-[9px]",children:[s.jsx("div",{className:"w-2 h-2",style:{background:B.border}}),s.jsx("span",{style:{color:"var(--terminal-text-muted)"},children:Y})]},Y))})})]})]})]})}function w0({label:t,active:l,onClick:r}){return s.jsx("button",{onClick:r,className:"px-4 py-2.5 text-sm font-medium cursor-pointer",style:{color:l?"#4ade80":"var(--terminal-text-muted)",borderBottom:l?"2px solid #4ade80":"2px solid transparent"},children:t})}function nC({standups:t,waves:l,decisions:r,mode:i,onClose:c,terminalWidth:u=0}){const[d,m]=k.useState(i==="decisions"?"decisions":"standups"),{panelRight:x,panelWidth:f,isResizing:g,handleResizeStart:y}=Ah(u);return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:x},onClick:c}),s.jsxs("div",{className:`side-panel open fixed top-0 h-full z-50 flex flex-col border-l-[3px] shadow-[-4px_0_20px_rgba(0,0,0,0.4)] ${g?"resizing":""}`,style:{right:x,width:f,background:"var(--terminal-bg)",borderLeftColor:"var(--desk-wood)"},children:[s.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${g?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:y}),s.jsxs("div",{className:"p-5 bg-[var(--desk-wood)] text-white relative",children:[s.jsx("button",{onClick:c,className:"absolute top-3 right-3 w-7 h-7 rounded-full bg-white/20 text-white flex items-center justify-center text-lg hover:bg-white/30 cursor-pointer",children:"×"}),s.jsx("div",{className:"text-lg font-bold",children:i==="bulletin"?"📌 Bulletin Board":"📜 Decision Log"})]}),s.jsx("div",{className:"flex",style:{borderBottom:"1px solid var(--terminal-border)"},children:i==="bulletin"?s.jsxs(s.Fragment,{children:[s.jsx(bf,{label:`Standups (${t.length})`,active:d==="standups",onClick:()=>m("standups")}),s.jsx(bf,{label:`Waves (${l.length})`,active:d==="waves",onClick:()=>m("waves")})]}):s.jsx(bf,{label:`Decisions (${r.length})`,active:d==="decisions",onClick:()=>m("decisions")})}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[d==="standups"&&t.map((b,v)=>s.jsx(vf,{title:`Standup ${b.date}`,content:b.content},v)),d==="waves"&&l.map((b,v)=>s.jsx(vf,{title:`Wave ${b.id}`,subtitle:b.timestamp,content:b.content},v)),d==="decisions"&&r.map((b,v)=>s.jsx(vf,{title:`#${b.id} ${b.title}`,subtitle:b.date,content:b.content},v))]})]})]})}function bf({label:t,active:l,onClick:r}){return s.jsx("button",{onClick:r,className:"px-4 py-2.5 text-sm font-medium cursor-pointer",style:{color:l?"var(--accent)":"var(--terminal-text-muted)",borderBottom:l?"2px solid var(--accent)":"2px solid transparent"},children:t})}function lC(t){return t.replace(/^#{1,6}\s+/gm,"").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/\*([^*]+)\*/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/```[\s\S]*?```/g,"").replace(/^\s*[-*+]\s+/gm,"• ").replace(/^\s*\d+\.\s+/gm,"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/^>\s+/gm,"").replace(/^---+$/gm,"").replace(/\|[^|]*\|/g,"").replace(/\n{2,}/g," · ").replace(/\n/g," ").trim()}function vf({title:t,subtitle:l,content:r}){const[i,c]=k.useState(!1),u=r.length>100,d=lC(r).slice(0,160);return s.jsxs("div",{className:"mb-3 rounded-lg overflow-hidden",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[s.jsxs("div",{className:"p-3 cursor-pointer hover:bg-white/5",onClick:()=>c(!i),children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{className:"font-medium text-sm",style:{color:"var(--terminal-text)"},children:t}),s.jsx("span",{className:"text-xs shrink-0 ml-2",style:{color:"var(--terminal-text-muted)"},children:i?"▲":"▼"})]}),l&&s.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--terminal-text-muted)"},children:l})]}),i&&s.jsx("div",{className:"px-3 pb-3 text-xs leading-relaxed pt-2",style:{borderTop:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:s.jsx(Is,{content:r})}),!i&&u&&s.jsx("div",{className:"px-3 pb-2 text-xs line-clamp-2 leading-relaxed",style:{color:"var(--terminal-text-muted)"},children:d})]})}function rC({projectId:t,onClose:l,terminalWidth:r=0}){const[i,c]=k.useState(null),{panelRight:u,panelWidth:d,isResizing:m,handleResizeStart:x}=Ah(r);if(k.useEffect(()=>{Ce.getProject(t).then(c).catch(console.error)},[t]),!i)return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:u},onClick:l}),s.jsx("div",{className:"side-panel open fixed top-0 h-full z-50 flex items-center justify-center border-l-[3px] border-[var(--meeting-blue)]",style:{right:u,width:d,background:"var(--terminal-bg)"},children:s.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-muted)"},children:"Loading project..."})})]});const f=i.tasks.filter(b=>b.status==="done").length,g=i.tasks.length,y=g>0?Math.round(f/g*100):0;return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:u},onClick:l}),s.jsxs("div",{className:`side-panel open fixed top-0 h-full z-50 flex flex-col border-l-[3px] border-[var(--meeting-blue)] shadow-[-4px_0_20px_rgba(0,0,0,0.4)] ${m?"resizing":""}`,style:{right:u,width:d,background:"var(--terminal-bg)"},children:[s.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${m?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:x}),s.jsxs("div",{className:"p-5 bg-[var(--meeting-blue)] text-white relative",children:[s.jsx("div",{className:"text-sm opacity-70",children:"Meeting Room"}),s.jsx("button",{onClick:l,className:"absolute top-3 right-3 z-10 w-7 h-7 rounded-full bg-white/20 text-white flex items-center justify-center text-lg hover:bg-white/30 cursor-pointer",children:"×"}),s.jsx("div",{className:"text-xl font-bold mt-1",children:i.name}),s.jsxs("div",{className:"flex items-center gap-3 mt-3 text-sm",children:[s.jsxs("span",{children:["Tasks: ",g]}),s.jsxs("span",{children:["Done: ",f]}),s.jsxs("span",{children:["Progress: ",y,"%"]})]}),s.jsx("div",{className:"mt-2 h-1.5 bg-white/20 rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-white rounded-full transition-all",style:{width:`${y}%`}})})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[i.prd&&s.jsxs("div",{className:"mb-5",children:[s.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:"PRD"}),s.jsx("div",{className:"rounded-lg p-4 text-xs leading-relaxed max-h-60 overflow-y-auto",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:s.jsx(Is,{content:i.prd})})]}),s.jsxs("div",{children:[s.jsxs("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:["Tasks (",g,")"]}),s.jsx("div",{className:"space-y-2",children:i.tasks.map(b=>s.jsxs("div",{className:"rounded-lg p-3",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-sm font-medium",style:{color:"var(--terminal-text)"},children:b.title}),s.jsx(aC,{status:b.status})]}),s.jsx("div",{className:"text-xs mt-1",style:{color:"var(--terminal-text-muted)"},children:b.role}),b.description&&s.jsx("div",{className:"text-xs mt-1.5 line-clamp-2",style:{color:"var(--terminal-text-secondary)"},children:b.description})]},b.id))})]})]})]})]})}function aC({status:t}){const l={done:{bg:"rgba(34,197,94,0.15)",color:"#4ade80"},"in-progress":{bg:"rgba(59,130,246,0.15)",color:"#60a5fa"},todo:{bg:"rgba(148,163,184,0.15)",color:"var(--terminal-text-muted)"}},r=l[t]??l.todo;return s.jsx("span",{className:"text-[10px] font-semibold px-2 py-0.5 rounded-full",style:{background:r.bg,color:r.color},children:t})}const iC={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"};function sC({roleId:t,roleName:l,mode:r="assign",onClose:i,onExecutionStart:c}){const[u,d]=k.useState(""),m=k.useRef(null);k.useEffect(()=>{var y;(y=m.current)==null||y.focus()},[]);const x=()=>{u.trim()&&(c(t,u.trim()),i())},f=y=>{y.key==="Enter"&&(y.metaKey||y.ctrlKey)&&x(),y.key==="Escape"&&i()},g=iC[t]??"#666";return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:i}),s.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[520px] z-[61] bg-[var(--wall)] rounded-2xl shadow-2xl overflow-hidden",children:[s.jsxs("div",{className:"p-5 text-white",style:{background:`linear-gradient(135deg, ${g}, ${g}cc)`},children:[s.jsx("div",{className:"text-lg font-bold",children:r==="ask"?"Ask":"Assign Task"}),s.jsx("div",{className:"text-sm opacity-80 mt-0.5",children:r==="ask"?`to ${l}`:`to ${l} (${t})`})]}),s.jsxs("div",{className:"p-5",children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Task Description"}),s.jsx("textarea",{ref:m,value:u,onChange:y=>d(y.target.value),onKeyDown:f,placeholder:r==="ask"?"What would you like to ask?":"Describe the task...",className:"w-full h-32 p-3 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 placeholder-white/25 resize-none focus:outline-none focus:border-white/25 transition-colors"}),s.jsx("div",{className:"text-[10px] text-white/30 mt-1",children:"Cmd+Enter to submit"})]}),s.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[s.jsx("button",{onClick:i,className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer",children:"Cancel"}),s.jsx("button",{onClick:x,disabled:!u.trim(),className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:g},children:r==="ask"?"Ask":"Assign"})]})]})]})}const k0={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"};function mg({event:t,isThinkingCollapsed:l,onToggleThinking:r,onNavigateToJob:i,onOpenKnowledgeDoc:c,compact:u}){var m;const d=k0[t.roleId]??"#888";switch(t.type){case"text":{const x=t.data.text??"",f=u?x.slice(0,300):x;return/[#*|`\[\]_~>-]/.test(f)?s.jsx("div",{className:"text-green-300/90 leading-relaxed event-markdown",children:s.jsx(gh,{remarkPlugins:[kh],children:f})}):s.jsx("div",{className:"text-green-300/90 whitespace-pre-wrap leading-relaxed",children:f})}case"thinking":{const x=t.data.text??"";return s.jsxs("div",{className:"group",children:[s.jsxs("button",{onClick:r,className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-[10px] cursor-pointer flex items-center gap-1",children:[s.jsx("span",{children:l?"▶":"▼"}),s.jsx("span",{className:"italic",children:"thinking..."})]}),!l&&s.jsxs("div",{className:`ml-3 text-[var(--terminal-text-muted)] italic whitespace-pre-wrap opacity-60 text-[11px] overflow-y-auto ${u?"max-h-[60px]":"max-h-[120px]"}`,children:[x.slice(0,u?200:500),x.length>(u?200:500)?"...":""]})]})}case"tool:start":{const x=String(t.data.name??""),f=t.data.input,g=typeof(f==null?void 0:f.command)=="string"?f.command.slice(0,80):"",y=typeof(f==null?void 0:f.file_path)=="string"?String(f.file_path):typeof(f==null?void 0:f.path)=="string"?String(f.path):"",b=y?y.split("/").pop()??"":"",v=/^(write_file|Write|edit_file|Edit)$/i.test(x),S=(m=y.match(/(?:^|\/)knowledge\/(.+\.md)$/))==null?void 0:m[1],j=v&&S&&c;return s.jsxs("div",{className:"flex items-center gap-2 py-0.5",children:[s.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] ${j?"text-green-400/80 bg-green-400/10":"text-blue-400/80 bg-blue-400/10"}`,children:j?v&&x.toLowerCase().includes("edit")?"Edit":"Write":x}),j?s.jsx("button",{onClick:()=>c(S),className:"text-[10px] text-green-400 hover:text-green-300 underline underline-offset-2 cursor-pointer truncate",style:{maxWidth:u?200:400},children:b}):s.jsxs(s.Fragment,{children:[g&&s.jsx("span",{className:`text-[var(--terminal-text-muted)] text-[10px] truncate ${u?"max-w-[200px]":"max-w-[400px]"}`,children:g}),b&&s.jsx("span",{className:`text-[var(--terminal-text-muted)] text-[10px] truncate ${u?"max-w-[200px]":"max-w-[400px]"}`,children:b})]})]})}case"dispatch:start":{const x=t.data.targetRoleId??t.data.roleId??"",f=t.data.task??"",g=t.data.childJobId,y=k0[x]??"#888";return s.jsx("div",{className:"my-1 p-2 rounded-lg border cursor-pointer hover:opacity-90 transition-opacity",style:{borderColor:`${y}44`,background:`${y}11`},onClick:()=>g&&(i==null?void 0:i(g)),children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{style:{color:y},className:"font-bold text-[11px]",children:["→"," ",x.toUpperCase()]}),s.jsx("span",{className:"text-[var(--terminal-text-secondary)] text-[10px] truncate flex-1",children:f.slice(0,u?60:100)}),g&&i&&s.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-white/10 text-[var(--terminal-text-muted)]",children:["View ","→"]})]})})}case"dispatch:done":return s.jsx("div",{className:"text-[var(--terminal-text-muted)] text-[10px] pl-3 border-l-2 border-[var(--terminal-border)] my-0.5",children:"Dispatch completed"});case"turn:complete":return s.jsx("div",{className:"border-t border-[var(--terminal-border)] my-2 relative",children:s.jsxs("span",{className:"absolute -top-2 left-2 bg-[var(--terminal-bg)] px-2 text-[9px] text-[var(--terminal-text-muted)]",children:["Turn ",t.data.turn]})});case"stderr":return s.jsxs("div",{className:"text-red-400/80 text-[11px]",children:["⚠"," ",t.data.message]});case"job:start":return s.jsxs("div",{className:"text-[var(--terminal-text-muted)] text-[10px] pb-1",children:[s.jsx("span",{style:{color:d},className:"font-bold",children:t.roleId.toUpperCase()})," ","started: ",(t.data.task??"").slice(0,u?50:80)]});case"job:done":{const x=t.data.turns??0,f=t.data.toolCalls??0;return s.jsx("div",{className:"mt-2 p-2 rounded-lg bg-green-900/20 border border-green-800/30",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-green-400"}),s.jsx("span",{className:"text-green-300 font-bold text-[11px]",children:"Complete"}),s.jsxs("span",{className:"text-[var(--terminal-text-muted)] text-[10px]",children:[x," turns · ",f," tools"]})]})})}case"job:error":return s.jsx("div",{className:"mt-2 p-2 rounded-lg bg-red-900/20 border border-red-800/30",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-red-400"}),s.jsx("span",{className:"text-red-300 font-bold text-[11px]",children:"Error"}),s.jsx("span",{className:"text-red-200/70 text-[10px]",children:t.data.message})]})});case"job:awaiting_input":{const x=t.data.question??"";return s.jsxs("div",{className:"mt-2 p-2 rounded-lg border",style:{background:"#F59E0B11",borderColor:"#F59E0B33"},children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:"#F59E0B",animation:"wave-pulse 1.5s ease-in-out infinite"}}),s.jsx("span",{className:"font-bold text-[11px]",style:{color:"#F59E0B"},children:"Awaiting Reply"})]}),x&&s.jsx("div",{className:"mt-1 text-[11px] text-[var(--terminal-text)] whitespace-pre-wrap",children:x})]})}case"job:reply":return s.jsx("div",{className:"mt-1 p-2 rounded-lg bg-blue-900/20 border border-blue-800/30",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-blue-300 font-bold text-[11px]",children:"CEO replied:"}),s.jsx("span",{className:"text-blue-200/80 text-[11px]",children:t.data.response??""})]})});case"import:scan":case"import:process":case"import:created":return s.jsxs("div",{className:"text-cyan-300/70 text-[11px]",children:["[",t.type,"] ",JSON.stringify(t.data)]});default:return null}}function oC({jobId:t,title:l,color:r,variant:i,style:c,onClose:u,onMinimize:d,onDone:m,onNavigateToJob:x,onOpenKnowledgeDoc:f}){const{events:g,status:y,textOutput:b,childJobIds:v}=K0(t),[S,j]=k.useState(0),[E,C]=k.useState(new Set),A=k.useRef(null),F=k.useRef(Date.now()),_=k.useRef(!1);k.useEffect(()=>{const Y=setInterval(()=>{j(Math.floor((Date.now()-F.current)/1e3))},1e3);return()=>clearInterval(Y)},[]),k.useEffect(()=>{A.current&&(A.current.scrollTop=A.current.scrollHeight)},[g]),k.useEffect(()=>{(y==="done"||y==="error")&&!_.current&&(_.current=!0,m==null||m())},[y,m]);const H=Y=>{C(B=>{const V=new Set(B);return V.has(Y)?V.delete(Y):V.add(Y),V})},M={idle:"Waiting",connecting:"Connecting...",streaming:"Working",done:"Complete",error:"Error"}[y],I={idle:"#888",connecting:"#888",streaming:r,done:"#2E7D32",error:"#C62828"}[y],W=Y=>`${Math.floor(Y/60)}:${String(Y%60).padStart(2,"0")}`,te=y==="done"||y==="error",D=s.jsxs("div",{className:i==="modal"?"fixed top-[5%] left-1/2 -translate-x-1/2 w-[720px] max-w-[95vw] h-[85vh] z-[61] bg-[var(--terminal-bg)] rounded-2xl shadow-2xl overflow-hidden flex flex-col":"bg-[var(--terminal-bg)] rounded-xl border border-[var(--terminal-border)] overflow-hidden flex flex-col max-h-[400px]",style:c,children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-[var(--terminal-border)] shrink-0",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-3 h-3 rounded-full animate-pulse",style:{background:I}}),s.jsx("div",{children:s.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-sm",children:l})})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs font-mono",children:W(S)}),s.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full font-semibold",style:{background:`${I}22`,color:I},children:M}),d&&i==="modal"&&s.jsx("button",{onClick:d,title:"Minimize",className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-sm cursor-pointer px-1",children:"–"}),te&&s.jsx("button",{onClick:u,className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-lg cursor-pointer",children:"×"})]})]}),s.jsxs("div",{ref:A,className:"flex-1 overflow-y-auto p-4 space-y-1 text-xs font-mono",children:[g.length===0&&y==="connecting"&&s.jsx("div",{className:"text-[var(--terminal-text-muted)]",children:"Connecting to activity stream..."}),g.map(Y=>s.jsx(mg,{event:Y,isThinkingCollapsed:E.has(Y.seq),onToggleThinking:()=>H(Y.seq),onNavigateToJob:x,onOpenKnowledgeDoc:f},Y.seq)),y==="streaming"&&s.jsx("span",{className:"inline-block w-2 h-4 bg-green-400 animate-pulse ml-0.5"})]}),s.jsxs("div",{className:"px-5 py-3 border-t border-[var(--terminal-border)] flex items-center justify-between shrink-0",children:[s.jsxs("div",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:[g.length>0&&`${g.length} events`,b.length>0&&` · ${b.length} chars`,v.length>0&&` · ${v.length} dispatches`]}),te&&s.jsx("button",{onClick:u,className:"px-4 py-1.5 text-xs text-white rounded-lg font-semibold cursor-pointer",style:{background:r},children:"Close"})]})]});return i==="modal"?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:te?u:void 0}),D]}):D}const wf={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};function cC({orgNodes:t,rootId:l}){const r=t[l];if(!r)return null;const c=r.children.map(m=>t[m]).filter(Boolean),u=[];for(const m of c)for(const x of m.children){const f=t[x];f&&u.push({node:f,parentId:m.id})}const d=c.length+u.length;return s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Propagation Preview"}),s.jsxs("div",{className:"bg-white/5 border border-white/10 rounded-lg p-4",children:[s.jsx("div",{className:"flex justify-center mb-2",children:s.jsx("span",{className:"px-3 py-1 text-[10px] font-bold rounded border-2 border-white/20 bg-white/5 text-white/30 uppercase",children:"CEO"})}),c.length>0&&s.jsx("div",{className:"flex justify-center mb-1",children:s.jsx("div",{className:"w-px h-3 bg-white/15"})}),c.length>1&&s.jsx("div",{className:"flex justify-center mb-1",children:s.jsx("div",{className:"h-px bg-white/15",style:{width:`${Math.min(c.length*80,320)}px`}})}),s.jsx("div",{className:"flex justify-center gap-3 mb-2 flex-wrap",children:c.map(m=>s.jsxs("div",{className:"flex flex-col items-center",children:[s.jsx("span",{className:"px-2.5 py-1 text-[10px] font-bold rounded border-2 uppercase",style:{borderColor:wf[m.id]??"#888",color:wf[m.id]??"#888",background:`${wf[m.id]??"#888"}22`},children:m.id}),s.jsx("span",{className:"text-[8px] text-white/30 mt-0.5",children:"direct"})]},m.id))}),u.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex justify-center mb-1",children:s.jsx("div",{className:"w-px h-2 bg-white/10"})}),s.jsx("div",{className:"flex justify-center gap-2 flex-wrap",children:u.map(({node:m})=>s.jsx("span",{className:"px-2 py-0.5 text-[9px] font-semibold rounded border border-white/15 text-white/40 uppercase",children:m.id},m.id))}),s.jsx("div",{className:"text-center text-[8px] text-white/30 mt-1",children:"via re-dispatch"})]})]}),s.jsxs("div",{className:"text-[10px] text-gray-400 mt-1.5",children:[d," role",d!==1?"s":""," will receive this wave"]})]})}function uC({cLevelRoles:t,orgNodes:l,rootId:r,onClose:i,onDispatch:c}){const[u,d]=k.useState(""),m=k.useRef(null);k.useEffect(()=>{var y;(y=m.current)==null||y.focus()},[]);const x=()=>{!u.trim()||t.length===0||(c(u.trim()),i())},f=y=>{y.key==="Enter"&&(y.metaKey||y.ctrlKey)&&x(),y.key==="Escape"&&i()},g=r&&Object.keys(l).length>0;return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:i}),s.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[560px] z-[61] bg-[var(--wall)] rounded-2xl shadow-2xl overflow-hidden",children:[s.jsxs("div",{className:"p-5 text-white",style:{background:"linear-gradient(135deg, #B71C1C, #D32F2F)"},children:[s.jsx("div",{className:"text-lg font-bold",children:"CEO Wave"}),s.jsx("div",{className:"text-sm opacity-80 mt-0.5",children:"Broadcast a directive to all C-Level reports"})]}),s.jsxs("div",{className:"p-5 space-y-4",children:[g&&s.jsx(cC,{orgNodes:l,rootId:r}),!g&&s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Dispatching to"}),s.jsx("div",{className:"flex gap-2 flex-wrap",children:t.length>0?t.map(y=>s.jsxs("span",{className:"px-3 py-1.5 text-xs font-semibold rounded-lg border-2 border-red-200 bg-red-50 text-red-800",children:[y.id.toUpperCase()," · ",y.name]},y.id)):s.jsx("span",{className:"text-xs text-gray-400 italic",children:"No C-Level roles found"})}),s.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"Each C-Level receives the directive and delegates to their reports"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Directive"}),s.jsx("textarea",{ref:m,value:u,onChange:y=>d(y.target.value),onKeyDown:f,placeholder:"e.g. Report current status across all departments",className:"w-full h-28 p-3 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 placeholder-white/25 resize-none focus:outline-none focus:border-white/25 transition-colors"}),s.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"Cmd+Enter to dispatch"})]})]}),s.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[s.jsx("button",{onClick:i,className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer",children:"Cancel"}),s.jsxs("button",{onClick:x,disabled:!u.trim()||t.length===0,className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#B71C1C"},children:["Dispatch to ",t.length," Role",t.length!==1?"s":""]})]})]})]})}function dC(t,l,r){const[i,c]=k.useState(new Map),[u,d]=k.useState(null),m=k.useRef(new Map),x=k.useRef(i);x.current=i,k.useEffect(()=>{if(!r||Object.keys(l).length===0)return;const b=new Map,v=j=>{const E=l[j];E&&(b.set(j,{jobId:null,roleId:j,roleName:E.name,children:E.children,status:"waiting",events:[],streamStatus:"idle"}),E.children.forEach(v))},S=l[r];S&&(b.set(r,{jobId:null,roleId:r,roleName:"CEO",children:S.children,status:"not-dispatched",events:[],streamStatus:"idle"}),S.children.forEach(v));for(const j of t){const E=b.get(j.roleId);E&&(E.jobId=j.jobId,E.status="running",E.streamStatus="connecting")}c(b),t.length>0&&d(t[0].roleId)},[t,l,r]);const f=k.useCallback((b,v)=>{const S=m.current.get(b);S&&S.controller.abort();const j=new AbortController,E={controller:j,lastSeq:-1};m.current.set(b,E);const A=`/api/jobs/${b}/stream?from=0`;fetch(A,{signal:j.signal}).then(async F=>{if(!F.ok||!F.body){c(I=>{const W=new Map(I),te=W.get(v);return te&&W.set(v,{...te,streamStatus:"error"}),W});return}c(I=>{const W=new Map(I),te=W.get(v);return te&&W.set(v,{...te,streamStatus:"streaming",status:"running"}),W});const _=F.body.getReader(),H=new TextDecoder;let M="";for(;;){const{done:I,value:W}=await _.read();if(I)break;M+=H.decode(W,{stream:!0});const te=M.split(`
|
|
81
|
+
`);M=te.pop()??"";let D="";for(const Y of te)if(Y.startsWith("event: "))D=Y.slice(7).trim();else if(Y.startsWith("data: ")){try{const B=JSON.parse(Y.slice(6));if(D==="activity"){const V=B;V.seq>E.lastSeq&&(E.lastSeq=V.seq),c(ne=>{const G=new Map(ne),L=G.get(v);if(!L||L.events.some(de=>de.seq===V.seq))return ne;const Z={...L,events:[...L.events,V]};if(V.type==="dispatch:start"&&V.data.childJobId){const de=V.data.childJobId,ue=V.data.targetRoleId??V.data.roleId;if(ue){const z=G.get(ue);z&&(G.set(ue,{...z,jobId:de,status:"running",streamStatus:"connecting"}),setTimeout(()=>f(de,ue),0))}}return V.type==="job:done"?(Z.status="done",Z.streamStatus="done"):V.type==="job:error"?(Z.status="error",Z.streamStatus="error"):V.type==="job:awaiting_input"?(Z.status="awaiting_input",Z.streamStatus="done"):V.type==="job:reply"&&(Z.status="running",Z.streamStatus="streaming"),G.set(v,Z),G})}else if(D==="stream:end"){const V=B.reason;c(ne=>{const G=new Map(ne),L=G.get(v);if(!L)return ne;const Z=V==="error"?"error":V==="awaiting_input"?"awaiting_input":"done";return G.set(v,{...L,status:L.status==="running"?Z:L.status,streamStatus:Z==="error"?"error":"done"}),G})}}catch{}D=""}}}).catch(F=>{F.name!=="AbortError"&&c(_=>{const H=new Map(_),M=H.get(v);return M&&H.set(v,{...M,streamStatus:"error"}),H})})},[]);k.useEffect(()=>{if(t.length!==0){for(const b of t)f(b.jobId,b.roleId);return()=>{for(const[,b]of m.current)b.controller.abort();m.current.clear()}}},[t,f]);const g=(()=>{let b=0,v=0,S=0,j=0;for(const[E,C]of i)E!==r&&(j++,C.status==="done"?b++:C.status==="running"?v++:C.status==="awaiting_input"&&S++);return{done:b,total:j,running:v,awaitingInput:S}})(),y=g.total>0&&g.running===0&&g.awaitingInput===0&&Array.from(i.values()).every(b=>b.status!=="running"&&b.status!=="awaiting_input"&&b.streamStatus!=="streaming"&&b.streamStatus!=="connecting");return k.useEffect(()=>{y&&c(b=>{const v=new Map(b);let S=!1;for(const[j,E]of v)E.status==="waiting"&&(v.set(j,{...E,status:"not-dispatched"}),S=!0);return S?v:b})},[y]),{nodes:i,selectedRoleId:u,selectNode:d,progress:g,allDone:y,connectStream:f}}const j0={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},ba=120,ir=44,S0=80;function fC(t,l){if(!t.get(l))return{layout:[],width:300,height:200};const i=[],c=[],u=[{id:l,depth:0,parentId:null}],d=new Set;for(;u.length>0;){const{id:g,depth:y,parentId:b}=u.shift();if(d.has(g))continue;for(d.add(g);c.length<=y;)c.push([]);c[y].push(g),i.push({roleId:g,x:0,y:y*S0+20,parentId:b});const v=t.get(g);if(v)for(const S of v.children)t.has(S)&&!d.has(S)&&u.push({id:S,depth:y+1,parentId:g})}const m=Math.max(...c.map(g=>g.length))*(ba+16),x=Math.max(m,280);for(const g of c){const y=g.length*(ba+16)-16,b=(x-y)/2;g.forEach((v,S)=>{const j=i.find(E=>E.roleId===v);j&&(j.x=b+S*(ba+16))})}const f=c.length*S0+40;return{layout:i,width:x,height:f}}function hC({nodes:t,rootId:l,selectedRoleId:r,onSelectNode:i}){const{layout:c,width:u,height:d}=fC(t,l),m=f=>{const g=c.find(y=>y.roleId===f);return g?{cx:g.x+ba/2,cy:g.y+ir/2}:{cx:0,cy:0}},x=f=>{switch(f.status){case"running":return j0[f.roleId]??"#FBBF24";case"awaiting_input":return"#F59E0B";case"done":return"#2E7D32";case"error":return"#C62828";case"not-dispatched":return"#666";default:return"#888"}};return s.jsxs("svg",{viewBox:`0 0 ${u} ${d}`,width:"100%",height:"100%",className:"block",children:[s.jsx("defs",{children:s.jsxs("filter",{id:"glow",children:[s.jsx("feGaussianBlur",{stdDeviation:"2",result:"blur"}),s.jsxs("feMerge",{children:[s.jsx("feMergeNode",{in:"blur"}),s.jsx("feMergeNode",{in:"SourceGraphic"})]})]})}),c.filter(f=>f.parentId).map(f=>{const g=m(f.parentId),y=m(f.roleId),b=t.get(f.roleId),v=t.get(f.parentId);let S="rgba(180,200,240,0.15)",j="4 4",E="";return(b==null?void 0:b.status)==="done"||(v==null?void 0:v.status)==="done"?(S="#2E7D3266",j=""):(b==null?void 0:b.status)==="awaiting_input"?(S="#F59E0B",j="6 4",E="wave-edge-flow"):(b==null?void 0:b.status)==="running"&&(S=j0[f.roleId]??"#FBBF24",j="6 4",E="wave-edge-flow"),s.jsx("line",{x1:g.cx,y1:g.cy+ir/2-4,x2:y.cx,y2:y.cy-ir/2+4,stroke:S,strokeWidth:1.5,strokeDasharray:j,className:E},`${f.parentId}-${f.roleId}`)}),c.map(f=>{const g=t.get(f.roleId);if(!g)return null;const y=x(g),b=r===f.roleId,v=f.roleId===l,S=v?.4:g.status==="not-dispatched"?.35:1;return s.jsxs("g",{transform:`translate(${f.x}, ${f.y})`,style:{cursor:v?"default":"pointer",opacity:S},onClick:()=>!v&&i(f.roleId),children:[s.jsx("rect",{x:0,y:0,width:ba,height:ir,rx:8,ry:8,fill:"var(--terminal-bg-deeper, #181825)",stroke:b?"#fff":y,strokeWidth:b?2:1.5,strokeDasharray:g.status==="not-dispatched"?"4 3":""}),s.jsx("circle",{cx:14,cy:ir/2,r:4,fill:y,filter:g.status==="running"||g.status==="awaiting_input"?"url(#glow)":void 0,children:(g.status==="running"||g.status==="awaiting_input")&&s.jsx("animate",{attributeName:"opacity",values:"1;0.4;1",dur:"1.5s",repeatCount:"indefinite"})}),s.jsx("text",{x:26,y:ir/2-4,fill:"var(--terminal-text, #fff)",fontSize:10,fontWeight:700,fontFamily:"var(--pixel-font)",children:g.roleId.toUpperCase()}),s.jsx("text",{x:26,y:ir/2+10,fill:"var(--terminal-text-muted, #888)",fontSize:8,fontFamily:"var(--pixel-font)",children:g.status==="running"?"Working...":g.status==="awaiting_input"?"Awaiting Reply":g.status==="done"?"Complete":g.status==="error"?"Error":g.status==="waiting"?"Waiting":""}),g.status==="done"&&s.jsx("text",{x:ba-18,y:ir/2+4,fontSize:14,fill:"#2E7D32",children:"✓"}),g.status==="error"&&s.jsx("text",{x:ba-18,y:ir/2+4,fontSize:14,fill:"#C62828",children:"✗"})]},f.roleId)})]})}const mC={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};function xC({directive:t,rootJobs:l,orgNodes:r,rootRoleId:i,onClose:c,onMinimize:u,onDone:d,onOpenKnowledgeDoc:m}){const{nodes:x,selectedRoleId:f,selectNode:g,progress:y,allDone:b,connectStream:v}=dC(l,r,i),[S,j]=k.useState(0),[E,C]=k.useState(new Set),[A,F]=k.useState(""),[_,H]=k.useState(!1),M=k.useRef(null),I=k.useRef(Date.now()),W=k.useRef(!1),te=k.useCallback(async()=>{if(!f||!A.trim())return;const L=x.get(f);if(!(!(L!=null&&L.jobId)||L.status!=="awaiting_input")){H(!0);try{const{jobId:Z}=await Ce.replyToJob(L.jobId,A.trim());F(""),v(Z,f)}catch(Z){console.error("Reply failed:",Z)}finally{H(!1)}}},[f,A,x,v]),D=k.useCallback(async L=>{const Z=x.get(L);if(Z!=null&&Z.jobId)try{await Ce.abortJob(Z.jobId)}catch(de){console.error("Abort failed:",de)}},[x]),Y=k.useCallback(async()=>{for(const[,L]of x)if((L.status==="running"||L.status==="awaiting_input")&&L.jobId)try{await Ce.abortJob(L.jobId)}catch{}},[x]);k.useEffect(()=>{const L=setInterval(()=>{j(Math.floor((Date.now()-I.current)/1e3))},1e3);return()=>clearInterval(L)},[]),k.useEffect(()=>{M.current&&(M.current.scrollTop=M.current.scrollHeight)},[f,x]),k.useEffect(()=>{b&&!W.current&&(W.current=!0,d==null||d())},[b,d]);const B=L=>`${Math.floor(L/60)}:${String(L%60).padStart(2,"0")}`,V=f?x.get(f):null,ne=f?mC[f]??"#888":"#888",G=L=>{C(Z=>{const de=new Set(Z);return de.has(L)?de.delete(L):de.add(L),de})};return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:b?c:void 0}),s.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[960px] max-w-[95vw] h-[85vh] z-[61] bg-[var(--terminal-bg)] rounded-2xl shadow-2xl overflow-hidden flex flex-col",children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-[var(--terminal-border)] shrink-0",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-3 h-3 rounded-full",style:{background:b?"#2E7D32":"#B71C1C",animation:b?void 0:"wave-pulse 2s ease-in-out infinite"}}),s.jsx("div",{children:s.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-sm",children:b?"WAVE COMPLETE":"WAVE COMMAND CENTER"})})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs font-mono",children:B(S)}),y.awaitingInput>0&&s.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full font-semibold",style:{background:"#F59E0B22",color:"#F59E0B"},children:[y.awaitingInput," awaiting reply"]}),s.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full font-semibold",style:{background:b?"#2E7D3222":"#B71C1C22",color:b?"#2E7D32":"#B71C1C"},children:[y.done,"/",y.total," done"]}),!b&&(y.running>0||y.awaitingInput>0)&&s.jsx("button",{onClick:Y,className:"text-xs px-2 py-0.5 rounded font-semibold cursor-pointer",style:{background:"#C6282822",color:"#C62828",border:"1px solid #C6282844"},title:"Stop all running jobs",children:"Stop All"}),s.jsx("button",{onClick:u,title:"Minimize",className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-sm cursor-pointer px-1",children:"–"}),b&&s.jsx("button",{onClick:c,className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-lg cursor-pointer",children:"×"})]})]}),s.jsx("div",{className:"px-5 py-2 border-b border-[var(--terminal-border)] shrink-0",children:s.jsxs("span",{className:"text-[var(--terminal-text-secondary)] text-xs italic",children:["“",t,"”"]})}),s.jsxs("div",{className:"flex flex-1 min-h-0",children:[s.jsxs("div",{className:"w-[280px] shrink-0 border-r border-[var(--terminal-border)] flex flex-col",children:[s.jsx("div",{className:"px-3 py-2 border-b border-[var(--terminal-border)]",children:s.jsx("span",{className:"text-[10px] font-bold text-[var(--terminal-text-secondary)] uppercase tracking-wider",children:"Org Propagation"})}),s.jsx("div",{className:"flex-1 overflow-auto p-3",children:s.jsx(hC,{nodes:x,rootId:i,selectedRoleId:f,onSelectNode:g})}),s.jsx("div",{className:"px-3 py-2 border-t border-[var(--terminal-border)] flex flex-wrap gap-x-3 gap-y-1",children:[{label:"running",color:"#FBBF24",dot:!0},{label:"awaiting",color:"#F59E0B",dot:!0},{label:"done",color:"#2E7D32",dot:!1},{label:"waiting",color:"#888",dot:!1},{label:"error",color:"#C62828",dot:!1}].map(L=>s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"w-2 h-2 rounded-full inline-block",style:{background:L.color,animation:L.dot?"wave-pulse 1.5s ease-in-out infinite":void 0}}),s.jsx("span",{className:"text-[8px] text-[var(--terminal-text-muted)]",children:L.label})]},L.label))})]}),s.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[V&&s.jsxs("div",{className:"px-4 py-2 border-b border-[var(--terminal-border)] shrink-0 flex items-center gap-2",children:[s.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:ne}}),s.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-xs",children:V.roleId.toUpperCase()}),s.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs",children:V.roleName}),s.jsx("span",{className:"ml-auto text-[10px] px-2 py-0.5 rounded-full font-semibold",style:{background:V.status==="awaiting_input"?"#F59E0B22":`${ne}22`,color:V.status==="awaiting_input"?"#F59E0B":ne},children:V.status==="running"?"Working":V.status==="done"?"Complete":V.status==="error"?"Error":V.status==="waiting"?"Waiting":V.status==="awaiting_input"?"Awaiting Reply":"Not dispatched"}),(V.status==="running"||V.status==="awaiting_input")&&V.jobId&&s.jsx("button",{onClick:()=>D(V.roleId),className:"text-[10px] px-2 py-0.5 rounded font-semibold cursor-pointer ml-1",style:{background:"#C6282822",color:"#C62828",border:"1px solid #C6282844"},title:"Force stop this job",children:"Stop"})]}),s.jsxs("div",{ref:M,className:"flex-1 overflow-y-auto p-4 space-y-1 text-xs font-mono",children:[V&&V.events.length===0&&s.jsx("div",{className:"text-[var(--terminal-text-muted)]",children:V.status==="waiting"?"Waiting for dispatch...":V.status==="running"?"Connecting to activity stream...":V.status==="not-dispatched"?"This role was not dispatched in this wave.":""}),V==null?void 0:V.events.map(L=>s.jsx(mg,{event:L,isThinkingCollapsed:E.has(L.seq),onToggleThinking:()=>G(L.seq),onNavigateToJob:Z=>{for(const[,de]of x)if(de.jobId===Z){g(de.roleId);return}},onOpenKnowledgeDoc:m},L.seq)),(V==null?void 0:V.status)==="running"&&s.jsx("span",{className:"inline-block w-2 h-4 bg-green-400 animate-pulse ml-0.5"})]}),(V==null?void 0:V.status)==="awaiting_input"&&s.jsxs("div",{className:"px-4 py-3 border-t border-[var(--terminal-border)] shrink-0",style:{background:"#F59E0B0A"},children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx("span",{className:"w-2 h-2 rounded-full inline-block",style:{background:"#F59E0B",animation:"wave-pulse 1.5s ease-in-out infinite"}}),s.jsxs("span",{className:"text-[11px] font-semibold",style:{color:"#F59E0B"},children:[V.roleName," is waiting for your response"]})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{type:"text",value:A,onChange:L=>F(L.target.value),onKeyDown:L=>{L.key==="Enter"&&!L.shiftKey&&(L.preventDefault(),te())},placeholder:"Type your response...",disabled:_,className:"flex-1 px-3 py-1.5 text-xs rounded border bg-[var(--terminal-bg)] text-[var(--terminal-text)] border-[var(--terminal-border)] outline-none focus:border-[#F59E0B]",autoFocus:!0}),s.jsx("button",{onClick:te,disabled:_||!A.trim(),className:"px-4 py-1.5 text-xs rounded font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#F59E0B",color:"#000"},children:_?"...":"Reply"})]})]}),!V&&s.jsx("div",{className:"flex-1 flex items-center justify-center text-[var(--terminal-text-muted)] text-xs",children:"Click a node in the org tree to view activity"}),s.jsxs("div",{className:"px-4 py-2 border-t border-[var(--terminal-border)] flex items-center justify-between shrink-0",children:[s.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:V&&V.events.length>0&&`${V.events.length} events`}),b&&s.jsx("button",{onClick:c,className:"px-4 py-1.5 text-xs text-white rounded-lg font-semibold cursor-pointer",style:{background:"#2E7D32"},children:"Close"})]})]})]})]})]})}const pC={cto:{skinColor:"#F5CBA7",hairColor:"#2C1810",shirtColor:"#1565C0",pantsColor:"#37474F",shoeColor:"#212121",hairStyle:"short",outfitStyle:"tshirt",accessory:"glasses"},cbo:{skinColor:"#FDEBD0",hairColor:"#1A0A00",shirtColor:"#E65100",pantsColor:"#37474F",shoeColor:"#1A1A1A",hairStyle:"slicked",outfitStyle:"suit",accessory:"lapels"},pm:{skinColor:"#FDEBD0",hairColor:"#6D4C41",shirtColor:"#2E7D32",pantsColor:"#37474F",shoeColor:"#212121",hairStyle:"bun",outfitStyle:"tshirt",accessory:"blush"},engineer:{skinColor:"#F5CBA7",hairColor:"#1A1A1A",shirtColor:"#4A148C",pantsColor:"#37474F",shoeColor:"#7B1FA2",hairStyle:"messy",outfitStyle:"hoodie",accessory:"headphones"},designer:{skinColor:"#FDEBD0",hairColor:"#AD1457",shirtColor:"#AD1457",pantsColor:"#37474F",shoeColor:"#212121",hairStyle:"bob",outfitStyle:"tshirt",accessory:"beret"},qa:{skinColor:"#F5CBA7",hairColor:"#4E342E",shirtColor:"#00695C",pantsColor:"#37474F",shoeColor:"#212121",hairStyle:"short",outfitStyle:"tshirt",accessory:"badge"},"data-analyst":{skinColor:"#F5CBA7",hairColor:"#3E2723",shirtColor:"#0277BD",pantsColor:"#37474F",shoeColor:"#212121",hairStyle:"curly",outfitStyle:"vest",accessory:"none"}};function Th(t){return pC[t]??{skinColor:"#B0BEC5",hairColor:"#78909C",shirtColor:"#607D8B",pantsColor:"#455A64",shoeColor:"#37474F"}}const xg=["#FDEBD0","#F5CBA7","#D4A07A","#C68642","#8D5524","#5C3A1E","#F3D1C7","#E8BEAC","#B07D62","#704214"],pg=["#1A0A00","#2C1810","#4E342E","#6D4C41","#8D6E63","#D4A574","#F5E6CA","#FFD700","#B71C1C","#AD1457","#4A148C","#1A237E","#004D40","#1A1A1A","#78909C","#E0E0E0"],yg=["#1565C0","#E65100","#2E7D32","#4A148C","#AD1457","#00695C","#D32F2F","#F57F17","#1B5E20","#283593","#4E342E","#37474F","#880E4F","#00838F","#6A1B9A","#FF6F00"],gg=["#37474F","#1A237E","#3E2723","#263238","#1B5E20","#455A64","#212121","#4E342E","#0D47A1","#311B92"],bg=["#212121","#1A1A1A","#37474F","#4E342E","#7B1FA2","#D32F2F","#1565C0","#F57F17","#2E7D32","#FFFFFF"],Gr={default:{name:"MIDNIGHT",icon:"🌃",vars:{"--floor-light":"#0d1117","--floor-dark":"#0a0e14","--hud-bg":"#0d1117","--hud-bg-alt":"#161b22","--pixel-border":"#30363d","--terminal-bg":"#0d1117","--terminal-border":"#21262d","--terminal-border-hover":"#388bfd","--terminal-text":"#e6edf3","--terminal-text-secondary":"#8b949e","--terminal-text-muted":"#484f58","--accent":"#388bfd","--active-green":"#3fb950","--idle-amber":"#d29922"}},light:{name:"DAYLIGHT",icon:"☀️",vars:{"--floor-light":"#f6f8fa","--floor-dark":"#eaeef2","--hud-bg":"#24292f","--hud-bg-alt":"#32383f","--pixel-border":"#d0d7de","--terminal-bg":"#ffffff","--terminal-border":"#d0d7de","--terminal-border-hover":"#0969da","--terminal-text":"#1f2328","--terminal-text-secondary":"#656d76","--terminal-text-muted":"#8c959f","--accent":"#0969da","--active-green":"#1a7f37","--idle-amber":"#9a6700"}},retro:{name:"RETRO",icon:"🎮",vars:{"--floor-light":"#1a1410","--floor-dark":"#140f0a","--hud-bg":"#1a1410","--hud-bg-alt":"#2a2018","--pixel-border":"#5c4a32","--terminal-bg":"#1a1410","--terminal-border":"#3a2e20","--terminal-border-hover":"#d4a44e","--terminal-text":"#e8d5b0","--terminal-text-secondary":"#a08860","--terminal-text-muted":"#6b5840","--accent":"#d4a44e","--active-green":"#8bba4a","--idle-amber":"#e8a030"}},cyberpunk:{name:"NEON",icon:"🌌",vars:{"--floor-light":"#0a0014","--floor-dark":"#06000e","--hud-bg":"#0a0014","--hud-bg-alt":"#14002a","--pixel-border":"#4a1a80","--terminal-bg":"#0a0014","--terminal-border":"#2a0a50","--terminal-border-hover":"#e040fb","--terminal-text":"#e0d0ff","--terminal-text-secondary":"#9070c0","--terminal-text-muted":"#5a3a80","--accent":"#e040fb","--active-green":"#00ff88","--idle-amber":"#ffab00"}},forest:{name:"FOREST",icon:"🌲",vars:{"--floor-light":"#0a1410","--floor-dark":"#060e0a","--hud-bg":"#0a1410","--hud-bg-alt":"#142a1e","--pixel-border":"#2a5a3a","--terminal-bg":"#0a1410","--terminal-border":"#1a3a26","--terminal-border-hover":"#4ade80","--terminal-text":"#d0f0d8","--terminal-text-secondary":"#70a880","--terminal-text-muted":"#3a6848","--accent":"#4ade80","--active-green":"#86efac","--idle-amber":"#fcd34d"}},ocean:{name:"OCEAN",icon:"🌊",vars:{"--floor-light":"#0a1420","--floor-dark":"#060e18","--hud-bg":"#0a1420","--hud-bg-alt":"#142a40","--pixel-border":"#1e4a6a","--terminal-bg":"#0a1420","--terminal-border":"#163050","--terminal-border-hover":"#38bdf8","--terminal-text":"#d0e8f8","--terminal-text-secondary":"#6090b0","--terminal-text-muted":"#305070","--accent":"#38bdf8","--active-green":"#34d399","--idle-amber":"#fbbf24"}}};function yC({color:t,selected:l,onClick:r}){return s.jsx("button",{onClick:r,className:"customize-swatch",style:{background:t,outline:l?"2px solid #fff":"2px solid transparent",boxShadow:l?`0 0 0 1px ${t}, 0 0 6px ${t}88`:"none"}})}function ks({label:t,presets:l,value:r,onChange:i}){return s.jsxs("div",{className:"customize-row",children:[s.jsxs("div",{className:"customize-row-header",children:[s.jsx("span",{className:"customize-row-label",children:t}),s.jsx("div",{className:"customize-row-current",style:{background:r}})]}),s.jsx("div",{className:"customize-swatches",children:l.map(c=>s.jsx(yC,{color:c,selected:c===r,onClick:()=>i(c)},c))})]})}function kf({label:t,items:l,value:r,onChange:i,lockInfo:c}){return s.jsxs("div",{className:"customize-row",children:[s.jsx("div",{className:"customize-row-header",children:s.jsx("span",{className:"customize-row-label",children:t})}),s.jsx("div",{className:"customize-swatches",style:{gap:4},children:l.map(u=>{const d=c?c.getLockLevel(u.id):1,m=u.id===r,x=c?d>c.roleLevel&&!m:!1,f=c?m&&d>c.roleLevel:!1;return s.jsxs("button",{onClick:()=>{x||i(u.id===r?void 0:u.id)},className:"customize-swatch",style:{width:"auto",height:"auto",padding:x?"2px 6px 10px 6px":"2px 6px",fontSize:9,fontFamily:"var(--font-pixel, monospace)",background:m?"rgba(255,255,255,0.15)":x?"rgba(255,255,255,0.02)":"rgba(255,255,255,0.04)",outline:m?f?"2px solid #F59E0B":"2px solid #fff":"2px solid transparent",color:x?"rgba(255,255,255,0.25)":m?"#fff":"rgba(255,255,255,0.5)",borderRadius:4,cursor:x?"not-allowed":"pointer",opacity:x?.35:1,position:"relative"},children:[u.name,x&&s.jsxs("span",{style:{position:"absolute",bottom:1,left:"50%",transform:"translateX(-50%)",fontSize:8,color:"rgba(255,255,255,0.5)",whiteSpace:"nowrap"},children:["🔒"," Lv.",d]}),f&&s.jsxs("span",{style:{position:"absolute",bottom:-8,left:"50%",transform:"translateX(-50%)",fontSize:7,color:"#F59E0B",whiteSpace:"nowrap"},children:["⚠"," Lv.",d]})]},u.id)})})]})}function jf({label:t,active:l,onClick:r}){return s.jsx("button",{onClick:r,style:{flex:1,padding:"6px 0",fontSize:10,fontFamily:"var(--font-pixel, monospace)",fontWeight:"bold",letterSpacing:1,background:l?"rgba(255,255,255,0.08)":"transparent",color:l?"#fff":"rgba(255,255,255,0.35)",border:"none",borderBottom:l?"2px solid #3B82F6":"2px solid transparent",cursor:"pointer",transition:"all 0.15s"},children:t})}function Ir(t){return t[Math.floor(Math.random()*t.length)]}function fi(t){var c,u,d;const l=ng(),r=lg(),i=rg().filter(m=>!t||ig(m.id,t));return{skinColor:Ir(xg),hairColor:Ir(pg),shirtColor:Ir(yg),pantsColor:Ir(gg),shoeColor:Ir(bg),hairStyle:(c=Ir(l))==null?void 0:c.id,outfitStyle:(u=Ir(r))==null?void 0:u.id,accessory:(d=Ir(i))==null?void 0:d.id}}function vg({roleId:t,appearance:l,onChange:r,onRandomize:i,onReset:c,label:u,roleLevel:d}){const[m,x]=k.useState("look"),f=k.useCallback((E,C)=>{r({...l,[E]:C})},[l,r]),g=k.useRef(null),y=k.useCallback(E=>{var F;const C=(F=E.target.files)==null?void 0:F[0];if(!C)return;const A=new Image;A.onload=()=>{const _=Hj(A);r({..._,hairStyle:l.hairStyle,outfitStyle:l.outfitStyle,accessory:l.accessory}),URL.revokeObjectURL(A.src)},A.src=URL.createObjectURL(C),E.target.value=""},[l.hairStyle,l.outfitStyle,l.accessory,r]),b=ng(),v=lg(),S=rg(),j=d!==void 0?S.filter(E=>ig(E.id,d)).length:S.length;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"customize-preview",children:[s.jsx("div",{className:"customize-preview-bg",children:s.jsx(_s,{roleId:t,appearance:l,scale:12})}),u&&s.jsx("div",{className:"customize-preview-name",children:u}),s.jsxs("div",{className:"customize-preview-actions",children:[s.jsx("button",{className:"customize-btn customize-btn--random",onClick:i,children:"RANDOM"}),s.jsx("button",{className:"customize-btn customize-btn--reset",onClick:c,children:"RESET"}),s.jsx("button",{className:"customize-btn",onClick:()=>{var E;return(E=g.current)==null?void 0:E.click()},style:{fontSize:9,opacity:.7},children:"PHOTO"}),s.jsx("input",{ref:g,type:"file",accept:"image/*",onChange:y,style:{display:"none"}})]})]}),s.jsxs("div",{className:"customize-colors",children:[s.jsxs("div",{style:{display:"flex",borderBottom:"1px solid rgba(255,255,255,0.06)",marginBottom:4},children:[s.jsx(jf,{label:"LOOK",active:m==="look",onClick:()=>x("look")}),s.jsx(jf,{label:"OUTFIT",active:m==="outfit",onClick:()=>x("outfit")}),s.jsx(jf,{label:"ACCESSORY",active:m==="accessory",onClick:()=>x("accessory")})]}),m==="look"&&s.jsxs(s.Fragment,{children:[s.jsx(ks,{label:"SKIN",presets:xg,value:l.skinColor,onChange:E=>f("skinColor",E)}),s.jsx(ks,{label:"HAIR COLOR",presets:pg,value:l.hairColor,onChange:E=>f("hairColor",E)}),s.jsx(kf,{label:"HAIR STYLE",items:b,value:l.hairStyle,onChange:E=>f("hairStyle",E)})]}),m==="outfit"&&s.jsxs(s.Fragment,{children:[s.jsx(kf,{label:"STYLE",items:v,value:l.outfitStyle,onChange:E=>f("outfitStyle",E)}),s.jsx(ks,{label:"TOP",presets:yg,value:l.shirtColor,onChange:E=>f("shirtColor",E)}),s.jsx(ks,{label:"PANTS",presets:gg,value:l.pantsColor,onChange:E=>f("pantsColor",E)}),s.jsx(ks,{label:"SHOES",presets:bg,value:l.shoeColor,onChange:E=>f("shoeColor",E)})]}),m==="accessory"&&s.jsxs(s.Fragment,{children:[d!==void 0&&s.jsxs("div",{style:{padding:"4px 8px",marginBottom:4,background:"rgba(255,255,255,0.04)",borderRadius:4,fontSize:9,fontFamily:"var(--font-pixel, monospace)",color:"rgba(255,255,255,0.5)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[s.jsxs("span",{children:["Lv.",d]}),s.jsxs("span",{children:[j,"/",S.length," unlocked"]})]}),s.jsx(kf,{label:"ACCESSORY",items:S,value:l.accessory,onChange:E=>f("accessory",E),lockInfo:d!==void 0?{roleLevel:d,getLockLevel:ag}:void 0}),s.jsx("div",{style:{marginTop:12,padding:"8px 10px",background:"rgba(255,255,255,0.03)",borderRadius:6,border:"1px dashed rgba(255,255,255,0.08)",color:"rgba(255,255,255,0.25)",fontSize:9,fontFamily:"var(--font-pixel, monospace)",textAlign:"center"},children:d!==void 0&&d<10?"Level up to unlock more accessories":"More accessories coming soon"})]})]})]})}const gC=[{value:"c-level",label:"C-Level"},{value:"team-lead",label:"Team Lead"},{value:"member",label:"Member"}];function Jf(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,24)}function Sf(t){switch(t){case"c-level":return{authority:{autonomous:["Strategic decisions within domain","Task delegation to reports"],needsApproval:["Budget over $5K","External commitments"]},knowledge:{reads:["company/","operations/","projects/"],writes:["operations/","knowledge/"]},reports:{daily:"standup",weekly:"summary"}};case"team-lead":return{authority:{autonomous:["Task planning","Sprint management"],needsApproval:["Architecture changes","New tool adoption"]},knowledge:{reads:["projects/","architecture/"],writes:["projects/"]},reports:{daily:"standup",weekly:"summary"}};default:return{authority:{autonomous:["Implementation within assigned tasks"],needsApproval:["Design changes","New dependencies"]},knowledge:{reads:["projects/"],writes:[]},reports:{daily:"standup",weekly:""}}}}const js=4;function bC(t,l,r){const i=t.trim();if(!i||i.startsWith("#"))return null;const c=i.split(",").map(y=>y.trim()),u=c[0];if(!u)return null;const d=Jf(u),m=(c[1]||"member").toLowerCase(),x=m==="c-level"?"c-level":m==="team-lead"?"team-lead":"member",f=c[2]||"ceo";let g;return l.has(d)?g="ID already exists":r.has(d)&&(g="Duplicate ID in batch"),r.add(d),{name:u,id:d,level:x,reportsTo:f,error:g}}function vC({existingRoles:t,onClose:l,onHire:r}){const[i,c]=k.useState("single"),[u,d]=k.useState(""),[m,x]=k.useState(null),[f,g]=k.useState(!1),[y,b]=k.useState(""),[v,S]=k.useState("input"),[j,E]=k.useState(""),[C,A]=k.useState(""),[F,_]=k.useState("ceo"),[H,M]=k.useState(1),[I,W]=k.useState(""),[te,D]=k.useState(""),[Y,B]=k.useState(!1),[V,ne]=k.useState("member"),[G,L]=k.useState("ceo"),[Z,de]=k.useState(""),[ue,z]=k.useState(fi),[R,K]=k.useState(!1),[T,fe]=k.useState(""),[Ee,Ne]=k.useState([]),[Le,Be]=k.useState(new Set),[Qe,Se]=k.useState(""),[tt,me]=k.useState("input"),[he,ge]=k.useState({done:0,total:0}),ke=k.useRef(null),Fe=k.useRef(null),Ae=k.useRef(null);k.useEffect(()=>{Ce.getSkills().then(q=>Ne(q.filter(ze=>ze.installed))).catch(()=>{})},[]),k.useEffect(()=>{var q,ze,He;i==="single"?(H===1&&((q=ke.current)==null||q.focus()),H===2&&((ze=Fe.current)==null||ze.focus())):tt==="input"&&((He=Ae.current)==null||He.focus())},[H,i,tt]);const De=k.useMemo(()=>new Set(t.map(q=>q.id)),[t]),je=k.useMemo(()=>{const q=Qe.split(`
|
|
82
82
|
`),ze=new Set;return q.map(He=>bC(He,De,ze)).filter(He=>He!==null)},[Qe,De]),_e=je.length>0&&je.every(q=>!q.error),Ke=q=>{W(q),Y||D(Jf(q))},Et=I.trim().length>0&&te.trim().length>0&&!t.some(q=>q.id===te),Ht=Z.trim().length>0,gt=async()=>{K(!0),fe("");const q=Sf(V);try{await r({id:te,name:I.trim(),level:V,reportsTo:G,persona:Z.trim(),...q,skills:Le.size>0?[...Le]:void 0},ue),l()}catch(ze){fe(ze instanceof Error?ze.message:"Failed to create role"),K(!1)}},Rt=q=>q===1?Et:q===2?Ht:!0,re=async()=>{K(!0),fe(""),ge({done:0,total:je.length});try{for(let q=0;q<je.length;q++){const ze=je[q],He=Sf(ze.level),Xe=fi(),ht=`${ze.name}. A ${ze.level} role reporting to ${ze.reportsTo}.`;await r({id:ze.id,name:ze.name,level:ze.level,reportsTo:ze.reportsTo,persona:ht,...He},Xe),ge({done:q+1,total:je.length})}l()}catch(q){fe(q instanceof Error?q.message:"Failed to create roles"),K(!1)}},pe=async()=>{g(!0),b("");try{const q=u.replace(/^tycono:/,"").trim();if(!q){b("Please enter a character ID"),g(!1);return}const ze=await mi.getCharacter(q);x(ze),E(ze.name||""),A(Jf(ze.name||q)),S("review")}catch{b("Character not found. Check the ID and try again.")}finally{g(!1)}},Te=async()=>{if(!m)return;K(!0),fe("");const q=m,ze=q.level==="c-level"||q.level==="team-lead"?q.level:"member",He=Sf(ze),Xe=q.skills!=null&&typeof q.skills=="object"&&!Array.isArray(q.skills)&&"primary"in q.skills;try{await r({id:C,name:j.trim(),level:ze,reportsTo:F,persona:q.persona||`${j}. Imported from Tycono Store.`,authority:q.authority||He.authority,knowledge:He.knowledge,reports:He.reports,source:{id:`tycono/${q.id}`,sync:"manual",forked_at:"1.0.0",upstream_version:"1.0.0"},skillContent:Xe?q.skills:void 0},q.appearance?q.appearance:fi()),l()}catch(ht){fe(ht instanceof Error?ht.message:"Failed to hire"),K(!1)}},Ye=q=>{q.key==="Escape"&&l(),q.key==="Enter"&&(q.metaKey||q.ctrlKey)&&(i==="single"?H<js&&Rt(H)?M(H+1):H===js&>():i==="bulk"?tt==="input"&&_e?me("review"):tt==="review"&&re():i==="store"&&(v==="input"&&u.trim()?pe():v==="review"&&Te()))},xe=t.some(q=>q.id===te)&&te.length>0;return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:l}),s.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[560px] max-h-[90vh] z-[61] bg-[var(--wall)] rounded-2xl shadow-2xl overflow-hidden flex flex-col",onKeyDown:Ye,children:[s.jsxs("div",{className:"p-5 text-white",style:{background:"linear-gradient(135deg, #2E7D32, #43A047)"},children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{className:"text-lg font-bold",children:"Hire New Role"}),s.jsxs("div",{className:"flex bg-black/20 rounded-lg p-0.5",children:[s.jsx("button",{onClick:()=>{c("single"),fe("")},className:`px-3 py-1 text-xs font-semibold rounded-md cursor-pointer transition-colors ${i==="single"?"bg-white/20 text-white":"text-white/50 hover:text-white/70"}`,children:"Single"}),s.jsx("button",{onClick:()=>{c("bulk"),fe("")},className:`px-3 py-1 text-xs font-semibold rounded-md cursor-pointer transition-colors ${i==="bulk"?"bg-white/20 text-white":"text-white/50 hover:text-white/70"}`,children:"Bulk"}),s.jsx("button",{onClick:()=>{c("store"),fe("")},className:`px-3 py-1 text-xs font-semibold rounded-md cursor-pointer transition-colors ${i==="store"?"bg-white/20 text-white":"text-white/50 hover:text-white/70"}`,children:"Import"})]})]}),s.jsx("div",{className:"text-sm opacity-80 mt-0.5",children:i==="single"?`Step ${H} of ${js}`:i==="bulk"?tt==="input"?"Enter roles, one per line":`Review ${je.length} roles`:v==="input"?"Import from Tycono Store":"Review & customize"})]}),i==="single"&&s.jsx("div",{className:"flex gap-1 px-5 pt-4",children:Array.from({length:js},(q,ze)=>ze+1).map(q=>s.jsx("div",{className:"flex-1 h-1 rounded-full transition-colors",style:{background:q<=H?"#2E7D32":"rgba(255,255,255,0.1)"}},q))}),s.jsx("div",{className:"p-5 min-h-[240px] overflow-y-auto flex-1",children:i==="store"?s.jsxs(s.Fragment,{children:[v==="input"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Character ID"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{value:u,onChange:q=>d(q.target.value),placeholder:"tycono:engineer",className:"flex-1 p-2.5 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 placeholder-white/25 font-mono focus:outline-none focus:border-white/25 transition-colors",onKeyDown:q=>{q.key==="Enter"&&u.trim()&&pe()},autoFocus:!0}),s.jsx("button",{onClick:pe,disabled:!u.trim()||f,className:"px-4 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#2E7D32"},children:f?"Fetching...":"Fetch"})]}),s.jsxs("div",{className:"text-[10px] text-gray-400 mt-1",children:["Copy a character ID from ",s.jsx("a",{href:"https://tycono.ai/store.html",target:"_blank",className:"text-green-400 hover:underline",children:"tycono.ai/store"})," and paste it here"]})]}),y&&s.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 p-2 rounded-lg border border-red-800/30",children:y})]}),v==="review"&&m&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"bg-white/5 rounded-xl p-4 border border-white/10",children:[s.jsxs("div",{className:"flex gap-4",children:[m.appearance&&s.jsx("div",{className:"flex-shrink-0 rounded-lg overflow-hidden",style:{background:"#0d1117",padding:8},children:s.jsx(_s,{roleId:"store-preview",appearance:m.appearance,scale:4})}),s.jsxs("div",{className:"flex-1 space-y-2.5",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] text-white/30 uppercase tracking-wider mb-0.5",children:"Name"}),s.jsx("input",{value:j,onChange:q=>E(q.target.value),className:"w-full p-2 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 focus:outline-none focus:border-white/25 transition-colors"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] text-white/30 uppercase tracking-wider mb-0.5",children:"Role ID"}),s.jsx("input",{value:C,onChange:q=>A(q.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"")),className:"w-full p-2 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 font-mono focus:outline-none focus:border-white/25 transition-colors"}),t.some(q=>q.id===C)&&C.length>0&&s.jsx("div",{className:"text-xs text-red-500 mt-1",children:"ID already exists"})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx("label",{className:"block text-[10px] text-white/30 uppercase tracking-wider mb-0.5",children:"Level"}),s.jsx("div",{className:"text-sm text-white/70 p-2 rounded-lg bg-white/5 border border-white/10",children:m.level==="c-level"?"C-Level":m.level==="team-lead"?"Lead":"Member"})]}),s.jsxs("div",{className:"flex-1",children:[s.jsx("label",{className:"block text-[10px] text-white/30 uppercase tracking-wider mb-0.5",children:"Reports To"}),s.jsxs("select",{value:F,onChange:q=>_(q.target.value),className:"w-full p-2 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 focus:outline-none focus:border-white/25 transition-colors",children:[s.jsx("option",{value:"ceo",className:"bg-[var(--wall)] text-white",children:"CEO"}),t.map(q=>s.jsxs("option",{value:q.id,className:"bg-[var(--wall)] text-white",children:[q.name," (",q.id,")"]},q.id))]})]})]})]})]}),m.persona&&s.jsxs("div",{className:"pt-3 mt-3 border-t border-white/10",children:[s.jsx("div",{className:"text-[10px] text-white/30 uppercase tracking-wider mb-1",children:"Persona"}),s.jsx("div",{className:"text-xs text-white/60 leading-relaxed line-clamp-3",children:m.persona})]}),m.skills&&s.jsxs("div",{className:"pt-3 mt-3 border-t border-white/10",children:[s.jsx("div",{className:"text-[10px] text-white/30 uppercase tracking-wider mb-1",children:"Skills"}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:(()=>{var Xe,ht;const q=m.skills;if(q&&typeof q=="object"&&!Array.isArray(q)&&"primary"in q){const Pe=[];return(ht=(Xe=q.primary)==null?void 0:Xe.frontmatter)!=null&&ht.name&&Pe.push(q.primary.frontmatter.name),q.shared&&q.shared.forEach(We=>{var un;return Pe.push(((un=We.frontmatter)==null?void 0:un.name)||We.id)}),Pe.map(We=>s.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-mono bg-green-900/20 border border-green-800/30 text-green-400",children:We},We))}return(Array.isArray(q)?q:[]).map((Pe,We)=>s.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-mono bg-green-900/20 border border-green-800/30 text-green-400",children:typeof Pe=="string"?Pe:Pe.name},We))})()})]})]}),T&&s.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 p-2 rounded-lg border border-red-800/30",children:T})]})]}):i==="single"?s.jsxs(s.Fragment,{children:[H===1&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Role Name"}),s.jsx("input",{ref:ke,value:I,onChange:q=>Ke(q.target.value),placeholder:"e.g. Data Analyst",className:"w-full p-2.5 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 placeholder-white/25 focus:outline-none focus:border-white/25 transition-colors"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Role ID (slug)"}),s.jsx("input",{value:te,onChange:q=>{D(q.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"")),B(!0)},className:`w-full p-2.5 rounded-lg border bg-white/5 text-sm text-white/90 font-mono focus:outline-none transition-colors ${xe?"border-red-400":"border-white/10 focus:border-white/25"}`}),xe&&s.jsx("div",{className:"text-xs text-red-500 mt-1",children:"ID already exists"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Level"}),s.jsx("div",{className:"flex gap-2",children:gC.map(q=>s.jsx("button",{onClick:()=>ne(q.value),className:`flex-1 p-2 text-xs font-semibold rounded-lg border cursor-pointer transition-colors ${V===q.value?"border-green-600 bg-green-900/30 text-green-400":"border-white/10 text-white/50 hover:border-white/20"}`,children:q.label},q.value))})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Reports To"}),s.jsxs("select",{value:G,onChange:q=>L(q.target.value),className:"w-full p-2.5 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 focus:outline-none focus:border-white/25 transition-colors",children:[s.jsx("option",{value:"ceo",className:"bg-[var(--wall)] text-white",children:"CEO"}),t.map(q=>s.jsxs("option",{value:q.id,className:"bg-[var(--wall)] text-white",children:[q.name," (",q.id,")"]},q.id))]})]})]}),H===2&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Persona"}),s.jsx("textarea",{ref:Fe,value:Z,onChange:q=>de(q.target.value),placeholder:"Describe this role's personality, expertise, and working style...",className:"w-full h-32 p-3 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 placeholder-white/25 resize-none focus:outline-none focus:border-white/25 transition-colors"}),s.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"This defines how the AI agent will behave in this role"})]}),Ee.length>0&&s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Skills"}),s.jsx("div",{className:"space-y-1.5 max-h-[120px] overflow-y-auto",children:Ee.map(q=>s.jsxs("label",{className:"flex items-center gap-2 p-2 rounded-lg border border-white/10 bg-white/5 cursor-pointer hover:border-white/20 transition-colors",children:[s.jsx("input",{type:"checkbox",checked:Le.has(q.id),onChange:()=>Be(ze=>{const He=new Set(ze);return He.has(q.id)?He.delete(q.id):He.add(q.id),He}),className:"accent-green-600"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"text-xs font-semibold text-white/80",children:q.name}),s.jsx("div",{className:"text-[10px] text-white/40 truncate",children:q.description})]})]},q.id))})]})]}),H===3&&s.jsx("div",{className:"customize-body",style:{padding:0},children:s.jsx(vg,{roleId:"default",appearance:ue,onChange:z,onRandomize:()=>z(fi()),onReset:()=>z(fi()),label:s.jsxs("span",{children:[te||"new-role"," — ",I||"New Role"]})})}),H===4&&s.jsxs("div",{className:"space-y-3",children:[s.jsx("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Review"}),s.jsxs("div",{className:"bg-white/5 rounded-xl p-4 border border-white/10",children:[s.jsxs("div",{className:"flex gap-4",children:[s.jsx("div",{className:"flex-shrink-0 rounded-lg overflow-hidden",style:{background:"#0d1117",padding:8},children:s.jsx(_s,{roleId:"default",appearance:ue,scale:4})}),s.jsxs("div",{className:"flex-1 space-y-2.5",children:[s.jsx(Ss,{label:"Name",value:I}),s.jsx(Ss,{label:"ID",value:te,mono:!0}),s.jsx(Ss,{label:"Level",value:V}),s.jsx(Ss,{label:"Reports To",value:G}),Le.size>0&&s.jsx(Ss,{label:"Skills",value:[...Le].join(", ")})]})]}),s.jsxs("div",{className:"pt-3 mt-3 border-t border-white/10",children:[s.jsx("div",{className:"text-[10px] text-white/30 uppercase tracking-wider mb-1",children:"Persona"}),s.jsx("div",{className:"text-xs text-white/60 leading-relaxed",children:Z})]})]}),T&&s.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 p-2 rounded-lg border border-red-800/30",children:T})]})]}):s.jsxs(s.Fragment,{children:[tt==="input"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Roles (one per line)"}),s.jsx("textarea",{ref:Ae,value:Qe,onChange:q=>Se(q.target.value),placeholder:`Name, Level, ReportsTo
|
|
83
83
|
e.g.
|
|
84
84
|
Data Analyst
|
|
85
85
|
DevOps Engineer, member, cto
|
|
86
|
-
VP Marketing, c-level, ceo`,className:"w-full h-40 p-3 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 placeholder-white/25 resize-none focus:outline-none focus:border-white/25 transition-colors font-mono"}),s.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"Format: Name, Level (member/team-lead/c-level), ReportsTo. Level and ReportsTo are optional."})]}),je.length>0&&s.jsxs("div",{children:[s.jsxs("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:["Preview (",je.length," role",je.length!==1?"s":"",")"]}),s.jsx("div",{className:"bg-white/5 rounded-lg border border-white/10 overflow-hidden",children:s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-white/10",children:[s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Name"}),s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"ID"}),s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Level"}),s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Reports To"})]})}),s.jsx("tbody",{children:je.map((q,ze)=>s.jsxs("tr",{className:`border-b border-white/5 ${q.error?"bg-red-900/10":""}`,children:[s.jsx("td",{className:"p-2 text-white/80",children:q.name}),s.jsx("td",{className:"p-2 text-white/60 font-mono",children:q.id}),s.jsx("td",{className:"p-2 text-white/60",children:q.level}),s.jsx("td",{className:"p-2 text-white/60",children:q.reportsTo}),q.error&&s.jsx("td",{className:"p-2 text-red-400 text-[10px]",children:q.error})]},ze))})]})})]})]}),tt==="review"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:["Confirm Bulk Hire — ",je.length," roles"]}),s.jsx("div",{className:"bg-white/5 rounded-lg border border-white/10 overflow-hidden max-h-[300px] overflow-y-auto",children:s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{className:"sticky top-0 bg-[var(--wall)]",children:s.jsxs("tr",{className:"border-b border-white/10",children:[s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"#"}),s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Name"}),s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"ID"}),s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Level"}),s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Reports To"})]})}),s.jsx("tbody",{children:je.map((q,ze)=>s.jsxs("tr",{className:"border-b border-white/5",children:[s.jsx("td",{className:"p-2 text-white/30",children:ze+1}),s.jsx("td",{className:"p-2 text-white/80",children:q.name}),s.jsx("td",{className:"p-2 text-white/60 font-mono",children:q.id}),s.jsx("td",{className:"p-2 text-white/60",children:q.level}),s.jsx("td",{className:"p-2 text-white/60",children:q.reportsTo})]},ze))})]})}),R&&he.total>0&&s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between text-[10px] text-white/40 mb-1",children:[s.jsx("span",{children:"Hiring..."}),s.jsxs("span",{children:[he.done,"/",he.total]})]}),s.jsx("div",{className:"h-1.5 bg-white/10 rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${he.done/he.total*100}%`,background:"#2E7D32"}})})]}),s.jsx("div",{className:"text-[10px] text-white/30",children:"Each role will get a random appearance and auto-generated persona. You can customize them later."}),T&&s.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 p-2 rounded-lg border border-red-800/30",children:T})]})]})}),s.jsxs("div",{className:"flex justify-between px-5 pb-5",children:[s.jsxs("div",{children:[i==="single"&&H>1&&s.jsx("button",{onClick:()=>M(H-1),className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer",children:"Back"}),i==="bulk"&&tt==="review"&&s.jsx("button",{onClick:()=>me("input"),disabled:R,className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer disabled:opacity-40",children:"Back"}),i==="store"&&v==="review"&&s.jsx("button",{onClick:()=>{S("input"),x(null),fe("")},disabled:R,className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer disabled:opacity-40",children:"Back"})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsx("button",{onClick:l,className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer",children:"Cancel"}),i==="single"?H<js?s.jsx("button",{onClick:()=>M(H+1),disabled:!Rt(H),className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#2E7D32"},children:"Next"}):s.jsx("button",{onClick:gt,disabled:R,className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#2E7D32"},children:R?"Hiring...":"HIRE"}):i==="bulk"?tt==="input"?s.jsxs("button",{onClick:()=>me("review"),disabled:!_e,className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#2E7D32"},children:["Review (",je.length,")"]}):s.jsx("button",{onClick:re,disabled:R,className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#2E7D32"},children:R?`Hiring ${he.done}/${he.total}...`:`HIRE ALL (${je.length})`}):v==="review"?s.jsx("button",{onClick:Te,disabled:R||!j.trim()||!C.trim()||t.some(q=>q.id===C),className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#2E7D32"},children:R?"Hiring...":"HIRE"}):null]})]})]})]})}function Ss({label:t,value:l,mono:r}){return s.jsxs("div",{className:"flex justify-between text-sm",children:[s.jsx("span",{className:"text-white/40",children:t}),s.jsx("span",{className:`font-semibold text-white/80 ${r?"font-mono":""}`,children:l})]})}function wC({roleId:t,roleName:l,onClose:r,onConfirm:i}){const[c,u]=k.useState(!1),d=async()=>{u(!0);try{await i(t)}finally{u(!1)}};return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:r}),s.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[480px] z-[61] bg-[var(--wall)] rounded-2xl shadow-2xl overflow-hidden",children:[s.jsxs("div",{className:"p-5 text-white",style:{background:"linear-gradient(135deg, #B71C1C, #D32F2F)"},children:[s.jsx("div",{className:"text-lg font-bold",children:"Fire Role"}),s.jsxs("div",{className:"text-sm opacity-80 mt-0.5",children:["Remove ",l," (",t,")"]})]}),s.jsxs("div",{className:"p-5",children:[s.jsxs("div",{className:"p-4 rounded-lg border-2 border-red-300 bg-red-50 mb-4",children:[s.jsx("div",{className:"text-sm font-bold text-red-800 mb-1",children:"Warning"}),s.jsxs("div",{className:"text-xs text-red-700 leading-relaxed",children:["This will permanently delete the role directory including",s.jsx("strong",{children:" role.yaml"}),", ",s.jsx("strong",{children:"profile.md"}),", ",s.jsx("strong",{children:"SKILL.md"}),", and all journal entries. This action cannot be undone."]})]}),s.jsxs("div",{className:"text-sm text-gray-600",children:["Are you sure you want to fire ",s.jsx("strong",{children:l}),"?"]})]}),s.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[s.jsx("button",{onClick:r,className:"px-4 py-2 text-sm rounded-lg border border-gray-300 hover:bg-gray-50 cursor-pointer",children:"Cancel"}),s.jsx("button",{onClick:d,disabled:c,className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#B71C1C"},children:c?"Removing...":"Confirm Fire"})]})]})]})}const kC={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"};function jC({roleId:t,title:l,roleColor:r,active:i,onClick:c,onClose:u,"data-session-id":d}){return s.jsxs("button",{onClick:c,"data-session-id":d,className:`flex items-center gap-1.5 px-3 py-1.5 text-[11px] rounded-t-lg shrink-0 cursor-pointer transition-colors max-w-[180px] group ${i?"bg-[var(--terminal-bg)] text-[var(--terminal-text)]":"bg-[var(--terminal-inline-bg)] text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)] hover:bg-[var(--terminal-surface)]"}`,style:i?{borderTop:`2px solid ${r}`}:void 0,children:[s.jsx("span",{className:"text-xs",children:kC[t]??"👤"}),s.jsx("span",{className:"truncate",children:l}),s.jsx("span",{onClick:u,className:"ml-auto text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-sm leading-none",children:"×"})]})}function SC({content:t,streaming:l}){let r=t;return l&&(t.match(/```/g)??[]).length%2!==0&&(r+="\n```"),s.jsx("div",{className:"terminal-markdown",children:s.jsx(
|
|
87
|
-
`)?s.jsx(EC,{language:i==null?void 0:i[1],children:l}):s.jsx("code",{className:"terminal-inline-code",...r,children:l})}function EC({children:t,language:l}){const[r,i]=k.useState(!1),c=String(t).replace(/\n$/,""),u=()=>{navigator.clipboard.writeText(c),i(!0),setTimeout(()=>i(!1),1500)};return s.jsxs("div",{className:"terminal-code-block group relative my-2",children:[l&&s.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] px-3 pt-1.5",children:l}),s.jsx("button",{onClick:u,className:"absolute top-1.5 right-2 text-[10px] text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",children:r?"Copied!":"Copy"}),s.jsx("pre",{className:"overflow-x-auto p-3 text-xs leading-relaxed",children:s.jsx("code",{children:c})})]})}const NC={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"};function Cf(t,l){return l?l.file_path?String(l.file_path).replace(/^.*\/(?=[^/]+\/)/,""):l.path?String(l.path).replace(/^.*\/(?=[^/]+\/)/,""):l.pattern?String(l.pattern):l.command?String(l.command).slice(0,60):l.query?String(l.query).slice(0,60):l.url?String(l.url).slice(0,60):"":""}function AC(t){const l=[];let r="";for(const i of t)if(i.type==="thinking")i.text&&(r=i.text),l.length===0||l[l.length-1].type!=="thinking"?l.push({type:"thinking",text:i.text}):l[l.length-1].text=i.text;else if(i.type==="tool")l.push({type:"tool",toolName:i.toolName,toolSummary:Cf(i.toolName??"",i.toolInput),toolInput:i.toolInput});else if(i.type==="dispatch")l.push({type:"dispatch",roleId:i.roleId,task:i.task});else if(i.type==="dispatch:progress"){const c=l.length>0?l[l.length-1]:null;(c==null?void 0:c.type)==="dispatch:progress"&&c.roleId===i.roleId?i.progressType==="tool"?(c.toolName=i.toolName,c.toolSummary=Cf(i.toolName??"",i.toolInput),c.progressType="tool"):i.progressType==="thinking"?(c.text=i.text,c.progressType="thinking"):i.progressType==="text"?(c.text=i.text,c.progressType="text"):(i.progressType==="done"||i.progressType==="error")&&(c.progressType=i.progressType):l.push({type:"dispatch:progress",roleId:i.roleId,progressType:i.progressType,text:i.text,toolName:i.toolName,toolSummary:i.toolName?Cf(i.toolName,i.toolInput):void 0})}if(r){const i=l.filter(c=>c.type==="thinking");i.length>0&&(i[i.length-1].text=r)}return l}function TC({event:t,isStreaming:l}){var c,u,d;const[r,i]=k.useState(!1);switch(t.type){case"thinking":return s.jsxs("div",{className:"stream-event-thinking",children:[s.jsxs("div",{className:"stream-event-thinking-header",onClick:()=>i(!r),children:[s.jsx("span",{className:"stream-event-thinking-icon"}),s.jsxs("span",{className:"stream-event-thinking-label",children:["thinking",l?"...":""]}),t.text&&!l&&s.jsx("span",{className:"stream-event-thinking-toggle",children:r?"▾":"▸"})]}),(l||r)&&t.text&&s.jsx("div",{className:"stream-event-thinking-content",children:t.text.slice(-500)})]});case"tool":return s.jsxs("div",{className:"stream-event-tool",children:[s.jsx("span",{className:"stream-event-tool-badge",children:t.toolName}),t.toolSummary&&s.jsx("span",{className:"stream-event-tool-path",children:t.toolSummary}),t.toolInput&&s.jsx("span",{className:"stream-event-tool-toggle",onClick:()=>i(!r),children:r?"▾":"▸"}),r&&t.toolInput&&s.jsx("div",{className:"stream-event-tool-detail",children:JSON.stringify(t.toolInput,null,1).slice(0,300)})]});case"dispatch":return s.jsxs("div",{className:"stream-event-dispatch",children:[s.jsxs("span",{className:"stream-event-dispatch-badge",children:["→"," ",(c=t.roleId)==null?void 0:c.toUpperCase()]}),s.jsx("span",{className:"stream-event-dispatch-task",children:(u=t.task)==null?void 0:u.slice(0,80)})]});case"dispatch:progress":return s.jsxs("div",{className:"stream-event-dispatch-progress",children:[s.jsx("span",{className:"stream-event-dispatch-progress-role",children:(d=t.roleId)==null?void 0:d.toUpperCase()}),t.progressType==="thinking"&&s.jsxs("span",{className:"stream-event-dispatch-progress-status",children:["thinking",l?"...":""]}),t.progressType==="tool"&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"stream-event-tool-badge",children:t.toolName}),t.toolSummary&&s.jsx("span",{className:"stream-event-tool-path",children:t.toolSummary})]}),t.progressType==="text"&&t.text&&s.jsx("span",{className:"stream-event-dispatch-progress-status",children:"responding..."}),t.progressType==="done"&&s.jsx("span",{className:"stream-event-dispatch-progress-done",children:"done"}),t.progressType==="error"&&s.jsx("span",{className:"stream-event-dispatch-progress-error",children:"error"})]});default:return null}}function DC({events:t,isStreaming:l}){const[r,i]=k.useState(!1);if(t.length===0)return null;const c=AC(t);if(c.length===0)return null;const u=t.filter(b=>b.type==="thinking").length,d=t.filter(b=>b.type==="tool"),m=t.filter(b=>b.type==="dispatch"||b.type==="dispatch:progress"),x=t.filter(b=>b.type==="turn").reduce((b,v)=>Math.max(b,v.turn??0),0),f=[];if(u>0&&f.push("thinking"),d.length>0){const b=[...new Set(d.map(v=>v.toolName))];b.length<=3?f.push(b.join(", ")):f.push(`${d.length} tool calls`)}m.length>0&&f.push(`${m.length} dispatch`),x>1&&f.push(`${x} turns`);const g=f.join(" · "),y=!r;return s.jsxs("div",{className:"stream-activity-log",children:[s.jsxs("div",{className:"stream-activity-header",onClick:()=>i(!r),children:[l&&s.jsx("span",{className:"stream-activity-pulse"}),s.jsxs("span",{className:"stream-activity-summary",children:[r?"▸":"▾"," ",g,l?"...":""]})]}),y&&s.jsx("div",{className:"stream-activity-events",children:c.map((b,v)=>s.jsx(TC,{event:b,isStreaming:l&&v===c.length-1},v))})]})}function zC({message:t,roleId:l,roleColor:r}){var f;const i=t.from==="ceo",c=t.type==="system",u=t.status==="streaming";if(c)return s.jsx("div",{className:"flex justify-center my-2",children:s.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] bg-[var(--terminal-inline-bg)] px-3 py-1 rounded-full",children:t.content})});if(i)return s.jsx("div",{className:"flex justify-end mb-3",children:s.jsxs("div",{className:"max-w-[85%]",children:[s.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] text-right mb-1",children:"CEO"}),s.jsxs("div",{className:"bg-[var(--terminal-surface-light)] rounded-xl rounded-tr-sm px-4 py-2.5 text-sm text-[var(--terminal-text)] leading-relaxed",children:[t.type==="directive"&&s.jsx("span",{className:"text-amber-400 text-[10px] font-bold mr-1.5",children:"DO"}),t.content]})]})});const d=(((f=t.streamEvents)==null?void 0:f.length)??0)>0,m=!!t.thinking,x=m&&!t.content&&u&&!d;return s.jsxs("div",{className:"flex gap-2.5 mb-3",children:[s.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center text-sm shrink-0 mt-5",style:{background:`${r}33`},children:NC[l]??"👤"}),s.jsxs("div",{className:"max-w-[85%] min-w-0",children:[s.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] mb-1",children:l.toUpperCase()}),d&&s.jsx(DC,{events:t.streamEvents,isStreaming:u}),m&&!d&&s.jsxs("details",{open:x,className:"mb-1",children:[s.jsxs("summary",{className:"text-[10px] text-purple-400/70 cursor-pointer select-none flex items-center gap-1",children:[x&&s.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-purple-400 animate-pulse"}),"thinking",x?"...":` (${t.thinking.length} chars)`]}),s.jsx("div",{className:"text-[11px] text-[var(--terminal-text-muted)] leading-relaxed mt-1 pl-2 border-l border-purple-400/20 max-h-32 overflow-y-auto",children:t.thinking.slice(-500)})]}),s.jsxs("div",{className:"rounded-xl rounded-tl-sm px-4 py-2.5 text-sm text-[var(--terminal-text)] leading-relaxed",style:{borderLeft:`3px solid ${r}`,background:"var(--terminal-surface)"},children:[t.content?s.jsx(SC,{content:t.content,streaming:u}):u&&!m?s.jsx("span",{className:"inline-block w-2 h-4 bg-[var(--terminal-text-secondary)] animate-pulse"}):u&&m?s.jsx("span",{className:"text-[11px] text-purple-400/50 italic",children:"analyzing..."}):null,u&&t.content&&s.jsx("span",{className:"inline-block w-1.5 h-3.5 bg-[var(--terminal-text-secondary)] animate-pulse ml-0.5 align-middle"})]}),t.status==="error"&&s.jsx("div",{className:"text-[10px] text-red-400 mt-1",children:"Error occurred"})]})]})}function MC({messages:t,roleId:l,roleColor:r}){var c;const i=k.useRef(null);return k.useEffect(()=>{var u;(u=i.current)==null||u.scrollIntoView({behavior:"smooth"})},[t,(c=t[t.length-1])==null?void 0:c.content]),t.length===0?s.jsxs("div",{className:"flex-1 flex items-center justify-center text-[var(--terminal-text-muted)] text-sm",children:["Start a conversation with ",l.toUpperCase()]}):s.jsxs("div",{className:"flex-1 overflow-y-auto p-4 terminal-scrollbar",children:[t.map(u=>s.jsx(zC,{message:u,roleId:l,roleColor:r},u.id)),s.jsx("div",{ref:i})]})}function FC({mode:t,onModeChange:l,onSend:r,disabled:i,disabledReason:c}){const[u,d]=k.useState(""),m=k.useRef(null);k.useEffect(()=>{const g=m.current;g&&(g.style.height="0",g.style.height=Math.min(g.scrollHeight,120)+"px")},[u]);const x=()=>{const g=u.trim();!g||i||(r(g),d(""))},f=g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),x())};return s.jsxs("div",{className:"border-t border-[var(--terminal-border)] p-3 shrink-0",children:[c&&s.jsx("div",{className:"text-[10px] text-amber-400/70 mb-2 text-center",children:c}),s.jsxs("div",{className:"flex items-end gap-2",children:[s.jsxs("div",{className:"flex rounded-lg overflow-hidden border border-[var(--terminal-border)] shrink-0",children:[s.jsx("button",{onClick:()=>l("talk"),className:`px-2.5 py-1.5 text-[11px] font-semibold cursor-pointer transition-colors ${t==="talk"?"bg-[var(--desk-wood)] text-white":"bg-[var(--terminal-inline-bg)] text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)]"}`,children:"Talk"}),s.jsx("button",{onClick:()=>l("do"),className:`px-2.5 py-1.5 text-[11px] font-semibold cursor-pointer transition-colors ${t==="do"?"bg-amber-700 text-white":"bg-[var(--terminal-inline-bg)] text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)]"}`,children:"Do"})]}),s.jsx("textarea",{ref:m,value:u,onChange:g=>d(g.target.value),onKeyDown:f,placeholder:i?"Waiting...":t==="talk"?"Ask something...":"Give a directive...",disabled:i,rows:1,className:"flex-1 bg-[var(--terminal-inline-bg)] border border-[var(--terminal-border)] rounded-lg px-3 py-2 text-sm text-[var(--terminal-text)] placeholder:text-[var(--terminal-text-muted)] resize-none focus:outline-none focus:border-[var(--terminal-border-hover)] disabled:opacity-40 terminal-scrollbar"}),s.jsx("button",{onClick:x,disabled:i||!u.trim(),className:"w-8 h-8 rounded-lg bg-[var(--terminal-surface-light)] text-[var(--terminal-text-secondary)] flex items-center justify-center shrink-0 cursor-pointer hover:bg-[var(--desk-wood)] hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M22 2L11 13"}),s.jsx("path",{d:"M22 2L15 22L11 13L2 9L22 2Z"})]})})]})]})}const RC={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},wg={cto:"CTO",cbo:"CBO",pm:"PM",engineer:"Engineer",designer:"Designer",qa:"QA","data-analyst":"Data Analyst"};function j0(t){return new Date(t).toLocaleTimeString("ko-KR",{hour:"2-digit",minute:"2-digit"})}function _C({msg:t}){const l=RC[t.roleId]??"#888",r=wg[t.roleId]??t.roleId;if(t.type==="dispatch"){const i=t.text.includes("WAVE"),c=t.text.includes("completed")||t.text.includes("완료"),u=i?"📡":c?"✓":"→",d=c?"text-green-400/70":"text-[var(--terminal-text-muted)]";return s.jsxs("div",{className:"flex items-start gap-2 px-3 py-1 hover:bg-white/[0.02]",children:[s.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)] shrink-0 w-10 text-right mt-0.5",children:j0(t.ts)}),s.jsx("span",{className:"text-[10px] shrink-0 mt-0.5",children:u}),s.jsx("span",{className:`text-[11px] ${d}`,children:t.text})]})}return s.jsxs("div",{className:"flex items-start gap-2 px-3 py-1.5 hover:bg-white/[0.02]",children:[s.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)] shrink-0 w-10 text-right mt-0.5",children:j0(t.ts)}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("span",{className:"text-[11px] font-semibold mr-1.5",style:{color:l},children:r}),s.jsx("span",{className:"text-xs text-[var(--terminal-text-secondary)]",children:t.text})]})]})}function OC({channel:t,allRoles:l,onUpdateMembers:r,onUpdateTopic:i}){const c=k.useRef(null),u=k.useRef(null);k.useEffect(()=>{var S;const b=u.current;if(!b)return;b.scrollHeight-b.scrollTop-b.clientHeight<80&&((S=c.current)==null||S.scrollIntoView({behavior:"smooth"}))},[t.messages.length]);const[d,m]=k.useState(!1),[x,f]=k.useState(!1),[g,y]=k.useState("");return s.jsxs("div",{ref:u,className:"flex-1 overflow-y-auto terminal-scrollbar py-2",children:[s.jsxs("div",{className:"px-3 py-2 mb-2 border-b border-[var(--terminal-border)] flex items-center gap-2",children:[s.jsx("span",{className:"text-sm font-semibold text-[var(--terminal-text)]",children:t.name}),t.members.length>0&&s.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:t.members.map(b=>wg[b]??b).join(", ")}),t.members.length===0&&s.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:t.isDefault?"system logs":"no members"}),!t.isDefault&&l&&r&&s.jsx("button",{className:"ml-auto text-[10px] px-2 py-0.5 rounded bg-white/5 hover:bg-white/10 text-[var(--terminal-text-muted)]",onClick:()=>m(!d),children:d?"Done":"Invite"})]}),!t.isDefault&&i&&s.jsx("div",{className:"px-3 pb-2 mb-1",children:x?s.jsx("input",{autoFocus:!0,value:g,onChange:b=>y(b.target.value),onKeyDown:b=>{b.key==="Enter"&&(i(t.id,g.trim()),f(!1)),b.key==="Escape"&&f(!1)},onBlur:()=>{i(t.id,g.trim()),f(!1)},placeholder:"Set a topic for this channel...",className:"w-full bg-transparent text-[10px] text-[var(--terminal-text-muted)] outline-none border-b border-[var(--terminal-border)] pb-0.5"}):s.jsx("button",{onClick:()=>{y(t.topic??""),f(!0)},className:"text-[10px] text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] cursor-pointer italic",children:t.topic||"Click to set channel topic..."})}),d&&!t.isDefault&&l&&r&&s.jsx("div",{className:"px-3 pb-2 mb-2 border-b border-[var(--terminal-border)]",children:s.jsx("div",{className:"flex flex-wrap gap-1",children:l.map(b=>{const v=t.members.includes(b.id);return s.jsxs("button",{className:`text-[10px] px-2 py-1 rounded ${v?"bg-white/15 text-[var(--terminal-text)]":"bg-white/5 text-[var(--terminal-text-muted)]"}`,onClick:()=>{const S=v?t.members.filter(j=>j!==b.id):[...t.members,b.id];r(t.id,S)},children:[v?"✓ ":"",b.name]},b.id)})})}),t.messages.length===0&&s.jsx("div",{className:"flex-1 flex flex-col items-center justify-center text-[var(--terminal-text-muted)] text-xs gap-1 py-8",children:s.jsx("span",{children:t.isDefault?"No dispatch events yet":"No messages yet — invite roles to start chatting"})}),t.messages.map(b=>s.jsx(_C,{msg:b},b.id)),s.jsx("div",{ref:c})]})}const Ef={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"},BC=400,LC=800;function $C({sessions:t,activeSessionId:l,roles:r,streamingSessionId:i,width:c,onWidthChange:u,onSwitchSession:d,onCloseSession:m,onCreateSession:x,onClearEmpty:f,onCloseAll:g,onSendMessage:y,onModeChange:b,onCloseTerminal:v,chatChannels:S,activeChatChannelId:j,onSwitchChatChannel:E,onCreateChatChannel:C,onDeleteChatChannel:A,onUpdateChatMembers:F,onUpdateChatTopic:_,unreadChannels:H}){const[M,I]=k.useState(!1),[W,te]=k.useState(!1),[D,Y]=k.useState(!1),[B,V]=k.useState(""),ne=j!=null,G=S==null?void 0:S.find(Se=>Se.id===j),[L,Z]=k.useState(!1),[de,ue]=k.useState(!1),[z,R]=k.useState(!1),K=k.useRef(0),T=k.useRef(0),fe=k.useRef(null),Ee=t.find(Se=>Se.id===l),Ne=i===l,Le=t.filter(Se=>Se.messages.length===0).length,Be=k.useCallback(()=>{const Se=fe.current;Se&&(ue(Se.scrollLeft>0),R(Se.scrollLeft+Se.clientWidth<Se.scrollWidth-1))},[]);k.useEffect(()=>{if(!l||!fe.current)return;const Se=fe.current.querySelector(`[data-session-id="${l}"]`);Se&&Se.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"}),Be()},[l,t.length,Be]),k.useEffect(()=>{const Se=fe.current;if(!Se)return;Be(),Se.addEventListener("scroll",Be);const tt=new ResizeObserver(Be);return tt.observe(Se),()=>{Se.removeEventListener("scroll",Be),tt.disconnect()}},[Be]);const Qe=k.useCallback(Se=>{Se.preventDefault(),K.current=Se.clientX,T.current=c,Z(!0);const tt=he=>{const ge=K.current-he.clientX,ke=Math.min(LC,Math.max(BC,T.current+ge));u==null||u(ke)},me=()=>{Z(!1),document.removeEventListener("mousemove",tt),document.removeEventListener("mouseup",me)};document.addEventListener("mousemove",tt),document.addEventListener("mouseup",me)},[c,u]);return s.jsxs("div",{className:"shrink-0 bg-[var(--terminal-bg)] border-l border-[var(--terminal-border)] flex flex-col h-full relative",style:{width:c},children:[u&&s.jsx("div",{className:`terminal-resize-handle absolute top-0 left-0 w-1 h-full cursor-col-resize z-10 transition-colors ${L?"bg-[var(--terminal-border-hover)]":"bg-transparent"}`,onMouseDown:Qe}),s.jsxs("div",{className:"flex items-center bg-[var(--terminal-bg-deeper)] border-b border-[var(--terminal-border)] shrink-0",children:[s.jsxs("div",{className:"relative flex-1 min-w-0",children:[de&&s.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-6 bg-gradient-to-r from-[var(--terminal-bg-deeper)] to-transparent z-10 pointer-events-none"}),s.jsxs("div",{ref:fe,className:"flex items-center overflow-x-auto terminal-tab-scroll gap-px px-1 py-1",children:[S==null?void 0:S.map(Se=>s.jsxs("button",{onClick:()=>{E==null||E(Se.id)},className:`flex items-center gap-1 px-2.5 py-1.5 text-[11px] rounded-t-lg shrink-0 cursor-pointer transition-colors group ${j===Se.id?"bg-[var(--terminal-bg)] text-[var(--terminal-text)]":"bg-[var(--terminal-inline-bg)] text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] hover:bg-[var(--terminal-surface)]"}`,style:j===Se.id?{borderTop:"2px solid #4CAF50"}:void 0,children:[s.jsx("span",{className:"text-[10px]",children:"💬"}),s.jsx("span",{className:"truncate",children:Se.name}),(H==null?void 0:H.has(Se.id))&&j!==Se.id&&s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-400 shrink-0"}),!Se.isDefault&&s.jsx("span",{onClick:tt=>{tt.stopPropagation(),A==null||A(Se.id)},className:"ml-1 text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-sm leading-none opacity-0 group-hover:opacity-100",children:"×"})]},Se.id)),S&&S.length>0&&t.length>0&&s.jsx("div",{className:"w-px h-4 bg-[var(--terminal-border)] shrink-0 mx-1"}),t.map(Se=>s.jsx(jC,{roleId:Se.roleId,title:Se.title,roleColor:Ef[Se.roleId]??"#666",active:!ne&&Se.id===l,onClick:()=>{E==null||E(null),d(Se.id)},onClose:tt=>{tt.stopPropagation(),m(Se.id)},"data-session-id":Se.id},Se.id))]}),z&&s.jsx("div",{className:"absolute right-0 top-0 bottom-0 w-6 bg-gradient-to-l from-[var(--terminal-bg-deeper)] to-transparent z-10 pointer-events-none"})]}),s.jsxs("div",{className:"relative shrink-0",children:[s.jsx("button",{onClick:()=>{I(!M),te(!1)},className:"w-7 h-7 flex items-center justify-center text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-lg cursor-pointer",children:"+"}),M&&s.jsxs("div",{className:"absolute top-full right-0 mt-1 bg-[var(--terminal-surface)] border border-[var(--terminal-border)] rounded-lg shadow-xl z-50 py-1 min-w-[200px]",children:[C&&s.jsxs(s.Fragment,{children:[D?s.jsxs("div",{className:"px-3 py-2 flex items-center gap-1",children:[s.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:"#"}),s.jsx("input",{autoFocus:!0,value:B,onChange:Se=>V(Se.target.value),onKeyDown:Se=>{Se.key==="Enter"&&B.trim()&&(C(B.trim(),[]),V(""),Y(!1),I(!1)),Se.key==="Escape"&&(Y(!1),V(""))},placeholder:"channel name",className:"flex-1 bg-transparent text-xs text-[var(--terminal-text)] outline-none border-b border-[var(--terminal-border)]"})]}):s.jsxs("button",{onClick:()=>Y(!0),className:"w-full text-left px-3 py-2 text-xs text-[var(--terminal-text-secondary)] hover:bg-[var(--terminal-surface-light)] cursor-pointer flex items-center gap-2",children:[s.jsx("span",{className:"text-[10px]",children:"💬"}),"New Channel"]}),s.jsx("div",{className:"border-b border-[var(--terminal-border)] my-1"})]}),r.map(Se=>s.jsxs("button",{onClick:()=>{x(Se.id),E==null||E(null),I(!1)},className:"w-full text-left px-3 py-2 text-xs text-[var(--terminal-text-secondary)] hover:bg-[var(--terminal-surface-light)] cursor-pointer flex items-center gap-2",children:[s.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:Ef[Se.id]??"#666"}}),Se.id.toUpperCase()," — ",Se.name]},Se.id))]})]}),s.jsxs("div",{className:"relative shrink-0",children:[s.jsx("button",{onClick:()=>{te(!W),I(!1)},className:"w-7 h-7 flex items-center justify-center text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-xs cursor-pointer tracking-tight",title:"Manage sessions",children:"···"}),W&&s.jsxs("div",{className:"absolute top-full right-0 mt-1 bg-[var(--terminal-surface)] border border-[var(--terminal-border)] rounded-lg shadow-xl z-50 py-1 min-w-[200px]",children:[s.jsxs("div",{className:"px-3 py-1.5 text-[10px] text-[var(--terminal-text-muted)] border-b border-[var(--terminal-border)]",children:[t.length," session",t.length!==1?"s":""]}),Le>0&&f&&s.jsxs("button",{onClick:()=>{f(),te(!1)},className:"w-full text-left px-3 py-2 text-xs text-[var(--terminal-text-secondary)] hover:bg-[var(--terminal-surface-light)] cursor-pointer",children:["Clear empty sessions (",Le,")"]}),t.length>0&&g&&s.jsx("button",{onClick:()=>{g(),te(!1)},className:"w-full text-left px-3 py-2 text-xs text-[#E57373] hover:bg-[var(--terminal-surface-light)] cursor-pointer",children:"Close all sessions"}),t.length===0&&s.jsx("div",{className:"px-3 py-2 text-xs text-[var(--terminal-text-muted)]",children:"No sessions"})]})]}),s.jsx("button",{onClick:v,className:"px-2 py-1 text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-sm cursor-pointer shrink-0",children:"×"})]}),ne&&G?s.jsx(OC,{channel:G,allRoles:r,onUpdateMembers:F,onUpdateTopic:_}):Ee?s.jsxs(s.Fragment,{children:[s.jsx(MC,{messages:Ee.messages,roleId:Ee.roleId,roleColor:Ef[Ee.roleId]??"#666"}),s.jsx(FC,{mode:Ee.mode,onModeChange:Se=>b(Ee.id,Se),onSend:Se=>y(Ee.id,Se,Ee.mode),disabled:Ne,disabledReason:Ne?`${Ee.roleId.toUpperCase()} is responding...`:void 0})]}):s.jsx("div",{className:"flex-1 flex items-center justify-center text-[var(--terminal-text-muted)] text-sm",children:"No active session. Click [+] to start."})]})}function HC(){const t=k.useRef(null),l=k.useCallback(()=>{var i;(i=t.current)==null||i.abort(),t.current=null},[]);return{sendMessage:k.useCallback((i,c,u,d)=>{l();const m=new AbortController;return t.current=m,fetch(`/api/exec/session/${i}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:c,mode:u}),signal:m.signal}).then(async x=>{var b,v,S,j,E;if(!x.ok||!x.body){d.onError("Failed to connect");return}const f=x.body.getReader(),g=new TextDecoder;let y="";for(;;){const{done:C,value:A}=await f.read();if(C)break;y+=g.decode(A,{stream:!0});const F=y.split(`
|
|
88
|
-
`);y=F.pop()??"";let _="";for(let H=0;H<F.length;H++){const M=F[H];if(M.startsWith("event: ")){_=M.slice(7).trim();continue}if(M.startsWith("data: ")){let I;try{I=JSON.parse(M.slice(6))}catch{_="";continue}switch(_){case"thinking":I.text&&((b=d.onThinking)==null||b.call(d,I.text));break;case"output":I.text&&d.onText(I.text);break;case"tool":(v=d.onToolUse)==null||v.call(d,I.name,I.input);break;case"dispatch":(S=d.onDispatch)==null||S.call(d,I.roleId,I.task);break;case"dispatch:progress":(j=d.onDispatchProgress)==null||j.call(d,I.roleId,I.type,I);break;case"turn":(E=d.onTurn)==null||E.call(d,I.turn);break;case"done":d.onDone(I);break;case"error":d.onError(I.message??"Unknown error");break;default:I.text&&d.onText(I.text);break}_=""}}}}).catch(x=>{x.name!=="AbortError"&&d.onError(x.message)}),{abort:l}},[l]),abort:l}}const kg="tycono-appearances",Pf="tycono-theme";function S0(){try{const t=localStorage.getItem(kg);return t?JSON.parse(t):{}}catch{return{}}}function Nf(t){localStorage.setItem(kg,JSON.stringify(t))}function C0(){try{const t=localStorage.getItem(Pf);if(t&&t in Gr)return t}catch{}return"default"}function UC(t){var i;const l=(i=Gr[t])==null?void 0:i.vars;if(!l)return;const r=document.documentElement;for(const[c,u]of Object.entries(l))r.style.setProperty(c,u)}const Af={mode:"auto",intervalSec:18,dailyBudgetUsd:1},eh="tycono-speech-settings",Tf="tycono-language";function IC(){try{const t=localStorage.getItem(eh);return t?{...Af,...JSON.parse(t)}:Af}catch{return Af}}function YC(){const[t,l]=k.useState(S0),[r,i]=k.useState(C0),[c,u]=k.useState(IC),[d,m]=k.useState(()=>{try{return localStorage.getItem(Tf)??"auto"}catch{return"auto"}}),x=k.useRef(!1);k.useEffect(()=>{x.current||(x.current=!0,Ce.getPreferences().then(j=>{const E=Object.keys(j.appearances??{}).length>0||j.theme!=="default";if(j.speech&&(u(C=>({...C,...j.speech})),localStorage.setItem(eh,JSON.stringify(j.speech))),j.language&&(m(j.language),localStorage.setItem(Tf,j.language)),E){const C=j.appearances;l(C),Nf(C),j.theme&&j.theme in Gr&&(i(j.theme),localStorage.setItem(Pf,j.theme))}else{const C=S0(),A=C0();(Object.keys(C).length>0||A!=="default")&&Ce.updatePreferences({appearances:C,theme:A}).catch(()=>{})}}).catch(()=>{}))},[]),k.useEffect(()=>{UC(r)},[r]);const f=k.useCallback(j=>t[j]??Nh(j),[t]),g=k.useCallback((j,E)=>{l(C=>{const A={...C,[j]:E};return Nf(A),Ce.updatePreferences({appearances:A}).catch(()=>{}),A})},[]),y=k.useCallback(j=>{l(E=>{const C={...E};return delete C[j],Nf(C),Ce.updatePreferences({appearances:C}).catch(()=>{}),C})},[]),b=k.useCallback(j=>{i(j),localStorage.setItem(Pf,j),Ce.updatePreferences({theme:j}).catch(()=>{})},[]),v=k.useCallback(j=>{u(E=>{const C={...E,...j};return localStorage.setItem(eh,JSON.stringify(C)),Ce.updatePreferences({speech:C}).catch(()=>{}),C})},[]),S=k.useCallback(j=>{m(j),localStorage.setItem(Tf,j),Ce.updatePreferences({language:j}).catch(()=>{})},[]);return{appearances:t,getAppearance:f,setAppearance:g,resetAppearance:y,theme:r,setTheme:b,speechSettings:c,setSpeechSettings:v,language:d,setLanguage:S}}const qC=3e4;function XC(){var E;const[t,l]=k.useState(null),[r,i]=k.useState("synced"),[c,u]=k.useState([]),d=k.useRef(null),m=k.useCallback(async()=>{try{const C=await Ce.getSaveStatus();l(C),C.noGit?i("no-git"):i(A=>A==="saving"?A:C.dirty?"dirty":"synced")}catch{i("error")}},[]),x=k.useCallback(()=>{d.current||(m(),d.current=setInterval(m,qC))},[m]);k.useEffect(()=>()=>{d.current&&clearInterval(d.current)},[]);const f=k.useCallback(async C=>{i("saving");try{const A=await Ce.save(C);return await m(),A}catch(A){throw i("error"),A}},[m]),g=k.useCallback(async()=>{try{const C=await Ce.getSaveHistory(20);u(C)}catch{}},[]),y=k.useCallback(async C=>{i("saving");try{await Ce.restoreSave(C),await m()}catch(A){throw i("error"),A}},[m]),b=k.useCallback(async()=>{try{await Ce.initGit(),await m()}catch{i("error")}},[m]),v=t?t.modified.length+t.untracked.length:0,S=((E=t==null?void 0:t.lastCommit)==null?void 0:E.date)??null,j=k.useCallback(async()=>{x()},[x]);return{state:r,dirtyCount:v,lastSaved:S,status:t,save:f,history:c,loadHistory:g,restore:y,refresh:j,initGit:b}}const E0={cto:["Need to reduce this architecture tech debt...","Don't over-engineer. Keep it minimal.","Performance profiling results are a bit concerning.","Should do a system design review.","If I just strip one abstraction layer, it should work.","Let me check the monitoring dashboard.","Need to go through the code review queue.","It's about time to clean up these module dependencies."],cbo:["Heard the competitor launched a new feature... need to analyze.","Should compile this month's revenue metrics.","It's time to update the market trend report.","Maybe I should benchmark the pricing strategy.","Need to recalculate the ROI.","Let me check the competitor's GitHub star trends.","Thinking about launch timing...","Should re-examine the positioning strategy."],pm:["Is this feature really what users want?","Need to clean up the backlog...","MVP scope keeps expanding.","Analyzing user feedback...","Might need to re-prioritize.","Watch out for scope creep.","Will the roadmap timeline hold...","Should double-check the task dependencies."],engineer:["I want to refactor this code...","Test coverage seems a bit low.","Working code first, perfect code later.","Waiting for PR review...","What could be causing this bug...","Is the build broken?","Need to fix that one type error.","Maybe I should run npm audit."],designer:["This UI flow feels a bit awkward...","Usability first, pretty later.","Need to organize the design system components.","Let me make two quick options and compare.","Should run through the accessibility checklist.","Maybe I should prototype this interaction.","Let me revisit the color palette...","The spacing feels a bit cramped."],qa:['"Works" and "correct" are two different things.',"Organizing edge case scenarios...","Should run the regression test suite.","This part could be converted to automated tests.","Need to go through the pre-release checklist.","Reproducible bug reports are key.","Should run cross-browser tests.","Need to check for performance regressions."],"data-analyst":["Checking the data pipeline status...","Interesting outlier detection pattern.","Need to update the dashboard metrics.","Correlation isn't causation though...","Seems like there is room for SQL query optimization.","It's time for a data quality check."]},N0={cto:["Should I assign more work to the team...","It's time to clean up the architecture debt.","Need to re-examine the tech roadmap.","It's quiet... am I missing something?"],cbo:["It's time to update the market analysis...","Should be preparing the revenue report, but no directives.","Let me check on competitor movements.","It's quiet on the business side..."],pm:["Backlog is pretty quiet... nothing to plan?","It's been a while since we scheduled a sprint.","User feedback must be piling up...","No PRD to write... that's unusual."],engineer:["Nothing to do today... maybe some code reviews.","Task queue is empty. Guess I'll refactor.","Am I missing something?","Should clean up the commit log."],designer:["No design requests coming in. Should I improve something on my own?","Maybe run a UI audit...","Should organize my portfolio.","Let me tidy up the component library."],qa:["No builds to test. Let me improve the automation scripts.","It's quiet... no bugs, or just haven't found them?","Let me review the existing test scenarios.","Should update the test coverage report."],"data-analyst":["No analysis requests coming in...","Maybe I should clean up the data warehouse.","Should verify the past reports."]},VC=[{id:"sup-check-1",relation:"superior-subordinate",minFamiliarity:0,topic:"progress",turns:[{speaker:"A",text:"How's the progress?"},{speaker:"B",text:"Going well. Should be done soon."},{speaker:"A",text:"Good, let me know when it's done."}]},{id:"sup-check-2",relation:"superior-subordinate",minFamiliarity:20,topic:"progress",turns:[{speaker:"A",text:"What are you working on today?"},{speaker:"B",text:"Finishing up what I was doing yesterday."}]},{id:"sub-report-1",relation:"superior-subordinate",minFamiliarity:10,topic:"report",turns:[{speaker:"B",text:"Done with that task from earlier."},{speaker:"A",text:"Nice work. Can you share the results?"},{speaker:"B",text:"Sure, I've updated the docs."}]},{id:"peer-tech-1",relation:"peer",minFamiliarity:20,topic:"tech",turns:[{speaker:"A",text:"What do you think about this design?"},{speaker:"B",text:"I think we could go simpler."},{speaker:"A",text:"Really? Want to look at it together?"}]},{id:"peer-tech-2",relation:"peer",minFamiliarity:30,topic:"tech",turns:[{speaker:"A",text:"Have you used this library before?"},{speaker:"B",text:"Yeah, used it in the last project. It was decent."}]},{id:"close-feedback-1",relation:"peer",minFamiliarity:60,topic:"feedback",turns:[{speaker:"A",text:"Can I be honest with you?"},{speaker:"B",text:"Of course, go ahead."},{speaker:"A",text:"This one feels a bit off. Let's revisit."},{speaker:"B",text:"...Alright. Thanks for the feedback."}]},{id:"clevel-sync-1",relation:"c-level",minFamiliarity:10,topic:"strategy",turns:[{speaker:"A",text:"We need to sync the roadmap with the business timeline."},{speaker:"B",text:"Agreed. I'll have it organized and shared by tomorrow."}]},{id:"clevel-sync-2",relation:"c-level",minFamiliarity:30,topic:"strategy",turns:[{speaker:"A",text:"I have some competitor intel to share."},{speaker:"B",text:"Great, I have a tech update too."},{speaker:"A",text:"Let's sync up when you're free."}]},{id:"casual-coffee",relation:"any",minFamiliarity:30,topic:"casual",turns:[{speaker:"A",text:"Want to grab a coffee?"},{speaker:"B",text:"Sure. Feels like it's going to be a long day."}]},{id:"casual-overtime",relation:"any",minFamiliarity:25,topic:"casual",turns:[{speaker:"A",text:"Working late again..."},{speaker:"B",text:"We're in this together. Hang in there."}]},{id:"casual-lunch",relation:"any",minFamiliarity:35,topic:"casual",turns:[{speaker:"A",text:"What should we get for lunch?"},{speaker:"B",text:"Anything. Feel like we eat the same thing every day."}]},{id:"casual-weekend",relation:"any",minFamiliarity:40,topic:"casual",turns:[{speaker:"A",text:"What did you do this weekend?"},{speaker:"B",text:"Just rested. Was too tired."}]},{id:"bestie-1",relation:"any",minFamiliarity:80,topic:"trust",turns:[{speaker:"A",text:"I'm a bit unsure about this direction..."},{speaker:"B",text:"What's bothering you? Be honest."},{speaker:"A",text:"Thanks. It's nice having someone I can talk to."}]}],GC=18e3,A0=6e3,KC=2500,QC=30*6e4,jg="tycono:relationships";function WC(){try{const t=localStorage.getItem(jg);return t?JSON.parse(t):[]}catch{return[]}}function ZC(t){localStorage.setItem(jg,JSON.stringify(t))}function oc(t,l,r){const[i,c]=l<r?[l,r]:[r,l];let u=t.find(d=>d.roleA===i&&d.roleB===c);return u||(u={roleA:i,roleB:c,dispatches:0,wavesTogether:0,conversations:0,familiarity:0,lastInteraction:new Date().toISOString()},t.push(u)),u}function cc(t){return Math.min(100,t.dispatches*5+t.wavesTogether*10+t.conversations*2)}function uc(t){return t[Math.floor(Math.random()*t.length)]}function JC(t,l,r){const i=r.find(m=>m.id===t),c=r.find(m=>m.id===l);if(!i||!c)return null;const u=i.level==="c-level",d=c.level==="c-level";return u&&d?"c-level":i.reportsTo===l||c.reportsTo===t?"superior-subordinate":(i.reportsTo===c.reportsTo,"peer")}function PC(t,l){return t.relation==="any"?!0:t.relation===l}function eE({roles:t,roleStatuses:l,activeExecs:r,getStandupSpeech:i}){const[c,u]=k.useState(new Map),[d,m]=k.useState(WC),x=k.useRef({}),f=k.useRef(null),g=k.useRef(t),y=k.useRef(l),b=k.useRef(r),v=k.useRef(i),S=k.useRef(d);g.current=t,y.current=l,b.current=r,v.current=i,S.current=d,k.useEffect(()=>{const _=Date.now();for(const[H,M]of Object.entries(l))M==="working"&&(x.current[H]=_)},[l]),k.useEffect(()=>{ZC(d)},[d]);const j=k.useCallback(_=>{const H=y.current[_],M=b.current.find(Y=>Y.roleId===_);if(H==="working"&&(M!=null&&M.task))return null;const I=v.current(_);if(I&&Math.random()<.3)return{text:I,type:"work",ts:Date.now()};const W=Date.now(),te=x.current[_]??0;if(W-te>QC&&Math.random()<.5){const Y=N0[_]??N0.engineer;return{text:uc(Y),type:"guilt",ts:W}}const D=E0[_]??E0.engineer;return{text:uc(D),type:"personality",ts:W}},[]),E=k.useCallback(_=>{if(f.current)return!1;const H=_.filter(Z=>y.current[Z.id]!=="working");if(H.length<2)return!1;const M=[...H].sort(()=>Math.random()-.5),I=M[0],W=M[1],te=JC(I.id,W.id,_);if(!te)return!1;const D=oc(S.current,I.id,W.id),Y=cc(D),B=VC.filter(Z=>PC(Z,te)&&Y>=Z.minFamiliarity);if(B.length===0)return!1;const V=uc(B);let ne=I.id,G=W.id;V.relation==="superior-subordinate"&&(W.reportsTo===I.id||I.level==="c-level"?(ne=I.id,G=W.id):(ne=W.id,G=I.id)),f.current={templateId:V.id,roleA:ne,roleB:G,turnIdx:0,timer:null};const L=Z=>{if(!f.current||Z>=V.turns.length){f.current=null,m(R=>{const K=[...R],T=oc(K,ne,G);return T.conversations++,T.familiarity=cc(T),T.lastInteraction=new Date().toISOString(),K}),setTimeout(()=>{u(R=>{const K=new Map(R);return K.delete(ne),K.delete(G),K})},A0);return}const de=V.turns[Z],ue=de.speaker==="A"?ne:G,z=de.speaker==="A"?G:ne;u(R=>{const K=new Map(R);if(K.set(ue,{text:de.text,type:"social",partnerId:z,ts:Date.now()}),Z>0){const T=V.turns[Z-1].speaker==="A"?ne:G;T!==ue&&K.delete(T)}return K}),f.current.turnIdx=Z,f.current.timer=setTimeout(()=>L(Z+1),KC)};return L(0),!0},[]);k.useEffect(()=>{const _=setInterval(()=>{const H=g.current;if(H.length===0||f.current||Math.random()<.35&&E(H))return;const M=H.filter(te=>y.current[te.id]!=="working");if(M.length===0)return;const I=uc(M),W=j(I.id);W&&(u(te=>{const D=new Map(te);return D.set(I.id,W),D}),setTimeout(()=>{u(te=>{const D=new Map(te),Y=D.get(I.id);return Y&&Y.ts===W.ts&&D.delete(I.id),D})},A0))},GC);return()=>{var H;clearInterval(_),(H=f.current)!=null&&H.timer&&clearTimeout(f.current.timer)}},[j,E]);const C=k.useCallback(_=>{const H=c.get(_);return(H==null?void 0:H.text)??""},[c]),A=k.useCallback((_,H)=>{m(M=>{const I=[...M],W=oc(I,_,H);return W.dispatches++,W.familiarity=cc(W),W.lastInteraction=new Date().toISOString(),I})},[]),F=k.useCallback(_=>{_.length<2||m(H=>{const M=[...H];for(let I=0;I<_.length;I++)for(let W=I+1;W<_.length;W++){const te=oc(M,_[I],_[W]);te.wavesTogether++,te.familiarity=cc(te),te.lastInteraction=new Date().toISOString()}return M})},[]);return{speeches:c,getSpeech:C,relationships:d,notifyDispatch:A,notifyWave:F}}const Sg="tycono:office-chat";let tE=0;function nE(){return`chat-${Date.now()}-${++tE}`}function Df(){return[{id:"general",name:"#general",members:[],isDefault:!0,messages:[],topic:"Company-wide announcements and general discussion"},{id:"watercooler",name:"#watercooler",members:[],isDefault:!0,messages:[],topic:"No managers allowed. Vent, gossip, joke around. Talk freely about work frustrations, complain about directives you disagree with, share hot takes."}]}function lE(){try{const t=localStorage.getItem(Sg);if(t){const l=JSON.parse(t);if(l.find(i=>i.id==="office")&&!l.find(i=>i.id==="general")){const i=l.filter(c=>c.id!=="office");return[...Df(),...i]}const r=Df();for(const i of r)l.find(c=>c.id===i.id)||l.unshift(i);return l}}catch{}return Df()}function rE(t){const l=t.map(r=>({...r,messages:r.messages.slice(-200)}));localStorage.setItem(Sg,JSON.stringify(l))}function aE(){const[t,l]=k.useState(lE),[r,i]=k.useState(null),[c,u]=k.useState(new Set);k.useEffect(()=>{rE(t)},[t]);const d=k.useCallback(v=>{i(v),v&&u(S=>{const j=new Set(S);return j.delete(v),j})},[]),m=k.useCallback(v=>{const S={...v,id:nE()};l(j=>{const E=j.map(C=>C.id==="general"?v.type==="dispatch"?{...C,messages:[...C.messages,S].slice(-200)}:C:v.channelId?C.id===v.channelId?{...C,messages:[...C.messages,S].slice(-200)}:C:C.members.length>0&&C.members.includes(v.roleId)?{...C,messages:[...C.messages,S].slice(-200)}:C);return u(C=>{const A=new Set(C);for(const F of E){const _=j.find(H=>H.id===F.id);_&&F.messages.length>_.messages.length&&A.add(F.id)}return A}),E})},[]),x=k.useCallback((v,S,j)=>{const E=`ch-${Date.now()}`,C={id:E,name:v.startsWith("#")?v:`#${v}`,members:S,isDefault:!1,messages:[],topic:j};l(A=>[...A,C]),i(E)},[]),f=k.useCallback(v=>{l(S=>S.filter(j=>j.id!==v||j.isDefault)),i(S=>S===v?"general":S)},[]),g=k.useCallback((v,S)=>{l(j=>j.map(E=>E.id===v&&!E.isDefault?{...E,members:S}:E))},[]),y=k.useCallback((v,S)=>{l(j=>j.map(E=>E.id===v&&!E.isDefault?{...E,topic:S||void 0}:E))},[]),b=k.useCallback(v=>{l(S=>S.map(j=>{if(j.id==="watercooler"){const E=v.filter(C=>C.level!=="c-level").map(C=>C.id);if(j.members.length!==E.length||!E.every(C=>j.members.includes(C)))return{...j,members:E}}return j}))},[]);return{channels:t,activeChannelId:r,setActiveChannelId:d,pushMessage:m,createChannel:x,deleteChannel:f,updateMembers:g,updateTopic:y,unreadChannels:c,syncDefaultMembers:b}}const iE=45e3,sE=5e3,oE=4,cE=20;function uE({roles:t,roleStatuses:l,activeExecs:r,channels:i,relationships:c,pushMessage:u,speechSettings:d,engineType:m,hasApiKey:x}){const g=((d==null?void 0:d.mode)==="auto"?m==="claude-cli"||m==="local"?"llm":"template":(d==null?void 0:d.mode)??"template")==="llm"&&(x!==!1||m==="claude-cli"),y=((d==null?void 0:d.intervalSec)??iE/1e3)*1e3,b=k.useRef(t),v=k.useRef(l),S=k.useRef(r),j=k.useRef(i),E=k.useRef(c),C=k.useRef(u),A=k.useRef(0),F=k.useRef(!1);b.current=t,v.current=l,S.current=r,j.current=i,E.current=c,C.current=u;const _=k.useCallback(async(M,I)=>{if(F.current)return!1;F.current=!0;try{if(!b.current.find(G=>G.id===M))return!1;const te=I.messages.slice(-cE).map(G=>({roleId:G.roleId,text:G.text,ts:G.ts})),D=b.current.filter(G=>I.members.includes(G.id)),Y=E.current.filter(G=>G.roleA===M||G.roleB===M).map(G=>({partnerId:G.roleA===M?G.roleB:G.roleA,familiarity:G.familiarity})),B=S.current.find(G=>G.roleId===M),V=B?{currentTask:B.task,taskProgress:null}:{currentTask:null,taskProgress:null},ne=await Ce.chatInChannel({channelId:I.name.replace("#",""),channelTopic:I.topic,roleId:M,history:te,members:D.map(G=>({id:G.id,name:G.name,level:G.level})),relationships:Y,workContext:V});return ne.message?(C.current({ts:Date.now(),roleId:M,text:ne.message,type:"chat",channelId:I.id}),!0):!1}catch{return!1}finally{F.current=!1}},[]),H=k.useCallback(async(M,I)=>{if(A.current>=oE){A.current=0;return}const W=M.members.filter(B=>B!==I&&v.current[B]!=="working");if(W.length===0){A.current=0;return}const te=W[Math.floor(Math.random()*W.length)];if(Math.random()>.7){A.current=0;return}const D=A.current*2e3,Y=Math.random()*5e3;setTimeout(async()=>{A.current++;const B=j.current.find(ne=>ne.id===M.id);if(!B)return;if(await _(te,B)){const ne=.6-A.current*.1;Math.random()<ne?H(B,te):A.current=0}else A.current=0},sE+D+Y)},[_]);k.useEffect(()=>{if(!g)return;const M=setInterval(async()=>{const I=b.current;if(I.length===0||F.current)return;const W=I.filter(V=>v.current[V.id]!=="working");if(W.length===0)return;const te=W[Math.floor(Math.random()*W.length)],D=j.current.filter(V=>V.members.length===0?!0:V.members.includes(te.id));if(D.length===0)return;const Y=D[Math.floor(Math.random()*D.length)];A.current=0,await _(te.id,Y)&&H(Y,te.id)},y);return()=>clearInterval(M)},[g,y,_,H])}function dc({type:t,className:l}){const r=k.useRef(null),i=Tj(t);return k.useEffect(()=>{const c=r.current;if(!c||!i)return;const u=c.getContext("2d");u&&zj(u,i)},[t,i]),i?s.jsx("canvas",{ref:r,width:i.canvasWidth,height:i.canvasHeight,className:l,style:{imageRendering:"pixelated",display:"block"}}):null}const Cg=[[1,8],[3,5],[8,1],[5,3]],dE=[[1,4],[2,3],[4,1],[3,2]];function fc(t){const l=t===1||t===3?-1:0,r=Cg[t],i=t<2?[0,1]:[1,0],c=l;return[{x:1,y:17,w:10,h:2,c:"#100A06",a:.18},{x:r[0],y:13,w:3,h:4,c:"$pants"},{x:r[1],y:13,w:3,h:4,c:"$pants"},{x:r[0]+1,y:13,w:1,h:3,c:"darken($pants, 25)",a:.2},{x:r[1]+1,y:13,w:1,h:3,c:"darken($pants, 25)",a:.2},{x:r[0],y:16,w:3,h:2,c:"$shoes"},{x:r[1],y:16,w:3,h:2,c:"$shoes"},{x:r[0],y:16,w:3,h:1,c:"lighten($shoes, 25)",a:.4},{x:r[1],y:16,w:3,h:1,c:"lighten($shoes, 25)",a:.4},{x:1,y:c+8,w:10,h:6,c:"$shirt"},{x:2,y:c+8,w:8,h:1,c:"lighten($shirt, 20)",a:.35},{x:1,y:c+8,w:1,h:5,c:"darken($shirt, 30)",a:.2},{x:10,y:c+8,w:1,h:5,c:"darken($shirt, 30)",a:.2},{x:-1,y:c+9+i[0],w:3,h:4-i[0],c:"$shirt"},{x:10,y:c+9+i[1],w:3,h:4-i[1],c:"$shirt"},{x:-1,y:c+12,w:2,h:1,c:"$skin"},{x:11,y:c+12,w:2,h:1,c:"$skin"},{x:4,y:c+6,w:4,h:3,c:"$skin"},{x:1,y:c+0,w:10,h:7,c:"$skin"},{x:3,y:c+3,w:2,h:2,c:"#1A1A2E"},{x:7,y:c+3,w:2,h:2,c:"#1A1A2E"},{x:3,y:c+3,w:1,h:1,c:"#FFF",a:.4},{x:7,y:c+3,w:1,h:1,c:"#FFF",a:.4},{x:5,y:c+6,w:2,h:1,c:"darken($skin, 25)",a:.35},{x:0,y:c+3,w:1,h:1,c:"$skin"},{x:11,y:c+3,w:1,h:1,c:"$skin"},{x:1,y:c+0,w:10,h:3,c:"$hair"},{x:0,y:c+1,w:2,h:3,c:"$hair"},{x:10,y:c+1,w:2,h:3,c:"$hair"},{x:2,y:c+0,w:8,h:1,c:"lighten($hair, 25)",a:.3}]}function hc(t){const l=t===1||t===3?-1:0,r=Cg[t],i=t<2?[0,1]:[1,0],c=l;return[{x:1,y:17,w:10,h:2,c:"#100A06",a:.18},{x:r[0],y:13,w:3,h:4,c:"$pants"},{x:r[1],y:13,w:3,h:4,c:"$pants"},{x:r[0],y:16,w:3,h:2,c:"$shoes"},{x:r[1],y:16,w:3,h:2,c:"$shoes"},{x:1,y:c+8,w:10,h:6,c:"$shirt"},{x:2,y:c+8,w:8,h:1,c:"lighten($shirt, 20)",a:.2},{x:5,y:c+10,w:2,h:3,c:"darken($shirt, 30)",a:.12},{x:-1,y:c+9+i[0],w:3,h:4-i[0],c:"$shirt"},{x:10,y:c+9+i[1],w:3,h:4-i[1],c:"$shirt"},{x:4,y:c+6,w:4,h:3,c:"$skin"},{x:1,y:c+0,w:10,h:7,c:"$skin"},{x:1,y:c+0,w:10,h:6,c:"$hair"},{x:0,y:c+1,w:2,h:5,c:"$hair"},{x:10,y:c+1,w:2,h:5,c:"$hair"},{x:2,y:c+0,w:8,h:1,c:"lighten($hair, 25)",a:.3},{x:0,y:c+4,w:1,h:1,c:"$skin",a:.6},{x:11,y:c+4,w:1,h:1,c:"$skin",a:.6}]}function Yr(t,l){const r=t===1||t===3?-1:0,i=dE[t],c=r,u=t%2===0?1:0;return l?[{x:1,y:17,w:10,h:2,c:"#100A06",a:.18},{x:i[0],y:13,w:3,h:4,c:"$pants"},{x:i[1],y:13,w:3,h:4,c:"$pants"},{x:i[0],y:16,w:3,h:2,c:"$shoes"},{x:i[1],y:16,w:3,h:2,c:"$shoes"},{x:2,y:c+8,w:8,h:6,c:"$shirt"},{x:2,y:c+8,w:8,h:1,c:"lighten($shirt, 20)",a:.2},{x:8,y:c+9+u,w:3,h:4-u,c:"$shirt"},{x:9,y:c+12,w:2,h:1,c:"$skin"},{x:4,y:c+6,w:4,h:3,c:"$skin"},{x:2,y:c+0,w:8,h:7,c:"$skin"},{x:7,y:c+3,w:2,h:2,c:"#1A1A2E"},{x:7,y:c+3,w:1,h:1,c:"#FFF",a:.3},{x:9,y:c+4,w:1,h:1,c:"darken($skin, 25)",a:.3},{x:2,y:c+0,w:8,h:3,c:"$hair"},{x:1,y:c+1,w:2,h:4,c:"$hair"},{x:9,y:c+1,w:2,h:3,c:"$hair"},{x:3,y:c+0,w:6,h:1,c:"lighten($hair, 25)",a:.25}]:[{x:1,y:17,w:10,h:2,c:"#100A06",a:.18},{x:i[0],y:13,w:3,h:4,c:"$pants"},{x:i[1],y:13,w:3,h:4,c:"$pants"},{x:i[0],y:16,w:3,h:2,c:"$shoes"},{x:i[1],y:16,w:3,h:2,c:"$shoes"},{x:2,y:c+8,w:8,h:6,c:"$shirt"},{x:2,y:c+8,w:8,h:1,c:"lighten($shirt, 20)",a:.2},{x:0,y:c+9+u,w:3,h:4-u,c:"$shirt"},{x:-1,y:c+12,w:2,h:1,c:"$skin"},{x:4,y:c+6,w:4,h:3,c:"$skin"},{x:2,y:c+0,w:8,h:7,c:"$skin"},{x:3,y:c+3,w:2,h:2,c:"#1A1A2E"},{x:3,y:c+3,w:1,h:1,c:"#FFF",a:.3},{x:1,y:c+4,w:1,h:1,c:"darken($skin, 25)",a:.3},{x:2,y:c+0,w:8,h:3,c:"$hair"},{x:1,y:c+1,w:2,h:3,c:"$hair"},{x:9,y:c+1,w:2,h:4,c:"$hair"},{x:3,y:c+0,w:6,h:1,c:"lighten($hair, 25)",a:.25}]}const T0={down:[fc(0),fc(1),fc(2),fc(3)],up:[hc(0),hc(1),hc(2),hc(3)],right:[Yr(0,!0),Yr(1,!0),Yr(2,!0),Yr(3,!0)],left:[Yr(0,!1),Yr(1,!1),Yr(2,!1),Yr(3,!1)]},Ge=4,Dt=28,cn=2,ft=4,at=4,or=[{wallColor:"#C8B898",baseboardColor:"#6A5840",floorType:"wood"},{wallColor:"#A8B8C8",baseboardColor:"#586878",floorType:"dark"},{wallColor:"#A8C8B0",baseboardColor:"#4A6A50",floorType:"carpet"},{wallColor:"#C8C0A8",baseboardColor:"#7A6A50",floorType:"tile"}];function Ah(t,l,r){const u=t.fy+Math.max(10,Math.floor(t.fh*.18)),d=Math.min(l,r),m=Math.ceil(l/d),x=[],f=d*28,g=t.fx+Math.max(8,Math.floor((t.fw-f)/2));for(let y=0;y<m&&x.length<l;y++){const b=Math.min(d,l-y*d);for(let v=0;v<b;v++)x.push({dx:g+v*28,dy:u+y*28,room:t.id})}return x}function fE(t){const i=or[0],c={id:"main",wx:Ge+at,wy:Ge,ww:160-2*(Ge+at),wh:Dt,fx:Ge+at,fy:Ge+Dt+cn,fw:160-2*(Ge+at),fh:120-Ge-Dt-cn-Ge,...i},u=Ah(c,Math.min(t,6),3),d=[{id:"s-window-l",type:"window",room:"main",zone:"wall",offsetX:10,offsetY:6,windowW:16,windowH:14},{id:"s-window-r",type:"window",room:"main",zone:"wall",anchorX:"right",offsetX:-26,offsetY:6,windowW:16,windowH:14},{id:"s-clock",type:"clock",room:"main",zone:"wall",offsetX:Math.floor((160-2*(Ge+at))/2),offsetY:10}],m=[{id:"s-plant-l",type:"plant",room:"main",zone:"floor",offsetX:4,offsetY:4},{id:"s-plant-r",type:"plant",room:"main",zone:"floor",anchorX:"right",offsetX:-8,offsetY:4}];return{preset:"S",canvasW:160,canvasH:120,rooms:{main:c},desks:u,doors:{},adjacency:{main:[]},corridorY:{main:c.fy+c.fh-12},waypoints:{main:[{x:c.fx+10,y:c.fy+c.fh-14},{x:c.fx+c.fw/2,y:c.fy+c.fh-14},{x:c.fx+c.fw-10,y:c.fy+c.fh-14}]},wallDecorations:d,furniture:m}}function hE(t){const c={id:"exec",wx:Ge+at,wy:Ge,ww:144-Ge-at-ft/2,wh:Dt,fx:Ge+at,fy:Ge+Dt+cn,fw:144-Ge-at-ft/2,fh:66,...or[0]},u={id:"work",wx:144+ft/2+at,wy:Ge,ww:144-ft/2-at-Ge,wh:Dt,fx:144+ft/2+at,fy:Ge+Dt+cn,fw:144-ft/2-at-Ge,fh:66,...or[1]},d={id:"meet",wx:Ge+at,wy:Ge+Dt+cn+66+ft,ww:144-Ge-at-ft/2,wh:Dt,fx:Ge+at,fy:Ge+Dt+cn+66+ft+Dt+cn,fw:144-Ge-at-ft/2,fh:70,...or[2]},m={id:"comm",wx:144+ft/2+at,wy:Ge+Dt+cn+66+ft,ww:144-ft/2-at-Ge,wh:Dt,fx:144+ft/2+at,fy:Ge+Dt+cn+66+ft+Dt+cn,fw:144-ft/2-at-Ge,fh:70,...or[3]},x={exec:c,work:u,meet:d,comm:m},f=[];let g=t;const y=[[c,Math.min(3,g)],[u,0]];y[1][1]=Math.min(3,g-y[0][1]);const b=[[d,0],[m,0]];let v=g-y[0][1]-y[1][1];v>0&&(b[0][1]=Math.min(2,v),v-=b[0][1]),v>0&&(b[1][1]=Math.min(2,v));for(const[M,I]of[...y,...b])I>0&&f.push(...Ah(M,I,3));const S=Ge+Dt+cn+66,j=144-ft/2,E={exec_work:{id:"exec_work",type:"v",doorY:Ge+Dt+cn+20+12,xA:j-2,xB:u.fx+2},meet_comm:{id:"meet_comm",type:"v",doorY:Ge+Dt+cn+66+ft+Dt+cn+20+12,xA:j-2,xB:m.fx+2},exec_meet:{id:"exec_meet",type:"h",doorX:Ge+at+40+14,yA:S-2,yB:d.fy+2},work_comm:{id:"work_comm",type:"h",doorX:144+ft/2+at+40+14,yA:S-2,yB:m.fy+2}},C={exec:[{room:"work",door:"exec_work",side:"A"},{room:"meet",door:"exec_meet",side:"A"}],work:[{room:"exec",door:"exec_work",side:"B"},{room:"comm",door:"work_comm",side:"A"}],meet:[{room:"exec",door:"exec_meet",side:"B"},{room:"comm",door:"meet_comm",side:"A"}],comm:[{room:"work",door:"work_comm",side:"B"},{room:"meet",door:"meet_comm",side:"B"}]},A={exec:c.fy+52,work:u.fy+48,meet:d.fy+56,comm:m.fy+42},F={exec:[{x:c.fx+6,y:c.fy+52},{x:c.fx+60,y:c.fy+54},{x:c.fx+112,y:c.fy+50},{x:c.fx+50,y:c.fy+52}],work:[{x:u.fx+14,y:u.fy+48},{x:u.fx+44,y:u.fy+48},{x:u.fx+70,y:u.fy+48},{x:u.fx+100,y:u.fy+48}],meet:[{x:d.fx+60,y:d.fy+56},{x:d.fx+30,y:d.fy+54},{x:d.fx+110,y:d.fy+50},{x:d.fx+80,y:d.fy+56}],comm:[{x:m.fx+96,y:m.fy+8},{x:m.fx+60,y:m.fy+42},{x:m.fx+40,y:m.fy+42},{x:m.fx+20,y:m.fy+42}]},_=[{id:"exec-window-1",type:"window",room:"exec",zone:"wall",offsetX:10,offsetY:6,windowW:16,windowH:14},{id:"exec-picture-1",type:"picture",room:"exec",zone:"wall",offsetX:34,offsetY:8,pictureColor:"#1565C0",facility:{id:"theme",label:"THEME",icon:"🎨",color:"#42A5F5",hitW:12,hitH:10}},{id:"exec-picture-2",type:"picture",room:"exec",zone:"wall",offsetX:48,offsetY:8,pictureColor:"#E65100"},{id:"exec-clock",type:"clock",room:"exec",zone:"wall",offsetX:64,offsetY:10,facility:{id:"settings",label:"SETTINGS",icon:"⚙",color:"#78909C",hitW:10,hitH:10}},{id:"exec-shelf",type:"shelf",room:"exec",zone:"wall",offsetX:78,offsetY:14,facility:{id:"stats",label:"STATS",icon:"📊",color:"#7E57C2",hitW:16,hitH:8}},{id:"exec-window-2",type:"window",room:"exec",zone:"wall",offsetX:104,offsetY:6,windowW:16,windowH:14},{id:"work-whiteboard",type:"whiteboard",room:"work",zone:"wall",offsetX:6,offsetY:4},{id:"work-window-1",type:"window",room:"work",zone:"wall",offsetX:50,offsetY:6,windowW:16,windowH:14},{id:"work-window-2",type:"window",room:"work",zone:"wall",offsetX:92,offsetY:6,windowW:16,windowH:14},{id:"meet-bulletin",type:"bulletin-board",room:"meet",zone:"wall",offsetX:6,offsetY:4,facility:{id:"bulletin",label:"BULLETIN",icon:"📋",color:"#F59E0B",hitW:22,hitH:16}},{id:"meet-picture",type:"picture",room:"meet",zone:"wall",offsetX:28,offsetY:8,pictureColor:"#10B981"},{id:"meet-window",type:"window",room:"meet",zone:"wall",offsetX:80,offsetY:6,windowW:16,windowH:14},{id:"meet-shelf",type:"shelf",room:"meet",zone:"wall",offsetX:102,offsetY:18},{id:"comm-screen",type:"screen",room:"comm",zone:"wall",offsetX:6,offsetY:6,facility:{id:"decisions",label:"DECISIONS",icon:"📜",color:"#EF4444",hitW:16,hitH:12}},{id:"comm-picture",type:"picture",room:"comm",zone:"wall",offsetX:28,offsetY:8,pictureColor:"#d4956a"},{id:"comm-window",type:"window",room:"comm",zone:"wall",offsetX:76,offsetY:6,windowW:16,windowH:14},{id:"comm-clock",type:"clock",room:"comm",zone:"wall",offsetX:98,offsetY:10},{id:"comm-shelf",type:"shelf",room:"comm",zone:"wall",offsetX:108,offsetY:18}],H=[{id:"exec-bookshelf",type:"bookshelf",room:"exec",zone:"floor",offsetX:2,offsetY:4},{id:"exec-plant-r",type:"plant",room:"exec",zone:"floor",anchorX:"right",offsetX:-10,offsetY:4},{id:"exec-plant-c",type:"plant",room:"exec",zone:"floor",offsetX:Math.floor(c.fw/2),offsetY:4},{id:"work-plant-1",type:"plant",room:"work",zone:"floor",offsetX:36,offsetY:4},{id:"work-plant-2",type:"plant",room:"work",zone:"floor",offsetX:80,offsetY:4},{id:"meet-plant",type:"plant",room:"meet",zone:"floor",anchorX:"right",offsetX:-12,offsetY:4},{id:"meet-table",type:"meeting-table",room:"meet",zone:"floor",offsetX:10,offsetY:14,condition:"no-desks",facility:{id:"meeting",label:"MEETING",icon:"🏢",color:"#3B82F6",hitW:44,hitH:40}},{id:"comm-coffee-machine",type:"coffee-machine",room:"comm",zone:"floor",anchorX:"right",offsetX:-30,offsetY:4,condition:"no-desks"},{id:"comm-plant-1",type:"plant",room:"comm",zone:"floor",offsetX:38,offsetY:4,condition:"no-desks"},{id:"comm-bookshelf",type:"bookshelf",room:"comm",zone:"floor",anchorX:"right",offsetX:-26,offsetY:16,accent:"#10B981",condition:"no-desks",facility:{id:"knowledge",label:"KNOWLEDGE",icon:"📚",color:"#10B981",hitW:26,hitH:24}},{id:"comm-sofa",type:"sofa",room:"comm",zone:"floor",offsetX:44,offsetY:30,condition:"no-desks"},{id:"comm-coffee-table",type:"coffee-table",room:"comm",zone:"floor",offsetX:50,offsetY:50,condition:"no-desks"},{id:"comm-plant-2",type:"plant",room:"comm",zone:"floor",offsetX:38,offsetY:50,condition:"no-desks"}];return{preset:"M",canvasW:288,canvasH:208,rooms:x,desks:f,doors:E,adjacency:C,corridorY:A,waypoints:F,wallDecorations:_,furniture:H}}function mE(t){const d={id:"exec",wx:Ge+at,wy:Ge,ww:180-Ge-at-ft/2,wh:Dt,fx:Ge+at,fy:Ge+Dt+cn,fw:180-Ge-at-ft/2,fh:82,...or[0]},m={id:"work",wx:180+ft/2+at,wy:Ge,ww:180-ft/2-at-Ge,wh:Dt,fx:180+ft/2+at,fy:Ge+Dt+cn,fw:180-ft/2-at-Ge,fh:82,...or[1]},x=Ge+Dt+cn+82,f={id:"meet",wx:Ge+at,wy:x+ft,ww:180-Ge-at-ft/2,wh:Dt,fx:Ge+at,fy:x+ft+Dt+cn,fw:180-Ge-at-ft/2,fh:86,...or[2]},g={id:"comm",wx:180+ft/2+at,wy:x+ft,ww:180-ft/2-at-Ge,wh:Dt,fx:180+ft/2+at,fy:x+ft+Dt+cn,fw:180-ft/2-at-Ge,fh:86,...or[3]},y={exec:d,work:m,meet:f,comm:g},b=[];let v=t;const S=[[d,Math.min(5,v)],[m,0]];S[1][1]=Math.min(5,v-S[0][1]);const j=[[f,0],[g,0]];let E=v-S[0][1]-S[1][1];E>0&&(j[0][1]=Math.min(3,E),E-=j[0][1]),E>0&&(j[1][1]=Math.min(3,E));for(const[W,te]of[...S,...j])te>0&&b.push(...Ah(W,te,4));const C=180-ft/2,A={exec_work:{id:"exec_work",type:"v",doorY:d.fy+82/2,xA:C-2,xB:m.fx+2},meet_comm:{id:"meet_comm",type:"v",doorY:f.fy+86/2,xA:C-2,xB:g.fx+2},exec_meet:{id:"exec_meet",type:"h",doorX:d.fx+54,yA:x-2,yB:f.fy+2},work_comm:{id:"work_comm",type:"h",doorX:m.fx+54,yA:x-2,yB:g.fy+2}},F={exec:[{room:"work",door:"exec_work",side:"A"},{room:"meet",door:"exec_meet",side:"A"}],work:[{room:"exec",door:"exec_work",side:"B"},{room:"comm",door:"work_comm",side:"A"}],meet:[{room:"exec",door:"exec_meet",side:"B"},{room:"comm",door:"meet_comm",side:"A"}],comm:[{room:"work",door:"work_comm",side:"B"},{room:"meet",door:"meet_comm",side:"B"}]},_={exec:d.fy+82-12,work:m.fy+82-12,meet:f.fy+86-12,comm:g.fy+86-12},H={exec:[{x:d.fx+10,y:_.exec},{x:d.fx+d.fw/2,y:_.exec},{x:d.fx+d.fw-10,y:_.exec}],work:[{x:m.fx+10,y:_.work},{x:m.fx+m.fw/2,y:_.work},{x:m.fx+m.fw-10,y:_.work}],meet:[{x:f.fx+10,y:_.meet},{x:f.fx+f.fw/2,y:_.meet},{x:f.fx+f.fw-10,y:_.meet}],comm:[{x:g.fx+10,y:_.comm},{x:g.fx+g.fw/2,y:_.comm},{x:g.fx+g.fw-10,y:_.comm}]},M=[{id:"exec-window-1",type:"window",room:"exec",zone:"wall",offsetX:10,offsetY:6,windowW:16,windowH:14},{id:"exec-picture-1",type:"picture",room:"exec",zone:"wall",offsetX:34,offsetY:8,pictureColor:"#1565C0",facility:{id:"theme",label:"THEME",icon:"🎨",color:"#42A5F5",hitW:12,hitH:10}},{id:"exec-picture-2",type:"picture",room:"exec",zone:"wall",offsetX:48,offsetY:8,pictureColor:"#E65100"},{id:"exec-clock",type:"clock",room:"exec",zone:"wall",offsetX:64,offsetY:10,facility:{id:"settings",label:"SETTINGS",icon:"⚙",color:"#78909C",hitW:10,hitH:10}},{id:"exec-shelf",type:"shelf",room:"exec",zone:"wall",offsetX:78,offsetY:14,facility:{id:"stats",label:"STATS",icon:"📊",color:"#7E57C2",hitW:16,hitH:8}},{id:"exec-window-2",type:"window",room:"exec",zone:"wall",offsetX:104,offsetY:6,windowW:16,windowH:14},{id:"work-whiteboard",type:"whiteboard",room:"work",zone:"wall",offsetX:6,offsetY:4},{id:"work-window-1",type:"window",room:"work",zone:"wall",offsetX:50,offsetY:6,windowW:16,windowH:14},{id:"work-window-2",type:"window",room:"work",zone:"wall",offsetX:92,offsetY:6,windowW:16,windowH:14},{id:"meet-bulletin",type:"bulletin-board",room:"meet",zone:"wall",offsetX:6,offsetY:4,facility:{id:"bulletin",label:"BULLETIN",icon:"📋",color:"#F59E0B",hitW:22,hitH:16}},{id:"meet-picture",type:"picture",room:"meet",zone:"wall",offsetX:28,offsetY:8,pictureColor:"#10B981"},{id:"meet-window",type:"window",room:"meet",zone:"wall",offsetX:80,offsetY:6,windowW:16,windowH:14},{id:"meet-shelf",type:"shelf",room:"meet",zone:"wall",offsetX:102,offsetY:18},{id:"comm-screen",type:"screen",room:"comm",zone:"wall",offsetX:6,offsetY:6,facility:{id:"decisions",label:"DECISIONS",icon:"📜",color:"#EF4444",hitW:16,hitH:12}},{id:"comm-picture",type:"picture",room:"comm",zone:"wall",offsetX:28,offsetY:8,pictureColor:"#d4956a"},{id:"comm-window",type:"window",room:"comm",zone:"wall",offsetX:76,offsetY:6,windowW:16,windowH:14},{id:"comm-clock",type:"clock",room:"comm",zone:"wall",offsetX:98,offsetY:10},{id:"comm-shelf",type:"shelf",room:"comm",zone:"wall",offsetX:108,offsetY:18}],I=[{id:"exec-bookshelf",type:"bookshelf",room:"exec",zone:"floor",offsetX:2,offsetY:4},{id:"exec-plant-r",type:"plant",room:"exec",zone:"floor",anchorX:"right",offsetX:-10,offsetY:4},{id:"exec-plant-c",type:"plant",room:"exec",zone:"floor",offsetX:Math.floor(d.fw/2),offsetY:4},{id:"work-plant-1",type:"plant",room:"work",zone:"floor",offsetX:36,offsetY:4},{id:"work-plant-2",type:"plant",room:"work",zone:"floor",offsetX:80,offsetY:4},{id:"meet-plant",type:"plant",room:"meet",zone:"floor",anchorX:"right",offsetX:-12,offsetY:4},{id:"meet-table",type:"meeting-table",room:"meet",zone:"floor",offsetX:10,offsetY:14,condition:"no-desks",facility:{id:"meeting",label:"MEETING",icon:"🏢",color:"#3B82F6",hitW:44,hitH:40}},{id:"comm-coffee-machine",type:"coffee-machine",room:"comm",zone:"floor",anchorX:"right",offsetX:-30,offsetY:4,condition:"no-desks"},{id:"comm-plant-1",type:"plant",room:"comm",zone:"floor",offsetX:38,offsetY:4,condition:"no-desks"},{id:"comm-bookshelf",type:"bookshelf",room:"comm",zone:"floor",anchorX:"right",offsetX:-26,offsetY:16,accent:"#10B981",condition:"no-desks",facility:{id:"knowledge",label:"KNOWLEDGE",icon:"📚",color:"#10B981",hitW:26,hitH:24}},{id:"comm-sofa",type:"sofa",room:"comm",zone:"floor",offsetX:44,offsetY:30,condition:"no-desks"},{id:"comm-coffee-table",type:"coffee-table",room:"comm",zone:"floor",offsetX:50,offsetY:50,condition:"no-desks"},{id:"comm-plant-2",type:"plant",room:"comm",zone:"floor",offsetX:38,offsetY:50,condition:"no-desks"}];return{preset:"L",canvasW:360,canvasH:260,rooms:y,desks:b,doors:A,adjacency:F,corridorY:_,waypoints:H,wallDecorations:M,furniture:I}}const xE=2;function Eg(t,l){return l?l==="L"&&t<=12-xE?"M":l==="M"&&t>12?"L":l:t<=12?"M":"L"}function Ng(t,l){switch(l??Eg(t)){case"S":return fE(t);case"M":return hE(t);case"L":return mE(t)}}function D0(t,l){if(!l||Object.keys(l).length===0)return t;const r=i=>i.map(c=>{const u=l[c.id];return u?{...c,offsetX:u.offsetX,offsetY:u.offsetY}:c});return{...t,wallDecorations:r(t.wallDecorations),furniture:r(t.furniture)}}function z0(t,l){if(l)for(const[r,i]of Object.entries(l))t[r]&&(t[r]={...t[r],dx:i.dx,dy:i.dy})}function zf(t,l){if(!l||l.length===0)return t;const r=new Set(l);return{...t,wallDecorations:t.wallDecorations.filter(i=>!r.has(i.id)),furniture:t.furniture.filter(i=>!r.has(i.id))}}function M0(t,l){if(!l||l.length===0)return t;const r=[],i=[];for(const c of l)c.zone==="wall"?r.push(c):i.push(c);return{...t,wallDecorations:[...t.wallDecorations,...r],furniture:[...t.furniture,...i]}}let Ns;function pE(t){Ns=t}function $(t,l,r,i,c,u){t=Math.round(t),l=Math.round(l),!(u!==void 0&&u<.01)&&(u!==void 0&&u!==1&&(Ns.globalAlpha=u),Ns.fillStyle=c,Ns.fillRect(t,l,r,i),u!==void 0&&u!==1&&(Ns.globalAlpha=1))}function it(t,l,r,i){$(t,l,1,1,r,i)}let wc=1;function vi(t){wc=t}function _l(){return wc=wc*16807%2147483647,(wc&65535)/65535}function Ag(t){const l=parseInt(t.slice(1,3),16)/255,r=parseInt(t.slice(3,5),16)/255,i=parseInt(t.slice(5,7),16)/255,c=Math.max(l,r,i),u=Math.min(l,r,i);let d=0,m=0;const x=(c+u)/2;if(c!==u){const f=c-u;m=x>.5?f/(2-c-u):f/(c+u),c===l?d=((r-i)/f+(r<i?6:0))/6:c===r?d=((i-l)/f+2)/6:d=((l-r)/f+4)/6}return[d*360,m*100,x*100]}function Tg(t,l,r){t=(t%360+360)%360,l=Math.max(0,Math.min(100,l))/100,r=Math.max(0,Math.min(100,r))/100;const i=l*Math.min(r,1-r),c=d=>{const m=(d+t/30)%12;return r-i*Math.max(-1,Math.min(m-3,9-m,1))},u=d=>Math.round(d*255).toString(16).padStart(2,"0");return"#"+u(c(0))+u(c(8))+u(c(4))}function Ol(t,l=1){const[r,i,c]=Ag(t);return Tg(r+15*l,Math.min(100,i+8),c-12*l)}function qt(t,l=1){const[r,i,c]=Ag(t);return Tg(r-10*l,i-3,c+10*l)}const on={hi:"#D4AA5C",base:"#B08040",sh:"#7A5038",deep:"#4E3028"},Rl={hi:"#8A6848",base:"#604832",sh:"#3A2E24",deep:"#2A1E18"},zl={hi:"#5A6A80",base:"#485868",sh:"#364858",deep:"#283848"},Wr="#100A06";function yE(t,l,r=14,i=12){$(t,l,r,i,"#4A3828"),$(t+1,l+1,r-2,i-2,"#5A4838"),$(t+2,l+2,r-4,i-4,"#4A7098"),$(t+2,l+2,r-4,Math.floor((i-4)/2),"#6A90B8",.35);const c=Math.floor(r/2);$(t+c,l+1,1,i-2,"#4A3828"),$(t+1,l+Math.floor(i/2),r-2,1,"#4A3828",.5),it(t+3,l+3,"#8AB8E8",.35),it(t+c+2,l+3,"#8AB8E8",.25),$(t-1,l+i,r+2,2,"#5A4838"),$(t-1,l+i,r+2,1,qt("#5A4838",.5),.35)}function gE(t,l,r){$(t,l,10,8,"#3A2818"),$(t+1,l+1,8,6,r),$(t+2,l+2,4,3,qt(r,1.2),.3),it(t+3,l+2,qt(r,2),.25)}function bE(t,l){$(t,l,7,7,"#3A2818"),$(t+1,l+1,5,5,"#F0EDE5"),it(t+3,l+1,"#AAA"),it(t+3,l+5,"#AAA"),it(t+1,l+3,"#AAA"),it(t+5,l+3,"#AAA"),it(t+3,l+3,"#222"),$(t+3,l+1,1,2,"#333"),it(t+4,l+3,"#D32F2F")}function vE(t,l){$(t,l,26,16,"#586878"),$(t+1,l+1,24,13,"#ECEFF1"),$(t+1,l+1,24,1,"#F5F5F5",.4),$(t+3,l+3,14,1,"#1565C0",.6),$(t+3,l+5,18,1,"#333",.2),$(t+3,l+7,12,1,"#D32F2F",.35),$(t+3,l+9,16,1,"#333",.15),$(t+1,l+14,24,2,"#708898"),$(t+3,l+14,3,1,"#D32F2F"),$(t+7,l+14,3,1,"#1565C0"),$(t+11,l+14,3,1,"#2E7D32")}function wE(t,l){$(t,l,22,16,"#6A5030"),$(t+1,l+1,20,14,"#C4A66A"),vi(88);for(let r=0;r<14;r++)for(let i=0;i<20;i++)_l()>.5&&it(t+1+i,l+1+r,_l()>.5?"#B89858":"#D4B87A",.18);$(t+2,l+2,5,4,"#FFF176"),$(t+8,l+2,5,4,"#90CAF9"),$(t+14,l+3,5,4,"#CE93D8"),$(t+3,l+8,7,4,"#C8E6C9"),$(t+11,l+8,8,4,"#F8BBD0"),it(t+4,l+2,"#E53935"),it(t+10,l+2,"#1E88E5"),it(t+16,l+3,"#FF9800")}function kE(t,l){$(t,l,20,3,"#5A4030"),$(t,l,20,1,qt("#5A4030",.5),.35),$(t,l+2,20,1,Ol("#5A4030",.5),.3),$(t+2,l-4,3,4,"#E53935"),$(t+2,l-4,3,1,qt("#E53935",1),.3),$(t+6,l-3,2,3,"#1E88E5"),$(t+9,l-5,4,5,"#43A047"),$(t+14,l-3,3,3,"#FFD54F"),it(t+15,l-3,"#FFF176",.4)}function jE(t,l){$(t,l,16,12,"#1E1E28"),$(t+1,l+1,14,9,"#0C1420"),$(t+2,l+2,12,1,"#EF4444",.6),it(t+2,l+4,"#4CAF50"),$(t+4,l+4,7,1,"#8b949e",.4),it(t+2,l+6,"#FF9800"),$(t+4,l+6,5,1,"#8b949e",.3),it(t+2,l+8,"#42A5F5"),$(t+4,l+8,8,1,"#8b949e",.25),$(t+7,l+10,2,2,"#1E1E28"),$(t+5,l+11,6,1,"#586878")}function SE(t,l,r){$(t+2,l+20,22,2,Wr,.15),$(t,l,22,20,Rl.deep),$(t+1,l+1,20,18,Rl.base),$(t,l,22,1,Rl.hi,.35),$(t,l,1,20,Rl.hi,.2);for(const u of[6,12])$(t+1,l+u,20,2,Rl.sh),$(t+1,l+u,20,1,Rl.hi,.2);const i=["#E53935","#1E88E5","#43A047","#8E24AA","#FB8C00","#00897B","#5C6BC0"];let c=t+2;for(let u=0;u<5;u++){const d=2+u%2;$(c,l+1,d,5,i[u]),$(c,l+1,d,1,qt(i[u],1),.35),c+=d+1}c=t+2;for(let u=0;u<4;u++)$(c,l+7,4,5,i[u+3]),$(c,l+7,4,1,qt(i[u+3],1),.25),c+=5;$(t+2,l+14,4,4,"#FFD54F"),$(t+8,l+14,7,4,"#90CAF9"),r&&$(t,l-1,22,1,r,.7)}function CE(t,l){$(t+2,l+11,6,2,Wr,.1),$(t+2,l+8,6,4,"#8B5E3C"),$(t+1,l+7,8,2,Ol("#A06E48",.3)),$(t+2,l+7,6,1,qt("#A06E48",.5),.4),$(t+1,l+3,3,4,"#2E7D32"),$(t+5,l+2,3,4,"#2E7D32"),$(t+2,l+1,4,4,"#43A047"),$(t+3,l+0,3,3,"#66BB6A"),it(t+4,l,"#81C784"),it(t+3,l+1,"#A5D6A7",.4)}function EE(t,l){ya(t+4,l-4,"down"),ya(t+16,l-4,"down"),ya(t+28,l-4,"down"),$(t+3,l+24,34,3,Wr,.15),$(t,l+2,36,18,on.deep),$(t+1,l+3,34,16,on.base),$(t+1,l+3,34,1,on.hi,.35);for(let r=0;r<14;r+=3)$(t+1,l+4+r,34,1,Ol(on.base,.2),.08);$(t,l+20,36,4,on.deep),$(t+1,l+21,34,2,on.sh),$(t+6,l+7,10,6,"#1A1A24"),$(t+7,l+8,8,4,"#0C1420"),$(t+8,l+9,4,1,"#2A6898",.4),$(t+20,l+8,6,4,"#F0F0F0"),$(t+15,l+7,3,3,"#ECEFF1"),it(t+16,l+8,"#795548"),ya(t+4,l+24,"up"),ya(t+16,l+24,"up"),ya(t+28,l+24,"up")}function NE(t,l){$(t+2,l+16,36,3,Wr,.15),$(t,l,36,5,"#5D4037"),$(t+1,l+1,34,3,"#6D4C41"),$(t+1,l+1,34,1,qt("#6D4C41",.5),.3),$(t,l+5,36,8,"#5D4037"),$(t+2,l+6,15,6,"#6D4C41"),$(t+3,l+6,13,1,qt("#6D4C41",.5),.35),$(t+19,l+6,15,6,"#6D4C41"),$(t+20,l+6,13,1,qt("#6D4C41",.5),.35),$(t+17,l+6,2,6,"#5D4037"),$(t,l+13,36,3,Ol("#5D4037",1)),$(t-2,l+2,3,12,"#5D4037"),$(t+35,l+2,3,12,"#5D4037"),$(t+4,l+7,6,4,"#FF8A65"),$(t+5,l+7,4,1,qt("#FF8A65",1),.35)}function AE(t,l){$(t+2,l+10,22,2,Wr,.12),$(t,l,22,8,Rl.deep),$(t+1,l+1,20,6,Rl.base),$(t+1,l+1,20,1,Rl.hi,.3),$(t,l+8,22,2,Rl.sh),$(t+3,l+2,6,4,"#F0F0F0"),$(t+13,l+3,3,3,"#ECEFF1"),it(t+14,l+4,"#795548")}function TE(t,l){$(t+1,l+14,10,2,Wr,.12),$(t,l,10,14,"#546E7A"),$(t,l,10,1,qt("#546E7A",1),.35),$(t+1,l+1,8,3,"#78909C"),$(t+1,l+5,8,4,"#37474F"),it(t+2,l+6,"#EF5350"),it(t+4,l+6,"#66BB6A"),$(t+2,l+11,4,2,"#ECEFF1")}function DE(t,l){$(t+2,l+16,26,3,Wr,.18),$(t,l,26,10,on.deep),$(t+1,l+1,24,8,on.base),$(t+1,l+2,24,1,on.hi,.2),$(t+1,l+4,24,1,Ol(on.base,.2),.1),$(t+1,l+6,24,1,on.hi,.15),$(t+1,l+1,24,1,on.hi,.4),$(t+1,l+1,1,8,on.hi,.2),$(t,l+10,26,5,on.deep),$(t+1,l+11,24,3,on.sh),$(t+1,l+10,24,1,Ol(on.base,1.5),.4),$(t+1,l+14,24,1,on.base,.15),$(t+2,l+12,10,1,on.deep,.4),$(t+14,l+12,10,1,on.deep,.4),it(t+7,l+11,"#C8D0D8",.6),it(t+19,l+11,"#C8D0D8",.6),$(t+6,l-5,14,7,"#1E1E28"),$(t+7,l-4,12,5,"#0C1420"),$(t+8,l-3,5,1,"#2A6898",.6),$(t+8,l-2,8,1,"#1A3858",.4),$(t+8,l-1,3,1,"#2A6898",.35),it(t+7,l-4,"#4A98D8",.25),it(t+12,l+1,"#4CAF50",.4),$(t+12,l+2,2,3,"#586878"),$(t+10,l+4,6,1,"#8898A8"),$(t+6,l+4,12,4,"#222228"),$(t+6,l+4,12,1,"#333338",.4);for(let r=0;r<5;r++)it(t+7+r*2,l+5,"#444",.6),it(t+7+r*2,l+6,"#3A3A3E",.4);$(t+20,l+5,3,4,"#333338"),$(t+20,l+5,3,1,"#444448"),$(t+1,l+3,4,4,"#F0EDE8"),$(t+1,l+3,4,1,"#F8F6F2"),it(t+2,l+5,"#6D4C41")}function ya(t,l,r){$(t+1,l+9,10,2,Wr,.1),it(t+5,l+9,"#1E1E22"),it(t+1,l+10,"#1A1A1E"),it(t+9,l+10,"#1A1A1E"),it(t+3,l+11,"#1A1A1E"),it(t+7,l+11,"#1A1A1E"),$(t+1,l+2,8,6,zl.base),$(t+2,l+3,6,4,zl.hi,.35),$(t+2,l+3,6,1,qt(zl.hi,.5),.25),$(t+1,l+7,8,1,zl.deep),r==="up"?($(t,l+7,10,3,zl.deep),$(t+1,l+8,8,1,zl.sh)):($(t,l-1,10,3,zl.deep),$(t+1,l,8,1,zl.sh)),$(t,l+3,1,4,zl.sh),$(t+9,l+3,1,4,zl.sh)}const Dg={bookshelf:(t,l,r)=>SE(t,l,r.accent),plant:(t,l)=>CE(t,l),"meeting-table":(t,l)=>EE(t,l),sofa:(t,l)=>NE(t,l),"coffee-table":(t,l)=>AE(t,l),"coffee-machine":(t,l)=>TE(t,l),window:(t,l,r)=>yE(t,l,r.windowW??16,r.windowH??14),picture:(t,l,r)=>gE(t,l,r.pictureColor??"#1565C0"),clock:(t,l)=>bE(t,l),whiteboard:(t,l)=>vE(t,l),"bulletin-board":(t,l)=>wE(t,l),shelf:(t,l)=>kE(t,l),screen:(t,l)=>jE(t,l)};function yi(t,l){const r=t.zone==="wall"?l.wx:l.fx,i=t.zone==="wall"?l.wy:l.fy;return{x:t.anchorX==="right"?(t.zone==="wall"?l.wx+l.ww:l.fx+l.fw)+t.offsetX:r+t.offsetX,y:i+t.offsetY}}function zE(t){for(const l of t.wallDecorations){const r=t.rooms[l.room];if(!r)continue;const{x:i,y:c}=yi(l,r),u=Dg[l.type];u&&u(i,c,l)}}function ME(t,l,r){for(const i of t.furniture){const c=t.rooms[i.room];if(!c||i.condition==="no-desks"&&r.has(i.room))continue;const{x:u,y:d}=yi(i,c),m=Dg[i.type];m&&l.push({y:d,draw:()=>m(u,d,i)})}}function qr(t){const l=[],r=[...t.wallDecorations,...t.furniture];for(const i of r){if(!i.facility)continue;const c=t.rooms[i.room];if(!c)continue;const{x:u,y:d}=yi(i,c);l.push({id:i.facility.id,label:i.facility.label,icon:i.facility.icon,color:i.facility.color,dx:u,dy:d,pw:i.facility.hitW,ph:i.facility.hitH})}return l}const FE={bookshelf:{w:22,h:20},plant:{w:10,h:12},"meeting-table":{w:36,h:28},sofa:{w:38,h:16},"coffee-table":{w:22,h:10},"coffee-machine":{w:10,h:14},window:{w:16,h:14},picture:{w:10,h:8},clock:{w:7,h:7},whiteboard:{w:26,h:16},"bulletin-board":{w:22,h:16},shelf:{w:20,h:8},screen:{w:16,h:12}};function th(t){return FE[t]??{w:16,h:16}}function Mf(t,l,r,i){for(let c=t.furniture.length-1;c>=0;c--){const u=t.furniture[c],d=t.rooms[u.room];if(!d||u.condition==="no-desks"&&i.has(u.room))continue;const{x:m,y:x}=yi(u,d),f=th(u.type);if(l>=m&&l<=m+f.w&&r>=x&&r<=x+f.h)return u.id}for(let c=t.wallDecorations.length-1;c>=0;c--){const u=t.wallDecorations[c],d=t.rooms[u.room];if(!d)continue;const{x:m,y:x}=yi(u,d),f=th(u.type);if(l>=m&&l<=m+f.w&&r>=x&&r<=x+f.h)return u.id}return null}function F0(t,l,r,i,c){const d=[...l.wallDecorations,...l.furniture].find(y=>y.id===r);if(!d||d.condition==="no-desks"&&c.has(d.room))return;const m=l.rooms[d.room];if(!m)return;const{x,y:f}=yi(d,m),g=th(d.type);t.save(),t.fillStyle=i,t.globalAlpha=.2,t.fillRect(x-1,f-1,g.w+2,g.h+2),t.globalAlpha=.9,t.strokeStyle=i,t.lineWidth=1,t.strokeRect(x-.5,f-.5,g.w+1,g.h+1),t.restore()}function R0(t,l,r,i){t.save(),t.fillStyle=i,t.globalAlpha=.2,t.fillRect(l-1,r-1,28,42),t.globalAlpha=.9,t.strokeStyle=i,t.lineWidth=1,t.strokeRect(l-.5,r-.5,27,41),t.restore()}function _0(t,l,r){for(const[i,c]of Object.entries(t))if(l>=c.dx&&l<=c.dx+26&&r>=c.dy&&r<=c.dy+40)return i;return null}const RE=[{type:"plant",zone:"floor",label:"Plant",icon:"🪴"},{type:"bookshelf",zone:"floor",label:"Bookshelf",icon:"📚"},{type:"sofa",zone:"floor",label:"Sofa",icon:"🛋️"},{type:"coffee-table",zone:"floor",label:"Coffee Table",icon:"☕"},{type:"coffee-machine",zone:"floor",label:"Coffee Machine",icon:"☕"},{type:"meeting-table",zone:"floor",label:"Meeting Table",icon:"🪑"},{type:"window",zone:"wall",label:"Window",icon:"🪟"},{type:"picture",zone:"wall",label:"Picture",icon:"🖼️"},{type:"clock",zone:"wall",label:"Clock",icon:"🕐"},{type:"whiteboard",zone:"wall",label:"Whiteboard",icon:"📋"},{type:"shelf",zone:"wall",label:"Shelf",icon:"📦"},{type:"screen",zone:"wall",label:"Screen",icon:"🖥️"}],mc=16,_E=4,pa=4,kc=2,wt=4,Xr=4;let $e=Ng(7);const Mc={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};let yl=qr($e);function zg(t){return{x:t.dx,y:t.dy,w:t.pw,h:t.ph}}function Mg(t){return{cx:t.dx+t.pw/2,botY:t.dy+t.ph}}let Gt={};function OE(t){const l={};for(let r=0;r<t.length&&r<$e.desks.length;r++)l[t[r]]=$e.desks[r];return l}let $t,va=null,ga=null,sr=!1,gl=null,Kn=null,wn=null,sn=null,ui=null,Ml=null;function BE(t,l){const{wx:r,wy:i,ww:c,wh:u,wallColor:d,baseboardColor:m}=t,x=Ol(d,.5),f=qt(d,.5),g=[];if(l){const y=l.x-r,b=l.w;y>0&&g.push({sx:r,sw:y}),y+b<c&&g.push({sx:l.x+b,sw:c-y-b})}else g.push({sx:r,sw:c});for(const y of g){$(y.sx,i,y.sw,u,d);for(let b=0;b<u;b+=4)$(y.sx,i+b,y.sw,1,f,.08),$(y.sx,i+b+2,y.sw,1,x,.05);vi(Math.round(y.sx*7+i*13));for(let b=0;b<y.sw;b+=3)_l()>.4&&$(y.sx+b,i,1,u,f,.04);$(y.sx,i,y.sw,2,f,.3),$(y.sx,i,y.sw,1,qt(d,1),.2),$(y.sx,i+u-2,y.sw,2,x,.3),$(y.sx,i+u,y.sw,kc,m),$(y.sx,i+u,y.sw,1,qt(m,.5),.4)}l&&($(l.x-1,i,1,u+kc,"#4A3828"),$(l.x+l.w,i,1,u+kc,"#4A3828"),$(l.x,i,l.w,1,"#0A0808",.12)),$(t.fx,t.fy,t.fw,3,"#0A0808",.12),$(t.fx,t.fy+3,t.fw,2,"#0A0808",.06)}function LE(t){const l="#504038",r=Ol(l,.5),i=qt(l,.5),c=t.wx-Xr,u=t.wy,d=t.wh+kc+t.fh;$(c,u,Xr,d,l),$(c,u,1,d,i,.3),$(c+Xr-1,u,1,d,r,.4);for(let x=0;x<d;x+=6)$(c+1,u+x,Xr-2,1,i,.06);const m=t.wx+t.ww;$(m,u,Xr,d,l),$(m,u,1,d,i,.2),$(m+Xr-1,u,1,d,r,.3)}function Ff(t){const{fx:l,fy:r,fw:i,fh:c}=t,u="#B08040",d="#C89848",m="#8A6030",x="#6A4820";$(l,r,i,c,u),vi(42);for(let f=0;f<c;f+=5){const g=Math.floor(f/5)%2*10;for(let y=-10;y<i+10;y+=20){const b=l+y+g,v=Math.max(l,b),S=Math.min(b+19,l+i)-v;if(S<=0)continue;const j=_l()>.5?d:u;$(v,r+f,S,4,j,.25),$(v,r+f,S,1,d,.3),$(v,r+f+4,S,1,x,.35),b>=l&&b<l+i&&$(b,r+f,1,4,x,.2),$(v,r+f+2,S,1,m,.1)}}$(l,r,i,2,"#0A0808",.08),$(l,r,2,c,"#0A0808",.06)}function O0(t){const{fx:l,fy:r,fw:i,fh:c}=t,u="#1C2A38",d="#101820";vi(99),$(l,r,i,c,u);for(let m=0;m<c;m+=mc)for(let x=0;x<i;x+=mc){const f=Math.min(mc,i-x),g=Math.min(mc,c-m);_l()>.5&&$(l+x,r+m,f,g,qt(u,.2),.15),$(l+x+2,r+m+2,f-4,g-4,qt(u,.3),.08),$(l+x,r+m,f,1,d,.5),$(l+x,r+m,1,g,d,.5),$(l+x+1,r+m+1,1,g-1,qt(u,.4),.1),_l()>.85&&it(l+x+4+Math.floor(_l()*8),r+m+4+Math.floor(_l()*8),"#3A6A9A",.08)}}function $E(t){const{fx:l,fy:r,fw:i,fh:c}=t,u="#387848",d="#4A9058",m="#285E38";$(l,r,i,c,u),vi(77);for(let f=0;f<c;f+=2)for(let g=0;g<i;g+=2)_l()>.5&&it(l+g,r+f,d,.1),_l()>.8&&it(l+g+1,r+f+1,m,.12);const x=5;$(l+x,r+x,i-x*2,1,d,.45),$(l+x,r+c-x-1,i-x*2,1,m,.45),$(l+x,r+x,1,c-x*2,d,.35),$(l+i-x-1,r+x,1,c-x*2,m,.35)}function HE(t){const{fx:l,fy:r,fw:i,fh:c}=t,u="#D8C490",d="#B09060",m="#907848";vi(55);for(let x=0;x<c;x+=8)for(let f=0;f<i;f+=8){const g=Math.min(8,i-f),y=Math.min(8,c-x),b=(f/8+x/8)%2===0?d:u;$(l+f,r+x,g,y,b),$(l+f+1,r+x+1,g-2,1,qt(b,.4),.2),$(l+f+1,r+x+1,1,y-2,qt(b,.4),.15),$(l+f+g-2,r+x+2,1,y-3,Ol(b,.4),.15),$(l+f+2,r+x+y-2,g-3,1,Ol(b,.4),.15),$(l+f,r+x,g,1,m,.3),$(l+f,r+x,1,y,m,.3)}}function UE(){const{canvasW:t,canvasH:l,rooms:r,doors:i}=$e,c="#2A1E14",u="#3A2E24";if($(0,0,t,pa,c),$(0,l-pa,t,pa,c),$(0,0,pa,l,c),$(t-pa,0,pa,l,c),$(0,0,t,1,u,.3),$(0,0,1,l,u,.2),!r.exec||!r.work||!r.meet||!r.comm)return;const d=r.exec,m=r.meet,x=t/2,f=x-wt/2,g=d.fy+d.fh,y=i.exec_work,b=i.meet_comm,v=i.exec_meet,S=i.work_comm,j=24,E=28,C=((y==null?void 0:y.doorY)??d.fy+20)-j/2,A=((v==null?void 0:v.doorX)??pa+Xr+54)-E/2,F=((S==null?void 0:S.doorX)??x+wt/2+Xr+54)-E/2,_=((b==null?void 0:b.doorY)??m.fy+20)-j/2;$(0,g,A,wt,c),$(A+E,g,f-A-E,wt,c),$(f+wt,g,F-f-wt,wt,c),$(F+E,g,t-F-E,wt,c),$(0,g,A,1,u,.3),$(A+E,g,f-A-E,1,u,.3),$(f+wt,g,F-f-wt,1,u,.3),$(F+E,g,t-F-E,1,u,.3),$(f,0,wt,C,c),$(f,C+j,wt,g-C-j,c),$(f,g+wt,wt,_-g-wt,c),$(f,_+j,wt,l-_-j,c),$(f,0,1,C,u,.2),$(f,C+j,1,g-C-j,u,.2),$(f,g+wt,1,_-g-wt,u,.2),$(f,_+j,1,l-_-j,u,.2),$(f,C,wt,j,"#C4A070"),$(f+wt/2,C,wt/2,j,"#3A4858"),$(f,_,wt,j,"#7AA880"),$(f+wt/2,_,wt/2,j,"#C8B890");const H="#4A3828";$(f,C-1,wt,1,H),$(f,C+j,wt,1,H),$(A-1,g,1,wt,H),$(A+E,g,1,wt,H),$(F-1,g,1,wt,H),$(F+E,g,1,wt,H),$(f,_-1,wt,1,H),$(f,_+j,wt,1,H)}const B0=new Map;function IE(t){const l=`${t.hairStyle??""}|${t.outfitStyle??""}|${t.accessory??""}`;let r=B0.get(l);if(!r){const i=Kf("mini-seated:default"),c=sg(i,t);r=c?c.layers.flatMap(u=>u.pixels):[],B0.set(l,r)}return r}function YE(t,l,r){Qf($t,IE(r),t,l,r)}function qE(t,l,r,i,c){ya(t+8,l+20,"up"),c||YE(t+8,l+0+i,r),DE(t,l+14)}function XE(t,l,r,i,c){const u=i in T0?i:"down",d=c%4,m=T0[u][d];Qf($t,m,t,l,r);const x=d===1||d===3?-1:0;if(r.accessory&&r.accessory!=="none"){const f=_j(r.accessory,u);f&&f.pixels.length>0&&Qf($t,f.pixels,t,l+x,r)}$t.globalAlpha=1}function VE(t){const l={};let r=0;for(const i of t){const c=Gt[i];c&&(l[i]={state:"sitting",homeX:c.dx+8,homeY:c.dy+34,homeRoom:c.room,x:c.dx+8,y:c.dy+34,path:[],room:c.room,dir:"down",walkFrame:0,walkTimer:0,bobY:0,bobOff:r*17,stateTimer:600+Math.floor(Math.random()*900)},r++)}return l}function zs(t,l,r,i,c){const u=$e.corridorY[c]??l,d=[];return l<u-4&&d.push({x:t,y:u}),Math.abs(t-r)>4&&d.push({x:r,y:u}),d.push({x:r,y:i}),d}function Rf(t,l,r,i){const c=$e.adjacency[r];if(!c)return[];const u=c.find(g=>g.room===i);if(!u)return[];const d=$e.doors[u.door];if(!d)return[];const m=[],x=$e.corridorY[r]??l,f=$e.corridorY[i]??l;if(Math.abs(l-x)>4&&m.push({x:t,y:x}),d.type==="v"){const g=u.side==="A"?d.xA:d.xB,y=u.side==="A"?d.xB:d.xA;m.push({x:g,y:x}),m.push({x:g,y:d.doorY}),m.push({x:y,y:d.doorY}),m.push({x:y,y:f})}else{const g=u.side==="A"?d.yA:d.yB,y=u.side==="A"?d.yB:d.yA;m.push({x:d.doorX,y:x}),m.push({x:d.doorX,y:g}),m.push({x:d.doorX,y}),m.push({x:d.doorX,y:f})}return m}function Fg(t,l){const r=$e.adjacency[t.room];if(!r)return[];if(!r.find(c=>c.room===l)){for(const c of r){const u=$e.adjacency[c.room];if(u!=null&&u.find(d=>d.room===l)){const d=Rf(t.x,t.y,t.room,c.room),m=d[d.length-1],x=Rf((m==null?void 0:m.x)??t.x,(m==null?void 0:m.y)??t.y,c.room,l);return[...d,...x]}}return[]}return Rf(t.x,t.y,t.room,l)}function GE(t){if(t.room!==t.homeRoom){const l=Fg({...t},t.homeRoom),r=l[l.length-1],i=zs((r==null?void 0:r.x)??t.x,(r==null?void 0:r.y)??t.y,t.homeX,t.homeY,t.homeRoom);return[...l,...i]}return zs(t.x,t.y,t.homeX,t.homeY,t.room)}function KE(t,l){for(const[,r]of Object.entries(t))if(r.stateTimer--,r.state==="sitting"){if(r.bobY=(l+r.bobOff)%60<30?1:0,r.stateTimer<=0){r.state="walking",r.x=r.homeX,r.y=r.homeY,r.room=r.homeRoom;const i=Object.keys($e.rooms);if(Math.random()<.25&&i.length>1){const c=i.filter(x=>x!==r.room),u=c[Math.floor(Math.random()*c.length)],d=Fg(r,u),m=$e.waypoints[u];if(m&&m.length>0){const x=m[Math.floor(Math.random()*m.length)],f=d[d.length-1]??{x:r.x,y:r.y},g=zs(f.x,f.y,x.x,x.y,u);r.path=[...d,...g]}else r.path=d;r.walkTimer=0}else{const c=$e.waypoints[r.room];if(c&&c.length>0){const u=c[Math.floor(Math.random()*c.length)];r.path=zs(r.x,r.y,u.x,u.y,r.room)}r.walkTimer=0}}}else if(r.state==="walking"||r.state==="returning"){if(r.path.length===0){r.state==="returning"?(r.state="sitting",r.room=r.homeRoom,r.stateTimer=800+Math.floor(Math.random()*1200)):(r.state="idle",r.dir="down",r.stateTimer=180+Math.floor(Math.random()*360));continue}const i=r.path[0],c=i.x-r.x,u=i.y-r.y,d=Math.sqrt(c*c+u*u);if(d<1.5){r.x=i.x,r.y=i.y,r.path.shift();for(const[m,x]of Object.entries($e.rooms))if(r.x>=x.fx&&r.x<=x.fx+x.fw&&r.y>=x.fy&&r.y<=x.fy+x.fh){r.room=m;break}}else r.x+=c/d*.2,r.y+=u/d*.2,Math.abs(c)>Math.abs(u)?r.dir=c>0?"right":"left":r.dir=u>0?"down":"up",r.walkTimer++,r.walkFrame=Math.floor(r.walkTimer/12)%4}else if(r.state==="idle"&&r.stateTimer<=0)if(Math.random()<.3){r.state="walking";const i=$e.waypoints[r.room];if(i&&i.length>0){const c=i[Math.floor(Math.random()*i.length)];r.path=zs(r.x,r.y,c.x,c.y,r.room)}r.walkTimer=0}else r.state="returning",r.path=GE(r),r.walkTimer=0}function QE(t,l,r){const{canvasW:i,canvasH:c,rooms:u}=$e;$t.clearRect(0,0,i,c),$(0,0,i,c,"#2A1E14");const d={wood:Ff,dark:O0,carpet:$E,tile:HE};for(const y of Object.values(u))(d[y.floorType]??Ff)(y);const m=Object.keys(u);if(m.length>=4){const y=u.exec,b=u.meet,{doors:v}=$e;if(y&&b&&v.exec_meet&&v.work_comm){const j=(v.exec_meet.doorX??0)-14,E=(v.work_comm.doorX??0)-28/2,C=y.fy+y.fh,A=b.fy;Ff({fx:j,fy:C,fw:28,fh:A-C}),O0({fx:E,fy:C,fw:28,fh:A-C})}}const x={};if(m.length>=4){const{doors:y}=$e,b=28,v=y.exec_meet,S=y.work_comm;v!=null&&v.doorX&&(x.meet={x:v.doorX-b/2,w:b}),S!=null&&S.doorX&&(x.comm={x:S.doorX-b/2,w:b})}for(const y of Object.values(u))BE(y,x[y.id]),LE(y);UE(),zE($e);const f=[],g=new Set(Object.values(Gt).map(y=>y.room));ME($e,f,g);for(const[y,b]of Object.entries(Gt)){const v=t[y];if(!v)continue;const S=v.state==="sitting",j=l(y),E=r[y]==="working";f.push({y:b.dy+14,draw:()=>{if(qE(b.dx,b.dy,j,S?v.bobY:0,!S),S&&E){const C=Mc[y]??"#388bfd";$(b.dx+7,b.dy+14-4,12,5,C,.15),it(b.dx+12,b.dy+14+1,"#4CAF50",.8)}}})}for(const[y,b]of Object.entries(t))if(b.state!=="sitting"){const v=l(y);f.push({y:b.y+14,draw:()=>XE(Math.round(b.x),Math.round(b.y),v,b.dir,b.walkFrame)})}f.sort((y,b)=>y.y-b.y);for(const y of f)y.draw();for(const y of yl){const b=ga===y.id,v=Mg(y);if($t.save(),$t.globalAlpha=b?.9:.5,$t.fillStyle=y.color,$t.fillRect(v.cx-1,v.botY-2,3,3),b){const S=zg(y);$t.globalAlpha=.3,$t.strokeStyle=y.color,$t.lineWidth=1,$t.strokeRect(S.x-1,S.y-1,S.w+2,S.h+2)}$t.restore()}if(sr){const y=new Set(Object.values(Gt).map(b=>b.room));if(gl&&gl!==Kn)if(gl.startsWith("desk:")){const b=gl.slice(5),v=Gt[b];v&&R0($t,v.dx,v.dy,"#FBBF24")}else F0($t,$e,gl,"#FBBF24",y);if(Kn)if(Kn.startsWith("desk:")){const b=Kn.slice(5),v=Gt[b];v&&R0($t,v.dx,v.dy,"#3B82F6")}else F0($t,$e,Kn,"#3B82F6",y)}if(va){const y=Gt[va],b=t[va];y&&b&&($t.save(),$t.globalAlpha=.25,$t.fillStyle=Mc[va]??"#fff",b.state==="sitting"?$t.fillRect(y.dx-1,y.dy+6,28,30):$t.fillRect(Math.round(b.x)-1,Math.round(b.y)-1,14,24),$t.restore())}}function WE({roles:t,projects:l,roleStatuses:r,activeExecs:i,onRoleClick:c,onProjectClick:u,onBulletinClick:d,onDecisionsClick:m,onKnowledgeClick:x,onSettingsClick:f,onThemeClick:g,onStatsClick:y,getRoleSpeech:b,getAppearance:v,onHireClick:S}){const j=k.useRef(null),E=k.useRef(null),C=k.useRef(null),A=k.useRef({}),F=k.useRef(0),_=k.useRef(_E),[H,M]=k.useState(!1),[I,W]=k.useState(null),[te,D]=k.useState(null),Y=k.useRef({}),B=k.useRef({}),V=k.useRef([]),ne=k.useRef([]);k.useEffect(()=>{sr=H},[H]),k.useEffect(()=>{ui=I,Ml=te},[I,te]),k.useEffect(()=>{Ce.getPreferences().then(me=>{const he=me.furnitureOverrides;he&&Object.keys(he).length>0&&(Y.current=he,$e=D0($e,he));const ge=me.deskOverrides;if(ge&&Object.keys(ge).length>0){B.current=ge,z0(Gt,ge);for(const[Ae,De]of Object.entries(Gt)){const je=A.current[Ae];je&&(je.homeX=De.dx+8,je.homeY=De.dy+34)}}const ke=me.removedFurniture;ke&&ke.length>0&&(V.current=ke,$e=zf($e,ke));const Fe=me.addedFurniture;Fe&&Fe.length>0&&(ne.current=Fe,$e=M0($e,Fe)),yl=qr($e)}).catch(()=>{})},[]);const G=k.useRef({roleStatuses:r,activeExecs:i,getRoleSpeech:b,getAppearance:v});G.current={roleStatuses:r,activeExecs:i,getRoleSpeech:b,getAppearance:v};const L=k.useMemo(()=>t.map(me=>me.id),[t]),Z=k.useRef($e);k.useEffect(()=>{const me=L.length,he=Eg(me,Z.current.preset);let ge=Ng(me,he);V.current.length>0&&(ge=zf(ge,V.current)),ne.current.length>0&&(ge=M0(ge,ne.current)),Object.keys(Y.current).length>0&&(ge=D0(ge,Y.current)),$e=ge,Z.current=ge,Gt=OE(L),Object.keys(B.current).length>0&&z0(Gt,B.current),yl=qr(ge),A.current=VE(L);const ke=j.current;ke&&(ke.width=ge.canvasW,ke.height=ge.canvasH),ue()},[L]);const de=k.useCallback(me=>{var he,ge;return((ge=(he=G.current).getAppearance)==null?void 0:ge.call(he,me))??Nh(me)},[]),ue=k.useCallback(()=>{const me=E.current,he=j.current;if(!me||!he)return;const ge=me.parentElement;if(!ge)return;const ke=ge.clientWidth,Fe=ge.clientHeight;if(ke===0||Fe===0)return;const{canvasW:Ae,canvasH:De}=$e;let je=Math.floor(Math.min(ke/Ae,Fe/De));je=Math.max(2,Math.min(je,5)),_.current=je,he.style.width=Ae*je+"px",he.style.height=De*je+"px",me.style.width=Ae*je+"px",me.style.height=De*je+"px"},[]);k.useEffect(()=>{var De;const me=j.current;if(!me)return;const he=me.getContext("2d");if(!he)return;$t=he,pE(he),ue();const ge=new ResizeObserver(()=>ue()),ke=(De=E.current)==null?void 0:De.parentElement;ke&&ge.observe(ke);let Fe;const Ae=()=>{F.current++,KE(A.current,F.current),QE(A.current,de,G.current.roleStatuses),z(),Fe=requestAnimationFrame(Ae)};return Fe=requestAnimationFrame(Ae),()=>{cancelAnimationFrame(Fe),ge.disconnect()}},[de,ue]),k.useEffect(()=>{const me=C.current;if(!me)return;me.innerHTML="";const he={};for(const ke of t)he[ke.id]=ke.name;for(const ke of L){const Fe=Mc[ke]??"#8b949e",Ae=he[ke],De=Ae&&Ae.toLowerCase()!==ke.toLowerCase()?`${ke.toUpperCase()} · ${Ae}`:ke.toUpperCase(),je=document.createElement("div");je.className="td-nametag",je.dataset.role=ke;const _e=document.createElement("span");_e.className="td-dot",_e.style.background=Fe,je.appendChild(_e),je.appendChild(document.createTextNode(De)),me.appendChild(je);const Ke=document.createElement("div");Ke.className="td-bubble",Ke.dataset.role=ke,Ke.dataset.type="bubble",me.appendChild(Ke)}const ge={meeting:()=>{const ke=l[0];ke?u(ke.id):d()},bulletin:d,decisions:m,knowledge:x,settings:f,theme:g,stats:y};for(const ke of yl){const Fe=document.createElement("div");Fe.className="td-facility-label",Fe.dataset.facility=ke.id,Fe.textContent=`${ke.icon} ${ke.label}`,Fe.style.borderColor=`${ke.color}44`;const Ae=ge[ke.id];Ae&&Fe.addEventListener("click",Ae),Fe.addEventListener("mouseenter",()=>{ga=ke.id}),Fe.addEventListener("mouseleave",()=>{ga=null}),me.appendChild(Fe)}},[L,t,l,u,d,m,x,f,g,y]);const z=k.useCallback(()=>{var De;const me=C.current;if(!me)return;const he=_.current,ge=A.current,{getRoleSpeech:ke,roleStatuses:Fe,activeExecs:Ae}=G.current;for(const je of Object.keys(ge)){const _e=ge[je],Ke=Gt[je];if(!Ke)continue;let Et,Ht,gt;_e.state==="sitting"?(Et=Ke.dx+13,gt=Ke.dy+2,Ht=Ke.dy+37):(Et=Math.round(_e.x)+6,gt=Math.round(_e.y)-2,Ht=Math.round(_e.y)+18);const Rt=Et/$e.canvasW*100,re=me.querySelector(`.td-nametag[data-role="${je}"]`);if(re){re.style.left=Rt+"%",re.style.top=Ht*he+2+"px";const Te=re.querySelector(".td-dot");if(Te){const Ye=Fe[je]==="working";Te.style.background=Ye?"#FBBF24":Mc[je]??"#8b949e",Ye?Te.style.animation="td-pulse 1s ease-in-out infinite":Te.style.animation=""}}const pe=me.querySelector(`.td-bubble[data-role="${je}"]`);if(pe){const Te=Fe[je]==="working",Ye=(De=Ae.find(ze=>ze.roleId===je))==null?void 0:De.task,xe=ke(je),q=Te&&Ye?Ye.slice(0,60):xe?xe.slice(0,60):"";q&&_e.state==="sitting"?(pe.style.display="",pe.style.left=Rt+"%",pe.style.top=(gt-10)*he+"px",pe.textContent=q):pe.style.display="none"}}for(const je of yl){const _e=me.querySelector(`.td-facility-label[data-facility="${je.id}"]`);if(_e){const Ke=Mg(je);_e.style.left=Ke.cx/$e.canvasW*100+"%",_e.style.top=Ke.botY*he-4+"px",_e.classList.toggle("td-facility-label--hover",ga===je.id)}}},[]),R=k.useCallback(me=>{const he=j.current;if(!he)return null;const ge=he.getBoundingClientRect(),ke=_.current,Fe=(me.clientX-ge.left)/ke,Ae=(me.clientY-ge.top)/ke,De=A.current;for(const[je,_e]of Object.entries(Gt)){if(!De[je])continue;const Ke=De[je];if(Ke.state==="sitting"){if(Fe>=_e.dx&&Fe<=_e.dx+26&&Ae>=_e.dy&&Ae<=_e.dy+40)return{type:"role",id:je}}else if(Fe>=Ke.x-2&&Fe<=Ke.x+14&&Ae>=Ke.y-2&&Ae<=Ke.y+20)return{type:"role",id:je}}for(const je of yl){const _e=zg(je);if(Fe>=_e.x&&Fe<=_e.x+_e.w&&Ae>=_e.y&&Ae<=_e.y+_e.h)return{type:"facility",id:je.id}}return null},[]),K=k.useCallback(me=>{const he=j.current;if(!he)return{mx:0,my:0};const ge=he.getBoundingClientRect(),ke=_.current;return{mx:(me.clientX-ge.left)/ke,my:(me.clientY-ge.top)/ke}},[]),T=k.useCallback(me=>{Ce.updatePreferences(me).catch(()=>{})},[]),fe=k.useCallback(me=>{const he=[...V.current,me];V.current=he,$e=zf($e,[me]),yl=qr($e),Kn=null,gl=null,T({removedFurniture:he})},[T]),Ee=k.useCallback((me,he)=>{if(!ui||!Ml)return;let ge=null;for(const[_e,Ke]of Object.entries($e.rooms)){const Et=Ml==="wall"?Ke.wx:Ke.fx,Ht=Ml==="wall"?Ke.wy:Ke.fy,gt=Ml==="wall"?Ke.ww:Ke.fw,Rt=Ml==="wall"?Ke.wh:Ke.fh;if(me>=Et&&me<=Et+gt&&he>=Ht&&he<=Ht+Rt){ge=_e;break}}if(!ge)return;const ke=$e.rooms[ge],Fe=Ml==="wall"?ke.wx:ke.fx,Ae=Ml==="wall"?ke.wy:ke.fy,De={id:`user-${ui}-${Date.now()}`,type:ui,room:ge,zone:Ml,offsetX:Math.round(me-Fe),offsetY:Math.round(he-Ae)},je=[...ne.current,De];ne.current=je,Ml==="wall"?$e.wallDecorations.push(De):$e.furniture.push(De),yl=qr($e),T({addedFurniture:je}),W(null),D(null)},[T]),Ne=k.useCallback(me=>{const he=j.current;if(sr&&wn){const{mx:ke,my:Fe}=K(me),De=[...$e.furniture,...$e.wallDecorations].find(Ke=>Ke.id===wn.defId);if(!De)return;const je=ke-wn.startMx,_e=Fe-wn.startMy;De.offsetX=Math.round(wn.origOffX+je),De.offsetY=Math.round(wn.origOffY+_e),yl=qr($e),he&&(he.style.cursor="grabbing");return}if(sr&&sn){const{mx:ke,my:Fe}=K(me),Ae=Gt[sn.roleId];if(!Ae)return;Ae.dx=Math.round(sn.origDx+(ke-sn.startMx)),Ae.dy=Math.round(sn.origDy+(Fe-sn.startMy));const De=A.current[sn.roleId];De&&(De.homeX=Ae.dx+8,De.homeY=Ae.dy+34),he&&(he.style.cursor="grabbing");return}if(sr){const{mx:ke,my:Fe}=K(me);if(ui){he&&(he.style.cursor="crosshair");return}const Ae=new Set(Object.values(Gt).map(je=>je.room)),De=Mf($e,ke,Fe,Ae);if(De)gl=De;else{const je=_0(Gt,ke,Fe);gl=je?`desk:${je}`:null}va=null,ga=null,he&&(he.style.cursor=gl?"grab":"default");return}const ge=R(me);va=(ge==null?void 0:ge.type)==="role"?ge.id:null,ga=(ge==null?void 0:ge.type)==="facility"?ge.id:null,gl=null,he&&(he.style.cursor=ge?"pointer":"default")},[R,K]),Le=k.useCallback(me=>{if(!sr)return;const{mx:he,my:ge}=K(me);if(ui){Ee(he,ge),me.preventDefault();return}const ke=new Set(Object.values(Gt).map(De=>De.room)),Fe=Mf($e,he,ge,ke);if(Fe){const je=[...$e.furniture,...$e.wallDecorations].find(_e=>_e.id===Fe);je&&(Kn=Fe,wn={defId:Fe,startMx:he,startMy:ge,origOffX:je.offsetX,origOffY:je.offsetY},me.preventDefault());return}const Ae=_0(Gt,he,ge);if(Ae){const De=Gt[Ae];Kn=`desk:${Ae}`,sn={roleId:Ae,startMx:he,startMy:ge,origDx:De.dx,origDy:De.dy},me.preventDefault();return}Kn=null},[K,Ee]),Be=k.useCallback(me=>{if(wn){const ge=[...$e.furniture,...$e.wallDecorations].find(ke=>ke.id===wn.defId);if(ge){const ke={...Y.current,[ge.id]:{offsetX:ge.offsetX,offsetY:ge.offsetY}};Y.current=ke,T({furnitureOverrides:ke}),yl=qr($e)}wn=null,j.current&&(j.current.style.cursor="grab");return}if(sn){const he=Gt[sn.roleId];if(he){const ge={...B.current,[sn.roleId]:{dx:he.dx,dy:he.dy}};B.current=ge,T({deskOverrides:ge})}sn=null,j.current&&(j.current.style.cursor="grab")}},[T]),Qe=k.useCallback(me=>{if(!sr)return;me.preventDefault();const{mx:he,my:ge}=K(me),ke=new Set(Object.values(Gt).map(Ae=>Ae.room)),Fe=Mf($e,he,ge,ke);Fe&&fe(Fe)},[K,fe]);k.useEffect(()=>{const me=he=>{!sr||!Kn||(he.key==="Delete"||he.key==="Backspace")&&(Kn.startsWith("desk:")||fe(Kn))};return window.addEventListener("keydown",me),()=>window.removeEventListener("keydown",me)},[fe]);const Se=k.useCallback(()=>{if(wn){const he=[...$e.furniture,...$e.wallDecorations].find(ge=>ge.id===wn.defId);he&&(he.offsetX=wn.origOffX,he.offsetY=wn.origOffY,yl=qr($e)),wn=null}if(sn){const me=Gt[sn.roleId];me&&(me.dx=sn.origDx,me.dy=sn.origDy);const he=A.current[sn.roleId];he&&(he.homeX=me.dx+8,he.homeY=me.dy+34),sn=null}va=null,ga=null,gl=null,j.current&&(j.current.style.cursor="default")},[]),tt=k.useCallback(me=>{if(sr)return;const he=R(me);if(he){if(he.type==="role"){c(he.id);return}switch(he.id){case"meeting":{const ge=l[0];ge?u(ge.id):d();break}case"bulletin":d();break;case"decisions":m();break;case"knowledge":x();break;case"settings":f==null||f();break;case"theme":g==null||g();break;case"stats":y==null||y();break}}},[R,c,u,d,m,x,f,g,y]);return s.jsxs("div",{className:`td-scene${H?" td-scene--editing":""}`,children:[s.jsxs("div",{ref:E,className:"td-wrap",children:[s.jsx("canvas",{ref:j,width:$e.canvasW,height:$e.canvasH,className:"td-canvas",onClick:tt,onMouseDown:Le,onMouseUp:Be,onMouseMove:Ne,onMouseLeave:Se,onContextMenu:Qe}),s.jsx("div",{ref:C,className:"td-overlay"})]}),H&&s.jsxs("div",{className:"td-edit-banner",children:[s.jsx("span",{className:"td-edit-banner__icon",children:"✎"})," EDIT MODE — Click DONE when finished"]}),s.jsxs("button",{className:`td-edit-btn${H?" td-edit-btn--active":""}`,onClick:()=>{M(me=>{const he=!me;return he||(W(null),D(null)),he}),Kn=null,wn=null,sn=null},title:H?"Exit Edit Mode":"Edit Furniture Layout",children:[s.jsx("span",{className:"td-edit-btn__icon",children:H?"✓":"✎"}),s.jsx("span",{className:"td-edit-btn__label",children:H?"DONE":"EDIT"})]}),H&&s.jsx("div",{className:"td-palette",children:RE.map(me=>s.jsx("button",{className:`td-palette__item${I===me.type?" td-palette__item--active":""}`,onClick:()=>{I===me.type?(W(null),D(null)):(W(me.type),D(me.zone))},title:me.label,children:s.jsx("span",{children:me.icon})},me.type))}),S&&s.jsxs("button",{className:"td-hire-btn",onClick:S,title:"Hire New Role",children:[s.jsx("span",{className:"td-hire-btn__icon",children:"+"}),s.jsx("span",{className:"td-hire-btn__label",children:"HIRE"})]})]})}function ZE({role:t,appearance:l,onSave:r,onReset:i,onClose:c,theme:u,onThemeChange:d,onUpdateName:m,initialTab:x,characterOnly:f,speechSettings:g,onSpeechSettingsChange:y,language:b,onLanguageChange:v,roleLevel:S}){var Y;const[j,E]=k.useState(x??"character"),[C,A]=k.useState({...l}),[F,_]=k.useState(t.name),[H,M]=k.useState(!1),I=k.useCallback(()=>A(fi(S)),[S]),W=k.useCallback(()=>{const B=Nh(t.id);A({...B}),i()},[t.id,i]),te=k.useCallback(async()=>{r(C);const B=F.trim();if(m&&B&&B!==t.name){M(!0);try{await m(t.id,B)}catch{}M(!1)}c()},[C,r,c,F,t.name,t.id,m]),D=s.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6},children:[s.jsxs("span",{children:[t.id.toUpperCase()," –"]}),m?s.jsx("input",{value:F,onChange:B=>_(B.target.value),disabled:H,className:"customize-name-input",style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.15)",borderRadius:4,color:"inherit",font:"inherit",padding:"2px 6px",flex:1,minWidth:0}}):s.jsx("span",{children:t.name})]});return s.jsx("div",{className:"customize-overlay",onClick:c,children:s.jsxs("div",{className:"customize-modal",onClick:B=>B.stopPropagation(),children:[s.jsxs("div",{className:"customize-header",children:[s.jsxs("div",{className:"customize-tabs",children:[s.jsx("button",{className:`customize-tab ${j==="character"?"active":""}`,onClick:()=>E("character"),children:"CHARACTER"}),!f&&s.jsxs(s.Fragment,{children:[s.jsx("button",{className:`customize-tab ${j==="office"?"active":""}`,onClick:()=>E("office"),children:"OFFICE THEME"}),s.jsx("button",{className:`customize-tab ${j==="settings"?"active":""}`,onClick:()=>E("settings"),children:"SETTINGS"})]})]}),s.jsx("button",{className:"customize-close",onClick:c,children:"X"})]}),j==="character"?s.jsx("div",{className:"customize-body",children:s.jsx(vg,{roleId:t.id,appearance:C,onChange:A,onRandomize:I,onReset:W,label:D,roleLevel:S})}):j==="office"?s.jsx("div",{className:"customize-body",children:s.jsx("div",{className:"customize-themes",children:Object.entries(Gr).map(([B,V])=>s.jsxs("button",{className:`customize-theme-card ${u===B?"active":""}`,onClick:()=>d(B),children:[s.jsxs("div",{className:"customize-theme-preview",style:{background:V.vars["--floor-light"],borderColor:V.vars["--pixel-border"]},children:[s.jsx("div",{style:{background:V.vars["--hud-bg"],height:8,borderBottom:`2px solid ${V.vars["--pixel-border"]}`}}),s.jsxs("div",{className:"flex-1 flex items-center justify-center gap-1 p-1",children:[s.jsx("div",{style:{width:10,height:14,background:V.vars["--accent"],borderRadius:1}}),s.jsx("div",{style:{width:10,height:14,background:V.vars["--active-green"],borderRadius:1}}),s.jsx("div",{style:{width:10,height:14,background:V.vars["--idle-amber"],borderRadius:1}})]}),s.jsx("div",{style:{background:V.vars["--hud-bg"],height:6,borderTop:`2px solid ${V.vars["--pixel-border"]}`}})]}),s.jsxs("div",{className:"customize-theme-name",children:[V.icon," ",V.name]})]},B))})}):s.jsx("div",{className:"customize-body",children:s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20,padding:"8px 0"},children:[s.jsxs("div",{children:[s.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"AMBIENT SPEECH MODE"}),s.jsx("div",{style:{display:"flex",gap:6},children:["template","llm","auto"].map(B=>s.jsxs("button",{onClick:()=>y==null?void 0:y({mode:B}),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(g==null?void 0:g.mode)===B?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(g==null?void 0:g.mode)===B?"rgba(255,255,255,0.08)":"transparent",color:(g==null?void 0:g.mode)===B?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center"},children:[s.jsx("div",{style:{fontWeight:600,marginBottom:2},children:B==="template"?"TEMPLATE":B==="llm"?"AI":"AUTO"}),s.jsx("div",{style:{fontSize:9,opacity:.7},children:B==="template"?"Static pool ($0)":B==="llm"?"LLM generated":"Detect engine"})]},B))}),s.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Auto: CLI Max = AI, BYOK = Template"})]}),s.jsxs("div",{children:[s.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["SPEECH INTERVAL: ",(g==null?void 0:g.intervalSec)??18,"s"]}),s.jsx("input",{type:"range",min:5,max:120,step:5,value:(g==null?void 0:g.intervalSec)??18,onChange:B=>y==null?void 0:y({intervalSec:Number(B.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[s.jsx("span",{children:"5s (frequent)"}),s.jsx("span",{children:"120s (rare)"})]})]}),(g==null?void 0:g.mode)!=="template"&&s.jsxs("div",{children:[s.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["DAILY LLM BUDGET: $",((Y=g==null?void 0:g.dailyBudgetUsd)==null?void 0:Y.toFixed(2))??"1.00"]}),s.jsx("input",{type:"range",min:0,max:5,step:.25,value:(g==null?void 0:g.dailyBudgetUsd)??1,onChange:B=>y==null?void 0:y({dailyBudgetUsd:Number(B.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[s.jsx("span",{children:"$0 (unlimited)"}),s.jsx("span",{children:"$5.00/day"})]})]}),s.jsxs("div",{children:[s.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"LANGUAGE"}),s.jsx("div",{style:{display:"flex",gap:6},children:[{key:"auto",label:"Auto"},{key:"en",label:"English"},{key:"ko",label:"한국어"},{key:"ja",label:"日本語"}].map(({key:B,label:V})=>s.jsx("button",{onClick:()=>v==null?void 0:v(B),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(b??"auto")===B?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(b??"auto")===B?"rgba(255,255,255,0.08)":"transparent",color:(b??"auto")===B?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center",fontWeight:600},children:V},B))}),s.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Sets language for AI responses and speech bubbles"})]})]})}),j==="character"&&s.jsxs("div",{className:"customize-footer",children:[s.jsx("button",{className:"customize-btn customize-btn--cancel",onClick:c,children:"CANCEL"}),s.jsx("button",{className:"customize-btn customize-btn--save",onClick:te,children:"SAVE"})]})]})})}function L0(t){if(t.length===0)return"";const l={};for(const{file:m}of t){const x=m.split("/"),f=x[0]==="."?x[1]??"root":x[0];(l[f]??(l[f]=[])).push(m)}const r={roles:"roles",projects:"projects",operations:"operations",knowledge:"knowledge",architecture:"architecture",company:"company",".tycono":"config",".claude":"skills"},i=[];for(const[m,x]of Object.entries(l)){const f=r[m]??m;if(x.length===1){const g=x[0].split("/").pop()??x[0];i.push(`${f}/${g}`)}else i.push(`${f} (${x.length} files)`)}const c=t.some(m=>m.status==="A"),u=t.some(m=>m.status==="M");return`${c&&!u?"add":"update"}: ${i.join(", ")}`}function $0(t){const l=Date.now()-new Date(t).getTime(),r=Math.floor(l/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const i=Math.floor(r/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function JE({status:t,history:l,onClose:r,onSave:i,onLoadHistory:c,onRestore:u,saving:d,onDelegate:m,delegateRoleName:x}){const[f,g]=k.useState("save"),[y,b]=k.useState(""),[v,S]=k.useState(null),[j,E]=k.useState(!1),[C,A]=k.useState(null),F=k.useRef(null);k.useEffect(()=>{f==="history"&&c()},[f,c]),k.useEffect(()=>{var D;(D=F.current)==null||D.focus()},[]);const _=[...((t==null?void 0:t.modified)??[]).map(D=>({status:"M",file:D})),...((t==null?void 0:t.untracked)??[]).map(D=>({status:"A",file:D}))],H=k.useRef(!1);k.useEffect(()=>{!H.current&&_.length>0&&!y&&(b(L0(_)),H.current=!0)},[_.length]);const M=k.useCallback(()=>{b(L0(_))},[_]),I=async()=>{S(null),A(null);try{const D=await i(y||void 0);A(D),b("")}catch(D){S(D instanceof Error?D.message:"Save failed")}},W=async D=>{if(confirm(`Restore from commit ${D.slice(0,7)}? This creates a new commit with those files.`)){E(!0);try{await u(D),E(!1)}catch(Y){S(Y instanceof Error?Y.message:"Restore failed"),E(!1)}}};k.useEffect(()=>{const D=Y=>{Y.key==="Escape"&&r()};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[r]);const te=D=>{D.key==="Enter"&&(D.metaKey||D.ctrlKey)&&I()};return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:r}),s.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[520px] max-h-[80vh] z-[61] overflow-hidden flex flex-col",style:{background:"var(--hud-bg)",border:"3px solid var(--pixel-border)",fontFamily:"var(--pixel-font)",color:"var(--terminal-text)"},onKeyDown:te,children:[s.jsxs("div",{className:"px-5 py-3 flex items-center justify-between shrink-0",style:{borderBottom:"2px solid var(--pixel-border)"},children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"text-lg font-black tracking-tight",children:"SAVE GAME"}),s.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-secondary)"},children:(t==null?void 0:t.branch)??""})]}),s.jsx("button",{onClick:r,className:"text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)] cursor-pointer text-lg",children:"×"})]}),s.jsx("div",{className:"flex shrink-0",style:{borderBottom:"2px solid var(--pixel-border)"},children:["save","history"].map(D=>s.jsx("button",{onClick:()=>g(D),className:"flex-1 py-2 text-[11px] font-bold uppercase tracking-wider cursor-pointer",style:{background:f===D?"var(--hud-bg-alt)":"transparent",color:f===D?"var(--terminal-text)":"var(--terminal-text-muted)",borderBottom:f===D?"2px solid var(--accent)":"2px solid transparent"},children:D==="save"?"SAVE":"HISTORY"},D))}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-5 space-y-4",children:[f==="save"&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"text-[11px]",style:{color:"var(--terminal-text-secondary)"},children:_.length>0?s.jsxs("span",{style:{color:"var(--idle-amber)"},children:["* ",_.length," unsaved change",_.length>1?"s":""]}):s.jsx("span",{style:{color:"var(--active-green)"},children:"All changes saved"})}),_.length>0&&s.jsxs("div",{children:[s.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:"Changed Files"}),s.jsx("div",{className:"text-[11px] max-h-[160px] overflow-y-auto p-2 space-y-0.5",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)"},children:_.map(({status:D,file:Y})=>s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{style:{color:D==="A"?"var(--active-green)":"var(--idle-amber)",width:"14px"},children:D}),s.jsx("span",{style:{color:"var(--terminal-text-secondary)"},children:Y})]},Y))})]}),_.length>0&&s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-muted)"},children:"Save Message"}),s.jsxs("button",{onClick:M,className:"text-[9px] px-1.5 py-0.5 cursor-pointer",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--accent)",fontFamily:"var(--pixel-font)"},title:"Auto-generate message from changes",children:["✨"," AUTO"]})]}),s.jsx("input",{ref:F,type:"text",value:y,onChange:D=>b(D.target.value),placeholder:"Auto-generated — edit if needed",className:"w-full px-3 py-2 text-[12px] outline-none",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)",fontFamily:"var(--pixel-font)"}})]}),_.length>0&&s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:I,disabled:d,className:"flex-1 py-2.5 text-[12px] font-black uppercase tracking-wider cursor-pointer disabled:opacity-50",style:{background:"var(--accent)",color:"#fff",border:"2px solid var(--accent)"},children:d?"SAVING...":t!=null&&t.hasRemote?"SAVE & PUSH":"SAVE"}),m&&s.jsxs("button",{onClick:()=>{const D=_.map(Y=>`${Y.status} ${Y.file}`).join(`
|
|
89
|
-
`);m(D)},disabled:d,className:"py-2.5 px-4 text-[11px] font-bold uppercase tracking-wider cursor-pointer disabled:opacity-50",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"2px solid var(--pixel-border)"},title:`Delegate to ${x??"AI role"} — they'll review, commit, push & merge`,children:["🤖"," ",(x==null?void 0:x.toUpperCase())??"DELEGATE"]})]}),_.length>0&&t&&!t.hasRemote&&s.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:"Local save only — add a git remote to enable push"}),C&&s.jsxs("div",{className:"text-[11px] p-2",style:{background:"rgba(59,185,80,0.1)",border:"1px solid var(--active-green)",color:"var(--active-green)"},children:["Saved! ",C.filesChanged," file",C.filesChanged>1?"s":""," committed",C.pushed?" & pushed":"",C.pushError?` (push error: ${C.pushError})`:""]}),v&&s.jsx("div",{className:"text-[11px] p-2",style:{background:"rgba(211,47,47,0.1)",border:"1px solid #D32F2F",color:"#EF5350"},children:v}),(t==null?void 0:t.lastCommit)&&s.jsxs("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:["Last save: ",t.lastCommit.message," (",$0(t.lastCommit.date),")"]})]}),f==="history"&&s.jsxs(s.Fragment,{children:[l.length===0&&s.jsx("div",{className:"text-[11px] text-center py-8",style:{color:"var(--terminal-text-muted)"},children:"No save history"}),s.jsx("div",{className:"space-y-1",children:l.map(D=>s.jsxs("div",{className:"flex items-center justify-between py-2 px-3 group",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-[11px] font-mono",style:{color:"var(--accent)"},children:D.shortSha}),s.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--terminal-text)"},children:D.message})]}),s.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:$0(D.date)})]}),s.jsx("button",{onClick:()=>W(D.sha),disabled:j,className:"text-[10px] font-bold px-2 py-1 opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--idle-amber)"},children:"LOAD"})]},D.sha))})]})]})]})]})}function PE({onClose:t}){const[l,r]=k.useState(null),[i,c]=k.useState(!0),[u,d]=k.useState(null);return k.useEffect(()=>{Ce.getCompanyStats().then(r).catch(m=>d(m.message)).finally(()=>c(!1))},[]),i?s.jsx("div",{style:{padding:24,color:"rgba(255,255,255,0.6)"},children:"Loading stats..."}):u||!l?s.jsxs("div",{style:{padding:24,color:"#ff6b6b"},children:[u||"Failed to load stats",s.jsx("button",{onClick:t,style:{marginLeft:12,color:"rgba(255,255,255,0.6)",background:"none",border:"none",cursor:"pointer"},children:"Close"})]}):s.jsxs("div",{style:{padding:20,color:"rgba(255,255,255,0.9)",maxHeight:"100%",overflowY:"auto"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:20},children:[s.jsx("h3",{style:{margin:0,fontSize:16,fontWeight:600},children:"Company Stats"}),s.jsx("button",{onClick:t,style:{background:"none",border:"none",color:"rgba(255,255,255,0.5)",cursor:"pointer",fontSize:18},children:"×"})]}),s.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10,marginBottom:20},children:[s.jsx(xc,{label:"Roles",value:String(l.company.roleCount)}),s.jsx(xc,{label:"Avg Level",value:`Lv.${l.company.avgLevel}`}),s.jsx(xc,{label:"Total Tokens",value:l.company.formattedTokens}),s.jsx(xc,{label:"Total Cost",value:`$${l.company.totalCostUsd.toFixed(2)}`})]}),s.jsx("h4",{style:{margin:"0 0 12px",fontSize:13,fontWeight:600,color:"rgba(255,255,255,0.6)",textTransform:"uppercase",letterSpacing:1},children:"Role Leaderboard"}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[l.roles.map((m,x)=>s.jsx(eN,{role:m,rank:x+1},m.roleId)),l.roles.length===0&&s.jsx("div",{style:{color:"rgba(255,255,255,0.4)",fontSize:13,padding:"8px 0"},children:"No role activity yet. Assign tasks to start leveling up!"})]}),Object.keys(l.byModel).length>0&&s.jsxs(s.Fragment,{children:[s.jsx("h4",{style:{margin:"20px 0 12px",fontSize:13,fontWeight:600,color:"rgba(255,255,255,0.6)",textTransform:"uppercase",letterSpacing:1},children:"Model Usage"}),s.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:Object.entries(l.byModel).map(([m,x])=>s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"6px 10px",background:"rgba(255,255,255,0.03)",borderRadius:6,fontSize:12},children:[s.jsx("span",{style:{color:"rgba(255,255,255,0.7)"},children:tN(m)}),s.jsxs("span",{style:{color:"rgba(255,255,255,0.5)"},children:["$",x.costUsd.toFixed(2)]})]},m))})]})]})}function xc({label:t,value:l}){return s.jsxs("div",{style:{padding:"12px 14px",background:"rgba(255,255,255,0.04)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)"},children:[s.jsx("div",{style:{fontSize:11,color:"rgba(255,255,255,0.45)",marginBottom:4},children:t}),s.jsx("div",{style:{fontSize:18,fontWeight:600},children:l})]})}function eN({role:t,rank:l}){const r=["🥇","🥈","🥉"],i=l<=3?r[l-1]:`#${l}`;return s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",background:"rgba(255,255,255,0.03)",borderRadius:8},children:[s.jsx("span",{style:{fontSize:14,width:28,textAlign:"center",flexShrink:0},children:i}),s.jsxs("div",{style:{flex:1,minWidth:0},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",marginBottom:4},children:[s.jsx("span",{style:{fontSize:13,fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.name}),s.jsxs("span",{style:{fontSize:12,color:H0(t.level),fontWeight:600,flexShrink:0,marginLeft:8},children:["Lv.",t.level]})]}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[s.jsx("div",{style:{flex:1,height:4,background:"rgba(255,255,255,0.08)",borderRadius:2,overflow:"hidden"},children:s.jsx("div",{style:{width:`${t.progress*100}%`,height:"100%",background:H0(t.level),borderRadius:2,transition:"width 0.3s ease"}})}),s.jsx("span",{style:{fontSize:10,color:"rgba(255,255,255,0.4)",flexShrink:0},children:t.formattedTokens})]})]})]})}function H0(t){return t>=9?"#FFD700":t>=7?"#C0A0FF":t>=5?"#4FC3F7":t>=3?"#81C784":"rgba(255,255,255,0.4)"}function tN(t){return t.includes("opus")?"Opus":t.includes("sonnet")?"Sonnet":t.includes("haiku")?"Haiku":t.split("-").slice(0,2).join(" ")}function nN({onClose:t,onSyncComplete:l}){const[r,i]=k.useState([]),[c,u]=k.useState([]),[d,m]=k.useState(!0),[x,f]=k.useState(null),[g,y]=k.useState(new Set),[b,v]=k.useState(null),[S,j]=k.useState(null),E=k.useCallback(async()=>{m(!0),v(null);try{const{roles:A}=await Ce.getSyncRoles();i(A);const F=A.filter(_=>_.source.sync!=="off");if(F.length===0){u([]),j(null);return}try{const _=await mi.syncCheck(F.map(M=>({roleId:M.roleId,sourceId:M.source.id,currentVersion:M.source.upstream_version??M.source.forked_at??"0.0.0"})));j(!0);const H=[];for(const M of _.updates){if(!M.hasUpdate)continue;const I=F.find(B=>B.roleId===M.roleId);if(!I)continue;const{character:W}=await mi.syncPull(M.sourceId),te=[];I.persona.trim()!==W.persona.trim()&&te.push({field:"persona",local:I.persona.slice(0,120)+(I.persona.length>120?"...":""),upstream:W.persona.slice(0,120)+(W.persona.length>120?"...":"")});const D=JSON.stringify(I.authority),Y=JSON.stringify(W.authority);D!==Y&&te.push({field:"authority",local:`${I.authority.autonomous.length} autonomous, ${I.authority.needsApproval.length} approval`,upstream:`${W.authority.autonomous.length} autonomous, ${W.authority.needsApproval.length} approval`}),te.length>0&&H.push({roleId:M.roleId,roleName:I.name,sourceId:M.sourceId,currentVersion:M.currentVersion,latestVersion:M.latestVersion,fields:te})}u(H)}catch{j(!1),u([])}}catch(A){v(A instanceof Error?A.message:"Failed to check for updates")}finally{m(!1)}},[]);k.useEffect(()=>{E()},[E]);const C=async A=>{f(A.roleId);try{const{character:F,version:_}=await mi.syncPull(A.sourceId);await Ce.applySyncUpdate({roleId:A.roleId,changes:{persona:F.persona,authority:F.authority},upstreamVersion:_}),y(H=>new Set(H).add(A.roleId)),l==null||l()}catch(F){v(F instanceof Error?F.message:"Failed to apply update")}finally{f(null)}};return s.jsxs("div",{style:{padding:20,color:"rgba(255,255,255,0.9)",maxHeight:"100%",overflowY:"auto"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[s.jsx("h3",{style:{margin:0,fontSize:16,fontWeight:600},children:"Role Sync"}),s.jsxs("div",{style:{display:"flex",gap:8},children:[s.jsx("button",{onClick:E,disabled:d,style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.1)",color:"rgba(255,255,255,0.7)",borderRadius:6,padding:"4px 10px",fontSize:12,cursor:d?"wait":"pointer"},children:d?"Checking...":"Refresh"}),s.jsx("button",{onClick:t,style:{background:"none",border:"none",color:"rgba(255,255,255,0.5)",cursor:"pointer",fontSize:18},children:"×"})]})]}),S===!1&&s.jsx("div",{style:{padding:"8px 12px",background:"rgba(255,180,0,0.1)",borderRadius:6,color:"#FFB74D",fontSize:12,marginBottom:12},children:"Cloud API unreachable. Sync requires connection to api.tycono.ai."}),b&&s.jsx("div",{style:{padding:"8px 12px",background:"rgba(255,100,100,0.1)",borderRadius:6,color:"#ff6b6b",fontSize:12,marginBottom:12},children:b}),s.jsxs("div",{style:{padding:"10px 14px",background:"rgba(255,255,255,0.04)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)",marginBottom:16,fontSize:13},children:[s.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Tracked roles: "}),s.jsx("span",{style:{fontWeight:500},children:r.length}),s.jsx("span",{style:{color:"rgba(255,255,255,0.3)",margin:"0 8px"},children:"·"}),s.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Updates available: "}),s.jsx("span",{style:{fontWeight:500,color:c.length>0?"#4FC3F7":"rgba(255,255,255,0.7)"},children:c.filter(A=>!g.has(A.roleId)).length}),S===!0&&s.jsxs(s.Fragment,{children:[s.jsx("span",{style:{color:"rgba(255,255,255,0.3)",margin:"0 8px"},children:"·"}),s.jsx("span",{style:{fontSize:11,color:"#81C784"},children:"Cloud connected"})]})]}),c.length===0&&!d&&s.jsx("div",{style:{color:"rgba(255,255,255,0.4)",fontSize:13,padding:"20px 0",textAlign:"center"},children:r.length===0?"No roles with source tracking. Hire from the Store to enable sync.":"All roles are up to date!"}),c.map(A=>s.jsxs("div",{style:{marginBottom:12,padding:14,background:"rgba(255,255,255,0.03)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:10},children:[s.jsxs("div",{children:[s.jsx("div",{style:{fontSize:14,fontWeight:500},children:A.roleName}),s.jsxs("div",{style:{fontSize:11,color:"rgba(255,255,255,0.4)"},children:[A.sourceId," · v",A.currentVersion," → v",A.latestVersion]})]}),g.has(A.roleId)?s.jsx("span",{style:{fontSize:12,color:"#81C784"},children:"Applied ✓"}):s.jsx("button",{onClick:()=>C(A),disabled:x===A.roleId,style:{background:"#1565C0",border:"none",color:"white",borderRadius:6,padding:"5px 12px",fontSize:12,cursor:x===A.roleId?"wait":"pointer",opacity:x===A.roleId?.6:1},children:x===A.roleId?"Applying...":"Apply Update"})]}),A.fields.map(F=>s.jsxs("div",{style:{marginBottom:6,fontSize:12},children:[s.jsx("div",{style:{color:"rgba(255,255,255,0.5)",marginBottom:2,textTransform:"uppercase",fontSize:10,letterSpacing:.5},children:F.field}),s.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:6},children:[s.jsxs("div",{style:{padding:"4px 8px",background:"rgba(255,100,100,0.08)",borderRadius:4,color:"rgba(255,255,255,0.6)"},children:[s.jsx("span",{style:{fontSize:9,color:"rgba(255,255,255,0.3)"},children:"LOCAL"}),s.jsx("br",{}),F.local]}),s.jsxs("div",{style:{padding:"4px 8px",background:"rgba(100,255,100,0.08)",borderRadius:4,color:"rgba(255,255,255,0.6)"},children:[s.jsx("span",{style:{fontSize:9,color:"rgba(255,255,255,0.3)"},children:"UPSTREAM"}),s.jsx("br",{}),F.upstream]})]})]},F.field))]},A.roleId)),r.length>0&&s.jsxs("div",{style:{marginTop:16,fontSize:11,color:"rgba(255,255,255,0.3)",lineHeight:1.5},children:["Roles hired from the Store are tracked automatically. Set ",s.jsx("code",{style:{background:"rgba(255,255,255,0.06)",padding:"1px 4px",borderRadius:3},children:"sync: off"})," in role.yaml to stop tracking."]})]})}function lN({onClose:t}){const[l,r]=k.useState(null),[i,c]=k.useState(!0),[u,d]=k.useState(null),[m,x]=k.useState(null),f=k.useCallback(async()=>{c(!0),d(null);try{const A=await Ce.getGitStatus();r(A)}catch(A){d(A instanceof Error?A.message:"Failed to load git status")}finally{c(!1)}},[]);k.useEffect(()=>{f()},[f]);const g=async A=>{x(A.path);try{await Ce.deleteWorktree(A.path),await f()}catch(F){d(F instanceof Error?F.message:"Failed to remove worktree")}finally{x(null)}},y=async A=>{x(A);try{await Ce.deleteBranch(A),await f()}catch(F){d(F instanceof Error?F.message:"Failed to delete branch")}finally{x(null)}};if(i&&!l)return s.jsx("div",{style:{padding:24,color:"rgba(255,255,255,0.6)"},children:"Loading git status..."});if(u&&!l)return s.jsxs("div",{style:{padding:24,color:"#ff6b6b"},children:[u,s.jsx("button",{onClick:t,style:{marginLeft:12,color:"rgba(255,255,255,0.6)",background:"none",border:"none",cursor:"pointer"},children:"Close"})]});if(!l)return null;const b=l.worktrees.filter(A=>A.status==="active"),v=l.worktrees.filter(A=>A.status==="pending-merge"),S=l.worktrees.filter(A=>A.status==="stale");function j(A){const F=A.split("/");if(F.length>1){const _=F[F.length-1],H=["cto","cbo","pm","engineer","designer","qa","data-analyst"];for(const M of H)if(_.toLowerCase().includes(M))return M}return null}function E(A,F=40){return A.length<=F?A:"..."+A.slice(A.length-F+3)}function C(A){const F=Date.now()-new Date(A).getTime(),_=Math.floor(F/6e4);if(_<1)return"just now";if(_<60)return`${_}m ago`;const H=Math.floor(_/60);return H<24?`${H}h ago`:`${Math.floor(H/24)}d ago`}return s.jsxs("div",{style:{padding:20,color:"rgba(255,255,255,0.9)",maxHeight:"100%",overflowY:"auto"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[s.jsx("h3",{style:{margin:0,fontSize:16,fontWeight:600},children:"GIT STATUS"}),s.jsxs("div",{style:{display:"flex",gap:8},children:[s.jsx("button",{onClick:f,disabled:i,style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.1)",color:"rgba(255,255,255,0.7)",borderRadius:6,padding:"4px 10px",fontSize:12,cursor:i?"wait":"pointer"},children:i?"Checking...":"Refresh"}),s.jsx("button",{onClick:t,style:{background:"none",border:"none",color:"rgba(255,255,255,0.5)",cursor:"pointer",fontSize:18},children:"×"})]})]}),u&&s.jsx("div",{style:{padding:"8px 12px",background:"rgba(255,100,100,0.1)",borderRadius:6,color:"#ff6b6b",fontSize:12,marginBottom:12},children:u}),s.jsxs("div",{style:{padding:"10px 14px",background:"rgba(255,255,255,0.04)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)",marginBottom:16,fontSize:13},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[s.jsxs("div",{children:[s.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Branch: "}),s.jsx("span",{style:{fontWeight:500},children:l.currentBranch})]}),s.jsx("div",{children:l.unsavedCount>0&&s.jsxs("span",{style:{color:"#FFB74D",fontSize:12},children:[l.unsavedCount," unsaved"]})})]}),l.lastCommit&&s.jsxs("div",{style:{marginTop:6,fontSize:11,color:"rgba(255,255,255,0.4)"},children:["Last commit: ",l.lastCommit.message.slice(0,60),l.lastCommit.message.length>60?"...":""," · ",C(l.lastCommit.date)]})]}),b.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(pc,{label:"Active Worktrees",count:b.length}),b.map(A=>s.jsx(_f,{wt:A,roleFromBranch:A.roleId||j(A.branch),truncatePath:E,timeAgo:C,removing:m===A.path,onRemove:()=>g(A),statusColor:"#4FC3F7",statusIcon:"📂"},A.path))]}),v.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(pc,{label:"Pending Merge",count:v.length}),v.map(A=>s.jsx(_f,{wt:A,roleFromBranch:A.roleId||j(A.branch),truncatePath:E,timeAgo:C,removing:m===A.path,onRemove:()=>g(A),statusColor:"#FFB74D",statusIcon:"⚠️"},A.path))]}),S.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(pc,{label:"Stale",count:S.length}),S.map(A=>s.jsx(_f,{wt:A,roleFromBranch:A.roleId||j(A.branch),truncatePath:E,timeAgo:C,removing:m===A.path,onRemove:()=>g(A),statusColor:"#ff6b6b",statusIcon:"🔴"},A.path))]}),l.staleBranches.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(pc,{label:"Unmerged Branches",count:l.staleBranches.length}),l.staleBranches.map(A=>s.jsxs("div",{style:{marginBottom:8,padding:"10px 14px",background:"rgba(255,255,255,0.03)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[s.jsxs("div",{style:{fontSize:13},children:[s.jsx("span",{style:{color:"rgba(255,255,255,0.5)",marginRight:6},children:"⚠️"}),s.jsx("span",{style:{fontWeight:500},children:A})]}),s.jsx("button",{onClick:()=>y(A),disabled:m===A,style:{background:"rgba(255,100,100,0.15)",border:"1px solid rgba(255,100,100,0.2)",color:"#ff6b6b",borderRadius:4,padding:"3px 8px",fontSize:10,cursor:m===A?"wait":"pointer",opacity:m===A?.6:1,fontWeight:600,textTransform:"uppercase",letterSpacing:.5},children:m===A?"...":"DELETE"})]},A))]}),b.length===0&&v.length===0&&S.length===0&&l.staleBranches.length===0&&s.jsxs("div",{style:{color:"rgba(255,255,255,0.4)",fontSize:13,padding:"20px 0",textAlign:"center"},children:["✓"," All clean. No active worktrees or stale branches."]}),l.lastMerge&&s.jsxs("div",{style:{marginTop:16,fontSize:11,color:"rgba(255,255,255,0.3)",lineHeight:1.5},children:["Last merge: ",s.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:l.lastMerge.branch})," · ",l.lastMerge.roleId," · ",C(l.lastMerge.mergedAt)]})]})}function pc({label:t,count:l}){return s.jsxs("h4",{style:{margin:"16px 0 8px",fontSize:11,fontWeight:600,color:"rgba(255,255,255,0.5)",textTransform:"uppercase",letterSpacing:1},children:[t," (",l,")"]})}function _f({wt:t,roleFromBranch:l,truncatePath:r,timeAgo:i,removing:c,onRemove:u,statusColor:d,statusIcon:m}){return s.jsx("div",{style:{marginBottom:8,padding:"10px 14px",background:"rgba(255,255,255,0.03)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)"},children:s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[s.jsxs("div",{style:{flex:1,minWidth:0},children:[s.jsxs("div",{style:{fontSize:13,fontWeight:500,marginBottom:2},children:[s.jsx("span",{style:{marginRight:6},children:m}),t.branch,l&&s.jsx("span",{style:{marginLeft:8,fontSize:10,padding:"1px 6px",background:"rgba(255,255,255,0.08)",borderRadius:3,color:"rgba(255,255,255,0.6)",textTransform:"uppercase"},children:l})]}),t.task&&s.jsxs("div",{style:{fontSize:11,color:"rgba(255,255,255,0.5)",marginBottom:2},children:['"',t.task.slice(0,50),t.task.length>50?"...":"",'"']}),s.jsxs("div",{style:{fontSize:10,color:"rgba(255,255,255,0.35)"},children:[r(t.path)," · ",t.filesChanged," file",t.filesChanged!==1?"s":""," changed"," · ",i(t.createdAt)]}),t.conflictFiles&&t.conflictFiles.length>0&&s.jsxs("div",{style:{fontSize:10,color:"#ff6b6b",marginTop:4},children:["⛔"," CONFLICT: ",t.conflictFiles.join(", ")]})]}),s.jsx("button",{onClick:u,disabled:c,style:{background:"rgba(255,100,100,0.15)",border:"1px solid rgba(255,100,100,0.2)",color:d,borderRadius:4,padding:"3px 8px",fontSize:10,cursor:c?"wait":"pointer",opacity:c?.6:1,fontWeight:600,textTransform:"uppercase",letterSpacing:.5,flexShrink:0,marginLeft:8},children:c?"...":"REMOVE"})]})})}function rN({onClose:t,speechSettings:l,onSpeechSettingsChange:r,language:i,onLanguageChange:c,onOpenSync:u,onOpenGitStatus:d,onOpenStats:m}){var x;return s.jsx("div",{className:"customize-overlay",onClick:t,children:s.jsxs("div",{className:"customize-modal",onClick:f=>f.stopPropagation(),style:{maxWidth:480},children:[s.jsxs("div",{className:"customize-header",children:[s.jsx("div",{style:{fontSize:12,fontWeight:700,letterSpacing:1,color:"var(--terminal-text)"},children:"SETTINGS"}),s.jsx("button",{className:"customize-close",onClick:t,children:"X"})]}),s.jsx("div",{className:"customize-body",style:{padding:"12px 20px 20px"},children:s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20},children:[s.jsxs("div",{children:[s.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"AMBIENT SPEECH MODE"}),s.jsx("div",{style:{display:"flex",gap:6},children:["template","llm","auto"].map(f=>s.jsxs("button",{onClick:()=>r==null?void 0:r({mode:f}),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(l==null?void 0:l.mode)===f?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(l==null?void 0:l.mode)===f?"rgba(255,255,255,0.08)":"transparent",color:(l==null?void 0:l.mode)===f?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center"},children:[s.jsx("div",{style:{fontWeight:600,marginBottom:2},children:f==="template"?"TEMPLATE":f==="llm"?"AI":"AUTO"}),s.jsx("div",{style:{fontSize:9,opacity:.7},children:f==="template"?"Static pool ($0)":f==="llm"?"LLM generated":"Detect engine"})]},f))}),s.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Auto: CLI Max = AI, BYOK = Template"})]}),s.jsxs("div",{children:[s.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["SPEECH INTERVAL: ",(l==null?void 0:l.intervalSec)??18,"s"]}),s.jsx("input",{type:"range",min:5,max:120,step:5,value:(l==null?void 0:l.intervalSec)??18,onChange:f=>r==null?void 0:r({intervalSec:Number(f.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[s.jsx("span",{children:"5s (frequent)"}),s.jsx("span",{children:"120s (rare)"})]})]}),(l==null?void 0:l.mode)!=="template"&&s.jsxs("div",{children:[s.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["DAILY LLM BUDGET: $",((x=l==null?void 0:l.dailyBudgetUsd)==null?void 0:x.toFixed(2))??"1.00"]}),s.jsx("input",{type:"range",min:0,max:5,step:.25,value:(l==null?void 0:l.dailyBudgetUsd)??1,onChange:f=>r==null?void 0:r({dailyBudgetUsd:Number(f.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[s.jsx("span",{children:"$0 (unlimited)"}),s.jsx("span",{children:"$5.00/day"})]})]}),s.jsxs("div",{children:[s.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"LANGUAGE"}),s.jsx("div",{style:{display:"flex",gap:6},children:[{key:"auto",label:"Auto"},{key:"en",label:"English"},{key:"ko",label:"한국어"},{key:"ja",label:"日本語"}].map(({key:f,label:g})=>s.jsx("button",{onClick:()=>c==null?void 0:c(f),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(i??"auto")===f?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(i??"auto")===f?"rgba(255,255,255,0.08)":"transparent",color:(i??"auto")===f?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center",fontWeight:600},children:g},f))}),s.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Sets language for AI responses and speech bubbles"})]}),s.jsxs("div",{style:{borderTop:"1px solid rgba(255,255,255,0.08)",paddingTop:16,display:"flex",gap:8},children:[u&&s.jsx("button",{onClick:()=>{t(),u()},className:"theme-btn",style:{flex:1,padding:"8px 12px",fontSize:10},children:"🔄 ROLE SYNC"}),d&&s.jsx("button",{onClick:()=>{t(),d()},className:"theme-btn",style:{flex:1,padding:"8px 12px",fontSize:10},children:"📂 GIT STATUS"}),m&&s.jsx("button",{onClick:()=>{t(),m()},className:"theme-btn",style:{flex:1,padding:"8px 12px",fontSize:10},children:"📊 COMPANY STATS"})]})]})})]})})}function aN({theme:t,onThemeChange:l,onClose:r}){const i=k.useRef(null);return k.useEffect(()=>{const c=u=>{i.current&&!i.current.contains(u.target)&&r()};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[r]),s.jsx("div",{ref:i,className:"theme-dropup",children:Object.entries(Gr).map(([c,u])=>s.jsxs("button",{className:`theme-dropup__item${t===c?" theme-dropup__item--active":""}`,onClick:()=>{l(c),r()},title:u.name,children:[s.jsxs("span",{className:"theme-dropup__swatch",style:{background:u.vars["--hud-bg"],borderColor:u.vars["--pixel-border"]},children:[s.jsx("span",{style:{background:u.vars["--accent"],width:5,height:5,borderRadius:1}}),s.jsx("span",{style:{background:u.vars["--active-green"],width:5,height:5,borderRadius:1}}),s.jsx("span",{style:{background:u.vars["--idle-amber"],width:5,height:5,borderRadius:1}})]}),s.jsx("span",{className:"theme-dropup__name",children:u.icon})]},c))})}const Fc=[0,1e4,5e4,15e4,4e5,1e6,25e5,5e6,1e7,25e6];function Rg(t){let l=1;for(let r=Fc.length-1;r>=0;r--)if(t>=Fc[r]){l=r+1;break}return Math.min(l,10)}function iN(t){const l=Rg(t);if(l>=10)return 1;const r=Fc[l-1],i=Fc[l];return Math.min(1,(t-r)/(i-r))}function U0(t){const l={};for(const[r,i]of Object.entries(t)){const c=i.inputTokens+i.outputTokens;l[r]={level:Rg(c),totalTokens:c,progress:iN(c)}}return l}const sN=[{id:"first-employee",name:"First Employee",icon:"🏆",description:"Hired your first role",check:t=>t.roleCount>=1},{id:"full-team",name:"Full Team",icon:"👥",description:"Hired 5+ roles",check:t=>t.roleCount>=5},{id:"token-10k",name:"Getting Started",icon:"📊",description:"Used 10K tokens total",check:t=>t.totalTokens>=1e4},{id:"token-100k",name:"Power User",icon:"💪",description:"Used 100K tokens total",check:t=>t.totalTokens>=1e5},{id:"token-millionaire",name:"Token Millionaire",icon:"🎖",description:"Used 1M tokens total",check:t=>t.totalTokens>=1e6},{id:"token-mogul",name:"Token Mogul",icon:"💎",description:"Used 10M tokens total",check:t=>t.totalTokens>=1e7},{id:"first-promotion",name:"First Promotion",icon:"⭐",description:"Any role reached Lv.3",check:t=>t.roles.some(l=>l.level>=3)},{id:"senior-staff",name:"Senior Staff",icon:"🌟",description:"Any role reached Lv.5",check:t=>t.roles.some(l=>l.level>=5)},{id:"master-class",name:"Master Class",icon:"👑",description:"Any role reached Lv.10",check:t=>t.roles.some(l=>l.level>=10)},{id:"full-house",name:"Full House",icon:"🏠",description:"All roles Lv.5+",check:t=>t.roleCount>=3&&t.roles.every(l=>l.level>=5)}];function I0(t){return sN.filter(l=>l.check(t))}const oN={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍","data-analyst":"📊"},jc={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},cN={cto:"아키텍처",cbo:"시장 분석",pm:"PRD 작성",engineer:"코딩",designer:"시안 제작",qa:"품질 검증"};function uN(t){let l=0;for(let i=0;i<t.length;i++)l=t.charCodeAt(i)+((l<<5)-l);return`hsl(${(l%360+360)%360}, 50%, 40%)`}function dN({importJob:t,onImportDone:l}){var ql,Ai,Ma;const[r,i]=k.useState([]),[c,u]=k.useState([]),[d,m]=k.useState([]),[x,f]=k.useState([]),[g,y]=k.useState([]),[b,v]=k.useState([]),[S,j]=k.useState("TYCONO"),[E,C]=k.useState(!0),[A,F]=k.useState(null),[_,H]=k.useState({type:"none"}),[M,I]=k.useState(null),[W,te]=k.useState(null),[D,Y]=k.useState([]),[B,V]=k.useState(!1),[ne,G]=k.useState([]),[L,Z]=k.useState(0),[de,ue]=k.useState(!1),[z,R]=k.useState({}),[K,T]=k.useState("ceo"),[fe,Ee]=k.useState(null),[Ne,Le]=k.useState(!1),[Be,Qe]=k.useState({}),Se=k.useRef({}),[tt,me]=k.useState(!1),[he,ge]=k.useState(null),[ke,Fe]=k.useState({}),[Ae,De]=k.useState([]),[je,_e]=k.useState([]),[Ke,Et]=k.useState(void 0),[Ht,gt]=k.useState(!1);k.useEffect(()=>{Ce.getStatus().then(O=>{Et(O.engine),gt(!!O.hasApiKey)}).catch(()=>{})},[]);const{getAppearance:Rt,setAppearance:re,resetAppearance:pe,theme:Te,setTheme:Ye,speechSettings:xe,setSpeechSettings:q,language:ze,setLanguage:He}=YC(),[Xe,ht]=k.useState(null),[,Pe]=k.useState("character"),We=XC(),[un,$l]=k.useState(!1),[ur,ol]=k.useState(!1),[dr,$n]=k.useState(!1),[fn,Wt]=k.useState(!1),[ve,Zt]=k.useState(!1),[Zr,cl]=k.useState(!1),[Wn,Ys]=k.useState(null);k.useEffect(()=>{const O=ae=>{(ae.metaKey||ae.ctrlKey)&&ae.key==="s"&&(ae.preventDefault(),We.dirtyCount>0&&$l(!0))};return window.addEventListener("keydown",O),()=>window.removeEventListener("keydown",O)},[We.dirtyCount]),k.useEffect(()=>{if(!fn)return;let O=!1;const ae=async()=>{try{const ye=await Ce.getGitStatus();O||Ys(ye)}catch{}};ae();const se=setInterval(ae,1e4);return()=>{O=!0,clearInterval(se)}},[fn]);const[Hl,Ca]=k.useState(null),[vl,wl]=k.useState(null),[Ul,wi]=k.useState([]),[Sn,Jt]=k.useState(!1),hn=k.useRef(!1),kl=k.useRef(null);let Ea=k.useRef(0);const qs=k.useRef(new Set),Il=(O,ae,se)=>{const ye={id:Ea.current++,type:O,text:ae,detail:se};wi(be=>[...be,ye])};k.useEffect(()=>{var O;Sn&&((O=kl.current)==null||O.scrollIntoView({behavior:"smooth"}))},[Ul,Sn]),k.useEffect(()=>{t&&(hn.current||(hn.current=!0,wl("Scanning knowledge sources..."),wi([{id:0,type:"scan",text:"Starting knowledge import..."}]),Ea.current=1,fetch("/api/setup/import-knowledge",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:t.paths,companyRoot:t.companyRoot})}).then(async O=>{var be;const ae=(be=O.body)==null?void 0:be.getReader();if(!ae)return;const se=new TextDecoder;let ye="";for(;;){const{done:Me,value:Ie}=await ae.read();if(Me)break;ye+=se.decode(Ie,{stream:!0});const nt=ye.split(`
|
|
90
|
-
`);ye=nt.pop()||"";let mt="";for(const Ze of nt)if(Ze.startsWith("event: "))mt=Ze.slice(7).trim();else if(Ze.startsWith("data: ")&&mt){try{const Ot=JSON.parse(Ze.slice(6));switch(mt){case"scanning":wl(`Scanning: ${Ot.path} (${Ot.fileCount} files)`),Il("scan",`Found ${Ot.fileCount} files`,Ot.path);break;case"processing":Ca({index:Ot.index,total:Ot.total}),wl(`Importing knowledge... (${Ot.index}/${Ot.total})`),Il("process",`Processing: ${Ot.file}`,`${Ot.index} / ${Ot.total}`);break;case"created":Il("created",Ot.title,Ot.summary);break;case"skipped":Il("process",`Skipped: ${Ot.file}`,Ot.reason);break;case"done":wl(null),Ca(null),Il("done",`Import complete! ${Ot.created} created, ${Ot.skipped} skipped.`),yt(`Knowledge import complete! ${Ot.created} documents imported.`,"#2E7D32"),l==null||l();break;case"error":wl(null),Ca(null),Il("error",Ot.message),yt(`Import failed: ${Ot.message}`,"#B71C1C"),l==null||l();break}}catch{}mt=""}}}).catch(O=>{wl(null),Il("error",O.message),yt(`Import error: ${O.message}`,"#B71C1C"),l==null||l()})))},[t]);const[Na,fr]=k.useState("iso"),[Aa,hr]=k.useState(typeof window<"u"?window.innerWidth:1200);k.useEffect(()=>{const O=()=>hr(window.innerWidth);return window.addEventListener("resize",O),()=>window.removeEventListener("resize",O)},[]);const jl=Aa<1024,[gn,Tn]=k.useState(!1),[Ut,Xs]=k.useState(560),[Yl,Yt]=k.useState([]),[ul,Zn]=k.useState(null),[mr,Ta]=k.useState(null),{sendMessage:Uc}=HC();k.useEffect(()=>{Promise.all([Ce.getCompany().then(O=>{j(O.name),i(O.roles)}),Ce.getOrgTree().then(O=>{R(O.nodes),T(O.root)}).catch(()=>{}),Ce.getCostSummary().then(O=>ki(U0(O.byRole))).catch(()=>{})]).catch(O=>F(`Failed to load: ${O.message}`)).finally(()=>C(!1)),Ce.getProjects().then(u).catch(()=>{}),Ce.getStandups().then(m).catch(()=>{}),Ce.getWaves().then(f).catch(()=>{}),Ce.getDecisions().then(y).catch(()=>{}),Ce.getKnowledge().then(v).catch(()=>{})},[]),k.useEffect(()=>{Ce.getSessions().then(O=>{if(O.length>0){const ae=O.map(ye=>({...ye,messages:[]}));Yt(ae);const se=ae.find(ye=>ye.status==="active")??ae[0];Zn(se.id),Tn(!0)}}).catch(O=>{console.error("Failed to load sessions",O)})},[]),k.useEffect(()=>{const O=()=>{fetch("/api/exec/status").then(se=>se.json()).then(se=>{Fe(se.statuses??{}),De(se.activeExecutions??[])}).catch(()=>{})};O();const ae=setInterval(O,3e3);return()=>clearInterval(ae)},[]);const Sl=k.useMemo(()=>{const O={...ke};if(mr){const ae=Yl.find(se=>se.id===mr);ae&&(O[ae.roleId]="working")}return O},[ke,mr,Yl]);k.useEffect(()=>{_.type==="role"?Ce.getRole(_.roleId).then(I).catch(console.error):I(null)},[_]);const Cl=()=>H({type:"none"}),dl=async(O,ae)=>{const se=r.find(be=>be.id===O),ye=(W==null?void 0:W.mode)==="ask";te(null);try{const{jobId:be}=await Ce.startJob({type:"assign",roleId:O,task:ae,readOnly:ye}),Me=jc[O]??"#666",Ie=`${O.toUpperCase()} · ${(se==null?void 0:se.name)??O}`;ue(!1),Y([{jobId:be,title:Ie,color:Me}]),Pt.pushMessage({ts:Date.now(),roleId:"ceo",text:`[CEO → ${(se==null?void 0:se.name)??O}] ${ye?"Ask":"Assign"}: ${ae}`,type:"dispatch",targetRoleId:O})}catch(be){yt(`Failed to start job: ${be instanceof Error?be.message:"unknown"}`,"#C62828")}},yt=(O,ae)=>{const se=Date.now();_e(ye=>[...ye,{id:se,message:O,color:ae}]),setTimeout(()=>_e(ye=>ye.filter(be=>be.id!==se)),4e3)},ki=O=>{var se,ye;const ae=Se.current;for(const[be,Me]of Object.entries(O)){const Ie=((se=ae[be])==null?void 0:se.level)??0;if(Ie>0&&Me.level>Ie){const nt=((ye=r.find(mt=>mt.id===be))==null?void 0:ye.name)??be.toUpperCase();yt(`${nt} leveled up to Lv.${Me.level}!`,"#7C3AED")}}Se.current=O,Qe(O)};k.useEffect(()=>{const O={roles:Object.entries(Be).map(([ye,be])=>({id:ye,level:be.level,totalTokens:be.totalTokens})),totalTokens:Object.values(Be).reduce((ye,be)=>ye+be.totalTokens,0),roleCount:r.length},ae=I0(O),se=qs.current;for(const ye of ae)se.has(ye.id)||se.size>0&&yt(`${ye.icon} Badge earned: ${ye.name}!`,"#D4A017");qs.current=new Set(ae.map(ye=>ye.id))},[Be,r.length]);const Ic=()=>{var ae;const O=D[D.length-1];O&&(yt(`${O.title} completed`,O.color),Pt.pushMessage({ts:Date.now(),roleId:((ae=O.title.split(" · ")[0])==null?void 0:ae.toLowerCase())??"unknown",text:`[${O.title}] Job completed`,type:"dispatch"})),Ce.getStandups().then(m).catch(console.error),Ce.getCompany().then(se=>i(se.roles)).catch(console.error),Ce.getCostSummary().then(se=>ki(U0(se.byRole))).catch(()=>{})},ji=async O=>{V(!1);try{const ae=await Ce.startJob({type:"wave",directive:O}),se=ae.jobIds??(ae.jobId?[ae.jobId]:[]),ye=r.filter(Me=>Me.level==="c-level"),be=se.map((Me,Ie)=>{var nt,mt;return{jobId:Me,roleId:((nt=ye[Ie])==null?void 0:nt.id)??`role-${Ie}`,roleName:((mt=ye[Ie])==null?void 0:mt.name)??`C-Level ${Ie+1}`}});Pt.pushMessage({ts:Date.now(),roleId:"ceo",text:`[CEO WAVE] "${O}" → ${be.map(Me=>Me.roleName).join(", ")}`,type:"dispatch"}),Object.keys(z).length>0?(Ee({directive:O,rootJobs:be}),Le(!1)):(G(be),Z(0),ue(!1),be.length>0&&Y([{jobId:be[0].jobId,title:`CEO WAVE · ${be[0].roleId.toUpperCase()}`,color:"#B71C1C"}]))}catch(ae){yt(`Failed to start wave: ${ae instanceof Error?ae.message:"unknown"}`,"#C62828")}},Si=()=>{Ce.getWaves().then(f).catch(console.error),Ce.getStandups().then(m).catch(console.error)},xr=()=>{Ce.getCompany().then(O=>i(O.roles)).catch(console.error)},Yc=async(O,ae)=>{await Ce.createRole(O),re(O.id,ae),xr(),yt(`${O.name} hired!`,"#2E7D32")},Dn=async O=>{await Ce.deleteRole(O),xr(),ge(null),yt(`${O.toUpperCase()} removed`,"#B71C1C")},Da=async(O,ae)=>{await Ce.updateRole(O,ae),xr(),_.type==="role"&&_.roleId===O&&Ce.getRole(O).then(I).catch(console.error),ae.name&&yt(`${O.toUpperCase()} renamed to "${ae.name}"`,"#1565C0")},Vs=O=>{Tn(!0)},Ci=async O=>{try{const ae=await Ce.createSession(O,"talk");Yt(se=>[ae,...se]),Zn(ae.id),Tn(!0)}catch(ae){console.error("Failed to create session",ae),yt(`Failed to create session: ${ae instanceof Error?ae.message:"API unreachable"}`,"#B71C1C")}},pr=async O=>{try{const ae=await Ce.createSession(O,"talk");Yt(se=>[ae,...se]),Zn(ae.id)}catch(ae){console.error("Failed to create session",ae),yt(`Failed to create session: ${ae instanceof Error?ae.message:"API unreachable"}`,"#B71C1C")}},Gs=async O=>{const ae=Ae.find(be=>be.roleId===O),se=(ae==null?void 0:ae.jobId)??(ae==null?void 0:ae.id);if(se&&Sl[O]==="working"){const be=r.find(nt=>nt.id===O),Me=jc[O]??"#666",Ie=`${O.toUpperCase()} · ${(be==null?void 0:be.name)??O}`;Y([{jobId:se,title:Ie,color:Me}]),ue(!1);return}const ye=Yl.find(be=>be.roleId===O);if(ye)Zn(ye.id),Pt.setActiveChannelId(null);else try{const be=await Ce.createSession(O,"talk");Yt(Me=>[be,...Me]),Zn(be.id),Pt.setActiveChannelId(null)}catch(be){console.error("Failed to create session",be)}Tn(!0)},Ks=async O=>{try{await Ce.deleteSession(O),Yt(ae=>{var ye;const se=ae.filter(be=>be.id!==O);return ul===O&&Zn(((ye=se[0])==null?void 0:ye.id)??null),se})}catch(ae){console.error("Failed to delete session",ae),yt(`Failed to close session: ${ae instanceof Error?ae.message:"API error"}`,"#B71C1C")}},yr=async()=>{try{const{ids:O}=await Ce.deleteEmptySessions();if(O.length===0)return;Yt(ae=>{var ye;const se=ae.filter(be=>!O.includes(be.id));return ul&&O.includes(ul)&&Zn(((ye=se[0])==null?void 0:ye.id)??null),se}),yt(`Cleared ${O.length} empty session${O.length!==1?"s":""}`,"#2E7D32")}catch(O){yt(`Failed to clear empty sessions: ${O instanceof Error?O.message:"API error"}`,"#B71C1C")}},qc=async()=>{if(!confirm("Close all sessions? This cannot be undone."))return;const O=Yl.map(ae=>ae.id);try{await Ce.deleteSessions(O),Yt([]),Zn(null),yt("All sessions closed","#2E7D32")}catch(ae){yt(`Failed to close sessions: ${ae instanceof Error?ae.message:"API error"}`,"#B71C1C")}},fl=(O,ae)=>{Yt(se=>se.map(ye=>{if(ye.id!==O)return ye;const be=[...ye.messages],Me=be[be.length-1];if(Me&&Me.from==="role"&&Me.status==="streaming"){const Ie=[...Me.streamEvents??[],ae];be[be.length-1]={...Me,streamEvents:Ie}}return{...ye,messages:be}}))},za=(O,ae,se)=>{const ye={id:`msg-${Date.now()}-ceo`,from:"ceo",content:ae,type:se==="do"?"directive":"conversation",status:"done",timestamp:new Date().toISOString()},be={id:`msg-${Date.now()+1}-role`,from:"role",content:"",type:"conversation",status:"streaming",timestamp:new Date().toISOString(),streamEvents:[]};Yt(Me=>Me.map(Ie=>Ie.id===O?{...Ie,messages:[...Ie.messages,ye,be],updatedAt:new Date().toISOString()}:Ie)),Ta(O),Uc(O,ae,se,{onThinking:Me=>{Yt(Ie=>Ie.map(nt=>{if(nt.id!==O)return nt;const mt=[...nt.messages],Ze=mt[mt.length-1];return Ze&&Ze.from==="role"&&Ze.status==="streaming"&&(mt[mt.length-1]={...Ze,thinking:(Ze.thinking??"")+Me}),{...nt,messages:mt}})),fl(O,{type:"thinking",timestamp:Date.now(),text:Me})},onText:Me=>{Yt(Ie=>Ie.map(nt=>{if(nt.id!==O)return nt;const mt=[...nt.messages],Ze=mt[mt.length-1];return Ze&&Ze.from==="role"&&Ze.status==="streaming"&&(mt[mt.length-1]={...Ze,content:Ze.content+Me}),{...nt,messages:mt}}))},onToolUse:(Me,Ie)=>{fl(O,{type:"tool",timestamp:Date.now(),toolName:Me,toolInput:Ie})},onDispatch:(Me,Ie)=>{fl(O,{type:"dispatch",timestamp:Date.now(),roleId:Me,task:Ie})},onDispatchProgress:(Me,Ie,nt)=>{var mt;Ie==="tool"?fl(O,{type:"dispatch:progress",timestamp:Date.now(),roleId:Me,progressType:"tool",toolName:nt.name,toolInput:nt.input}):Ie==="thinking"?fl(O,{type:"dispatch:progress",timestamp:Date.now(),roleId:Me,progressType:"thinking",text:nt.text}):Ie==="text"?fl(O,{type:"dispatch:progress",timestamp:Date.now(),roleId:Me,progressType:"text",text:(mt=nt.text)==null?void 0:mt.slice(-200)}):(Ie==="done"||Ie==="error")&&fl(O,{type:"dispatch:progress",timestamp:Date.now(),roleId:Me,progressType:Ie})},onTurn:Me=>{fl(O,{type:"turn",timestamp:Date.now(),turn:Me})},onDone:()=>{Yt(Me=>Me.map(Ie=>{if(Ie.id!==O)return Ie;const nt=Ie.messages.map(Ze=>Ze.status==="streaming"?{...Ze,status:"done"}:Ze),mt=Ie.messages.length<=2?ae.slice(0,40).replace(/\n/g," "):Ie.title;return{...Ie,messages:nt,title:mt}})),Ta(null)},onError:Me=>{Yt(Ie=>Ie.map(nt=>{if(nt.id!==O)return nt;const mt=nt.messages.map(Ze=>Ze.status==="streaming"?{...Ze,status:"error",content:Ze.content||Me}:Ze);return{...nt,messages:mt}})),Ta(null)}})},Ei=(O,ae)=>{Yt(se=>se.map(ye=>ye.id===O?{...ye,mode:ae}:ye)),Ce.updateSession(O,{mode:ae}).catch(console.error)},Xc=new Date().toISOString().slice(0,10),El=c[0],Jr={cto:"Chief Technology Officer",cbo:"Chief Business Officer",pm:"Product Manager",engineer:"Software Engineer",designer:"UI/UX Designer",qa:"QA Engineer"},hl=O=>{const ae=Jr[O];if(!ae)return"";for(const se of d){const ye=se.content,be=ye.indexOf(`## ${ae}`);if(be===-1)continue;const Me=ye.indexOf(`
|
|
86
|
+
VP Marketing, c-level, ceo`,className:"w-full h-40 p-3 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 placeholder-white/25 resize-none focus:outline-none focus:border-white/25 transition-colors font-mono"}),s.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"Format: Name, Level (member/team-lead/c-level), ReportsTo. Level and ReportsTo are optional."})]}),je.length>0&&s.jsxs("div",{children:[s.jsxs("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:["Preview (",je.length," role",je.length!==1?"s":"",")"]}),s.jsx("div",{className:"bg-white/5 rounded-lg border border-white/10 overflow-hidden",children:s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-white/10",children:[s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Name"}),s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"ID"}),s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Level"}),s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Reports To"})]})}),s.jsx("tbody",{children:je.map((q,ze)=>s.jsxs("tr",{className:`border-b border-white/5 ${q.error?"bg-red-900/10":""}`,children:[s.jsx("td",{className:"p-2 text-white/80",children:q.name}),s.jsx("td",{className:"p-2 text-white/60 font-mono",children:q.id}),s.jsx("td",{className:"p-2 text-white/60",children:q.level}),s.jsx("td",{className:"p-2 text-white/60",children:q.reportsTo}),q.error&&s.jsx("td",{className:"p-2 text-red-400 text-[10px]",children:q.error})]},ze))})]})})]})]}),tt==="review"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:["Confirm Bulk Hire — ",je.length," roles"]}),s.jsx("div",{className:"bg-white/5 rounded-lg border border-white/10 overflow-hidden max-h-[300px] overflow-y-auto",children:s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{className:"sticky top-0 bg-[var(--wall)]",children:s.jsxs("tr",{className:"border-b border-white/10",children:[s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"#"}),s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Name"}),s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"ID"}),s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Level"}),s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Reports To"})]})}),s.jsx("tbody",{children:je.map((q,ze)=>s.jsxs("tr",{className:"border-b border-white/5",children:[s.jsx("td",{className:"p-2 text-white/30",children:ze+1}),s.jsx("td",{className:"p-2 text-white/80",children:q.name}),s.jsx("td",{className:"p-2 text-white/60 font-mono",children:q.id}),s.jsx("td",{className:"p-2 text-white/60",children:q.level}),s.jsx("td",{className:"p-2 text-white/60",children:q.reportsTo})]},ze))})]})}),R&&he.total>0&&s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between text-[10px] text-white/40 mb-1",children:[s.jsx("span",{children:"Hiring..."}),s.jsxs("span",{children:[he.done,"/",he.total]})]}),s.jsx("div",{className:"h-1.5 bg-white/10 rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${he.done/he.total*100}%`,background:"#2E7D32"}})})]}),s.jsx("div",{className:"text-[10px] text-white/30",children:"Each role will get a random appearance and auto-generated persona. You can customize them later."}),T&&s.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 p-2 rounded-lg border border-red-800/30",children:T})]})]})}),s.jsxs("div",{className:"flex justify-between px-5 pb-5",children:[s.jsxs("div",{children:[i==="single"&&H>1&&s.jsx("button",{onClick:()=>M(H-1),className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer",children:"Back"}),i==="bulk"&&tt==="review"&&s.jsx("button",{onClick:()=>me("input"),disabled:R,className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer disabled:opacity-40",children:"Back"}),i==="store"&&v==="review"&&s.jsx("button",{onClick:()=>{S("input"),x(null),fe("")},disabled:R,className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer disabled:opacity-40",children:"Back"})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsx("button",{onClick:l,className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer",children:"Cancel"}),i==="single"?H<js?s.jsx("button",{onClick:()=>M(H+1),disabled:!Rt(H),className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#2E7D32"},children:"Next"}):s.jsx("button",{onClick:gt,disabled:R,className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#2E7D32"},children:R?"Hiring...":"HIRE"}):i==="bulk"?tt==="input"?s.jsxs("button",{onClick:()=>me("review"),disabled:!_e,className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#2E7D32"},children:["Review (",je.length,")"]}):s.jsx("button",{onClick:re,disabled:R,className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#2E7D32"},children:R?`Hiring ${he.done}/${he.total}...`:`HIRE ALL (${je.length})`}):v==="review"?s.jsx("button",{onClick:Te,disabled:R||!j.trim()||!C.trim()||t.some(q=>q.id===C),className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#2E7D32"},children:R?"Hiring...":"HIRE"}):null]})]})]})]})}function Ss({label:t,value:l,mono:r}){return s.jsxs("div",{className:"flex justify-between text-sm",children:[s.jsx("span",{className:"text-white/40",children:t}),s.jsx("span",{className:`font-semibold text-white/80 ${r?"font-mono":""}`,children:l})]})}function wC({roleId:t,roleName:l,onClose:r,onConfirm:i}){const[c,u]=k.useState(!1),d=async()=>{u(!0);try{await i(t)}finally{u(!1)}};return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:r}),s.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[480px] z-[61] bg-[var(--wall)] rounded-2xl shadow-2xl overflow-hidden",children:[s.jsxs("div",{className:"p-5 text-white",style:{background:"linear-gradient(135deg, #B71C1C, #D32F2F)"},children:[s.jsx("div",{className:"text-lg font-bold",children:"Fire Role"}),s.jsxs("div",{className:"text-sm opacity-80 mt-0.5",children:["Remove ",l," (",t,")"]})]}),s.jsxs("div",{className:"p-5",children:[s.jsxs("div",{className:"p-4 rounded-lg border-2 border-red-300 bg-red-50 mb-4",children:[s.jsx("div",{className:"text-sm font-bold text-red-800 mb-1",children:"Warning"}),s.jsxs("div",{className:"text-xs text-red-700 leading-relaxed",children:["This will permanently delete the role directory including",s.jsx("strong",{children:" role.yaml"}),", ",s.jsx("strong",{children:"profile.md"}),", ",s.jsx("strong",{children:"SKILL.md"}),", and all journal entries. This action cannot be undone."]})]}),s.jsxs("div",{className:"text-sm text-gray-600",children:["Are you sure you want to fire ",s.jsx("strong",{children:l}),"?"]})]}),s.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[s.jsx("button",{onClick:r,className:"px-4 py-2 text-sm rounded-lg border border-gray-300 hover:bg-gray-50 cursor-pointer",children:"Cancel"}),s.jsx("button",{onClick:d,disabled:c,className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#B71C1C"},children:c?"Removing...":"Confirm Fire"})]})]})]})}const kC={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"};function jC({roleId:t,title:l,roleColor:r,active:i,onClick:c,onClose:u,"data-session-id":d}){return s.jsxs("button",{onClick:c,"data-session-id":d,className:`flex items-center gap-1.5 px-3 py-1.5 text-[11px] rounded-t-lg shrink-0 cursor-pointer transition-colors max-w-[180px] group ${i?"bg-[var(--terminal-bg)] text-[var(--terminal-text)]":"bg-[var(--terminal-inline-bg)] text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)] hover:bg-[var(--terminal-surface)]"}`,style:i?{borderTop:`2px solid ${r}`}:void 0,children:[s.jsx("span",{className:"text-xs",children:kC[t]??"👤"}),s.jsx("span",{className:"truncate",children:l}),s.jsx("span",{onClick:u,className:"ml-auto text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-sm leading-none",children:"×"})]})}function SC({content:t,streaming:l}){let r=t;return l&&(t.match(/```/g)??[]).length%2!==0&&(r+="\n```"),s.jsx("div",{className:"terminal-markdown",children:s.jsx(gh,{remarkPlugins:[kh],components:{code:CC,table:({children:i})=>s.jsx("div",{className:"overflow-x-auto my-2",children:s.jsx("table",{className:"terminal-table",children:i})})},children:r})})}function CC({className:t,children:l,...r}){const i=/language-(\w+)/.exec(t??"");return i||typeof l=="string"&&l.includes(`
|
|
87
|
+
`)?s.jsx(EC,{language:i==null?void 0:i[1],children:l}):s.jsx("code",{className:"terminal-inline-code",...r,children:l})}function EC({children:t,language:l}){const[r,i]=k.useState(!1),c=String(t).replace(/\n$/,""),u=()=>{navigator.clipboard.writeText(c),i(!0),setTimeout(()=>i(!1),1500)};return s.jsxs("div",{className:"terminal-code-block group relative my-2",children:[l&&s.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] px-3 pt-1.5",children:l}),s.jsx("button",{onClick:u,className:"absolute top-1.5 right-2 text-[10px] text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",children:r?"Copied!":"Copy"}),s.jsx("pre",{className:"overflow-x-auto p-3 text-xs leading-relaxed",children:s.jsx("code",{children:c})})]})}const NC={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"};function Cf(t,l){return l?l.file_path?String(l.file_path).replace(/^.*\/(?=[^/]+\/)/,""):l.path?String(l.path).replace(/^.*\/(?=[^/]+\/)/,""):l.pattern?String(l.pattern):l.command?String(l.command).slice(0,60):l.query?String(l.query).slice(0,60):l.url?String(l.url).slice(0,60):"":""}function AC(t){const l=[];let r="";for(const i of t)if(i.type==="thinking")i.text&&(r=i.text),l.length===0||l[l.length-1].type!=="thinking"?l.push({type:"thinking",text:i.text}):l[l.length-1].text=i.text;else if(i.type==="tool")l.push({type:"tool",toolName:i.toolName,toolSummary:Cf(i.toolName??"",i.toolInput),toolInput:i.toolInput});else if(i.type==="dispatch")l.push({type:"dispatch",roleId:i.roleId,task:i.task});else if(i.type==="dispatch:progress"){const c=l.length>0?l[l.length-1]:null;(c==null?void 0:c.type)==="dispatch:progress"&&c.roleId===i.roleId?i.progressType==="tool"?(c.toolName=i.toolName,c.toolSummary=Cf(i.toolName??"",i.toolInput),c.progressType="tool"):i.progressType==="thinking"?(c.text=i.text,c.progressType="thinking"):i.progressType==="text"?(c.text=i.text,c.progressType="text"):(i.progressType==="done"||i.progressType==="error")&&(c.progressType=i.progressType):l.push({type:"dispatch:progress",roleId:i.roleId,progressType:i.progressType,text:i.text,toolName:i.toolName,toolSummary:i.toolName?Cf(i.toolName,i.toolInput):void 0})}if(r){const i=l.filter(c=>c.type==="thinking");i.length>0&&(i[i.length-1].text=r)}return l}function TC({event:t,isStreaming:l}){var c,u,d;const[r,i]=k.useState(!1);switch(t.type){case"thinking":return s.jsxs("div",{className:"stream-event-thinking",children:[s.jsxs("div",{className:"stream-event-thinking-header",onClick:()=>i(!r),children:[s.jsx("span",{className:"stream-event-thinking-icon"}),s.jsxs("span",{className:"stream-event-thinking-label",children:["thinking",l?"...":""]}),t.text&&!l&&s.jsx("span",{className:"stream-event-thinking-toggle",children:r?"▾":"▸"})]}),(l||r)&&t.text&&s.jsx("div",{className:"stream-event-thinking-content",children:t.text.slice(-500)})]});case"tool":return s.jsxs("div",{className:"stream-event-tool",children:[s.jsx("span",{className:"stream-event-tool-badge",children:t.toolName}),t.toolSummary&&s.jsx("span",{className:"stream-event-tool-path",children:t.toolSummary}),t.toolInput&&s.jsx("span",{className:"stream-event-tool-toggle",onClick:()=>i(!r),children:r?"▾":"▸"}),r&&t.toolInput&&s.jsx("div",{className:"stream-event-tool-detail",children:JSON.stringify(t.toolInput,null,1).slice(0,300)})]});case"dispatch":return s.jsxs("div",{className:"stream-event-dispatch",children:[s.jsxs("span",{className:"stream-event-dispatch-badge",children:["→"," ",(c=t.roleId)==null?void 0:c.toUpperCase()]}),s.jsx("span",{className:"stream-event-dispatch-task",children:(u=t.task)==null?void 0:u.slice(0,80)})]});case"dispatch:progress":return s.jsxs("div",{className:"stream-event-dispatch-progress",children:[s.jsx("span",{className:"stream-event-dispatch-progress-role",children:(d=t.roleId)==null?void 0:d.toUpperCase()}),t.progressType==="thinking"&&s.jsxs("span",{className:"stream-event-dispatch-progress-status",children:["thinking",l?"...":""]}),t.progressType==="tool"&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"stream-event-tool-badge",children:t.toolName}),t.toolSummary&&s.jsx("span",{className:"stream-event-tool-path",children:t.toolSummary})]}),t.progressType==="text"&&t.text&&s.jsx("span",{className:"stream-event-dispatch-progress-status",children:"responding..."}),t.progressType==="done"&&s.jsx("span",{className:"stream-event-dispatch-progress-done",children:"done"}),t.progressType==="error"&&s.jsx("span",{className:"stream-event-dispatch-progress-error",children:"error"})]});default:return null}}function DC({events:t,isStreaming:l}){const[r,i]=k.useState(!1);if(t.length===0)return null;const c=AC(t);if(c.length===0)return null;const u=t.filter(b=>b.type==="thinking").length,d=t.filter(b=>b.type==="tool"),m=t.filter(b=>b.type==="dispatch"||b.type==="dispatch:progress"),x=t.filter(b=>b.type==="turn").reduce((b,v)=>Math.max(b,v.turn??0),0),f=[];if(u>0&&f.push("thinking"),d.length>0){const b=[...new Set(d.map(v=>v.toolName))];b.length<=3?f.push(b.join(", ")):f.push(`${d.length} tool calls`)}m.length>0&&f.push(`${m.length} dispatch`),x>1&&f.push(`${x} turns`);const g=f.join(" · "),y=!r;return s.jsxs("div",{className:"stream-activity-log",children:[s.jsxs("div",{className:"stream-activity-header",onClick:()=>i(!r),children:[l&&s.jsx("span",{className:"stream-activity-pulse"}),s.jsxs("span",{className:"stream-activity-summary",children:[r?"▸":"▾"," ",g,l?"...":""]})]}),y&&s.jsx("div",{className:"stream-activity-events",children:c.map((b,v)=>s.jsx(TC,{event:b,isStreaming:l&&v===c.length-1},v))})]})}function zC({message:t,roleId:l,roleColor:r}){var f;const i=t.from==="ceo",c=t.type==="system",u=t.status==="streaming";if(c)return s.jsx("div",{className:"flex justify-center my-2",children:s.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] bg-[var(--terminal-inline-bg)] px-3 py-1 rounded-full",children:t.content})});if(i)return s.jsx("div",{className:"flex justify-end mb-3",children:s.jsxs("div",{className:"max-w-[85%]",children:[s.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] text-right mb-1",children:"CEO"}),s.jsxs("div",{className:"bg-[var(--terminal-surface-light)] rounded-xl rounded-tr-sm px-4 py-2.5 text-sm text-[var(--terminal-text)] leading-relaxed",children:[t.type==="directive"&&s.jsx("span",{className:"text-amber-400 text-[10px] font-bold mr-1.5",children:"DO"}),t.content]})]})});const d=(((f=t.streamEvents)==null?void 0:f.length)??0)>0,m=!!t.thinking,x=m&&!t.content&&u&&!d;return s.jsxs("div",{className:"flex gap-2.5 mb-3",children:[s.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center text-sm shrink-0 mt-5",style:{background:`${r}33`},children:NC[l]??"👤"}),s.jsxs("div",{className:"max-w-[85%] min-w-0",children:[s.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] mb-1",children:l.toUpperCase()}),d&&s.jsx(DC,{events:t.streamEvents,isStreaming:u}),m&&!d&&s.jsxs("details",{open:x,className:"mb-1",children:[s.jsxs("summary",{className:"text-[10px] text-purple-400/70 cursor-pointer select-none flex items-center gap-1",children:[x&&s.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-purple-400 animate-pulse"}),"thinking",x?"...":` (${t.thinking.length} chars)`]}),s.jsx("div",{className:"text-[11px] text-[var(--terminal-text-muted)] leading-relaxed mt-1 pl-2 border-l border-purple-400/20 max-h-32 overflow-y-auto",children:t.thinking.slice(-500)})]}),s.jsxs("div",{className:"rounded-xl rounded-tl-sm px-4 py-2.5 text-sm text-[var(--terminal-text)] leading-relaxed",style:{borderLeft:`3px solid ${r}`,background:"var(--terminal-surface)"},children:[t.content?s.jsx(SC,{content:t.content,streaming:u}):u&&!m?s.jsx("span",{className:"inline-block w-2 h-4 bg-[var(--terminal-text-secondary)] animate-pulse"}):u&&m?s.jsx("span",{className:"text-[11px] text-purple-400/50 italic",children:"analyzing..."}):null,u&&t.content&&s.jsx("span",{className:"inline-block w-1.5 h-3.5 bg-[var(--terminal-text-secondary)] animate-pulse ml-0.5 align-middle"})]}),t.status==="error"&&s.jsx("div",{className:"text-[10px] text-red-400 mt-1",children:"Error occurred"})]})]})}function MC({messages:t,roleId:l,roleColor:r}){var c;const i=k.useRef(null);return k.useEffect(()=>{var u;(u=i.current)==null||u.scrollIntoView({behavior:"smooth"})},[t,(c=t[t.length-1])==null?void 0:c.content]),t.length===0?s.jsxs("div",{className:"flex-1 flex items-center justify-center text-[var(--terminal-text-muted)] text-sm",children:["Start a conversation with ",l.toUpperCase()]}):s.jsxs("div",{className:"flex-1 overflow-y-auto p-4 terminal-scrollbar",children:[t.map(u=>s.jsx(zC,{message:u,roleId:l,roleColor:r},u.id)),s.jsx("div",{ref:i})]})}function FC({mode:t,onModeChange:l,onSend:r,disabled:i,disabledReason:c}){const[u,d]=k.useState(""),m=k.useRef(null);k.useEffect(()=>{const g=m.current;g&&(g.style.height="0",g.style.height=Math.min(g.scrollHeight,120)+"px")},[u]);const x=()=>{const g=u.trim();!g||i||(r(g),d(""))},f=g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),x())};return s.jsxs("div",{className:"border-t border-[var(--terminal-border)] p-3 shrink-0",children:[c&&s.jsx("div",{className:"text-[10px] text-amber-400/70 mb-2 text-center",children:c}),s.jsxs("div",{className:"flex items-end gap-2",children:[s.jsxs("div",{className:"flex rounded-lg overflow-hidden border border-[var(--terminal-border)] shrink-0",children:[s.jsx("button",{onClick:()=>l("talk"),className:`px-2.5 py-1.5 text-[11px] font-semibold cursor-pointer transition-colors ${t==="talk"?"bg-[var(--desk-wood)] text-white":"bg-[var(--terminal-inline-bg)] text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)]"}`,children:"Talk"}),s.jsx("button",{onClick:()=>l("do"),className:`px-2.5 py-1.5 text-[11px] font-semibold cursor-pointer transition-colors ${t==="do"?"bg-amber-700 text-white":"bg-[var(--terminal-inline-bg)] text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)]"}`,children:"Do"})]}),s.jsx("textarea",{ref:m,value:u,onChange:g=>d(g.target.value),onKeyDown:f,placeholder:i?"Waiting...":t==="talk"?"Ask something...":"Give a directive...",disabled:i,rows:1,className:"flex-1 bg-[var(--terminal-inline-bg)] border border-[var(--terminal-border)] rounded-lg px-3 py-2 text-sm text-[var(--terminal-text)] placeholder:text-[var(--terminal-text-muted)] resize-none focus:outline-none focus:border-[var(--terminal-border-hover)] disabled:opacity-40 terminal-scrollbar"}),s.jsx("button",{onClick:x,disabled:i||!u.trim(),className:"w-8 h-8 rounded-lg bg-[var(--terminal-surface-light)] text-[var(--terminal-text-secondary)] flex items-center justify-center shrink-0 cursor-pointer hover:bg-[var(--desk-wood)] hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M22 2L11 13"}),s.jsx("path",{d:"M22 2L15 22L11 13L2 9L22 2Z"})]})})]})]})}const RC={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},wg={cto:"CTO",cbo:"CBO",pm:"PM",engineer:"Engineer",designer:"Designer",qa:"QA","data-analyst":"Data Analyst"};function C0(t){return new Date(t).toLocaleTimeString("ko-KR",{hour:"2-digit",minute:"2-digit"})}function _C({msg:t}){const l=RC[t.roleId]??"#888",r=wg[t.roleId]??t.roleId;if(t.type==="dispatch"){const i=t.text.includes("WAVE"),c=t.text.includes("completed")||t.text.includes("완료"),u=i?"📡":c?"✓":"→",d=c?"text-green-400/70":"text-[var(--terminal-text-muted)]";return s.jsxs("div",{className:"flex items-start gap-2 px-3 py-1 hover:bg-white/[0.02]",children:[s.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)] shrink-0 w-10 text-right mt-0.5",children:C0(t.ts)}),s.jsx("span",{className:"text-[10px] shrink-0 mt-0.5",children:u}),s.jsx("span",{className:`text-[11px] ${d}`,children:t.text})]})}return s.jsxs("div",{className:"flex items-start gap-2 px-3 py-1.5 hover:bg-white/[0.02]",children:[s.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)] shrink-0 w-10 text-right mt-0.5",children:C0(t.ts)}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("span",{className:"text-[11px] font-semibold mr-1.5",style:{color:l},children:r}),s.jsx("span",{className:"text-xs text-[var(--terminal-text-secondary)]",children:t.text})]})]})}function OC({channel:t,allRoles:l,onUpdateMembers:r,onUpdateTopic:i}){const c=k.useRef(null),u=k.useRef(null);k.useEffect(()=>{var S;const b=u.current;if(!b)return;b.scrollHeight-b.scrollTop-b.clientHeight<80&&((S=c.current)==null||S.scrollIntoView({behavior:"smooth"}))},[t.messages.length]);const[d,m]=k.useState(!1),[x,f]=k.useState(!1),[g,y]=k.useState("");return s.jsxs("div",{ref:u,className:"flex-1 overflow-y-auto terminal-scrollbar py-2",children:[s.jsxs("div",{className:"px-3 py-2 mb-2 border-b border-[var(--terminal-border)] flex items-center gap-2",children:[s.jsx("span",{className:"text-sm font-semibold text-[var(--terminal-text)]",children:t.name}),t.members.length>0&&s.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:t.members.map(b=>wg[b]??b).join(", ")}),t.members.length===0&&s.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:t.isDefault?"system logs":"no members"}),!t.isDefault&&l&&r&&s.jsx("button",{className:"ml-auto text-[10px] px-2 py-0.5 rounded bg-white/5 hover:bg-white/10 text-[var(--terminal-text-muted)]",onClick:()=>m(!d),children:d?"Done":"Invite"})]}),!t.isDefault&&i&&s.jsx("div",{className:"px-3 pb-2 mb-1",children:x?s.jsx("input",{autoFocus:!0,value:g,onChange:b=>y(b.target.value),onKeyDown:b=>{b.key==="Enter"&&(i(t.id,g.trim()),f(!1)),b.key==="Escape"&&f(!1)},onBlur:()=>{i(t.id,g.trim()),f(!1)},placeholder:"Set a topic for this channel...",className:"w-full bg-transparent text-[10px] text-[var(--terminal-text-muted)] outline-none border-b border-[var(--terminal-border)] pb-0.5"}):s.jsx("button",{onClick:()=>{y(t.topic??""),f(!0)},className:"text-[10px] text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] cursor-pointer italic",children:t.topic||"Click to set channel topic..."})}),d&&!t.isDefault&&l&&r&&s.jsx("div",{className:"px-3 pb-2 mb-2 border-b border-[var(--terminal-border)]",children:s.jsx("div",{className:"flex flex-wrap gap-1",children:l.map(b=>{const v=t.members.includes(b.id);return s.jsxs("button",{className:`text-[10px] px-2 py-1 rounded ${v?"bg-white/15 text-[var(--terminal-text)]":"bg-white/5 text-[var(--terminal-text-muted)]"}`,onClick:()=>{const S=v?t.members.filter(j=>j!==b.id):[...t.members,b.id];r(t.id,S)},children:[v?"✓ ":"",b.name]},b.id)})})}),t.messages.length===0&&s.jsx("div",{className:"flex-1 flex flex-col items-center justify-center text-[var(--terminal-text-muted)] text-xs gap-1 py-8",children:s.jsx("span",{children:t.isDefault?"No dispatch events yet":"No messages yet — invite roles to start chatting"})}),t.messages.map(b=>s.jsx(_C,{msg:b},b.id)),s.jsx("div",{ref:c})]})}const Ef={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"},BC=400,LC=800;function $C({sessions:t,activeSessionId:l,roles:r,streamingSessionId:i,width:c,onWidthChange:u,onSwitchSession:d,onCloseSession:m,onCreateSession:x,onClearEmpty:f,onCloseAll:g,onSendMessage:y,onModeChange:b,onCloseTerminal:v,chatChannels:S,activeChatChannelId:j,onSwitchChatChannel:E,onCreateChatChannel:C,onDeleteChatChannel:A,onUpdateChatMembers:F,onUpdateChatTopic:_,unreadChannels:H}){const[M,I]=k.useState(!1),[W,te]=k.useState(!1),[D,Y]=k.useState(!1),[B,V]=k.useState(""),ne=j!=null,G=S==null?void 0:S.find(Se=>Se.id===j),[L,Z]=k.useState(!1),[de,ue]=k.useState(!1),[z,R]=k.useState(!1),K=k.useRef(0),T=k.useRef(0),fe=k.useRef(null),Ee=t.find(Se=>Se.id===l),Ne=i===l,Le=t.filter(Se=>Se.messages.length===0).length,Be=k.useCallback(()=>{const Se=fe.current;Se&&(ue(Se.scrollLeft>0),R(Se.scrollLeft+Se.clientWidth<Se.scrollWidth-1))},[]);k.useEffect(()=>{if(!l||!fe.current)return;const Se=fe.current.querySelector(`[data-session-id="${l}"]`);Se&&Se.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"}),Be()},[l,t.length,Be]),k.useEffect(()=>{const Se=fe.current;if(!Se)return;Be(),Se.addEventListener("scroll",Be);const tt=new ResizeObserver(Be);return tt.observe(Se),()=>{Se.removeEventListener("scroll",Be),tt.disconnect()}},[Be]);const Qe=k.useCallback(Se=>{Se.preventDefault(),K.current=Se.clientX,T.current=c,Z(!0);const tt=he=>{const ge=K.current-he.clientX,ke=Math.min(LC,Math.max(BC,T.current+ge));u==null||u(ke)},me=()=>{Z(!1),document.removeEventListener("mousemove",tt),document.removeEventListener("mouseup",me)};document.addEventListener("mousemove",tt),document.addEventListener("mouseup",me)},[c,u]);return s.jsxs("div",{className:"shrink-0 bg-[var(--terminal-bg)] border-l border-[var(--terminal-border)] flex flex-col h-full relative",style:{width:c},children:[u&&s.jsx("div",{className:`terminal-resize-handle absolute top-0 left-0 w-1 h-full cursor-col-resize z-10 transition-colors ${L?"bg-[var(--terminal-border-hover)]":"bg-transparent"}`,onMouseDown:Qe}),s.jsxs("div",{className:"flex items-center bg-[var(--terminal-bg-deeper)] border-b border-[var(--terminal-border)] shrink-0",children:[s.jsxs("div",{className:"relative flex-1 min-w-0",children:[de&&s.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-6 bg-gradient-to-r from-[var(--terminal-bg-deeper)] to-transparent z-10 pointer-events-none"}),s.jsxs("div",{ref:fe,className:"flex items-center overflow-x-auto terminal-tab-scroll gap-px px-1 py-1",children:[S==null?void 0:S.map(Se=>s.jsxs("button",{onClick:()=>{E==null||E(Se.id)},className:`flex items-center gap-1 px-2.5 py-1.5 text-[11px] rounded-t-lg shrink-0 cursor-pointer transition-colors group ${j===Se.id?"bg-[var(--terminal-bg)] text-[var(--terminal-text)]":"bg-[var(--terminal-inline-bg)] text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] hover:bg-[var(--terminal-surface)]"}`,style:j===Se.id?{borderTop:"2px solid #4CAF50"}:void 0,children:[s.jsx("span",{className:"text-[10px]",children:"💬"}),s.jsx("span",{className:"truncate",children:Se.name}),(H==null?void 0:H.has(Se.id))&&j!==Se.id&&s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-400 shrink-0"}),!Se.isDefault&&s.jsx("span",{onClick:tt=>{tt.stopPropagation(),A==null||A(Se.id)},className:"ml-1 text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-sm leading-none opacity-0 group-hover:opacity-100",children:"×"})]},Se.id)),S&&S.length>0&&t.length>0&&s.jsx("div",{className:"w-px h-4 bg-[var(--terminal-border)] shrink-0 mx-1"}),t.map(Se=>s.jsx(jC,{roleId:Se.roleId,title:Se.title,roleColor:Ef[Se.roleId]??"#666",active:!ne&&Se.id===l,onClick:()=>{E==null||E(null),d(Se.id)},onClose:tt=>{tt.stopPropagation(),m(Se.id)},"data-session-id":Se.id},Se.id))]}),z&&s.jsx("div",{className:"absolute right-0 top-0 bottom-0 w-6 bg-gradient-to-l from-[var(--terminal-bg-deeper)] to-transparent z-10 pointer-events-none"})]}),s.jsxs("div",{className:"relative shrink-0",children:[s.jsx("button",{onClick:()=>{I(!M),te(!1)},className:"w-7 h-7 flex items-center justify-center text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-lg cursor-pointer",children:"+"}),M&&s.jsxs("div",{className:"absolute top-full right-0 mt-1 bg-[var(--terminal-surface)] border border-[var(--terminal-border)] rounded-lg shadow-xl z-50 py-1 min-w-[200px]",children:[C&&s.jsxs(s.Fragment,{children:[D?s.jsxs("div",{className:"px-3 py-2 flex items-center gap-1",children:[s.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:"#"}),s.jsx("input",{autoFocus:!0,value:B,onChange:Se=>V(Se.target.value),onKeyDown:Se=>{Se.key==="Enter"&&B.trim()&&(C(B.trim(),[]),V(""),Y(!1),I(!1)),Se.key==="Escape"&&(Y(!1),V(""))},placeholder:"channel name",className:"flex-1 bg-transparent text-xs text-[var(--terminal-text)] outline-none border-b border-[var(--terminal-border)]"})]}):s.jsxs("button",{onClick:()=>Y(!0),className:"w-full text-left px-3 py-2 text-xs text-[var(--terminal-text-secondary)] hover:bg-[var(--terminal-surface-light)] cursor-pointer flex items-center gap-2",children:[s.jsx("span",{className:"text-[10px]",children:"💬"}),"New Channel"]}),s.jsx("div",{className:"border-b border-[var(--terminal-border)] my-1"})]}),r.map(Se=>s.jsxs("button",{onClick:()=>{x(Se.id),E==null||E(null),I(!1)},className:"w-full text-left px-3 py-2 text-xs text-[var(--terminal-text-secondary)] hover:bg-[var(--terminal-surface-light)] cursor-pointer flex items-center gap-2",children:[s.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:Ef[Se.id]??"#666"}}),Se.id.toUpperCase()," — ",Se.name]},Se.id))]})]}),s.jsxs("div",{className:"relative shrink-0",children:[s.jsx("button",{onClick:()=>{te(!W),I(!1)},className:"w-7 h-7 flex items-center justify-center text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-xs cursor-pointer tracking-tight",title:"Manage sessions",children:"···"}),W&&s.jsxs("div",{className:"absolute top-full right-0 mt-1 bg-[var(--terminal-surface)] border border-[var(--terminal-border)] rounded-lg shadow-xl z-50 py-1 min-w-[200px]",children:[s.jsxs("div",{className:"px-3 py-1.5 text-[10px] text-[var(--terminal-text-muted)] border-b border-[var(--terminal-border)]",children:[t.length," session",t.length!==1?"s":""]}),Le>0&&f&&s.jsxs("button",{onClick:()=>{f(),te(!1)},className:"w-full text-left px-3 py-2 text-xs text-[var(--terminal-text-secondary)] hover:bg-[var(--terminal-surface-light)] cursor-pointer",children:["Clear empty sessions (",Le,")"]}),t.length>0&&g&&s.jsx("button",{onClick:()=>{g(),te(!1)},className:"w-full text-left px-3 py-2 text-xs text-[#E57373] hover:bg-[var(--terminal-surface-light)] cursor-pointer",children:"Close all sessions"}),t.length===0&&s.jsx("div",{className:"px-3 py-2 text-xs text-[var(--terminal-text-muted)]",children:"No sessions"})]})]}),s.jsx("button",{onClick:v,className:"px-2 py-1 text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-sm cursor-pointer shrink-0",children:"×"})]}),ne&&G?s.jsx(OC,{channel:G,allRoles:r,onUpdateMembers:F,onUpdateTopic:_}):Ee?s.jsxs(s.Fragment,{children:[s.jsx(MC,{messages:Ee.messages,roleId:Ee.roleId,roleColor:Ef[Ee.roleId]??"#666"}),s.jsx(FC,{mode:Ee.mode,onModeChange:Se=>b(Ee.id,Se),onSend:Se=>y(Ee.id,Se,Ee.mode),disabled:Ne,disabledReason:Ne?`${Ee.roleId.toUpperCase()} is responding...`:void 0})]}):s.jsx("div",{className:"flex-1 flex items-center justify-center text-[var(--terminal-text-muted)] text-sm",children:"No active session. Click [+] to start."})]})}function HC(){const t=k.useRef(null),l=k.useCallback(()=>{var i;(i=t.current)==null||i.abort(),t.current=null},[]);return{sendMessage:k.useCallback((i,c,u,d)=>{l();const m=new AbortController;return t.current=m,fetch(`/api/exec/session/${i}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:c,mode:u}),signal:m.signal}).then(async x=>{var b,v,S,j,E;if(!x.ok||!x.body){d.onError("Failed to connect");return}const f=x.body.getReader(),g=new TextDecoder;let y="";for(;;){const{done:C,value:A}=await f.read();if(C)break;y+=g.decode(A,{stream:!0});const F=y.split(`
|
|
88
|
+
`);y=F.pop()??"";let _="";for(let H=0;H<F.length;H++){const M=F[H];if(M.startsWith("event: ")){_=M.slice(7).trim();continue}if(M.startsWith("data: ")){let I;try{I=JSON.parse(M.slice(6))}catch{_="";continue}switch(_){case"thinking":I.text&&((b=d.onThinking)==null||b.call(d,I.text));break;case"output":I.text&&d.onText(I.text);break;case"tool":(v=d.onToolUse)==null||v.call(d,I.name,I.input);break;case"dispatch":(S=d.onDispatch)==null||S.call(d,I.roleId,I.task);break;case"dispatch:progress":(j=d.onDispatchProgress)==null||j.call(d,I.roleId,I.type,I);break;case"turn":(E=d.onTurn)==null||E.call(d,I.turn);break;case"done":d.onDone(I);break;case"error":d.onError(I.message??"Unknown error");break;default:I.text&&d.onText(I.text);break}_=""}}}}).catch(x=>{x.name!=="AbortError"&&d.onError(x.message)}),{abort:l}},[l]),abort:l}}const kg="tycono-appearances",Pf="tycono-theme";function E0(){try{const t=localStorage.getItem(kg);return t?JSON.parse(t):{}}catch{return{}}}function Nf(t){localStorage.setItem(kg,JSON.stringify(t))}function N0(){try{const t=localStorage.getItem(Pf);if(t&&t in Gr)return t}catch{}return"default"}function UC(t){var i;const l=(i=Gr[t])==null?void 0:i.vars;if(!l)return;const r=document.documentElement;for(const[c,u]of Object.entries(l))r.style.setProperty(c,u)}const Af={mode:"auto",intervalSec:18,dailyBudgetUsd:1},eh="tycono-speech-settings",Tf="tycono-language";function IC(){try{const t=localStorage.getItem(eh);return t?{...Af,...JSON.parse(t)}:Af}catch{return Af}}function YC(){const[t,l]=k.useState(E0),[r,i]=k.useState(N0),[c,u]=k.useState(IC),[d,m]=k.useState(()=>{try{return localStorage.getItem(Tf)??"auto"}catch{return"auto"}}),x=k.useRef(!1);k.useEffect(()=>{x.current||(x.current=!0,Ce.getPreferences().then(j=>{const E=Object.keys(j.appearances??{}).length>0||j.theme!=="default";if(j.speech&&(u(C=>({...C,...j.speech})),localStorage.setItem(eh,JSON.stringify(j.speech))),j.language&&(m(j.language),localStorage.setItem(Tf,j.language)),E){const C=j.appearances;l(C),Nf(C),j.theme&&j.theme in Gr&&(i(j.theme),localStorage.setItem(Pf,j.theme))}else{const C=E0(),A=N0();(Object.keys(C).length>0||A!=="default")&&Ce.updatePreferences({appearances:C,theme:A}).catch(()=>{})}}).catch(()=>{}))},[]),k.useEffect(()=>{UC(r)},[r]);const f=k.useCallback(j=>t[j]??Th(j),[t]),g=k.useCallback((j,E)=>{l(C=>{const A={...C,[j]:E};return Nf(A),Ce.updatePreferences({appearances:A}).catch(()=>{}),A})},[]),y=k.useCallback(j=>{l(E=>{const C={...E};return delete C[j],Nf(C),Ce.updatePreferences({appearances:C}).catch(()=>{}),C})},[]),b=k.useCallback(j=>{i(j),localStorage.setItem(Pf,j),Ce.updatePreferences({theme:j}).catch(()=>{})},[]),v=k.useCallback(j=>{u(E=>{const C={...E,...j};return localStorage.setItem(eh,JSON.stringify(C)),Ce.updatePreferences({speech:C}).catch(()=>{}),C})},[]),S=k.useCallback(j=>{m(j),localStorage.setItem(Tf,j),Ce.updatePreferences({language:j}).catch(()=>{})},[]);return{appearances:t,getAppearance:f,setAppearance:g,resetAppearance:y,theme:r,setTheme:b,speechSettings:c,setSpeechSettings:v,language:d,setLanguage:S}}const qC=3e4;function XC(){var E;const[t,l]=k.useState(null),[r,i]=k.useState("synced"),[c,u]=k.useState([]),d=k.useRef(null),m=k.useCallback(async()=>{try{const C=await Ce.getSaveStatus();l(C),C.noGit?i("no-git"):i(A=>A==="saving"?A:C.dirty?"dirty":"synced")}catch{i("error")}},[]),x=k.useCallback(()=>{d.current||(m(),d.current=setInterval(m,qC))},[m]);k.useEffect(()=>()=>{d.current&&clearInterval(d.current)},[]);const f=k.useCallback(async C=>{i("saving");try{const A=await Ce.save(C);return await m(),A}catch(A){throw i("error"),A}},[m]),g=k.useCallback(async()=>{try{const C=await Ce.getSaveHistory(20);u(C)}catch{}},[]),y=k.useCallback(async C=>{i("saving");try{await Ce.restoreSave(C),await m()}catch(A){throw i("error"),A}},[m]),b=k.useCallback(async()=>{try{await Ce.initGit(),await m()}catch{i("error")}},[m]),v=t?t.modified.length+t.untracked.length:0,S=((E=t==null?void 0:t.lastCommit)==null?void 0:E.date)??null,j=k.useCallback(async()=>{x()},[x]);return{state:r,dirtyCount:v,lastSaved:S,status:t,save:f,history:c,loadHistory:g,restore:y,refresh:j,initGit:b}}const A0={cto:["Need to reduce this architecture tech debt...","Don't over-engineer. Keep it minimal.","Performance profiling results are a bit concerning.","Should do a system design review.","If I just strip one abstraction layer, it should work.","Let me check the monitoring dashboard.","Need to go through the code review queue.","It's about time to clean up these module dependencies."],cbo:["Heard the competitor launched a new feature... need to analyze.","Should compile this month's revenue metrics.","It's time to update the market trend report.","Maybe I should benchmark the pricing strategy.","Need to recalculate the ROI.","Let me check the competitor's GitHub star trends.","Thinking about launch timing...","Should re-examine the positioning strategy."],pm:["Is this feature really what users want?","Need to clean up the backlog...","MVP scope keeps expanding.","Analyzing user feedback...","Might need to re-prioritize.","Watch out for scope creep.","Will the roadmap timeline hold...","Should double-check the task dependencies."],engineer:["I want to refactor this code...","Test coverage seems a bit low.","Working code first, perfect code later.","Waiting for PR review...","What could be causing this bug...","Is the build broken?","Need to fix that one type error.","Maybe I should run npm audit."],designer:["This UI flow feels a bit awkward...","Usability first, pretty later.","Need to organize the design system components.","Let me make two quick options and compare.","Should run through the accessibility checklist.","Maybe I should prototype this interaction.","Let me revisit the color palette...","The spacing feels a bit cramped."],qa:['"Works" and "correct" are two different things.',"Organizing edge case scenarios...","Should run the regression test suite.","This part could be converted to automated tests.","Need to go through the pre-release checklist.","Reproducible bug reports are key.","Should run cross-browser tests.","Need to check for performance regressions."],"data-analyst":["Checking the data pipeline status...","Interesting outlier detection pattern.","Need to update the dashboard metrics.","Correlation isn't causation though...","Seems like there is room for SQL query optimization.","It's time for a data quality check."]},T0={cto:["Should I assign more work to the team...","It's time to clean up the architecture debt.","Need to re-examine the tech roadmap.","It's quiet... am I missing something?"],cbo:["It's time to update the market analysis...","Should be preparing the revenue report, but no directives.","Let me check on competitor movements.","It's quiet on the business side..."],pm:["Backlog is pretty quiet... nothing to plan?","It's been a while since we scheduled a sprint.","User feedback must be piling up...","No PRD to write... that's unusual."],engineer:["Nothing to do today... maybe some code reviews.","Task queue is empty. Guess I'll refactor.","Am I missing something?","Should clean up the commit log."],designer:["No design requests coming in. Should I improve something on my own?","Maybe run a UI audit...","Should organize my portfolio.","Let me tidy up the component library."],qa:["No builds to test. Let me improve the automation scripts.","It's quiet... no bugs, or just haven't found them?","Let me review the existing test scenarios.","Should update the test coverage report."],"data-analyst":["No analysis requests coming in...","Maybe I should clean up the data warehouse.","Should verify the past reports."]},VC=[{id:"sup-check-1",relation:"superior-subordinate",minFamiliarity:0,topic:"progress",turns:[{speaker:"A",text:"How's the progress?"},{speaker:"B",text:"Going well. Should be done soon."},{speaker:"A",text:"Good, let me know when it's done."}]},{id:"sup-check-2",relation:"superior-subordinate",minFamiliarity:20,topic:"progress",turns:[{speaker:"A",text:"What are you working on today?"},{speaker:"B",text:"Finishing up what I was doing yesterday."}]},{id:"sub-report-1",relation:"superior-subordinate",minFamiliarity:10,topic:"report",turns:[{speaker:"B",text:"Done with that task from earlier."},{speaker:"A",text:"Nice work. Can you share the results?"},{speaker:"B",text:"Sure, I've updated the docs."}]},{id:"peer-tech-1",relation:"peer",minFamiliarity:20,topic:"tech",turns:[{speaker:"A",text:"What do you think about this design?"},{speaker:"B",text:"I think we could go simpler."},{speaker:"A",text:"Really? Want to look at it together?"}]},{id:"peer-tech-2",relation:"peer",minFamiliarity:30,topic:"tech",turns:[{speaker:"A",text:"Have you used this library before?"},{speaker:"B",text:"Yeah, used it in the last project. It was decent."}]},{id:"close-feedback-1",relation:"peer",minFamiliarity:60,topic:"feedback",turns:[{speaker:"A",text:"Can I be honest with you?"},{speaker:"B",text:"Of course, go ahead."},{speaker:"A",text:"This one feels a bit off. Let's revisit."},{speaker:"B",text:"...Alright. Thanks for the feedback."}]},{id:"clevel-sync-1",relation:"c-level",minFamiliarity:10,topic:"strategy",turns:[{speaker:"A",text:"We need to sync the roadmap with the business timeline."},{speaker:"B",text:"Agreed. I'll have it organized and shared by tomorrow."}]},{id:"clevel-sync-2",relation:"c-level",minFamiliarity:30,topic:"strategy",turns:[{speaker:"A",text:"I have some competitor intel to share."},{speaker:"B",text:"Great, I have a tech update too."},{speaker:"A",text:"Let's sync up when you're free."}]},{id:"casual-coffee",relation:"any",minFamiliarity:30,topic:"casual",turns:[{speaker:"A",text:"Want to grab a coffee?"},{speaker:"B",text:"Sure. Feels like it's going to be a long day."}]},{id:"casual-overtime",relation:"any",minFamiliarity:25,topic:"casual",turns:[{speaker:"A",text:"Working late again..."},{speaker:"B",text:"We're in this together. Hang in there."}]},{id:"casual-lunch",relation:"any",minFamiliarity:35,topic:"casual",turns:[{speaker:"A",text:"What should we get for lunch?"},{speaker:"B",text:"Anything. Feel like we eat the same thing every day."}]},{id:"casual-weekend",relation:"any",minFamiliarity:40,topic:"casual",turns:[{speaker:"A",text:"What did you do this weekend?"},{speaker:"B",text:"Just rested. Was too tired."}]},{id:"bestie-1",relation:"any",minFamiliarity:80,topic:"trust",turns:[{speaker:"A",text:"I'm a bit unsure about this direction..."},{speaker:"B",text:"What's bothering you? Be honest."},{speaker:"A",text:"Thanks. It's nice having someone I can talk to."}]}],GC=18e3,D0=6e3,KC=2500,QC=30*6e4,jg="tycono:relationships";function WC(){try{const t=localStorage.getItem(jg);return t?JSON.parse(t):[]}catch{return[]}}function ZC(t){localStorage.setItem(jg,JSON.stringify(t))}function oc(t,l,r){const[i,c]=l<r?[l,r]:[r,l];let u=t.find(d=>d.roleA===i&&d.roleB===c);return u||(u={roleA:i,roleB:c,dispatches:0,wavesTogether:0,conversations:0,familiarity:0,lastInteraction:new Date().toISOString()},t.push(u)),u}function cc(t){return Math.min(100,t.dispatches*5+t.wavesTogether*10+t.conversations*2)}function uc(t){return t[Math.floor(Math.random()*t.length)]}function JC(t,l,r){const i=r.find(m=>m.id===t),c=r.find(m=>m.id===l);if(!i||!c)return null;const u=i.level==="c-level",d=c.level==="c-level";return u&&d?"c-level":i.reportsTo===l||c.reportsTo===t?"superior-subordinate":(i.reportsTo===c.reportsTo,"peer")}function PC(t,l){return t.relation==="any"?!0:t.relation===l}function eE({roles:t,roleStatuses:l,activeExecs:r,getStandupSpeech:i}){const[c,u]=k.useState(new Map),[d,m]=k.useState(WC),x=k.useRef({}),f=k.useRef(null),g=k.useRef(t),y=k.useRef(l),b=k.useRef(r),v=k.useRef(i),S=k.useRef(d);g.current=t,y.current=l,b.current=r,v.current=i,S.current=d,k.useEffect(()=>{const _=Date.now();for(const[H,M]of Object.entries(l))M==="working"&&(x.current[H]=_)},[l]),k.useEffect(()=>{ZC(d)},[d]);const j=k.useCallback(_=>{const H=y.current[_],M=b.current.find(Y=>Y.roleId===_);if(H==="working"&&(M!=null&&M.task))return null;const I=v.current(_);if(I&&Math.random()<.3)return{text:I,type:"work",ts:Date.now()};const W=Date.now(),te=x.current[_]??0;if(W-te>QC&&Math.random()<.5){const Y=T0[_]??T0.engineer;return{text:uc(Y),type:"guilt",ts:W}}const D=A0[_]??A0.engineer;return{text:uc(D),type:"personality",ts:W}},[]),E=k.useCallback(_=>{if(f.current)return!1;const H=_.filter(Z=>y.current[Z.id]!=="working");if(H.length<2)return!1;const M=[...H].sort(()=>Math.random()-.5),I=M[0],W=M[1],te=JC(I.id,W.id,_);if(!te)return!1;const D=oc(S.current,I.id,W.id),Y=cc(D),B=VC.filter(Z=>PC(Z,te)&&Y>=Z.minFamiliarity);if(B.length===0)return!1;const V=uc(B);let ne=I.id,G=W.id;V.relation==="superior-subordinate"&&(W.reportsTo===I.id||I.level==="c-level"?(ne=I.id,G=W.id):(ne=W.id,G=I.id)),f.current={templateId:V.id,roleA:ne,roleB:G,turnIdx:0,timer:null};const L=Z=>{if(!f.current||Z>=V.turns.length){f.current=null,m(R=>{const K=[...R],T=oc(K,ne,G);return T.conversations++,T.familiarity=cc(T),T.lastInteraction=new Date().toISOString(),K}),setTimeout(()=>{u(R=>{const K=new Map(R);return K.delete(ne),K.delete(G),K})},D0);return}const de=V.turns[Z],ue=de.speaker==="A"?ne:G,z=de.speaker==="A"?G:ne;u(R=>{const K=new Map(R);if(K.set(ue,{text:de.text,type:"social",partnerId:z,ts:Date.now()}),Z>0){const T=V.turns[Z-1].speaker==="A"?ne:G;T!==ue&&K.delete(T)}return K}),f.current.turnIdx=Z,f.current.timer=setTimeout(()=>L(Z+1),KC)};return L(0),!0},[]);k.useEffect(()=>{const _=setInterval(()=>{const H=g.current;if(H.length===0||f.current||Math.random()<.35&&E(H))return;const M=H.filter(te=>y.current[te.id]!=="working");if(M.length===0)return;const I=uc(M),W=j(I.id);W&&(u(te=>{const D=new Map(te);return D.set(I.id,W),D}),setTimeout(()=>{u(te=>{const D=new Map(te),Y=D.get(I.id);return Y&&Y.ts===W.ts&&D.delete(I.id),D})},D0))},GC);return()=>{var H;clearInterval(_),(H=f.current)!=null&&H.timer&&clearTimeout(f.current.timer)}},[j,E]);const C=k.useCallback(_=>{const H=c.get(_);return(H==null?void 0:H.text)??""},[c]),A=k.useCallback((_,H)=>{m(M=>{const I=[...M],W=oc(I,_,H);return W.dispatches++,W.familiarity=cc(W),W.lastInteraction=new Date().toISOString(),I})},[]),F=k.useCallback(_=>{_.length<2||m(H=>{const M=[...H];for(let I=0;I<_.length;I++)for(let W=I+1;W<_.length;W++){const te=oc(M,_[I],_[W]);te.wavesTogether++,te.familiarity=cc(te),te.lastInteraction=new Date().toISOString()}return M})},[]);return{speeches:c,getSpeech:C,relationships:d,notifyDispatch:A,notifyWave:F}}const Sg="tycono:office-chat";let tE=0;function nE(){return`chat-${Date.now()}-${++tE}`}function Df(){return[{id:"general",name:"#general",members:[],isDefault:!0,messages:[],topic:"Company-wide announcements and general discussion"},{id:"watercooler",name:"#watercooler",members:[],isDefault:!0,messages:[],topic:"No managers allowed. Vent, gossip, joke around. Talk freely about work frustrations, complain about directives you disagree with, share hot takes."}]}function lE(){try{const t=localStorage.getItem(Sg);if(t){const l=JSON.parse(t);if(l.find(i=>i.id==="office")&&!l.find(i=>i.id==="general")){const i=l.filter(c=>c.id!=="office");return[...Df(),...i]}const r=Df();for(const i of r)l.find(c=>c.id===i.id)||l.unshift(i);return l}}catch{}return Df()}function rE(t){const l=t.map(r=>({...r,messages:r.messages.slice(-200)}));localStorage.setItem(Sg,JSON.stringify(l))}function aE(){const[t,l]=k.useState(lE),[r,i]=k.useState(null),[c,u]=k.useState(new Set);k.useEffect(()=>{rE(t)},[t]);const d=k.useCallback(v=>{i(v),v&&u(S=>{const j=new Set(S);return j.delete(v),j})},[]),m=k.useCallback(v=>{const S={...v,id:nE()};l(j=>{const E=j.map(C=>C.id==="general"?v.type==="dispatch"?{...C,messages:[...C.messages,S].slice(-200)}:C:v.channelId?C.id===v.channelId?{...C,messages:[...C.messages,S].slice(-200)}:C:C.members.length>0&&C.members.includes(v.roleId)?{...C,messages:[...C.messages,S].slice(-200)}:C);return u(C=>{const A=new Set(C);for(const F of E){const _=j.find(H=>H.id===F.id);_&&F.messages.length>_.messages.length&&A.add(F.id)}return A}),E})},[]),x=k.useCallback((v,S,j)=>{const E=`ch-${Date.now()}`,C={id:E,name:v.startsWith("#")?v:`#${v}`,members:S,isDefault:!1,messages:[],topic:j};l(A=>[...A,C]),i(E)},[]),f=k.useCallback(v=>{l(S=>S.filter(j=>j.id!==v||j.isDefault)),i(S=>S===v?"general":S)},[]),g=k.useCallback((v,S)=>{l(j=>j.map(E=>E.id===v&&!E.isDefault?{...E,members:S}:E))},[]),y=k.useCallback((v,S)=>{l(j=>j.map(E=>E.id===v&&!E.isDefault?{...E,topic:S||void 0}:E))},[]),b=k.useCallback(v=>{l(S=>S.map(j=>{if(j.id==="watercooler"){const E=v.filter(C=>C.level!=="c-level").map(C=>C.id);if(j.members.length!==E.length||!E.every(C=>j.members.includes(C)))return{...j,members:E}}return j}))},[]);return{channels:t,activeChannelId:r,setActiveChannelId:d,pushMessage:m,createChannel:x,deleteChannel:f,updateMembers:g,updateTopic:y,unreadChannels:c,syncDefaultMembers:b}}const iE=45e3,sE=5e3,oE=4,cE=20;function uE({roles:t,roleStatuses:l,activeExecs:r,channels:i,relationships:c,pushMessage:u,speechSettings:d,engineType:m,hasApiKey:x}){const g=((d==null?void 0:d.mode)==="auto"?m==="claude-cli"||m==="local"?"llm":"template":(d==null?void 0:d.mode)??"template")==="llm"&&(x!==!1||m==="claude-cli"),y=((d==null?void 0:d.intervalSec)??iE/1e3)*1e3,b=k.useRef(t),v=k.useRef(l),S=k.useRef(r),j=k.useRef(i),E=k.useRef(c),C=k.useRef(u),A=k.useRef(0),F=k.useRef(!1);b.current=t,v.current=l,S.current=r,j.current=i,E.current=c,C.current=u;const _=k.useCallback(async(M,I)=>{if(F.current)return!1;F.current=!0;try{if(!b.current.find(G=>G.id===M))return!1;const te=I.messages.slice(-cE).map(G=>({roleId:G.roleId,text:G.text,ts:G.ts})),D=b.current.filter(G=>I.members.includes(G.id)),Y=E.current.filter(G=>G.roleA===M||G.roleB===M).map(G=>({partnerId:G.roleA===M?G.roleB:G.roleA,familiarity:G.familiarity})),B=S.current.find(G=>G.roleId===M),V=B?{currentTask:B.task,taskProgress:null}:{currentTask:null,taskProgress:null},ne=await Ce.chatInChannel({channelId:I.name.replace("#",""),channelTopic:I.topic,roleId:M,history:te,members:D.map(G=>({id:G.id,name:G.name,level:G.level})),relationships:Y,workContext:V});return ne.message?(C.current({ts:Date.now(),roleId:M,text:ne.message,type:"chat",channelId:I.id}),!0):!1}catch{return!1}finally{F.current=!1}},[]),H=k.useCallback(async(M,I)=>{if(A.current>=oE){A.current=0;return}const W=M.members.filter(B=>B!==I&&v.current[B]!=="working");if(W.length===0){A.current=0;return}const te=W[Math.floor(Math.random()*W.length)];if(Math.random()>.7){A.current=0;return}const D=A.current*2e3,Y=Math.random()*5e3;setTimeout(async()=>{A.current++;const B=j.current.find(ne=>ne.id===M.id);if(!B)return;if(await _(te,B)){const ne=.6-A.current*.1;Math.random()<ne?H(B,te):A.current=0}else A.current=0},sE+D+Y)},[_]);k.useEffect(()=>{if(!g)return;const M=setInterval(async()=>{const I=b.current;if(I.length===0||F.current)return;const W=I.filter(V=>v.current[V.id]!=="working");if(W.length===0)return;const te=W[Math.floor(Math.random()*W.length)],D=j.current.filter(V=>V.members.length===0?!0:V.members.includes(te.id));if(D.length===0)return;const Y=D[Math.floor(Math.random()*D.length)];A.current=0,await _(te.id,Y)&&H(Y,te.id)},y);return()=>clearInterval(M)},[g,y,_,H])}function dc({type:t,className:l}){const r=k.useRef(null),i=Tj(t);return k.useEffect(()=>{const c=r.current;if(!c||!i)return;const u=c.getContext("2d");u&&zj(u,i)},[t,i]),i?s.jsx("canvas",{ref:r,width:i.canvasWidth,height:i.canvasHeight,className:l,style:{imageRendering:"pixelated",display:"block"}}):null}const Cg=[[1,8],[3,5],[8,1],[5,3]],dE=[[1,4],[2,3],[4,1],[3,2]];function fc(t){const l=t===1||t===3?-1:0,r=Cg[t],i=t<2?[0,1]:[1,0],c=l;return[{x:1,y:17,w:10,h:2,c:"#100A06",a:.18},{x:r[0],y:13,w:3,h:4,c:"$pants"},{x:r[1],y:13,w:3,h:4,c:"$pants"},{x:r[0]+1,y:13,w:1,h:3,c:"darken($pants, 25)",a:.2},{x:r[1]+1,y:13,w:1,h:3,c:"darken($pants, 25)",a:.2},{x:r[0],y:16,w:3,h:2,c:"$shoes"},{x:r[1],y:16,w:3,h:2,c:"$shoes"},{x:r[0],y:16,w:3,h:1,c:"lighten($shoes, 25)",a:.4},{x:r[1],y:16,w:3,h:1,c:"lighten($shoes, 25)",a:.4},{x:1,y:c+8,w:10,h:6,c:"$shirt"},{x:2,y:c+8,w:8,h:1,c:"lighten($shirt, 20)",a:.35},{x:1,y:c+8,w:1,h:5,c:"darken($shirt, 30)",a:.2},{x:10,y:c+8,w:1,h:5,c:"darken($shirt, 30)",a:.2},{x:-1,y:c+9+i[0],w:3,h:4-i[0],c:"$shirt"},{x:10,y:c+9+i[1],w:3,h:4-i[1],c:"$shirt"},{x:-1,y:c+12,w:2,h:1,c:"$skin"},{x:11,y:c+12,w:2,h:1,c:"$skin"},{x:4,y:c+6,w:4,h:3,c:"$skin"},{x:1,y:c+0,w:10,h:7,c:"$skin"},{x:3,y:c+3,w:2,h:2,c:"#1A1A2E"},{x:7,y:c+3,w:2,h:2,c:"#1A1A2E"},{x:3,y:c+3,w:1,h:1,c:"#FFF",a:.4},{x:7,y:c+3,w:1,h:1,c:"#FFF",a:.4},{x:5,y:c+6,w:2,h:1,c:"darken($skin, 25)",a:.35},{x:0,y:c+3,w:1,h:1,c:"$skin"},{x:11,y:c+3,w:1,h:1,c:"$skin"},{x:1,y:c+0,w:10,h:3,c:"$hair"},{x:0,y:c+1,w:2,h:3,c:"$hair"},{x:10,y:c+1,w:2,h:3,c:"$hair"},{x:2,y:c+0,w:8,h:1,c:"lighten($hair, 25)",a:.3}]}function hc(t){const l=t===1||t===3?-1:0,r=Cg[t],i=t<2?[0,1]:[1,0],c=l;return[{x:1,y:17,w:10,h:2,c:"#100A06",a:.18},{x:r[0],y:13,w:3,h:4,c:"$pants"},{x:r[1],y:13,w:3,h:4,c:"$pants"},{x:r[0],y:16,w:3,h:2,c:"$shoes"},{x:r[1],y:16,w:3,h:2,c:"$shoes"},{x:1,y:c+8,w:10,h:6,c:"$shirt"},{x:2,y:c+8,w:8,h:1,c:"lighten($shirt, 20)",a:.2},{x:5,y:c+10,w:2,h:3,c:"darken($shirt, 30)",a:.12},{x:-1,y:c+9+i[0],w:3,h:4-i[0],c:"$shirt"},{x:10,y:c+9+i[1],w:3,h:4-i[1],c:"$shirt"},{x:4,y:c+6,w:4,h:3,c:"$skin"},{x:1,y:c+0,w:10,h:7,c:"$skin"},{x:1,y:c+0,w:10,h:6,c:"$hair"},{x:0,y:c+1,w:2,h:5,c:"$hair"},{x:10,y:c+1,w:2,h:5,c:"$hair"},{x:2,y:c+0,w:8,h:1,c:"lighten($hair, 25)",a:.3},{x:0,y:c+4,w:1,h:1,c:"$skin",a:.6},{x:11,y:c+4,w:1,h:1,c:"$skin",a:.6}]}function Yr(t,l){const r=t===1||t===3?-1:0,i=dE[t],c=r,u=t%2===0?1:0;return l?[{x:1,y:17,w:10,h:2,c:"#100A06",a:.18},{x:i[0],y:13,w:3,h:4,c:"$pants"},{x:i[1],y:13,w:3,h:4,c:"$pants"},{x:i[0],y:16,w:3,h:2,c:"$shoes"},{x:i[1],y:16,w:3,h:2,c:"$shoes"},{x:2,y:c+8,w:8,h:6,c:"$shirt"},{x:2,y:c+8,w:8,h:1,c:"lighten($shirt, 20)",a:.2},{x:8,y:c+9+u,w:3,h:4-u,c:"$shirt"},{x:9,y:c+12,w:2,h:1,c:"$skin"},{x:4,y:c+6,w:4,h:3,c:"$skin"},{x:2,y:c+0,w:8,h:7,c:"$skin"},{x:7,y:c+3,w:2,h:2,c:"#1A1A2E"},{x:7,y:c+3,w:1,h:1,c:"#FFF",a:.3},{x:9,y:c+4,w:1,h:1,c:"darken($skin, 25)",a:.3},{x:2,y:c+0,w:8,h:3,c:"$hair"},{x:1,y:c+1,w:2,h:4,c:"$hair"},{x:9,y:c+1,w:2,h:3,c:"$hair"},{x:3,y:c+0,w:6,h:1,c:"lighten($hair, 25)",a:.25}]:[{x:1,y:17,w:10,h:2,c:"#100A06",a:.18},{x:i[0],y:13,w:3,h:4,c:"$pants"},{x:i[1],y:13,w:3,h:4,c:"$pants"},{x:i[0],y:16,w:3,h:2,c:"$shoes"},{x:i[1],y:16,w:3,h:2,c:"$shoes"},{x:2,y:c+8,w:8,h:6,c:"$shirt"},{x:2,y:c+8,w:8,h:1,c:"lighten($shirt, 20)",a:.2},{x:0,y:c+9+u,w:3,h:4-u,c:"$shirt"},{x:-1,y:c+12,w:2,h:1,c:"$skin"},{x:4,y:c+6,w:4,h:3,c:"$skin"},{x:2,y:c+0,w:8,h:7,c:"$skin"},{x:3,y:c+3,w:2,h:2,c:"#1A1A2E"},{x:3,y:c+3,w:1,h:1,c:"#FFF",a:.3},{x:1,y:c+4,w:1,h:1,c:"darken($skin, 25)",a:.3},{x:2,y:c+0,w:8,h:3,c:"$hair"},{x:1,y:c+1,w:2,h:3,c:"$hair"},{x:9,y:c+1,w:2,h:4,c:"$hair"},{x:3,y:c+0,w:6,h:1,c:"lighten($hair, 25)",a:.25}]}const z0={down:[fc(0),fc(1),fc(2),fc(3)],up:[hc(0),hc(1),hc(2),hc(3)],right:[Yr(0,!0),Yr(1,!0),Yr(2,!0),Yr(3,!0)],left:[Yr(0,!1),Yr(1,!1),Yr(2,!1),Yr(3,!1)]},Ge=4,Dt=28,cn=2,ft=4,at=4,or=[{wallColor:"#C8B898",baseboardColor:"#6A5840",floorType:"wood"},{wallColor:"#A8B8C8",baseboardColor:"#586878",floorType:"dark"},{wallColor:"#A8C8B0",baseboardColor:"#4A6A50",floorType:"carpet"},{wallColor:"#C8C0A8",baseboardColor:"#7A6A50",floorType:"tile"}];function Dh(t,l,r){const u=t.fy+Math.max(10,Math.floor(t.fh*.18)),d=Math.min(l,r),m=Math.ceil(l/d),x=[],f=d*28,g=t.fx+Math.max(8,Math.floor((t.fw-f)/2));for(let y=0;y<m&&x.length<l;y++){const b=Math.min(d,l-y*d);for(let v=0;v<b;v++)x.push({dx:g+v*28,dy:u+y*28,room:t.id})}return x}function fE(t){const i=or[0],c={id:"main",wx:Ge+at,wy:Ge,ww:160-2*(Ge+at),wh:Dt,fx:Ge+at,fy:Ge+Dt+cn,fw:160-2*(Ge+at),fh:120-Ge-Dt-cn-Ge,...i},u=Dh(c,Math.min(t,6),3),d=[{id:"s-window-l",type:"window",room:"main",zone:"wall",offsetX:10,offsetY:6,windowW:16,windowH:14},{id:"s-window-r",type:"window",room:"main",zone:"wall",anchorX:"right",offsetX:-26,offsetY:6,windowW:16,windowH:14},{id:"s-clock",type:"clock",room:"main",zone:"wall",offsetX:Math.floor((160-2*(Ge+at))/2),offsetY:10}],m=[{id:"s-plant-l",type:"plant",room:"main",zone:"floor",offsetX:4,offsetY:4},{id:"s-plant-r",type:"plant",room:"main",zone:"floor",anchorX:"right",offsetX:-8,offsetY:4}];return{preset:"S",canvasW:160,canvasH:120,rooms:{main:c},desks:u,doors:{},adjacency:{main:[]},corridorY:{main:c.fy+c.fh-12},waypoints:{main:[{x:c.fx+10,y:c.fy+c.fh-14},{x:c.fx+c.fw/2,y:c.fy+c.fh-14},{x:c.fx+c.fw-10,y:c.fy+c.fh-14}]},wallDecorations:d,furniture:m}}function hE(t){const c={id:"exec",wx:Ge+at,wy:Ge,ww:144-Ge-at-ft/2,wh:Dt,fx:Ge+at,fy:Ge+Dt+cn,fw:144-Ge-at-ft/2,fh:66,...or[0]},u={id:"work",wx:144+ft/2+at,wy:Ge,ww:144-ft/2-at-Ge,wh:Dt,fx:144+ft/2+at,fy:Ge+Dt+cn,fw:144-ft/2-at-Ge,fh:66,...or[1]},d={id:"meet",wx:Ge+at,wy:Ge+Dt+cn+66+ft,ww:144-Ge-at-ft/2,wh:Dt,fx:Ge+at,fy:Ge+Dt+cn+66+ft+Dt+cn,fw:144-Ge-at-ft/2,fh:70,...or[2]},m={id:"comm",wx:144+ft/2+at,wy:Ge+Dt+cn+66+ft,ww:144-ft/2-at-Ge,wh:Dt,fx:144+ft/2+at,fy:Ge+Dt+cn+66+ft+Dt+cn,fw:144-ft/2-at-Ge,fh:70,...or[3]},x={exec:c,work:u,meet:d,comm:m},f=[];let g=t;const y=[[c,Math.min(3,g)],[u,0]];y[1][1]=Math.min(3,g-y[0][1]);const b=[[d,0],[m,0]];let v=g-y[0][1]-y[1][1];v>0&&(b[0][1]=Math.min(2,v),v-=b[0][1]),v>0&&(b[1][1]=Math.min(2,v));for(const[M,I]of[...y,...b])I>0&&f.push(...Dh(M,I,3));const S=Ge+Dt+cn+66,j=144-ft/2,E={exec_work:{id:"exec_work",type:"v",doorY:Ge+Dt+cn+20+12,xA:j-2,xB:u.fx+2},meet_comm:{id:"meet_comm",type:"v",doorY:Ge+Dt+cn+66+ft+Dt+cn+20+12,xA:j-2,xB:m.fx+2},exec_meet:{id:"exec_meet",type:"h",doorX:Ge+at+40+14,yA:S-2,yB:d.fy+2},work_comm:{id:"work_comm",type:"h",doorX:144+ft/2+at+40+14,yA:S-2,yB:m.fy+2}},C={exec:[{room:"work",door:"exec_work",side:"A"},{room:"meet",door:"exec_meet",side:"A"}],work:[{room:"exec",door:"exec_work",side:"B"},{room:"comm",door:"work_comm",side:"A"}],meet:[{room:"exec",door:"exec_meet",side:"B"},{room:"comm",door:"meet_comm",side:"A"}],comm:[{room:"work",door:"work_comm",side:"B"},{room:"meet",door:"meet_comm",side:"B"}]},A={exec:c.fy+52,work:u.fy+48,meet:d.fy+56,comm:m.fy+42},F={exec:[{x:c.fx+6,y:c.fy+52},{x:c.fx+60,y:c.fy+54},{x:c.fx+112,y:c.fy+50},{x:c.fx+50,y:c.fy+52}],work:[{x:u.fx+14,y:u.fy+48},{x:u.fx+44,y:u.fy+48},{x:u.fx+70,y:u.fy+48},{x:u.fx+100,y:u.fy+48}],meet:[{x:d.fx+60,y:d.fy+56},{x:d.fx+30,y:d.fy+54},{x:d.fx+110,y:d.fy+50},{x:d.fx+80,y:d.fy+56}],comm:[{x:m.fx+96,y:m.fy+8},{x:m.fx+60,y:m.fy+42},{x:m.fx+40,y:m.fy+42},{x:m.fx+20,y:m.fy+42}]},_=[{id:"exec-window-1",type:"window",room:"exec",zone:"wall",offsetX:10,offsetY:6,windowW:16,windowH:14},{id:"exec-picture-1",type:"picture",room:"exec",zone:"wall",offsetX:34,offsetY:8,pictureColor:"#1565C0",facility:{id:"theme",label:"THEME",icon:"🎨",color:"#42A5F5",hitW:12,hitH:10}},{id:"exec-picture-2",type:"picture",room:"exec",zone:"wall",offsetX:48,offsetY:8,pictureColor:"#E65100"},{id:"exec-clock",type:"clock",room:"exec",zone:"wall",offsetX:64,offsetY:10,facility:{id:"settings",label:"SETTINGS",icon:"⚙",color:"#78909C",hitW:10,hitH:10}},{id:"exec-shelf",type:"shelf",room:"exec",zone:"wall",offsetX:78,offsetY:14,facility:{id:"stats",label:"STATS",icon:"📊",color:"#7E57C2",hitW:16,hitH:8}},{id:"exec-window-2",type:"window",room:"exec",zone:"wall",offsetX:104,offsetY:6,windowW:16,windowH:14},{id:"work-whiteboard",type:"whiteboard",room:"work",zone:"wall",offsetX:6,offsetY:4},{id:"work-window-1",type:"window",room:"work",zone:"wall",offsetX:50,offsetY:6,windowW:16,windowH:14},{id:"work-window-2",type:"window",room:"work",zone:"wall",offsetX:92,offsetY:6,windowW:16,windowH:14},{id:"meet-bulletin",type:"bulletin-board",room:"meet",zone:"wall",offsetX:6,offsetY:4,facility:{id:"bulletin",label:"BULLETIN",icon:"📋",color:"#F59E0B",hitW:22,hitH:16}},{id:"meet-picture",type:"picture",room:"meet",zone:"wall",offsetX:28,offsetY:8,pictureColor:"#10B981"},{id:"meet-window",type:"window",room:"meet",zone:"wall",offsetX:80,offsetY:6,windowW:16,windowH:14},{id:"meet-shelf",type:"shelf",room:"meet",zone:"wall",offsetX:102,offsetY:18},{id:"comm-screen",type:"screen",room:"comm",zone:"wall",offsetX:6,offsetY:6,facility:{id:"decisions",label:"DECISIONS",icon:"📜",color:"#EF4444",hitW:16,hitH:12}},{id:"comm-picture",type:"picture",room:"comm",zone:"wall",offsetX:28,offsetY:8,pictureColor:"#d4956a"},{id:"comm-window",type:"window",room:"comm",zone:"wall",offsetX:76,offsetY:6,windowW:16,windowH:14},{id:"comm-clock",type:"clock",room:"comm",zone:"wall",offsetX:98,offsetY:10},{id:"comm-shelf",type:"shelf",room:"comm",zone:"wall",offsetX:108,offsetY:18}],H=[{id:"exec-bookshelf",type:"bookshelf",room:"exec",zone:"floor",offsetX:2,offsetY:4},{id:"exec-plant-r",type:"plant",room:"exec",zone:"floor",anchorX:"right",offsetX:-10,offsetY:4},{id:"exec-plant-c",type:"plant",room:"exec",zone:"floor",offsetX:Math.floor(c.fw/2),offsetY:4},{id:"work-plant-1",type:"plant",room:"work",zone:"floor",offsetX:36,offsetY:4},{id:"work-plant-2",type:"plant",room:"work",zone:"floor",offsetX:80,offsetY:4},{id:"meet-plant",type:"plant",room:"meet",zone:"floor",anchorX:"right",offsetX:-12,offsetY:4},{id:"meet-table",type:"meeting-table",room:"meet",zone:"floor",offsetX:10,offsetY:14,condition:"no-desks",facility:{id:"meeting",label:"MEETING",icon:"🏢",color:"#3B82F6",hitW:44,hitH:40}},{id:"comm-coffee-machine",type:"coffee-machine",room:"comm",zone:"floor",anchorX:"right",offsetX:-30,offsetY:4,condition:"no-desks"},{id:"comm-plant-1",type:"plant",room:"comm",zone:"floor",offsetX:38,offsetY:4,condition:"no-desks"},{id:"comm-bookshelf",type:"bookshelf",room:"comm",zone:"floor",anchorX:"right",offsetX:-26,offsetY:16,accent:"#10B981",condition:"no-desks",facility:{id:"knowledge",label:"KNOWLEDGE",icon:"📚",color:"#10B981",hitW:26,hitH:24}},{id:"comm-sofa",type:"sofa",room:"comm",zone:"floor",offsetX:44,offsetY:30,condition:"no-desks"},{id:"comm-coffee-table",type:"coffee-table",room:"comm",zone:"floor",offsetX:50,offsetY:50,condition:"no-desks"},{id:"comm-plant-2",type:"plant",room:"comm",zone:"floor",offsetX:38,offsetY:50,condition:"no-desks"}];return{preset:"M",canvasW:288,canvasH:208,rooms:x,desks:f,doors:E,adjacency:C,corridorY:A,waypoints:F,wallDecorations:_,furniture:H}}function mE(t){const d={id:"exec",wx:Ge+at,wy:Ge,ww:180-Ge-at-ft/2,wh:Dt,fx:Ge+at,fy:Ge+Dt+cn,fw:180-Ge-at-ft/2,fh:82,...or[0]},m={id:"work",wx:180+ft/2+at,wy:Ge,ww:180-ft/2-at-Ge,wh:Dt,fx:180+ft/2+at,fy:Ge+Dt+cn,fw:180-ft/2-at-Ge,fh:82,...or[1]},x=Ge+Dt+cn+82,f={id:"meet",wx:Ge+at,wy:x+ft,ww:180-Ge-at-ft/2,wh:Dt,fx:Ge+at,fy:x+ft+Dt+cn,fw:180-Ge-at-ft/2,fh:86,...or[2]},g={id:"comm",wx:180+ft/2+at,wy:x+ft,ww:180-ft/2-at-Ge,wh:Dt,fx:180+ft/2+at,fy:x+ft+Dt+cn,fw:180-ft/2-at-Ge,fh:86,...or[3]},y={exec:d,work:m,meet:f,comm:g},b=[];let v=t;const S=[[d,Math.min(5,v)],[m,0]];S[1][1]=Math.min(5,v-S[0][1]);const j=[[f,0],[g,0]];let E=v-S[0][1]-S[1][1];E>0&&(j[0][1]=Math.min(3,E),E-=j[0][1]),E>0&&(j[1][1]=Math.min(3,E));for(const[W,te]of[...S,...j])te>0&&b.push(...Dh(W,te,4));const C=180-ft/2,A={exec_work:{id:"exec_work",type:"v",doorY:d.fy+82/2,xA:C-2,xB:m.fx+2},meet_comm:{id:"meet_comm",type:"v",doorY:f.fy+86/2,xA:C-2,xB:g.fx+2},exec_meet:{id:"exec_meet",type:"h",doorX:d.fx+54,yA:x-2,yB:f.fy+2},work_comm:{id:"work_comm",type:"h",doorX:m.fx+54,yA:x-2,yB:g.fy+2}},F={exec:[{room:"work",door:"exec_work",side:"A"},{room:"meet",door:"exec_meet",side:"A"}],work:[{room:"exec",door:"exec_work",side:"B"},{room:"comm",door:"work_comm",side:"A"}],meet:[{room:"exec",door:"exec_meet",side:"B"},{room:"comm",door:"meet_comm",side:"A"}],comm:[{room:"work",door:"work_comm",side:"B"},{room:"meet",door:"meet_comm",side:"B"}]},_={exec:d.fy+82-12,work:m.fy+82-12,meet:f.fy+86-12,comm:g.fy+86-12},H={exec:[{x:d.fx+10,y:_.exec},{x:d.fx+d.fw/2,y:_.exec},{x:d.fx+d.fw-10,y:_.exec}],work:[{x:m.fx+10,y:_.work},{x:m.fx+m.fw/2,y:_.work},{x:m.fx+m.fw-10,y:_.work}],meet:[{x:f.fx+10,y:_.meet},{x:f.fx+f.fw/2,y:_.meet},{x:f.fx+f.fw-10,y:_.meet}],comm:[{x:g.fx+10,y:_.comm},{x:g.fx+g.fw/2,y:_.comm},{x:g.fx+g.fw-10,y:_.comm}]},M=[{id:"exec-window-1",type:"window",room:"exec",zone:"wall",offsetX:10,offsetY:6,windowW:16,windowH:14},{id:"exec-picture-1",type:"picture",room:"exec",zone:"wall",offsetX:34,offsetY:8,pictureColor:"#1565C0",facility:{id:"theme",label:"THEME",icon:"🎨",color:"#42A5F5",hitW:12,hitH:10}},{id:"exec-picture-2",type:"picture",room:"exec",zone:"wall",offsetX:48,offsetY:8,pictureColor:"#E65100"},{id:"exec-clock",type:"clock",room:"exec",zone:"wall",offsetX:64,offsetY:10,facility:{id:"settings",label:"SETTINGS",icon:"⚙",color:"#78909C",hitW:10,hitH:10}},{id:"exec-shelf",type:"shelf",room:"exec",zone:"wall",offsetX:78,offsetY:14,facility:{id:"stats",label:"STATS",icon:"📊",color:"#7E57C2",hitW:16,hitH:8}},{id:"exec-window-2",type:"window",room:"exec",zone:"wall",offsetX:104,offsetY:6,windowW:16,windowH:14},{id:"work-whiteboard",type:"whiteboard",room:"work",zone:"wall",offsetX:6,offsetY:4},{id:"work-window-1",type:"window",room:"work",zone:"wall",offsetX:50,offsetY:6,windowW:16,windowH:14},{id:"work-window-2",type:"window",room:"work",zone:"wall",offsetX:92,offsetY:6,windowW:16,windowH:14},{id:"meet-bulletin",type:"bulletin-board",room:"meet",zone:"wall",offsetX:6,offsetY:4,facility:{id:"bulletin",label:"BULLETIN",icon:"📋",color:"#F59E0B",hitW:22,hitH:16}},{id:"meet-picture",type:"picture",room:"meet",zone:"wall",offsetX:28,offsetY:8,pictureColor:"#10B981"},{id:"meet-window",type:"window",room:"meet",zone:"wall",offsetX:80,offsetY:6,windowW:16,windowH:14},{id:"meet-shelf",type:"shelf",room:"meet",zone:"wall",offsetX:102,offsetY:18},{id:"comm-screen",type:"screen",room:"comm",zone:"wall",offsetX:6,offsetY:6,facility:{id:"decisions",label:"DECISIONS",icon:"📜",color:"#EF4444",hitW:16,hitH:12}},{id:"comm-picture",type:"picture",room:"comm",zone:"wall",offsetX:28,offsetY:8,pictureColor:"#d4956a"},{id:"comm-window",type:"window",room:"comm",zone:"wall",offsetX:76,offsetY:6,windowW:16,windowH:14},{id:"comm-clock",type:"clock",room:"comm",zone:"wall",offsetX:98,offsetY:10},{id:"comm-shelf",type:"shelf",room:"comm",zone:"wall",offsetX:108,offsetY:18}],I=[{id:"exec-bookshelf",type:"bookshelf",room:"exec",zone:"floor",offsetX:2,offsetY:4},{id:"exec-plant-r",type:"plant",room:"exec",zone:"floor",anchorX:"right",offsetX:-10,offsetY:4},{id:"exec-plant-c",type:"plant",room:"exec",zone:"floor",offsetX:Math.floor(d.fw/2),offsetY:4},{id:"work-plant-1",type:"plant",room:"work",zone:"floor",offsetX:36,offsetY:4},{id:"work-plant-2",type:"plant",room:"work",zone:"floor",offsetX:80,offsetY:4},{id:"meet-plant",type:"plant",room:"meet",zone:"floor",anchorX:"right",offsetX:-12,offsetY:4},{id:"meet-table",type:"meeting-table",room:"meet",zone:"floor",offsetX:10,offsetY:14,condition:"no-desks",facility:{id:"meeting",label:"MEETING",icon:"🏢",color:"#3B82F6",hitW:44,hitH:40}},{id:"comm-coffee-machine",type:"coffee-machine",room:"comm",zone:"floor",anchorX:"right",offsetX:-30,offsetY:4,condition:"no-desks"},{id:"comm-plant-1",type:"plant",room:"comm",zone:"floor",offsetX:38,offsetY:4,condition:"no-desks"},{id:"comm-bookshelf",type:"bookshelf",room:"comm",zone:"floor",anchorX:"right",offsetX:-26,offsetY:16,accent:"#10B981",condition:"no-desks",facility:{id:"knowledge",label:"KNOWLEDGE",icon:"📚",color:"#10B981",hitW:26,hitH:24}},{id:"comm-sofa",type:"sofa",room:"comm",zone:"floor",offsetX:44,offsetY:30,condition:"no-desks"},{id:"comm-coffee-table",type:"coffee-table",room:"comm",zone:"floor",offsetX:50,offsetY:50,condition:"no-desks"},{id:"comm-plant-2",type:"plant",room:"comm",zone:"floor",offsetX:38,offsetY:50,condition:"no-desks"}];return{preset:"L",canvasW:360,canvasH:260,rooms:y,desks:b,doors:A,adjacency:F,corridorY:_,waypoints:H,wallDecorations:M,furniture:I}}const xE=2;function Eg(t,l){return l?l==="L"&&t<=12-xE?"M":l==="M"&&t>12?"L":l:t<=12?"M":"L"}function Ng(t,l){switch(l??Eg(t)){case"S":return fE(t);case"M":return hE(t);case"L":return mE(t)}}function M0(t,l){if(!l||Object.keys(l).length===0)return t;const r=i=>i.map(c=>{const u=l[c.id];return u?{...c,offsetX:u.offsetX,offsetY:u.offsetY}:c});return{...t,wallDecorations:r(t.wallDecorations),furniture:r(t.furniture)}}function F0(t,l){if(l)for(const[r,i]of Object.entries(l))t[r]&&(t[r]={...t[r],dx:i.dx,dy:i.dy})}function zf(t,l){if(!l||l.length===0)return t;const r=new Set(l);return{...t,wallDecorations:t.wallDecorations.filter(i=>!r.has(i.id)),furniture:t.furniture.filter(i=>!r.has(i.id))}}function R0(t,l){if(!l||l.length===0)return t;const r=[],i=[];for(const c of l)c.zone==="wall"?r.push(c):i.push(c);return{...t,wallDecorations:[...t.wallDecorations,...r],furniture:[...t.furniture,...i]}}let Ns;function pE(t){Ns=t}function $(t,l,r,i,c,u){t=Math.round(t),l=Math.round(l),!(u!==void 0&&u<.01)&&(u!==void 0&&u!==1&&(Ns.globalAlpha=u),Ns.fillStyle=c,Ns.fillRect(t,l,r,i),u!==void 0&&u!==1&&(Ns.globalAlpha=1))}function it(t,l,r,i){$(t,l,1,1,r,i)}let wc=1;function vi(t){wc=t}function _l(){return wc=wc*16807%2147483647,(wc&65535)/65535}function Ag(t){const l=parseInt(t.slice(1,3),16)/255,r=parseInt(t.slice(3,5),16)/255,i=parseInt(t.slice(5,7),16)/255,c=Math.max(l,r,i),u=Math.min(l,r,i);let d=0,m=0;const x=(c+u)/2;if(c!==u){const f=c-u;m=x>.5?f/(2-c-u):f/(c+u),c===l?d=((r-i)/f+(r<i?6:0))/6:c===r?d=((i-l)/f+2)/6:d=((l-r)/f+4)/6}return[d*360,m*100,x*100]}function Tg(t,l,r){t=(t%360+360)%360,l=Math.max(0,Math.min(100,l))/100,r=Math.max(0,Math.min(100,r))/100;const i=l*Math.min(r,1-r),c=d=>{const m=(d+t/30)%12;return r-i*Math.max(-1,Math.min(m-3,9-m,1))},u=d=>Math.round(d*255).toString(16).padStart(2,"0");return"#"+u(c(0))+u(c(8))+u(c(4))}function Ol(t,l=1){const[r,i,c]=Ag(t);return Tg(r+15*l,Math.min(100,i+8),c-12*l)}function qt(t,l=1){const[r,i,c]=Ag(t);return Tg(r-10*l,i-3,c+10*l)}const on={hi:"#D4AA5C",base:"#B08040",sh:"#7A5038",deep:"#4E3028"},Rl={hi:"#8A6848",base:"#604832",sh:"#3A2E24",deep:"#2A1E18"},zl={hi:"#5A6A80",base:"#485868",sh:"#364858",deep:"#283848"},Wr="#100A06";function yE(t,l,r=14,i=12){$(t,l,r,i,"#4A3828"),$(t+1,l+1,r-2,i-2,"#5A4838"),$(t+2,l+2,r-4,i-4,"#4A7098"),$(t+2,l+2,r-4,Math.floor((i-4)/2),"#6A90B8",.35);const c=Math.floor(r/2);$(t+c,l+1,1,i-2,"#4A3828"),$(t+1,l+Math.floor(i/2),r-2,1,"#4A3828",.5),it(t+3,l+3,"#8AB8E8",.35),it(t+c+2,l+3,"#8AB8E8",.25),$(t-1,l+i,r+2,2,"#5A4838"),$(t-1,l+i,r+2,1,qt("#5A4838",.5),.35)}function gE(t,l,r){$(t,l,10,8,"#3A2818"),$(t+1,l+1,8,6,r),$(t+2,l+2,4,3,qt(r,1.2),.3),it(t+3,l+2,qt(r,2),.25)}function bE(t,l){$(t,l,7,7,"#3A2818"),$(t+1,l+1,5,5,"#F0EDE5"),it(t+3,l+1,"#AAA"),it(t+3,l+5,"#AAA"),it(t+1,l+3,"#AAA"),it(t+5,l+3,"#AAA"),it(t+3,l+3,"#222"),$(t+3,l+1,1,2,"#333"),it(t+4,l+3,"#D32F2F")}function vE(t,l){$(t,l,26,16,"#586878"),$(t+1,l+1,24,13,"#ECEFF1"),$(t+1,l+1,24,1,"#F5F5F5",.4),$(t+3,l+3,14,1,"#1565C0",.6),$(t+3,l+5,18,1,"#333",.2),$(t+3,l+7,12,1,"#D32F2F",.35),$(t+3,l+9,16,1,"#333",.15),$(t+1,l+14,24,2,"#708898"),$(t+3,l+14,3,1,"#D32F2F"),$(t+7,l+14,3,1,"#1565C0"),$(t+11,l+14,3,1,"#2E7D32")}function wE(t,l){$(t,l,22,16,"#6A5030"),$(t+1,l+1,20,14,"#C4A66A"),vi(88);for(let r=0;r<14;r++)for(let i=0;i<20;i++)_l()>.5&&it(t+1+i,l+1+r,_l()>.5?"#B89858":"#D4B87A",.18);$(t+2,l+2,5,4,"#FFF176"),$(t+8,l+2,5,4,"#90CAF9"),$(t+14,l+3,5,4,"#CE93D8"),$(t+3,l+8,7,4,"#C8E6C9"),$(t+11,l+8,8,4,"#F8BBD0"),it(t+4,l+2,"#E53935"),it(t+10,l+2,"#1E88E5"),it(t+16,l+3,"#FF9800")}function kE(t,l){$(t,l,20,3,"#5A4030"),$(t,l,20,1,qt("#5A4030",.5),.35),$(t,l+2,20,1,Ol("#5A4030",.5),.3),$(t+2,l-4,3,4,"#E53935"),$(t+2,l-4,3,1,qt("#E53935",1),.3),$(t+6,l-3,2,3,"#1E88E5"),$(t+9,l-5,4,5,"#43A047"),$(t+14,l-3,3,3,"#FFD54F"),it(t+15,l-3,"#FFF176",.4)}function jE(t,l){$(t,l,16,12,"#1E1E28"),$(t+1,l+1,14,9,"#0C1420"),$(t+2,l+2,12,1,"#EF4444",.6),it(t+2,l+4,"#4CAF50"),$(t+4,l+4,7,1,"#8b949e",.4),it(t+2,l+6,"#FF9800"),$(t+4,l+6,5,1,"#8b949e",.3),it(t+2,l+8,"#42A5F5"),$(t+4,l+8,8,1,"#8b949e",.25),$(t+7,l+10,2,2,"#1E1E28"),$(t+5,l+11,6,1,"#586878")}function SE(t,l,r){$(t+2,l+20,22,2,Wr,.15),$(t,l,22,20,Rl.deep),$(t+1,l+1,20,18,Rl.base),$(t,l,22,1,Rl.hi,.35),$(t,l,1,20,Rl.hi,.2);for(const u of[6,12])$(t+1,l+u,20,2,Rl.sh),$(t+1,l+u,20,1,Rl.hi,.2);const i=["#E53935","#1E88E5","#43A047","#8E24AA","#FB8C00","#00897B","#5C6BC0"];let c=t+2;for(let u=0;u<5;u++){const d=2+u%2;$(c,l+1,d,5,i[u]),$(c,l+1,d,1,qt(i[u],1),.35),c+=d+1}c=t+2;for(let u=0;u<4;u++)$(c,l+7,4,5,i[u+3]),$(c,l+7,4,1,qt(i[u+3],1),.25),c+=5;$(t+2,l+14,4,4,"#FFD54F"),$(t+8,l+14,7,4,"#90CAF9"),r&&$(t,l-1,22,1,r,.7)}function CE(t,l){$(t+2,l+11,6,2,Wr,.1),$(t+2,l+8,6,4,"#8B5E3C"),$(t+1,l+7,8,2,Ol("#A06E48",.3)),$(t+2,l+7,6,1,qt("#A06E48",.5),.4),$(t+1,l+3,3,4,"#2E7D32"),$(t+5,l+2,3,4,"#2E7D32"),$(t+2,l+1,4,4,"#43A047"),$(t+3,l+0,3,3,"#66BB6A"),it(t+4,l,"#81C784"),it(t+3,l+1,"#A5D6A7",.4)}function EE(t,l){ya(t+4,l-4,"down"),ya(t+16,l-4,"down"),ya(t+28,l-4,"down"),$(t+3,l+24,34,3,Wr,.15),$(t,l+2,36,18,on.deep),$(t+1,l+3,34,16,on.base),$(t+1,l+3,34,1,on.hi,.35);for(let r=0;r<14;r+=3)$(t+1,l+4+r,34,1,Ol(on.base,.2),.08);$(t,l+20,36,4,on.deep),$(t+1,l+21,34,2,on.sh),$(t+6,l+7,10,6,"#1A1A24"),$(t+7,l+8,8,4,"#0C1420"),$(t+8,l+9,4,1,"#2A6898",.4),$(t+20,l+8,6,4,"#F0F0F0"),$(t+15,l+7,3,3,"#ECEFF1"),it(t+16,l+8,"#795548"),ya(t+4,l+24,"up"),ya(t+16,l+24,"up"),ya(t+28,l+24,"up")}function NE(t,l){$(t+2,l+16,36,3,Wr,.15),$(t,l,36,5,"#5D4037"),$(t+1,l+1,34,3,"#6D4C41"),$(t+1,l+1,34,1,qt("#6D4C41",.5),.3),$(t,l+5,36,8,"#5D4037"),$(t+2,l+6,15,6,"#6D4C41"),$(t+3,l+6,13,1,qt("#6D4C41",.5),.35),$(t+19,l+6,15,6,"#6D4C41"),$(t+20,l+6,13,1,qt("#6D4C41",.5),.35),$(t+17,l+6,2,6,"#5D4037"),$(t,l+13,36,3,Ol("#5D4037",1)),$(t-2,l+2,3,12,"#5D4037"),$(t+35,l+2,3,12,"#5D4037"),$(t+4,l+7,6,4,"#FF8A65"),$(t+5,l+7,4,1,qt("#FF8A65",1),.35)}function AE(t,l){$(t+2,l+10,22,2,Wr,.12),$(t,l,22,8,Rl.deep),$(t+1,l+1,20,6,Rl.base),$(t+1,l+1,20,1,Rl.hi,.3),$(t,l+8,22,2,Rl.sh),$(t+3,l+2,6,4,"#F0F0F0"),$(t+13,l+3,3,3,"#ECEFF1"),it(t+14,l+4,"#795548")}function TE(t,l){$(t+1,l+14,10,2,Wr,.12),$(t,l,10,14,"#546E7A"),$(t,l,10,1,qt("#546E7A",1),.35),$(t+1,l+1,8,3,"#78909C"),$(t+1,l+5,8,4,"#37474F"),it(t+2,l+6,"#EF5350"),it(t+4,l+6,"#66BB6A"),$(t+2,l+11,4,2,"#ECEFF1")}function DE(t,l){$(t+2,l+16,26,3,Wr,.18),$(t,l,26,10,on.deep),$(t+1,l+1,24,8,on.base),$(t+1,l+2,24,1,on.hi,.2),$(t+1,l+4,24,1,Ol(on.base,.2),.1),$(t+1,l+6,24,1,on.hi,.15),$(t+1,l+1,24,1,on.hi,.4),$(t+1,l+1,1,8,on.hi,.2),$(t,l+10,26,5,on.deep),$(t+1,l+11,24,3,on.sh),$(t+1,l+10,24,1,Ol(on.base,1.5),.4),$(t+1,l+14,24,1,on.base,.15),$(t+2,l+12,10,1,on.deep,.4),$(t+14,l+12,10,1,on.deep,.4),it(t+7,l+11,"#C8D0D8",.6),it(t+19,l+11,"#C8D0D8",.6),$(t+6,l-5,14,7,"#1E1E28"),$(t+7,l-4,12,5,"#0C1420"),$(t+8,l-3,5,1,"#2A6898",.6),$(t+8,l-2,8,1,"#1A3858",.4),$(t+8,l-1,3,1,"#2A6898",.35),it(t+7,l-4,"#4A98D8",.25),it(t+12,l+1,"#4CAF50",.4),$(t+12,l+2,2,3,"#586878"),$(t+10,l+4,6,1,"#8898A8"),$(t+6,l+4,12,4,"#222228"),$(t+6,l+4,12,1,"#333338",.4);for(let r=0;r<5;r++)it(t+7+r*2,l+5,"#444",.6),it(t+7+r*2,l+6,"#3A3A3E",.4);$(t+20,l+5,3,4,"#333338"),$(t+20,l+5,3,1,"#444448"),$(t+1,l+3,4,4,"#F0EDE8"),$(t+1,l+3,4,1,"#F8F6F2"),it(t+2,l+5,"#6D4C41")}function ya(t,l,r){$(t+1,l+9,10,2,Wr,.1),it(t+5,l+9,"#1E1E22"),it(t+1,l+10,"#1A1A1E"),it(t+9,l+10,"#1A1A1E"),it(t+3,l+11,"#1A1A1E"),it(t+7,l+11,"#1A1A1E"),$(t+1,l+2,8,6,zl.base),$(t+2,l+3,6,4,zl.hi,.35),$(t+2,l+3,6,1,qt(zl.hi,.5),.25),$(t+1,l+7,8,1,zl.deep),r==="up"?($(t,l+7,10,3,zl.deep),$(t+1,l+8,8,1,zl.sh)):($(t,l-1,10,3,zl.deep),$(t+1,l,8,1,zl.sh)),$(t,l+3,1,4,zl.sh),$(t+9,l+3,1,4,zl.sh)}const Dg={bookshelf:(t,l,r)=>SE(t,l,r.accent),plant:(t,l)=>CE(t,l),"meeting-table":(t,l)=>EE(t,l),sofa:(t,l)=>NE(t,l),"coffee-table":(t,l)=>AE(t,l),"coffee-machine":(t,l)=>TE(t,l),window:(t,l,r)=>yE(t,l,r.windowW??16,r.windowH??14),picture:(t,l,r)=>gE(t,l,r.pictureColor??"#1565C0"),clock:(t,l)=>bE(t,l),whiteboard:(t,l)=>vE(t,l),"bulletin-board":(t,l)=>wE(t,l),shelf:(t,l)=>kE(t,l),screen:(t,l)=>jE(t,l)};function yi(t,l){const r=t.zone==="wall"?l.wx:l.fx,i=t.zone==="wall"?l.wy:l.fy;return{x:t.anchorX==="right"?(t.zone==="wall"?l.wx+l.ww:l.fx+l.fw)+t.offsetX:r+t.offsetX,y:i+t.offsetY}}function zE(t){for(const l of t.wallDecorations){const r=t.rooms[l.room];if(!r)continue;const{x:i,y:c}=yi(l,r),u=Dg[l.type];u&&u(i,c,l)}}function ME(t,l,r){for(const i of t.furniture){const c=t.rooms[i.room];if(!c||i.condition==="no-desks"&&r.has(i.room))continue;const{x:u,y:d}=yi(i,c),m=Dg[i.type];m&&l.push({y:d,draw:()=>m(u,d,i)})}}function qr(t){const l=[],r=[...t.wallDecorations,...t.furniture];for(const i of r){if(!i.facility)continue;const c=t.rooms[i.room];if(!c)continue;const{x:u,y:d}=yi(i,c);l.push({id:i.facility.id,label:i.facility.label,icon:i.facility.icon,color:i.facility.color,dx:u,dy:d,pw:i.facility.hitW,ph:i.facility.hitH})}return l}const FE={bookshelf:{w:22,h:20},plant:{w:10,h:12},"meeting-table":{w:36,h:28},sofa:{w:38,h:16},"coffee-table":{w:22,h:10},"coffee-machine":{w:10,h:14},window:{w:16,h:14},picture:{w:10,h:8},clock:{w:7,h:7},whiteboard:{w:26,h:16},"bulletin-board":{w:22,h:16},shelf:{w:20,h:8},screen:{w:16,h:12}};function th(t){return FE[t]??{w:16,h:16}}function Mf(t,l,r,i){for(let c=t.furniture.length-1;c>=0;c--){const u=t.furniture[c],d=t.rooms[u.room];if(!d||u.condition==="no-desks"&&i.has(u.room))continue;const{x:m,y:x}=yi(u,d),f=th(u.type);if(l>=m&&l<=m+f.w&&r>=x&&r<=x+f.h)return u.id}for(let c=t.wallDecorations.length-1;c>=0;c--){const u=t.wallDecorations[c],d=t.rooms[u.room];if(!d)continue;const{x:m,y:x}=yi(u,d),f=th(u.type);if(l>=m&&l<=m+f.w&&r>=x&&r<=x+f.h)return u.id}return null}function _0(t,l,r,i,c){const d=[...l.wallDecorations,...l.furniture].find(y=>y.id===r);if(!d||d.condition==="no-desks"&&c.has(d.room))return;const m=l.rooms[d.room];if(!m)return;const{x,y:f}=yi(d,m),g=th(d.type);t.save(),t.fillStyle=i,t.globalAlpha=.2,t.fillRect(x-1,f-1,g.w+2,g.h+2),t.globalAlpha=.9,t.strokeStyle=i,t.lineWidth=1,t.strokeRect(x-.5,f-.5,g.w+1,g.h+1),t.restore()}function O0(t,l,r,i){t.save(),t.fillStyle=i,t.globalAlpha=.2,t.fillRect(l-1,r-1,28,42),t.globalAlpha=.9,t.strokeStyle=i,t.lineWidth=1,t.strokeRect(l-.5,r-.5,27,41),t.restore()}function B0(t,l,r){for(const[i,c]of Object.entries(t))if(l>=c.dx&&l<=c.dx+26&&r>=c.dy&&r<=c.dy+40)return i;return null}const RE=[{type:"plant",zone:"floor",label:"Plant",icon:"🪴"},{type:"bookshelf",zone:"floor",label:"Bookshelf",icon:"📚"},{type:"sofa",zone:"floor",label:"Sofa",icon:"🛋️"},{type:"coffee-table",zone:"floor",label:"Coffee Table",icon:"☕"},{type:"coffee-machine",zone:"floor",label:"Coffee Machine",icon:"☕"},{type:"meeting-table",zone:"floor",label:"Meeting Table",icon:"🪑"},{type:"window",zone:"wall",label:"Window",icon:"🪟"},{type:"picture",zone:"wall",label:"Picture",icon:"🖼️"},{type:"clock",zone:"wall",label:"Clock",icon:"🕐"},{type:"whiteboard",zone:"wall",label:"Whiteboard",icon:"📋"},{type:"shelf",zone:"wall",label:"Shelf",icon:"📦"},{type:"screen",zone:"wall",label:"Screen",icon:"🖥️"}],mc=16,_E=4,pa=4,kc=2,wt=4,Xr=4;let $e=Ng(7);const Mc={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};let yl=qr($e);function zg(t){return{x:t.dx,y:t.dy,w:t.pw,h:t.ph}}function Mg(t){return{cx:t.dx+t.pw/2,botY:t.dy+t.ph}}let Gt={};function OE(t){const l={};for(let r=0;r<t.length&&r<$e.desks.length;r++)l[t[r]]=$e.desks[r];return l}let $t,va=null,ga=null,sr=!1,gl=null,Kn=null,wn=null,sn=null,ui=null,Ml=null;function BE(t,l){const{wx:r,wy:i,ww:c,wh:u,wallColor:d,baseboardColor:m}=t,x=Ol(d,.5),f=qt(d,.5),g=[];if(l){const y=l.x-r,b=l.w;y>0&&g.push({sx:r,sw:y}),y+b<c&&g.push({sx:l.x+b,sw:c-y-b})}else g.push({sx:r,sw:c});for(const y of g){$(y.sx,i,y.sw,u,d);for(let b=0;b<u;b+=4)$(y.sx,i+b,y.sw,1,f,.08),$(y.sx,i+b+2,y.sw,1,x,.05);vi(Math.round(y.sx*7+i*13));for(let b=0;b<y.sw;b+=3)_l()>.4&&$(y.sx+b,i,1,u,f,.04);$(y.sx,i,y.sw,2,f,.3),$(y.sx,i,y.sw,1,qt(d,1),.2),$(y.sx,i+u-2,y.sw,2,x,.3),$(y.sx,i+u,y.sw,kc,m),$(y.sx,i+u,y.sw,1,qt(m,.5),.4)}l&&($(l.x-1,i,1,u+kc,"#4A3828"),$(l.x+l.w,i,1,u+kc,"#4A3828"),$(l.x,i,l.w,1,"#0A0808",.12)),$(t.fx,t.fy,t.fw,3,"#0A0808",.12),$(t.fx,t.fy+3,t.fw,2,"#0A0808",.06)}function LE(t){const l="#504038",r=Ol(l,.5),i=qt(l,.5),c=t.wx-Xr,u=t.wy,d=t.wh+kc+t.fh;$(c,u,Xr,d,l),$(c,u,1,d,i,.3),$(c+Xr-1,u,1,d,r,.4);for(let x=0;x<d;x+=6)$(c+1,u+x,Xr-2,1,i,.06);const m=t.wx+t.ww;$(m,u,Xr,d,l),$(m,u,1,d,i,.2),$(m+Xr-1,u,1,d,r,.3)}function Ff(t){const{fx:l,fy:r,fw:i,fh:c}=t,u="#B08040",d="#C89848",m="#8A6030",x="#6A4820";$(l,r,i,c,u),vi(42);for(let f=0;f<c;f+=5){const g=Math.floor(f/5)%2*10;for(let y=-10;y<i+10;y+=20){const b=l+y+g,v=Math.max(l,b),S=Math.min(b+19,l+i)-v;if(S<=0)continue;const j=_l()>.5?d:u;$(v,r+f,S,4,j,.25),$(v,r+f,S,1,d,.3),$(v,r+f+4,S,1,x,.35),b>=l&&b<l+i&&$(b,r+f,1,4,x,.2),$(v,r+f+2,S,1,m,.1)}}$(l,r,i,2,"#0A0808",.08),$(l,r,2,c,"#0A0808",.06)}function L0(t){const{fx:l,fy:r,fw:i,fh:c}=t,u="#1C2A38",d="#101820";vi(99),$(l,r,i,c,u);for(let m=0;m<c;m+=mc)for(let x=0;x<i;x+=mc){const f=Math.min(mc,i-x),g=Math.min(mc,c-m);_l()>.5&&$(l+x,r+m,f,g,qt(u,.2),.15),$(l+x+2,r+m+2,f-4,g-4,qt(u,.3),.08),$(l+x,r+m,f,1,d,.5),$(l+x,r+m,1,g,d,.5),$(l+x+1,r+m+1,1,g-1,qt(u,.4),.1),_l()>.85&&it(l+x+4+Math.floor(_l()*8),r+m+4+Math.floor(_l()*8),"#3A6A9A",.08)}}function $E(t){const{fx:l,fy:r,fw:i,fh:c}=t,u="#387848",d="#4A9058",m="#285E38";$(l,r,i,c,u),vi(77);for(let f=0;f<c;f+=2)for(let g=0;g<i;g+=2)_l()>.5&&it(l+g,r+f,d,.1),_l()>.8&&it(l+g+1,r+f+1,m,.12);const x=5;$(l+x,r+x,i-x*2,1,d,.45),$(l+x,r+c-x-1,i-x*2,1,m,.45),$(l+x,r+x,1,c-x*2,d,.35),$(l+i-x-1,r+x,1,c-x*2,m,.35)}function HE(t){const{fx:l,fy:r,fw:i,fh:c}=t,u="#D8C490",d="#B09060",m="#907848";vi(55);for(let x=0;x<c;x+=8)for(let f=0;f<i;f+=8){const g=Math.min(8,i-f),y=Math.min(8,c-x),b=(f/8+x/8)%2===0?d:u;$(l+f,r+x,g,y,b),$(l+f+1,r+x+1,g-2,1,qt(b,.4),.2),$(l+f+1,r+x+1,1,y-2,qt(b,.4),.15),$(l+f+g-2,r+x+2,1,y-3,Ol(b,.4),.15),$(l+f+2,r+x+y-2,g-3,1,Ol(b,.4),.15),$(l+f,r+x,g,1,m,.3),$(l+f,r+x,1,y,m,.3)}}function UE(){const{canvasW:t,canvasH:l,rooms:r,doors:i}=$e,c="#2A1E14",u="#3A2E24";if($(0,0,t,pa,c),$(0,l-pa,t,pa,c),$(0,0,pa,l,c),$(t-pa,0,pa,l,c),$(0,0,t,1,u,.3),$(0,0,1,l,u,.2),!r.exec||!r.work||!r.meet||!r.comm)return;const d=r.exec,m=r.meet,x=t/2,f=x-wt/2,g=d.fy+d.fh,y=i.exec_work,b=i.meet_comm,v=i.exec_meet,S=i.work_comm,j=24,E=28,C=((y==null?void 0:y.doorY)??d.fy+20)-j/2,A=((v==null?void 0:v.doorX)??pa+Xr+54)-E/2,F=((S==null?void 0:S.doorX)??x+wt/2+Xr+54)-E/2,_=((b==null?void 0:b.doorY)??m.fy+20)-j/2;$(0,g,A,wt,c),$(A+E,g,f-A-E,wt,c),$(f+wt,g,F-f-wt,wt,c),$(F+E,g,t-F-E,wt,c),$(0,g,A,1,u,.3),$(A+E,g,f-A-E,1,u,.3),$(f+wt,g,F-f-wt,1,u,.3),$(F+E,g,t-F-E,1,u,.3),$(f,0,wt,C,c),$(f,C+j,wt,g-C-j,c),$(f,g+wt,wt,_-g-wt,c),$(f,_+j,wt,l-_-j,c),$(f,0,1,C,u,.2),$(f,C+j,1,g-C-j,u,.2),$(f,g+wt,1,_-g-wt,u,.2),$(f,_+j,1,l-_-j,u,.2),$(f,C,wt,j,"#C4A070"),$(f+wt/2,C,wt/2,j,"#3A4858"),$(f,_,wt,j,"#7AA880"),$(f+wt/2,_,wt/2,j,"#C8B890");const H="#4A3828";$(f,C-1,wt,1,H),$(f,C+j,wt,1,H),$(A-1,g,1,wt,H),$(A+E,g,1,wt,H),$(F-1,g,1,wt,H),$(F+E,g,1,wt,H),$(f,_-1,wt,1,H),$(f,_+j,wt,1,H)}const $0=new Map;function IE(t){const l=`${t.hairStyle??""}|${t.outfitStyle??""}|${t.accessory??""}`;let r=$0.get(l);if(!r){const i=Kf("mini-seated:default"),c=sg(i,t);r=c?c.layers.flatMap(u=>u.pixels):[],$0.set(l,r)}return r}function YE(t,l,r){Qf($t,IE(r),t,l,r)}function qE(t,l,r,i,c){ya(t+8,l+20,"up"),c||YE(t+8,l+0+i,r),DE(t,l+14)}function XE(t,l,r,i,c){const u=i in z0?i:"down",d=c%4,m=z0[u][d];Qf($t,m,t,l,r);const x=d===1||d===3?-1:0;if(r.accessory&&r.accessory!=="none"){const f=_j(r.accessory,u);f&&f.pixels.length>0&&Qf($t,f.pixels,t,l+x,r)}$t.globalAlpha=1}function VE(t){const l={};let r=0;for(const i of t){const c=Gt[i];c&&(l[i]={state:"sitting",homeX:c.dx+8,homeY:c.dy+34,homeRoom:c.room,x:c.dx+8,y:c.dy+34,path:[],room:c.room,dir:"down",walkFrame:0,walkTimer:0,bobY:0,bobOff:r*17,stateTimer:600+Math.floor(Math.random()*900)},r++)}return l}function zs(t,l,r,i,c){const u=$e.corridorY[c]??l,d=[];return l<u-4&&d.push({x:t,y:u}),Math.abs(t-r)>4&&d.push({x:r,y:u}),d.push({x:r,y:i}),d}function Rf(t,l,r,i){const c=$e.adjacency[r];if(!c)return[];const u=c.find(g=>g.room===i);if(!u)return[];const d=$e.doors[u.door];if(!d)return[];const m=[],x=$e.corridorY[r]??l,f=$e.corridorY[i]??l;if(Math.abs(l-x)>4&&m.push({x:t,y:x}),d.type==="v"){const g=u.side==="A"?d.xA:d.xB,y=u.side==="A"?d.xB:d.xA;m.push({x:g,y:x}),m.push({x:g,y:d.doorY}),m.push({x:y,y:d.doorY}),m.push({x:y,y:f})}else{const g=u.side==="A"?d.yA:d.yB,y=u.side==="A"?d.yB:d.yA;m.push({x:d.doorX,y:x}),m.push({x:d.doorX,y:g}),m.push({x:d.doorX,y}),m.push({x:d.doorX,y:f})}return m}function Fg(t,l){const r=$e.adjacency[t.room];if(!r)return[];if(!r.find(c=>c.room===l)){for(const c of r){const u=$e.adjacency[c.room];if(u!=null&&u.find(d=>d.room===l)){const d=Rf(t.x,t.y,t.room,c.room),m=d[d.length-1],x=Rf((m==null?void 0:m.x)??t.x,(m==null?void 0:m.y)??t.y,c.room,l);return[...d,...x]}}return[]}return Rf(t.x,t.y,t.room,l)}function GE(t){if(t.room!==t.homeRoom){const l=Fg({...t},t.homeRoom),r=l[l.length-1],i=zs((r==null?void 0:r.x)??t.x,(r==null?void 0:r.y)??t.y,t.homeX,t.homeY,t.homeRoom);return[...l,...i]}return zs(t.x,t.y,t.homeX,t.homeY,t.room)}function KE(t,l){for(const[,r]of Object.entries(t))if(r.stateTimer--,r.state==="sitting"){if(r.bobY=(l+r.bobOff)%60<30?1:0,r.stateTimer<=0){r.state="walking",r.x=r.homeX,r.y=r.homeY,r.room=r.homeRoom;const i=Object.keys($e.rooms);if(Math.random()<.25&&i.length>1){const c=i.filter(x=>x!==r.room),u=c[Math.floor(Math.random()*c.length)],d=Fg(r,u),m=$e.waypoints[u];if(m&&m.length>0){const x=m[Math.floor(Math.random()*m.length)],f=d[d.length-1]??{x:r.x,y:r.y},g=zs(f.x,f.y,x.x,x.y,u);r.path=[...d,...g]}else r.path=d;r.walkTimer=0}else{const c=$e.waypoints[r.room];if(c&&c.length>0){const u=c[Math.floor(Math.random()*c.length)];r.path=zs(r.x,r.y,u.x,u.y,r.room)}r.walkTimer=0}}}else if(r.state==="walking"||r.state==="returning"){if(r.path.length===0){r.state==="returning"?(r.state="sitting",r.room=r.homeRoom,r.stateTimer=800+Math.floor(Math.random()*1200)):(r.state="idle",r.dir="down",r.stateTimer=180+Math.floor(Math.random()*360));continue}const i=r.path[0],c=i.x-r.x,u=i.y-r.y,d=Math.sqrt(c*c+u*u);if(d<1.5){r.x=i.x,r.y=i.y,r.path.shift();for(const[m,x]of Object.entries($e.rooms))if(r.x>=x.fx&&r.x<=x.fx+x.fw&&r.y>=x.fy&&r.y<=x.fy+x.fh){r.room=m;break}}else r.x+=c/d*.2,r.y+=u/d*.2,Math.abs(c)>Math.abs(u)?r.dir=c>0?"right":"left":r.dir=u>0?"down":"up",r.walkTimer++,r.walkFrame=Math.floor(r.walkTimer/12)%4}else if(r.state==="idle"&&r.stateTimer<=0)if(Math.random()<.3){r.state="walking";const i=$e.waypoints[r.room];if(i&&i.length>0){const c=i[Math.floor(Math.random()*i.length)];r.path=zs(r.x,r.y,c.x,c.y,r.room)}r.walkTimer=0}else r.state="returning",r.path=GE(r),r.walkTimer=0}function QE(t,l,r){const{canvasW:i,canvasH:c,rooms:u}=$e;$t.clearRect(0,0,i,c),$(0,0,i,c,"#2A1E14");const d={wood:Ff,dark:L0,carpet:$E,tile:HE};for(const y of Object.values(u))(d[y.floorType]??Ff)(y);const m=Object.keys(u);if(m.length>=4){const y=u.exec,b=u.meet,{doors:v}=$e;if(y&&b&&v.exec_meet&&v.work_comm){const j=(v.exec_meet.doorX??0)-14,E=(v.work_comm.doorX??0)-28/2,C=y.fy+y.fh,A=b.fy;Ff({fx:j,fy:C,fw:28,fh:A-C}),L0({fx:E,fy:C,fw:28,fh:A-C})}}const x={};if(m.length>=4){const{doors:y}=$e,b=28,v=y.exec_meet,S=y.work_comm;v!=null&&v.doorX&&(x.meet={x:v.doorX-b/2,w:b}),S!=null&&S.doorX&&(x.comm={x:S.doorX-b/2,w:b})}for(const y of Object.values(u))BE(y,x[y.id]),LE(y);UE(),zE($e);const f=[],g=new Set(Object.values(Gt).map(y=>y.room));ME($e,f,g);for(const[y,b]of Object.entries(Gt)){const v=t[y];if(!v)continue;const S=v.state==="sitting",j=l(y),E=r[y]==="working";f.push({y:b.dy+14,draw:()=>{if(qE(b.dx,b.dy,j,S?v.bobY:0,!S),S&&E){const C=Mc[y]??"#388bfd";$(b.dx+7,b.dy+14-4,12,5,C,.15),it(b.dx+12,b.dy+14+1,"#4CAF50",.8)}}})}for(const[y,b]of Object.entries(t))if(b.state!=="sitting"){const v=l(y);f.push({y:b.y+14,draw:()=>XE(Math.round(b.x),Math.round(b.y),v,b.dir,b.walkFrame)})}f.sort((y,b)=>y.y-b.y);for(const y of f)y.draw();for(const y of yl){const b=ga===y.id,v=Mg(y);if($t.save(),$t.globalAlpha=b?.9:.5,$t.fillStyle=y.color,$t.fillRect(v.cx-1,v.botY-2,3,3),b){const S=zg(y);$t.globalAlpha=.3,$t.strokeStyle=y.color,$t.lineWidth=1,$t.strokeRect(S.x-1,S.y-1,S.w+2,S.h+2)}$t.restore()}if(sr){const y=new Set(Object.values(Gt).map(b=>b.room));if(gl&&gl!==Kn)if(gl.startsWith("desk:")){const b=gl.slice(5),v=Gt[b];v&&O0($t,v.dx,v.dy,"#FBBF24")}else _0($t,$e,gl,"#FBBF24",y);if(Kn)if(Kn.startsWith("desk:")){const b=Kn.slice(5),v=Gt[b];v&&O0($t,v.dx,v.dy,"#3B82F6")}else _0($t,$e,Kn,"#3B82F6",y)}if(va){const y=Gt[va],b=t[va];y&&b&&($t.save(),$t.globalAlpha=.25,$t.fillStyle=Mc[va]??"#fff",b.state==="sitting"?$t.fillRect(y.dx-1,y.dy+6,28,30):$t.fillRect(Math.round(b.x)-1,Math.round(b.y)-1,14,24),$t.restore())}}function WE({roles:t,projects:l,roleStatuses:r,activeExecs:i,onRoleClick:c,onProjectClick:u,onBulletinClick:d,onDecisionsClick:m,onKnowledgeClick:x,onSettingsClick:f,onThemeClick:g,onStatsClick:y,getRoleSpeech:b,getAppearance:v,onHireClick:S}){const j=k.useRef(null),E=k.useRef(null),C=k.useRef(null),A=k.useRef({}),F=k.useRef(0),_=k.useRef(_E),[H,M]=k.useState(!1),[I,W]=k.useState(null),[te,D]=k.useState(null),Y=k.useRef({}),B=k.useRef({}),V=k.useRef([]),ne=k.useRef([]);k.useEffect(()=>{sr=H},[H]),k.useEffect(()=>{ui=I,Ml=te},[I,te]),k.useEffect(()=>{Ce.getPreferences().then(me=>{const he=me.furnitureOverrides;he&&Object.keys(he).length>0&&(Y.current=he,$e=M0($e,he));const ge=me.deskOverrides;if(ge&&Object.keys(ge).length>0){B.current=ge,F0(Gt,ge);for(const[Ae,De]of Object.entries(Gt)){const je=A.current[Ae];je&&(je.homeX=De.dx+8,je.homeY=De.dy+34)}}const ke=me.removedFurniture;ke&&ke.length>0&&(V.current=ke,$e=zf($e,ke));const Fe=me.addedFurniture;Fe&&Fe.length>0&&(ne.current=Fe,$e=R0($e,Fe)),yl=qr($e)}).catch(()=>{})},[]);const G=k.useRef({roleStatuses:r,activeExecs:i,getRoleSpeech:b,getAppearance:v});G.current={roleStatuses:r,activeExecs:i,getRoleSpeech:b,getAppearance:v};const L=k.useMemo(()=>t.map(me=>me.id),[t]),Z=k.useRef($e);k.useEffect(()=>{const me=L.length,he=Eg(me,Z.current.preset);let ge=Ng(me,he);V.current.length>0&&(ge=zf(ge,V.current)),ne.current.length>0&&(ge=R0(ge,ne.current)),Object.keys(Y.current).length>0&&(ge=M0(ge,Y.current)),$e=ge,Z.current=ge,Gt=OE(L),Object.keys(B.current).length>0&&F0(Gt,B.current),yl=qr(ge),A.current=VE(L);const ke=j.current;ke&&(ke.width=ge.canvasW,ke.height=ge.canvasH),ue()},[L]);const de=k.useCallback(me=>{var he,ge;return((ge=(he=G.current).getAppearance)==null?void 0:ge.call(he,me))??Th(me)},[]),ue=k.useCallback(()=>{const me=E.current,he=j.current;if(!me||!he)return;const ge=me.parentElement;if(!ge)return;const ke=ge.clientWidth,Fe=ge.clientHeight;if(ke===0||Fe===0)return;const{canvasW:Ae,canvasH:De}=$e;let je=Math.floor(Math.min(ke/Ae,Fe/De));je=Math.max(2,Math.min(je,5)),_.current=je,he.style.width=Ae*je+"px",he.style.height=De*je+"px",me.style.width=Ae*je+"px",me.style.height=De*je+"px"},[]);k.useEffect(()=>{var De;const me=j.current;if(!me)return;const he=me.getContext("2d");if(!he)return;$t=he,pE(he),ue();const ge=new ResizeObserver(()=>ue()),ke=(De=E.current)==null?void 0:De.parentElement;ke&&ge.observe(ke);let Fe;const Ae=()=>{F.current++,KE(A.current,F.current),QE(A.current,de,G.current.roleStatuses),z(),Fe=requestAnimationFrame(Ae)};return Fe=requestAnimationFrame(Ae),()=>{cancelAnimationFrame(Fe),ge.disconnect()}},[de,ue]),k.useEffect(()=>{const me=C.current;if(!me)return;me.innerHTML="";const he={};for(const ke of t)he[ke.id]=ke.name;for(const ke of L){const Fe=Mc[ke]??"#8b949e",Ae=he[ke],De=Ae&&Ae.toLowerCase()!==ke.toLowerCase()?`${ke.toUpperCase()} · ${Ae}`:ke.toUpperCase(),je=document.createElement("div");je.className="td-nametag",je.dataset.role=ke;const _e=document.createElement("span");_e.className="td-dot",_e.style.background=Fe,je.appendChild(_e),je.appendChild(document.createTextNode(De)),me.appendChild(je);const Ke=document.createElement("div");Ke.className="td-bubble",Ke.dataset.role=ke,Ke.dataset.type="bubble",me.appendChild(Ke)}const ge={meeting:()=>{const ke=l[0];ke?u(ke.id):d()},bulletin:d,decisions:m,knowledge:x,settings:f,theme:g,stats:y};for(const ke of yl){const Fe=document.createElement("div");Fe.className="td-facility-label",Fe.dataset.facility=ke.id,Fe.textContent=`${ke.icon} ${ke.label}`,Fe.style.borderColor=`${ke.color}44`;const Ae=ge[ke.id];Ae&&Fe.addEventListener("click",Ae),Fe.addEventListener("mouseenter",()=>{ga=ke.id}),Fe.addEventListener("mouseleave",()=>{ga=null}),me.appendChild(Fe)}},[L,t,l,u,d,m,x,f,g,y]);const z=k.useCallback(()=>{var De;const me=C.current;if(!me)return;const he=_.current,ge=A.current,{getRoleSpeech:ke,roleStatuses:Fe,activeExecs:Ae}=G.current;for(const je of Object.keys(ge)){const _e=ge[je],Ke=Gt[je];if(!Ke)continue;let Et,Ht,gt;_e.state==="sitting"?(Et=Ke.dx+13,gt=Ke.dy+2,Ht=Ke.dy+37):(Et=Math.round(_e.x)+6,gt=Math.round(_e.y)-2,Ht=Math.round(_e.y)+18);const Rt=Et/$e.canvasW*100,re=me.querySelector(`.td-nametag[data-role="${je}"]`);if(re){re.style.left=Rt+"%",re.style.top=Ht*he+2+"px";const Te=re.querySelector(".td-dot");if(Te){const Ye=Fe[je]==="working";Te.style.background=Ye?"#FBBF24":Mc[je]??"#8b949e",Ye?Te.style.animation="td-pulse 1s ease-in-out infinite":Te.style.animation=""}}const pe=me.querySelector(`.td-bubble[data-role="${je}"]`);if(pe){const Te=Fe[je]==="working",Ye=(De=Ae.find(ze=>ze.roleId===je))==null?void 0:De.task,xe=ke(je),q=Te&&Ye?Ye.slice(0,60):xe?xe.slice(0,60):"";q&&_e.state==="sitting"?(pe.style.display="",pe.style.left=Rt+"%",pe.style.top=(gt-10)*he+"px",pe.textContent=q):pe.style.display="none"}}for(const je of yl){const _e=me.querySelector(`.td-facility-label[data-facility="${je.id}"]`);if(_e){const Ke=Mg(je);_e.style.left=Ke.cx/$e.canvasW*100+"%",_e.style.top=Ke.botY*he-4+"px",_e.classList.toggle("td-facility-label--hover",ga===je.id)}}},[]),R=k.useCallback(me=>{const he=j.current;if(!he)return null;const ge=he.getBoundingClientRect(),ke=_.current,Fe=(me.clientX-ge.left)/ke,Ae=(me.clientY-ge.top)/ke,De=A.current;for(const[je,_e]of Object.entries(Gt)){if(!De[je])continue;const Ke=De[je];if(Ke.state==="sitting"){if(Fe>=_e.dx&&Fe<=_e.dx+26&&Ae>=_e.dy&&Ae<=_e.dy+40)return{type:"role",id:je}}else if(Fe>=Ke.x-2&&Fe<=Ke.x+14&&Ae>=Ke.y-2&&Ae<=Ke.y+20)return{type:"role",id:je}}for(const je of yl){const _e=zg(je);if(Fe>=_e.x&&Fe<=_e.x+_e.w&&Ae>=_e.y&&Ae<=_e.y+_e.h)return{type:"facility",id:je.id}}return null},[]),K=k.useCallback(me=>{const he=j.current;if(!he)return{mx:0,my:0};const ge=he.getBoundingClientRect(),ke=_.current;return{mx:(me.clientX-ge.left)/ke,my:(me.clientY-ge.top)/ke}},[]),T=k.useCallback(me=>{Ce.updatePreferences(me).catch(()=>{})},[]),fe=k.useCallback(me=>{const he=[...V.current,me];V.current=he,$e=zf($e,[me]),yl=qr($e),Kn=null,gl=null,T({removedFurniture:he})},[T]),Ee=k.useCallback((me,he)=>{if(!ui||!Ml)return;let ge=null;for(const[_e,Ke]of Object.entries($e.rooms)){const Et=Ml==="wall"?Ke.wx:Ke.fx,Ht=Ml==="wall"?Ke.wy:Ke.fy,gt=Ml==="wall"?Ke.ww:Ke.fw,Rt=Ml==="wall"?Ke.wh:Ke.fh;if(me>=Et&&me<=Et+gt&&he>=Ht&&he<=Ht+Rt){ge=_e;break}}if(!ge)return;const ke=$e.rooms[ge],Fe=Ml==="wall"?ke.wx:ke.fx,Ae=Ml==="wall"?ke.wy:ke.fy,De={id:`user-${ui}-${Date.now()}`,type:ui,room:ge,zone:Ml,offsetX:Math.round(me-Fe),offsetY:Math.round(he-Ae)},je=[...ne.current,De];ne.current=je,Ml==="wall"?$e.wallDecorations.push(De):$e.furniture.push(De),yl=qr($e),T({addedFurniture:je}),W(null),D(null)},[T]),Ne=k.useCallback(me=>{const he=j.current;if(sr&&wn){const{mx:ke,my:Fe}=K(me),De=[...$e.furniture,...$e.wallDecorations].find(Ke=>Ke.id===wn.defId);if(!De)return;const je=ke-wn.startMx,_e=Fe-wn.startMy;De.offsetX=Math.round(wn.origOffX+je),De.offsetY=Math.round(wn.origOffY+_e),yl=qr($e),he&&(he.style.cursor="grabbing");return}if(sr&&sn){const{mx:ke,my:Fe}=K(me),Ae=Gt[sn.roleId];if(!Ae)return;Ae.dx=Math.round(sn.origDx+(ke-sn.startMx)),Ae.dy=Math.round(sn.origDy+(Fe-sn.startMy));const De=A.current[sn.roleId];De&&(De.homeX=Ae.dx+8,De.homeY=Ae.dy+34),he&&(he.style.cursor="grabbing");return}if(sr){const{mx:ke,my:Fe}=K(me);if(ui){he&&(he.style.cursor="crosshair");return}const Ae=new Set(Object.values(Gt).map(je=>je.room)),De=Mf($e,ke,Fe,Ae);if(De)gl=De;else{const je=B0(Gt,ke,Fe);gl=je?`desk:${je}`:null}va=null,ga=null,he&&(he.style.cursor=gl?"grab":"default");return}const ge=R(me);va=(ge==null?void 0:ge.type)==="role"?ge.id:null,ga=(ge==null?void 0:ge.type)==="facility"?ge.id:null,gl=null,he&&(he.style.cursor=ge?"pointer":"default")},[R,K]),Le=k.useCallback(me=>{if(!sr)return;const{mx:he,my:ge}=K(me);if(ui){Ee(he,ge),me.preventDefault();return}const ke=new Set(Object.values(Gt).map(De=>De.room)),Fe=Mf($e,he,ge,ke);if(Fe){const je=[...$e.furniture,...$e.wallDecorations].find(_e=>_e.id===Fe);je&&(Kn=Fe,wn={defId:Fe,startMx:he,startMy:ge,origOffX:je.offsetX,origOffY:je.offsetY},me.preventDefault());return}const Ae=B0(Gt,he,ge);if(Ae){const De=Gt[Ae];Kn=`desk:${Ae}`,sn={roleId:Ae,startMx:he,startMy:ge,origDx:De.dx,origDy:De.dy},me.preventDefault();return}Kn=null},[K,Ee]),Be=k.useCallback(me=>{if(wn){const ge=[...$e.furniture,...$e.wallDecorations].find(ke=>ke.id===wn.defId);if(ge){const ke={...Y.current,[ge.id]:{offsetX:ge.offsetX,offsetY:ge.offsetY}};Y.current=ke,T({furnitureOverrides:ke}),yl=qr($e)}wn=null,j.current&&(j.current.style.cursor="grab");return}if(sn){const he=Gt[sn.roleId];if(he){const ge={...B.current,[sn.roleId]:{dx:he.dx,dy:he.dy}};B.current=ge,T({deskOverrides:ge})}sn=null,j.current&&(j.current.style.cursor="grab")}},[T]),Qe=k.useCallback(me=>{if(!sr)return;me.preventDefault();const{mx:he,my:ge}=K(me),ke=new Set(Object.values(Gt).map(Ae=>Ae.room)),Fe=Mf($e,he,ge,ke);Fe&&fe(Fe)},[K,fe]);k.useEffect(()=>{const me=he=>{!sr||!Kn||(he.key==="Delete"||he.key==="Backspace")&&(Kn.startsWith("desk:")||fe(Kn))};return window.addEventListener("keydown",me),()=>window.removeEventListener("keydown",me)},[fe]);const Se=k.useCallback(()=>{if(wn){const he=[...$e.furniture,...$e.wallDecorations].find(ge=>ge.id===wn.defId);he&&(he.offsetX=wn.origOffX,he.offsetY=wn.origOffY,yl=qr($e)),wn=null}if(sn){const me=Gt[sn.roleId];me&&(me.dx=sn.origDx,me.dy=sn.origDy);const he=A.current[sn.roleId];he&&(he.homeX=me.dx+8,he.homeY=me.dy+34),sn=null}va=null,ga=null,gl=null,j.current&&(j.current.style.cursor="default")},[]),tt=k.useCallback(me=>{if(sr)return;const he=R(me);if(he){if(he.type==="role"){c(he.id);return}switch(he.id){case"meeting":{const ge=l[0];ge?u(ge.id):d();break}case"bulletin":d();break;case"decisions":m();break;case"knowledge":x();break;case"settings":f==null||f();break;case"theme":g==null||g();break;case"stats":y==null||y();break}}},[R,c,u,d,m,x,f,g,y]);return s.jsxs("div",{className:`td-scene${H?" td-scene--editing":""}`,children:[s.jsxs("div",{ref:E,className:"td-wrap",children:[s.jsx("canvas",{ref:j,width:$e.canvasW,height:$e.canvasH,className:"td-canvas",onClick:tt,onMouseDown:Le,onMouseUp:Be,onMouseMove:Ne,onMouseLeave:Se,onContextMenu:Qe}),s.jsx("div",{ref:C,className:"td-overlay"})]}),H&&s.jsxs("div",{className:"td-edit-banner",children:[s.jsx("span",{className:"td-edit-banner__icon",children:"✎"})," EDIT MODE — Click DONE when finished"]}),s.jsxs("button",{className:`td-edit-btn${H?" td-edit-btn--active":""}`,onClick:()=>{M(me=>{const he=!me;return he||(W(null),D(null)),he}),Kn=null,wn=null,sn=null},title:H?"Exit Edit Mode":"Edit Furniture Layout",children:[s.jsx("span",{className:"td-edit-btn__icon",children:H?"✓":"✎"}),s.jsx("span",{className:"td-edit-btn__label",children:H?"DONE":"EDIT"})]}),H&&s.jsx("div",{className:"td-palette",children:RE.map(me=>s.jsx("button",{className:`td-palette__item${I===me.type?" td-palette__item--active":""}`,onClick:()=>{I===me.type?(W(null),D(null)):(W(me.type),D(me.zone))},title:me.label,children:s.jsx("span",{children:me.icon})},me.type))}),S&&s.jsxs("button",{className:"td-hire-btn",onClick:S,title:"Hire New Role",children:[s.jsx("span",{className:"td-hire-btn__icon",children:"+"}),s.jsx("span",{className:"td-hire-btn__label",children:"HIRE"})]})]})}function ZE({role:t,appearance:l,onSave:r,onReset:i,onClose:c,theme:u,onThemeChange:d,onUpdateName:m,initialTab:x,characterOnly:f,speechSettings:g,onSpeechSettingsChange:y,language:b,onLanguageChange:v,roleLevel:S}){var Y;const[j,E]=k.useState(x??"character"),[C,A]=k.useState({...l}),[F,_]=k.useState(t.name),[H,M]=k.useState(!1),I=k.useCallback(()=>A(fi(S)),[S]),W=k.useCallback(()=>{const B=Th(t.id);A({...B}),i()},[t.id,i]),te=k.useCallback(async()=>{r(C);const B=F.trim();if(m&&B&&B!==t.name){M(!0);try{await m(t.id,B)}catch{}M(!1)}c()},[C,r,c,F,t.name,t.id,m]),D=s.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6},children:[s.jsxs("span",{children:[t.id.toUpperCase()," –"]}),m?s.jsx("input",{value:F,onChange:B=>_(B.target.value),disabled:H,className:"customize-name-input",style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.15)",borderRadius:4,color:"inherit",font:"inherit",padding:"2px 6px",flex:1,minWidth:0}}):s.jsx("span",{children:t.name})]});return s.jsx("div",{className:"customize-overlay",onClick:c,children:s.jsxs("div",{className:"customize-modal",onClick:B=>B.stopPropagation(),children:[s.jsxs("div",{className:"customize-header",children:[s.jsxs("div",{className:"customize-tabs",children:[s.jsx("button",{className:`customize-tab ${j==="character"?"active":""}`,onClick:()=>E("character"),children:"CHARACTER"}),!f&&s.jsxs(s.Fragment,{children:[s.jsx("button",{className:`customize-tab ${j==="office"?"active":""}`,onClick:()=>E("office"),children:"OFFICE THEME"}),s.jsx("button",{className:`customize-tab ${j==="settings"?"active":""}`,onClick:()=>E("settings"),children:"SETTINGS"})]})]}),s.jsx("button",{className:"customize-close",onClick:c,children:"X"})]}),j==="character"?s.jsx("div",{className:"customize-body",children:s.jsx(vg,{roleId:t.id,appearance:C,onChange:A,onRandomize:I,onReset:W,label:D,roleLevel:S})}):j==="office"?s.jsx("div",{className:"customize-body",children:s.jsx("div",{className:"customize-themes",children:Object.entries(Gr).map(([B,V])=>s.jsxs("button",{className:`customize-theme-card ${u===B?"active":""}`,onClick:()=>d(B),children:[s.jsxs("div",{className:"customize-theme-preview",style:{background:V.vars["--floor-light"],borderColor:V.vars["--pixel-border"]},children:[s.jsx("div",{style:{background:V.vars["--hud-bg"],height:8,borderBottom:`2px solid ${V.vars["--pixel-border"]}`}}),s.jsxs("div",{className:"flex-1 flex items-center justify-center gap-1 p-1",children:[s.jsx("div",{style:{width:10,height:14,background:V.vars["--accent"],borderRadius:1}}),s.jsx("div",{style:{width:10,height:14,background:V.vars["--active-green"],borderRadius:1}}),s.jsx("div",{style:{width:10,height:14,background:V.vars["--idle-amber"],borderRadius:1}})]}),s.jsx("div",{style:{background:V.vars["--hud-bg"],height:6,borderTop:`2px solid ${V.vars["--pixel-border"]}`}})]}),s.jsxs("div",{className:"customize-theme-name",children:[V.icon," ",V.name]})]},B))})}):s.jsx("div",{className:"customize-body",children:s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20,padding:"8px 0"},children:[s.jsxs("div",{children:[s.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"AMBIENT SPEECH MODE"}),s.jsx("div",{style:{display:"flex",gap:6},children:["template","llm","auto"].map(B=>s.jsxs("button",{onClick:()=>y==null?void 0:y({mode:B}),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(g==null?void 0:g.mode)===B?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(g==null?void 0:g.mode)===B?"rgba(255,255,255,0.08)":"transparent",color:(g==null?void 0:g.mode)===B?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center"},children:[s.jsx("div",{style:{fontWeight:600,marginBottom:2},children:B==="template"?"TEMPLATE":B==="llm"?"AI":"AUTO"}),s.jsx("div",{style:{fontSize:9,opacity:.7},children:B==="template"?"Static pool ($0)":B==="llm"?"LLM generated":"Detect engine"})]},B))}),s.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Auto: CLI Max = AI, BYOK = Template"})]}),s.jsxs("div",{children:[s.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["SPEECH INTERVAL: ",(g==null?void 0:g.intervalSec)??18,"s"]}),s.jsx("input",{type:"range",min:5,max:120,step:5,value:(g==null?void 0:g.intervalSec)??18,onChange:B=>y==null?void 0:y({intervalSec:Number(B.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[s.jsx("span",{children:"5s (frequent)"}),s.jsx("span",{children:"120s (rare)"})]})]}),(g==null?void 0:g.mode)!=="template"&&s.jsxs("div",{children:[s.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["DAILY LLM BUDGET: $",((Y=g==null?void 0:g.dailyBudgetUsd)==null?void 0:Y.toFixed(2))??"1.00"]}),s.jsx("input",{type:"range",min:0,max:5,step:.25,value:(g==null?void 0:g.dailyBudgetUsd)??1,onChange:B=>y==null?void 0:y({dailyBudgetUsd:Number(B.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[s.jsx("span",{children:"$0 (unlimited)"}),s.jsx("span",{children:"$5.00/day"})]})]}),s.jsxs("div",{children:[s.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"LANGUAGE"}),s.jsx("div",{style:{display:"flex",gap:6},children:[{key:"auto",label:"Auto"},{key:"en",label:"English"},{key:"ko",label:"한국어"},{key:"ja",label:"日本語"}].map(({key:B,label:V})=>s.jsx("button",{onClick:()=>v==null?void 0:v(B),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(b??"auto")===B?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(b??"auto")===B?"rgba(255,255,255,0.08)":"transparent",color:(b??"auto")===B?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center",fontWeight:600},children:V},B))}),s.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Sets language for AI responses and speech bubbles"})]})]})}),j==="character"&&s.jsxs("div",{className:"customize-footer",children:[s.jsx("button",{className:"customize-btn customize-btn--cancel",onClick:c,children:"CANCEL"}),s.jsx("button",{className:"customize-btn customize-btn--save",onClick:te,children:"SAVE"})]})]})})}function H0(t){if(t.length===0)return"";const l={};for(const{file:m}of t){const x=m.split("/"),f=x[0]==="."?x[1]??"root":x[0];(l[f]??(l[f]=[])).push(m)}const r={roles:"roles",projects:"projects",operations:"operations",knowledge:"knowledge",architecture:"architecture",company:"company",".tycono":"config",".claude":"skills"},i=[];for(const[m,x]of Object.entries(l)){const f=r[m]??m;if(x.length===1){const g=x[0].split("/").pop()??x[0];i.push(`${f}/${g}`)}else i.push(`${f} (${x.length} files)`)}const c=t.some(m=>m.status==="A"),u=t.some(m=>m.status==="M");return`${c&&!u?"add":"update"}: ${i.join(", ")}`}function U0(t){const l=Date.now()-new Date(t).getTime(),r=Math.floor(l/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const i=Math.floor(r/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function JE({status:t,history:l,onClose:r,onSave:i,onLoadHistory:c,onRestore:u,saving:d,onDelegate:m,delegateRoleName:x}){const[f,g]=k.useState("save"),[y,b]=k.useState(""),[v,S]=k.useState(null),[j,E]=k.useState(!1),[C,A]=k.useState(null),F=k.useRef(null);k.useEffect(()=>{f==="history"&&c()},[f,c]),k.useEffect(()=>{var D;(D=F.current)==null||D.focus()},[]);const _=[...((t==null?void 0:t.modified)??[]).map(D=>({status:"M",file:D})),...((t==null?void 0:t.untracked)??[]).map(D=>({status:"A",file:D}))],H=k.useRef(!1);k.useEffect(()=>{!H.current&&_.length>0&&!y&&(b(H0(_)),H.current=!0)},[_.length]);const M=k.useCallback(()=>{b(H0(_))},[_]),I=async()=>{S(null),A(null);try{const D=await i(y||void 0);A(D),b("")}catch(D){S(D instanceof Error?D.message:"Save failed")}},W=async D=>{if(confirm(`Restore from commit ${D.slice(0,7)}? This creates a new commit with those files.`)){E(!0);try{await u(D),E(!1)}catch(Y){S(Y instanceof Error?Y.message:"Restore failed"),E(!1)}}};k.useEffect(()=>{const D=Y=>{Y.key==="Escape"&&r()};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[r]);const te=D=>{D.key==="Enter"&&(D.metaKey||D.ctrlKey)&&I()};return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:r}),s.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[520px] max-h-[80vh] z-[61] overflow-hidden flex flex-col",style:{background:"var(--hud-bg)",border:"3px solid var(--pixel-border)",fontFamily:"var(--pixel-font)",color:"var(--terminal-text)"},onKeyDown:te,children:[s.jsxs("div",{className:"px-5 py-3 flex items-center justify-between shrink-0",style:{borderBottom:"2px solid var(--pixel-border)"},children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"text-lg font-black tracking-tight",children:"SAVE GAME"}),s.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-secondary)"},children:(t==null?void 0:t.branch)??""})]}),s.jsx("button",{onClick:r,className:"text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)] cursor-pointer text-lg",children:"×"})]}),s.jsx("div",{className:"flex shrink-0",style:{borderBottom:"2px solid var(--pixel-border)"},children:["save","history"].map(D=>s.jsx("button",{onClick:()=>g(D),className:"flex-1 py-2 text-[11px] font-bold uppercase tracking-wider cursor-pointer",style:{background:f===D?"var(--hud-bg-alt)":"transparent",color:f===D?"var(--terminal-text)":"var(--terminal-text-muted)",borderBottom:f===D?"2px solid var(--accent)":"2px solid transparent"},children:D==="save"?"SAVE":"HISTORY"},D))}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-5 space-y-4",children:[f==="save"&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"text-[11px]",style:{color:"var(--terminal-text-secondary)"},children:_.length>0?s.jsxs("span",{style:{color:"var(--idle-amber)"},children:["* ",_.length," unsaved change",_.length>1?"s":""]}):s.jsx("span",{style:{color:"var(--active-green)"},children:"All changes saved"})}),_.length>0&&s.jsxs("div",{children:[s.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:"Changed Files"}),s.jsx("div",{className:"text-[11px] max-h-[160px] overflow-y-auto p-2 space-y-0.5",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)"},children:_.map(({status:D,file:Y})=>s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{style:{color:D==="A"?"var(--active-green)":"var(--idle-amber)",width:"14px"},children:D}),s.jsx("span",{style:{color:"var(--terminal-text-secondary)"},children:Y})]},Y))})]}),_.length>0&&s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-muted)"},children:"Save Message"}),s.jsxs("button",{onClick:M,className:"text-[9px] px-1.5 py-0.5 cursor-pointer",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--accent)",fontFamily:"var(--pixel-font)"},title:"Auto-generate message from changes",children:["✨"," AUTO"]})]}),s.jsx("input",{ref:F,type:"text",value:y,onChange:D=>b(D.target.value),placeholder:"Auto-generated — edit if needed",className:"w-full px-3 py-2 text-[12px] outline-none",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)",fontFamily:"var(--pixel-font)"}})]}),_.length>0&&s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:I,disabled:d,className:"flex-1 py-2.5 text-[12px] font-black uppercase tracking-wider cursor-pointer disabled:opacity-50",style:{background:"var(--accent)",color:"#fff",border:"2px solid var(--accent)"},children:d?"SAVING...":t!=null&&t.hasRemote?"SAVE & PUSH":"SAVE"}),m&&s.jsxs("button",{onClick:()=>{const D=_.map(Y=>`${Y.status} ${Y.file}`).join(`
|
|
89
|
+
`);m(D)},disabled:d,className:"py-2.5 px-4 text-[11px] font-bold uppercase tracking-wider cursor-pointer disabled:opacity-50",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"2px solid var(--pixel-border)"},title:`Delegate to ${x??"AI role"} — they'll review, commit, push & merge`,children:["🤖"," ",(x==null?void 0:x.toUpperCase())??"DELEGATE"]})]}),_.length>0&&t&&!t.hasRemote&&s.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:"Local save only — add a git remote to enable push"}),C&&s.jsxs("div",{className:"text-[11px] p-2",style:{background:"rgba(59,185,80,0.1)",border:"1px solid var(--active-green)",color:"var(--active-green)"},children:["Saved! ",C.filesChanged," file",C.filesChanged>1?"s":""," committed",C.pushed?" & pushed":"",C.pushError?` (push error: ${C.pushError})`:""]}),v&&s.jsx("div",{className:"text-[11px] p-2",style:{background:"rgba(211,47,47,0.1)",border:"1px solid #D32F2F",color:"#EF5350"},children:v}),(t==null?void 0:t.lastCommit)&&s.jsxs("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:["Last save: ",t.lastCommit.message," (",U0(t.lastCommit.date),")"]})]}),f==="history"&&s.jsxs(s.Fragment,{children:[l.length===0&&s.jsx("div",{className:"text-[11px] text-center py-8",style:{color:"var(--terminal-text-muted)"},children:"No save history"}),s.jsx("div",{className:"space-y-1",children:l.map(D=>s.jsxs("div",{className:"flex items-center justify-between py-2 px-3 group",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-[11px] font-mono",style:{color:"var(--accent)"},children:D.shortSha}),s.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--terminal-text)"},children:D.message})]}),s.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:U0(D.date)})]}),s.jsx("button",{onClick:()=>W(D.sha),disabled:j,className:"text-[10px] font-bold px-2 py-1 opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--idle-amber)"},children:"LOAD"})]},D.sha))})]})]})]})]})}function PE({onClose:t}){const[l,r]=k.useState(null),[i,c]=k.useState(!0),[u,d]=k.useState(null);return k.useEffect(()=>{Ce.getCompanyStats().then(r).catch(m=>d(m.message)).finally(()=>c(!1))},[]),i?s.jsx("div",{style:{padding:24,color:"rgba(255,255,255,0.6)"},children:"Loading stats..."}):u||!l?s.jsxs("div",{style:{padding:24,color:"#ff6b6b"},children:[u||"Failed to load stats",s.jsx("button",{onClick:t,style:{marginLeft:12,color:"rgba(255,255,255,0.6)",background:"none",border:"none",cursor:"pointer"},children:"Close"})]}):s.jsxs("div",{style:{padding:20,color:"rgba(255,255,255,0.9)",maxHeight:"100%",overflowY:"auto"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:20},children:[s.jsx("h3",{style:{margin:0,fontSize:16,fontWeight:600},children:"Company Stats"}),s.jsx("button",{onClick:t,style:{background:"none",border:"none",color:"rgba(255,255,255,0.5)",cursor:"pointer",fontSize:18},children:"×"})]}),s.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10,marginBottom:20},children:[s.jsx(xc,{label:"Roles",value:String(l.company.roleCount)}),s.jsx(xc,{label:"Avg Level",value:`Lv.${l.company.avgLevel}`}),s.jsx(xc,{label:"Total Tokens",value:l.company.formattedTokens}),s.jsx(xc,{label:"Total Cost",value:`$${l.company.totalCostUsd.toFixed(2)}`})]}),s.jsx("h4",{style:{margin:"0 0 12px",fontSize:13,fontWeight:600,color:"rgba(255,255,255,0.6)",textTransform:"uppercase",letterSpacing:1},children:"Role Leaderboard"}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[l.roles.map((m,x)=>s.jsx(eN,{role:m,rank:x+1},m.roleId)),l.roles.length===0&&s.jsx("div",{style:{color:"rgba(255,255,255,0.4)",fontSize:13,padding:"8px 0"},children:"No role activity yet. Assign tasks to start leveling up!"})]}),Object.keys(l.byModel).length>0&&s.jsxs(s.Fragment,{children:[s.jsx("h4",{style:{margin:"20px 0 12px",fontSize:13,fontWeight:600,color:"rgba(255,255,255,0.6)",textTransform:"uppercase",letterSpacing:1},children:"Model Usage"}),s.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:Object.entries(l.byModel).map(([m,x])=>s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"6px 10px",background:"rgba(255,255,255,0.03)",borderRadius:6,fontSize:12},children:[s.jsx("span",{style:{color:"rgba(255,255,255,0.7)"},children:tN(m)}),s.jsxs("span",{style:{color:"rgba(255,255,255,0.5)"},children:["$",x.costUsd.toFixed(2)]})]},m))})]})]})}function xc({label:t,value:l}){return s.jsxs("div",{style:{padding:"12px 14px",background:"rgba(255,255,255,0.04)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)"},children:[s.jsx("div",{style:{fontSize:11,color:"rgba(255,255,255,0.45)",marginBottom:4},children:t}),s.jsx("div",{style:{fontSize:18,fontWeight:600},children:l})]})}function eN({role:t,rank:l}){const r=["🥇","🥈","🥉"],i=l<=3?r[l-1]:`#${l}`;return s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",background:"rgba(255,255,255,0.03)",borderRadius:8},children:[s.jsx("span",{style:{fontSize:14,width:28,textAlign:"center",flexShrink:0},children:i}),s.jsxs("div",{style:{flex:1,minWidth:0},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",marginBottom:4},children:[s.jsx("span",{style:{fontSize:13,fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.name}),s.jsxs("span",{style:{fontSize:12,color:I0(t.level),fontWeight:600,flexShrink:0,marginLeft:8},children:["Lv.",t.level]})]}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[s.jsx("div",{style:{flex:1,height:4,background:"rgba(255,255,255,0.08)",borderRadius:2,overflow:"hidden"},children:s.jsx("div",{style:{width:`${t.progress*100}%`,height:"100%",background:I0(t.level),borderRadius:2,transition:"width 0.3s ease"}})}),s.jsx("span",{style:{fontSize:10,color:"rgba(255,255,255,0.4)",flexShrink:0},children:t.formattedTokens})]})]})]})}function I0(t){return t>=9?"#FFD700":t>=7?"#C0A0FF":t>=5?"#4FC3F7":t>=3?"#81C784":"rgba(255,255,255,0.4)"}function tN(t){return t.includes("opus")?"Opus":t.includes("sonnet")?"Sonnet":t.includes("haiku")?"Haiku":t.split("-").slice(0,2).join(" ")}function nN({onClose:t,onSyncComplete:l}){const[r,i]=k.useState([]),[c,u]=k.useState([]),[d,m]=k.useState(!0),[x,f]=k.useState(null),[g,y]=k.useState(new Set),[b,v]=k.useState(null),[S,j]=k.useState(null),E=k.useCallback(async()=>{m(!0),v(null);try{const{roles:A}=await Ce.getSyncRoles();i(A);const F=A.filter(_=>_.source.sync!=="off");if(F.length===0){u([]),j(null);return}try{const _=await mi.syncCheck(F.map(M=>({roleId:M.roleId,sourceId:M.source.id,currentVersion:M.source.upstream_version??M.source.forked_at??"0.0.0"})));j(!0);const H=[];for(const M of _.updates){if(!M.hasUpdate)continue;const I=F.find(B=>B.roleId===M.roleId);if(!I)continue;const{character:W}=await mi.syncPull(M.sourceId),te=[];I.persona.trim()!==W.persona.trim()&&te.push({field:"persona",local:I.persona.slice(0,120)+(I.persona.length>120?"...":""),upstream:W.persona.slice(0,120)+(W.persona.length>120?"...":"")});const D=JSON.stringify(I.authority),Y=JSON.stringify(W.authority);D!==Y&&te.push({field:"authority",local:`${I.authority.autonomous.length} autonomous, ${I.authority.needsApproval.length} approval`,upstream:`${W.authority.autonomous.length} autonomous, ${W.authority.needsApproval.length} approval`}),te.length>0&&H.push({roleId:M.roleId,roleName:I.name,sourceId:M.sourceId,currentVersion:M.currentVersion,latestVersion:M.latestVersion,fields:te})}u(H)}catch{j(!1),u([])}}catch(A){v(A instanceof Error?A.message:"Failed to check for updates")}finally{m(!1)}},[]);k.useEffect(()=>{E()},[E]);const C=async A=>{f(A.roleId);try{const{character:F,version:_}=await mi.syncPull(A.sourceId);await Ce.applySyncUpdate({roleId:A.roleId,changes:{persona:F.persona,authority:F.authority},upstreamVersion:_}),y(H=>new Set(H).add(A.roleId)),l==null||l()}catch(F){v(F instanceof Error?F.message:"Failed to apply update")}finally{f(null)}};return s.jsxs("div",{style:{padding:20,color:"rgba(255,255,255,0.9)",maxHeight:"100%",overflowY:"auto"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[s.jsx("h3",{style:{margin:0,fontSize:16,fontWeight:600},children:"Role Sync"}),s.jsxs("div",{style:{display:"flex",gap:8},children:[s.jsx("button",{onClick:E,disabled:d,style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.1)",color:"rgba(255,255,255,0.7)",borderRadius:6,padding:"4px 10px",fontSize:12,cursor:d?"wait":"pointer"},children:d?"Checking...":"Refresh"}),s.jsx("button",{onClick:t,style:{background:"none",border:"none",color:"rgba(255,255,255,0.5)",cursor:"pointer",fontSize:18},children:"×"})]})]}),S===!1&&s.jsx("div",{style:{padding:"8px 12px",background:"rgba(255,180,0,0.1)",borderRadius:6,color:"#FFB74D",fontSize:12,marginBottom:12},children:"Cloud API unreachable. Sync requires connection to api.tycono.ai."}),b&&s.jsx("div",{style:{padding:"8px 12px",background:"rgba(255,100,100,0.1)",borderRadius:6,color:"#ff6b6b",fontSize:12,marginBottom:12},children:b}),s.jsxs("div",{style:{padding:"10px 14px",background:"rgba(255,255,255,0.04)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)",marginBottom:16,fontSize:13},children:[s.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Tracked roles: "}),s.jsx("span",{style:{fontWeight:500},children:r.length}),s.jsx("span",{style:{color:"rgba(255,255,255,0.3)",margin:"0 8px"},children:"·"}),s.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Updates available: "}),s.jsx("span",{style:{fontWeight:500,color:c.length>0?"#4FC3F7":"rgba(255,255,255,0.7)"},children:c.filter(A=>!g.has(A.roleId)).length}),S===!0&&s.jsxs(s.Fragment,{children:[s.jsx("span",{style:{color:"rgba(255,255,255,0.3)",margin:"0 8px"},children:"·"}),s.jsx("span",{style:{fontSize:11,color:"#81C784"},children:"Cloud connected"})]})]}),c.length===0&&!d&&s.jsx("div",{style:{color:"rgba(255,255,255,0.4)",fontSize:13,padding:"20px 0",textAlign:"center"},children:r.length===0?"No roles with source tracking. Hire from the Store to enable sync.":"All roles are up to date!"}),c.map(A=>s.jsxs("div",{style:{marginBottom:12,padding:14,background:"rgba(255,255,255,0.03)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:10},children:[s.jsxs("div",{children:[s.jsx("div",{style:{fontSize:14,fontWeight:500},children:A.roleName}),s.jsxs("div",{style:{fontSize:11,color:"rgba(255,255,255,0.4)"},children:[A.sourceId," · v",A.currentVersion," → v",A.latestVersion]})]}),g.has(A.roleId)?s.jsx("span",{style:{fontSize:12,color:"#81C784"},children:"Applied ✓"}):s.jsx("button",{onClick:()=>C(A),disabled:x===A.roleId,style:{background:"#1565C0",border:"none",color:"white",borderRadius:6,padding:"5px 12px",fontSize:12,cursor:x===A.roleId?"wait":"pointer",opacity:x===A.roleId?.6:1},children:x===A.roleId?"Applying...":"Apply Update"})]}),A.fields.map(F=>s.jsxs("div",{style:{marginBottom:6,fontSize:12},children:[s.jsx("div",{style:{color:"rgba(255,255,255,0.5)",marginBottom:2,textTransform:"uppercase",fontSize:10,letterSpacing:.5},children:F.field}),s.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:6},children:[s.jsxs("div",{style:{padding:"4px 8px",background:"rgba(255,100,100,0.08)",borderRadius:4,color:"rgba(255,255,255,0.6)"},children:[s.jsx("span",{style:{fontSize:9,color:"rgba(255,255,255,0.3)"},children:"LOCAL"}),s.jsx("br",{}),F.local]}),s.jsxs("div",{style:{padding:"4px 8px",background:"rgba(100,255,100,0.08)",borderRadius:4,color:"rgba(255,255,255,0.6)"},children:[s.jsx("span",{style:{fontSize:9,color:"rgba(255,255,255,0.3)"},children:"UPSTREAM"}),s.jsx("br",{}),F.upstream]})]})]},F.field))]},A.roleId)),r.length>0&&s.jsxs("div",{style:{marginTop:16,fontSize:11,color:"rgba(255,255,255,0.3)",lineHeight:1.5},children:["Roles hired from the Store are tracked automatically. Set ",s.jsx("code",{style:{background:"rgba(255,255,255,0.06)",padding:"1px 4px",borderRadius:3},children:"sync: off"})," in role.yaml to stop tracking."]})]})}function lN({onClose:t}){const[l,r]=k.useState(null),[i,c]=k.useState(!0),[u,d]=k.useState(null),[m,x]=k.useState(null),f=k.useCallback(async()=>{c(!0),d(null);try{const A=await Ce.getGitStatus();r(A)}catch(A){d(A instanceof Error?A.message:"Failed to load git status")}finally{c(!1)}},[]);k.useEffect(()=>{f()},[f]);const g=async A=>{x(A.path);try{await Ce.deleteWorktree(A.path),await f()}catch(F){d(F instanceof Error?F.message:"Failed to remove worktree")}finally{x(null)}},y=async A=>{x(A);try{await Ce.deleteBranch(A),await f()}catch(F){d(F instanceof Error?F.message:"Failed to delete branch")}finally{x(null)}};if(i&&!l)return s.jsx("div",{style:{padding:24,color:"rgba(255,255,255,0.6)"},children:"Loading git status..."});if(u&&!l)return s.jsxs("div",{style:{padding:24,color:"#ff6b6b"},children:[u,s.jsx("button",{onClick:t,style:{marginLeft:12,color:"rgba(255,255,255,0.6)",background:"none",border:"none",cursor:"pointer"},children:"Close"})]});if(!l)return null;const b=l.worktrees.filter(A=>A.status==="active"),v=l.worktrees.filter(A=>A.status==="pending-merge"),S=l.worktrees.filter(A=>A.status==="stale");function j(A){const F=A.split("/");if(F.length>1){const _=F[F.length-1],H=["cto","cbo","pm","engineer","designer","qa","data-analyst"];for(const M of H)if(_.toLowerCase().includes(M))return M}return null}function E(A,F=40){return A.length<=F?A:"..."+A.slice(A.length-F+3)}function C(A){const F=Date.now()-new Date(A).getTime(),_=Math.floor(F/6e4);if(_<1)return"just now";if(_<60)return`${_}m ago`;const H=Math.floor(_/60);return H<24?`${H}h ago`:`${Math.floor(H/24)}d ago`}return s.jsxs("div",{style:{padding:20,color:"rgba(255,255,255,0.9)",maxHeight:"100%",overflowY:"auto"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[s.jsx("h3",{style:{margin:0,fontSize:16,fontWeight:600},children:"GIT STATUS"}),s.jsxs("div",{style:{display:"flex",gap:8},children:[s.jsx("button",{onClick:f,disabled:i,style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.1)",color:"rgba(255,255,255,0.7)",borderRadius:6,padding:"4px 10px",fontSize:12,cursor:i?"wait":"pointer"},children:i?"Checking...":"Refresh"}),s.jsx("button",{onClick:t,style:{background:"none",border:"none",color:"rgba(255,255,255,0.5)",cursor:"pointer",fontSize:18},children:"×"})]})]}),u&&s.jsx("div",{style:{padding:"8px 12px",background:"rgba(255,100,100,0.1)",borderRadius:6,color:"#ff6b6b",fontSize:12,marginBottom:12},children:u}),s.jsxs("div",{style:{padding:"10px 14px",background:"rgba(255,255,255,0.04)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)",marginBottom:16,fontSize:13},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[s.jsxs("div",{children:[s.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Branch: "}),s.jsx("span",{style:{fontWeight:500},children:l.currentBranch})]}),s.jsx("div",{children:l.unsavedCount>0&&s.jsxs("span",{style:{color:"#FFB74D",fontSize:12},children:[l.unsavedCount," unsaved"]})})]}),l.lastCommit&&s.jsxs("div",{style:{marginTop:6,fontSize:11,color:"rgba(255,255,255,0.4)"},children:["Last commit: ",l.lastCommit.message.slice(0,60),l.lastCommit.message.length>60?"...":""," · ",C(l.lastCommit.date)]})]}),b.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(pc,{label:"Active Worktrees",count:b.length}),b.map(A=>s.jsx(_f,{wt:A,roleFromBranch:A.roleId||j(A.branch),truncatePath:E,timeAgo:C,removing:m===A.path,onRemove:()=>g(A),statusColor:"#4FC3F7",statusIcon:"📂"},A.path))]}),v.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(pc,{label:"Pending Merge",count:v.length}),v.map(A=>s.jsx(_f,{wt:A,roleFromBranch:A.roleId||j(A.branch),truncatePath:E,timeAgo:C,removing:m===A.path,onRemove:()=>g(A),statusColor:"#FFB74D",statusIcon:"⚠️"},A.path))]}),S.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(pc,{label:"Stale",count:S.length}),S.map(A=>s.jsx(_f,{wt:A,roleFromBranch:A.roleId||j(A.branch),truncatePath:E,timeAgo:C,removing:m===A.path,onRemove:()=>g(A),statusColor:"#ff6b6b",statusIcon:"🔴"},A.path))]}),l.staleBranches.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(pc,{label:"Unmerged Branches",count:l.staleBranches.length}),l.staleBranches.map(A=>s.jsxs("div",{style:{marginBottom:8,padding:"10px 14px",background:"rgba(255,255,255,0.03)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[s.jsxs("div",{style:{fontSize:13},children:[s.jsx("span",{style:{color:"rgba(255,255,255,0.5)",marginRight:6},children:"⚠️"}),s.jsx("span",{style:{fontWeight:500},children:A})]}),s.jsx("button",{onClick:()=>y(A),disabled:m===A,style:{background:"rgba(255,100,100,0.15)",border:"1px solid rgba(255,100,100,0.2)",color:"#ff6b6b",borderRadius:4,padding:"3px 8px",fontSize:10,cursor:m===A?"wait":"pointer",opacity:m===A?.6:1,fontWeight:600,textTransform:"uppercase",letterSpacing:.5},children:m===A?"...":"DELETE"})]},A))]}),b.length===0&&v.length===0&&S.length===0&&l.staleBranches.length===0&&s.jsxs("div",{style:{color:"rgba(255,255,255,0.4)",fontSize:13,padding:"20px 0",textAlign:"center"},children:["✓"," All clean. No active worktrees or stale branches."]}),l.lastMerge&&s.jsxs("div",{style:{marginTop:16,fontSize:11,color:"rgba(255,255,255,0.3)",lineHeight:1.5},children:["Last merge: ",s.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:l.lastMerge.branch})," · ",l.lastMerge.roleId," · ",C(l.lastMerge.mergedAt)]})]})}function pc({label:t,count:l}){return s.jsxs("h4",{style:{margin:"16px 0 8px",fontSize:11,fontWeight:600,color:"rgba(255,255,255,0.5)",textTransform:"uppercase",letterSpacing:1},children:[t," (",l,")"]})}function _f({wt:t,roleFromBranch:l,truncatePath:r,timeAgo:i,removing:c,onRemove:u,statusColor:d,statusIcon:m}){return s.jsx("div",{style:{marginBottom:8,padding:"10px 14px",background:"rgba(255,255,255,0.03)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)"},children:s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[s.jsxs("div",{style:{flex:1,minWidth:0},children:[s.jsxs("div",{style:{fontSize:13,fontWeight:500,marginBottom:2},children:[s.jsx("span",{style:{marginRight:6},children:m}),t.branch,l&&s.jsx("span",{style:{marginLeft:8,fontSize:10,padding:"1px 6px",background:"rgba(255,255,255,0.08)",borderRadius:3,color:"rgba(255,255,255,0.6)",textTransform:"uppercase"},children:l})]}),t.task&&s.jsxs("div",{style:{fontSize:11,color:"rgba(255,255,255,0.5)",marginBottom:2},children:['"',t.task.slice(0,50),t.task.length>50?"...":"",'"']}),s.jsxs("div",{style:{fontSize:10,color:"rgba(255,255,255,0.35)"},children:[r(t.path)," · ",t.filesChanged," file",t.filesChanged!==1?"s":""," changed"," · ",i(t.createdAt)]}),t.conflictFiles&&t.conflictFiles.length>0&&s.jsxs("div",{style:{fontSize:10,color:"#ff6b6b",marginTop:4},children:["⛔"," CONFLICT: ",t.conflictFiles.join(", ")]})]}),s.jsx("button",{onClick:u,disabled:c,style:{background:"rgba(255,100,100,0.15)",border:"1px solid rgba(255,100,100,0.2)",color:d,borderRadius:4,padding:"3px 8px",fontSize:10,cursor:c?"wait":"pointer",opacity:c?.6:1,fontWeight:600,textTransform:"uppercase",letterSpacing:.5,flexShrink:0,marginLeft:8},children:c?"...":"REMOVE"})]})})}function rN({onClose:t,speechSettings:l,onSpeechSettingsChange:r,language:i,onLanguageChange:c,onOpenSync:u,onOpenGitStatus:d,onOpenStats:m}){var x;return s.jsx("div",{className:"customize-overlay",onClick:t,children:s.jsxs("div",{className:"customize-modal",onClick:f=>f.stopPropagation(),style:{maxWidth:480},children:[s.jsxs("div",{className:"customize-header",children:[s.jsx("div",{style:{fontSize:12,fontWeight:700,letterSpacing:1,color:"var(--terminal-text)"},children:"SETTINGS"}),s.jsx("button",{className:"customize-close",onClick:t,children:"X"})]}),s.jsx("div",{className:"customize-body",style:{padding:"12px 20px 20px"},children:s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20},children:[s.jsxs("div",{children:[s.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"AMBIENT SPEECH MODE"}),s.jsx("div",{style:{display:"flex",gap:6},children:["template","llm","auto"].map(f=>s.jsxs("button",{onClick:()=>r==null?void 0:r({mode:f}),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(l==null?void 0:l.mode)===f?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(l==null?void 0:l.mode)===f?"rgba(255,255,255,0.08)":"transparent",color:(l==null?void 0:l.mode)===f?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center"},children:[s.jsx("div",{style:{fontWeight:600,marginBottom:2},children:f==="template"?"TEMPLATE":f==="llm"?"AI":"AUTO"}),s.jsx("div",{style:{fontSize:9,opacity:.7},children:f==="template"?"Static pool ($0)":f==="llm"?"LLM generated":"Detect engine"})]},f))}),s.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Auto: CLI Max = AI, BYOK = Template"})]}),s.jsxs("div",{children:[s.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["SPEECH INTERVAL: ",(l==null?void 0:l.intervalSec)??18,"s"]}),s.jsx("input",{type:"range",min:5,max:120,step:5,value:(l==null?void 0:l.intervalSec)??18,onChange:f=>r==null?void 0:r({intervalSec:Number(f.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[s.jsx("span",{children:"5s (frequent)"}),s.jsx("span",{children:"120s (rare)"})]})]}),(l==null?void 0:l.mode)!=="template"&&s.jsxs("div",{children:[s.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["DAILY LLM BUDGET: $",((x=l==null?void 0:l.dailyBudgetUsd)==null?void 0:x.toFixed(2))??"1.00"]}),s.jsx("input",{type:"range",min:0,max:5,step:.25,value:(l==null?void 0:l.dailyBudgetUsd)??1,onChange:f=>r==null?void 0:r({dailyBudgetUsd:Number(f.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[s.jsx("span",{children:"$0 (unlimited)"}),s.jsx("span",{children:"$5.00/day"})]})]}),s.jsxs("div",{children:[s.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"LANGUAGE"}),s.jsx("div",{style:{display:"flex",gap:6},children:[{key:"auto",label:"Auto"},{key:"en",label:"English"},{key:"ko",label:"한국어"},{key:"ja",label:"日本語"}].map(({key:f,label:g})=>s.jsx("button",{onClick:()=>c==null?void 0:c(f),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(i??"auto")===f?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(i??"auto")===f?"rgba(255,255,255,0.08)":"transparent",color:(i??"auto")===f?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center",fontWeight:600},children:g},f))}),s.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Sets language for AI responses and speech bubbles"})]}),s.jsxs("div",{style:{borderTop:"1px solid rgba(255,255,255,0.08)",paddingTop:16,display:"flex",gap:8},children:[u&&s.jsx("button",{onClick:()=>{t(),u()},className:"theme-btn",style:{flex:1,padding:"8px 12px",fontSize:10},children:"🔄 ROLE SYNC"}),d&&s.jsx("button",{onClick:()=>{t(),d()},className:"theme-btn",style:{flex:1,padding:"8px 12px",fontSize:10},children:"📂 GIT STATUS"}),m&&s.jsx("button",{onClick:()=>{t(),m()},className:"theme-btn",style:{flex:1,padding:"8px 12px",fontSize:10},children:"📊 COMPANY STATS"})]})]})})]})})}function aN({theme:t,onThemeChange:l,onClose:r}){const i=k.useRef(null);return k.useEffect(()=>{const c=u=>{i.current&&!i.current.contains(u.target)&&r()};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[r]),s.jsx("div",{ref:i,className:"theme-dropup",children:Object.entries(Gr).map(([c,u])=>s.jsxs("button",{className:`theme-dropup__item${t===c?" theme-dropup__item--active":""}`,onClick:()=>{l(c),r()},title:u.name,children:[s.jsxs("span",{className:"theme-dropup__swatch",style:{background:u.vars["--hud-bg"],borderColor:u.vars["--pixel-border"]},children:[s.jsx("span",{style:{background:u.vars["--accent"],width:5,height:5,borderRadius:1}}),s.jsx("span",{style:{background:u.vars["--active-green"],width:5,height:5,borderRadius:1}}),s.jsx("span",{style:{background:u.vars["--idle-amber"],width:5,height:5,borderRadius:1}})]}),s.jsx("span",{className:"theme-dropup__name",children:u.icon})]},c))})}const Fc=[0,1e4,5e4,15e4,4e5,1e6,25e5,5e6,1e7,25e6];function Rg(t){let l=1;for(let r=Fc.length-1;r>=0;r--)if(t>=Fc[r]){l=r+1;break}return Math.min(l,10)}function iN(t){const l=Rg(t);if(l>=10)return 1;const r=Fc[l-1],i=Fc[l];return Math.min(1,(t-r)/(i-r))}function Y0(t){const l={};for(const[r,i]of Object.entries(t)){const c=i.inputTokens+i.outputTokens;l[r]={level:Rg(c),totalTokens:c,progress:iN(c)}}return l}const sN=[{id:"first-employee",name:"First Employee",icon:"🏆",description:"Hired your first role",check:t=>t.roleCount>=1},{id:"full-team",name:"Full Team",icon:"👥",description:"Hired 5+ roles",check:t=>t.roleCount>=5},{id:"token-10k",name:"Getting Started",icon:"📊",description:"Used 10K tokens total",check:t=>t.totalTokens>=1e4},{id:"token-100k",name:"Power User",icon:"💪",description:"Used 100K tokens total",check:t=>t.totalTokens>=1e5},{id:"token-millionaire",name:"Token Millionaire",icon:"🎖",description:"Used 1M tokens total",check:t=>t.totalTokens>=1e6},{id:"token-mogul",name:"Token Mogul",icon:"💎",description:"Used 10M tokens total",check:t=>t.totalTokens>=1e7},{id:"first-promotion",name:"First Promotion",icon:"⭐",description:"Any role reached Lv.3",check:t=>t.roles.some(l=>l.level>=3)},{id:"senior-staff",name:"Senior Staff",icon:"🌟",description:"Any role reached Lv.5",check:t=>t.roles.some(l=>l.level>=5)},{id:"master-class",name:"Master Class",icon:"👑",description:"Any role reached Lv.10",check:t=>t.roles.some(l=>l.level>=10)},{id:"full-house",name:"Full House",icon:"🏠",description:"All roles Lv.5+",check:t=>t.roleCount>=3&&t.roles.every(l=>l.level>=5)}];function q0(t){return sN.filter(l=>l.check(t))}const oN={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍","data-analyst":"📊"},jc={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},cN={cto:"아키텍처",cbo:"시장 분석",pm:"PRD 작성",engineer:"코딩",designer:"시안 제작",qa:"품질 검증"};function uN(t){let l=0;for(let i=0;i<t.length;i++)l=t.charCodeAt(i)+((l<<5)-l);return`hsl(${(l%360+360)%360}, 50%, 40%)`}function dN({importJob:t,onImportDone:l}){var ql,Ai,Ma;const[r,i]=k.useState([]),[c,u]=k.useState([]),[d,m]=k.useState([]),[x,f]=k.useState([]),[g,y]=k.useState([]),[b,v]=k.useState([]),[S,j]=k.useState("TYCONO"),[E,C]=k.useState(!0),[A,F]=k.useState(null),[_,H]=k.useState({type:"none"}),[M,I]=k.useState(null),[W,te]=k.useState(null),[D,Y]=k.useState([]),[B,V]=k.useState(!1),[ne,G]=k.useState([]),[L,Z]=k.useState(0),[de,ue]=k.useState(!1),[z,R]=k.useState({}),[K,T]=k.useState("ceo"),[fe,Ee]=k.useState(null),[Ne,Le]=k.useState(!1),[Be,Qe]=k.useState({}),Se=k.useRef({}),[tt,me]=k.useState(!1),[he,ge]=k.useState(null),[ke,Fe]=k.useState({}),[Ae,De]=k.useState([]),[je,_e]=k.useState([]),[Ke,Et]=k.useState(void 0),[Ht,gt]=k.useState(!1);k.useEffect(()=>{Ce.getStatus().then(O=>{Et(O.engine),gt(!!O.hasApiKey)}).catch(()=>{})},[]);const{getAppearance:Rt,setAppearance:re,resetAppearance:pe,theme:Te,setTheme:Ye,speechSettings:xe,setSpeechSettings:q,language:ze,setLanguage:He}=YC(),[Xe,ht]=k.useState(null),[,Pe]=k.useState("character"),We=XC(),[un,$l]=k.useState(!1),[ur,ol]=k.useState(!1),[dr,$n]=k.useState(!1),[fn,Wt]=k.useState(!1),[ve,Zt]=k.useState(!1),[Zr,cl]=k.useState(!1),[Wn,Ys]=k.useState(null);k.useEffect(()=>{const O=ae=>{(ae.metaKey||ae.ctrlKey)&&ae.key==="s"&&(ae.preventDefault(),We.dirtyCount>0&&$l(!0))};return window.addEventListener("keydown",O),()=>window.removeEventListener("keydown",O)},[We.dirtyCount]),k.useEffect(()=>{if(!fn)return;let O=!1;const ae=async()=>{try{const ye=await Ce.getGitStatus();O||Ys(ye)}catch{}};ae();const se=setInterval(ae,1e4);return()=>{O=!0,clearInterval(se)}},[fn]);const[Hl,Ca]=k.useState(null),[vl,wl]=k.useState(null),[Ul,wi]=k.useState([]),[Sn,Jt]=k.useState(!1),hn=k.useRef(!1),kl=k.useRef(null);let Ea=k.useRef(0);const qs=k.useRef(new Set),Il=(O,ae,se)=>{const ye={id:Ea.current++,type:O,text:ae,detail:se};wi(be=>[...be,ye])};k.useEffect(()=>{var O;Sn&&((O=kl.current)==null||O.scrollIntoView({behavior:"smooth"}))},[Ul,Sn]),k.useEffect(()=>{t&&(hn.current||(hn.current=!0,wl("Scanning knowledge sources..."),wi([{id:0,type:"scan",text:"Starting knowledge import..."}]),Ea.current=1,fetch("/api/setup/import-knowledge",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:t.paths,companyRoot:t.companyRoot})}).then(async O=>{var be;const ae=(be=O.body)==null?void 0:be.getReader();if(!ae)return;const se=new TextDecoder;let ye="";for(;;){const{done:Me,value:Ie}=await ae.read();if(Me)break;ye+=se.decode(Ie,{stream:!0});const nt=ye.split(`
|
|
90
|
+
`);ye=nt.pop()||"";let mt="";for(const Ze of nt)if(Ze.startsWith("event: "))mt=Ze.slice(7).trim();else if(Ze.startsWith("data: ")&&mt){try{const Ot=JSON.parse(Ze.slice(6));switch(mt){case"scanning":wl(`Scanning: ${Ot.path} (${Ot.fileCount} files)`),Il("scan",`Found ${Ot.fileCount} files`,Ot.path);break;case"processing":Ca({index:Ot.index,total:Ot.total}),wl(`Importing knowledge... (${Ot.index}/${Ot.total})`),Il("process",`Processing: ${Ot.file}`,`${Ot.index} / ${Ot.total}`);break;case"created":Il("created",Ot.title,Ot.summary);break;case"skipped":Il("process",`Skipped: ${Ot.file}`,Ot.reason);break;case"done":wl(null),Ca(null),Il("done",`Import complete! ${Ot.created} created, ${Ot.skipped} skipped.`),yt(`Knowledge import complete! ${Ot.created} documents imported.`,"#2E7D32"),l==null||l();break;case"error":wl(null),Ca(null),Il("error",Ot.message),yt(`Import failed: ${Ot.message}`,"#B71C1C"),l==null||l();break}}catch{}mt=""}}}).catch(O=>{wl(null),Il("error",O.message),yt(`Import error: ${O.message}`,"#B71C1C"),l==null||l()})))},[t]);const[Na,fr]=k.useState("iso"),[Aa,hr]=k.useState(typeof window<"u"?window.innerWidth:1200);k.useEffect(()=>{const O=()=>hr(window.innerWidth);return window.addEventListener("resize",O),()=>window.removeEventListener("resize",O)},[]);const jl=Aa<1024,[gn,Tn]=k.useState(!1),[Ut,Xs]=k.useState(560),[Yl,Yt]=k.useState([]),[ul,Zn]=k.useState(null),[mr,Ta]=k.useState(null),{sendMessage:Uc}=HC();k.useEffect(()=>{Promise.all([Ce.getCompany().then(O=>{j(O.name),i(O.roles)}),Ce.getOrgTree().then(O=>{R(O.nodes),T(O.root)}).catch(()=>{}),Ce.getCostSummary().then(O=>ki(Y0(O.byRole))).catch(()=>{})]).catch(O=>F(`Failed to load: ${O.message}`)).finally(()=>C(!1)),Ce.getProjects().then(u).catch(()=>{}),Ce.getStandups().then(m).catch(()=>{}),Ce.getWaves().then(f).catch(()=>{}),Ce.getDecisions().then(y).catch(()=>{}),Ce.getKnowledge().then(v).catch(()=>{})},[]),k.useEffect(()=>{Ce.getSessions().then(O=>{if(O.length>0){const ae=O.map(ye=>({...ye,messages:[]}));Yt(ae);const se=ae.find(ye=>ye.status==="active")??ae[0];Zn(se.id),Tn(!0)}}).catch(O=>{console.error("Failed to load sessions",O)})},[]),k.useEffect(()=>{const O=()=>{fetch("/api/exec/status").then(se=>se.json()).then(se=>{Fe(se.statuses??{}),De(se.activeExecutions??[])}).catch(()=>{})};O();const ae=setInterval(O,3e3);return()=>clearInterval(ae)},[]);const Sl=k.useMemo(()=>{const O={...ke};if(mr){const ae=Yl.find(se=>se.id===mr);ae&&(O[ae.roleId]="working")}return O},[ke,mr,Yl]);k.useEffect(()=>{_.type==="role"?Ce.getRole(_.roleId).then(I).catch(console.error):I(null)},[_]);const Cl=()=>H({type:"none"}),dl=async(O,ae)=>{const se=r.find(be=>be.id===O),ye=(W==null?void 0:W.mode)==="ask";te(null);try{const{jobId:be}=await Ce.startJob({type:"assign",roleId:O,task:ae,readOnly:ye}),Me=jc[O]??"#666",Ie=`${O.toUpperCase()} · ${(se==null?void 0:se.name)??O}`;ue(!1),Y([{jobId:be,title:Ie,color:Me}]),Pt.pushMessage({ts:Date.now(),roleId:"ceo",text:`[CEO → ${(se==null?void 0:se.name)??O}] ${ye?"Ask":"Assign"}: ${ae}`,type:"dispatch",targetRoleId:O})}catch(be){yt(`Failed to start job: ${be instanceof Error?be.message:"unknown"}`,"#C62828")}},yt=(O,ae)=>{const se=Date.now();_e(ye=>[...ye,{id:se,message:O,color:ae}]),setTimeout(()=>_e(ye=>ye.filter(be=>be.id!==se)),4e3)},ki=O=>{var se,ye;const ae=Se.current;for(const[be,Me]of Object.entries(O)){const Ie=((se=ae[be])==null?void 0:se.level)??0;if(Ie>0&&Me.level>Ie){const nt=((ye=r.find(mt=>mt.id===be))==null?void 0:ye.name)??be.toUpperCase();yt(`${nt} leveled up to Lv.${Me.level}!`,"#7C3AED")}}Se.current=O,Qe(O)};k.useEffect(()=>{const O={roles:Object.entries(Be).map(([ye,be])=>({id:ye,level:be.level,totalTokens:be.totalTokens})),totalTokens:Object.values(Be).reduce((ye,be)=>ye+be.totalTokens,0),roleCount:r.length},ae=q0(O),se=qs.current;for(const ye of ae)se.has(ye.id)||se.size>0&&yt(`${ye.icon} Badge earned: ${ye.name}!`,"#D4A017");qs.current=new Set(ae.map(ye=>ye.id))},[Be,r.length]);const Ic=()=>{var ae;const O=D[D.length-1];O&&(yt(`${O.title} completed`,O.color),Pt.pushMessage({ts:Date.now(),roleId:((ae=O.title.split(" · ")[0])==null?void 0:ae.toLowerCase())??"unknown",text:`[${O.title}] Job completed`,type:"dispatch"})),Ce.getStandups().then(m).catch(console.error),Ce.getCompany().then(se=>i(se.roles)).catch(console.error),Ce.getCostSummary().then(se=>ki(Y0(se.byRole))).catch(()=>{})},ji=async O=>{V(!1);try{const ae=await Ce.startJob({type:"wave",directive:O}),se=ae.jobIds??(ae.jobId?[ae.jobId]:[]),ye=r.filter(Me=>Me.level==="c-level"),be=se.map((Me,Ie)=>{var nt,mt;return{jobId:Me,roleId:((nt=ye[Ie])==null?void 0:nt.id)??`role-${Ie}`,roleName:((mt=ye[Ie])==null?void 0:mt.name)??`C-Level ${Ie+1}`}});Pt.pushMessage({ts:Date.now(),roleId:"ceo",text:`[CEO WAVE] "${O}" → ${be.map(Me=>Me.roleName).join(", ")}`,type:"dispatch"}),Object.keys(z).length>0?(Ee({directive:O,rootJobs:be}),Le(!1)):(G(be),Z(0),ue(!1),be.length>0&&Y([{jobId:be[0].jobId,title:`CEO WAVE · ${be[0].roleId.toUpperCase()}`,color:"#B71C1C"}]))}catch(ae){yt(`Failed to start wave: ${ae instanceof Error?ae.message:"unknown"}`,"#C62828")}},Si=()=>{Ce.getWaves().then(f).catch(console.error),Ce.getStandups().then(m).catch(console.error)},xr=()=>{Ce.getCompany().then(O=>i(O.roles)).catch(console.error)},Yc=async(O,ae)=>{await Ce.createRole(O),re(O.id,ae),xr(),yt(`${O.name} hired!`,"#2E7D32")},Dn=async O=>{await Ce.deleteRole(O),xr(),ge(null),yt(`${O.toUpperCase()} removed`,"#B71C1C")},Da=async(O,ae)=>{await Ce.updateRole(O,ae),xr(),_.type==="role"&&_.roleId===O&&Ce.getRole(O).then(I).catch(console.error),ae.name&&yt(`${O.toUpperCase()} renamed to "${ae.name}"`,"#1565C0")},Vs=O=>{Tn(!0)},Ci=async O=>{try{const ae=await Ce.createSession(O,"talk");Yt(se=>[ae,...se]),Zn(ae.id),Tn(!0)}catch(ae){console.error("Failed to create session",ae),yt(`Failed to create session: ${ae instanceof Error?ae.message:"API unreachable"}`,"#B71C1C")}},pr=async O=>{try{const ae=await Ce.createSession(O,"talk");Yt(se=>[ae,...se]),Zn(ae.id)}catch(ae){console.error("Failed to create session",ae),yt(`Failed to create session: ${ae instanceof Error?ae.message:"API unreachable"}`,"#B71C1C")}},Gs=async O=>{const ae=Ae.find(be=>be.roleId===O),se=(ae==null?void 0:ae.jobId)??(ae==null?void 0:ae.id);if(se&&Sl[O]==="working"){const be=r.find(nt=>nt.id===O),Me=jc[O]??"#666",Ie=`${O.toUpperCase()} · ${(be==null?void 0:be.name)??O}`;Y([{jobId:se,title:Ie,color:Me}]),ue(!1);return}const ye=Yl.find(be=>be.roleId===O);if(ye)Zn(ye.id),Pt.setActiveChannelId(null);else try{const be=await Ce.createSession(O,"talk");Yt(Me=>[be,...Me]),Zn(be.id),Pt.setActiveChannelId(null)}catch(be){console.error("Failed to create session",be)}Tn(!0)},Ks=async O=>{try{await Ce.deleteSession(O),Yt(ae=>{var ye;const se=ae.filter(be=>be.id!==O);return ul===O&&Zn(((ye=se[0])==null?void 0:ye.id)??null),se})}catch(ae){console.error("Failed to delete session",ae),yt(`Failed to close session: ${ae instanceof Error?ae.message:"API error"}`,"#B71C1C")}},yr=async()=>{try{const{ids:O}=await Ce.deleteEmptySessions();if(O.length===0)return;Yt(ae=>{var ye;const se=ae.filter(be=>!O.includes(be.id));return ul&&O.includes(ul)&&Zn(((ye=se[0])==null?void 0:ye.id)??null),se}),yt(`Cleared ${O.length} empty session${O.length!==1?"s":""}`,"#2E7D32")}catch(O){yt(`Failed to clear empty sessions: ${O instanceof Error?O.message:"API error"}`,"#B71C1C")}},qc=async()=>{if(!confirm("Close all sessions? This cannot be undone."))return;const O=Yl.map(ae=>ae.id);try{await Ce.deleteSessions(O),Yt([]),Zn(null),yt("All sessions closed","#2E7D32")}catch(ae){yt(`Failed to close sessions: ${ae instanceof Error?ae.message:"API error"}`,"#B71C1C")}},fl=(O,ae)=>{Yt(se=>se.map(ye=>{if(ye.id!==O)return ye;const be=[...ye.messages],Me=be[be.length-1];if(Me&&Me.from==="role"&&Me.status==="streaming"){const Ie=[...Me.streamEvents??[],ae];be[be.length-1]={...Me,streamEvents:Ie}}return{...ye,messages:be}}))},za=(O,ae,se)=>{const ye={id:`msg-${Date.now()}-ceo`,from:"ceo",content:ae,type:se==="do"?"directive":"conversation",status:"done",timestamp:new Date().toISOString()},be={id:`msg-${Date.now()+1}-role`,from:"role",content:"",type:"conversation",status:"streaming",timestamp:new Date().toISOString(),streamEvents:[]};Yt(Me=>Me.map(Ie=>Ie.id===O?{...Ie,messages:[...Ie.messages,ye,be],updatedAt:new Date().toISOString()}:Ie)),Ta(O),Uc(O,ae,se,{onThinking:Me=>{Yt(Ie=>Ie.map(nt=>{if(nt.id!==O)return nt;const mt=[...nt.messages],Ze=mt[mt.length-1];return Ze&&Ze.from==="role"&&Ze.status==="streaming"&&(mt[mt.length-1]={...Ze,thinking:(Ze.thinking??"")+Me}),{...nt,messages:mt}})),fl(O,{type:"thinking",timestamp:Date.now(),text:Me})},onText:Me=>{Yt(Ie=>Ie.map(nt=>{if(nt.id!==O)return nt;const mt=[...nt.messages],Ze=mt[mt.length-1];return Ze&&Ze.from==="role"&&Ze.status==="streaming"&&(mt[mt.length-1]={...Ze,content:Ze.content+Me}),{...nt,messages:mt}}))},onToolUse:(Me,Ie)=>{fl(O,{type:"tool",timestamp:Date.now(),toolName:Me,toolInput:Ie})},onDispatch:(Me,Ie)=>{fl(O,{type:"dispatch",timestamp:Date.now(),roleId:Me,task:Ie})},onDispatchProgress:(Me,Ie,nt)=>{var mt;Ie==="tool"?fl(O,{type:"dispatch:progress",timestamp:Date.now(),roleId:Me,progressType:"tool",toolName:nt.name,toolInput:nt.input}):Ie==="thinking"?fl(O,{type:"dispatch:progress",timestamp:Date.now(),roleId:Me,progressType:"thinking",text:nt.text}):Ie==="text"?fl(O,{type:"dispatch:progress",timestamp:Date.now(),roleId:Me,progressType:"text",text:(mt=nt.text)==null?void 0:mt.slice(-200)}):(Ie==="done"||Ie==="error")&&fl(O,{type:"dispatch:progress",timestamp:Date.now(),roleId:Me,progressType:Ie})},onTurn:Me=>{fl(O,{type:"turn",timestamp:Date.now(),turn:Me})},onDone:()=>{Yt(Me=>Me.map(Ie=>{if(Ie.id!==O)return Ie;const nt=Ie.messages.map(Ze=>Ze.status==="streaming"?{...Ze,status:"done"}:Ze),mt=Ie.messages.length<=2?ae.slice(0,40).replace(/\n/g," "):Ie.title;return{...Ie,messages:nt,title:mt}})),Ta(null)},onError:Me=>{Yt(Ie=>Ie.map(nt=>{if(nt.id!==O)return nt;const mt=nt.messages.map(Ze=>Ze.status==="streaming"?{...Ze,status:"error",content:Ze.content||Me}:Ze);return{...nt,messages:mt}})),Ta(null)}})},Ei=(O,ae)=>{Yt(se=>se.map(ye=>ye.id===O?{...ye,mode:ae}:ye)),Ce.updateSession(O,{mode:ae}).catch(console.error)},Xc=new Date().toISOString().slice(0,10),El=c[0],Jr={cto:"Chief Technology Officer",cbo:"Chief Business Officer",pm:"Product Manager",engineer:"Software Engineer",designer:"UI/UX Designer",qa:"QA Engineer"},hl=O=>{const ae=Jr[O];if(!ae)return"";for(const se of d){const ye=se.content,be=ye.indexOf(`## ${ae}`);if(be===-1)continue;const Me=ye.indexOf(`
|
|
91
91
|
## `,be+10),nt=(Me===-1?ye.slice(be):ye.slice(be,Me)).split(`
|
|
92
92
|
`).filter(mt=>mt.trim().length>0);for(const mt of nt){const Ze=mt.replace(/^#+\s*/,"").replace(/\*\*/g,"").replace(/^[-*]\s+/,"").trim();if(!(Ze.startsWith("|")||Ze.startsWith("{")||Ze.startsWith("[")||Ze.startsWith("```")||Ze.startsWith("---")||Ze.includes("Journal")||Ze.includes("(c-level)")||Ze.includes("(team-lead)")||Ze.includes("(member)")||/^(CEO |작업 결과|생성\/수정|APPROVAL|비고|상황 보고|태스크$)/.test(Ze))&&Ze.length>15&&Ze.length<120)return Ze}}return""},Ni=O=>{const ae=Jr[O];if(!ae)return"";for(const se of d){const ye=se.content,be=ye.indexOf(`## ${ae}`);if(be===-1)continue;const Me=ye.indexOf(`
|
|
93
|
-
## `,be+10),nt=(Me===-1?ye.slice(be):ye.slice(be,Me)).replace(/^## .+\n/,"").trim();if(nt)return nt.slice(0,1500)}return""},Pt=aE();k.useEffect(()=>{r.length>0&&Pt.syncDefaultMembers(r)},[r]);const Jn=eE({roles:r,roleStatuses:ke,activeExecs:Ae,getStandupSpeech:hl});return uE({roles:r,roleStatuses:ke,activeExecs:Ae,channels:Pt.channels,relationships:Jn.relationships,pushMessage:Pt.pushMessage,speechSettings:xe,engineType:Ke,hasApiKey:Ht}),E?s.jsxs("div",{className:"h-screen flex flex-col bg-[var(--floor-light)]",style:{fontFamily:"var(--pixel-font)"},children:[(vl||Ul.length>0)&&s.jsxs("div",{className:"shrink-0 z-[44]",children:[s.jsxs("div",{className:"flex items-center gap-3 px-5 py-2 text-xs cursor-pointer select-none",style:{background:"var(--accent)",color:"#fff",fontFamily:"var(--pixel-font)"},onClick:()=>Jt(O=>!O),children:[vl?s.jsx("div",{className:"w-3 h-3 border-2 border-white/40 border-t-white rounded-full animate-spin shrink-0"}):s.jsx("span",{className:"shrink-0",children:"✅"}),s.jsx("span",{className:"flex-1",children:vl||"Knowledge import finished"}),Hl&&s.jsx("div",{className:"w-24 h-1.5 rounded-full overflow-hidden shrink-0",style:{background:"rgba(255,255,255,0.3)"},children:s.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Hl.index/Hl.total*100}%`,background:"#fff"}})}),s.jsx("span",{className:"text-[10px] opacity-70 shrink-0",children:Sn?"▲":"▼"})]}),Sn&&s.jsxs("div",{className:"overflow-y-auto text-xs",style:{background:"var(--terminal-bg)",borderBottom:"2px solid var(--accent)",maxHeight:240,fontFamily:"var(--pixel-font)"},children:[Ul.map(O=>s.jsxs("div",{className:"flex items-start gap-2 px-5 py-1.5",style:{borderBottom:"1px solid var(--terminal-border)"},children:[s.jsxs("span",{className:"shrink-0 mt-0.5",style:{width:14,textAlign:"center"},children:[O.type==="scan"&&"🔍",O.type==="process"&&"⚙️",O.type==="created"&&"✅",O.type==="done"&&"🎉",O.type==="error"&&"❌"]}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{style:{color:O.type==="error"?"#EF4444":O.type==="done"?"var(--active-green)":"var(--terminal-text)"},children:O.text}),O.detail&&s.jsx("div",{className:"text-[10px] truncate",style:{color:"var(--terminal-text-muted)"},children:O.detail})]})]},O.id)),s.jsx("div",{ref:kl})]})]}),s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"text-4xl mb-3",children:"🏢"}),s.jsx("div",{className:"text-gray-600 font-semibold text-xs",children:"LOADING OFFICE..."})]})})]}):A?s.jsx("div",{className:"h-screen flex items-center justify-center bg-[var(--floor-light)]",children:s.jsxs("div",{className:"text-center max-w-md",style:{fontFamily:"var(--pixel-font)"},children:[s.jsx("div",{className:"text-4xl mb-3",children:"⚠️"}),s.jsx("div",{className:"text-gray-800 font-semibold mb-2 text-xs",children:"CONNECTION ERROR"}),s.jsx("div",{className:"text-gray-500 text-xs mb-4",children:A}),s.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 bg-gray-800 text-white text-xs font-bold cursor-pointer border-2 border-gray-600",style:{fontFamily:"var(--pixel-font)"},children:"RETRY"})]})}):s.jsxs("div",{className:"flex flex-col",style:{height:"100dvh",fontFamily:"var(--pixel-font)"},children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-2 bg-[var(--hud-bg)] text-white text-sm shrink-0 z-[45]",style:{borderBottom:"3px solid var(--pixel-border)"},children:[s.jsxs("div",{className:"font-black text-[13px] tracking-tight",style:{color:"var(--idle-amber)",textShadow:"2px 2px 0 rgba(0,0,0,0.5)"},children:["🏢"," ",s.jsx("span",{style:{color:"var(--terminal-text)"},children:S})]}),s.jsxs("div",{className:"flex gap-4 text-[var(--terminal-text-secondary)] text-[11px] items-center",children:[(()=>{const O=Object.values(Be).reduce((Me,Ie)=>Me+Ie.totalTokens,0),ae=O>=1e6?`${(O/1e6).toFixed(1)}M`:O>=1e3?`${Math.round(O/1e3)}K`:String(O),se=Math.min(100,Math.round(O/25e4*100)),ye=Ae.length,be=r.length>0?Math.round(ye/r.length*100):0;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"hidden md:flex items-center gap-1",children:["💰",s.jsx("div",{className:"w-[50px] h-2 bg-[#111] overflow-hidden",style:{border:"2px solid var(--pixel-border)"},children:s.jsx("div",{className:"h-full",style:{width:`${se}%`,background:"linear-gradient(90deg,#22c55e,#34D399)"}})}),s.jsx("strong",{className:"text-[var(--active-green)]",children:ae})]}),s.jsxs("div",{className:"hidden md:flex items-center gap-1",children:["⚡",s.jsx("div",{className:"w-[50px] h-2 bg-[#111] overflow-hidden",style:{border:"2px solid var(--pixel-border)"},children:s.jsx("div",{className:"h-full",style:{width:`${be}%`,background:"linear-gradient(90deg,#3b82f6,#60A5FA)"}})}),s.jsx("strong",{className:"text-[var(--terminal-text)]",children:be})]})]})})(),s.jsxs("span",{className:"hidden sm:inline",children:["Roles: ",s.jsx("strong",{className:"text-[var(--terminal-text)]",children:r.length})]}),s.jsxs("span",{className:"hidden sm:inline",children:["Projects: ",s.jsx("strong",{className:"text-[var(--terminal-text)]",children:c.length})]}),Ae.length>0&&s.jsxs("span",{className:"text-amber-400",children:["Working: ",s.jsx("strong",{children:Ae.length})]}),(()=>{const O={roles:Object.entries(Be).map(([se,ye])=>({id:se,level:ye.level,totalTokens:ye.totalTokens})),totalTokens:Object.values(Be).reduce((se,ye)=>se+ye.totalTokens,0),roleCount:r.length},ae=I0(O);return ae.length>0?s.jsx("div",{className:"hidden sm:flex",style:{gap:2,alignItems:"center",marginLeft:8,paddingLeft:8,borderLeft:"1px solid rgba(255,255,255,0.1)"},children:ae.map(se=>s.jsx("span",{title:`${se.name}: ${se.description}`,style:{fontSize:12,cursor:"default"},children:se.icon},se.id))}):null})(),s.jsx("span",{className:"px-1.5 py-0.5",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--pixel-border)"},children:Xc})]})]}),(vl||Ul.length>0)&&s.jsxs("div",{className:"shrink-0 z-[44]",children:[s.jsxs("div",{className:"flex items-center gap-3 px-5 py-2 text-xs cursor-pointer select-none",style:{background:"var(--accent)",color:"#fff",fontFamily:"var(--pixel-font)"},onClick:()=>Jt(O=>!O),children:[vl?s.jsx("div",{className:"w-3 h-3 border-2 border-white/40 border-t-white rounded-full animate-spin shrink-0"}):s.jsx("span",{className:"shrink-0",children:"✅"}),s.jsx("span",{className:"flex-1",children:vl||"Knowledge import finished"}),Hl&&s.jsx("div",{className:"w-24 h-1.5 rounded-full overflow-hidden shrink-0",style:{background:"rgba(255,255,255,0.3)"},children:s.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Hl.index/Hl.total*100}%`,background:"#fff"}})}),s.jsx("span",{className:"text-[10px] opacity-70 shrink-0",children:Sn?"▲":"▼"})]}),Sn&&s.jsxs("div",{className:"overflow-y-auto text-xs",style:{background:"var(--terminal-bg)",borderBottom:"2px solid var(--accent)",maxHeight:240,fontFamily:"var(--pixel-font)"},children:[Ul.map(O=>s.jsxs("div",{className:"flex items-start gap-2 px-5 py-1.5",style:{borderBottom:"1px solid var(--terminal-border)"},children:[s.jsxs("span",{className:"shrink-0 mt-0.5",style:{width:14,textAlign:"center"},children:[O.type==="scan"&&"🔍",O.type==="process"&&"⚙️",O.type==="created"&&"✅",O.type==="done"&&"🎉",O.type==="error"&&"❌"]}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{style:{color:O.type==="error"?"#EF4444":O.type==="done"?"var(--active-green)":"var(--terminal-text)"},children:O.text}),O.detail&&s.jsx("div",{className:"text-[10px] truncate",style:{color:"var(--terminal-text-muted)"},children:O.detail})]})]},O.id)),s.jsx("div",{ref:kl}),Ul.length===0&&s.jsx("div",{className:"px-5 py-4 text-center",style:{color:"var(--terminal-text-muted)"},children:"Waiting for events..."})]})]}),s.jsxs("div",{className:"flex-1 overflow-hidden flex relative",children:[s.jsx("div",{className:"flex-1 overflow-y-auto relative floor-grid",style:{background:"var(--floor-light)"},children:Na==="iso"?s.jsx(WE,{roles:r,projects:c,waves:x,standups:d,decisions:g,roleStatuses:Sl,activeExecs:Ae,onRoleClick:O=>H({type:"role",roleId:O}),onProjectClick:O=>H({type:"project",projectId:O}),onBulletinClick:()=>H({type:"bulletin"}),onDecisionsClick:()=>H({type:"decisions"}),onKnowledgeClick:()=>H({type:"knowledge"}),onSettingsClick:()=>Zt(!0),onThemeClick:()=>cl(O=>!O),onStatsClick:()=>ol(!0),knowledgeDocsCount:b.length,getRoleSpeech:Jn.getSpeech,getAppearance:Rt,onHireClick:()=>me(!0)}):s.jsxs("div",{className:`${gn?"max-w-full":"max-w-[1100px]"} mx-auto h-full p-4 flex flex-col gap-3 relative z-[1]`,children:[(()=>{const O=r.filter(se=>se.level==="c-level"),ae=r.filter(se=>se.level!=="c-level");return s.jsxs(s.Fragment,{children:[O.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"pixel-section-label",children:"LEADERSHIP"}),s.jsx("div",{className:`grid gap-2 ${O.length===1?"grid-cols-1":"grid-cols-2"}`,children:O.map(se=>{var ye,be;return s.jsx(Y0,{role:se,speech:Jn.getSpeech(se.id),onClick:()=>H({type:"role",roleId:se.id}),liveStatus:Sl[se.id],activeTask:(ye=Ae.find(Me=>Me.roleId===se.id))==null?void 0:ye.task,featured:!0,appearance:Rt(se.id),xpLevel:(be=Be[se.id])==null?void 0:be.level},se.id)})})]}),s.jsx("div",{className:"pixel-section-label",children:"TEAM"}),s.jsxs("div",{className:`grid gap-2 ${gn?"grid-cols-3":"grid-cols-4"}`,children:[ae.map(se=>{var ye,be;return s.jsx(Y0,{role:se,speech:Jn.getSpeech(se.id),onClick:()=>H({type:"role",roleId:se.id}),liveStatus:Sl[se.id],activeTask:(ye=Ae.find(Me=>Me.roleId===se.id))==null?void 0:ye.task,appearance:Rt(se.id),xpLevel:(be=Be[se.id])==null?void 0:be.level},se.id)}),s.jsx("div",{className:"pixel-card pixel-card--hire",onClick:()=>me(!0),children:s.jsxs("div",{className:"pixel-card--hire-inner",children:[s.jsx("span",{className:"pixel-card--hire-icon",children:"+"}),s.jsx("span",{className:"pixel-card--hire-label",children:"HIRE NEW ROLE"})]})})]})]})})(),s.jsx("div",{className:"pixel-section-label mt-1",children:"OFFICE"}),s.jsxs("div",{className:"grid grid-cols-4 gap-2",children:[s.jsxs("div",{className:"facility-card-compact",onClick:El?()=>H({type:"project",projectId:El.id}):void 0,style:El?void 0:{borderStyle:"dashed",opacity:.5},children:[s.jsxs("div",{className:"fcc-hdr",style:{background:"#3B82F6"},children:["🏢"," MEETING ROOM"]}),s.jsx("div",{className:"fcc-canvas",children:s.jsx(dc,{type:"meeting"})}),s.jsxs("div",{className:"fcc-body",children:[s.jsx("div",{className:"fcc-desc",children:"Projects, PRDs, and task boards"}),El?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"fcc-title",children:['"',El.name,'"']}),s.jsxs("div",{className:"fcc-meta",children:["Status: ",s.jsx("strong",{style:{color:"var(--active-green)"},children:El.status})]})]}):s.jsx("div",{className:"fcc-meta",style:{fontStyle:"italic"},children:"No active projects"})]})]}),s.jsxs("div",{className:"facility-card-compact",onClick:()=>H({type:"bulletin"}),children:[s.jsxs("div",{className:"fcc-hdr",style:{background:"#64748b"},children:["📋"," BULLETIN"]}),s.jsx("div",{className:"fcc-canvas",children:s.jsx(dc,{type:"bulletin"})}),s.jsxs("div",{className:"fcc-body",children:[s.jsx("div",{className:"fcc-desc",children:"Waves and daily standups"}),x.slice(0,1).map(O=>s.jsxs("div",{className:"fcc-item",children:["Wave ",O.id]},O.id)),d.slice(0,1).map(O=>s.jsxs("div",{className:"fcc-item",children:["Standup ",O.date]},O.date)),x.length===0&&d.length===0&&s.jsx("div",{className:"fcc-meta",style:{fontStyle:"italic"},children:"No entries yet"})]})]}),s.jsxs("div",{className:"facility-card-compact",onClick:()=>H({type:"decisions"}),children:[s.jsxs("div",{className:"fcc-hdr",style:{background:"#EF4444"},children:["📜"," DECISIONS"]}),s.jsx("div",{className:"fcc-canvas",children:s.jsx(dc,{type:"decision"})}),s.jsxs("div",{className:"fcc-body",children:[s.jsx("div",{className:"fcc-desc",children:"CEO strategic decision log"}),s.jsxs("div",{className:"fcc-title",children:[g.length," decisions"]}),g.slice(0,2).map(O=>s.jsxs("div",{className:"fcc-item",children:["#",O.id," ",O.title]},O.id))]})]}),s.jsxs("div",{className:"facility-card-compact",onClick:()=>H({type:"knowledge"}),children:[s.jsxs("div",{className:"fcc-hdr",style:{background:"#0D9488"},children:["📚"," KNOWLEDGE"]}),s.jsx("div",{className:"fcc-canvas",children:s.jsx(dc,{type:"knowledge"})}),s.jsxs("div",{className:"fcc-body",children:[s.jsx("div",{className:"fcc-desc",children:"Research, analysis, and references"}),s.jsxs("div",{className:"fcc-title",children:[b.length," docs"]}),b.slice(0,2).map(O=>s.jsx("div",{className:"fcc-item",children:O.title},O.id))]})]})]})]})}),gn&&s.jsx("div",{className:jl?"absolute inset-0 z-50":"contents",children:s.jsx($C,{sessions:Yl,activeSessionId:ul,roles:r,streamingSessionId:mr,width:jl?Aa:Ut,onWidthChange:jl?void 0:Xs,onSwitchSession:Zn,onCloseSession:Ks,onCreateSession:Ci,onClearEmpty:yr,onCloseAll:qc,onSendMessage:za,onModeChange:Ei,onCloseTerminal:()=>Tn(!1),chatChannels:Pt.channels,activeChatChannelId:Pt.activeChannelId,onSwitchChatChannel:Pt.setActiveChannelId,onCreateChatChannel:Pt.createChannel,onDeleteChatChannel:Pt.deleteChannel,onUpdateChatMembers:Pt.updateMembers,onUpdateChatTopic:Pt.updateTopic,unreadChannels:Pt.unreadChannels})})]}),s.jsxs("div",{className:"flex items-center justify-between px-5 py-2 bg-[var(--hud-bg)] text-[var(--terminal-text-secondary)] text-[10px] shrink-0 z-[45]",style:{borderTop:"3px solid var(--pixel-border)"},children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:()=>fr("card"),className:`view-toggle-btn ${Na==="card"?"active":""}`,children:"CARD"}),s.jsx("button",{onClick:()=>fr("iso"),className:`view-toggle-btn ${Na==="iso"?"active":""}`,children:"OFFICE"}),s.jsx("span",{className:"mx-1",children:"|"}),s.jsxs("div",{style:{position:"relative"},children:[s.jsxs("button",{className:`theme-btn${Zr?" active":""}`,onClick:()=>cl(O=>!O),title:"Office Theme",children:[((ql=Gr[Te])==null?void 0:ql.icon)??"","▾"]}),Zr&&s.jsx(aN,{theme:Te,onThemeChange:Ye,onClose:()=>cl(!1)})]}),s.jsx("button",{className:"theme-btn",onClick:()=>Zt(!0),title:"Settings",children:"⚙"}),s.jsx("span",{className:"mx-1",children:"|"}),s.jsxs("button",{onClick:()=>{We.state==="no-git"?We.initGit():We.state==="dirty"?$l(!0):Wt(!0)},title:We.state==="dirty"?`${We.dirtyCount} unsaved — click to save`:"Git Status",style:{background:"none",border:"none",cursor:"pointer",fontSize:10,fontFamily:"var(--pixel-font)",color:"var(--terminal-text-muted)",display:"flex",alignItems:"center",gap:4},children:[s.jsx("span",{style:{display:"inline-block",width:6,height:6,borderRadius:"50%",background:We.state==="no-git"?"var(--terminal-text-muted)":We.state==="saving"||We.state==="dirty"?"var(--idle-amber)":We.state==="error"?"#EF5350":"var(--active-green)",animation:We.state==="saving"?"pulse 1s infinite":void 0}}),s.jsx("span",{style:{color:We.state==="dirty"?"var(--idle-amber)":"var(--terminal-text-muted)"},children:We.state==="no-git"?"No git":We.state==="saving"?"Saving...":We.state==="dirty"?`${We.dirtyCount} unsaved`:"Saved"}),Wn&&(Wn.worktrees.length>0||Wn.staleBranches.length>0)&&s.jsxs("span",{style:{color:Wn.worktrees.some(O=>O.status==="stale")?"#ff6b6b":Wn.worktrees.some(O=>O.status==="pending-merge")?"#FFB74D":"#4FC3F7"},children:["·"," ","📂"," ",Wn.worktrees.length," worktree",Wn.worktrees.length!==1?"s":"",Wn.staleBranches.length>0&&` · ⚠ ${Wn.staleBranches.length} branch${Wn.staleBranches.length!==1?"es":""}`]})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[fe&&Ne&&s.jsx("button",{onClick:()=>Le(!1),className:"px-3 py-1 font-black text-white cursor-pointer animate-pulse",style:{background:"#B71C1C",border:"2px solid #7f121288",fontFamily:"var(--pixel-font)",borderRadius:4},children:"WAVE"}),D.length>0&&de&&s.jsxs("button",{onClick:()=>ue(!1),className:"px-3 py-1 font-black text-white cursor-pointer animate-pulse",style:{background:D[D.length-1].color,border:`2px solid ${D[D.length-1].color}88`,fontFamily:"var(--pixel-font)",borderRadius:4},children:[D[D.length-1].title.slice(0,20),D[D.length-1].title.length>20?"..":""]}),s.jsxs("button",{onClick:()=>V(!0),className:"wave-btn px-3 py-1 font-black text-white cursor-pointer",style:{background:"#B71C1C",border:"2px solid #7f1212",fontFamily:"var(--pixel-font)"},children:["🔴"," CEO WAVE"]}),s.jsx("button",{onClick:()=>gn?Tn(!1):Vs(),className:"px-3 py-1 font-black cursor-pointer",style:{background:gn?"var(--terminal-bg)":"var(--hud-bg-alt)",color:"var(--terminal-text)",border:`2px solid ${gn?"var(--terminal-border-hover)":"var(--pixel-border)"}`,fontFamily:"var(--pixel-font)"},children:"TERMINAL"})]})]}),_.type==="role"&&M&&(()=>{var ae;const O=Ae.find(se=>se.roleId===M.id);return s.jsx(oS,{role:M,allRoles:r,recentActivity:Ni(M.id),onClose:Cl,onFireRole:(se,ye)=>{ge({roleId:se,roleName:ye}),Cl()},terminalWidth:gn?Ut:0,activeJobId:O==null?void 0:O.id,activeTask:O==null?void 0:O.task,isWorking:Sl[M.id]==="working",jobStartedAt:O==null?void 0:O.startedAt,onStopJob:se=>Ce.abortJob(se),sessions:Yl,streamingSessionId:mr,onCreateSessionSilent:pr,onSendMessage:za,onFocusTerminal:Gs,onCustomize:se=>{const ye=r.find(be=>be.id===se);ye&&(Pe("character"),ht(ye))},onUpdateRole:Da,appearance:Rt(M.id),relationships:Jn.relationships,roleLevel:(ae=Be[M.id])==null?void 0:ae.level})})(),_.type==="project"&&El&&s.jsx(rC,{projectId:El.id,onClose:Cl,terminalWidth:gn?Ut:0}),(_.type==="bulletin"||_.type==="decisions")&&s.jsx(nC,{standups:d,waves:x,decisions:g,mode:_.type==="bulletin"?"bulletin":"decisions",onClose:Cl,terminalWidth:gn?Ut:0}),_.type==="knowledge"&&s.jsx(tC,{docs:b,onClose:Cl,onRefresh:()=>Ce.getKnowledge().then(v).catch(()=>{}),terminalWidth:gn?Ut:0,initialDocId:_.docId}),W&&s.jsx(sC,{roleId:W.roleId,roleName:W.roleName,mode:W.mode,onClose:()=>te(null),onExecutionStart:dl}),fe&&!Ne&&s.jsx(xC,{directive:fe.directive,rootJobs:fe.rootJobs,orgNodes:z,rootRoleId:K,onClose:()=>{Ee(null),Le(!1)},onMinimize:()=>Le(!0),onDone:()=>{Si(),yt("Wave complete","#2E7D32")},onOpenKnowledgeDoc:O=>{Ee(null),Le(!1),H({type:"knowledge",docId:O}),Ce.getKnowledge().then(v).catch(()=>{})}}),D.length>0&&!de&&(()=>{var se;const O=D[D.length-1],ae=ne.length>1;return s.jsxs(s.Fragment,{children:[ae&&D.length===1&&s.jsx("div",{className:"fixed top-[5%] left-1/2 -translate-x-1/2 w-[720px] max-w-[95vw] z-[63] flex gap-1 px-2 pt-2",children:ne.map((ye,be)=>s.jsx("button",{onClick:()=>{Z(be),Y([{jobId:ye.jobId,title:`CEO WAVE · ${ye.roleId.toUpperCase()}`,color:"#B71C1C"}])},className:"px-3 py-1.5 text-xs font-bold rounded-t-lg cursor-pointer transition-colors",style:{background:L===be?"#B71C1C":"var(--terminal-bg)",color:L===be?"#fff":"var(--terminal-text-secondary)",border:`1px solid ${L===be?"#B71C1C":"var(--terminal-border)"}`,borderBottom:"none"},children:ye.roleId.toUpperCase()},ye.jobId))}),s.jsx(oC,{jobId:O.jobId,title:D.length>1?O.title:ae?`CEO WAVE · ${((se=ne[L])==null?void 0:se.roleName)??""}`:O.title,color:O.color,variant:"modal",style:ae&&D.length===1?{marginTop:28}:void 0,onClose:()=>{Y([]),G([]),Z(0),ue(!1)},onMinimize:()=>ue(!0),onDone:()=>{Ic(),Si()},onNavigateToJob:ye=>{Ce.getJob(ye).then(be=>{const Me=jc[be.roleId]??"#888";Y(Ie=>[...Ie,{jobId:ye,title:`${be.roleId.toUpperCase()} · ${be.task.slice(0,40)}`,color:Me}])}).catch(console.error)},onOpenKnowledgeDoc:ye=>{Y([]),G([]),Z(0),ue(!1),H({type:"knowledge",docId:ye}),Ce.getKnowledge().then(v).catch(()=>{})}},O.jobId)]})})(),D.length>1&&s.jsx("div",{className:"fixed top-[5%] left-1/2 -translate-x-1/2 w-[720px] max-w-[95vw] z-[62] pointer-events-none",children:s.jsx("div",{className:"pointer-events-auto",children:s.jsxs("button",{onClick:()=>Y(O=>O.slice(0,-1)),className:"mt-2 ml-2 px-3 py-1 text-xs font-bold text-[var(--terminal-text)] bg-[var(--terminal-bg)] border border-[var(--terminal-border)] rounded-lg cursor-pointer hover:bg-[var(--terminal-inline-bg)]",children:["←"," Back to ",(Ai=D[D.length-2])==null?void 0:Ai.title]})})}),B&&s.jsx(uC,{cLevelRoles:r.filter(O=>O.level==="c-level"),orgNodes:z,rootId:K,onClose:()=>V(!1),onDispatch:ji}),tt&&s.jsx(vC,{existingRoles:r,onClose:()=>me(!1),onHire:Yc}),he&&s.jsx(wC,{roleId:he.roleId,roleName:he.roleName,onClose:()=>ge(null),onConfirm:Dn}),Xe&&s.jsx(ZE,{role:Xe,appearance:Rt(Xe.id),onSave:O=>re(Xe.id,O),onReset:()=>pe(Xe.id),onClose:()=>{ht(null),Pe("character")},theme:Te,onThemeChange:Ye,onUpdateName:async(O,ae)=>{await Da(O,{name:ae})},initialTab:"character",characterOnly:!0,speechSettings:xe,onSpeechSettingsChange:q,language:ze,onLanguageChange:He,roleLevel:(Ma=Be[Xe.id])==null?void 0:Ma.level}),un&&(()=>{const O=r.find(ae=>ae.id==="cto")??r.find(ae=>ae.level==="c-level")??r[0];return s.jsx(JE,{status:We.status,history:We.history,onClose:()=>$l(!1),onSave:async ae=>await We.save(ae),onLoadHistory:We.loadHistory,onRestore:We.restore,saving:We.state==="saving",delegateRoleName:(O==null?void 0:O.name)??(O==null?void 0:O.id),onDelegate:O?async ae=>{$l(!1);try{const se=await Ce.createSession(O.id,"do");Yt(be=>[se,...be]),Zn(se.id),Tn(!0);const ye=`Review the following unsaved changes, write a proper commit message, save (git add + commit), and push. If the current branch is not the main branch, create a PR and merge it.
|
|
93
|
+
## `,be+10),nt=(Me===-1?ye.slice(be):ye.slice(be,Me)).replace(/^## .+\n/,"").trim();if(nt)return nt.slice(0,1500)}return""},Pt=aE();k.useEffect(()=>{r.length>0&&Pt.syncDefaultMembers(r)},[r]);const Jn=eE({roles:r,roleStatuses:ke,activeExecs:Ae,getStandupSpeech:hl});return uE({roles:r,roleStatuses:ke,activeExecs:Ae,channels:Pt.channels,relationships:Jn.relationships,pushMessage:Pt.pushMessage,speechSettings:xe,engineType:Ke,hasApiKey:Ht}),E?s.jsxs("div",{className:"h-screen flex flex-col bg-[var(--floor-light)]",style:{fontFamily:"var(--pixel-font)"},children:[(vl||Ul.length>0)&&s.jsxs("div",{className:"shrink-0 z-[44]",children:[s.jsxs("div",{className:"flex items-center gap-3 px-5 py-2 text-xs cursor-pointer select-none",style:{background:"var(--accent)",color:"#fff",fontFamily:"var(--pixel-font)"},onClick:()=>Jt(O=>!O),children:[vl?s.jsx("div",{className:"w-3 h-3 border-2 border-white/40 border-t-white rounded-full animate-spin shrink-0"}):s.jsx("span",{className:"shrink-0",children:"✅"}),s.jsx("span",{className:"flex-1",children:vl||"Knowledge import finished"}),Hl&&s.jsx("div",{className:"w-24 h-1.5 rounded-full overflow-hidden shrink-0",style:{background:"rgba(255,255,255,0.3)"},children:s.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Hl.index/Hl.total*100}%`,background:"#fff"}})}),s.jsx("span",{className:"text-[10px] opacity-70 shrink-0",children:Sn?"▲":"▼"})]}),Sn&&s.jsxs("div",{className:"overflow-y-auto text-xs",style:{background:"var(--terminal-bg)",borderBottom:"2px solid var(--accent)",maxHeight:240,fontFamily:"var(--pixel-font)"},children:[Ul.map(O=>s.jsxs("div",{className:"flex items-start gap-2 px-5 py-1.5",style:{borderBottom:"1px solid var(--terminal-border)"},children:[s.jsxs("span",{className:"shrink-0 mt-0.5",style:{width:14,textAlign:"center"},children:[O.type==="scan"&&"🔍",O.type==="process"&&"⚙️",O.type==="created"&&"✅",O.type==="done"&&"🎉",O.type==="error"&&"❌"]}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{style:{color:O.type==="error"?"#EF4444":O.type==="done"?"var(--active-green)":"var(--terminal-text)"},children:O.text}),O.detail&&s.jsx("div",{className:"text-[10px] truncate",style:{color:"var(--terminal-text-muted)"},children:O.detail})]})]},O.id)),s.jsx("div",{ref:kl})]})]}),s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"text-4xl mb-3",children:"🏢"}),s.jsx("div",{className:"text-gray-600 font-semibold text-xs",children:"LOADING OFFICE..."})]})})]}):A?s.jsx("div",{className:"h-screen flex items-center justify-center bg-[var(--floor-light)]",children:s.jsxs("div",{className:"text-center max-w-md",style:{fontFamily:"var(--pixel-font)"},children:[s.jsx("div",{className:"text-4xl mb-3",children:"⚠️"}),s.jsx("div",{className:"text-gray-800 font-semibold mb-2 text-xs",children:"CONNECTION ERROR"}),s.jsx("div",{className:"text-gray-500 text-xs mb-4",children:A}),s.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 bg-gray-800 text-white text-xs font-bold cursor-pointer border-2 border-gray-600",style:{fontFamily:"var(--pixel-font)"},children:"RETRY"})]})}):s.jsxs("div",{className:"flex flex-col",style:{height:"100dvh",fontFamily:"var(--pixel-font)"},children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-2 bg-[var(--hud-bg)] text-white text-sm shrink-0 z-[45]",style:{borderBottom:"3px solid var(--pixel-border)"},children:[s.jsxs("div",{className:"font-black text-[13px] tracking-tight",style:{color:"var(--idle-amber)",textShadow:"2px 2px 0 rgba(0,0,0,0.5)"},children:["🏢"," ",s.jsx("span",{style:{color:"var(--terminal-text)"},children:S})]}),s.jsxs("div",{className:"flex gap-4 text-[var(--terminal-text-secondary)] text-[11px] items-center",children:[(()=>{const O=Object.values(Be).reduce((Me,Ie)=>Me+Ie.totalTokens,0),ae=O>=1e6?`${(O/1e6).toFixed(1)}M`:O>=1e3?`${Math.round(O/1e3)}K`:String(O),se=Math.min(100,Math.round(O/25e4*100)),ye=Ae.length,be=r.length>0?Math.round(ye/r.length*100):0;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"hidden md:flex items-center gap-1",children:["💰",s.jsx("div",{className:"w-[50px] h-2 bg-[#111] overflow-hidden",style:{border:"2px solid var(--pixel-border)"},children:s.jsx("div",{className:"h-full",style:{width:`${se}%`,background:"linear-gradient(90deg,#22c55e,#34D399)"}})}),s.jsx("strong",{className:"text-[var(--active-green)]",children:ae})]}),s.jsxs("div",{className:"hidden md:flex items-center gap-1",children:["⚡",s.jsx("div",{className:"w-[50px] h-2 bg-[#111] overflow-hidden",style:{border:"2px solid var(--pixel-border)"},children:s.jsx("div",{className:"h-full",style:{width:`${be}%`,background:"linear-gradient(90deg,#3b82f6,#60A5FA)"}})}),s.jsx("strong",{className:"text-[var(--terminal-text)]",children:be})]})]})})(),s.jsxs("span",{className:"hidden sm:inline",children:["Roles: ",s.jsx("strong",{className:"text-[var(--terminal-text)]",children:r.length})]}),s.jsxs("span",{className:"hidden sm:inline",children:["Projects: ",s.jsx("strong",{className:"text-[var(--terminal-text)]",children:c.length})]}),Ae.length>0&&s.jsxs("span",{className:"text-amber-400",children:["Working: ",s.jsx("strong",{children:Ae.length})]}),(()=>{const O={roles:Object.entries(Be).map(([se,ye])=>({id:se,level:ye.level,totalTokens:ye.totalTokens})),totalTokens:Object.values(Be).reduce((se,ye)=>se+ye.totalTokens,0),roleCount:r.length},ae=q0(O);return ae.length>0?s.jsx("div",{className:"hidden sm:flex",style:{gap:2,alignItems:"center",marginLeft:8,paddingLeft:8,borderLeft:"1px solid rgba(255,255,255,0.1)"},children:ae.map(se=>s.jsx("span",{title:`${se.name}: ${se.description}`,style:{fontSize:12,cursor:"default"},children:se.icon},se.id))}):null})(),s.jsx("span",{className:"px-1.5 py-0.5",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--pixel-border)"},children:Xc})]})]}),(vl||Ul.length>0)&&s.jsxs("div",{className:"shrink-0 z-[44]",children:[s.jsxs("div",{className:"flex items-center gap-3 px-5 py-2 text-xs cursor-pointer select-none",style:{background:"var(--accent)",color:"#fff",fontFamily:"var(--pixel-font)"},onClick:()=>Jt(O=>!O),children:[vl?s.jsx("div",{className:"w-3 h-3 border-2 border-white/40 border-t-white rounded-full animate-spin shrink-0"}):s.jsx("span",{className:"shrink-0",children:"✅"}),s.jsx("span",{className:"flex-1",children:vl||"Knowledge import finished"}),Hl&&s.jsx("div",{className:"w-24 h-1.5 rounded-full overflow-hidden shrink-0",style:{background:"rgba(255,255,255,0.3)"},children:s.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Hl.index/Hl.total*100}%`,background:"#fff"}})}),s.jsx("span",{className:"text-[10px] opacity-70 shrink-0",children:Sn?"▲":"▼"})]}),Sn&&s.jsxs("div",{className:"overflow-y-auto text-xs",style:{background:"var(--terminal-bg)",borderBottom:"2px solid var(--accent)",maxHeight:240,fontFamily:"var(--pixel-font)"},children:[Ul.map(O=>s.jsxs("div",{className:"flex items-start gap-2 px-5 py-1.5",style:{borderBottom:"1px solid var(--terminal-border)"},children:[s.jsxs("span",{className:"shrink-0 mt-0.5",style:{width:14,textAlign:"center"},children:[O.type==="scan"&&"🔍",O.type==="process"&&"⚙️",O.type==="created"&&"✅",O.type==="done"&&"🎉",O.type==="error"&&"❌"]}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{style:{color:O.type==="error"?"#EF4444":O.type==="done"?"var(--active-green)":"var(--terminal-text)"},children:O.text}),O.detail&&s.jsx("div",{className:"text-[10px] truncate",style:{color:"var(--terminal-text-muted)"},children:O.detail})]})]},O.id)),s.jsx("div",{ref:kl}),Ul.length===0&&s.jsx("div",{className:"px-5 py-4 text-center",style:{color:"var(--terminal-text-muted)"},children:"Waiting for events..."})]})]}),s.jsxs("div",{className:"flex-1 overflow-hidden flex relative",children:[s.jsx("div",{className:"flex-1 overflow-y-auto relative floor-grid",style:{background:"var(--floor-light)"},children:Na==="iso"?s.jsx(WE,{roles:r,projects:c,waves:x,standups:d,decisions:g,roleStatuses:Sl,activeExecs:Ae,onRoleClick:O=>H({type:"role",roleId:O}),onProjectClick:O=>H({type:"project",projectId:O}),onBulletinClick:()=>H({type:"bulletin"}),onDecisionsClick:()=>H({type:"decisions"}),onKnowledgeClick:()=>H({type:"knowledge"}),onSettingsClick:()=>Zt(!0),onThemeClick:()=>cl(O=>!O),onStatsClick:()=>ol(!0),knowledgeDocsCount:b.length,getRoleSpeech:Jn.getSpeech,getAppearance:Rt,onHireClick:()=>me(!0)}):s.jsxs("div",{className:`${gn?"max-w-full":"max-w-[1100px]"} mx-auto h-full p-4 flex flex-col gap-3 relative z-[1]`,children:[(()=>{const O=r.filter(se=>se.level==="c-level"),ae=r.filter(se=>se.level!=="c-level");return s.jsxs(s.Fragment,{children:[O.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"pixel-section-label",children:"LEADERSHIP"}),s.jsx("div",{className:`grid gap-2 ${O.length===1?"grid-cols-1":"grid-cols-2"}`,children:O.map(se=>{var ye,be;return s.jsx(X0,{role:se,speech:Jn.getSpeech(se.id),onClick:()=>H({type:"role",roleId:se.id}),liveStatus:Sl[se.id],activeTask:(ye=Ae.find(Me=>Me.roleId===se.id))==null?void 0:ye.task,featured:!0,appearance:Rt(se.id),xpLevel:(be=Be[se.id])==null?void 0:be.level},se.id)})})]}),s.jsx("div",{className:"pixel-section-label",children:"TEAM"}),s.jsxs("div",{className:`grid gap-2 ${gn?"grid-cols-3":"grid-cols-4"}`,children:[ae.map(se=>{var ye,be;return s.jsx(X0,{role:se,speech:Jn.getSpeech(se.id),onClick:()=>H({type:"role",roleId:se.id}),liveStatus:Sl[se.id],activeTask:(ye=Ae.find(Me=>Me.roleId===se.id))==null?void 0:ye.task,appearance:Rt(se.id),xpLevel:(be=Be[se.id])==null?void 0:be.level},se.id)}),s.jsx("div",{className:"pixel-card pixel-card--hire",onClick:()=>me(!0),children:s.jsxs("div",{className:"pixel-card--hire-inner",children:[s.jsx("span",{className:"pixel-card--hire-icon",children:"+"}),s.jsx("span",{className:"pixel-card--hire-label",children:"HIRE NEW ROLE"})]})})]})]})})(),s.jsx("div",{className:"pixel-section-label mt-1",children:"OFFICE"}),s.jsxs("div",{className:"grid grid-cols-4 gap-2",children:[s.jsxs("div",{className:"facility-card-compact",onClick:El?()=>H({type:"project",projectId:El.id}):void 0,style:El?void 0:{borderStyle:"dashed",opacity:.5},children:[s.jsxs("div",{className:"fcc-hdr",style:{background:"#3B82F6"},children:["🏢"," MEETING ROOM"]}),s.jsx("div",{className:"fcc-canvas",children:s.jsx(dc,{type:"meeting"})}),s.jsxs("div",{className:"fcc-body",children:[s.jsx("div",{className:"fcc-desc",children:"Projects, PRDs, and task boards"}),El?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"fcc-title",children:['"',El.name,'"']}),s.jsxs("div",{className:"fcc-meta",children:["Status: ",s.jsx("strong",{style:{color:"var(--active-green)"},children:El.status})]})]}):s.jsx("div",{className:"fcc-meta",style:{fontStyle:"italic"},children:"No active projects"})]})]}),s.jsxs("div",{className:"facility-card-compact",onClick:()=>H({type:"bulletin"}),children:[s.jsxs("div",{className:"fcc-hdr",style:{background:"#64748b"},children:["📋"," BULLETIN"]}),s.jsx("div",{className:"fcc-canvas",children:s.jsx(dc,{type:"bulletin"})}),s.jsxs("div",{className:"fcc-body",children:[s.jsx("div",{className:"fcc-desc",children:"Waves and daily standups"}),x.slice(0,1).map(O=>s.jsxs("div",{className:"fcc-item",children:["Wave ",O.id]},O.id)),d.slice(0,1).map(O=>s.jsxs("div",{className:"fcc-item",children:["Standup ",O.date]},O.date)),x.length===0&&d.length===0&&s.jsx("div",{className:"fcc-meta",style:{fontStyle:"italic"},children:"No entries yet"})]})]}),s.jsxs("div",{className:"facility-card-compact",onClick:()=>H({type:"decisions"}),children:[s.jsxs("div",{className:"fcc-hdr",style:{background:"#EF4444"},children:["📜"," DECISIONS"]}),s.jsx("div",{className:"fcc-canvas",children:s.jsx(dc,{type:"decision"})}),s.jsxs("div",{className:"fcc-body",children:[s.jsx("div",{className:"fcc-desc",children:"CEO strategic decision log"}),s.jsxs("div",{className:"fcc-title",children:[g.length," decisions"]}),g.slice(0,2).map(O=>s.jsxs("div",{className:"fcc-item",children:["#",O.id," ",O.title]},O.id))]})]}),s.jsxs("div",{className:"facility-card-compact",onClick:()=>H({type:"knowledge"}),children:[s.jsxs("div",{className:"fcc-hdr",style:{background:"#0D9488"},children:["📚"," KNOWLEDGE"]}),s.jsx("div",{className:"fcc-canvas",children:s.jsx(dc,{type:"knowledge"})}),s.jsxs("div",{className:"fcc-body",children:[s.jsx("div",{className:"fcc-desc",children:"Research, analysis, and references"}),s.jsxs("div",{className:"fcc-title",children:[b.length," docs"]}),b.slice(0,2).map(O=>s.jsx("div",{className:"fcc-item",children:O.title},O.id))]})]})]})]})}),gn&&s.jsx("div",{className:jl?"absolute inset-0 z-50":"contents",children:s.jsx($C,{sessions:Yl,activeSessionId:ul,roles:r,streamingSessionId:mr,width:jl?Aa:Ut,onWidthChange:jl?void 0:Xs,onSwitchSession:Zn,onCloseSession:Ks,onCreateSession:Ci,onClearEmpty:yr,onCloseAll:qc,onSendMessage:za,onModeChange:Ei,onCloseTerminal:()=>Tn(!1),chatChannels:Pt.channels,activeChatChannelId:Pt.activeChannelId,onSwitchChatChannel:Pt.setActiveChannelId,onCreateChatChannel:Pt.createChannel,onDeleteChatChannel:Pt.deleteChannel,onUpdateChatMembers:Pt.updateMembers,onUpdateChatTopic:Pt.updateTopic,unreadChannels:Pt.unreadChannels})})]}),s.jsxs("div",{className:"flex items-center justify-between px-5 py-2 bg-[var(--hud-bg)] text-[var(--terminal-text-secondary)] text-[10px] shrink-0 z-[45]",style:{borderTop:"3px solid var(--pixel-border)"},children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:()=>fr("card"),className:`view-toggle-btn ${Na==="card"?"active":""}`,children:"CARD"}),s.jsx("button",{onClick:()=>fr("iso"),className:`view-toggle-btn ${Na==="iso"?"active":""}`,children:"OFFICE"}),s.jsx("span",{className:"mx-1",children:"|"}),s.jsxs("div",{style:{position:"relative"},children:[s.jsxs("button",{className:`theme-btn${Zr?" active":""}`,onClick:()=>cl(O=>!O),title:"Office Theme",children:[((ql=Gr[Te])==null?void 0:ql.icon)??"","▾"]}),Zr&&s.jsx(aN,{theme:Te,onThemeChange:Ye,onClose:()=>cl(!1)})]}),s.jsx("button",{className:"theme-btn",onClick:()=>Zt(!0),title:"Settings",children:"⚙"}),s.jsx("span",{className:"mx-1",children:"|"}),s.jsxs("button",{onClick:()=>{We.state==="no-git"?We.initGit():We.state==="dirty"?$l(!0):Wt(!0)},title:We.state==="dirty"?`${We.dirtyCount} unsaved — click to save`:"Git Status",style:{background:"none",border:"none",cursor:"pointer",fontSize:10,fontFamily:"var(--pixel-font)",color:"var(--terminal-text-muted)",display:"flex",alignItems:"center",gap:4},children:[s.jsx("span",{style:{display:"inline-block",width:6,height:6,borderRadius:"50%",background:We.state==="no-git"?"var(--terminal-text-muted)":We.state==="saving"||We.state==="dirty"?"var(--idle-amber)":We.state==="error"?"#EF5350":"var(--active-green)",animation:We.state==="saving"?"pulse 1s infinite":void 0}}),s.jsx("span",{style:{color:We.state==="dirty"?"var(--idle-amber)":"var(--terminal-text-muted)"},children:We.state==="no-git"?"No git":We.state==="saving"?"Saving...":We.state==="dirty"?`${We.dirtyCount} unsaved`:"Saved"}),Wn&&(Wn.worktrees.length>0||Wn.staleBranches.length>0)&&s.jsxs("span",{style:{color:Wn.worktrees.some(O=>O.status==="stale")?"#ff6b6b":Wn.worktrees.some(O=>O.status==="pending-merge")?"#FFB74D":"#4FC3F7"},children:["·"," ","📂"," ",Wn.worktrees.length," worktree",Wn.worktrees.length!==1?"s":"",Wn.staleBranches.length>0&&` · ⚠ ${Wn.staleBranches.length} branch${Wn.staleBranches.length!==1?"es":""}`]})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[fe&&Ne&&s.jsx("button",{onClick:()=>Le(!1),className:"px-3 py-1 font-black text-white cursor-pointer animate-pulse",style:{background:"#B71C1C",border:"2px solid #7f121288",fontFamily:"var(--pixel-font)",borderRadius:4},children:"WAVE"}),D.length>0&&de&&s.jsxs("button",{onClick:()=>ue(!1),className:"px-3 py-1 font-black text-white cursor-pointer animate-pulse",style:{background:D[D.length-1].color,border:`2px solid ${D[D.length-1].color}88`,fontFamily:"var(--pixel-font)",borderRadius:4},children:[D[D.length-1].title.slice(0,20),D[D.length-1].title.length>20?"..":""]}),s.jsxs("button",{onClick:()=>V(!0),className:"wave-btn px-3 py-1 font-black text-white cursor-pointer",style:{background:"#B71C1C",border:"2px solid #7f1212",fontFamily:"var(--pixel-font)"},children:["🔴"," CEO WAVE"]}),s.jsx("button",{onClick:()=>gn?Tn(!1):Vs(),className:"px-3 py-1 font-black cursor-pointer",style:{background:gn?"var(--terminal-bg)":"var(--hud-bg-alt)",color:"var(--terminal-text)",border:`2px solid ${gn?"var(--terminal-border-hover)":"var(--pixel-border)"}`,fontFamily:"var(--pixel-font)"},children:"TERMINAL"})]})]}),_.type==="role"&&M&&(()=>{var ae;const O=Ae.find(se=>se.roleId===M.id);return s.jsx(oS,{role:M,allRoles:r,recentActivity:Ni(M.id),onClose:Cl,onFireRole:(se,ye)=>{ge({roleId:se,roleName:ye}),Cl()},terminalWidth:gn?Ut:0,activeJobId:O==null?void 0:O.id,activeTask:O==null?void 0:O.task,isWorking:Sl[M.id]==="working",jobStartedAt:O==null?void 0:O.startedAt,onStopJob:se=>Ce.abortJob(se),sessions:Yl,streamingSessionId:mr,onCreateSessionSilent:pr,onSendMessage:za,onFocusTerminal:Gs,onCustomize:se=>{const ye=r.find(be=>be.id===se);ye&&(Pe("character"),ht(ye))},onUpdateRole:Da,appearance:Rt(M.id),relationships:Jn.relationships,roleLevel:(ae=Be[M.id])==null?void 0:ae.level})})(),_.type==="project"&&El&&s.jsx(rC,{projectId:El.id,onClose:Cl,terminalWidth:gn?Ut:0}),(_.type==="bulletin"||_.type==="decisions")&&s.jsx(nC,{standups:d,waves:x,decisions:g,mode:_.type==="bulletin"?"bulletin":"decisions",onClose:Cl,terminalWidth:gn?Ut:0}),_.type==="knowledge"&&s.jsx(tC,{docs:b,onClose:Cl,onRefresh:()=>Ce.getKnowledge().then(v).catch(()=>{}),terminalWidth:gn?Ut:0,initialDocId:_.docId}),W&&s.jsx(sC,{roleId:W.roleId,roleName:W.roleName,mode:W.mode,onClose:()=>te(null),onExecutionStart:dl}),fe&&!Ne&&s.jsx(xC,{directive:fe.directive,rootJobs:fe.rootJobs,orgNodes:z,rootRoleId:K,onClose:()=>{Ee(null),Le(!1)},onMinimize:()=>Le(!0),onDone:()=>{Si(),yt("Wave complete","#2E7D32")},onOpenKnowledgeDoc:O=>{Ee(null),Le(!1),H({type:"knowledge",docId:O}),Ce.getKnowledge().then(v).catch(()=>{})}}),D.length>0&&!de&&(()=>{var se;const O=D[D.length-1],ae=ne.length>1;return s.jsxs(s.Fragment,{children:[ae&&D.length===1&&s.jsx("div",{className:"fixed top-[5%] left-1/2 -translate-x-1/2 w-[720px] max-w-[95vw] z-[63] flex gap-1 px-2 pt-2",children:ne.map((ye,be)=>s.jsx("button",{onClick:()=>{Z(be),Y([{jobId:ye.jobId,title:`CEO WAVE · ${ye.roleId.toUpperCase()}`,color:"#B71C1C"}])},className:"px-3 py-1.5 text-xs font-bold rounded-t-lg cursor-pointer transition-colors",style:{background:L===be?"#B71C1C":"var(--terminal-bg)",color:L===be?"#fff":"var(--terminal-text-secondary)",border:`1px solid ${L===be?"#B71C1C":"var(--terminal-border)"}`,borderBottom:"none"},children:ye.roleId.toUpperCase()},ye.jobId))}),s.jsx(oC,{jobId:O.jobId,title:D.length>1?O.title:ae?`CEO WAVE · ${((se=ne[L])==null?void 0:se.roleName)??""}`:O.title,color:O.color,variant:"modal",style:ae&&D.length===1?{marginTop:28}:void 0,onClose:()=>{Y([]),G([]),Z(0),ue(!1)},onMinimize:()=>ue(!0),onDone:()=>{Ic(),Si()},onNavigateToJob:ye=>{Ce.getJob(ye).then(be=>{const Me=jc[be.roleId]??"#888";Y(Ie=>[...Ie,{jobId:ye,title:`${be.roleId.toUpperCase()} · ${be.task.slice(0,40)}`,color:Me}])}).catch(console.error)},onOpenKnowledgeDoc:ye=>{Y([]),G([]),Z(0),ue(!1),H({type:"knowledge",docId:ye}),Ce.getKnowledge().then(v).catch(()=>{})}},O.jobId)]})})(),D.length>1&&s.jsx("div",{className:"fixed top-[5%] left-1/2 -translate-x-1/2 w-[720px] max-w-[95vw] z-[62] pointer-events-none",children:s.jsx("div",{className:"pointer-events-auto",children:s.jsxs("button",{onClick:()=>Y(O=>O.slice(0,-1)),className:"mt-2 ml-2 px-3 py-1 text-xs font-bold text-[var(--terminal-text)] bg-[var(--terminal-bg)] border border-[var(--terminal-border)] rounded-lg cursor-pointer hover:bg-[var(--terminal-inline-bg)]",children:["←"," Back to ",(Ai=D[D.length-2])==null?void 0:Ai.title]})})}),B&&s.jsx(uC,{cLevelRoles:r.filter(O=>O.level==="c-level"),orgNodes:z,rootId:K,onClose:()=>V(!1),onDispatch:ji}),tt&&s.jsx(vC,{existingRoles:r,onClose:()=>me(!1),onHire:Yc}),he&&s.jsx(wC,{roleId:he.roleId,roleName:he.roleName,onClose:()=>ge(null),onConfirm:Dn}),Xe&&s.jsx(ZE,{role:Xe,appearance:Rt(Xe.id),onSave:O=>re(Xe.id,O),onReset:()=>pe(Xe.id),onClose:()=>{ht(null),Pe("character")},theme:Te,onThemeChange:Ye,onUpdateName:async(O,ae)=>{await Da(O,{name:ae})},initialTab:"character",characterOnly:!0,speechSettings:xe,onSpeechSettingsChange:q,language:ze,onLanguageChange:He,roleLevel:(Ma=Be[Xe.id])==null?void 0:Ma.level}),un&&(()=>{const O=r.find(ae=>ae.id==="cto")??r.find(ae=>ae.level==="c-level")??r[0];return s.jsx(JE,{status:We.status,history:We.history,onClose:()=>$l(!1),onSave:async ae=>await We.save(ae),onLoadHistory:We.loadHistory,onRestore:We.restore,saving:We.state==="saving",delegateRoleName:(O==null?void 0:O.name)??(O==null?void 0:O.id),onDelegate:O?async ae=>{$l(!1);try{const se=await Ce.createSession(O.id,"do");Yt(be=>[se,...be]),Zn(se.id),Tn(!0);const ye=`Review the following unsaved changes, write a proper commit message, save (git add + commit), and push. If the current branch is not the main branch, create a PR and merge it.
|
|
94
94
|
|
|
95
95
|
Changed files:
|
|
96
|
-
${ae}`;za(se.id,ye,"do")}catch(se){yt(`Failed to delegate: ${se instanceof Error?se.message:"error"}`,"#B71C1C")}}:void 0})})(),ur&&s.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>ol(!1),children:s.jsx("div",{style:{width:420,maxHeight:"80vh",background:"var(--terminal-bg)",border:"2px solid var(--pixel-border)",borderRadius:8},onClick:O=>O.stopPropagation(),children:s.jsx(PE,{onClose:()=>ol(!1)})})}),dr&&s.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>$n(!1),children:s.jsx("div",{style:{width:480,maxHeight:"80vh",background:"var(--terminal-bg)",border:"2px solid var(--pixel-border)",borderRadius:8,overflowY:"auto"},onClick:O=>O.stopPropagation(),children:s.jsx(nN,{onClose:()=>$n(!1),onSyncComplete:()=>{}})})}),ve&&s.jsx(rN,{onClose:()=>Zt(!1),speechSettings:xe,onSpeechSettingsChange:q,language:ze,onLanguageChange:He,onOpenSync:()=>$n(!0),onOpenGitStatus:()=>Wt(!0),onOpenStats:()=>ol(!0)}),fn&&s.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>Wt(!1),children:s.jsx("div",{style:{width:520,maxHeight:"80vh",background:"var(--terminal-bg)",border:"2px solid var(--pixel-border)",borderRadius:8,overflowY:"auto"},onClick:O=>O.stopPropagation(),children:s.jsx(lN,{onClose:()=>Wt(!1)})})}),s.jsx("div",{className:"fixed top-16 right-4 z-[70] flex flex-col gap-2",children:je.map(O=>s.jsxs("div",{className:"toast-enter flex items-center gap-2 px-4 py-2.5 shadow-lg text-white text-xs font-black",style:{background:O.color,border:"2px solid rgba(0,0,0,0.3)",fontFamily:"var(--pixel-font)"},children:[s.jsx("div",{className:"w-2 h-2 bg-white/60"}),O.message]},O.id))})]})}function
|
|
96
|
+
${ae}`;za(se.id,ye,"do")}catch(se){yt(`Failed to delegate: ${se instanceof Error?se.message:"error"}`,"#B71C1C")}}:void 0})})(),ur&&s.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>ol(!1),children:s.jsx("div",{style:{width:420,maxHeight:"80vh",background:"var(--terminal-bg)",border:"2px solid var(--pixel-border)",borderRadius:8},onClick:O=>O.stopPropagation(),children:s.jsx(PE,{onClose:()=>ol(!1)})})}),dr&&s.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>$n(!1),children:s.jsx("div",{style:{width:480,maxHeight:"80vh",background:"var(--terminal-bg)",border:"2px solid var(--pixel-border)",borderRadius:8,overflowY:"auto"},onClick:O=>O.stopPropagation(),children:s.jsx(nN,{onClose:()=>$n(!1),onSyncComplete:()=>{}})})}),ve&&s.jsx(rN,{onClose:()=>Zt(!1),speechSettings:xe,onSpeechSettingsChange:q,language:ze,onLanguageChange:He,onOpenSync:()=>$n(!0),onOpenGitStatus:()=>Wt(!0),onOpenStats:()=>ol(!0)}),fn&&s.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>Wt(!1),children:s.jsx("div",{style:{width:520,maxHeight:"80vh",background:"var(--terminal-bg)",border:"2px solid var(--pixel-border)",borderRadius:8,overflowY:"auto"},onClick:O=>O.stopPropagation(),children:s.jsx(lN,{onClose:()=>Wt(!1)})})}),s.jsx("div",{className:"fixed top-16 right-4 z-[70] flex flex-col gap-2",children:je.map(O=>s.jsxs("div",{className:"toast-enter flex items-center gap-2 px-4 py-2.5 shadow-lg text-white text-xs font-black",style:{background:O.color,border:"2px solid rgba(0,0,0,0.3)",fontFamily:"var(--pixel-font)"},children:[s.jsx("div",{className:"w-2 h-2 bg-white/60"}),O.message]},O.id))})]})}function X0({role:t,speech:l,onClick:r,liveStatus:i,activeTask:c,featured:u,appearance:d,xpLevel:m}){const x=jc[t.id]??uN(t.id),f=m??1,g=cN[t.id]??t.name,y=i==="working",b=y&&c?c:l||g;return s.jsxs("div",{className:`pixel-card ${y?"working":""} ${u?"pixel-card--featured":""}`,onClick:r,children:[s.jsxs("div",{className:"pixel-card-hdr",style:{background:x},children:[s.jsxs("span",{children:[t.id.toUpperCase()," ","·"," ",t.name.toUpperCase()]}),s.jsxs("span",{className:"lvl",children:["Lv.",f]})]}),s.jsxs("div",{className:"pixel-card-body",children:[s.jsx("div",{className:"pixel-desk"}),s.jsx(_s,{roleId:t.id,appearance:d}),s.jsx("div",{className:"pixel-status-dot",style:{background:y?"var(--idle-amber)":"var(--active-green)"}})]}),s.jsxs("div",{className:"pixel-card-task",children:[s.jsx("span",{className:"pixel-card-task-icon",children:y?"🛠️":oN[t.id]??"👤"}),s.jsx("span",{className:"pixel-card-task-text",children:b||g})]})]})}function yc({onSelect:t,onClose:l}){const[r,i]=k.useState(null),[c,u]=k.useState(!0),d=k.useCallback(async m=>{u(!0);try{const x=await Ce.browse(m);i(x)}catch{}finally{u(!1)}},[]);return k.useEffect(()=>{d()},[d]),c&&!r?s.jsx("div",{className:"mt-3 rounded-lg p-4 text-xs text-center",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text-muted)"},children:"Loading..."}):r?s.jsxs("div",{className:"mt-3 rounded-lg overflow-hidden text-xs",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",maxHeight:220,overflowY:"auto"},children:[s.jsxs("div",{className:"px-3 py-2 flex items-center gap-2 sticky top-0",style:{background:"var(--terminal-surface)",borderBottom:"1px solid var(--terminal-border)"},children:[s.jsx("span",{style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},className:"truncate flex-1",children:r.current}),s.jsx("button",{onClick:()=>t(r.current),className:"px-2 py-1 rounded text-[10px] font-medium shrink-0",style:{background:"var(--active-green)",color:"#fff"},children:"Select"}),s.jsx("button",{onClick:l,className:"opacity-50 hover:opacity-100 shrink-0",style:{color:"var(--terminal-text)"},children:"✕"})]}),r.parent&&s.jsxs("div",{className:"px-3 py-1.5 cursor-pointer flex items-center gap-2 hover:bg-[var(--terminal-surface-light)]",style:{color:"var(--terminal-text-secondary)"},onClick:()=>d(r.parent),children:[s.jsx("span",{children:"⬆️"}),s.jsx("span",{children:".."})]}),r.dirs.map(m=>s.jsxs("div",{className:"px-3 py-1.5 cursor-pointer flex items-center gap-2 hover:bg-[var(--terminal-surface-light)]",style:{color:"var(--terminal-text)"},onClick:()=>d(m.path),children:[s.jsx("span",{children:"📁"}),s.jsx("span",{children:m.name})]},m.path)),r.dirs.length===0&&s.jsx("div",{className:"px-3 py-3 text-center",style:{color:"var(--terminal-text-muted)"},children:"No subdirectories"})]}):null}const fN={engine:"AI Engine",company:"Company Info",project:"Project",knowledge:"Knowledge",team:"Team Template",create:"Create"};function V0(t){switch(t){case"skip":return["engine","company","project","knowledge","team","create"];case"import":return["engine","company","project","knowledge","team","create"];case"existing-akb":return["engine","knowledge","create"]}}function hN({onComplete:t}){const[l,r]=k.useState(0),[i,c]=k.useState(null),[u,d]=k.useState("none"),[m,x]=k.useState(""),[f,g]=k.useState(!0),[y,b]=k.useState(""),[v,S]=k.useState(""),[j,E]=k.useState("auto"),[C,A]=k.useState(""),[F,_]=k.useState(""),[H,M]=k.useState(!1),[I,W]=k.useState(!1),te=k.useRef(null),[D,Y]=k.useState("fresh"),[B,V]=k.useState(""),[ne,G]=k.useState(null),[L,Z]=k.useState(!1),[de,ue]=k.useState(!1),[z,R]=k.useState("skip"),[K,T]=k.useState([]),[fe,Ee]=k.useState(""),[Ne,Le]=k.useState(!1),[Be,Qe]=k.useState(""),[Se,tt]=k.useState(null),[me,he]=k.useState(!1),[ge,ke]=k.useState(!1),[Fe,Ae]=k.useState([]),[De,je]=k.useState("startup"),[_e,Ke]=k.useState(!1),[Et,Ht]=k.useState(!1),[gt,Rt]=k.useState(null),[re,pe]=k.useState([]),[Te,Ye]=k.useState(""),[xe,q]=k.useState(!1),ze=k.useMemo(()=>V0(z),[z]),He=ze[l]??"engine";k.useEffect(()=>{Ce.detectEngine().then(ve=>{c(ve),d(ve.recommended),g(!1)}).catch(()=>g(!1)),Ce.getTeams().then(Ae).catch(()=>{}),Ce.getStatus().then(ve=>{_(ve.companyRoot||"")}).catch(()=>{})},[]),k.useEffect(()=>{var ve;He==="company"&&((ve=te.current)==null||ve.focus())},[He]),k.useEffect(()=>{if(H||!F)return;const ve=y.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");A(ve?`${F}/${ve}`:F)},[y,F,H]);const Xe=()=>{switch(He){case"engine":return u!=="none"||m.length>10;case"company":return y.trim().length>0;case"project":return D==="fresh"||D==="existing"&&ne===!0;case"knowledge":return z==="existing-akb"?Se===!0:z==="import"?K.length>0:!0;case"team":return!0;case"create":return!Et;default:return!1}},ht=()=>{l<ze.length-1&&Xe()&&r(l+1),He==="create"&&!_e&&!xe&&(z==="existing-akb"?ol():ur())},Pe=()=>{l>0&&r(l-1)};k.useEffect(()=>{const ve=V0(z);l>=ve.length&&r(ve.length-1)},[z,l]);const We=async()=>{if(B.trim()){Z(!0);try{const ve=await Ce.validatePath(B.trim());G(ve.valid)}catch{G(!1)}finally{Z(!1)}}},un=async()=>{if(Be.trim()){he(!0);try{const ve=await Ce.validatePath(Be.trim());tt(ve.valid&&ve.hasClaudeMd===!0)}catch{tt(!1)}finally{he(!1)}}},$l=()=>{const ve=fe.trim();ve&&!K.includes(ve)&&(T([...K,ve]),Ee(""))},ur=async()=>{Ke(!0),Rt(null);try{const ve={companyName:y.trim(),description:v.trim()||"An AI-powered organization",team:De,existingProjectPath:D==="existing"?B.trim():void 0,knowledgePaths:z==="import"&&K.length>0?K:void 0,language:j!=="auto"?j:void 0,location:C.trim()||void 0};(u==="direct-api"||m)&&(ve.apiKey=m||void 0);const Zt=await Ce.scaffold(ve);pe(Zt.created),Ye(Zt.projectRoot),Ht(!0)}catch(ve){Rt(ve instanceof Error?ve.message:"Scaffold failed")}finally{Ke(!1)}},ol=async()=>{q(!0),Rt(null);try{const ve=await Ce.connectAkb(Be.trim());ve.ok?(Ht(!0),pe([`Connected to: ${ve.companyRoot}`])):Rt(ve.error||"Failed to connect")}catch(ve){Rt(ve instanceof Error?ve.message:"Connect failed")}finally{q(!1)}},dr=()=>{z==="import"&&K.length>0?t({paths:K,companyRoot:""}):t()},$n=ve=>{ve.key==="Enter"&&Xe()&&(ve.preventDefault(),ht())},fn=`w-full px-3 py-2 rounded text-sm outline-none transition-colors
|
|
97
97
|
bg-[var(--terminal-bg)] text-[var(--terminal-text)]
|
|
98
98
|
border border-[var(--terminal-border)]
|
|
99
99
|
focus:border-[var(--terminal-border-hover)]
|
|
100
|
-
placeholder:text-[var(--terminal-text-muted)]`,Wt=ve=>`p-4 rounded-lg border-2 cursor-pointer transition-all text-[var(--terminal-text)] ${ve?"border-[var(--accent)] bg-[var(--accent)]/10":"border-[var(--terminal-border)] bg-[var(--hud-bg-alt)] hover:border-[var(--accent)]/50"}`;return s.jsx("div",{className:"h-full flex items-center justify-center",style:{background:"var(--floor-dark)"},onKeyDown:$n,children:s.jsxs("div",{className:"w-full max-w-xl rounded-xl shadow-2xl overflow-hidden",style:{background:"var(--hud-bg)",border:"1px solid var(--terminal-border)"},children:[s.jsxs("div",{className:"px-6 py-5",style:{background:"var(--terminal-bg)",borderBottom:"1px solid var(--terminal-border)"},children:[s.jsx("div",{className:"text-lg font-bold",style:{color:"var(--terminal-text)",fontFamily:"var(--pixel-font)"},children:"tycono"}),s.jsx("div",{className:"text-xs mt-1",style:{color:"var(--terminal-text-secondary)"},children:"Build an AI company. Watch them work."}),s.jsx("div",{className:"flex gap-1.5 mt-4",children:ze.map((ve,Zt)=>s.jsxs("div",{className:"flex-1",children:[s.jsx("div",{className:"h-1 rounded-full transition-colors",style:{background:Zt<=l?"var(--accent)":"var(--terminal-surface-light)"}}),s.jsx("div",{className:"text-[9px] mt-1 truncate",style:{color:Zt===l?"var(--terminal-text)":"var(--terminal-text-muted)"},children:fN[ve]})]},ve))})]}),s.jsxs("div",{className:"px-6 py-5 min-h-[280px]",children:[He==="engine"&&s.jsxs("div",{className:"space-y-4",children:[s.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"AI Engine Setup"}),f?s.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-secondary)"},children:"Detecting AI engine..."}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:Wt(u==="claude-cli"),onClick:()=>(i==null?void 0:i.claudeCli)&&d("claude-cli"),style:{opacity:i!=null&&i.claudeCli?1:.4},children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-lg",children:i!=null&&i.claudeCli?"✅":"❌"}),s.jsxs("div",{children:[s.jsx("div",{className:"font-medium text-sm",children:"Claude Code CLI"}),s.jsx("div",{className:"text-xs opacity-70",children:i!=null&&i.claudeCli?"Detected! Recommended — zero config needed.":"Not installed. Get it at claude.ai/download"})]})]})}),s.jsxs("div",{className:Wt(u==="direct-api"),onClick:()=>d("direct-api"),children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-lg",children:i!=null&&i.apiKey?"✅":"🔑"}),s.jsxs("div",{className:"flex-1",children:[s.jsx("div",{className:"font-medium text-sm",children:"Anthropic API Key (BYOK)"}),s.jsx("div",{className:"text-xs opacity-70",children:i!=null&&i.apiKey?"API key found in environment.":"Enter your ANTHROPIC_API_KEY"})]})]}),u==="direct-api"&&!(i!=null&&i.apiKey)&&s.jsx("input",{type:"password",className:`${fn} mt-3`,placeholder:"sk-ant-...",value:m,onChange:ve=>x(ve.target.value),autoFocus:!0})]})]})]}),He==="company"&&s.jsxs("div",{className:"space-y-4",children:[s.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Company Info"}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"Company Name *"}),s.jsx("input",{ref:te,className:fn,placeholder:"e.g. Acme Corp",value:y,onChange:ve=>b(ve.target.value)})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"Description"}),s.jsx("textarea",{className:`${fn} resize-none`,rows:3,placeholder:"What does your AI company do?",value:v,onChange:ve=>S(ve.target.value)})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"Location"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{className:`${fn} flex-1`,placeholder:"/path/to/your-company",value:C,onChange:ve=>{A(ve.target.value),M(!0)}}),s.jsx("button",{onClick:()=>W(!I),className:"px-3 py-2 rounded text-xs font-medium transition-colors shrink-0",style:{background:"var(--hud-bg-alt)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},title:"Browse folders",children:"📁"})]}),s.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--terminal-text-muted)"},children:"Where your AI company files will be created."}),I&&s.jsx(yc,{onSelect:ve=>{A(ve),M(!0),W(!1)},onClose:()=>W(!1)})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"AI Response Language"}),s.jsxs("select",{className:fn,value:j,onChange:ve=>E(ve.target.value),children:[s.jsx("option",{value:"auto",children:"Auto"}),s.jsx("option",{value:"en",children:"English"}),s.jsx("option",{value:"ko",children:"한국어"}),s.jsx("option",{value:"ja",children:"日本語"})]})]})]}),He==="project"&&s.jsxs("div",{className:"space-y-4",children:[s.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Project Setup"}),s.jsxs("div",{className:Wt(D==="fresh"),onClick:()=>{Y("fresh"),G(null)},children:[s.jsxs("div",{className:"font-medium text-sm",children:["🌱"," Start Fresh"]}),s.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Create a new AI company from scratch with clean directory structure."})]}),s.jsxs("div",{className:Wt(D==="existing"),onClick:()=>Y("existing"),children:[s.jsxs("div",{className:"font-medium text-sm",children:["📂"," Connect Existing Project"]}),s.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Add AI company structure to an existing codebase or knowledge base."}),D==="existing"&&s.jsxs("div",{className:"mt-3",onClick:ve=>ve.stopPropagation(),children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{className:`${fn} flex-1`,placeholder:"/path/to/your/project",value:B,onChange:ve=>{V(ve.target.value),G(null)},autoFocus:!0}),s.jsx("button",{onClick:()=>ue(!de),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--hud-bg-alt)",color:"var(--terminal-text)"},title:"Browse folders",children:"📁"}),s.jsx("button",{onClick:We,disabled:L||!B.trim(),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--accent)",color:"#fff",opacity:L||!B.trim()?.5:1},children:L?"...":"Verify"})]}),ne===!0&&s.jsxs("div",{className:"text-xs mt-2",style:{color:"var(--active-green)"},children:["✅"," Path verified: ",B]}),ne===!1&&s.jsxs("div",{className:"text-xs mt-2",style:{color:"#EF4444"},children:["❌"," Invalid path"]}),de&&s.jsx(yc,{onSelect:ve=>{V(ve),G(!0),ue(!1)},onClose:()=>ue(!1)})]})]})]}),He==="knowledge"&&s.jsxs("div",{className:"space-y-3",children:[s.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Knowledge Strategy"}),s.jsx("p",{className:"text-xs",style:{color:"var(--terminal-text-secondary)"},children:"How should AI handle your knowledge base?"}),s.jsxs("div",{className:Wt(z==="skip"),onClick:()=>R("skip"),children:[s.jsxs("div",{className:"font-medium text-sm",children:["🌱"," Start Fresh"]}),s.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Empty knowledge base. Add documents later from the office."})]}),s.jsxs("div",{className:Wt(z==="import"),onClick:()=>R("import"),children:[s.jsxs("div",{className:"font-medium text-sm",children:["📚"," Import & Build"]}),s.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Select folders with documents — AI reads, summarizes, and organizes them."}),z==="import"&&s.jsxs("div",{className:"mt-3 space-y-2",onClick:ve=>ve.stopPropagation(),children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{className:`${fn} flex-1`,placeholder:"/path/to/docs",value:fe,onChange:ve=>Ee(ve.target.value),onKeyDown:ve=>{ve.key==="Enter"&&(ve.preventDefault(),$l())},autoFocus:!0}),s.jsx("button",{onClick:()=>Le(!Ne),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--hud-bg-alt)",color:"var(--terminal-text)"},title:"Browse folders",children:"📁"}),s.jsx("button",{onClick:$l,disabled:!fe.trim(),className:"px-3 py-2 rounded text-xs font-medium",style:{background:"var(--accent)",color:"#fff",opacity:fe.trim()?1:.5},children:"Add"})]}),Ne&&s.jsx(yc,{onSelect:ve=>{K.includes(ve)||T([...K,ve]),Le(!1)},onClose:()=>Le(!1)}),K.length>0&&s.jsx("div",{className:"space-y-1",children:K.map((ve,Zt)=>s.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded text-xs",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},children:[s.jsx("span",{className:"flex-1 truncate",style:{fontFamily:"var(--pixel-font)"},children:ve}),s.jsx("button",{onClick:()=>T(K.filter((Zr,cl)=>cl!==Zt)),className:"opacity-50 hover:opacity-100",children:"✕"})]},Zt))}),K.length===0&&s.jsx("div",{className:"text-[10px] text-center py-2",style:{color:"var(--terminal-text-muted)"},children:"Add at least one folder to import."})]})]}),s.jsxs("div",{className:Wt(z==="existing-akb"),onClick:()=>R("existing-akb"),children:[s.jsxs("div",{className:"font-medium text-sm",children:["🔗"," Connect Existing AKB"]}),s.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Connect a directory that already has CLAUDE.md and AKB structure."}),z==="existing-akb"&&s.jsxs("div",{className:"mt-3",onClick:ve=>ve.stopPropagation(),children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{className:`${fn} flex-1`,placeholder:"/path/to/your/akb",value:Be,onChange:ve=>{Qe(ve.target.value),tt(null)},autoFocus:!0}),s.jsx("button",{onClick:()=>ke(!ge),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--hud-bg-alt)",color:"var(--terminal-text)"},title:"Browse folders",children:"📁"}),s.jsx("button",{onClick:un,disabled:me||!Be.trim(),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--accent)",color:"#fff",opacity:me||!Be.trim()?.5:1},children:me?"...":"Verify"})]}),Se===!0&&s.jsxs("div",{className:"text-xs mt-2",style:{color:"var(--active-green)"},children:["✅"," Valid AKB found: ",Be]}),Se===!1&&s.jsxs("div",{className:"text-xs mt-2",style:{color:"#EF4444"},children:["❌"," No valid AKB (CLAUDE.md required)"]}),ge&&s.jsx(yc,{onSelect:ve=>{Qe(ve),tt(null),ke(!1)},onClose:()=>ke(!1)})]})]})]}),He==="team"&&s.jsxs("div",{className:"space-y-4",children:[s.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Team Template"}),s.jsx("p",{className:"text-xs",style:{color:"var(--terminal-text-secondary)"},children:"Choose a starting team. You can add or remove roles later."}),Fe.map(ve=>s.jsxs("div",{className:Wt(De===ve.id),onClick:()=>je(ve.id),children:[s.jsx("div",{className:"font-medium text-sm capitalize",children:ve.id}),s.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:ve.roles.map(Zt=>s.jsx("span",{className:"px-2 py-0.5 rounded text-[10px]",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},children:Zt.name},Zt.id))})]},ve.id)),s.jsxs("div",{className:Wt(De==="custom"),onClick:()=>je("custom"),children:[s.jsx("div",{className:"font-medium text-sm",children:"Custom"}),s.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Start with no pre-built roles. Hire them from the office."})]})]}),He==="create"&&s.jsxs("div",{className:"space-y-4",children:[s.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:Et?z==="existing-akb"?"AKB Connected!":"Company Created!":"Review & Create"}),!Et&&!_e&&!xe&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"rounded-lg p-4 space-y-2 text-xs",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)",fontFamily:"var(--pixel-font)"},children:z==="existing-akb"?s.jsxs(s.Fragment,{children:[s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Mode:"})," Connect Existing AKB"]}),s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Path:"})," ",Be]}),s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Engine:"})," ",u==="claude-cli"?"Claude Code CLI":"Direct API"]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Company:"})," ",y]}),s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Location:"})," ",C||"(default)"]}),s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Engine:"})," ",u==="claude-cli"?"Claude Code CLI":"Direct API"]}),s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Project:"})," ",D==="fresh"?"Start Fresh":`Existing (${B})`]}),s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Knowledge:"})," ",z==="skip"?"Fresh (empty)":`Import ${K.length} source(s)`]}),s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Team:"})," ",De]}),z==="import"&&K.length>0&&s.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--idle-amber)"},children:"Knowledge import will run in the background after entering the office."})]})}),gt&&s.jsx("div",{className:"text-xs p-3 rounded",style:{background:"rgba(220,38,38,0.15)",color:"#f87171"},children:gt})]}),(_e||xe)&&s.jsxs("div",{className:"flex flex-col items-center py-8 gap-3",children:[s.jsx("div",{className:"w-8 h-8 border-2 rounded-full animate-spin",style:{borderColor:"var(--terminal-border)",borderTopColor:"var(--accent)"}}),s.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-secondary)"},children:xe?"Connecting to AKB...":"Scaffolding your company..."})]}),Et&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"text-center py-4 text-4xl",children:"🏢"}),Te&&s.jsxs("div",{className:"rounded-lg p-3 text-xs",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)",fontFamily:"var(--pixel-font)"},children:[s.jsx("span",{className:"opacity-50",children:"Location:"})," ",Te]}),s.jsx("div",{className:"rounded-lg p-4 text-xs max-h-40 overflow-y-auto",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)",fontFamily:"var(--pixel-font)"},children:re.map((ve,Zt)=>s.jsxs("div",{className:"py-0.5",children:[s.jsx("span",{style:{color:"var(--active-green)"},children:"✓"})," ",ve]},Zt))}),z==="import"&&K.length>0&&s.jsx("div",{className:"text-xs p-3 rounded",style:{background:"var(--accent)",color:"#fff",opacity:.9},children:"Knowledge import will start in the background after entering the office."})]})]})]}),s.jsxs("div",{className:"px-6 py-4 flex justify-between items-center",style:{borderTop:"1px solid var(--terminal-border)"},children:[s.jsx("div",{children:l>0&&!Et&&s.jsx("button",{onClick:Pe,className:"px-4 py-2 rounded text-sm transition-colors",style:{color:"var(--terminal-text-secondary)",border:"1px solid var(--terminal-border)"},children:"Back"})}),s.jsxs("div",{className:"text-xs",style:{color:"var(--terminal-text-muted)"},children:[l+1," / ",ze.length]}),s.jsx("div",{children:Et?s.jsx("button",{onClick:dr,className:"px-5 py-2 rounded text-sm font-medium transition-colors",style:{background:"var(--active-green)",color:"#fff"},children:"Enter Office"}):s.jsx("button",{onClick:ht,disabled:!Xe()||_e||xe,className:"px-5 py-2 rounded text-sm font-medium transition-colors",style:{background:Xe()?"var(--accent)":"var(--terminal-border)",color:"#fff",opacity:Xe()&&!_e&&!xe?1:.5},children:He==="create"?_e||xe?xe?"Connecting...":"Creating...":z==="existing-akb"?"Connect AKB":"Create Company":"Next"})})]})]})})}function mN(){const[t,l]=k.useState(null),[r,i]=k.useState(!0),[c,u]=k.useState(null),d=k.useCallback(async()=>{i(!0),u(null);try{const m=await Ce.getStatus();l(m)}catch(m){u(m instanceof Error?m.message:"Failed to fetch status")}finally{i(!1)}},[]);return k.useEffect(()=>{d()},[d]),{initialized:(t==null?void 0:t.initialized)??!1,companyName:(t==null?void 0:t.companyName)??null,engine:(t==null?void 0:t.engine)??"none",companyRoot:(t==null?void 0:t.companyRoot)??"",loading:r,error:c,refetch:d}}const xN=k.lazy(()=>J2(()=>import("./preview-app-C0mxfMCG.js"),[]));function _g(){return s.jsx("div",{className:"h-full flex items-center justify-center",style:{background:"var(--floor-dark)"},children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-10 h-10 mx-auto border-2 rounded-full animate-spin",style:{borderColor:"var(--terminal-border)",borderTopColor:"var(--accent)"}}),s.jsx("div",{className:"mt-4 text-sm",style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},children:"Loading..."})]})})}function pN(){var t;try{const l=localStorage.getItem("tycono-theme"),r=l&&l in Gr?l:"default",i=(t=Gr[r])==null?void 0:t.vars;if(!i)return;const c=document.documentElement;for(const[u,d]of Object.entries(i))c.style.setProperty(u,d)}catch{}}function yN(){const{initialized:t,loading:l,refetch:r}=mN(),[i,c]=k.useState(null);k.useEffect(()=>{pN()},[]);const u=d=>{d&&c(d),r()};return l?s.jsx(_g,{}):t?s.jsx(dN,{importJob:i,onImportDone:()=>c(null)}):s.jsx(hN,{onComplete:u})}function gN(){const t=new URLSearchParams(window.location.search).has("sprite-preview");return s.jsx(P2,{children:t?s.jsx(k.Suspense,{fallback:s.jsx(_g,{}),children:s.jsx(xN,{})}):s.jsx(yN,{})})}Q2.createRoot(document.getElementById("root")).render(s.jsx(k.StrictMode,{children:s.jsx(gN,{})}));export{pg as H,gg as P,bg as S,wN as a,yg as b,xg as c,Kf as d,Dj as e,Tj as f,vN as g,zj as h,s as j,k as r};
|
|
100
|
+
placeholder:text-[var(--terminal-text-muted)]`,Wt=ve=>`p-4 rounded-lg border-2 cursor-pointer transition-all text-[var(--terminal-text)] ${ve?"border-[var(--accent)] bg-[var(--accent)]/10":"border-[var(--terminal-border)] bg-[var(--hud-bg-alt)] hover:border-[var(--accent)]/50"}`;return s.jsx("div",{className:"h-full flex items-center justify-center",style:{background:"var(--floor-dark)"},onKeyDown:$n,children:s.jsxs("div",{className:"w-full max-w-xl rounded-xl shadow-2xl overflow-hidden",style:{background:"var(--hud-bg)",border:"1px solid var(--terminal-border)"},children:[s.jsxs("div",{className:"px-6 py-5",style:{background:"var(--terminal-bg)",borderBottom:"1px solid var(--terminal-border)"},children:[s.jsx("div",{className:"text-lg font-bold",style:{color:"var(--terminal-text)",fontFamily:"var(--pixel-font)"},children:"tycono"}),s.jsx("div",{className:"text-xs mt-1",style:{color:"var(--terminal-text-secondary)"},children:"Build an AI company. Watch them work."}),s.jsx("div",{className:"flex gap-1.5 mt-4",children:ze.map((ve,Zt)=>s.jsxs("div",{className:"flex-1",children:[s.jsx("div",{className:"h-1 rounded-full transition-colors",style:{background:Zt<=l?"var(--accent)":"var(--terminal-surface-light)"}}),s.jsx("div",{className:"text-[9px] mt-1 truncate",style:{color:Zt===l?"var(--terminal-text)":"var(--terminal-text-muted)"},children:fN[ve]})]},ve))})]}),s.jsxs("div",{className:"px-6 py-5 min-h-[280px]",children:[He==="engine"&&s.jsxs("div",{className:"space-y-4",children:[s.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"AI Engine Setup"}),f?s.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-secondary)"},children:"Detecting AI engine..."}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:Wt(u==="claude-cli"),onClick:()=>(i==null?void 0:i.claudeCli)&&d("claude-cli"),style:{opacity:i!=null&&i.claudeCli?1:.4},children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-lg",children:i!=null&&i.claudeCli?"✅":"❌"}),s.jsxs("div",{children:[s.jsx("div",{className:"font-medium text-sm",children:"Claude Code CLI"}),s.jsx("div",{className:"text-xs opacity-70",children:i!=null&&i.claudeCli?"Detected! Recommended — zero config needed.":"Not installed. Get it at claude.ai/download"})]})]})}),s.jsxs("div",{className:Wt(u==="direct-api"),onClick:()=>d("direct-api"),children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-lg",children:i!=null&&i.apiKey?"✅":"🔑"}),s.jsxs("div",{className:"flex-1",children:[s.jsx("div",{className:"font-medium text-sm",children:"Anthropic API Key (BYOK)"}),s.jsx("div",{className:"text-xs opacity-70",children:i!=null&&i.apiKey?"API key found in environment.":"Enter your ANTHROPIC_API_KEY"})]})]}),u==="direct-api"&&!(i!=null&&i.apiKey)&&s.jsx("input",{type:"password",className:`${fn} mt-3`,placeholder:"sk-ant-...",value:m,onChange:ve=>x(ve.target.value),autoFocus:!0})]})]})]}),He==="company"&&s.jsxs("div",{className:"space-y-4",children:[s.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Company Info"}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"Company Name *"}),s.jsx("input",{ref:te,className:fn,placeholder:"e.g. Acme Corp",value:y,onChange:ve=>b(ve.target.value)})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"Description"}),s.jsx("textarea",{className:`${fn} resize-none`,rows:3,placeholder:"What does your AI company do?",value:v,onChange:ve=>S(ve.target.value)})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"Location"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{className:`${fn} flex-1`,placeholder:"/path/to/your-company",value:C,onChange:ve=>{A(ve.target.value),M(!0)}}),s.jsx("button",{onClick:()=>W(!I),className:"px-3 py-2 rounded text-xs font-medium transition-colors shrink-0",style:{background:"var(--hud-bg-alt)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},title:"Browse folders",children:"📁"})]}),s.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--terminal-text-muted)"},children:"Where your AI company files will be created."}),I&&s.jsx(yc,{onSelect:ve=>{A(ve),M(!0),W(!1)},onClose:()=>W(!1)})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"AI Response Language"}),s.jsxs("select",{className:fn,value:j,onChange:ve=>E(ve.target.value),children:[s.jsx("option",{value:"auto",children:"Auto"}),s.jsx("option",{value:"en",children:"English"}),s.jsx("option",{value:"ko",children:"한국어"}),s.jsx("option",{value:"ja",children:"日本語"})]})]})]}),He==="project"&&s.jsxs("div",{className:"space-y-4",children:[s.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Project Setup"}),s.jsxs("div",{className:Wt(D==="fresh"),onClick:()=>{Y("fresh"),G(null)},children:[s.jsxs("div",{className:"font-medium text-sm",children:["🌱"," Start Fresh"]}),s.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Create a new AI company from scratch with clean directory structure."})]}),s.jsxs("div",{className:Wt(D==="existing"),onClick:()=>Y("existing"),children:[s.jsxs("div",{className:"font-medium text-sm",children:["📂"," Connect Existing Project"]}),s.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Add AI company structure to an existing codebase or knowledge base."}),D==="existing"&&s.jsxs("div",{className:"mt-3",onClick:ve=>ve.stopPropagation(),children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{className:`${fn} flex-1`,placeholder:"/path/to/your/project",value:B,onChange:ve=>{V(ve.target.value),G(null)},autoFocus:!0}),s.jsx("button",{onClick:()=>ue(!de),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--hud-bg-alt)",color:"var(--terminal-text)"},title:"Browse folders",children:"📁"}),s.jsx("button",{onClick:We,disabled:L||!B.trim(),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--accent)",color:"#fff",opacity:L||!B.trim()?.5:1},children:L?"...":"Verify"})]}),ne===!0&&s.jsxs("div",{className:"text-xs mt-2",style:{color:"var(--active-green)"},children:["✅"," Path verified: ",B]}),ne===!1&&s.jsxs("div",{className:"text-xs mt-2",style:{color:"#EF4444"},children:["❌"," Invalid path"]}),de&&s.jsx(yc,{onSelect:ve=>{V(ve),G(!0),ue(!1)},onClose:()=>ue(!1)})]})]})]}),He==="knowledge"&&s.jsxs("div",{className:"space-y-3",children:[s.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Knowledge Strategy"}),s.jsx("p",{className:"text-xs",style:{color:"var(--terminal-text-secondary)"},children:"How should AI handle your knowledge base?"}),s.jsxs("div",{className:Wt(z==="skip"),onClick:()=>R("skip"),children:[s.jsxs("div",{className:"font-medium text-sm",children:["🌱"," Start Fresh"]}),s.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Empty knowledge base. Add documents later from the office."})]}),s.jsxs("div",{className:Wt(z==="import"),onClick:()=>R("import"),children:[s.jsxs("div",{className:"font-medium text-sm",children:["📚"," Import & Build"]}),s.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Select folders with documents — AI reads, summarizes, and organizes them."}),z==="import"&&s.jsxs("div",{className:"mt-3 space-y-2",onClick:ve=>ve.stopPropagation(),children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{className:`${fn} flex-1`,placeholder:"/path/to/docs",value:fe,onChange:ve=>Ee(ve.target.value),onKeyDown:ve=>{ve.key==="Enter"&&(ve.preventDefault(),$l())},autoFocus:!0}),s.jsx("button",{onClick:()=>Le(!Ne),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--hud-bg-alt)",color:"var(--terminal-text)"},title:"Browse folders",children:"📁"}),s.jsx("button",{onClick:$l,disabled:!fe.trim(),className:"px-3 py-2 rounded text-xs font-medium",style:{background:"var(--accent)",color:"#fff",opacity:fe.trim()?1:.5},children:"Add"})]}),Ne&&s.jsx(yc,{onSelect:ve=>{K.includes(ve)||T([...K,ve]),Le(!1)},onClose:()=>Le(!1)}),K.length>0&&s.jsx("div",{className:"space-y-1",children:K.map((ve,Zt)=>s.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded text-xs",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},children:[s.jsx("span",{className:"flex-1 truncate",style:{fontFamily:"var(--pixel-font)"},children:ve}),s.jsx("button",{onClick:()=>T(K.filter((Zr,cl)=>cl!==Zt)),className:"opacity-50 hover:opacity-100",children:"✕"})]},Zt))}),K.length===0&&s.jsx("div",{className:"text-[10px] text-center py-2",style:{color:"var(--terminal-text-muted)"},children:"Add at least one folder to import."})]})]}),s.jsxs("div",{className:Wt(z==="existing-akb"),onClick:()=>R("existing-akb"),children:[s.jsxs("div",{className:"font-medium text-sm",children:["🔗"," Connect Existing AKB"]}),s.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Connect a directory that already has CLAUDE.md and AKB structure."}),z==="existing-akb"&&s.jsxs("div",{className:"mt-3",onClick:ve=>ve.stopPropagation(),children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{className:`${fn} flex-1`,placeholder:"/path/to/your/akb",value:Be,onChange:ve=>{Qe(ve.target.value),tt(null)},autoFocus:!0}),s.jsx("button",{onClick:()=>ke(!ge),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--hud-bg-alt)",color:"var(--terminal-text)"},title:"Browse folders",children:"📁"}),s.jsx("button",{onClick:un,disabled:me||!Be.trim(),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--accent)",color:"#fff",opacity:me||!Be.trim()?.5:1},children:me?"...":"Verify"})]}),Se===!0&&s.jsxs("div",{className:"text-xs mt-2",style:{color:"var(--active-green)"},children:["✅"," Valid AKB found: ",Be]}),Se===!1&&s.jsxs("div",{className:"text-xs mt-2",style:{color:"#EF4444"},children:["❌"," No valid AKB (CLAUDE.md required)"]}),ge&&s.jsx(yc,{onSelect:ve=>{Qe(ve),tt(null),ke(!1)},onClose:()=>ke(!1)})]})]})]}),He==="team"&&s.jsxs("div",{className:"space-y-4",children:[s.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Team Template"}),s.jsx("p",{className:"text-xs",style:{color:"var(--terminal-text-secondary)"},children:"Choose a starting team. You can add or remove roles later."}),Fe.map(ve=>s.jsxs("div",{className:Wt(De===ve.id),onClick:()=>je(ve.id),children:[s.jsx("div",{className:"font-medium text-sm capitalize",children:ve.id}),s.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:ve.roles.map(Zt=>s.jsx("span",{className:"px-2 py-0.5 rounded text-[10px]",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},children:Zt.name},Zt.id))})]},ve.id)),s.jsxs("div",{className:Wt(De==="custom"),onClick:()=>je("custom"),children:[s.jsx("div",{className:"font-medium text-sm",children:"Custom"}),s.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Start with no pre-built roles. Hire them from the office."})]})]}),He==="create"&&s.jsxs("div",{className:"space-y-4",children:[s.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:Et?z==="existing-akb"?"AKB Connected!":"Company Created!":"Review & Create"}),!Et&&!_e&&!xe&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"rounded-lg p-4 space-y-2 text-xs",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)",fontFamily:"var(--pixel-font)"},children:z==="existing-akb"?s.jsxs(s.Fragment,{children:[s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Mode:"})," Connect Existing AKB"]}),s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Path:"})," ",Be]}),s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Engine:"})," ",u==="claude-cli"?"Claude Code CLI":"Direct API"]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Company:"})," ",y]}),s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Location:"})," ",C||"(default)"]}),s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Engine:"})," ",u==="claude-cli"?"Claude Code CLI":"Direct API"]}),s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Project:"})," ",D==="fresh"?"Start Fresh":`Existing (${B})`]}),s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Knowledge:"})," ",z==="skip"?"Fresh (empty)":`Import ${K.length} source(s)`]}),s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Team:"})," ",De]}),z==="import"&&K.length>0&&s.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--idle-amber)"},children:"Knowledge import will run in the background after entering the office."})]})}),gt&&s.jsx("div",{className:"text-xs p-3 rounded",style:{background:"rgba(220,38,38,0.15)",color:"#f87171"},children:gt})]}),(_e||xe)&&s.jsxs("div",{className:"flex flex-col items-center py-8 gap-3",children:[s.jsx("div",{className:"w-8 h-8 border-2 rounded-full animate-spin",style:{borderColor:"var(--terminal-border)",borderTopColor:"var(--accent)"}}),s.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-secondary)"},children:xe?"Connecting to AKB...":"Scaffolding your company..."})]}),Et&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"text-center py-4 text-4xl",children:"🏢"}),Te&&s.jsxs("div",{className:"rounded-lg p-3 text-xs",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)",fontFamily:"var(--pixel-font)"},children:[s.jsx("span",{className:"opacity-50",children:"Location:"})," ",Te]}),s.jsx("div",{className:"rounded-lg p-4 text-xs max-h-40 overflow-y-auto",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)",fontFamily:"var(--pixel-font)"},children:re.map((ve,Zt)=>s.jsxs("div",{className:"py-0.5",children:[s.jsx("span",{style:{color:"var(--active-green)"},children:"✓"})," ",ve]},Zt))}),z==="import"&&K.length>0&&s.jsx("div",{className:"text-xs p-3 rounded",style:{background:"var(--accent)",color:"#fff",opacity:.9},children:"Knowledge import will start in the background after entering the office."})]})]})]}),s.jsxs("div",{className:"px-6 py-4 flex justify-between items-center",style:{borderTop:"1px solid var(--terminal-border)"},children:[s.jsx("div",{children:l>0&&!Et&&s.jsx("button",{onClick:Pe,className:"px-4 py-2 rounded text-sm transition-colors",style:{color:"var(--terminal-text-secondary)",border:"1px solid var(--terminal-border)"},children:"Back"})}),s.jsxs("div",{className:"text-xs",style:{color:"var(--terminal-text-muted)"},children:[l+1," / ",ze.length]}),s.jsx("div",{children:Et?s.jsx("button",{onClick:dr,className:"px-5 py-2 rounded text-sm font-medium transition-colors",style:{background:"var(--active-green)",color:"#fff"},children:"Enter Office"}):s.jsx("button",{onClick:ht,disabled:!Xe()||_e||xe,className:"px-5 py-2 rounded text-sm font-medium transition-colors",style:{background:Xe()?"var(--accent)":"var(--terminal-border)",color:"#fff",opacity:Xe()&&!_e&&!xe?1:.5},children:He==="create"?_e||xe?xe?"Connecting...":"Creating...":z==="existing-akb"?"Connect AKB":"Create Company":"Next"})})]})]})})}function mN(){const[t,l]=k.useState(null),[r,i]=k.useState(!0),[c,u]=k.useState(null),d=k.useCallback(async()=>{i(!0),u(null);try{const m=await Ce.getStatus();l(m)}catch(m){u(m instanceof Error?m.message:"Failed to fetch status")}finally{i(!1)}},[]);return k.useEffect(()=>{d()},[d]),{initialized:(t==null?void 0:t.initialized)??!1,companyName:(t==null?void 0:t.companyName)??null,engine:(t==null?void 0:t.engine)??"none",companyRoot:(t==null?void 0:t.companyRoot)??"",loading:r,error:c,refetch:d}}const xN=k.lazy(()=>J2(()=>import("./preview-app-mMmnwqgt.js"),[]));function _g(){return s.jsx("div",{className:"h-full flex items-center justify-center",style:{background:"var(--floor-dark)"},children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-10 h-10 mx-auto border-2 rounded-full animate-spin",style:{borderColor:"var(--terminal-border)",borderTopColor:"var(--accent)"}}),s.jsx("div",{className:"mt-4 text-sm",style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},children:"Loading..."})]})})}function pN(){var t;try{const l=localStorage.getItem("tycono-theme"),r=l&&l in Gr?l:"default",i=(t=Gr[r])==null?void 0:t.vars;if(!i)return;const c=document.documentElement;for(const[u,d]of Object.entries(i))c.style.setProperty(u,d)}catch{}}function yN(){const{initialized:t,loading:l,refetch:r}=mN(),[i,c]=k.useState(null);k.useEffect(()=>{pN()},[]);const u=d=>{d&&c(d),r()};return l?s.jsx(_g,{}):t?s.jsx(dN,{importJob:i,onImportDone:()=>c(null)}):s.jsx(hN,{onComplete:u})}function gN(){const t=new URLSearchParams(window.location.search).has("sprite-preview");return s.jsx(P2,{children:t?s.jsx(k.Suspense,{fallback:s.jsx(_g,{}),children:s.jsx(xN,{})}):s.jsx(yN,{})})}Q2.createRoot(document.getElementById("root")).render(s.jsx(k.StrictMode,{children:s.jsx(gN,{})}));export{pg as H,gg as P,bg as S,wN as a,yg as b,xg as c,Kf as d,Dj as e,Tj as f,vN as g,zj as h,s as j,k as r};
|