tycono 0.1.44 → 0.1.45
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-XDE-Ld_X.js → index-Bk15eKYG.js} +40 -39
- package/src/web/dist/assets/index-DM-qIa7f.css +1 -0
- package/src/web/dist/assets/{preview-app-DtCHQ2CL.js → preview-app-F1hM5BWu.js} +1 -1
- package/src/web/dist/index.html +2 -2
- package/src/web/dist/assets/index-DdHzlGw8.css +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var $2=Object.defineProperty;var L2=(t,l,r)=>l in t?$2(t,l,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[l]=r;var u1=(t,l,r)=>L2(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 Z0(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Qd={exports:{}},Ss={};/**
|
|
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 d1;function H2(){if(d1)return Ss;d1=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 Ss.Fragment=l,Ss.jsx=r,Ss.jsxs=r,Ss}var f1;function U2(){return f1||(f1=1,Qd.exports=H2()),Qd.exports}var s=U2(),Zd={exports:{}},nt={};/**
|
|
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 h1;function I2(){if(h1)return nt;h1=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(z){return z===null||typeof z!="object"?null:(z=b&&z[b]||z["@@iterator"],typeof z=="function"?z:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,E={};function C(z,G,D){this.props=z,this.context=G,this.refs=E,this.updater=D||S}C.prototype.isReactComponent={},C.prototype.setState=function(z,G){if(typeof z!="object"&&typeof z!="function"&&z!=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,z,G,"setState")},C.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function A(){}A.prototype=C.prototype;function R(z,G,D){this.props=z,this.context=G,this.refs=E,this.updater=D||S}var B=R.prototype=new A;B.constructor=R,j(B,C.prototype),B.isPureReactComponent=!0;var L=Array.isArray;function _(){}var V={H:null,A:null,T:null,S:null},K=Object.prototype.hasOwnProperty;function Y(z,G,D){var ue=D.ref;return{$$typeof:t,type:z,key:G,ref:ue!==void 0?ue:null,props:D}}function T(z,G){return Y(z.type,G,z.props)}function U(z){return typeof z=="object"&&z!==null&&z.$$typeof===t}function O(z){var G={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(D){return G[D]})}var Z=/\/+/g;function ne(z,G){return typeof z=="object"&&z!==null&&z.key!=null?O(""+z.key):G.toString(36)}function W(z){switch(z.status){case"fulfilled":return z.value;case"rejected":throw z.reason;default:switch(typeof z.status=="string"?z.then(_,_):(z.status="pending",z.then(function(G){z.status==="pending"&&(z.status="fulfilled",z.value=G)},function(G){z.status==="pending"&&(z.status="rejected",z.reason=G)})),z.status){case"fulfilled":return z.value;case"rejected":throw z.reason}}throw z}function I(z,G,D,ue,Ee){var ge=typeof z;(ge==="undefined"||ge==="boolean")&&(z=null);var Ae=!1;if(z===null)Ae=!0;else switch(ge){case"bigint":case"string":case"number":Ae=!0;break;case"object":switch(z.$$typeof){case t:case l:Ae=!0;break;case g:return Ae=z._init,I(Ae(z._payload),G,D,ue,Ee)}}if(Ae)return Ee=Ee(z),Ae=ue===""?"."+ne(z,0):ue,L(Ee)?(D="",Ae!=null&&(D=Ae.replace(Z,"$&/")+"/"),I(Ee,G,D,"",function(pe){return pe})):Ee!=null&&(U(Ee)&&(Ee=T(Ee,D+(Ee.key==null||z&&z.key===Ee.key?"":(""+Ee.key).replace(Z,"$&/")+"/")+Ae)),G.push(Ee)),1;Ae=0;var De=ue===""?".":ue+":";if(L(z))for(var Ie=0;Ie<z.length;Ie++)ue=z[Ie],ge=De+ne(ue,Ie),Ae+=I(ue,G,D,ge,Ee);else if(Ie=v(z),typeof Ie=="function")for(z=Ie.call(z),Ie=0;!(ue=z.next()).done;)ue=ue.value,ge=De+ne(ue,Ie++),Ae+=I(ue,G,D,ge,Ee);else if(ge==="object"){if(typeof z.then=="function")return I(W(z),G,D,ue,Ee);throw G=String(z),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys(z).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.")}return Ae}function P(z,G,D){if(z==null)return z;var ue=[],Ee=0;return I(z,ue,"","",function(ge){return G.call(D,ge,Ee++)}),ue}function ae(z){if(z._status===-1){var G=z._result;G=G(),G.then(function(D){(z._status===0||z._status===-1)&&(z._status=1,z._result=D)},function(D){(z._status===0||z._status===-1)&&(z._status=2,z._result=D)}),z._status===-1&&(z._status=0,z._result=G)}if(z._status===1)return z._result.default;throw z._result}var je=typeof reportError=="function"?reportError:function(z){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var G=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof z=="object"&&z!==null&&typeof z.message=="string"?String(z.message):String(z),error:z});if(!window.dispatchEvent(G))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",z);return}console.error(z)},M={map:P,forEach:function(z,G,D){P(z,function(){G.apply(this,arguments)},D)},count:function(z){var G=0;return P(z,function(){G++}),G},toArray:function(z){return P(z,function(G){return G})||[]},only:function(z){if(!U(z))throw Error("React.Children.only expected to receive a single React element child.");return z}};return nt.Activity=y,nt.Children=M,nt.Component=C,nt.Fragment=r,nt.Profiler=c,nt.PureComponent=R,nt.StrictMode=i,nt.Suspense=x,nt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=V,nt.__COMPILER_RUNTIME={__proto__:null,c:function(z){return V.H.useMemoCache(z)}},nt.cache=function(z){return function(){return z.apply(null,arguments)}},nt.cacheSignal=function(){return null},nt.cloneElement=function(z,G,D){if(z==null)throw Error("The argument must be a React element, but you passed "+z+".");var ue=j({},z.props),Ee=z.key;if(G!=null)for(ge in G.key!==void 0&&(Ee=""+G.key),G)!K.call(G,ge)||ge==="key"||ge==="__self"||ge==="__source"||ge==="ref"&&G.ref===void 0||(ue[ge]=G[ge]);var ge=arguments.length-2;if(ge===1)ue.children=D;else if(1<ge){for(var Ae=Array(ge),De=0;De<ge;De++)Ae[De]=arguments[De+2];ue.children=Ae}return Y(z.type,Ee,ue)},nt.createContext=function(z){return z={$$typeof:d,_currentValue:z,_currentValue2:z,_threadCount:0,Provider:null,Consumer:null},z.Provider=z,z.Consumer={$$typeof:u,_context:z},z},nt.createElement=function(z,G,D){var ue,Ee={},ge=null;if(G!=null)for(ue in G.key!==void 0&&(ge=""+G.key),G)K.call(G,ue)&&ue!=="key"&&ue!=="__self"&&ue!=="__source"&&(Ee[ue]=G[ue]);var Ae=arguments.length-2;if(Ae===1)Ee.children=D;else if(1<Ae){for(var De=Array(Ae),Ie=0;Ie<Ae;Ie++)De[Ie]=arguments[Ie+2];Ee.children=De}if(z&&z.defaultProps)for(ue in Ae=z.defaultProps,Ae)Ee[ue]===void 0&&(Ee[ue]=Ae[ue]);return Y(z,ge,Ee)},nt.createRef=function(){return{current:null}},nt.forwardRef=function(z){return{$$typeof:m,render:z}},nt.isValidElement=U,nt.lazy=function(z){return{$$typeof:g,_payload:{_status:-1,_result:z},_init:ae}},nt.memo=function(z,G){return{$$typeof:f,type:z,compare:G===void 0?null:G}},nt.startTransition=function(z){var G=V.T,D={};V.T=D;try{var ue=z(),Ee=V.S;Ee!==null&&Ee(D,ue),typeof ue=="object"&&ue!==null&&typeof ue.then=="function"&&ue.then(_,je)}catch(ge){je(ge)}finally{G!==null&&D.types!==null&&(G.types=D.types),V.T=G}},nt.unstable_useCacheRefresh=function(){return V.H.useCacheRefresh()},nt.use=function(z){return V.H.use(z)},nt.useActionState=function(z,G,D){return V.H.useActionState(z,G,D)},nt.useCallback=function(z,G){return V.H.useCallback(z,G)},nt.useContext=function(z){return V.H.useContext(z)},nt.useDebugValue=function(){},nt.useDeferredValue=function(z,G){return V.H.useDeferredValue(z,G)},nt.useEffect=function(z,G){return V.H.useEffect(z,G)},nt.useEffectEvent=function(z){return V.H.useEffectEvent(z)},nt.useId=function(){return V.H.useId()},nt.useImperativeHandle=function(z,G,D){return V.H.useImperativeHandle(z,G,D)},nt.useInsertionEffect=function(z,G){return V.H.useInsertionEffect(z,G)},nt.useLayoutEffect=function(z,G){return V.H.useLayoutEffect(z,G)},nt.useMemo=function(z,G){return V.H.useMemo(z,G)},nt.useOptimistic=function(z,G){return V.H.useOptimistic(z,G)},nt.useReducer=function(z,G,D){return V.H.useReducer(z,G,D)},nt.useRef=function(z){return V.H.useRef(z)},nt.useState=function(z){return V.H.useState(z)},nt.useSyncExternalStore=function(z,G,D){return V.H.useSyncExternalStore(z,G,D)},nt.useTransition=function(){return V.H.useTransition()},nt.version="19.2.4",nt}var m1;function oh(){return m1||(m1=1,Zd.exports=I2()),Zd.exports}var k=oh(),Jd={exports:{}},Cs={},Pd={exports:{}},ef={};/**
|
|
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 x1;function Y2(){return x1||(x1=1,(function(t){function l(I,P){var ae=I.length;I.push(P);e:for(;0<ae;){var je=ae-1>>>1,M=I[je];if(0<c(M,P))I[je]=P,I[ae]=M,ae=je;else break e}}function r(I){return I.length===0?null:I[0]}function i(I){if(I.length===0)return null;var P=I[0],ae=I.pop();if(ae!==P){I[0]=ae;e:for(var je=0,M=I.length,z=M>>>1;je<z;){var G=2*(je+1)-1,D=I[G],ue=G+1,Ee=I[ue];if(0>c(D,ae))ue<M&&0>c(Ee,D)?(I[je]=Ee,I[ue]=ae,je=ue):(I[je]=D,I[G]=ae,je=G);else if(ue<M&&0>c(Ee,ae))I[je]=Ee,I[ue]=ae,je=ue;else break e}}return P}function c(I,P){var ae=I.sortIndex-P.sortIndex;return ae!==0?ae:I.id-P.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,R=typeof setImmediate<"u"?setImmediate:null;function B(I){for(var P=r(f);P!==null;){if(P.callback===null)i(f);else if(P.startTime<=I)i(f),P.sortIndex=P.expirationTime,l(x,P);else break;P=r(f)}}function L(I){if(j=!1,B(I),!S)if(r(x)!==null)S=!0,_||(_=!0,O());else{var P=r(f);P!==null&&W(L,P.startTime-I)}}var _=!1,V=-1,K=5,Y=-1;function T(){return E?!0:!(t.unstable_now()-Y<K)}function U(){if(E=!1,_){var I=t.unstable_now();Y=I;var P=!0;try{e:{S=!1,j&&(j=!1,A(V),V=-1),v=!0;var ae=b;try{t:{for(B(I),y=r(x);y!==null&&!(y.expirationTime>I&&T());){var je=y.callback;if(typeof je=="function"){y.callback=null,b=y.priorityLevel;var M=je(y.expirationTime<=I);if(I=t.unstable_now(),typeof M=="function"){y.callback=M,B(I),P=!0;break t}y===r(x)&&i(x),B(I)}else i(x);y=r(x)}if(y!==null)P=!0;else{var z=r(f);z!==null&&W(L,z.startTime-I),P=!1}}break e}finally{y=null,b=ae,v=!1}P=void 0}}finally{P?O():_=!1}}}var O;if(typeof R=="function")O=function(){R(U)};else if(typeof MessageChannel<"u"){var Z=new MessageChannel,ne=Z.port2;Z.port1.onmessage=U,O=function(){ne.postMessage(null)}}else O=function(){C(U,0)};function W(I,P){V=C(function(){I(t.unstable_now())},P)}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(I){I.callback=null},t.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):K=0<I?Math.floor(1e3/I):5},t.unstable_getCurrentPriorityLevel=function(){return b},t.unstable_next=function(I){switch(b){case 1:case 2:case 3:var P=3;break;default:P=b}var ae=b;b=P;try{return I()}finally{b=ae}},t.unstable_requestPaint=function(){E=!0},t.unstable_runWithPriority=function(I,P){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var ae=b;b=I;try{return P()}finally{b=ae}},t.unstable_scheduleCallback=function(I,P,ae){var je=t.unstable_now();switch(typeof ae=="object"&&ae!==null?(ae=ae.delay,ae=typeof ae=="number"&&0<ae?je+ae:je):ae=je,I){case 1:var M=-1;break;case 2:M=250;break;case 5:M=1073741823;break;case 4:M=1e4;break;default:M=5e3}return M=ae+M,I={id:g++,callback:P,priorityLevel:I,startTime:ae,expirationTime:M,sortIndex:-1},ae>je?(I.sortIndex=ae,l(f,I),r(x)===null&&I===r(f)&&(j?(A(V),V=-1):j=!0,W(L,ae-je))):(I.sortIndex=M,l(x,I),S||v||(S=!0,_||(_=!0,O()))),I},t.unstable_shouldYield=T,t.unstable_wrapCallback=function(I){var P=b;return function(){var ae=b;b=P;try{return I.apply(this,arguments)}finally{b=ae}}}})(ef)),ef}var p1;function q2(){return p1||(p1=1,Pd.exports=Y2()),Pd.exports}var tf={exports:{}},jn={};/**
|
|
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 y1;function X2(){if(y1)return jn;y1=1;var t=oh();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 jn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,jn.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)},jn.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()}},jn.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))},jn.prefetchDNS=function(x){typeof x=="string"&&i.d.D(x)},jn.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})}},jn.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)},jn.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})}},jn.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)},jn.requestFormReset=function(x){i.d.r(x)},jn.unstable_batchedUpdates=function(x,f){return x(f)},jn.useFormState=function(x,f,g){return d.H.useFormState(x,f,g)},jn.useFormStatus=function(){return d.H.useHostTransitionStatus()},jn.version="19.2.4",jn}var g1;function V2(){if(g1)return tf.exports;g1=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(),tf.exports=X2(),tf.exports}/**
|
|
34
34
|
* @license React
|
|
35
35
|
* react-dom-client.production.js
|
|
36
36
|
*
|
|
@@ -38,63 +38,64 @@ 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 b1;function G2(){if(b1)return Cs;b1=1;var t=q2(),l=oh(),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"),R=Symbol.for("react.context"),B=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),V=Symbol.for("react.memo"),K=Symbol.for("react.lazy"),Y=Symbol.for("react.activity"),T=Symbol.for("react.memo_cache_sentinel"),U=Symbol.iterator;function O(e){return e===null||typeof e!="object"?null:(e=U&&e[U]||e["@@iterator"],typeof e=="function"?e:null)}var Z=Symbol.for("react.client.reference");function ne(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Z?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 L:return"Suspense";case _:return"SuspenseList";case Y:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case S:return"Portal";case R:return e.displayName||"Context";case A:return(e._context.displayName||"Context")+".Consumer";case B:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case V:return n=e.displayName||null,n!==null?n:ne(e.type)||"Memo";case K:n=e._payload,e=e._init;try{return ne(e(n))}catch{}}return null}var W=Array.isArray,I=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae={pending:!1,data:null,method:null,action:null},je=[],M=-1;function z(e){return{current:e}}function G(e){0>M||(e.current=je[M],je[M]=null,M--)}function D(e,n){M++,je[M]=e.current,e.current=n}var ue=z(null),Ee=z(null),ge=z(null),Ae=z(null);function De(e,n){switch(D(ge,n),D(Ee,e),D(ue,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?Fp(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=Fp(n),e=Rp(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}G(ue),D(ue,e)}function Ie(){G(ue),G(Ee),G(ge)}function pe(e){e.memoizedState!==null&&D(Ae,e);var n=ue.current,a=Rp(n,e.type);n!==a&&(D(Ee,e),D(ue,a))}function Pe(e){Ee.current===e&&(G(ue),G(Ee)),Ae.current===e&&(G(Ae),vs._currentValue=ae)}var fe,he;function be(e){if(fe===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);fe=n&&n[1]||"",he=-1<a.stack.indexOf(`
|
|
42
42
|
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
-
`+fe+e+he}var Ce=!1;function ze(e,n){if(!e||Ce)return"";Ce=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(n){var de=function(){throw Error()};if(Object.defineProperty(de.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(de,[])}catch(
|
|
43
|
+
`+fe+e+he}var Ce=!1;function ze(e,n){if(!e||Ce)return"";Ce=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(n){var de=function(){throw Error()};if(Object.defineProperty(de.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(de,[])}catch(re){var te=re}Reflect.construct(e,[],de)}else{try{de.call()}catch(re){te=re}e.call(de.prototype)}}else{try{throw Error()}catch(re){te=re}(de=e())&&typeof de.catch=="function"&&de.catch(function(){})}}catch(re){if(re&&te&&typeof re.stack=="string")return[re.stack,te.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 H=w.split(`
|
|
44
44
|
`),ee=N.split(`
|
|
45
|
-
`);for(h=o=0;o<H.length&&!H[o].includes("DetermineComponentFrameRoot");)o++;for(;h<ee.length&&!ee[h].includes("DetermineComponentFrameRoot");)h++;if(o===H.length||h===ee.length)for(o=H.length-1,h=ee.length-1;1<=o&&0<=h&&H[o]!==ee[h];)h--;for(;1<=o&&0<=h;o--,h--)if(H[o]!==ee[h]){if(o!==1||h!==1)do if(o--,h--,0>h||H[o]!==ee[h]){var
|
|
46
|
-
`+H[o].replace(" at new "," at ");return e.displayName&&
|
|
45
|
+
`);for(h=o=0;o<H.length&&!H[o].includes("DetermineComponentFrameRoot");)o++;for(;h<ee.length&&!ee[h].includes("DetermineComponentFrameRoot");)h++;if(o===H.length||h===ee.length)for(o=H.length-1,h=ee.length-1;1<=o&&0<=h&&H[o]!==ee[h];)h--;for(;1<=o&&0<=h;o--,h--)if(H[o]!==ee[h]){if(o!==1||h!==1)do if(o--,h--,0>h||H[o]!==ee[h]){var oe=`
|
|
46
|
+
`+H[o].replace(" at new "," at ");return e.displayName&&oe.includes("<anonymous>")&&(oe=oe.replace("<anonymous>",e.displayName)),oe}while(1<=o&&0<=h);break}}}finally{Ce=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?be(a):""}function Oe(e,n){switch(e.tag){case 26:case 27:case 5:return be(e.type);case 16:return be("Lazy");case 13:return e.child!==n&&n!==null?be("Suspense Fallback"):be("Suspense");case 19:return be("SuspenseList");case 0:case 15:return ze(e.type,!1);case 11:return ze(e.type.render,!1);case 1:return ze(e.type,!0);case 31:return be("Activity");default:return""}}function Me(e){try{var n="",a=null;do n+=Oe(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 ve=Object.prototype.hasOwnProperty,Oe=t.unstable_scheduleCallback,Je=t.unstable_cancelCallback,jt=t.unstable_shouldYield,$t=t.unstable_requestPaint,yt=t.unstable_now,Xt=t.unstable_getCurrentPriorityLevel,ae=t.unstable_ImmediatePriority,me=t.unstable_UserBlockingPriority,Fe=t.unstable_NormalPriority,Ye=t.unstable_LowPriority,xe=t.unstable_IdlePriority,q=t.log,Te=t.unstable_setDisableYieldValue,$e=null,Ke=null;function mt(e){if(typeof q=="function"&&Te(e),Ke&&typeof Ke.setStrictMode=="function")try{Ke.setStrictMode($e,e)}catch{}}var Qe=Math.clz32?Math.clz32:Nt,It=Math.log,an=Math.LN2;function Nt(e){return e>>>=0,e===0?32:31-(It(e)/an|0)|0}var ar=256,dl=262144,ir=4194304;function Fn(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 En(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=Fn(o):(w&=N,w!==0?h=Fn(w):a||(a=N&~e,a!==0&&(h=Fn(a))))):(N=o&~p,N!==0?h=Fn(N):w!==0?h=Fn(w):a||(a=o&~e,a!==0&&(h=Fn(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 sn(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function we(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 Wt(){var e=ir;return ir<<=1,(ir&62914560)===0&&(ir=4194304),e}function Sa(e){for(var n=[],a=0;31>a;a++)n.push(e);return n}function fl(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ys(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,H=e.expirationTimes,ee=e.hiddenUpdates;for(a=w&~a;0<a;){var se=31-Qe(a),de=1<<se;N[se]=0,H[se]=-1;var te=ee[se];if(te!==null)for(ee[se]=null,se=0;se<te.length;se++){var le=te[se];le!==null&&(le.lane&=-536870913)}a&=~de}o!==0&&Ca(e,o,0),p!==0&&h===0&&e.tag!==0&&(e.suspendedLanes|=p&~(w&~n))}function Ca(e,n,a){e.pendingLanes|=n,e.suspendedLanes&=~n;var o=31-Qe(n);e.entangledLanes|=n,e.entanglements[o]=e.entanglements[o]|1073741824|a&261930}function Un(e,n){var a=e.entangledLanes|=n;for(e=e.entanglements;a;){var o=31-Qe(a),h=1<<o;h&n|e[o]&n&&(e[o]|=n),a&=~h}}function qs(e,n){var a=n&-n;return a=(a&42)!==0?1:bl(a),(a&(e.suspendedLanes|n))!==0?0:a}function bl(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 Gr(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Rl(){var e=P.p;return e!==0?e:(e=window.event,e===void 0?32:Pp(e.type))}function _l(e,n){var a=P.p;try{return P.p=e,n()}finally{P.p=a}}var Nn=Math.random().toString(36).slice(2),Pt="__reactFiber$"+Nn,Qt="__reactProps$"+Nn,Ol="__reactContainer$"+Nn,Ea="__reactEvents$"+Nn,ki="__reactListeners$"+Nn,Xs="__reactHandles$"+Nn,ji="__reactResources$"+Nn,In="__reactMarker$"+Nn;function Kr(e){delete e[Pt],delete e[Qt],delete e[Ea],delete e[ki],delete e[Xs]}function Bl(e){var n=e[Pt];if(n)return n;for(var a=e.parentNode;a;){if(n=a[Ol]||a[Pt]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(e=Bp(e);e!==null;){if(a=e[Pt])return a;e=Bp(e)}return n}e=a,a=e.parentNode}return null}function Ll(e){if(e=e[Pt]||e[Ol]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function Wr(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(i(33))}function vl(e){var n=e[ji];return n||(n=e[ji]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function St(e){e[In]=!0}var wl=new Set,sr={};function $l(e,n){Yn(e,n),Yn(e+"Capture",n)}function Yn(e,n){for(sr[e]=n,e=0;e<n.length;e++)wl.add(n[e])}var xn=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]*$"),Qr={},qn={};function Zr(e){return ve.call(qn,e)?!0:ve.call(Qr,e)?!1:xn.test(e)?qn[e]=!0:(Qr[e]=!0,!1)}function or(e,n,a){if(Zr(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 Na(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 An(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 fn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Vs(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Ht(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 Aa(e){if(!e._valueTracker){var n=Vs(e)?"checked":"value";e._valueTracker=Ht(e,n,""+e[n])}}function Gs(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var a=n.getValue(),o="";return e&&(o=Vs(e)?e.checked?"true":"false":e.value),e=o,e!==a?(n.setValue(e),!0):!1}function Da(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 Si=/[\n"\\]/g;function wn(e){return e.replace(Si,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function Ci(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=""+fn(n)):e.value!==""+fn(n)&&(e.value=""+fn(n)):w!=="submit"&&w!=="reset"||e.removeAttribute("value"),n!=null?Ta(e,w,fn(n)):a!=null?Ta(e,w,fn(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=""+fn(N):e.removeAttribute("name")}function Ks(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)){Aa(e);return}a=a!=null?""+fn(a):"",n=n!=null?""+fn(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),Aa(e)}function Ta(e,n,a){n==="number"&&Da(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function cr(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=""+fn(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 Ws(e,n,a){if(n!=null&&(n=""+fn(n),n!==e.value&&(e.value=n),a==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=a!=null?""+fn(a):""}function Qs(e,n,a,o){if(n==null){if(o!=null){if(a!=null)throw Error(i(92));if(W(o)){if(1<o.length)throw Error(i(93));o=o[0]}a=o}a==null&&(a=""),n=a}a=fn(n),e.defaultValue=a,o=e.textContent,o===a&&o!==""&&o!==null&&(e.value=o),Aa(e)}function ur(e,n){if(n){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=n;return}}e.textContent=n}var Xc=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 Zs(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||Xc.has(n)?n==="float"?e.cssFloat=a:e[n]=(""+a).trim():e[n]=a+"px"}function Js(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&&Zs(e,h,o)}else for(var p in n)n.hasOwnProperty(p)&&Zs(e,p,n[p])}function tl(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 Ei=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"]]),Vc=/^[\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 za(e){return Vc.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function hn(){}var Ma=null;function Ni(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var dr=null,Yt=null;function fr(e){var n=Ll(e);if(n&&(e=n.stateNode)){var a=e[Qt]||null;e:switch(e=n.stateNode,n.type){case"input":if(Ci(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="'+wn(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var o=a[n];if(o!==e&&o.form===e.form){var h=o[Qt]||null;if(!h)throw Error(i(90));Ci(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&&Gs(o)}break e;case"textarea":Ws(e,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&cr(e,!!a.multiple,n,!1)}}}var Fa=!1;function Ai(e,n,a){if(Fa)return e(n,a);Fa=!0;try{var o=e(n);return o}finally{if(Fa=!1,(dr!==null||Yt!==null)&&(Bo(),dr&&(n=dr,e=Yt,Yt=dr=null,fr(n),e)))for(n=0;n<e.length;n++)fr(e[n])}}function hr(e,n){var a=e.stateNode;if(a===null)return null;var o=a[Qt]||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 R=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ie=!1;if(R)try{var ce={};Object.defineProperty(ce,"passive",{get:function(){ie=!0}}),window.addEventListener("test",ce,ce),window.removeEventListener("test",ce,ce)}catch{ie=!1}var pe=null,Se=null,et=null;function Ze(){if(et)return et;var e,n=Se,a=n.length,o,h="value"in pe?pe.value:pe.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 et=h.slice(e,1<o?1-o:void 0)}function Ge(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 rt(){return!0}function at(){return!1}function Ue(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)?rt:at,this.isPropagationStopped=at,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=rt)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=rt)},persist:function(){},isPersistent:rt}),n}var Jr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ps=Ue(Jr),Di=y({},Jr,{view:0,detail:0}),Og=Ue(Di),Gc,Kc,Ti,eo=y({},Di,{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!==Ti&&(Ti&&e.type==="mousemove"?(Gc=e.screenX-Ti.screenX,Kc=e.screenY-Ti.screenY):Kc=Gc=0,Ti=e),Gc)},movementY:function(e){return"movementY"in e?e.movementY:Kc}}),Mh=Ue(eo),Bg=y({},eo,{dataTransfer:0}),Lg=Ue(Bg),$g=y({},Di,{relatedTarget:0}),Wc=Ue($g),Hg=y({},Jr,{animationName:0,elapsedTime:0,pseudoElement:0}),Ug=Ue(Hg),Ig=y({},Jr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Yg=Ue(Ig),qg=y({},Jr,{data:0}),Fh=Ue(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 Wg=y({},Di,{key:function(e){if(e.key){var n=Xg[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=Ge(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"?Ge(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ge(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Qg=Ue(Wg),Zg=y({},eo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Rh=Ue(Zg),Jg=y({},Di,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Qc}),Pg=Ue(Jg),eb=y({},Jr,{propertyName:0,elapsedTime:0,pseudoElement:0}),tb=Ue(eb),nb=y({},eo,{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=Ue(nb),rb=y({},Jr,{newState:0,oldState:0}),ab=Ue(rb),ib=[9,13,27,32],Zc=R&&"CompositionEvent"in window,zi=null;R&&"documentMode"in document&&(zi=document.documentMode);var sb=R&&"TextEvent"in window&&!zi,_h=R&&(!Zc||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 Ra=!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(Ra)return e==="compositionend"||!Zc&&Lh(e,n)?(e=Ze(),et=Se=pe=null,Ra=!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){dr?Yt?Yt.push(o):Yt=[o]:dr=o,n=qo(n,"onChange"),0<n.length&&(a=new Ps("onChange","change",null,a,o),e.push({event:a,listeners:n}))}var Mi=null,Fi=null;function db(e){jp(e,0)}function to(e){var n=Wr(e);if(Gs(n))return e}function Ih(e,n){if(e==="change")return n}var Yh=!1;if(R){var Jc;if(R){var Pc="oninput"in document;if(!Pc){var qh=document.createElement("div");qh.setAttribute("oninput","return;"),Pc=typeof qh.oninput=="function"}Jc=Pc}else Jc=!1;Yh=Jc&&(!document.documentMode||9<document.documentMode)}function Xh(){Mi&&(Mi.detachEvent("onpropertychange",Vh),Fi=Mi=null)}function Vh(e){if(e.propertyName==="value"&&to(Fi)){var n=[];Uh(n,Fi,e,Ni(e)),Ai(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 to(Fi)}function mb(e,n){if(e==="click")return to(n)}function xb(e,n){if(e==="input"||e==="change")return to(n)}function pb(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var Xn=typeof Object.is=="function"?Object.is:pb;function Ri(e,n){if(Xn(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(!ve.call(n,h)||!Xn(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 Wh(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Wh(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Qh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=Da(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=Da(e.document)}return n}function eu(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=R&&"documentMode"in document&&11>=document.documentMode,_a=null,tu=null,_i=null,nu=!1;function Zh(e,n,a){var o=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;nu||_a==null||_a!==Da(o)||(o=_a,"selectionStart"in o&&eu(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=qo(tu,"onSelect"),0<o.length&&(n=new Ps("onSelect","select",null,n,a),e.push({event:n,listeners:o}),n.target=_a)))}function Pr(e,n){var a={};return a[e.toLowerCase()]=n.toLowerCase(),a["Webkit"+e]="webkit"+n,a["Moz"+e]="moz"+n,a}var Oa={animationend:Pr("Animation","AnimationEnd"),animationiteration:Pr("Animation","AnimationIteration"),animationstart:Pr("Animation","AnimationStart"),transitionrun:Pr("Transition","TransitionRun"),transitionstart:Pr("Transition","TransitionStart"),transitioncancel:Pr("Transition","TransitionCancel"),transitionend:Pr("Transition","TransitionEnd")},lu={},Jh={};R&&(Jh=document.createElement("div").style,"AnimationEvent"in window||(delete Oa.animationend.animation,delete Oa.animationiteration.animation,delete Oa.animationstart.animation),"TransitionEvent"in window||delete Oa.transitionend.transition);function ea(e){if(lu[e])return lu[e];if(!Oa[e])return e;var n=Oa[e],a;for(a in n)if(n.hasOwnProperty(a)&&a in Jh)return lu[e]=n[a];return e}var Ph=ea("animationend"),em=ea("animationiteration"),tm=ea("animationstart"),gb=ea("transitionrun"),bb=ea("transitionstart"),vb=ea("transitioncancel"),nm=ea("transitionend"),lm=new Map,ru="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(" ");ru.push("scrollEnd");function hl(e,n){lm.set(e,n),$l(n,[e])}var no=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)},nl=[],Ba=0,au=0;function lo(){for(var e=Ba,n=au=Ba=0;n<e;){var a=nl[n];nl[n++]=null;var o=nl[n];nl[n++]=null;var h=nl[n];nl[n++]=null;var p=nl[n];if(nl[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 ro(e,n,a,o){nl[Ba++]=e,nl[Ba++]=n,nl[Ba++]=a,nl[Ba++]=o,au|=o,e.lanes|=o,e=e.alternate,e!==null&&(e.lanes|=o)}function iu(e,n,a,o){return ro(e,n,a,o),ao(e)}function ta(e,n){return ro(e,null,null,n),ao(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-Qe(a),e=p.hiddenUpdates,o=e[h],o===null?e[h]=[n]:o.push(n),n.lane=a|536870912),p):null}function ao(e){if(50<ls)throw ls=0,xd=null,Error(i(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var La={};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 Vn(e,n,a,o){return new wb(e,n,a,o)}function su(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Hl(e,n){var a=e.alternate;return a===null?(a=Vn(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 io(e,n,a,o,h,p){var w=0;if(o=e,typeof e=="function")su(e)&&(w=1);else if(typeof e=="string")w=E2(e,a,ue.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Y:return e=Vn(31,a,n,h),e.elementType=Y,e.lanes=p,e;case j:return na(a.children,h,p,n);case E:w=8,h|=24;break;case C:return e=Vn(12,a,n,h|2),e.elementType=C,e.lanes=p,e;case $:return e=Vn(13,a,n,h),e.elementType=$,e.lanes=p,e;case _:return e=Vn(19,a,n,h),e.elementType=_,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 B:w=11;break e;case V:w=14;break e;case K:w=16,o=null;break e}w=29,a=Error(i(130,e===null?"null":typeof e,"")),o=null}return n=Vn(w,a,n,h),n.elementType=e,n.type=o,n.lanes=p,n}function na(e,n,a,o){return e=Vn(7,e,o,n),e.lanes=a,e}function ou(e,n,a){return e=Vn(6,e,null,n),e.lanes=a,e}function im(e){var n=Vn(18,null,null,0);return n.stateNode=e,n}function cu(e,n,a){return n=Vn(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 ll(e,n){if(typeof e=="object"&&e!==null){var a=sm.get(e);return a!==void 0?a:(n={value:e,source:n,stack:Me(n)},sm.set(e,n),n)}return{value:e,source:n,stack:Me(n)}}var $a=[],Ha=0,so=null,Oi=0,rl=[],al=0,mr=null,kl=1,jl="";function Ul(e,n){$a[Ha++]=Oi,$a[Ha++]=so,so=e,Oi=n}function om(e,n,a){rl[al++]=kl,rl[al++]=jl,rl[al++]=mr,mr=e;var o=kl;e=jl;var h=32-Qe(o)-1;o&=~(1<<h),a+=1;var p=32-Qe(n)+h;if(30<p){var w=h-h%5;p=(o&(1<<w)-1).toString(32),o>>=w,h-=w,kl=1<<32-Qe(n)+h|a<<h|o,jl=p+e}else kl=1<<p|a<<h|o,jl=e}function uu(e){e.return!==null&&(Ul(e,1),om(e,1,0))}function du(e){for(;e===so;)so=$a[--Ha],$a[Ha]=null,Oi=$a[--Ha],$a[Ha]=null;for(;e===mr;)mr=rl[--al],rl[al]=null,jl=rl[--al],rl[al]=null,kl=rl[--al],rl[al]=null}function cm(e,n){rl[al++]=kl,rl[al++]=jl,rl[al++]=mr,kl=n.id,jl=n.overflow,mr=e}var pn=null,Ot=null,xt=!1,xr=null,il=!1,fu=Error(i(519));function pr(e){var n=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Bi(ll(n,e)),fu}function um(e){var n=e.stateNode,a=e.type,o=e.memoizedProps;switch(n[Pt]=e,n[Qt]=o,a){case"dialog":ct("cancel",n),ct("close",n);break;case"iframe":case"object":case"embed":ct("load",n);break;case"video":case"audio":for(a=0;a<as.length;a++)ct(as[a],n);break;case"source":ct("error",n);break;case"img":case"image":case"link":ct("error",n),ct("load",n);break;case"details":ct("toggle",n);break;case"input":ct("invalid",n),Ks(n,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":ct("invalid",n);break;case"textarea":ct("invalid",n),Qs(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&&(ct("beforetoggle",n),ct("toggle",n)),o.onScroll!=null&&ct("scroll",n),o.onScrollEnd!=null&&ct("scrollend",n),o.onClick!=null&&(n.onclick=hn),n=!0):n=!1,n||pr(e,!0)}function dm(e){for(pn=e.return;pn;)switch(pn.tag){case 5:case 31:case 13:il=!1;return;case 27:case 3:il=!0;return;default:pn=pn.return}}function Ua(e){if(e!==pn)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&&Ot&&pr(e),dm(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));Ot=Op(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));Ot=Op(e)}else n===27?(n=Ot,Tr(e.type)?(e=_d,_d=null,Ot=e):Ot=n):Ot=pn?ol(e.stateNode.nextSibling):null;return!0}function la(){Ot=pn=null,xt=!1}function hu(){var e=xr;return e!==null&&(Bn===null?Bn=e:Bn.push.apply(Bn,e),xr=null),e}function Bi(e){xr===null?xr=[e]:xr.push(e)}var mu=z(null),ra=null,Il=null;function yr(e,n,a){D(mu,n._currentValue),n._currentValue=a}function Yl(e){e._currentValue=mu.current,G(mu)}function xu(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 pu(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 H=0;H<n.length;H++)if(N.context===n[H]){p.lanes|=a,N=p.alternate,N!==null&&(N.lanes|=a),xu(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),xu(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 Ia(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;Xn(h.pendingProps.value,w.value)||(e!==null?e.push(N):e=[N])}}else if(h===Ae.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&&pu(n,e,a,o),n.flags|=262144}function oo(e){for(e=e.firstContext;e!==null;){if(!Xn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function aa(e){ra=e,Il=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function yn(e){return fm(ra,e)}function co(e,n){return ra===null&&aa(e),fm(e,n)}function fm(e,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},Il===null){if(e===null)throw Error(i(308));Il=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else Il=Il.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 yu(){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,gu=0,Ya=0,qa=null;function Cb(e,n){if($i===null){var a=$i=[];gu=0,Ya=wd(),qa={status:"pending",value:void 0,then:function(o){a.push(o)}}}return gu++,n.then(hm,hm),n}function hm(){if(--gu===0&&$i!==null){qa!==null&&(qa.status="fulfilled");var e=$i;$i=null,Ya=0,qa=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=I.S;I.S=function(e,n){Zx=yt(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&Cb(e,n),mm!==null&&mm(e,n)};var ia=z(null);function bu(){var e=ia.current;return e!==null?e:Mt.pooledCache}function uo(e,n){n===null?D(ia,ia.current):D(ia,n.pool)}function xm(){var e=bu();return e===null?null:{parent:en._currentValue,pool:e}}var Xa=Error(i(460)),vu=Error(i(474)),fo=Error(i(542)),ho={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(hn,hn),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(hn,hn);else{if(e=Mt,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 oa=n,Xa}}function sa(e){try{var n=e._init;return n(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(oa=a,Xa):a}}var oa=null;function gm(){if(oa===null)throw Error(i(459));var e=oa;return oa=null,e}function bm(e){if(e===Xa||e===fo)throw Error(i(483))}var Va=null,Hi=0;function mo(e){var n=Hi;return Hi+=1,Va===null&&(Va=[]),ym(Va,e,n)}function Ui(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function xo(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=Hl(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=ou(J,Q.mode,oe),X.return=Q,X):(X=h(X,J),X.return=Q,X)}function H(Q,X,J,oe){var Ie=J.type;return Ie===j?se(Q,X,J.props.children,oe,J.key):X!==null&&(X.elementType===Ie||typeof Ie=="object"&&Ie!==null&&Ie.$$typeof===K&&sa(Ie)===X.type)?(X=h(X,J.props),Ui(X,J),X.return=Q,X):(X=io(J.type,J.key,J.props,null,Q.mode,oe),Ui(X,J),X.return=Q,X)}function ee(Q,X,J,oe){return X===null||X.tag!==4||X.stateNode.containerInfo!==J.containerInfo||X.stateNode.implementation!==J.implementation?(X=cu(J,Q.mode,oe),X.return=Q,X):(X=h(X,J.children||[]),X.return=Q,X)}function se(Q,X,J,oe,Ie){return X===null||X.tag!==7?(X=na(J,Q.mode,oe,Ie),X.return=Q,X):(X=h(X,J),X.return=Q,X)}function de(Q,X,J){if(typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint")return X=ou(""+X,Q.mode,J),X.return=Q,X;if(typeof X=="object"&&X!==null){switch(X.$$typeof){case v:return J=io(X.type,X.key,X.props,null,Q.mode,J),Ui(J,X),J.return=Q,J;case S:return X=cu(X,Q.mode,J),X.return=Q,X;case K:return X=sa(X),de(Q,X,J)}if(W(X)||O(X))return X=na(X,Q.mode,J,null),X.return=Q,X;if(typeof X.then=="function")return de(Q,mo(X),J);if(X.$$typeof===F)return de(Q,co(Q,X),J);xo(Q,X)}return null}function te(Q,X,J,oe){var Ie=X!==null?X.key:null;if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return Ie!==null?null:N(Q,X,""+J,oe);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case v:return J.key===Ie?H(Q,X,J,oe):null;case S:return J.key===Ie?ee(Q,X,J,oe):null;case K:return J=sa(J),te(Q,X,J,oe)}if(W(J)||O(J))return Ie!==null?null:se(Q,X,J,oe,null);if(typeof J.then=="function")return te(Q,X,mo(J),oe);if(J.$$typeof===F)return te(Q,X,co(Q,J),oe);xo(Q,J)}return null}function le(Q,X,J,oe,Ie){if(typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint")return Q=Q.get(J)||null,N(X,Q,""+oe,Ie);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case v:return Q=Q.get(oe.key===null?J:oe.key)||null,H(X,Q,oe,Ie);case S:return Q=Q.get(oe.key===null?J:oe.key)||null,ee(X,Q,oe,Ie);case K:return oe=sa(oe),le(Q,X,J,oe,Ie)}if(W(oe)||O(oe))return Q=Q.get(J)||null,se(X,Q,oe,Ie,null);if(typeof oe.then=="function")return le(Q,X,J,mo(oe),Ie);if(oe.$$typeof===F)return le(Q,X,J,co(X,oe),Ie);xo(X,oe)}return null}function Re(Q,X,J,oe){for(var Ie=null,gt=null,Be=X,nt=X=0,ft=null;Be!==null&&nt<J.length;nt++){Be.index>nt?(ft=Be,Be=null):ft=Be.sibling;var bt=te(Q,Be,J[nt],oe);if(bt===null){Be===null&&(Be=ft);break}e&&Be&&bt.alternate===null&&n(Q,Be),X=p(bt,X,nt),gt===null?Ie=bt:gt.sibling=bt,gt=bt,Be=ft}if(nt===J.length)return a(Q,Be),xt&&Ul(Q,nt),Ie;if(Be===null){for(;nt<J.length;nt++)Be=de(Q,J[nt],oe),Be!==null&&(X=p(Be,X,nt),gt===null?Ie=Be:gt.sibling=Be,gt=Be);return xt&&Ul(Q,nt),Ie}for(Be=o(Be);nt<J.length;nt++)ft=le(Be,Q,nt,J[nt],oe),ft!==null&&(e&&ft.alternate!==null&&Be.delete(ft.key===null?nt:ft.key),X=p(ft,X,nt),gt===null?Ie=ft:gt.sibling=ft,gt=ft);return e&&Be.forEach(function(_r){return n(Q,_r)}),xt&&Ul(Q,nt),Ie}function Xe(Q,X,J,oe){if(J==null)throw Error(i(151));for(var Ie=null,gt=null,Be=X,nt=X=0,ft=null,bt=J.next();Be!==null&&!bt.done;nt++,bt=J.next()){Be.index>nt?(ft=Be,Be=null):ft=Be.sibling;var _r=te(Q,Be,bt.value,oe);if(_r===null){Be===null&&(Be=ft);break}e&&Be&&_r.alternate===null&&n(Q,Be),X=p(_r,X,nt),gt===null?Ie=_r:gt.sibling=_r,gt=_r,Be=ft}if(bt.done)return a(Q,Be),xt&&Ul(Q,nt),Ie;if(Be===null){for(;!bt.done;nt++,bt=J.next())bt=de(Q,bt.value,oe),bt!==null&&(X=p(bt,X,nt),gt===null?Ie=bt:gt.sibling=bt,gt=bt);return xt&&Ul(Q,nt),Ie}for(Be=o(Be);!bt.done;nt++,bt=J.next())bt=le(Be,Q,nt,bt.value,oe),bt!==null&&(e&&bt.alternate!==null&&Be.delete(bt.key===null?nt:bt.key),X=p(bt,X,nt),gt===null?Ie=bt:gt.sibling=bt,gt=bt);return e&&Be.forEach(function(B2){return n(Q,B2)}),xt&&Ul(Q,nt),Ie}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 Ie=J.key;X!==null;){if(X.key===Ie){if(Ie=J.type,Ie===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===Ie||typeof Ie=="object"&&Ie!==null&&Ie.$$typeof===K&&sa(Ie)===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=na(J.props.children,Q.mode,oe,J.key),oe.return=Q,Q=oe):(oe=io(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(Ie=J.key;X!==null;){if(X.key===Ie)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=cu(J,Q.mode,oe),oe.return=Q,Q=oe}return w(Q);case K:return J=sa(J),Tt(Q,X,J,oe)}if(W(J))return Re(Q,X,J,oe);if(O(J)){if(Ie=O(J),typeof Ie!="function")throw Error(i(150));return J=Ie.call(J),Xe(Q,X,J,oe)}if(typeof J.then=="function")return Tt(Q,X,mo(J),oe);if(J.$$typeof===F)return Tt(Q,X,co(Q,J),oe);xo(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=ou(J,Q.mode,oe),oe.return=Q,Q=oe),w(Q)):a(Q,X)}return function(Q,X,J,oe){try{Hi=0;var Ie=Tt(Q,X,J,oe);return Va=null,Ie}catch(Be){if(Be===Xa||Be===fo)throw Be;var gt=Vn(29,Be,null,Q.mode);return gt.lanes=oe,gt.return=Q,gt}finally{}}}var ca=vm(!0),wm=vm(!1),gr=!1;function wu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ku(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 br(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function vr(e,n,a){var o=e.updateQueue;if(o===null)return null;if(o=o.shared,(wt&2)!==0){var h=o.pending;return h===null?n.next=n:(n.next=h.next,h.next=n),o.pending=n,n=ao(e),rm(e,null,a),n}return ro(e,o,n,a),ao(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,Un(e,a)}}function ju(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 Su=!1;function Yi(){if(Su){var e=qa;if(e!==null)throw e}}function qi(e,n,a,o){Su=!1;var h=e.updateQueue;gr=!1;var p=h.firstBaseUpdate,w=h.lastBaseUpdate,N=h.shared.pending;if(N!==null){h.shared.pending=null;var H=N,ee=H.next;H.next=null,w===null?p=ee:w.next=ee,w=H;var se=e.alternate;se!==null&&(se=se.updateQueue,N=se.lastBaseUpdate,N!==w&&(N===null?se.firstBaseUpdate=ee:N.next=ee,se.lastBaseUpdate=H))}if(p!==null){var de=h.baseState;w=0,se=ee=H=null,N=p;do{var te=N.lane&-536870913,le=te!==N.lane;if(le?(dt&te)===te:(o&te)===te){te!==0&&te===Ya&&(Su=!0),se!==null&&(se=se.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var Re=e,Xe=N;te=n;var Tt=a;switch(Xe.tag){case 1:if(Re=Xe.payload,typeof Re=="function"){de=Re.call(Tt,de,te);break e}de=Re;break e;case 3:Re.flags=Re.flags&-65537|128;case 0:if(Re=Xe.payload,te=typeof Re=="function"?Re.call(Tt,de,te):Re,te==null)break e;de=y({},de,te);break e;case 2:gr=!0}}te=N.callback,te!==null&&(e.flags|=64,le&&(e.flags|=8192),le=h.callbacks,le===null?h.callbacks=[te]:le.push(te))}else le={lane:te,tag:N.tag,payload:N.payload,callback:N.callback,next:null},se===null?(ee=se=le,H=de):se=se.next=le,w|=te;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);se===null&&(H=de),h.baseState=H,h.firstBaseUpdate=ee,h.lastBaseUpdate=se,p===null&&(h.shared.lanes=0),Cr|=w,e.lanes=w,e.memoizedState=de}}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 Ga=z(null),po=z(0);function Sm(e,n){e=Jl,D(po,e),D(Ga,n),Jl=e|n.baseLanes}function Cu(){D(po,Jl),D(Ga,Ga.current)}function Eu(){Jl=po.current,G(Ga),G(po)}var Gn=z(null),sl=null;function wr(e){var n=e.alternate;D(Zt,Zt.current&1),D(Gn,e),sl===null&&(n===null||Ga.current!==null||n.memoizedState!==null)&&(sl=e)}function Nu(e){D(Zt,Zt.current),D(Gn,e),sl===null&&(sl=e)}function Cm(e){e.tag===22?(D(Zt,Zt.current),D(Gn,e),sl===null&&(sl=e)):kr()}function kr(){D(Zt,Zt.current),D(Gn,Gn.current)}function Kn(e){G(Gn),sl===e&&(sl=null),G(Zt)}var Zt=z(0);function yo(e){for(var n=e;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Fd(a)||Rd(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,tt=null,At=null,tn=null,go=!1,Ka=!1,ua=!1,bo=0,Xi=0,Wa=null,Nb=0;function Vt(){throw Error(i(321))}function Au(e,n){if(n===null)return!1;for(var a=0;a<n.length&&a<e.length;a++)if(!Xn(e[a],n[a]))return!1;return!0}function Du(e,n,a,o,h,p){return ql=p,tt=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,I.H=e===null||e.memoizedState===null?ox:qu,ua=!1,p=a(o,h),ua=!1,Ka&&(p=Nm(n,a,o,h)),Em(e),p}function Em(e){I.H=Ki;var n=At!==null&&At.next!==null;if(ql=0,tn=At=tt=null,go=!1,Xi=0,Wa=null,n)throw Error(i(300));e===null||nn||(e=e.dependencies,e!==null&&oo(e)&&(nn=!0))}function Nm(e,n,a,o){tt=e;var h=0;do{if(Ka&&(Wa=null),Xi=0,Ka=!1,25<=h)throw Error(i(301));if(h+=1,tn=At=null,e.updateQueue!=null){var p=e.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}I.H=cx,p=n(a,o)}while(Ka);return p}function Ab(){var e=I.H,n=e.useState()[0];return n=typeof n.then=="function"?Vi(n):n,e=e.useState()[0],(At!==null?At.memoizedState:null)!==e&&(tt.flags|=1024),n}function Tu(){var e=bo!==0;return bo=0,e}function zu(e,n,a){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~a}function Mu(e){if(go){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}go=!1}ql=0,tn=At=tt=null,Ka=!1,Xi=bo=0,Wa=null}function Dn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return tn===null?tt.memoizedState=tn=e:tn=tn.next=e,tn}function Jt(){if(At===null){var e=tt.alternate;e=e!==null?e.memoizedState:null}else e=At.next;var n=tn===null?tt.memoizedState:tn.next;if(n!==null)tn=n,At=e;else{if(e===null)throw tt.alternate===null?Error(i(467)):Error(i(310));At=e,e={memoizedState:At.memoizedState,baseState:At.baseState,baseQueue:At.baseQueue,queue:At.queue,next:null},tn===null?tt.memoizedState=tn=e:tn=tn.next=e}return tn}function vo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Vi(e){var n=Xi;return Xi+=1,Wa===null&&(Wa=[]),e=ym(Wa,e,n),n=tt,(tn===null?n.memoizedState:tn.next)===null&&(n=n.alternate,I.H=n===null||n.memoizedState===null?ox:qu),e}function wo(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Vi(e);if(e.$$typeof===F)return yn(e)}throw Error(i(438,String(e)))}function Fu(e){var n=null,a=tt.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var o=tt.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=vo(),tt.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]=T;return n.index++,a}function Xl(e,n){return typeof n=="function"?n(e):n}function ko(e){var n=Jt();return Ru(n,At,e)}function Ru(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,H=null,ee=n,se=!1;do{var de=ee.lane&-536870913;if(de!==ee.lane?(dt&de)===de:(ql&de)===de){var te=ee.revertLane;if(te===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null}),de===Ya&&(se=!0);else if((ql&te)===te){ee=ee.next,te===Ya&&(se=!0);continue}else de={lane:0,revertLane:ee.revertLane,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},H===null?(N=H=de,w=p):H=H.next=de,tt.lanes|=te,Cr|=te;de=ee.action,ua&&a(p,de),p=ee.hasEagerState?ee.eagerState:a(p,de)}else te={lane:de,revertLane:ee.revertLane,gesture:ee.gesture,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},H===null?(N=H=te,w=p):H=H.next=te,tt.lanes|=de,Cr|=de;ee=ee.next}while(ee!==null&&ee!==n);if(H===null?w=p:H.next=N,!Xn(p,e.memoizedState)&&(nn=!0,se&&(a=qa,a!==null)))throw a;e.memoizedState=p,e.baseState=w,e.baseQueue=H,o.lastRenderedState=p}return h===null&&(o.lanes=0),[e.memoizedState,o.dispatch]}function _u(e){var n=Jt(),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);Xn(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=tt,h=Jt(),p=xt;if(p){if(a===void 0)throw Error(i(407));a=a()}else a=n();var w=!Xn((At||h).memoizedState,a);if(w&&(h.memoizedState=a,nn=!0),h=h.queue,Lu(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},Tm.bind(null,o,h,a,n),null),Mt===null)throw Error(i(349));p||(ql&127)!==0||Dm(o,n,a)}return a}function Dm(e,n,a){e.flags|=16384,e={getSnapshot:n,value:a},n=tt.updateQueue,n===null?(n=vo(),tt.updateQueue=n,n.stores=[e]):(a=n.stores,a===null?n.stores=[e]:a.push(e))}function Tm(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!Xn(e,a)}catch{return!0}}function Fm(e){var n=ta(e,2);n!==null&&Ln(n,e,2)}function Ou(e){var n=Dn();if(typeof e=="function"){var a=e;if(e=a(),ua){mt(!0);try{a()}finally{mt(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xl,lastRenderedState:e},n}function Rm(e,n,a,o){return e.baseState=a,Ru(e,At,typeof o=="function"?o:Xl)}function Db(e,n,a,o,h){if(Co(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)}};I.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=I.T,w={};I.T=w;try{var N=a(h,o),H=I.S;H!==null&&H(w,N),Om(e,n,N)}catch(ee){Bu(e,n,ee)}finally{p!==null&&w.types!==null&&(p.types=w.types),I.T=p}}else try{p=a(h,o),Om(e,n,p)}catch(ee){Bu(e,n,ee)}}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 Bu(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 Bu(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=Mt.formState;if(a!==null){e:{var o=tt;if(xt){if(Ot){t:{for(var h=Ot,p=il;h.nodeType!==8;){if(!p){h=null;break t}if(h=ol(h.nextSibling),h===null){h=null;break t}}p=h.data,h=p==="F!"||p==="F"?h:null}if(h){Ot=ol(h.nextSibling),o=h.data==="F!";break e}}pr(o)}o=!1}o&&(n=a[0])}}return a=Dn(),a.memoizedState=a.baseState=n,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:$m,lastRenderedState:n},a.queue=o,a=ax.bind(null,tt,o),o.dispatch=a,o=Ou(!1),p=Yu.bind(null,tt,!1,o.queue),o=Dn(),h={state:n,dispatch:null,action:e,pending:null},o.queue=h,a=Db.bind(null,tt,h,p,a),h.dispatch=a,o.memoizedState=e,[n,a,!1]}function Um(e){var n=Jt();return Im(n,At,e)}function Im(e,n,a){if(n=Ru(e,n,$m)[0],e=ko(Xl)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var o=Vi(n)}catch(w){throw w===Xa?fo:w}else o=n;n=Jt();var h=n.queue,p=h.dispatch;return a!==n.memoizedState&&(tt.flags|=2048,Qa(9,{destroy:void 0},Tb.bind(null,h,a),null)),[o,p,e]}function Tb(e,n){e.action=n}function Ym(e){var n=Jt(),a=At;if(a!==null)return Im(n,a,e);Jt(),n=n.memoizedState,a=Jt();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=tt.updateQueue,n===null&&(n=vo(),tt.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 Jt().memoizedState}function jo(e,n,a,o){var h=Dn();tt.flags|=e,h.memoizedState=Qa(1|n,{destroy:void 0},a,o===void 0?null:o)}function So(e,n,a,o){var h=Jt();o=o===void 0?null:o;var p=h.memoizedState.inst;At!==null&&o!==null&&Au(o,At.memoizedState.deps)?h.memoizedState=Qa(n,p,a,o):(tt.flags|=e,h.memoizedState=Qa(1|n,p,a,o))}function Xm(e,n){jo(8390656,8,e,n)}function Lu(e,n){So(2048,8,e,n)}function zb(e){tt.flags|=4;var n=tt.updateQueue;if(n===null)n=vo(),tt.updateQueue=n,n.events=[e];else{var a=n.events;a===null?n.events=[e]:a.push(e)}}function Vm(e){var n=Jt().memoizedState;return zb({ref:n,nextImpl:e}),function(){if((wt&2)!==0)throw Error(i(440));return n.impl.apply(void 0,arguments)}}function Gm(e,n){return So(4,2,e,n)}function Km(e,n){return So(4,4,e,n)}function Wm(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 Qm(e,n,a){a=a!=null?a.concat([e]):null,So(4,4,Wm.bind(null,n,e),a)}function $u(){}function Zm(e,n){var a=Jt();n=n===void 0?null:n;var o=a.memoizedState;return n!==null&&Au(n,o[1])?o[0]:(a.memoizedState=[e,n],e)}function Jm(e,n){var a=Jt();n=n===void 0?null:n;var o=a.memoizedState;if(n!==null&&Au(n,o[1]))return o[0];if(o=e(),ua){mt(!0);try{e()}finally{mt(!1)}}return a.memoizedState=[o,n],o}function Hu(e,n,a){return a===void 0||(ql&1073741824)!==0&&(dt&261930)===0?e.memoizedState=n:(e.memoizedState=a,e=Px(),tt.lanes|=e,Cr|=e,a)}function Pm(e,n,a,o){return Xn(a,n)?a:Ga.current!==null?(e=Hu(e,a,o),Xn(e,n)||(nn=!0),e):(ql&42)===0||(ql&1073741824)!==0&&(dt&261930)===0?(nn=!0,e.memoizedState=a):(e=Px(),tt.lanes|=e,Cr|=e,n)}function ex(e,n,a,o,h){var p=P.p;P.p=p!==0&&8>p?p:8;var w=I.T,N={};I.T=N,Yu(e,!1,n,a);try{var H=h(),ee=I.S;if(ee!==null&&ee(N,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var se=Eb(H,o);Gi(e,n,se,Zn(e))}else Gi(e,n,o,Zn(e))}catch(de){Gi(e,n,{then:function(){},status:"rejected",reason:de},Zn())}finally{P.p=p,w!==null&&N.types!==null&&(w.types=N.types),I.T=w}}function Mb(){}function Uu(e,n,a,o){if(e.tag!==5)throw Error(i(476));var h=tx(e).queue;ex(e,h,n,re,a===null?Mb:function(){return nx(e),a(o)})}function tx(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:re,baseState:re,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xl,lastRenderedState:re},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xl,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,{},Zn())}function Iu(){return yn(us)}function lx(){return Jt().memoizedState}function rx(){return Jt().memoizedState}function Fb(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var a=Zn();e=br(a);var o=vr(n,e,a);o!==null&&(Ln(o,n,a),Ii(o,n,a)),n={cache:yu()},e.payload=n;return}n=n.return}}function Rb(e,n,a){var o=Zn();a={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Co(e)?ix(n,a):(a=iu(e,n,a,o),a!==null&&(Ln(a,e,o),sx(a,n,o)))}function ax(e,n,a){var o=Zn();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(Co(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,Xn(N,w))return ro(e,n,h,0),Mt===null&&lo(),!1}catch{}finally{}if(a=iu(e,n,h,o),a!==null)return Ln(a,e,o),sx(a,n,o),!0}return!1}function Yu(e,n,a,o){if(o={lane:2,revertLane:wd(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Co(e)){if(n)throw Error(i(479))}else n=iu(e,a,o,2),n!==null&&Ln(n,e,2)}function Co(e){var n=e.alternate;return e===tt||n!==null&&n===tt}function ix(e,n){Ka=go=!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,Un(e,a)}}var Ki={readContext:yn,use:wo,useCallback:Vt,useContext:Vt,useEffect:Vt,useImperativeHandle:Vt,useLayoutEffect:Vt,useInsertionEffect:Vt,useMemo:Vt,useReducer:Vt,useRef:Vt,useState:Vt,useDebugValue:Vt,useDeferredValue:Vt,useTransition:Vt,useSyncExternalStore:Vt,useId:Vt,useHostTransitionStatus:Vt,useFormState:Vt,useActionState:Vt,useOptimistic:Vt,useMemoCache:Vt,useCacheRefresh:Vt};Ki.useEffectEvent=Vt;var ox={readContext:yn,use:wo,useCallback:function(e,n){return Dn().memoizedState=[e,n===void 0?null:n],e},useContext:yn,useEffect:Xm,useImperativeHandle:function(e,n,a){a=a!=null?a.concat([e]):null,jo(4194308,4,Wm.bind(null,n,e),a)},useLayoutEffect:function(e,n){return jo(4194308,4,e,n)},useInsertionEffect:function(e,n){jo(4,2,e,n)},useMemo:function(e,n){var a=Dn();n=n===void 0?null:n;var o=e();if(ua){mt(!0);try{e()}finally{mt(!1)}}return a.memoizedState=[o,n],o},useReducer:function(e,n,a){var o=Dn();if(a!==void 0){var h=a(n);if(ua){mt(!0);try{a(n)}finally{mt(!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,tt,e),[o.memoizedState,e]},useRef:function(e){var n=Dn();return e={current:e},n.memoizedState=e},useState:function(e){e=Ou(e);var n=e.queue,a=ax.bind(null,tt,n);return n.dispatch=a,[e.memoizedState,a]},useDebugValue:$u,useDeferredValue:function(e,n){var a=Dn();return Hu(a,e,n)},useTransition:function(){var e=Ou(!1);return e=ex.bind(null,tt,e.queue,!0,!1),Dn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,a){var o=tt,h=Dn();if(xt){if(a===void 0)throw Error(i(407));a=a()}else{if(a=n(),Mt===null)throw Error(i(349));(dt&127)!==0||Dm(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},Tm.bind(null,o,p,a,n),null),a},useId:function(){var e=Dn(),n=Mt.identifierPrefix;if(xt){var a=jl,o=kl;a=(o&~(1<<32-Qe(o)-1)).toString(32)+a,n="_"+n+"R_"+a,a=bo++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=Nb++,n="_"+n+"r_"+a.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:Iu,useFormState:Hm,useActionState:Hm,useOptimistic:function(e){var n=Dn();n.memoizedState=n.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=Yu.bind(null,tt,!0,a),a.dispatch=n,[e,n]},useMemoCache:Fu,useCacheRefresh:function(){return Dn().memoizedState=Fb.bind(null,tt)},useEffectEvent:function(e){var n=Dn(),a={impl:e};return n.memoizedState=a,function(){if((wt&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}},qu={readContext:yn,use:wo,useCallback:Zm,useContext:yn,useEffect:Lu,useImperativeHandle:Qm,useInsertionEffect:Gm,useLayoutEffect:Km,useMemo:Jm,useReducer:ko,useRef:qm,useState:function(){return ko(Xl)},useDebugValue:$u,useDeferredValue:function(e,n){var a=Jt();return Pm(a,At.memoizedState,e,n)},useTransition:function(){var e=ko(Xl)[0],n=Jt().memoizedState;return[typeof e=="boolean"?e:Vi(e),n]},useSyncExternalStore:Am,useId:lx,useHostTransitionStatus:Iu,useFormState:Um,useActionState:Um,useOptimistic:function(e,n){var a=Jt();return Rm(a,At,e,n)},useMemoCache:Fu,useCacheRefresh:rx};qu.useEffectEvent=Vm;var cx={readContext:yn,use:wo,useCallback:Zm,useContext:yn,useEffect:Lu,useImperativeHandle:Qm,useInsertionEffect:Gm,useLayoutEffect:Km,useMemo:Jm,useReducer:_u,useRef:qm,useState:function(){return _u(Xl)},useDebugValue:$u,useDeferredValue:function(e,n){var a=Jt();return At===null?Hu(a,e,n):Pm(a,At.memoizedState,e,n)},useTransition:function(){var e=_u(Xl)[0],n=Jt().memoizedState;return[typeof e=="boolean"?e:Vi(e),n]},useSyncExternalStore:Am,useId:lx,useHostTransitionStatus:Iu,useFormState:Ym,useActionState:Ym,useOptimistic:function(e,n){var a=Jt();return At!==null?Rm(a,At,e,n):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:Fu,useCacheRefresh:rx};cx.useEffectEvent=Vm;function Xu(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 Vu={enqueueSetState:function(e,n,a){e=e._reactInternals;var o=Zn(),h=br(o);h.payload=n,a!=null&&(h.callback=a),n=vr(e,h,o),n!==null&&(Ln(n,e,o),Ii(n,e,o))},enqueueReplaceState:function(e,n,a){e=e._reactInternals;var o=Zn(),h=br(o);h.tag=1,h.payload=n,a!=null&&(h.callback=a),n=vr(e,h,o),n!==null&&(Ln(n,e,o),Ii(n,e,o))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var a=Zn(),o=br(a);o.tag=2,n!=null&&(o.callback=n),n=vr(e,o,a),n!==null&&(Ln(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&&Vu.enqueueReplaceState(n,n.state,null)}function da(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){no(e)}function hx(e){console.error(e)}function mx(e){no(e)}function Eo(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 Gu(e,n,a){return a=br(a),a.tag=3,a.payload={element:null},a.callback=function(){Eo(e,n)},a}function px(e){return e=br(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"&&(Er===null?Er=new Set([this]):Er.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&&Ia(n,a,h,!0),a=Gn.current,a!==null){switch(a.tag){case 31:case 13:return sl===null?Lo():a.alternate===null&&Gt===0&&(Gt=3),a.flags&=-257,a.flags|=65536,a.lanes=h,o===ho?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([o]):n.add(o),gd(e,o,h)),!1;case 22:return a.flags|=65536,o===ho?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)),gd(e,o,h)),!1}throw Error(i(435,a.tag))}return gd(e,o,h),Lo(),!1}if(xt)return n=Gn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=h,o!==fu&&(e=Error(i(422),{cause:o}),Bi(ll(e,a)))):(o!==fu&&(n=Error(i(423),{cause:o}),Bi(ll(n,a))),e=e.current.alternate,e.flags|=65536,h&=-h,e.lanes|=h,o=ll(o,a),h=Gu(e.stateNode,o,h),ju(e,h),Gt!==4&&(Gt=2)),!1;var p=Error(i(520),{cause:o});if(p=ll(p,a),ns===null?ns=[p]:ns.push(p),Gt!==4&&(Gt=2),n===null)return!0;o=ll(o,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,e=h&-h,a.lanes|=e,e=Gu(a.stateNode,o,e),ju(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"&&(Er===null||!Er.has(p))))return a.flags|=65536,h&=-h,a.lanes|=h,h=px(h),yx(h,e,a,o),ju(a,h),!1}a=a.return}while(a!==null);return!1}var Ku=Error(i(461)),nn=!1;function gn(e,n,a,o){n.child=e===null?wm(n,null,a,o):ca(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 aa(n),o=Du(e,n,a,w,p,h),N=Tu(),e!==null&&!nn?(zu(e,n,h),Vl(e,n,h)):(xt&&N&&uu(n),n.flags|=1,gn(e,n,o,h),n.child)}function bx(e,n,a,o,h){if(e===null){var p=a.type;return typeof p=="function"&&!su(p)&&p.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=p,vx(e,n,p,o,h)):(e=io(a.type,null,o,n,n.mode,h),e.ref=n.ref,e.return=n,n.child=e)}if(p=e.child,!nd(e,h)){var w=p.memoizedProps;if(a=a.compare,a=a!==null?a:Ri,a(w,o)&&e.ref===n.ref)return Vl(e,n,h)}return n.flags|=1,e=Hl(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,nd(e,h))(e.flags&131072)!==0&&(nn=!0);else return n.lanes=e.lanes,Vl(e,n,h)}return Wu(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&&uo(n,p!==null?p.cachePool:null),p!==null?Sm(n,p):Cu(),Cm(n);else return o=n.lanes=536870912,kx(e,n,p!==null?p.baseLanes|a:a,a,o)}else p!==null?(uo(n,p.cachePool),Sm(n,p),kr(),n.memoizedState=null):(e!==null&&uo(n,null),Cu(),kr());return gn(e,n,h,a),n.child}function Wi(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=bu();return p=p===null?null:{parent:en._currentValue,pool:p},n.memoizedState={baseLanes:a,cachePool:p},e!==null&&uo(n,null),Cu(),Cm(n),e!==null&&Ia(e,n,o,!0),n.childLanes=h,null}function No(e,n){return n=Do({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 ca(n,e.child,null,a),e=No(n,n.pendingProps),e.flags|=2,Kn(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=No(n,o),n.lanes=536870912,Wi(null,e);if(Nu(n),(e=Ot)?(e=_p(e,il),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:mr!==null?{id:kl,overflow:jl}:null,retryLane:536870912,hydrationErrors:null},a=im(e),a.return=n,n.child=a,pn=n,Ot=null)):e=null,e===null)throw pr(n);return n.lanes=536870912,null}return No(n,o)}var p=e.memoizedState;if(p!==null){var w=p.dehydrated;if(Nu(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||Ia(e,n,a,!1),h=(a&e.childLanes)!==0,nn||h){if(o=Mt,o!==null&&(w=qs(o,a),w!==0&&w!==p.retryLane))throw p.retryLane=w,ta(e,w),Ln(o,e,w),Ku;Lo(),n=jx(e,n,a)}else e=p.treeContext,Ot=ol(w.nextSibling),pn=n,xt=!0,xr=null,il=!1,e!==null&&cm(n,e),n=No(n,o),n.flags|=4096;return n}return e=Hl(e.child,{mode:o.mode,children:o.children}),e.ref=n.ref,n.child=e,e.return=n,e}function Ao(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 Wu(e,n,a,o,h){return aa(n),a=Du(e,n,a,o,void 0,h),o=Tu(),e!==null&&!nn?(zu(e,n,h),Vl(e,n,h)):(xt&&o&&uu(n),n.flags|=1,gn(e,n,a,h),n.child)}function Sx(e,n,a,o,h,p){return aa(n),n.updateQueue=null,a=Nm(n,o,a,h),Em(e),o=Tu(),e!==null&&!nn?(zu(e,n,p),Vl(e,n,p)):(xt&&o&&uu(n),n.flags|=1,gn(e,n,a,p),n.child)}function Cx(e,n,a,o,h){if(aa(n),n.stateNode===null){var p=La,w=a.contextType;typeof w=="object"&&w!==null&&(p=yn(w)),p=new a(o,p),n.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=Vu,n.stateNode=p,p._reactInternals=n,p=n.stateNode,p.props=o,p.state=n.memoizedState,p.refs={},wu(n),w=a.contextType,p.context=typeof w=="object"&&w!==null?yn(w):La,p.state=n.memoizedState,w=a.getDerivedStateFromProps,typeof w=="function"&&(Xu(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&&Vu.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,H=da(a,N);p.props=H;var ee=p.context,se=a.contextType;w=La,typeof se=="object"&&se!==null&&(w=yn(se));var de=a.getDerivedStateFromProps;se=typeof de=="function"||typeof p.getSnapshotBeforeUpdate=="function",N=n.pendingProps!==N,se||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(N||ee!==w)&&dx(n,p,o,w),gr=!1;var te=n.memoizedState;p.state=te,qi(n,o,p,h),Yi(),ee=n.memoizedState,N||te!==ee||gr?(typeof de=="function"&&(Xu(n,a,de,o),ee=n.memoizedState),(H=gr||ux(n,a,H,o,te,ee,w))?(se||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=ee),p.props=o,p.state=ee,p.context=w,o=H):(typeof p.componentDidMount=="function"&&(n.flags|=4194308),o=!1)}else{p=n.stateNode,ku(e,n),w=n.memoizedProps,se=da(a,w),p.props=se,de=n.pendingProps,te=p.context,ee=a.contextType,H=La,typeof ee=="object"&&ee!==null&&(H=yn(ee)),N=a.getDerivedStateFromProps,(ee=typeof N=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(w!==de||te!==H)&&dx(n,p,o,H),gr=!1,te=n.memoizedState,p.state=te,qi(n,o,p,h),Yi();var le=n.memoizedState;w!==de||te!==le||gr||e!==null&&e.dependencies!==null&&oo(e.dependencies)?(typeof N=="function"&&(Xu(n,a,N,o),le=n.memoizedState),(se=gr||ux(n,a,se,o,te,le,H)||e!==null&&e.dependencies!==null&&oo(e.dependencies))?(ee||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(o,le,H),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(o,le,H)),typeof p.componentDidUpdate=="function"&&(n.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof p.componentDidUpdate!="function"||w===e.memoizedProps&&te===e.memoizedState||(n.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||w===e.memoizedProps&&te===e.memoizedState||(n.flags|=1024),n.memoizedProps=o,n.memoizedState=le),p.props=o,p.state=le,p.context=H,o=se):(typeof p.componentDidUpdate!="function"||w===e.memoizedProps&&te===e.memoizedState||(n.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||w===e.memoizedProps&&te===e.memoizedState||(n.flags|=1024),o=!1)}return p=o,Ao(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=ca(n,e.child,null,h),n.child=ca(n,null,a,h)):gn(e,n,a,h),n.memoizedState=p.state,e=n.child):e=Vl(e,n,h),e}function Ex(e,n,a,o){return la(),n.flags|=256,gn(e,n,a,o),n.child}var Qu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Zu(e){return{baseLanes:e,cachePool:xm()}}function Ju(e,n,a){return e=e!==null?e.childLanes&~a:0,n&&(e|=Qn),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:(Zt.current&2)!==0),w&&(h=!0,n.flags&=-129),w=(n.flags&32)!==0,n.flags&=-33,e===null){if(xt){if(h?wr(n):kr(),(e=Ot)?(e=_p(e,il),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:mr!==null?{id:kl,overflow:jl}:null,retryLane:536870912,hydrationErrors:null},a=im(e),a.return=n,n.child=a,pn=n,Ot=null)):e=null,e===null)throw pr(n);return Rd(e)?n.lanes=32:n.lanes=536870912,null}var N=o.children;return o=o.fallback,h?(kr(),h=n.mode,N=Do({mode:"hidden",children:N},h),o=na(o,h,a,null),N.return=n,o.return=n,N.sibling=o,n.child=N,o=n.child,o.memoizedState=Zu(a),o.childLanes=Ju(e,w,a),n.memoizedState=Qu,Wi(null,o)):(wr(n),Pu(n,N))}var H=e.memoizedState;if(H!==null&&(N=H.dehydrated,N!==null)){if(p)n.flags&256?(wr(n),n.flags&=-257,n=ed(e,n,a)):n.memoizedState!==null?(kr(),n.child=e.child,n.flags|=128,n=null):(kr(),N=o.fallback,h=n.mode,o=Do({mode:"visible",children:o.children},h),N=na(N,h,a,null),N.flags|=2,o.return=n,N.return=n,o.sibling=N,n.child=o,ca(n,e.child,null,a),o=n.child,o.memoizedState=Zu(a),o.childLanes=Ju(e,w,a),n.memoizedState=Qu,n=Wi(null,o));else if(wr(n),Rd(N)){if(w=N.nextSibling&&N.nextSibling.dataset,w)var ee=w.dgst;w=ee,o=Error(i(419)),o.stack="",o.digest=w,Bi({value:o,source:null,stack:null}),n=ed(e,n,a)}else if(nn||Ia(e,n,a,!1),w=(a&e.childLanes)!==0,nn||w){if(w=Mt,w!==null&&(o=qs(w,a),o!==0&&o!==H.retryLane))throw H.retryLane=o,ta(e,o),Ln(w,e,o),Ku;Fd(N)||Lo(),n=ed(e,n,a)}else Fd(N)?(n.flags|=192,n.child=e.child,n=null):(e=H.treeContext,Ot=ol(N.nextSibling),pn=n,xt=!0,xr=null,il=!1,e!==null&&cm(n,e),n=Pu(n,o.children),n.flags|=4096);return n}return h?(kr(),N=o.fallback,h=n.mode,H=e.child,ee=H.sibling,o=Hl(H,{mode:"hidden",children:o.children}),o.subtreeFlags=H.subtreeFlags&65011712,ee!==null?N=Hl(ee,N):(N=na(N,h,a,null),N.flags|=2),N.return=n,o.return=n,o.sibling=N,n.child=o,Wi(null,o),o=n.child,N=e.child.memoizedState,N===null?N=Zu(a):(h=N.cachePool,h!==null?(H=en._currentValue,h=h.parent!==H?{parent:H,pool:H}:h):h=xm(),N={baseLanes:N.baseLanes|a,cachePool:h}),o.memoizedState=N,o.childLanes=Ju(e,w,a),n.memoizedState=Qu,Wi(e.child,o)):(wr(n),a=e.child,e=a.sibling,a=Hl(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 Pu(e,n){return n=Do({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function Do(e,n){return e=Vn(22,e,null,n),e.lanes=0,e}function ed(e,n,a){return ca(n,e.child,null,a),e=Pu(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),xu(e.return,n,a)}function td(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 Dx(e,n,a){var o=n.pendingProps,h=o.revealOrder,p=o.tail;o=o.children;var w=Zt.current,N=(w&2)!==0;if(N?(w=w&1|2,n.flags|=128):w&=1,D(Zt,w),gn(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&&yo(e)===null&&(h=a),a=a.sibling;a=h,a===null?(h=n.child,n.child=null):(h=a.sibling,a.sibling=null),td(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&&yo(e)===null){n.child=h;break}e=h.sibling,h.sibling=a,a=h,h=e}td(n,!0,a,null,p,o);break;case"together":td(n,!1,null,null,void 0,o);break;default:n.memoizedState=null}return n.child}function Vl(e,n,a){if(e!==null&&(n.dependencies=e.dependencies),Cr|=n.lanes,(a&n.childLanes)===0)if(e!==null){if(Ia(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=Hl(e,e.pendingProps),n.child=a,a.return=n;e.sibling!==null;)e=e.sibling,a=a.sibling=Hl(e,e.pendingProps),a.return=n;a.sibling=null}return n.child}function nd(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&oo(e)))}function Bb(e,n,a){switch(n.tag){case 3:De(n,n.stateNode.containerInfo),yr(n,en,e.memoizedState.cache),la();break;case 27:case 5:ye(n);break;case 4:De(n,n.stateNode.containerInfo);break;case 10:yr(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,Nu(n),null;break;case 13:var o=n.memoizedState;if(o!==null)return o.dehydrated!==null?(wr(n),n.flags|=128,null):(a&n.child.childLanes)!==0?Nx(e,n,a):(wr(n),e=Vl(e,n,a),e!==null?e.sibling:null);wr(n);break;case 19:var h=(e.flags&128)!==0;if(o=(a&n.childLanes)!==0,o||(Ia(e,n,a,!1),o=(a&n.childLanes)!==0),h){if(o)return Dx(e,n,a);n.flags|=128}if(h=n.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),D(Zt,Zt.current),o)break;return null;case 22:return n.lanes=0,wx(e,n,a,n.pendingProps);case 24:yr(n,en,e.memoizedState.cache)}return Vl(e,n,a)}function Tx(e,n,a){if(e!==null)if(e.memoizedProps!==n.pendingProps)nn=!0;else{if(!nd(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=sa(n.elementType),n.type=e,typeof e=="function")su(e)?(o=da(e,o),n.tag=1,n=Cx(null,n,e,o,a)):(n.tag=0,n=Wu(null,n,e,o,a));else{if(e!=null){var h=e.$$typeof;if(h===B){n.tag=11,n=gx(null,n,e,o,a);break e}else if(h===V){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 Wu(e,n,n.type,n.pendingProps,a);case 1:return o=n.type,h=da(o,n.pendingProps),Cx(e,n,o,h,a);case 3:e:{if(De(n,n.stateNode.containerInfo),e===null)throw Error(i(387));o=n.pendingProps;var p=n.memoizedState;h=p.element,ku(e,n),qi(n,o,null,a);var w=n.memoizedState;if(o=w.cache,yr(n,en,o),o!==p.cache&&pu(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=ll(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(Ot=ol(e.firstChild),pn=n,xt=!0,xr=null,il=!0,a=wm(n,null,o,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(la(),o===h){n=Vl(e,n,a);break e}gn(e,n,o,a)}n=n.child}return n;case 26:return Ao(e,n),e===null?(a=Up(n.type,null,n.pendingProps,null))?n.memoizedState=a:xt||(a=n.type,e=n.pendingProps,o=Xo(ge.current).createElement(a),o[Pt]=n,o[Qt]=e,bn(o,a,e),St(o),n.stateNode=o):n.memoizedState=Up(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return ye(n),e===null&&xt&&(o=n.stateNode=Lp(n.type,n.pendingProps,ge.current),pn=n,il=!0,h=Ot,Tr(n.type)?(_d=h,Ot=ol(o.firstChild)):Ot=h),gn(e,n,n.pendingProps.children,a),Ao(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&xt&&((h=o=Ot)&&(o=h2(o,n.type,n.pendingProps,il),o!==null?(n.stateNode=o,pn=n,Ot=ol(o.firstChild),il=!1,h=!0):h=!1),h||pr(n)),ye(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=Du(e,n,Ab,null,null,a),us._currentValue=h),Ao(e,n),gn(e,n,o,a),n.child;case 6:return e===null&&xt&&((e=a=Ot)&&(a=m2(a,n.pendingProps,il),a!==null?(n.stateNode=a,pn=n,Ot=null,e=!0):e=!1),e||pr(n)),null;case 13:return Nx(e,n,a);case 4:return De(n,n.stateNode.containerInfo),o=n.pendingProps,e===null?n.child=ca(n,null,o,a):gn(e,n,o,a),n.child;case 11:return gx(e,n,n.type,n.pendingProps,a);case 7:return gn(e,n,n.pendingProps,a),n.child;case 8:return gn(e,n,n.pendingProps.children,a),n.child;case 12:return gn(e,n,n.pendingProps.children,a),n.child;case 10:return o=n.pendingProps,yr(n,n.type,o.value),gn(e,n,o.children,a),n.child;case 9:return h=n.type._context,o=n.pendingProps.children,aa(n),h=yn(h),o=o(h),n.flags|=1,gn(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 Dx(e,n,a);case 31:return Ob(e,n,a);case 22:return wx(e,n,a,n.pendingProps);case 24:return aa(n),o=yn(en),e===null?(h=bu(),h===null&&(h=Mt,p=yu(),h.pooledCache=p,p.refCount++,p!==null&&(h.pooledCacheLanes|=a),h=p),n.memoizedState={parent:o,cache:h},wu(n),yr(n,en,h)):((e.lanes&a)!==0&&(ku(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),yr(n,en,o)):(o=p.cache,yr(n,en,o),o!==h.cache&&pu(n,[en],a,!0))),gn(e,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(i(156,n.tag))}function Gl(e){e.flags|=4}function ld(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 oa=ho,vu}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 oa=ho,vu}function To(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?Wt():536870912,e.lanes|=n,ei|=n)}function Qi(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 Bt(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(du(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Bt(n),null;case 1:return Bt(n),null;case 3:return a=n.stateNode,o=null,e!==null&&(o=e.memoizedState.cache),n.memoizedState.cache!==o&&(n.flags|=2048),Yl(en),He(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Ua(n)?Gl(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,hu())),Bt(n),null;case 26:var h=n.type,p=n.memoizedState;return e===null?(Gl(n),p!==null?(Bt(n),zx(n,p)):(Bt(n),ld(n,h,null,o,a))):p?p!==e.memoizedState?(Gl(n),Bt(n),zx(n,p)):(Bt(n),n.flags&=-16777217):(e=e.memoizedProps,e!==o&&Gl(n),Bt(n),ld(n,h,e,o,a)),null;case 27:if(We(n),a=ge.current,h=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==o&&Gl(n);else{if(!o){if(n.stateNode===null)throw Error(i(166));return Bt(n),null}e=ue.current,Ua(n)?um(n):(e=Lp(h,o,a),n.stateNode=e,Gl(n))}return Bt(n),null;case 5:if(We(n),h=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==o&&Gl(n);else{if(!o){if(n.stateNode===null)throw Error(i(166));return Bt(n),null}if(p=ue.current,Ua(n))um(n);else{var w=Xo(ge.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[Pt]=n,p[Qt]=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(bn(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&&Gl(n)}}return Bt(n),ld(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,a),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==o&&Gl(n);else{if(typeof o!="string"&&n.stateNode===null)throw Error(i(166));if(e=ge.current,Ua(n)){if(e=n.stateNode,a=n.memoizedProps,o=null,h=pn,h!==null)switch(h.tag){case 27:case 5:o=h.memoizedProps}e[Pt]=n,e=!!(e.nodeValue===a||o!==null&&o.suppressHydrationWarning===!0||Np(e.nodeValue,a)),e||pr(n,!0)}else e=Xo(e).createTextNode(o),e[Pt]=n,n.stateNode=e}return Bt(n),null;case 31:if(a=n.memoizedState,e===null||e.memoizedState!==null){if(o=Ua(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[Pt]=n}else la(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Bt(n),e=!1}else a=hu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return n.flags&256?(Kn(n),n):(Kn(n),null);if((n.flags&128)!==0)throw Error(i(558))}return Bt(n),null;case 13:if(o=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(h=Ua(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[Pt]=n}else la(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Bt(n),h=!1}else h=hu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=h),h=!0;if(!h)return n.flags&256?(Kn(n),n):(Kn(n),null)}return Kn(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),To(n,n.updateQueue),Bt(n),null);case 4:return He(),e===null&&Cd(n.stateNode.containerInfo),Bt(n),null;case 10:return Yl(n.type),Bt(n),null;case 19:if(G(Zt),o=n.memoizedState,o===null)return Bt(n),null;if(h=(n.flags&128)!==0,p=o.rendering,p===null)if(h)Qi(o,!1);else{if(Gt!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(p=yo(e),p!==null){for(n.flags|=128,Qi(o,!1),e=p.updateQueue,n.updateQueue=e,To(n,e),n.subtreeFlags=0,e=a,a=n.child;a!==null;)am(a,e),a=a.sibling;return D(Zt,Zt.current&1|2),xt&&Ul(n,o.treeForkCount),n.child}e=e.sibling}o.tail!==null&&yt()>_o&&(n.flags|=128,h=!0,Qi(o,!1),n.lanes=4194304)}else{if(!h)if(e=yo(p),e!==null){if(n.flags|=128,h=!0,e=e.updateQueue,n.updateQueue=e,To(n,e),Qi(o,!0),o.tail===null&&o.tailMode==="hidden"&&!p.alternate&&!xt)return Bt(n),null}else 2*yt()-o.renderingStartTime>_o&&a!==536870912&&(n.flags|=128,h=!0,Qi(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=yt(),e.sibling=null,a=Zt.current,D(Zt,h?a&1|2:a&1),xt&&Ul(n,o.treeForkCount),e):(Bt(n),null);case 22:case 23:return Kn(n),Eu(),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&&(Bt(n),n.subtreeFlags&6&&(n.flags|=8192)):Bt(n),a=n.updateQueue,a!==null&&To(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&&G(ia),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),Yl(en),Bt(n),null;case 25:return null;case 30:return null}throw Error(i(156,n.tag))}function $b(e,n){switch(du(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return Yl(en),He(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return We(n),null;case 31:if(n.memoizedState!==null){if(Kn(n),n.alternate===null)throw Error(i(340));la()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(Kn(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(i(340));la()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return G(Zt),null;case 4:return He(),null;case 10:return Yl(n.type),null;case 22:case 23:return Kn(n),Eu(),e!==null&&G(ia),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return Yl(en),null;case 25:return null;default:return null}}function Mx(e,n){switch(du(n),n.tag){case 3:Yl(en),He();break;case 26:case 27:case 5:We(n);break;case 4:He();break;case 31:n.memoizedState!==null&&Kn(n);break;case 13:Kn(n);break;case 19:G(Zt);break;case 10:Yl(n.type);break;case 22:case 23:Kn(n),Eu(),e!==null&&G(ia);break;case 24:Yl(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){Et(n,n.return,N)}}function jr(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 H=a,ee=N;try{ee()}catch(se){Et(h,H,se)}}}o=o.next}while(o!==p)}}catch(se){Et(n,n.return,se)}}function Fx(e){var n=e.updateQueue;if(n!==null){var a=e.stateNode;try{jm(n,a)}catch(o){Et(e,e.return,o)}}}function Rx(e,n,a){a.props=da(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(o){Et(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){Et(e,n,h)}}function Sl(e,n){var a=e.ref,o=e.refCleanup;if(a!==null)if(typeof o=="function")try{o()}catch(h){Et(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){Et(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){Et(e,e.return,h)}}function rd(e,n,a){try{var o=e.stateNode;s2(o,e.type,a,n),o[Qt]=n}catch(h){Et(e,e.return,h)}}function Ox(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Tr(e.type)||e.tag===4}function ad(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&&Tr(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 id(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=hn));else if(o!==4&&(o===27&&Tr(e.type)&&(a=e.stateNode,n=null),e=e.child,e!==null))for(id(e,n,a),e=e.sibling;e!==null;)id(e,n,a),e=e.sibling}function zo(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&&Tr(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(zo(e,n,a),e=e.sibling;e!==null;)zo(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]);bn(n,o,a),n[Pt]=e,n[Qt]=a}catch(p){Et(e,e.return,p)}}var Kl=!1,ln=!1,sd=!1,Lx=typeof WeakSet=="function"?WeakSet:Set,mn=null;function Hb(e,n){if(e=e.containerInfo,Ad=Jo,e=Qh(e),eu(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,H=-1,ee=0,se=0,de=e,te=null;t:for(;;){for(var le;de!==a||h!==0&&de.nodeType!==3||(N=w+h),de!==p||o!==0&&de.nodeType!==3||(H=w+o),de.nodeType===3&&(w+=de.nodeValue.length),(le=de.firstChild)!==null;)te=de,de=le;for(;;){if(de===e)break t;if(te===a&&++ee===h&&(N=w),te===p&&++se===o&&(H=w),(le=de.nextSibling)!==null)break;de=te,te=de.parentNode}de=le}a=N===-1||H===-1?null:{start:N,end:H}}else a=null}a=a||{start:0,end:0}}else a=null;for(Dd={focusedElem:e,selectionRange:a},Jo=!1,mn=n;mn!==null;)if(n=mn,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,mn=e;else for(;mn!==null;){switch(n=mn,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=da(a.type,h);e=o.getSnapshotBeforeUpdate(Re,p),o.__reactInternalSnapshotBeforeUpdate=e}catch(Xe){Et(a,a.return,Xe)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,a=e.nodeType,a===9)Md(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Md(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,mn=e;break}mn=n.return}}function $x(e,n,a){var o=a.flags;switch(a.tag){case 0:case 11:case 15:Ql(e,a),o&4&&Zi(5,a);break;case 1:if(Ql(e,a),o&4)if(e=a.stateNode,n===null)try{e.componentDidMount()}catch(w){Et(a,a.return,w)}else{var h=da(a.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(h,n,e.__reactInternalSnapshotBeforeUpdate)}catch(w){Et(a,a.return,w)}}o&64&&Fx(a),o&512&&Ji(a,a.return);break;case 3:if(Ql(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){Et(a,a.return,w)}}break;case 27:n===null&&o&4&&Bx(a);case 26:case 5:Ql(e,a),n===null&&o&4&&_x(a),o&512&&Ji(a,a.return);break;case 12:Ql(e,a);break;case 31:Ql(e,a),o&4&&Ix(e,a);break;case 13:Ql(e,a),o&4&&Yx(e,a),o&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=Wb.bind(null,a),x2(e,a))));break;case 22:if(o=a.memoizedState!==null||Kl,!o){n=n!==null&&n.memoizedState!==null||ln,h=Kl;var p=ln;Kl=o,(ln=n)&&!p?Zl(e,a,(a.subtreeFlags&8772)!==0):Ql(e,a),Kl=h,ln=p}break;case 30:break;default:Ql(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&&Kr(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 Ut=null,Rn=!1;function Wl(e,n,a){for(a=a.child;a!==null;)Ux(e,n,a),a=a.sibling}function Ux(e,n,a){if(Ke&&typeof Ke.onCommitFiberUnmount=="function")try{Ke.onCommitFiberUnmount($e,a)}catch{}switch(a.tag){case 26:ln||Sl(a,n),Wl(e,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:ln||Sl(a,n);var o=Ut,h=Rn;Tr(a.type)&&(Ut=a.stateNode,Rn=!1),Wl(e,n,a),ss(a.stateNode),Ut=o,Rn=h;break;case 5:ln||Sl(a,n);case 6:if(o=Ut,h=Rn,Ut=null,Wl(e,n,a),Ut=o,Rn=h,Ut!==null)if(Rn)try{(Ut.nodeType===9?Ut.body:Ut.nodeName==="HTML"?Ut.ownerDocument.body:Ut).removeChild(a.stateNode)}catch(p){Et(a,n,p)}else try{Ut.removeChild(a.stateNode)}catch(p){Et(a,n,p)}break;case 18:Ut!==null&&(Rn?(e=Ut,Fp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),oi(e)):Fp(Ut,a.stateNode));break;case 4:o=Ut,h=Rn,Ut=a.stateNode.containerInfo,Rn=!0,Wl(e,n,a),Ut=o,Rn=h;break;case 0:case 11:case 14:case 15:jr(2,a,n),ln||jr(4,a,n),Wl(e,n,a);break;case 1:ln||(Sl(a,n),o=a.stateNode,typeof o.componentWillUnmount=="function"&&Rx(a,n,o)),Wl(e,n,a);break;case 21:Wl(e,n,a);break;case 22:ln=(o=ln)||a.memoizedState!==null,Wl(e,n,a),ln=o;break;default:Wl(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{oi(e)}catch(a){Et(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{oi(e)}catch(a){Et(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 Mo(e,n){var a=Ub(e);n.forEach(function(o){if(!a.has(o)){a.add(o);var h=Qb.bind(null,e,o);o.then(h,h)}})}function _n(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(Tr(N.type)){Ut=N.stateNode,Rn=!1;break e}break;case 5:Ut=N.stateNode,Rn=!1;break e;case 3:case 4:Ut=N.stateNode.containerInfo,Rn=!0;break e}N=N.return}if(Ut===null)throw Error(i(160));Ux(p,w,h),Ut=null,Rn=!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 ml=null;function qx(e,n){var a=e.alternate,o=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:_n(n,e),On(e),o&4&&(jr(3,e,e.return),Zi(3,e),jr(5,e,e.return));break;case 1:_n(n,e),On(e),o&512&&(ln||a===null||Sl(a,a.return)),o&64&&Kl&&(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=ml;if(_n(n,e),On(e),o&512&&(ln||a===null||Sl(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[In]||p[Pt]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=h.createElement(o),h.head.insertBefore(p,h.querySelector("head > title"))),bn(p,o,a),p[Pt]=e,St(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),bn(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),bn(p,o,a),h.head.appendChild(p);break;default:throw Error(i(468,o))}p[Pt]=e,St(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&&rd(e,e.memoizedProps,a.memoizedProps)}break;case 27:_n(n,e),On(e),o&512&&(ln||a===null||Sl(a,a.return)),a!==null&&o&4&&rd(e,e.memoizedProps,a.memoizedProps);break;case 5:if(_n(n,e),On(e),o&512&&(ln||a===null||Sl(a,a.return)),e.flags&32){h=e.stateNode;try{ur(h,"")}catch(Re){Et(e,e.return,Re)}}o&4&&e.stateNode!=null&&(h=e.memoizedProps,rd(e,h,a!==null?a.memoizedProps:h)),o&1024&&(sd=!0);break;case 6:if(_n(n,e),On(e),o&4){if(e.stateNode===null)throw Error(i(162));o=e.memoizedProps,a=e.stateNode;try{a.nodeValue=o}catch(Re){Et(e,e.return,Re)}}break;case 3:if(Ko=null,h=ml,ml=Vo(n.containerInfo),_n(n,e),ml=h,On(e),o&4&&a!==null&&a.memoizedState.isDehydrated)try{oi(n.containerInfo)}catch(Re){Et(e,e.return,Re)}sd&&(sd=!1,Xx(e));break;case 4:o=ml,ml=Vo(e.stateNode.containerInfo),_n(n,e),On(e),ml=o;break;case 12:_n(n,e),On(e);break;case 31:_n(n,e),On(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,Mo(e,o)));break;case 13:_n(n,e),On(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Ro=yt()),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,Mo(e,o)));break;case 22:h=e.memoizedState!==null;var H=a!==null&&a.memoizedState!==null,ee=Kl,se=ln;if(Kl=ee||h,ln=se||H,_n(n,e),ln=se,Kl=ee,On(e),o&8192)e:for(n=e.stateNode,n._visibility=h?n._visibility&-2:n._visibility|1,h&&(a===null||H||Kl||ln||fa(e)),a=null,n=e;;){if(n.tag===5||n.tag===26){if(a===null){H=a=n;try{if(p=H.stateNode,h)w=p.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{N=H.stateNode;var de=H.memoizedProps.style,te=de!=null&&de.hasOwnProperty("display")?de.display:null;N.style.display=te==null||typeof te=="boolean"?"":(""+te).trim()}}catch(Re){Et(H,H.return,Re)}}}else if(n.tag===6){if(a===null){H=n;try{H.stateNode.nodeValue=h?"":H.memoizedProps}catch(Re){Et(H,H.return,Re)}}}else if(n.tag===18){if(a===null){H=n;try{var le=H.stateNode;h?Rp(le,!0):Rp(H.stateNode,!1)}catch(Re){Et(H,H.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,Mo(e,a))));break;case 19:_n(n,e),On(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,Mo(e,o)));break;case 30:break;case 21:break;default:_n(n,e),On(e)}}function On(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=ad(e);zo(e,p,h);break;case 5:var w=a.stateNode;a.flags&32&&(ur(w,""),a.flags&=-33);var N=ad(e);zo(e,N,w);break;case 3:case 4:var H=a.stateNode.containerInfo,ee=ad(e);id(e,ee,H);break;default:throw Error(i(161))}}catch(se){Et(e,e.return,se)}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 Ql(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)$x(e,n.alternate,n),n=n.sibling}function fa(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:jr(4,n,n.return),fa(n);break;case 1:Sl(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&Rx(n,n.return,a),fa(n);break;case 27:ss(n.stateNode);case 26:case 5:Sl(n,n.return),fa(n);break;case 22:n.memoizedState===null&&fa(n);break;case 30:fa(n);break;default:fa(n)}e=e.sibling}}function Zl(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:Zl(h,p,a),Zi(4,p);break;case 1:if(Zl(h,p,a),o=p,h=o.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(ee){Et(o,o.return,ee)}if(o=p,h=o.updateQueue,h!==null){var N=o.stateNode;try{var H=h.shared.hiddenCallbacks;if(H!==null)for(h.shared.hiddenCallbacks=null,h=0;h<H.length;h++)km(H[h],N)}catch(ee){Et(o,o.return,ee)}}a&&w&64&&Fx(p),Ji(p,p.return);break;case 27:Bx(p);case 26:case 5:Zl(h,p,a),a&&o===null&&w&4&&_x(p),Ji(p,p.return);break;case 12:Zl(h,p,a);break;case 31:Zl(h,p,a),a&&w&4&&Ix(h,p);break;case 13:Zl(h,p,a),a&&w&4&&Yx(h,p);break;case 22:p.memoizedState===null&&Zl(h,p,a),Ji(p,p.return);break;case 30:break;default:Zl(h,p,a)}n=n.sibling}}function od(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 cd(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 xl(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:xl(e,n,a,o),h&2048&&Zi(9,n);break;case 1:xl(e,n,a,o);break;case 3:xl(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){xl(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(H){Et(n,n.return,H)}}else xl(e,n,a,o);break;case 31:xl(e,n,a,o);break;case 13:xl(e,n,a,o);break;case 23:break;case 22:p=n.stateNode,w=n.alternate,n.memoizedState!==null?p._visibility&2?xl(e,n,a,o):Pi(e,n):p._visibility&2?xl(e,n,a,o):(p._visibility|=2,Za(e,n,a,o,(n.subtreeFlags&10256)!==0||!1)),h&2048&&od(w,n);break;case 24:xl(e,n,a,o),h&2048&&cd(n.alternate,n);break;default:xl(e,n,a,o)}}function Za(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,H=o,ee=w.flags;switch(w.tag){case 0:case 11:case 15:Za(p,w,N,H,h),Zi(8,w);break;case 23:break;case 22:var se=w.stateNode;w.memoizedState!==null?se._visibility&2?Za(p,w,N,H,h):Pi(p,w):(se._visibility|=2,Za(p,w,N,H,h)),h&&ee&2048&&od(w.alternate,w);break;case 24:Za(p,w,N,H,h),h&&ee&2048&&cd(w.alternate,w);break;default:Za(p,w,N,H,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&&od(o.alternate,o);break;case 24:Pi(a,o),h&2048&&cd(o.alternate,o);break;default:Pi(a,o)}n=n.sibling}}var es=8192;function Ja(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:Ja(e,n,a),e.flags&es&&e.memoizedState!==null&&N2(a,ml,e.memoizedState,e.memoizedProps);break;case 5:Ja(e,n,a);break;case 3:case 4:var o=ml;ml=Vo(e.stateNode.containerInfo),Ja(e,n,a),ml=o;break;case 22:e.memoizedState===null&&(o=e.alternate,o!==null&&o.memoizedState!==null?(o=es,es=16777216,Ja(e,n,a),es=o):Ja(e,n,a));break;default:Ja(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];mn=o,Qx(o,e)}Kx(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Wx(e),e=e.sibling}function Wx(e){switch(e.tag){case 0:case 11:case 15:ts(e),e.flags&2048&&jr(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,Fo(e)):ts(e);break;default:ts(e)}}function Fo(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];mn=o,Qx(o,e)}Kx(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:jr(8,n,n.return),Fo(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,Fo(n));break;default:Fo(n)}e=e.sibling}}function Qx(e,n){for(;mn!==null;){var a=mn;switch(a.tag){case 0:case 11:case 15:jr(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,mn=o;else e:for(a=e;mn!==null;){o=mn;var h=o.sibling,p=o.return;if(Hx(o),o===a){mn=null;break e}if(h!==null){h.return=p,mn=h;break e}mn=p}}}var Ib={getCacheForType:function(e){var n=yn(en),a=n.data.get(e);return a===void 0&&(a=e(),n.data.set(e,a)),a},cacheSignal:function(){return yn(en).controller.signal}},Yb=typeof WeakMap=="function"?WeakMap:Map,wt=0,Mt=null,ot=null,dt=0,Ct=0,Wn=null,Sr=!1,Pa=!1,ud=!1,Jl=0,Gt=0,Cr=0,ha=0,dd=0,Qn=0,ei=0,ns=null,Bn=null,fd=!1,Ro=0,Zx=0,_o=1/0,Oo=null,Er=null,on=0,Nr=null,ti=null,Pl=0,hd=0,md=null,Jx=null,ls=0,xd=null;function Zn(){return(wt&2)!==0&&dt!==0?dt&-dt:I.T!==null?wd():Rl()}function Px(){if(Qn===0)if((dt&536870912)===0||xt){var e=dl;dl<<=1,(dl&3932160)===0&&(dl=262144),Qn=e}else Qn=536870912;return e=Gn.current,e!==null&&(e.flags|=32),Qn}function Ln(e,n,a){(e===Mt&&(Ct===2||Ct===9)||e.cancelPendingCommit!==null)&&(ni(e,0),Ar(e,dt,Qn,!1)),fl(e,a),((wt&2)===0||e!==Mt)&&(e===Mt&&((wt&2)===0&&(ha|=a),Gt===4&&Ar(e,dt,Qn,!1)),Cl(e))}function ep(e,n,a){if((wt&6)!==0)throw Error(i(327));var o=!a&&(n&127)===0&&(n&e.expiredLanes)===0||sn(e,n),h=o?Vb(e,n):yd(e,n,!0),p=o;do{if(h===0){Pa&&!o&&Ar(e,n,0,!1);break}else{if(a=e.current.alternate,p&&!qb(a)){h=yd(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 H=N.current.memoizedState.isDehydrated;if(H&&(ni(N,w).flags|=256),w=yd(N,w,!1),w!==2){if(ud&&!H){N.errorRecoveryDisabledLanes|=p,ha|=p,h=4;break e}p=Bn,Bn=h,p!==null&&(Bn===null?Bn=p:Bn.push.apply(Bn,p))}h=w}if(p=!1,h!==2)continue}}if(h===1){ni(e,0),Ar(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:Ar(o,n,Qn,!Sr);break e;case 2:Bn=null;break;case 3:case 5:break;default:throw Error(i(329))}if((n&62914560)===n&&(h=Ro+300-yt(),10<h)){if(Ar(o,n,Qn,!Sr),En(o,0,!0)!==0)break e;Pl=n,o.timeoutHandle=zp(tp.bind(null,o,a,Bn,Oo,fd,n,Qn,ha,ei,Sr,p,"Throttled",-0,0),h);break e}tp(o,a,Bn,Oo,fd,n,Qn,ha,ei,Sr,p,null,-0,0)}}break}while(!0);Cl(e)}function tp(e,n,a,o,h,p,w,N,H,ee,se,de,te,le){if(e.timeoutHandle=-1,de=n.subtreeFlags,de&8192||(de&16785408)===16785408){de={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:hn},Gx(n,p,de);var Re=(p&62914560)===p?Ro-yt():(p&4194048)===p?Zx-yt():0;if(Re=A2(de,Re),Re!==null){Pl=p,e.cancelPendingCommit=Re(cp.bind(null,e,n,p,a,o,h,w,N,H,se,de,null,te,le)),Ar(e,p,w,!ee);return}}cp(e,n,p,a,o,h,w,N,H)}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(!Xn(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 Ar(e,n,a,o){n&=~dd,n&=~ha,e.suspendedLanes|=n,e.pingedLanes&=~n,o&&(e.warmLanes|=n),o=e.expirationTimes;for(var h=n;0<h;){var p=31-Qe(h),w=1<<p;o[p]=-1,h&=~w}a!==0&&Ca(e,a,n)}function Bo(){return(wt&6)===0?(rs(0),!1):!0}function pd(){if(ot!==null){if(Ct===0)var e=ot.return;else e=ot,Il=ra=null,Mu(e),Va=null,Hi=0,e=ot;for(;e!==null;)Mx(e.alternate,e),e=e.return;ot=null}}function ni(e,n){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,u2(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),Pl=0,pd(),Mt=e,ot=a=Hl(e.current,null),dt=n,Ct=0,Wn=null,Sr=!1,Pa=sn(e,n),ud=!1,ei=Qn=dd=ha=Cr=Gt=0,Bn=ns=null,fd=!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-Qe(o),p=1<<h;n|=e[h],o&=~p}return Jl=n,lo(),a}function np(e,n){tt=null,I.H=Ki,n===Xa||n===fo?(n=gm(),Ct=3):n===vu?(n=gm(),Ct=4):Ct=n===Ku?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,Wn=n,ot===null&&(Gt=1,Eo(e,ll(n,e.current)))}function lp(){var e=Gn.current;return e===null?!0:(dt&4194048)===dt?sl===null:(dt&62914560)===dt||(dt&536870912)!==0?e===sl:!1}function rp(){var e=I.H;return I.H=Ki,e===null?Ki:e}function ap(){var e=I.A;return I.A=Ib,e}function Lo(){Gt=4,Sr||(dt&4194048)!==dt&&Gn.current!==null||(Pa=!0),(Cr&134217727)===0&&(ha&134217727)===0||Mt===null||Ar(Mt,dt,Qn,!1)}function yd(e,n,a){var o=wt;wt|=2;var h=rp(),p=ap();(Mt!==e||dt!==n)&&(Oo=null,ni(e,n)),n=!1;var w=Gt;e:do try{if(Ct!==0&&ot!==null){var N=ot,H=Wn;switch(Ct){case 8:pd(),w=6;break e;case 3:case 2:case 9:case 6:Gn.current===null&&(n=!0);var ee=Ct;if(Ct=0,Wn=null,li(e,N,H,ee),a&&Pa){w=0;break e}break;default:ee=Ct,Ct=0,Wn=null,li(e,N,H,ee)}}Xb(),w=Gt;break}catch(se){np(e,se)}while(!0);return n&&e.shellSuspendCounter++,Il=ra=null,wt=o,I.H=h,I.A=p,ot===null&&(Mt=null,dt=0,lo()),w}function Xb(){for(;ot!==null;)ip(ot)}function Vb(e,n){var a=wt;wt|=2;var o=rp(),h=ap();Mt!==e||dt!==n?(Oo=null,_o=yt()+500,ni(e,n)):Pa=sn(e,n);e:do try{if(Ct!==0&&ot!==null){n=ot;var p=Wn;t:switch(Ct){case 1:Ct=0,Wn=null,li(e,n,p,1);break;case 2:case 9:if(pm(p)){Ct=0,Wn=null,sp(n);break}n=function(){Ct!==2&&Ct!==9||Mt!==e||(Ct=7),Cl(e)},p.then(n,n);break e;case 3:Ct=7;break e;case 4:Ct=5;break e;case 7:pm(p)?(Ct=0,Wn=null,sp(n)):(Ct=0,Wn=null,li(e,n,p,7));break;case 5:var w=null;switch(ot.tag){case 26:w=ot.memoizedState;case 5:case 27:var N=ot;if(w?Vp(w):N.stateNode.complete){Ct=0,Wn=null;var H=N.sibling;if(H!==null)ot=H;else{var ee=N.return;ee!==null?(ot=ee,$o(ee)):ot=null}break t}}Ct=0,Wn=null,li(e,n,p,5);break;case 6:Ct=0,Wn=null,li(e,n,p,6);break;case 8:pd(),Gt=6;break e;default:throw Error(i(462))}}Gb();break}catch(se){np(e,se)}while(!0);return Il=ra=null,I.H=o,I.A=h,wt=a,ot!==null?0:(Mt=null,dt=0,lo(),Gt)}function Gb(){for(;ot!==null&&!jt();)ip(ot)}function ip(e){var n=Tx(e.alternate,e,Jl);e.memoizedProps=e.pendingProps,n===null?$o(e):ot=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,dt);break;case 11:n=Sx(a,n,n.pendingProps,n.type.render,n.ref,dt);break;case 5:Mu(n);default:Mx(a,n),n=ot=am(n,Jl),n=Tx(a,n,Jl)}e.memoizedProps=e.pendingProps,n===null?$o(e):ot=n}function li(e,n,a,o){Il=ra=null,Mu(n),Va=null,Hi=0;var h=n.return;try{if(_b(e,h,n,a,dt)){Gt=1,Eo(e,ll(a,e.current)),ot=null;return}}catch(p){if(h!==null)throw ot=h,p;Gt=1,Eo(e,ll(a,e.current)),ot=null;return}n.flags&32768?(xt||o===1?e=!0:Pa||(dt&536870912)!==0?e=!1:(Sr=e=!0,(o===2||o===9||o===3||o===6)&&(o=Gn.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,Sr);return}e=n.return;var a=Lb(n.alternate,n,Jl);if(a!==null){ot=a;return}if(n=n.sibling,n!==null){ot=n;return}ot=n=e}while(n!==null);Gt===0&&(Gt=5)}function op(e,n){do{var a=$b(e.alternate,e);if(a!==null){a.flags&=32767,ot=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(e=e.sibling,e!==null)){ot=e;return}ot=e=a}while(e!==null);Gt=6,ot=null}function cp(e,n,a,o,h,p,w,N,H){e.cancelPendingCommit=null;do Ho();while(on!==0);if((wt&6)!==0)throw Error(i(327));if(n!==null){if(n===e.current)throw Error(i(177));if(p=n.lanes|n.childLanes,p|=au,Ys(e,a,p,w,N,H),e===Mt&&(ot=Mt=null,dt=0),ti=n,Nr=e,Pl=a,hd=p,md=h,Jx=o,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Zb(Fe,function(){return mp(),null})):(e.callbackNode=null,e.callbackPriority=0),o=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||o){o=I.T,I.T=null,h=P.p,P.p=2,w=wt,wt|=4;try{Hb(e,n,a)}finally{wt=w,P.p=h,I.T=o}}on=1,up(),dp(),fp()}}function up(){if(on===1){on=0;var e=Nr,n=ti,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=I.T,I.T=null;var o=P.p;P.p=2;var h=wt;wt|=4;try{qx(n,e);var p=Dd,w=Qh(e.containerInfo),N=p.focusedElem,H=p.selectionRange;if(w!==N&&N&&N.ownerDocument&&Wh(N.ownerDocument.documentElement,N)){if(H!==null&&eu(N)){var ee=H.start,se=H.end;if(se===void 0&&(se=ee),"selectionStart"in N)N.selectionStart=ee,N.selectionEnd=Math.min(se,N.value.length);else{var de=N.ownerDocument||document,te=de&&de.defaultView||window;if(te.getSelection){var le=te.getSelection(),Re=N.textContent.length,Xe=Math.min(H.start,Re),Tt=H.end===void 0?Xe:Math.min(H.end,Re);!le.extend&&Xe>Tt&&(w=Tt,Tt=Xe,Xe=w);var Q=Kh(N,Xe),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=de.createRange();J.setStart(Q.node,Q.offset),le.removeAllRanges(),Xe>Tt?(le.addRange(J),le.extend(X.node,X.offset)):(J.setEnd(X.node,X.offset),le.addRange(J))}}}}for(de=[],le=N;le=le.parentNode;)le.nodeType===1&&de.push({element:le,left:le.scrollLeft,top:le.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<de.length;N++){var oe=de[N];oe.element.scrollLeft=oe.left,oe.element.scrollTop=oe.top}}Jo=!!Ad,Dd=Ad=null}finally{wt=h,P.p=o,I.T=a}}e.current=n,on=2}}function dp(){if(on===2){on=0;var e=Nr,n=ti,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=I.T,I.T=null;var o=P.p;P.p=2;var h=wt;wt|=4;try{$x(e,n.alternate,n)}finally{wt=h,P.p=o,I.T=a}}on=3}}function fp(){if(on===4||on===3){on=0,$t();var e=Nr,n=ti,a=Pl,o=Jx;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?on=5:(on=0,ti=Nr=null,hp(e,e.pendingLanes));var h=e.pendingLanes;if(h===0&&(Er=null),Gr(a),n=n.stateNode,Ke&&typeof Ke.onCommitFiberRoot=="function")try{Ke.onCommitFiberRoot($e,n,void 0,(n.current.flags&128)===128)}catch{}if(o!==null){n=I.T,h=P.p,P.p=2,I.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{I.T=n,P.p=h}}(Pl&3)!==0&&Ho(),Cl(e),h=e.pendingLanes,(a&261930)!==0&&(h&42)!==0?e===xd?ls++:(ls=0,xd=e):ls=0,rs(0)}}function hp(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,Li(n)))}function Ho(){return up(),dp(),fp(),mp()}function mp(){if(on!==5)return!1;var e=Nr,n=hd;hd=0;var a=Gr(Pl),o=I.T,h=P.p;try{P.p=32>a?32:a,I.T=null,a=md,md=null;var p=Nr,w=Pl;if(on=0,ti=Nr=null,Pl=0,(wt&6)!==0)throw Error(i(331));var N=wt;if(wt|=4,Wx(p.current),Vx(p,p.current,w,a),wt=N,rs(0,!1),Ke&&typeof Ke.onPostCommitFiberRoot=="function")try{Ke.onPostCommitFiberRoot($e,p)}catch{}return!0}finally{P.p=h,I.T=o,hp(e,n)}}function xp(e,n,a){n=ll(a,n),n=Gu(e.stateNode,n,2),e=vr(e,n,2),e!==null&&(fl(e,2),Cl(e))}function Et(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"&&(Er===null||!Er.has(o))){e=ll(a,e),a=px(2),o=vr(n,a,2),o!==null&&(yx(a,o,n,e),fl(o,2),Cl(o));break}}n=n.return}}function gd(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)||(ud=!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,Mt===e&&(dt&a)===a&&(Gt===4||Gt===3&&(dt&62914560)===dt&&300>yt()-Ro?(wt&2)===0&&ni(e,0):dd|=a,ei===dt&&(ei=0)),Cl(e)}function pp(e,n){n===0&&(n=Wt()),e=ta(e,n),e!==null&&(fl(e,n),Cl(e))}function Wb(e){var n=e.memoizedState,a=0;n!==null&&(a=n.retryLane),pp(e,a)}function Qb(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 Oe(e,n)}var Uo=null,ri=null,bd=!1,Io=!1,vd=!1,Dr=0;function Cl(e){e!==ri&&e.next===null&&(ri===null?Uo=ri=e:ri=ri.next=e),Io=!0,bd||(bd=!0,Pb())}function rs(e,n){if(!vd&&Io){vd=!0;do for(var a=!1,o=Uo;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-Qe(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=dt,p=En(o,o===Mt?p:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(p&3)===0||sn(o,p)||(a=!0,vp(o,p));o=o.next}while(a);vd=!1}}function Jb(){yp()}function yp(){Io=bd=!1;var e=0;Dr!==0&&c2()&&(e=Dr);for(var n=yt(),a=null,o=Uo;o!==null;){var h=o.next,p=gp(o,n);p===0?(o.next=null,a===null?Uo=h:a.next=h,h===null&&(ri=a)):(a=o,(e!==0||(p&3)!==0)&&(Io=!0)),o=h}on!==0&&on!==5||rs(e),Dr!==0&&(Dr=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-Qe(p),N=1<<w,H=h[w];H===-1?((N&a)===0||(N&o)!==0)&&(h[w]=we(N,n)):H<=n&&(e.expiredLanes|=N),p&=~N}if(n=Mt,a=dt,a=En(e,e===n?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o=e.callbackNode,a===0||e===n&&(Ct===2||Ct===9)||e.cancelPendingCommit!==null)return o!==null&&o!==null&&Je(o),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||sn(e,a)){if(n=a&-a,n===e.callbackPriority)return n;switch(o!==null&&Je(o),Gr(a)){case 2:case 8:a=me;break;case 32:a=Fe;break;case 268435456:a=xe;break;default:a=Fe}return o=bp.bind(null,e),a=Oe(a,o),e.callbackPriority=n,e.callbackNode=a,n}return o!==null&&o!==null&&Je(o),e.callbackPriority=2,e.callbackNode=null,2}function bp(e,n){if(on!==0&&on!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Ho()&&e.callbackNode!==a)return null;var o=dt;return o=En(e,e===Mt?o:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o===0?null:(ep(e,o,n),gp(e,yt()),e.callbackNode!=null&&e.callbackNode===a?bp.bind(null,e):null)}function vp(e,n){if(Ho())return null;ep(e,n,!0)}function Pb(){d2(function(){(wt&6)!==0?Oe(ae,Jb):yp()})}function wd(){if(Dr===0){var e=Ya;e===0&&(e=ar,ar<<=1,(ar&261888)===0&&(ar=256)),Dr=e}return Dr}function wp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:za(""+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[Qt]||null).action),w=o.submitter;w&&(n=(n=w[Qt]||null)?wp(n.formAction):w.getAttribute("formAction"),n!==null&&(p=n,w=null));var N=new Ps("action","action",null,o,h);e.push({event:N,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(Dr!==0){var H=w?kp(h,w):new FormData(h);Uu(a,{pending:!0,data:H,method:h.method,action:p},null,H)}}else typeof p=="function"&&(N.preventDefault(),H=w?kp(h,w):new FormData(h),Uu(a,{pending:!0,data:H,method:h.method,action:p},p,H))},currentTarget:h}]})}}for(var kd=0;kd<ru.length;kd++){var jd=ru[kd],t2=jd.toLowerCase(),n2=jd[0].toUpperCase()+jd.slice(1);hl(t2,"on"+n2)}hl(Ph,"onAnimationEnd"),hl(em,"onAnimationIteration"),hl(tm,"onAnimationStart"),hl("dblclick","onDoubleClick"),hl("focusin","onFocus"),hl("focusout","onBlur"),hl(gb,"onTransitionRun"),hl(bb,"onTransitionStart"),hl(vb,"onTransitionCancel"),hl(nm,"onTransitionEnd"),Yn("onMouseEnter",["mouseout","mouseover"]),Yn("onMouseLeave",["mouseout","mouseover"]),Yn("onPointerEnter",["pointerout","pointerover"]),Yn("onPointerLeave",["pointerout","pointerover"]),$l("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),$l("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),$l("onBeforeInput",["compositionend","keypress","textInput","paste"]),$l("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),$l("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),$l("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],H=N.instance,ee=N.currentTarget;if(N=N.listener,H!==p&&h.isPropagationStopped())break e;p=N,h.currentTarget=ee;try{p(h)}catch(se){no(se)}h.currentTarget=null,p=H}else for(w=0;w<o.length;w++){if(N=o[w],H=N.instance,ee=N.currentTarget,N=N.listener,H!==p&&h.isPropagationStopped())break e;p=N,h.currentTarget=ee;try{p(h)}catch(se){no(se)}h.currentTarget=null,p=H}}}}function ct(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 Sd(e,n,a){var o=0;n&&(o|=4),Sp(a,e,o,n)}var Yo="_reactListening"+Math.random().toString(36).slice(2);function Cd(e){if(!e[Yo]){e[Yo]=!0,wl.forEach(function(a){a!=="selectionchange"&&(l2.has(a)||Sd(a,!1,e),Sd(a,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[Yo]||(n[Yo]=!0,Sd("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=Hd}a=h.bind(null,n,a,e),h=void 0,!ie||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 Ed(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 H=w.tag;if((H===3||H===4)&&w.stateNode.containerInfo===h)return;w=w.return}for(;N!==null;){if(w=Bl(N),w===null)return;if(H=w.tag,H===5||H===6||H===26||H===27){o=p=w;continue e}N=N.parentNode}}o=o.return}Ai(function(){var ee=p,se=Ni(a),de=[];e:{var te=lm.get(e);if(te!==void 0){var le=Ps,Re=e;switch(e){case"keypress":if(Ge(a)===0)break e;case"keydown":case"keyup":le=Qg;break;case"focusin":Re="focus",le=Wc;break;case"focusout":Re="blur",le=Wc;break;case"beforeblur":case"afterblur":le=Wc;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 Xe=(n&4)!==0,Tt=!Xe&&(e==="scroll"||e==="scrollend"),Q=Xe?te!==null?te+"Capture":null:te;Xe=[];for(var X=ee,J;X!==null;){var oe=X;if(J=oe.stateNode,oe=oe.tag,oe!==5&&oe!==26&&oe!==27||J===null||Q===null||(oe=hr(X,Q),oe!=null&&Xe.push(is(X,oe,J))),Tt)break;X=X.return}0<Xe.length&&(te=new le(te,Re,null,a,se),de.push({event:te,listeners:Xe}))}}if((n&7)===0){e:{if(te=e==="mouseover"||e==="pointerover",le=e==="mouseout"||e==="pointerout",te&&a!==Ma&&(Re=a.relatedTarget||a.fromElement)&&(Bl(Re)||Re[Ol]))break e;if((le||te)&&(te=se.window===se?se:(te=se.ownerDocument)?te.defaultView||te.parentWindow:window,le?(Re=a.relatedTarget||a.toElement,le=ee,Re=Re?Bl(Re):null,Re!==null&&(Tt=u(Re),Xe=Re.tag,Re!==Tt||Xe!==5&&Xe!==27&&Xe!==6)&&(Re=null)):(le=null,Re=ee),le!==Re)){if(Xe=Mh,oe="onMouseLeave",Q="onMouseEnter",X="mouse",(e==="pointerout"||e==="pointerover")&&(Xe=Rh,oe="onPointerLeave",Q="onPointerEnter",X="pointer"),Tt=le==null?te:Wr(le),J=Re==null?te:Wr(Re),te=new Xe(oe,X+"leave",le,a,se),te.target=Tt,te.relatedTarget=J,oe=null,Bl(se)===ee&&(Xe=new Xe(Q,X+"enter",Re,a,se),Xe.target=J,Xe.relatedTarget=Tt,oe=Xe),Tt=oe,le&&Re)t:{for(Xe=r2,Q=le,X=Re,J=0,oe=Q;oe;oe=Xe(oe))J++;oe=0;for(var Ie=X;Ie;Ie=Xe(Ie))oe++;for(;0<J-oe;)Q=Xe(Q),J--;for(;0<oe-J;)X=Xe(X),oe--;for(;J--;){if(Q===X||X!==null&&Q===X.alternate){Xe=Q;break t}Q=Xe(Q),X=Xe(X)}Xe=null}else Xe=null;le!==null&&Cp(de,te,le,Xe,!1),Re!==null&&Tt!==null&&Cp(de,Tt,Re,Xe,!0)}}e:{if(te=ee?Wr(ee):window,le=te.nodeName&&te.nodeName.toLowerCase(),le==="select"||le==="input"&&te.type==="file")var gt=Ih;else if(Hh(te))if(Yh)gt=xb;else{gt=hb;var Be=fb}else le=te.nodeName,!le||le.toLowerCase()!=="input"||te.type!=="checkbox"&&te.type!=="radio"?ee&&tl(ee.elementType)&&(gt=Ih):gt=mb;if(gt&&(gt=gt(e,ee))){Uh(de,gt,a,se);break e}Be&&Be(e,te,ee),e==="focusout"&&ee&&te.type==="number"&&ee.memoizedProps.value!=null&&Ta(te,"number",te.value)}switch(Be=ee?Wr(ee):window,e){case"focusin":(Hh(Be)||Be.contentEditable==="true")&&(_a=Be,tu=ee,_i=null);break;case"focusout":_i=tu=_a=null;break;case"mousedown":nu=!0;break;case"contextmenu":case"mouseup":case"dragend":nu=!1,Zh(de,a,se);break;case"selectionchange":if(yb)break;case"keydown":case"keyup":Zh(de,a,se)}var nt;if(Zc)e:{switch(e){case"compositionstart":var ft="onCompositionStart";break e;case"compositionend":ft="onCompositionEnd";break e;case"compositionupdate":ft="onCompositionUpdate";break e}ft=void 0}else Ra?Lh(e,a)&&(ft="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(ft="onCompositionStart");ft&&(_h&&a.locale!=="ko"&&(Ra||ft!=="onCompositionStart"?ft==="onCompositionEnd"&&Ra&&(nt=Ze()):(pe=se,Se="value"in pe?pe.value:pe.textContent,Ra=!0)),Be=qo(ee,ft),0<Be.length&&(ft=new Fh(ft,e,null,a,se),de.push({event:ft,listeners:Be}),nt?ft.data=nt:(nt=$h(a),nt!==null&&(ft.data=nt)))),(nt=sb?ob(e,a):cb(e,a))&&(ft=qo(ee,"onBeforeInput"),0<ft.length&&(Be=new Fh("onBeforeInput","beforeinput",null,a,se),de.push({event:Be,listeners:ft}),Be.data=nt)),e2(de,e,ee,a,se)}jp(de,n)})}function is(e,n,a){return{instance:e,listener:n,currentTarget:a}}function qo(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=hr(e,a),h!=null&&o.unshift(is(e,h,p)),h=hr(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,H=N.alternate,ee=N.stateNode;if(N=N.tag,H!==null&&H===o)break;N!==5&&N!==26&&N!==27||ee===null||(H=ee,h?(ee=hr(a,p),ee!=null&&w.unshift(is(a,ee,H))):h||(ee=hr(a,p),ee!=null&&w.push(is(a,ee,H)))),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 Dt(e,n,a,o,h,p){switch(a){case"children":typeof o=="string"?n==="body"||n==="textarea"&&o===""||ur(e,o):(typeof o=="number"||typeof o=="bigint")&&n!=="body"&&ur(e,""+o);break;case"className":Na(e,"class",o);break;case"tabIndex":Na(e,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":Na(e,a,o);break;case"style":Js(e,o,p);break;case"data":if(n!=="object"){Na(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=za(""+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"&&Dt(e,n,"name",h.name,h,null),Dt(e,n,"formEncType",h.formEncType,h,null),Dt(e,n,"formMethod",h.formMethod,h,null),Dt(e,n,"formTarget",h.formTarget,h,null)):(Dt(e,n,"encType",h.encType,h,null),Dt(e,n,"method",h.method,h,null),Dt(e,n,"target",h.target,h,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(a);break}o=za(""+o),e.setAttribute(a,o);break;case"onClick":o!=null&&(e.onclick=hn);break;case"onScroll":o!=null&&ct("scroll",e);break;case"onScrollEnd":o!=null&&ct("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=za(""+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":ct("beforetoggle",e),ct("toggle",e),or(e,"popover",o);break;case"xlinkActuate":An(e,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":An(e,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":An(e,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":An(e,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":An(e,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":An(e,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":An(e,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":An(e,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":An(e,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":or(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=Ei.get(a)||a,or(e,a,o))}}function Nd(e,n,a,o,h,p){switch(a){case"style":Js(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"?ur(e,o):(typeof o=="number"||typeof o=="bigint")&&ur(e,""+o);break;case"onScroll":o!=null&&ct("scroll",e);break;case"onScrollEnd":o!=null&&ct("scrollend",e);break;case"onClick":o!=null&&(e.onclick=hn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!sr.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[Qt]||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,""):or(e,a,o)}}}function bn(e,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ct("error",e),ct("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:Dt(e,n,p,w,a,null)}}h&&Dt(e,n,"srcSet",a.srcSet,a,null),o&&Dt(e,n,"src",a.src,a,null);return;case"input":ct("invalid",e);var N=p=w=h=null,H=null,ee=null;for(o in a)if(a.hasOwnProperty(o)){var se=a[o];if(se!=null)switch(o){case"name":h=se;break;case"type":w=se;break;case"checked":H=se;break;case"defaultChecked":ee=se;break;case"value":p=se;break;case"defaultValue":N=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(i(137,n));break;default:Dt(e,n,o,se,a,null)}}Ks(e,p,N,H,ee,w,h,!1);return;case"select":ct("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:Dt(e,n,h,N,a,null)}n=p,a=w,e.multiple=!!o,n!=null?cr(e,!!o,n,!1):a!=null&&cr(e,!!o,a,!0);return;case"textarea":ct("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:Dt(e,n,w,N,a,null)}Qs(e,o,h,p);return;case"option":for(H in a)if(a.hasOwnProperty(H)&&(o=a[H],o!=null))switch(H){case"selected":e.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:Dt(e,n,H,o,a,null)}return;case"dialog":ct("beforetoggle",e),ct("toggle",e),ct("cancel",e),ct("close",e);break;case"iframe":case"object":ct("load",e);break;case"video":case"audio":for(o=0;o<as.length;o++)ct(as[o],e);break;case"image":ct("error",e),ct("load",e);break;case"details":ct("toggle",e);break;case"embed":case"source":case"link":ct("error",e),ct("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(ee in a)if(a.hasOwnProperty(ee)&&(o=a[ee],o!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:Dt(e,n,ee,o,a,null)}return;default:if(tl(n)){for(se in a)a.hasOwnProperty(se)&&(o=a[se],o!==void 0&&Nd(e,n,se,o,a,void 0));return}}for(N in a)a.hasOwnProperty(N)&&(o=a[N],o!=null&&Dt(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,H=null,ee=null,se=null;for(le in a){var de=a[le];if(a.hasOwnProperty(le)&&de!=null)switch(le){case"checked":break;case"value":break;case"defaultValue":H=de;default:o.hasOwnProperty(le)||Dt(e,n,le,null,o,de)}}for(var te in o){var le=o[te];if(de=a[te],o.hasOwnProperty(te)&&(le!=null||de!=null))switch(te){case"type":p=le;break;case"name":h=le;break;case"checked":ee=le;break;case"defaultChecked":se=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!==de&&Dt(e,n,te,le,o,de)}}Ci(e,w,N,H,ee,se,p,h);return;case"select":le=w=N=te=null;for(p in a)if(H=a[p],a.hasOwnProperty(p)&&H!=null)switch(p){case"value":break;case"multiple":le=H;default:o.hasOwnProperty(p)||Dt(e,n,p,null,o,H)}for(h in o)if(p=o[h],H=a[h],o.hasOwnProperty(h)&&(p!=null||H!=null))switch(h){case"value":te=p;break;case"defaultValue":N=p;break;case"multiple":w=p;default:p!==H&&Dt(e,n,h,p,o,H)}n=N,a=w,o=le,te!=null?cr(e,!!a,te,!1):!!o!=!!a&&(n!=null?cr(e,!!a,n,!0):cr(e,!!a,a?[]:"",!1));return;case"textarea":le=te=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:Dt(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":te=h;break;case"defaultValue":le=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(i(91));break;default:h!==p&&Dt(e,n,w,h,o,p)}Ws(e,te,le);return;case"option":for(var Re in a)if(te=a[Re],a.hasOwnProperty(Re)&&te!=null&&!o.hasOwnProperty(Re))switch(Re){case"selected":e.selected=!1;break;default:Dt(e,n,Re,null,o,te)}for(H in o)if(te=o[H],le=a[H],o.hasOwnProperty(H)&&te!==le&&(te!=null||le!=null))switch(H){case"selected":e.selected=te&&typeof te!="function"&&typeof te!="symbol";break;default:Dt(e,n,H,te,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 Xe in a)te=a[Xe],a.hasOwnProperty(Xe)&&te!=null&&!o.hasOwnProperty(Xe)&&Dt(e,n,Xe,null,o,te);for(ee in o)if(te=o[ee],le=a[ee],o.hasOwnProperty(ee)&&te!==le&&(te!=null||le!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(i(137,n));break;default:Dt(e,n,ee,te,o,le)}return;default:if(tl(n)){for(var Tt in a)te=a[Tt],a.hasOwnProperty(Tt)&&te!==void 0&&!o.hasOwnProperty(Tt)&&Nd(e,n,Tt,void 0,o,te);for(se in o)te=o[se],le=a[se],!o.hasOwnProperty(se)||te===le||te===void 0&&le===void 0||Nd(e,n,se,te,o,le);return}}for(var Q in a)te=a[Q],a.hasOwnProperty(Q)&&te!=null&&!o.hasOwnProperty(Q)&&Dt(e,n,Q,null,o,te);for(de in o)te=o[de],le=a[de],!o.hasOwnProperty(de)||te===le||te==null&&le==null||Dt(e,n,de,te,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 H=a[o],ee=H.startTime;if(ee>N)break;var se=H.transferSize,de=H.initiatorType;se&&Ap(de)&&(H=H.responseEnd,w+=se*(H<N?1:(N-ee)/(H-ee)))}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 Ad=null,Dd=null;function Xo(e){return e.nodeType===9?e:e.ownerDocument}function Dp(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 Tp(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 zd=null;function c2(){var e=window.event;return e&&e.type==="popstate"?e===zd?!1:(zd=e,!0):(zd=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 Tr(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),oi(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[In]||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);oi(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 Md(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":Md(a),Kr(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[In])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=ol(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=ol(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=ol(e.nextSibling),e===null))return null;return e}function Fd(e){return e.data==="$?"||e.data==="$~"}function Rd(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 ol(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 _d=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 ol(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=Xo(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]);Kr(e)}var cl=new Map,$p=new Set;function Vo(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var er=P.d;P.d={f:p2,r:y2,D:g2,C:b2,L:v2,m:w2,X:j2,S:k2,M:S2};function p2(){var e=er.f(),n=Bo();return e||n}function y2(e){var n=Ll(e);n!==null&&n.tag===5&&n.type==="form"?nx(n):er.r(e)}var ai=typeof document>"u"?null:document;function Hp(e,n,a){var o=ai;if(o&&typeof n=="string"&&n){var h=wn(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"),bn(n,"link",e),St(n),o.head.appendChild(n)))}}function g2(e){er.D(e),Hp("dns-prefetch",e,null)}function b2(e,n){er.C(e,n),Hp("preconnect",e,n)}function v2(e,n,a){er.L(e,n,a);var o=ai;if(o&&e&&n){var h='link[rel="preload"][as="'+wn(n)+'"]';n==="image"&&a&&a.imageSrcSet?(h+='[imagesrcset="'+wn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(h+='[imagesizes="'+wn(a.imageSizes)+'"]')):h+='[href="'+wn(e)+'"]';var p=h;switch(n){case"style":p=ii(e);break;case"script":p=si(e)}cl.has(p)||(e=y({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:e,as:n},a),cl.set(p,e),o.querySelector(h)!==null||n==="style"&&o.querySelector(os(p))||n==="script"&&o.querySelector(cs(p))||(n=o.createElement("link"),bn(n,"link",e),St(n),o.head.appendChild(n)))}}function w2(e,n){er.m(e,n);var a=ai;if(a&&e){var o=n&&typeof n.as=="string"?n.as:"script",h='link[rel="modulepreload"][as="'+wn(o)+'"][href="'+wn(e)+'"]',p=h;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=si(e)}if(!cl.has(p)&&(e=y({rel:"modulepreload",href:e},n),cl.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"),bn(o,"link",e),St(o),a.head.appendChild(o)}}}function k2(e,n,a){er.S(e,n,a);var o=ai;if(o&&e){var h=vl(o).hoistableStyles,p=ii(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=cl.get(p))&&Od(e,a);var H=w=o.createElement("link");St(H),bn(H,"link",e),H._p=new Promise(function(ee,se){H.onload=ee,H.onerror=se}),H.addEventListener("load",function(){N.loading|=1}),H.addEventListener("error",function(){N.loading|=2}),N.loading|=4,Go(w,n,o)}w={type:"stylesheet",instance:w,count:1,state:N},h.set(p,w)}}}function j2(e,n){er.X(e,n);var a=ai;if(a&&e){var o=vl(a).hoistableScripts,h=si(e),p=o.get(h);p||(p=a.querySelector(cs(h)),p||(e=y({src:e,async:!0},n),(n=cl.get(h))&&Bd(e,n),p=a.createElement("script"),St(p),bn(p,"link",e),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function S2(e,n){er.M(e,n);var a=ai;if(a&&e){var o=vl(a).hoistableScripts,h=si(e),p=o.get(h);p||(p=a.querySelector(cs(h)),p||(e=y({src:e,async:!0,type:"module"},n),(n=cl.get(h))&&Bd(e,n),p=a.createElement("script"),St(p),bn(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=ge.current)?Vo(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=ii(a.href),a=vl(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=ii(a.href);var p=vl(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),cl.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},cl.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=si(a),a=vl(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 ii(e){return'href="'+wn(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}),bn(n,"link",a),St(n),e.head.appendChild(n))}function si(e){return'[src="'+wn(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~="'+wn(a.href)+'"]');if(o)return n.instance=o,St(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"),St(o),bn(o,"style",h),Go(o,a.precedence,e),n.instance=o;case"stylesheet":h=ii(a.href);var p=e.querySelector(os(h));if(p)return n.state.loading|=4,n.instance=p,St(p),p;o=Ip(a),(h=cl.get(h))&&Od(o,h),p=(e.ownerDocument||e).createElement("link"),St(p);var w=p;return w._p=new Promise(function(N,H){w.onload=N,w.onerror=H}),bn(p,"link",o),n.state.loading|=4,Go(p,a.precedence,e),n.instance=p;case"script":return p=si(a.src),(h=e.querySelector(cs(p)))?(n.instance=h,St(h),h):(o=a,(h=cl.get(p))&&(o=y({},a),Bd(o,h)),e=e.ownerDocument||e,h=e.createElement("script"),St(h),bn(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,Go(o,a.precedence,e));return n.instance}function Go(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 Od(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function Bd(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var Ko=null;function qp(e,n,a){if(Ko===null){var o=new Map,h=Ko=new Map;h.set(a,o)}else h=Ko,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[In]||p[Pt]||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=ii(o.href),p=n.querySelector(os(h));if(p){n=p._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=Wo.bind(e),n.then(e,e)),a.state.loading|=4,a.instance=p,St(p);return}p=n.ownerDocument||n,o=Ip(o),(h=cl.get(h))&&Od(o,h),p=p.createElement("link"),St(p);var w=p;w._p=new Promise(function(N,H){w.onload=N,w.onerror=H}),bn(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=Wo.bind(e),n.addEventListener("load",a),n.addEventListener("error",a))}}var Ld=0;function A2(e,n){return e.stylesheets&&e.count===0&&Zo(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var o=setTimeout(function(){if(e.stylesheets&&Zo(e,e.stylesheets),e.unsuspend){var p=e.unsuspend;e.unsuspend=null,p()}},6e4+n);0<e.imgBytes&&Ld===0&&(Ld=62500*o2());var h=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Zo(e,e.stylesheets),e.unsuspend)){var p=e.unsuspend;e.unsuspend=null,p()}},(e.imgBytes>Ld?50:800)+n);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(o),clearTimeout(h)}}:null}function Wo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Zo(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Qo=null;function Zo(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Qo=new Map,n.forEach(D2,e),Qo=null,Wo.call(e))}function D2(e,n){if(!(n.state.loading&4)){var a=Qo.get(e);if(a)var o=a.get(null);else{a=new Map,Qo.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=Wo.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:re,_currentValue2:re,_threadCount:0};function T2(e,n,a,o,h,p,w,N,H){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=Sa(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Sa(0),this.hiddenUpdates=Sa(null),this.identifierPrefix=o,this.onUncaughtError=h,this.onCaughtError=p,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function Gp(e,n,a,o,h,p,w,N,H,ee,se,de){return e=new T2(e,n,a,w,H,ee,se,de,N),n=1,p===!0&&(n|=24),p=Vn(3,null,null,n),e.current=p,p.stateNode=e,n=yu(),n.refCount++,e.pooledCache=n,n.refCount++,p.memoizedState={element:o,isDehydrated:a,cache:n},wu(p),e}function Kp(e){return e?(e=La,e):La}function Wp(e,n,a,o,h,p){h=Kp(h),o.context===null?o.context=h:o.pendingContext=h,o=br(n),o.payload={element:a},p=p===void 0?null:p,p!==null&&(o.callback=p),a=vr(e,o,n),a!==null&&(Ln(a,e,n),Ii(a,e,n))}function Qp(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<n?a:n}}function $d(e,n){Qp(e,n),(e=e.alternate)&&Qp(e,n)}function Zp(e){if(e.tag===13||e.tag===31){var n=ta(e,67108864);n!==null&&Ln(n,e,67108864),$d(e,67108864)}}function Jp(e){if(e.tag===13||e.tag===31){var n=Zn();n=bl(n);var a=ta(e,n);a!==null&&Ln(a,e,n),$d(e,n)}}var Jo=!0;function z2(e,n,a,o){var h=I.T;I.T=null;var p=P.p;try{P.p=2,Hd(e,n,a,o)}finally{P.p=p,I.T=h}}function M2(e,n,a,o){var h=I.T;I.T=null;var p=P.p;try{P.p=8,Hd(e,n,a,o)}finally{P.p=p,I.T=h}}function Hd(e,n,a,o){if(Jo){var h=Ud(o);if(h===null)Ed(e,n,o,Po,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=Ll(h);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var w=Fn(p.pendingLanes);if(w!==0){var N=p;for(N.pendingLanes|=2,N.entangledLanes|=2;w;){var H=1<<31-Qe(w);N.entanglements[1]|=H,w&=~H}Cl(p),(wt&6)===0&&(_o=yt()+500,rs(0))}}break;case 31:case 13:N=ta(p,2),N!==null&&Ln(N,p,2),Bo(),$d(p,2)}if(p=Ud(o),p===null&&Ed(e,n,o,Po,a),p===h)break;h=p}h!==null&&o.stopPropagation()}else Ed(e,n,o,null,a)}}function Ud(e){return e=Ni(e),Id(e)}var Po=null;function Id(e){if(Po=null,e=Bl(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 Po=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(Xt()){case ae:return 2;case me:return 8;case Fe:case Ye:return 32;case xe:return 268435456;default:return 32}default:return 32}}var Yd=!1,zr=null,Mr=null,Fr=null,ds=new Map,fs=new Map,Rr=[],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":zr=null;break;case"dragenter":case"dragleave":Mr=null;break;case"mouseover":case"mouseout":Fr=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=Ll(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 zr=hs(zr,e,n,a,o,h),!0;case"dragenter":return Mr=hs(Mr,e,n,a,o,h),!0;case"mouseover":return Fr=hs(Fr,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=Bl(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,_l(e.priority,function(){Jp(a)});return}}else if(n===31){if(n=m(a),n!==null){e.blockedOn=n,_l(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 ec(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var a=Ud(e.nativeEvent);if(a===null){a=e.nativeEvent;var o=new a.constructor(a.type,a);Ma=o,a.target.dispatchEvent(o),Ma=null}else return n=Ll(a),n!==null&&Zp(n),e.blockedOn=a,!1;n.shift()}return!0}function n1(e,n,a){ec(e)&&a.delete(n)}function _2(){Yd=!1,zr!==null&&ec(zr)&&(zr=null),Mr!==null&&ec(Mr)&&(Mr=null),Fr!==null&&ec(Fr)&&(Fr=null),ds.forEach(n1),fs.forEach(n1)}function tc(e,n){e.blockedOn===n&&(e.blockedOn=null,Yd||(Yd=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,_2)))}var nc=null;function l1(e){nc!==e&&(nc=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){nc===e&&(nc=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(Id(o||a)===null)continue;break}var p=Ll(a);p!==null&&(e.splice(n,3),n-=3,Uu(p,{pending:!0,data:h,method:a.method,action:o},o,h))}}))}function oi(e){function n(H){return tc(H,e)}zr!==null&&tc(zr,e),Mr!==null&&tc(Mr,e),Fr!==null&&tc(Fr,e),ds.forEach(n),fs.forEach(n);for(var a=0;a<Rr.length;a++){var o=Rr[a];o.blockedOn===e&&(o.blockedOn=null)}for(;0<Rr.length&&(a=Rr[0],a.blockedOn===null);)t1(a),a.blockedOn===null&&Rr.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[Qt]||null;if(typeof p=="function")w||l1(a);else if(w){var N=null;if(p&&p.hasAttribute("formAction")){if(h=p,w=p[Qt]||null)N=w.formAction;else if(Id(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 qd(e){this._internalRoot=e}lc.prototype.render=qd.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(i(409));var a=n.current,o=Zn();Wp(a,o,e,n,null,null)},lc.prototype.unmount=qd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;Wp(e.current,2,null,e,null,null),Bo(),n[Ol]=null}};function lc(e){this._internalRoot=e}lc.prototype.unstable_scheduleHydration=function(e){if(e){var n=Rl();e={blockedOn:null,target:e,priority:n};for(var a=0;a<Rr.length&&n!==0&&n<Rr[a].priority;a++);Rr.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"));P.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:I,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var rc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!rc.isDisabled&&rc.supportsFiber)try{$e=rc.inject(O2),Ke=rc}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[Ol]=n.current,Cd(e),new qd(n)},xs.hydrateRoot=function(e,n,a){if(!c(e))throw Error(i(299));var o=!1,h="",p=fx,w=hx,N=mx,H=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&&(H=a.formState)),n=Gp(e,1,!0,n,a??null,o,h,H,p,w,N,r1),n.context=Kp(null),a=n.current,o=Zn(),o=bl(o),h=br(o),h.callback=null,vr(a,h,o),a=o,n.current.lanes=a,fl(n,a),Cl(n),e[Ol]=n.current,Cd(e),new lc(n)},xs.version="19.2.4",xs}var p1;function K2(){if(p1)return Gd.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(),Gd.exports=G2(),Gd.exports}var W2=K2();const Q2="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":Q2,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 Ft(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 Zd(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 Or(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 Ne={getCompany:()=>Ft("/company"),getRoles:()=>Ft("/roles"),getRole:t=>Ft(`/roles/${t}`),getProjects:()=>Ft("/projects"),getProject:t=>Ft(`/projects/${t}`),getStandups:()=>Ft("/operations/standups"),getWaves:()=>Ft("/operations/waves"),getDecisions:()=>Ft("/operations/decisions"),getOrgTree:()=>Ft("/engine/org"),getSkills:()=>Ft("/skills"),exportSkills:t=>Ft(`/skills/export/${t}`),getSkillRegistry:()=>Ft("/skills/registry"),installRegistrySkill:(t,l)=>vn("/skills/registry/install",{skillId:t,url:l}),createRole:t=>vn("/engine/roles",t),updateRole:(t,l)=>Zd(`/engine/roles/${t}`,l),deleteRole:t=>Or(`/engine/roles/${t}`),getSessions:()=>Ft("/sessions"),getSession:t=>Ft(`/sessions/${t}`),createSession:(t,l="talk")=>vn("/sessions",{roleId:t,mode:l}),deleteSession:t=>Or(`/sessions/${t}`),deleteSessions:t=>Or("/sessions",{ids:t}),deleteEmptySessions:()=>Or("/sessions?empty=true"),updateSession:(t,l)=>Zd(`/sessions/${t}`,l),startJob:t=>vn("/jobs",t),getJob:t=>Ft(`/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 Ft(`/jobs${r?"?"+r:""}`)},abortJob:t=>Or(`/jobs/${t}`),replyToJob:(t,l)=>vn(`/jobs/${t}/reply`,{message:l}),saveWave:t=>vn("/waves/save",t),getStatus:()=>Ft("/status"),detectEngine:()=>vn("/setup/detect-engine",{}),validatePath:t=>vn("/setup/validate-path",{path:t}),scaffold:t=>vn("/setup/scaffold",t),getTeams:()=>Ft("/setup/teams"),browse:t=>vn("/setup/browse",{path:t}),connectAkb:t=>vn("/setup/connect-akb",{path:t}),getKnowledge:()=>Ft("/knowledge"),getKnowledgeDoc:t=>{const l=t.split("/").map(encodeURIComponent).join("/");return Ft(`/knowledge/${l}`)},createKnowledgeDoc:t=>vn("/knowledge",t),updateKnowledgeDoc:(t,l)=>{const r=t.split("/").map(encodeURIComponent).join("/");return fetch(`${Ls}/knowledge/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:l})}).then(i=>{if(!i.ok)throw new Error(`API error: ${i.status}`);return i.json()})},deleteKnowledgeDoc:t=>{const l=t.split("/").map(encodeURIComponent).join("/");return Or(`/knowledge/${l}`)},getPreferences:()=>Ft("/preferences"),updatePreferences:t=>Zd("/preferences",t),chatInChannel:t=>vn("/speech/chat",t),getSaveStatus:()=>Ft("/save/status"),save:t=>vn("/save",{message:t}),getSaveHistory:(t=20)=>Ft(`/save/history?limit=${t}`),restoreSave:(t,l)=>vn("/save/restore",{sha:t,paths:l}),initGit:()=>vn("/save/init",{}),getCostSummary:()=>Ft("/cost/summary"),getSyncRoles:()=>Ft("/sync/roles"),applySyncUpdate:t=>vn("/sync/apply",t),getCompanyStats:()=>Ft("/sync/stats"),getGitStatus:()=>Ft("/git/status"),deleteWorktree:t=>Or(`/git/worktrees/${encodeURIComponent(t)}`),deleteBranch:t=>Or(`/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(),B=new TextDecoder;let $="";for(;;){const{done:_,value:V}=await F.read();if(_)break;$+=B.decode(V,{stream:!0});const K=$.split(`
|
|
50
|
-
`);$=K.pop()??"";let Y="";for(const T of K)if(T.startsWith("event: "))Y=T.slice(7).trim();else if(T.startsWith("data: ")){try{const U=JSON.parse(T.slice(6));if(Y==="activity"){const O=U;O.seq>f.current&&(f.current=O.seq),r(Z=>Z.some(ne=>ne.seq===O.seq)?Z:[...Z,O]),O.type==="text"&&d(Z=>Z+(O.data.text??"")),O.type==="dispatch:start"&&O.data.childJobId&&x(Z=>[...Z,O.data.childJobId]),O.type==="job:done"?c("done"):O.type==="job:error"&&c("error")}else if(Y==="stream:end"){const O=U.reason;c(O==="done"?"done":O==="error"?"error":"done")}}catch{}Y=""}}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 W0(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 Bf(t){return t.toLowerCase()}class Hn{constructor(l,r){this.attribute=r,this.property=l}}Hn.prototype.attribute="";Hn.prototype.booleanish=!1;Hn.prototype.boolean=!1;Hn.prototype.commaOrSpaceSeparated=!1;Hn.prototype.commaSeparated=!1;Hn.prototype.defined=!1;Hn.prototype.mustUseProperty=!1;Hn.prototype.number=!1;Hn.prototype.overloadedBoolean=!1;Hn.prototype.property="";Hn.prototype.spaceSeparated=!1;Hn.prototype.space=void 0;let iv=0;const lt=ja(),rn=ja(),Lf=ja(),je=ja(),_t=ja(),mi=ja(),Jn=ja();function ja(){return 2**++iv}const $f=Object.freeze(Object.defineProperty({__proto__:null,boolean:lt,booleanish:rn,commaOrSpaceSeparated:Jn,commaSeparated:mi,number:je,overloadedBoolean:Lf,spaceSeparated:_t},Symbol.toStringTag,{value:"Module"})),Jd=Object.keys($f);class rh extends Hn{constructor(l,r,i,c){let u=-1;if(super(l,r),v1(this,"space",c),typeof i=="number")for(;++u<Jd.length;){const d=Jd[u];v1(this,Jd[u],(i&$f[d])===$f[d])}}}rh.prototype.defined=!0;function v1(t,l,r){r&&(t[l]=r)}function bi(t){const l={},r={};for(const[i,c]of Object.entries(t.properties)){const u=new rh(i,t.transform(t.attributes||{},i),c,t.space);t.mustUseProperty&&t.mustUseProperty.includes(i)&&(u.mustUseProperty=!0),l[i]=u,r[Bf(i)]=i,r[Bf(u.attribute)]=i}return new $s(l,r,t.space)}const Q0=bi({properties:{ariaActiveDescendant:null,ariaAtomic:rn,ariaAutoComplete:null,ariaBusy:rn,ariaChecked:rn,ariaColCount:je,ariaColIndex:je,ariaColSpan:je,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:je,ariaLive:null,ariaModal:rn,ariaMultiLine:rn,ariaMultiSelectable:rn,ariaOrientation:null,ariaOwns:_t,ariaPlaceholder:null,ariaPosInSet:je,ariaPressed:rn,ariaReadOnly:rn,ariaRelevant:null,ariaRequired:rn,ariaRoleDescription:_t,ariaRowCount:je,ariaRowIndex:je,ariaRowSpan:je,ariaSelected:rn,ariaSetSize:je,ariaSort:null,ariaValueMax:je,ariaValueMin:je,ariaValueNow:je,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=bi({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:mi,acceptCharset:_t,accessKey:_t,action:null,allow:null,allowFullScreen:lt,allowPaymentRequest:lt,allowUserMedia:lt,alt:null,as:null,async:lt,autoCapitalize:null,autoComplete:_t,autoFocus:lt,autoPlay:lt,blocking:_t,capture:null,charSet:null,checked:lt,cite:null,className:_t,cols:je,colSpan:null,content:null,contentEditable:rn,controls:lt,controlsList:_t,coords:je|mi,crossOrigin:null,data:null,dateTime:null,decoding:null,default:lt,defer:lt,dir:null,dirName:null,disabled:lt,download:Lf,draggable:rn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:lt,formTarget:null,headers:_t,height:je,hidden:Lf,high:je,href:null,hrefLang:null,htmlFor:_t,httpEquiv:_t,id:null,imageSizes:null,imageSrcSet:null,inert:lt,inputMode:null,integrity:null,is:null,isMap:lt,itemId:null,itemProp:_t,itemRef:_t,itemScope:lt,itemType:_t,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:lt,low:je,manifest:null,max:null,maxLength:je,media:null,method:null,min:null,minLength:je,multiple:lt,muted:lt,name:null,nonce:null,noModule:lt,noValidate:lt,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:lt,optimum:je,pattern:null,ping:_t,placeholder:null,playsInline:lt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:lt,referrerPolicy:null,rel:_t,required:lt,reversed:lt,rows:je,rowSpan:je,sandbox:_t,scope:null,scoped:lt,seamless:lt,selected:lt,shadowRootClonable:lt,shadowRootDelegatesFocus:lt,shadowRootMode:null,shape:null,size:je,sizes:null,slot:null,span:je,spellCheck:rn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:je,step:null,style:null,tabIndex:je,target:null,title:null,translate:null,type:null,typeMustMatch:lt,useMap:null,value:rn,width:je,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:_t,axis:null,background:null,bgColor:null,border:je,borderColor:null,bottomMargin:je,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:lt,declare:lt,event:null,face:null,frame:null,frameBorder:null,hSpace:je,leftMargin:je,link:null,longDesc:null,lowSrc:null,marginHeight:je,marginWidth:je,noResize:lt,noHref:lt,noShade:lt,noWrap:lt,object:null,profile:null,prompt:null,rev:null,rightMargin:je,rules:null,scheme:null,scrolling:rn,standby:null,summary:null,text:null,topMargin:je,valueType:null,version:null,vAlign:null,vLink:null,vSpace:je,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:lt,disableRemotePlayback:lt,prefix:null,property:null,results:je,security:null,unselectable:null},space:"html",transform:J0}),ov=bi({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:Jn,accentHeight:je,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:je,amplitude:je,arabicForm:null,ascent:je,attributeName:null,attributeType:null,azimuth:je,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:je,by:null,calcMode:null,capHeight:je,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:je,diffuseConstant:je,direction:null,display:null,dur:null,divisor:je,dominantBaseline:null,download:lt,dx:null,dy:null,edgeMode:null,editable:null,elevation:je,enableBackground:null,end:null,event:null,exponent:je,externalResourcesRequired:null,fill:null,fillOpacity:je,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:mi,g2:mi,glyphName:mi,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:je,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:je,horizOriginX:je,horizOriginY:je,id:null,ideographic:je,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:je,k:je,k1:je,k2:je,k3:je,k4:je,kernelMatrix:Jn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:je,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:je,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:je,overlineThickness:je,paintOrder:null,panose1:null,path:null,pathLength:je,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:_t,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:je,pointsAtY:je,pointsAtZ:je,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Jn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Jn,rev:Jn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Jn,requiredFeatures:Jn,requiredFonts:Jn,requiredFormats:Jn,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:je,specularExponent:je,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:je,strikethroughThickness:je,string:null,stroke:null,strokeDashArray:Jn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:je,strokeOpacity:je,strokeWidth:null,style:null,surfaceScale:je,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Jn,tabIndex:je,tableValues:null,target:null,targetX:je,targetY:je,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Jn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:je,underlineThickness:je,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:je,values:null,vAlphabetic:je,vMathematical:je,vectorEffect:null,vHanging:je,vIdeographic:je,version:null,vertAdvY:je,vertOriginX:je,vertOriginY:je,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:je,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Z0}),P0=bi({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=bi({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:J0}),ty=bi({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=Bf(l);let i=l,c=Hn;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=rh}return new c(i,l)}function hv(t){return"-"+t.toLowerCase()}function mv(t){return t.charAt(1).toUpperCase()}const xv=W0([Q0,sv,P0,ey,ty],"html"),ah=W0([Q0,ov,P0,ey,ty],"svg");function pv(t){return t.join(" ").trim()}var ci={},Pd,k1;function yv(){if(k1)return Pd;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 B(ne){var W=ne.match(l);W&&(A+=W.length);var I=ne.lastIndexOf(x);F=~I?ne.length-I:F+ne.length}function $(){var ne={line:A,column:F};return function(W){return W.position=new _(ne),Y(),W}}function _(ne){this.start=ne,this.end={line:A,column:F},this.source=C.source}_.prototype.content=E;function V(ne){var W=new Error(C.source+":"+A+":"+F+": "+ne);if(W.reason=ne,W.filename=C.source,W.line=A,W.column=F,W.source=E,!C.silent)throw W}function K(ne){var W=ne.exec(E);if(W){var I=W[0];return B(I),E=E.slice(I.length),W}}function Y(){K(r)}function T(ne){var W;for(ne=ne||[];W=U();)W!==!1&&ne.push(W);return ne}function U(){var ne=$();if(!(f!=E.charAt(0)||g!=E.charAt(1))){for(var W=2;y!=E.charAt(W)&&(g!=E.charAt(W)||f!=E.charAt(W+1));)++W;if(W+=2,y===E.charAt(W-1))return V("End of comment missing");var I=E.slice(2,W-2);return F+=2,B(I),E=E.slice(W),F+=2,ne({type:b,comment:I})}}function O(){var ne=$(),W=K(i);if(W){if(U(),!K(c))return V("property missing ':'");var I=K(u),P=ne({type:v,property:j(W[0].replace(t,y)),value:I?j(I[0].replace(t,y)):y});return K(d),P}}function Z(){var ne=[];T(ne);for(var W;W=O();)W!==!1&&(ne.push(W),T(ne));return ne}return Y(),Z()}function j(E){return E?E.replace(m,y):y}return Pd=S,Pd}var j1;function gv(){if(j1)return ci;j1=1;var t=ci&&ci.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(ci,"__esModule",{value:!0}),ci.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 ci}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"),ih=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=ih(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?Hf(t):""}function Hf(t){return N1(t&&t.line)+":"+N1(t&&t.column)}function E1(t){return Hf(t&&t.start)+"-"+Hf(t&&t.end)}function N1(t){return t&&typeof t=="number"?t:1}class Cn 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}}Cn.prototype.file="";Cn.prototype.name="";Cn.prototype.reason="";Cn.prototype.message="";Cn.prototype.stack="";Cn.prototype.column=void 0;Cn.prototype.line=void 0;Cn.prototype.ancestors=void 0;Cn.prototype.cause=void 0;Cn.prototype.fatal=void 0;Cn.prototype.place=void 0;Cn.prototype.ruleId=void 0;Cn.prototype.source=void 0;const sh={}.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"?ah: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 Dv(t,l,r);if(l.type==="mdxFlowExpression"||l.type==="mdxTextExpression")return Tv(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 Dv(t,l,r){const i=t.schema;let c=i;l.tagName.toLowerCase()==="svg"&&i.space==="html"&&(c=ah,t.schema=c),t.ancestors.push(l);const u=sy(t,l.tagName,!1),d=Bv(t,l);let m=ch(t,l);return Ev.has(l.tagName)&&(m=m.filter(function(x){return typeof x=="string"?!av(x):!0})),iy(t,d,u,l),oh(d,m),t.ancestors.pop(),t.schema=i,t.create(l,u,d,r)}function Tv(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=ah,t.schema=c),t.ancestors.push(l);const u=l.name===null?t.Fragment:sy(t,l.name,!0),d=Lv(t,l),m=ch(t,l);return iy(t,d,u,l),oh(d,m),t.ancestors.pop(),t.schema=i,t.create(l,u,d,r)}function Fv(t,l,r){const i={};return oh(i,ch(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 oh(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=ih(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"&&sh.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 ch(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 Cn("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 sh.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 Cn("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)sh.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 ef={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 uh(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 D1=document.createElement("i");function dh(t){const l="&"+t+";";D1.innerHTML=l;const r=D1.textContent;return r.charCodeAt(r.length-1)===59&&t!=="semi"||r===l?!1:r}function el(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 ul(t,l){return t.length>0?(el(t,t.length,0,l),t):l}const T1={}.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=(T1.call(t,r)?t[r]:void 0)||(t[r]={}),u=l[r];let d;if(u)for(d in u){T1.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]);el(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 gl(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Tn=qr(/[A-Za-z]/),Sn=qr(/[\dA-Za-z]/),Kv=qr(/[#-'*+\--9=?A-Z^-~]/);function Ac(t){return t!==null&&(t<32||t===127)}const Uf=qr(/\d/),Wv=qr(/[\dA-Fa-f]/),Qv=qr(/[!-/:-@[-`{-~]/);function qe(t){return t!==null&&t<-2}function Rt(t){return t!==null&&(t<0||t===32)}function ut(t){return t===-2||t===-1||t===32}const Lc=qr(new RegExp("\\p{P}|\\p{S}","u")),wa=qr(/\s/);function qr(t){return l;function l(r){return r!==null&&r>-1&&t.test(String.fromCharCode(r))}}function vi(t){const l=[];let r=-1,i=0,c=0;for(;++r<t.length;){const u=t.charCodeAt(r);let d="";if(u===37&&Sn(t.charCodeAt(r+1))&&Sn(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 ut(x)?(t.enter(r),m(x)):l(x)}function m(x){return ut(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 B=r[i];return l.containerState=B[1],t.attempt(B[0].continuation,x,f)(F)}return f(F)}function x(F){if(i++,l.containerState._closeFlow){l.containerState._closeFlow=void 0,c&&A();const B=l.events.length;let $=B,_;for(;$--;)if(l.events[$][0]==="exit"&&l.events[$][1].type==="chunkFlow"){_=l.events[$][1].end;break}C(i);let V=B;for(;V<l.events.length;)l.events[V][1].end={..._},V++;return el(l.events,$+1,0,l.events.slice(B)),l.events.length=V,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,B){const $=l.sliceStream(F);if(B&&$.push(null),F.previous=u,u&&(u.next=F),u=F,c.defineSkip(F.start),c.write($),l.parser.lazy[F.start.line]){let _=c.events.length;for(;_--;)if(c.events[_][1].start.offset<d&&(!c.events[_][1].end||c.events[_][1].end.offset>d))return;const V=l.events.length;let K=V,Y,T;for(;K--;)if(l.events[K][0]==="exit"&&l.events[K][1].type==="chunkFlow"){if(Y){T=l.events[K][1].end;break}Y=!0}for(C(i),_=V;_<l.events.length;)l.events[_][1].end={...T},_++;el(l.events,K+1,0,l.events.slice(V)),l.events.length=_}}function C(F){let B=r.length;for(;B-- >F;){const $=r[B];l.containerState=$[1],$[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 pi(t){if(t===null||Rt(t)||wa(t))return 1;if(Lc(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 If={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=ul(f,[["enter",t[i][1],l],["exit",t[i][1],l]])),f=ul(f,[["enter",c,l],["enter",d,l],["exit",d,l],["enter",u,l]]),f=ul(f,$c(l.parser.constructs.insideSpan.null,t.slice(i+1,r),l)),f=ul(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=ul(f,[["enter",t[r][1],l],["exit",t[r][1],l]])):g=0,el(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=pi(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=pi(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 Tn(v)?(t.consume(v),d):v===64?r(v):f(v)}function d(v){return v===43||v===45||v===46||Sn(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||Sn(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||Ac(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 Sn(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||Sn(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 ut(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 ut(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 ut(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 Qv(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=Sn,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=Wv,g):(t.enter("characterReferenceValue"),u=7,d=Uf,g(y))}function g(y){if(y===59&&c){const b=t.exit("characterReferenceValue");return d===Sn&&!dh(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:$};let u=0,d=0,m;return x;function x(_){return f(_)}function f(_){const V=i.events[i.events.length-1];return u=V&&V[1].type==="linePrefix"?V[2].sliceSerialize(V[1],!0).length:0,m=_,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),g(_)}function g(_){return _===m?(d++,t.consume(_),g):d<3?r(_):(t.exit("codeFencedFenceSequence"),ut(_)?pt(t,y,"whitespace")(_):y(_))}function y(_){return _===null||qe(_)?(t.exit("codeFencedFence"),i.interrupt?l(_):t.check(F1,j,B)(_)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),b(_))}function b(_){return _===null||qe(_)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),y(_)):ut(_)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),pt(t,v,"whitespace")(_)):_===96&&_===m?r(_):(t.consume(_),b)}function v(_){return _===null||qe(_)?y(_):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),S(_))}function S(_){return _===null||qe(_)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),y(_)):_===96&&_===m?r(_):(t.consume(_),S)}function j(_){return t.attempt(c,B,E)(_)}function E(_){return t.enter("lineEnding"),t.consume(_),t.exit("lineEnding"),C}function C(_){return u>0&&ut(_)?pt(t,A,"linePrefix",u+1)(_):A(_)}function A(_){return _===null||qe(_)?t.check(F1,j,B)(_):(t.enter("codeFlowValue"),F(_))}function F(_){return _===null||qe(_)?(t.exit("codeFlowValue"),A(_)):(t.consume(_),F)}function B(_){return t.exit("codeFenced"),l(_)}function $(_,V,K){let Y=0;return T;function T(W){return _.enter("lineEnding"),_.consume(W),_.exit("lineEnding"),U}function U(W){return _.enter("codeFencedFence"),ut(W)?pt(_,O,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(W):O(W)}function O(W){return W===m?(_.enter("codeFencedFenceSequence"),Z(W)):K(W)}function Z(W){return W===m?(Y++,_.consume(W),Z):Y>=d?(_.exit("codeFencedFenceSequence"),ut(W)?pt(_,ne,"whitespace")(W):ne(W)):K(W)}function ne(W){return W===null||qe(W)?(_.exit("codeFencedFence"),V(W)):K(W)}}}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 tf={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 el(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||Ac(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||Rt(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||Ac(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=!ut(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 Ds(t,l){let r;return i;function i(c){return qe(c)?(t.enter("lineEnding"),t.consume(c),t.exit("lineEnding"),r=!0,i):ut(c)?pt(t,i,r?"linePrefix":"lineSuffix")(c):l(c)}}const Aw={name:"definition",tokenize:Tw},Dw={partial:!0,tokenize:zw};function Tw(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=gl(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 Rt(v)?Ds(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(Dw,y,y)(v)}function y(v){return ut(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 Rt(m)?Ds(t,c)(m):r(m)}function c(m){return yy(t,u,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(m)}function u(m){return ut(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"},el(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||Rt(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)):ut(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||Rt(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(D){return g(D)}function g(D){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(D),y}function y(D){return D===33?(t.consume(D),b):D===47?(t.consume(D),u=!0,j):D===63?(t.consume(D),c=3,i.interrupt?l:M):Tn(D)?(t.consume(D),d=String.fromCharCode(D),E):r(D)}function b(D){return D===45?(t.consume(D),c=2,v):D===91?(t.consume(D),c=5,m=0,S):Tn(D)?(t.consume(D),c=4,i.interrupt?l:M):r(D)}function v(D){return D===45?(t.consume(D),i.interrupt?l:M):r(D)}function S(D){const ue="CDATA[";return D===ue.charCodeAt(m++)?(t.consume(D),m===ue.length?i.interrupt?l:O:S):r(D)}function j(D){return Tn(D)?(t.consume(D),d=String.fromCharCode(D),E):r(D)}function E(D){if(D===null||D===47||D===62||Rt(D)){const ue=D===47,Ee=d.toLowerCase();return!ue&&!u&&_1.includes(Ee)?(c=1,i.interrupt?l(D):O(D)):Bw.includes(d.toLowerCase())?(c=6,ue?(t.consume(D),C):i.interrupt?l(D):O(D)):(c=7,i.interrupt&&!i.parser.lazy[i.now().line]?r(D):u?A(D):F(D))}return D===45||Sn(D)?(t.consume(D),d+=String.fromCharCode(D),E):r(D)}function C(D){return D===62?(t.consume(D),i.interrupt?l:O):r(D)}function A(D){return ut(D)?(t.consume(D),A):T(D)}function F(D){return D===47?(t.consume(D),T):D===58||D===95||Tn(D)?(t.consume(D),B):ut(D)?(t.consume(D),F):T(D)}function B(D){return D===45||D===46||D===58||D===95||Sn(D)?(t.consume(D),B):$(D)}function $(D){return D===61?(t.consume(D),_):ut(D)?(t.consume(D),$):F(D)}function _(D){return D===null||D===60||D===61||D===62||D===96?r(D):D===34||D===39?(t.consume(D),x=D,V):ut(D)?(t.consume(D),_):K(D)}function V(D){return D===x?(t.consume(D),x=null,Y):D===null||qe(D)?r(D):(t.consume(D),V)}function K(D){return D===null||D===34||D===39||D===47||D===60||D===61||D===62||D===96||Rt(D)?$(D):(t.consume(D),K)}function Y(D){return D===47||D===62||ut(D)?F(D):r(D)}function T(D){return D===62?(t.consume(D),U):r(D)}function U(D){return D===null||qe(D)?O(D):ut(D)?(t.consume(D),U):r(D)}function O(D){return D===45&&c===2?(t.consume(D),I):D===60&&c===1?(t.consume(D),P):D===62&&c===4?(t.consume(D),z):D===63&&c===3?(t.consume(D),M):D===93&&c===5?(t.consume(D),ke):qe(D)&&(c===6||c===7)?(t.exit("htmlFlowData"),t.check($w,G,Z)(D)):D===null||qe(D)?(t.exit("htmlFlowData"),Z(D)):(t.consume(D),O)}function Z(D){return t.check(Hw,ne,G)(D)}function ne(D){return t.enter("lineEnding"),t.consume(D),t.exit("lineEnding"),W}function W(D){return D===null||qe(D)?Z(D):(t.enter("htmlFlowData"),O(D))}function I(D){return D===45?(t.consume(D),M):O(D)}function P(D){return D===47?(t.consume(D),d="",re):O(D)}function re(D){if(D===62){const ue=d.toLowerCase();return _1.includes(ue)?(t.consume(D),z):O(D)}return Tn(D)&&d.length<8?(t.consume(D),d+=String.fromCharCode(D),re):O(D)}function ke(D){return D===93?(t.consume(D),M):O(D)}function M(D){return D===62?(t.consume(D),z):D===45&&c===2?(t.consume(D),M):O(D)}function z(D){return D===null||qe(D)?(t.exit("htmlFlowData"),G(D)):(t.consume(D),z)}function G(D){return t.exit("htmlFlow"),l(D)}}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(M){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(M),x}function x(M){return M===33?(t.consume(M),f):M===47?(t.consume(M),$):M===63?(t.consume(M),F):Tn(M)?(t.consume(M),K):r(M)}function f(M){return M===45?(t.consume(M),g):M===91?(t.consume(M),u=0,S):Tn(M)?(t.consume(M),A):r(M)}function g(M){return M===45?(t.consume(M),v):r(M)}function y(M){return M===null?r(M):M===45?(t.consume(M),b):qe(M)?(d=y,P(M)):(t.consume(M),y)}function b(M){return M===45?(t.consume(M),v):y(M)}function v(M){return M===62?I(M):M===45?b(M):y(M)}function S(M){const z="CDATA[";return M===z.charCodeAt(u++)?(t.consume(M),u===z.length?j:S):r(M)}function j(M){return M===null?r(M):M===93?(t.consume(M),E):qe(M)?(d=j,P(M)):(t.consume(M),j)}function E(M){return M===93?(t.consume(M),C):j(M)}function C(M){return M===62?I(M):M===93?(t.consume(M),C):j(M)}function A(M){return M===null||M===62?I(M):qe(M)?(d=A,P(M)):(t.consume(M),A)}function F(M){return M===null?r(M):M===63?(t.consume(M),B):qe(M)?(d=F,P(M)):(t.consume(M),F)}function B(M){return M===62?I(M):F(M)}function $(M){return Tn(M)?(t.consume(M),_):r(M)}function _(M){return M===45||Sn(M)?(t.consume(M),_):V(M)}function V(M){return qe(M)?(d=V,P(M)):ut(M)?(t.consume(M),V):I(M)}function K(M){return M===45||Sn(M)?(t.consume(M),K):M===47||M===62||Rt(M)?Y(M):r(M)}function Y(M){return M===47?(t.consume(M),I):M===58||M===95||Tn(M)?(t.consume(M),T):qe(M)?(d=Y,P(M)):ut(M)?(t.consume(M),Y):I(M)}function T(M){return M===45||M===46||M===58||M===95||Sn(M)?(t.consume(M),T):U(M)}function U(M){return M===61?(t.consume(M),O):qe(M)?(d=U,P(M)):ut(M)?(t.consume(M),U):Y(M)}function O(M){return M===null||M===60||M===61||M===62||M===96?r(M):M===34||M===39?(t.consume(M),c=M,Z):qe(M)?(d=O,P(M)):ut(M)?(t.consume(M),O):(t.consume(M),ne)}function Z(M){return M===c?(t.consume(M),c=void 0,W):M===null?r(M):qe(M)?(d=Z,P(M)):(t.consume(M),Z)}function ne(M){return M===null||M===34||M===39||M===60||M===61||M===96?r(M):M===47||M===62||Rt(M)?Y(M):(t.consume(M),ne)}function W(M){return M===47||M===62||Rt(M)?Y(M):r(M)}function I(M){return M===62?(t.consume(M),t.exit("htmlTextData"),t.exit("htmlText"),l):r(M)}function P(M){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(M),t.exit("lineEnding"),re}function re(M){return ut(M)?pt(t,ke,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):ke(M)}function ke(M){return t.enter("htmlTextData"),d(M)}}const fh={name:"labelEnd",resolveAll:Qw,resolveTo:Zw,tokenize:Jw},Gw={tokenize:Pw},Kw={tokenize:e5},Ww={tokenize:t5};function Qw(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&&el(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=ul(m,t.slice(u+1,u+i+3)),m=ul(m,[["enter",g,l]]),m=ul(m,$c(l.parser.constructs.insideSpan.null,t.slice(u+i+4,d-3),l)),m=ul(m,[["exit",g,l],t[d-2],t[d-1],["exit",f,l]]),m=ul(m,t.slice(d+1)),m=ul(m,[["exit",x,l]]),el(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(gl(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(Ww,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 Rt(y)?Ds(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 Rt(y)?Ds(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 Rt(y)?Ds(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(gl(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:fh.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:fh.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 nf={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 kc={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"),ut(f)?pt(t,m,"whitespace")(f):m(f))}}const $n={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:Uf(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(kc,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 Uf(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 ut(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||!ut(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($n,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!ut(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"),ut(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:$n,43:$n,45:$n,48:$n,49:$n,50:$n,51:$n,52:$n,53:$n,54:$n,55:$n,56:$n,57:$n,62:dy},S5={91:Aw},C5={[-2]:tf,[-1]:tf,32:tf},E5={35:Rw,42:kc,45:[O1,kc],60:Lw,61:O1,95:kc,96:R1,126:R1},N5={38:hy,92:fy},A5={[-5]:nf,[-4]:nf,[-3]:nf,33:n5,38:hy,42:If,60:[rw,Xw],91:r5,92:[Mw,fy],93:fh,95:If,96:yw},D5={null:[If,b5]},T5={null:[42,95]},z5={null:[]},M5=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:T5,contentInitial:S5,disable:z5,document:j5,flow:E5,flowInitial:C5,insideSpan:D5,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:V($),check:V(_),consume:A,enter:F,exit:B,interrupt:V(_,{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(U){return d=ul(d,U),E(),d[d.length-1]!==null?[]:(K(l,0),f.events=$c(u,f.events,f),f.events)}function b(U,O){return _5(v(U),O)}function v(U){return R5(d,U)}function S(){const{_bufferIndex:U,_index:O,line:Z,column:ne,offset:W}=i;return{_bufferIndex:U,_index:O,line:Z,column:ne,offset:W}}function j(U){c[U.line]=U.column,T()}function E(){let U;for(;i._index<d.length;){const O=d[i._index];if(typeof O=="string")for(U=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===U&&i._bufferIndex<O.length;)C(O.charCodeAt(i._bufferIndex));else C(O)}}function C(U){g=g(U)}function A(U){qe(U)?(i.line++,i.column=1,i.offset+=U===-3?2:1,T()):U!==-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=U}function F(U,O){const Z=O||{};return Z.type=U,Z.start=S(),f.events.push(["enter",Z,f]),m.push(Z),Z}function B(U){const O=m.pop();return O.end=S(),f.events.push(["exit",O,f]),O}function $(U,O){K(U,O.from)}function _(U,O){O.restore()}function V(U,O){return Z;function Z(ne,W,I){let P,re,ke,M;return Array.isArray(ne)?G(ne):"tokenize"in ne?G([ne]):z(ne);function z(ge){return Ae;function Ae(De){const He=De!==null&&ge[De],ye=De!==null&&ge.null,We=[...Array.isArray(He)?He:He?[He]:[],...Array.isArray(ye)?ye:ye?[ye]:[]];return G(We)(De)}}function G(ge){return P=ge,re=0,ge.length===0?I:D(ge[re])}function D(ge){return Ae;function Ae(De){return M=Y(),ke=ge,ge.partial||(f.currentConstruct=ge),ge.name&&f.parser.constructs.disable.null.includes(ge.name)?Ee():ge.tokenize.call(O?Object.assign(Object.create(f),O):f,x,ue,Ee)(De)}}function ue(ge){return U(ke,M),W}function Ee(ge){return M.restore(),++re<P.length?D(P[re]):I}}}function K(U,O){U.resolveAll&&!u.includes(U)&&u.push(U),U.resolve&&el(f.events,O,f.events.length-O,U.resolve(f.events.slice(O),f)),U.resolveTo&&(f.events=U.resolveTo(f.events,f))}function Y(){const U=S(),O=f.previous,Z=f.currentConstruct,ne=f.events.length,W=Array.from(m);return{from:ne,restore:I};function I(){i=U,f.previous=O,f.currentConstruct=Z,f.events.length=ne,m=W,T()}}function T(){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 we=Object.prototype.hasOwnProperty,Be=t.unstable_scheduleCallback,tt=t.unstable_cancelCallback,jt=t.unstable_shouldYield,Ut=t.unstable_requestPaint,yt=t.unstable_now,Vt=t.unstable_getCurrentPriorityLevel,ie=t.unstable_ImmediatePriority,me=t.unstable_UserBlockingPriority,Fe=t.unstable_NormalPriority,Ge=t.unstable_LowPriority,ye=t.unstable_IdlePriority,q=t.log,Te=t.unstable_setDisableYieldValue,He=null,Je=null;function mt(e){if(typeof q=="function"&&Te(e),Je&&typeof Je.setStrictMode=="function")try{Je.setStrictMode(He,e)}catch{}}var et=Math.clz32?Math.clz32:Nt,Yt=Math.log,cn=Math.LN2;function Nt(e){return e>>>=0,e===0?32:31-(Yt(e)/cn|0)|0}var hr=256,xl=262144,mr=4194304;function On(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 Nn(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=On(o):(w&=N,w!==0?h=On(w):a||(a=N&~e,a!==0&&(h=On(a))))):(N=o&~p,N!==0?h=On(N):w!==0?h=On(w):a||(a=o&~e,a!==0&&(h=On(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 un(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function ke(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 Qt(){var e=mr;return mr<<=1,(mr&62914560)===0&&(mr=4194304),e}function Oa(e){for(var n=[],a=0;31>a;a++)n.push(e);return n}function pl(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ps(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,H=e.expirationTimes,ee=e.hiddenUpdates;for(a=w&~a;0<a;){var oe=31-et(a),de=1<<oe;N[oe]=0,H[oe]=-1;var te=ee[oe];if(te!==null)for(ee[oe]=null,oe=0;oe<te.length;oe++){var re=te[oe];re!==null&&(re.lane&=-536870913)}a&=~de}o!==0&&Ba(e,o,0),p!==0&&h===0&&e.tag!==0&&(e.suspendedLanes|=p&~(w&~n))}function Ba(e,n,a){e.pendingLanes|=n,e.suspendedLanes&=~n;var o=31-et(n);e.entangledLanes|=n,e.entanglements[o]=e.entanglements[o]|1073741824|a&261930}function Xn(e,n){var a=e.entangledLanes|=n;for(e=e.entanglements;a;){var o=31-et(a),h=1<<o;h&n|e[o]&n&&(e[o]|=n),a&=~h}}function eo(e,n){var a=n&-n;return a=(a&42)!==0?1:El(a),(a&(e.suspendedLanes|n))!==0?0:a}function El(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 ia(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Ul(){var e=P.p;return e!==0?e:(e=window.event,e===void 0?32:l1(e.type))}function Il(e,n){var a=P.p;try{return P.p=e,n()}finally{P.p=a}}var An=Math.random().toString(36).slice(2),tn="__reactFiber$"+An,Zt="__reactProps$"+An,Yl="__reactContainer$"+An,$a="__reactEvents$"+An,Mi="__reactListeners$"+An,to="__reactHandles$"+An,Fi="__reactResources$"+An,Vn="__reactMarker$"+An;function sa(e){delete e[tn],delete e[Zt],delete e[$a],delete e[Mi],delete e[to]}function ql(e){var n=e[tn];if(n)return n;for(var a=e.parentNode;a;){if(n=a[Yl]||a[tn]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(e=Up(e);e!==null;){if(a=e[tn])return a;e=Up(e)}return n}e=a,a=e.parentNode}return null}function Xl(e){if(e=e[tn]||e[Yl]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function oa(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(i(33))}function Nl(e){var n=e[Fi];return n||(n=e[Fi]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function St(e){e[Vn]=!0}var yl=new Set,xr={};function Vl(e,n){Dn(e,n),Dn(e+"Capture",n)}function Dn(e,n){for(xr[e]=n,e=0;e<n.length;e++)yl.add(n[e])}var qt=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]*$"),pr={},Tn={};function ca(e){return we.call(Tn,e)?!0:we.call(pr,e)?!1:qt.test(e)?Tn[e]=!0:(pr[e]=!0,!1)}function yr(e,n,a){if(ca(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 La(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 zn(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 xn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function gr(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Qc(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 _t(e){if(!e._valueTracker){var n=gr(e)?"checked":"value";e._valueTracker=Qc(e,n,""+e[n])}}function Ri(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var a=n.getValue(),o="";return e&&(o=gr(e)?e.checked?"true":"false":e.value),e=o,e!==a?(n.setValue(e),!0):!1}function Ha(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 Zc=/[\n"\\]/g;function Bn(e){return e.replace(Zc,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function ua(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=""+xn(n)):e.value!==""+xn(n)&&(e.value=""+xn(n)):w!=="submit"&&w!=="reset"||e.removeAttribute("value"),n!=null?_i(e,w,xn(n)):a!=null?_i(e,w,xn(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=""+xn(N):e.removeAttribute("name")}function Ua(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)){_t(e);return}a=a!=null?""+xn(a):"",n=n!=null?""+xn(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),_t(e)}function _i(e,n,a){n==="number"&&Ha(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function br(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=""+xn(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 Oi(e,n,a){if(n!=null&&(n=""+xn(n),n!==e.value&&(e.value=n),a==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=a!=null?""+xn(a):""}function no(e,n,a,o){if(n==null){if(o!=null){if(a!=null)throw Error(i(92));if(W(o)){if(1<o.length)throw Error(i(93));o=o[0]}a=o}a==null&&(a=""),n=a}a=xn(n),e.defaultValue=a,o=e.textContent,o===a&&o!==""&&o!==null&&(e.value=o),_t(e)}function vr(e,n){if(n){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=n;return}}e.textContent=n}var Jc=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 lo(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||Jc.has(n)?n==="float"?e.cssFloat=a:e[n]=(""+a).trim():e[n]=a+"px"}function ro(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&&lo(e,h,o)}else for(var p in n)n.hasOwnProperty(p)&&lo(e,p,n[p])}function Bi(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 Pc=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"]]),Al=/^[\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 wr(e){return Al.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function gl(){}var $i=null;function ll(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Gl=null,kr=null;function ao(e){var n=Xl(e);if(n&&(e=n.stateNode)){var a=e[Zt]||null;e:switch(e=n.stateNode,n.type){case"input":if(ua(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="'+Bn(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var o=a[n];if(o!==e&&o.form===e.form){var h=o[Zt]||null;if(!h)throw Error(i(90));ua(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&&Ri(o)}break e;case"textarea":Oi(e,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&br(e,!!a.multiple,n,!1)}}}var nn=!1;function jr(e,n,a){if(nn)return e(n,a);nn=!0;try{var o=e(n);return o}finally{if(nn=!1,(Gl!==null||kr!==null)&&(Io(),Gl&&(n=Gl,e=kr,kr=Gl=null,ao(n),e)))for(n=0;n<e.length;n++)ao(e[n])}}function Sr(e,n){var a=e.stateNode;if(a===null)return null;var o=a[Zt]||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 rl=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ia=!1;if(rl)try{var F={};Object.defineProperty(F,"passive",{get:function(){Ia=!0}}),window.addEventListener("test",F,F),window.removeEventListener("test",F,F)}catch{Ia=!1}var le=null,se=null,xe=null;function ve(){if(xe)return xe;var e,n=se,a=n.length,o,h="value"in le?le.value:le.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 xe=h.slice(e,1<o?1-o:void 0)}function Ve(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 Ye(){return!0}function Re(){return!1}function Ue(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)?Ye:Re,this.isPropagationStopped=Re,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=Ye)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Ye)},persist:function(){},isPersistent:Ye}),n}var Xe={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},We=Ue(Xe),Cr=y({},Xe,{view:0,detail:0}),Ya=Ue(Cr),Er,Li,Bt,bl=y({},Cr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:tu,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!==Bt&&(Bt&&e.type==="mousemove"?(Er=e.screenX-Bt.screenX,Li=e.screenY-Bt.screenY):Li=Er=0,Bt=e),Er)},movementY:function(e){return"movementY"in e?e.movementY:Li}}),al=Ue(bl),yn=y({},bl,{dataTransfer:0}),Hi=Ue(yn),Jt=y({},Cr,{relatedTarget:0}),eu=Ue(Jt),Hg=y({},Xe,{animationName:0,elapsedTime:0,pseudoElement:0}),Ug=Ue(Hg),Ig=y({},Xe,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Yg=Ue(Ig),qg=y({},Xe,{data:0}),Bh=Ue(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 tu(){return Kg}var Wg=y({},Cr,{key:function(e){if(e.key){var n=Xg[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=Ve(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:tu,charCode:function(e){return e.type==="keypress"?Ve(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ve(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Qg=Ue(Wg),Zg=y({},bl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),$h=Ue(Zg),Jg=y({},Cr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:tu}),Pg=Ue(Jg),eb=y({},Xe,{propertyName:0,elapsedTime:0,pseudoElement:0}),tb=Ue(eb),nb=y({},bl,{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=Ue(nb),rb=y({},Xe,{newState:0,oldState:0}),ab=Ue(rb),ib=[9,13,27,32],nu=rl&&"CompositionEvent"in window,Ui=null;rl&&"documentMode"in document&&(Ui=document.documentMode);var sb=rl&&"TextEvent"in window&&!Ui,Lh=rl&&(!nu||Ui&&8<Ui&&11>=Ui),Hh=" ",Uh=!1;function Ih(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 Yh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var qa=!1;function ob(e,n){switch(e){case"compositionend":return Yh(n);case"keypress":return n.which!==32?null:(Uh=!0,Hh);case"textInput":return e=n.data,e===Hh&&Uh?null:e;default:return null}}function cb(e,n){if(qa)return e==="compositionend"||!nu&&Ih(e,n)?(e=ve(),xe=se=le=null,qa=!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 Lh&&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 qh(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!ub[e.type]:n==="textarea"}function Xh(e,n,a,o){Gl?kr?kr.push(o):kr=[o]:Gl=o,n=Wo(n,"onChange"),0<n.length&&(a=new We("onChange","change",null,a,o),e.push({event:a,listeners:n}))}var Ii=null,Yi=null;function db(e){Np(e,0)}function io(e){var n=oa(e);if(Ri(n))return e}function Vh(e,n){if(e==="change")return n}var Gh=!1;if(rl){var lu;if(rl){var ru="oninput"in document;if(!ru){var Kh=document.createElement("div");Kh.setAttribute("oninput","return;"),ru=typeof Kh.oninput=="function"}lu=ru}else lu=!1;Gh=lu&&(!document.documentMode||9<document.documentMode)}function Wh(){Ii&&(Ii.detachEvent("onpropertychange",Qh),Yi=Ii=null)}function Qh(e){if(e.propertyName==="value"&&io(Yi)){var n=[];Xh(n,Yi,e,ll(e)),jr(db,n)}}function fb(e,n,a){e==="focusin"?(Wh(),Ii=n,Yi=a,Ii.attachEvent("onpropertychange",Qh)):e==="focusout"&&Wh()}function hb(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return io(Yi)}function mb(e,n){if(e==="click")return io(n)}function xb(e,n){if(e==="input"||e==="change")return io(n)}function pb(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var Gn=typeof Object.is=="function"?Object.is:pb;function qi(e,n){if(Gn(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(!we.call(n,h)||!Gn(e[h],n[h]))return!1}return!0}function Zh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Jh(e,n){var a=Zh(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=Zh(a)}}function Ph(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Ph(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function em(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=Ha(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=Ha(e.document)}return n}function au(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=rl&&"documentMode"in document&&11>=document.documentMode,Xa=null,iu=null,Xi=null,su=!1;function tm(e,n,a){var o=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;su||Xa==null||Xa!==Ha(o)||(o=Xa,"selectionStart"in o&&au(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}),Xi&&qi(Xi,o)||(Xi=o,o=Wo(iu,"onSelect"),0<o.length&&(n=new We("onSelect","select",null,n,a),e.push({event:n,listeners:o}),n.target=Xa)))}function da(e,n){var a={};return a[e.toLowerCase()]=n.toLowerCase(),a["Webkit"+e]="webkit"+n,a["Moz"+e]="moz"+n,a}var Va={animationend:da("Animation","AnimationEnd"),animationiteration:da("Animation","AnimationIteration"),animationstart:da("Animation","AnimationStart"),transitionrun:da("Transition","TransitionRun"),transitionstart:da("Transition","TransitionStart"),transitioncancel:da("Transition","TransitionCancel"),transitionend:da("Transition","TransitionEnd")},ou={},nm={};rl&&(nm=document.createElement("div").style,"AnimationEvent"in window||(delete Va.animationend.animation,delete Va.animationiteration.animation,delete Va.animationstart.animation),"TransitionEvent"in window||delete Va.transitionend.transition);function fa(e){if(ou[e])return ou[e];if(!Va[e])return e;var n=Va[e],a;for(a in n)if(n.hasOwnProperty(a)&&a in nm)return ou[e]=n[a];return e}var lm=fa("animationend"),rm=fa("animationiteration"),am=fa("animationstart"),gb=fa("transitionrun"),bb=fa("transitionstart"),vb=fa("transitioncancel"),im=fa("transitionend"),sm=new Map,cu="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(" ");cu.push("scrollEnd");function vl(e,n){sm.set(e,n),Vl(n,[e])}var so=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)},il=[],Ga=0,uu=0;function oo(){for(var e=Ga,n=uu=Ga=0;n<e;){var a=il[n];il[n++]=null;var o=il[n];il[n++]=null;var h=il[n];il[n++]=null;var p=il[n];if(il[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&&om(a,h,p)}}function co(e,n,a,o){il[Ga++]=e,il[Ga++]=n,il[Ga++]=a,il[Ga++]=o,uu|=o,e.lanes|=o,e=e.alternate,e!==null&&(e.lanes|=o)}function du(e,n,a,o){return co(e,n,a,o),uo(e)}function ha(e,n){return co(e,null,null,n),uo(e)}function om(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-et(a),e=p.hiddenUpdates,o=e[h],o===null?e[h]=[n]:o.push(n),n.lane=a|536870912),p):null}function uo(e){if(50<hs)throw hs=0,vd=null,Error(i(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var Ka={};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 Kn(e,n,a,o){return new wb(e,n,a,o)}function fu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Kl(e,n){var a=e.alternate;return a===null?(a=Kn(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 cm(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 fo(e,n,a,o,h,p){var w=0;if(o=e,typeof e=="function")fu(e)&&(w=1);else if(typeof e=="string")w=E2(e,a,ue.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Y:return e=Kn(31,a,n,h),e.elementType=Y,e.lanes=p,e;case j:return ma(a.children,h,p,n);case E:w=8,h|=24;break;case C:return e=Kn(12,a,n,h|2),e.elementType=C,e.lanes=p,e;case L:return e=Kn(13,a,n,h),e.elementType=L,e.lanes=p,e;case _:return e=Kn(19,a,n,h),e.elementType=_,e.lanes=p,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case R:w=10;break e;case A:w=9;break e;case B:w=11;break e;case V:w=14;break e;case K:w=16,o=null;break e}w=29,a=Error(i(130,e===null?"null":typeof e,"")),o=null}return n=Kn(w,a,n,h),n.elementType=e,n.type=o,n.lanes=p,n}function ma(e,n,a,o){return e=Kn(7,e,o,n),e.lanes=a,e}function hu(e,n,a){return e=Kn(6,e,null,n),e.lanes=a,e}function um(e){var n=Kn(18,null,null,0);return n.stateNode=e,n}function mu(e,n,a){return n=Kn(4,e.children!==null?e.children:[],e.key,n),n.lanes=a,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var dm=new WeakMap;function sl(e,n){if(typeof e=="object"&&e!==null){var a=dm.get(e);return a!==void 0?a:(n={value:e,source:n,stack:Me(n)},dm.set(e,n),n)}return{value:e,source:n,stack:Me(n)}}var Wa=[],Qa=0,ho=null,Vi=0,ol=[],cl=0,Nr=null,Dl=1,Tl="";function Wl(e,n){Wa[Qa++]=Vi,Wa[Qa++]=ho,ho=e,Vi=n}function fm(e,n,a){ol[cl++]=Dl,ol[cl++]=Tl,ol[cl++]=Nr,Nr=e;var o=Dl;e=Tl;var h=32-et(o)-1;o&=~(1<<h),a+=1;var p=32-et(n)+h;if(30<p){var w=h-h%5;p=(o&(1<<w)-1).toString(32),o>>=w,h-=w,Dl=1<<32-et(n)+h|a<<h|o,Tl=p+e}else Dl=1<<p|a<<h|o,Tl=e}function xu(e){e.return!==null&&(Wl(e,1),fm(e,1,0))}function pu(e){for(;e===ho;)ho=Wa[--Qa],Wa[Qa]=null,Vi=Wa[--Qa],Wa[Qa]=null;for(;e===Nr;)Nr=ol[--cl],ol[cl]=null,Tl=ol[--cl],ol[cl]=null,Dl=ol[--cl],ol[cl]=null}function hm(e,n){ol[cl++]=Dl,ol[cl++]=Tl,ol[cl++]=Nr,Dl=n.id,Tl=n.overflow,Nr=e}var gn=null,$t=null,xt=!1,Ar=null,ul=!1,yu=Error(i(519));function Dr(e){var n=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Gi(sl(n,e)),yu}function mm(e){var n=e.stateNode,a=e.type,o=e.memoizedProps;switch(n[tn]=e,n[Zt]=o,a){case"dialog":ct("cancel",n),ct("close",n);break;case"iframe":case"object":case"embed":ct("load",n);break;case"video":case"audio":for(a=0;a<xs.length;a++)ct(xs[a],n);break;case"source":ct("error",n);break;case"img":case"image":case"link":ct("error",n),ct("load",n);break;case"details":ct("toggle",n);break;case"input":ct("invalid",n),Ua(n,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":ct("invalid",n);break;case"textarea":ct("invalid",n),no(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||zp(n.textContent,a)?(o.popover!=null&&(ct("beforetoggle",n),ct("toggle",n)),o.onScroll!=null&&ct("scroll",n),o.onScrollEnd!=null&&ct("scrollend",n),o.onClick!=null&&(n.onclick=gl),n=!0):n=!1,n||Dr(e,!0)}function xm(e){for(gn=e.return;gn;)switch(gn.tag){case 5:case 31:case 13:ul=!1;return;case 27:case 3:ul=!0;return;default:gn=gn.return}}function Za(e){if(e!==gn)return!1;if(!xt)return xm(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")||_d(e.type,e.memoizedProps)),a=!a),a&&$t&&Dr(e),xm(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));$t=Hp(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));$t=Hp(e)}else n===27?(n=$t,Yr(e.type)?(e=Hd,Hd=null,$t=e):$t=n):$t=gn?fl(e.stateNode.nextSibling):null;return!0}function xa(){$t=gn=null,xt=!1}function gu(){var e=Ar;return e!==null&&(Un===null?Un=e:Un.push.apply(Un,e),Ar=null),e}function Gi(e){Ar===null?Ar=[e]:Ar.push(e)}var bu=z(null),pa=null,Ql=null;function Tr(e,n,a){D(bu,n._currentValue),n._currentValue=a}function Zl(e){e._currentValue=bu.current,G(bu)}function vu(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 wu(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 H=0;H<n.length;H++)if(N.context===n[H]){p.lanes|=a,N=p.alternate,N!==null&&(N.lanes|=a),vu(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),vu(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 Ja(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;Gn(h.pendingProps.value,w.value)||(e!==null?e.push(N):e=[N])}}else if(h===Ae.current){if(w=h.alternate,w===null)throw Error(i(387));w.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(e!==null?e.push(vs):e=[vs])}h=h.return}e!==null&&wu(n,e,a,o),n.flags|=262144}function mo(e){for(e=e.firstContext;e!==null;){if(!Gn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ya(e){pa=e,Ql=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function bn(e){return pm(pa,e)}function xo(e,n){return pa===null&&ya(e),pm(e,n)}function pm(e,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},Ql===null){if(e===null)throw Error(i(308));Ql=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else Ql=Ql.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,ln={$$typeof:R,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ku(){return{controller:new kb,data:new Map,refCount:0}}function Ki(e){e.refCount--,e.refCount===0&&jb(Sb,function(){e.controller.abort()})}var Wi=null,ju=0,Pa=0,ei=null;function Cb(e,n){if(Wi===null){var a=Wi=[];ju=0,Pa=Ed(),ei={status:"pending",value:void 0,then:function(o){a.push(o)}}}return ju++,n.then(ym,ym),n}function ym(){if(--ju===0&&Wi!==null){ei!==null&&(ei.status="fulfilled");var e=Wi;Wi=null,Pa=0,ei=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 gm=I.S;I.S=function(e,n){tp=yt(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&Cb(e,n),gm!==null&&gm(e,n)};var ga=z(null);function Su(){var e=ga.current;return e!==null?e:Mt.pooledCache}function po(e,n){n===null?D(ga,ga.current):D(ga,n.pool)}function bm(){var e=Su();return e===null?null:{parent:ln._currentValue,pool:e}}var ti=Error(i(460)),Cu=Error(i(474)),yo=Error(i(542)),go={then:function(){}};function vm(e){return e=e.status,e==="fulfilled"||e==="rejected"}function wm(e,n,a){switch(a=e[a],a===void 0?e.push(n):a!==n&&(n.then(gl,gl),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,jm(e),e;default:if(typeof n.status=="string")n.then(gl,gl);else{if(e=Mt,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,jm(e),e}throw va=n,ti}}function ba(e){try{var n=e._init;return n(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(va=a,ti):a}}var va=null;function km(){if(va===null)throw Error(i(459));var e=va;return va=null,e}function jm(e){if(e===ti||e===yo)throw Error(i(483))}var ni=null,Qi=0;function bo(e){var n=Qi;return Qi+=1,ni===null&&(ni=[]),wm(ni,e,n)}function Zi(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function vo(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 Sm(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=Kl(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,ce){return X===null||X.tag!==6?(X=hu(J,Q.mode,ce),X.return=Q,X):(X=h(X,J),X.return=Q,X)}function H(Q,X,J,ce){var qe=J.type;return qe===j?oe(Q,X,J.props.children,ce,J.key):X!==null&&(X.elementType===qe||typeof qe=="object"&&qe!==null&&qe.$$typeof===K&&ba(qe)===X.type)?(X=h(X,J.props),Zi(X,J),X.return=Q,X):(X=fo(J.type,J.key,J.props,null,Q.mode,ce),Zi(X,J),X.return=Q,X)}function ee(Q,X,J,ce){return X===null||X.tag!==4||X.stateNode.containerInfo!==J.containerInfo||X.stateNode.implementation!==J.implementation?(X=mu(J,Q.mode,ce),X.return=Q,X):(X=h(X,J.children||[]),X.return=Q,X)}function oe(Q,X,J,ce,qe){return X===null||X.tag!==7?(X=ma(J,Q.mode,ce,qe),X.return=Q,X):(X=h(X,J),X.return=Q,X)}function de(Q,X,J){if(typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint")return X=hu(""+X,Q.mode,J),X.return=Q,X;if(typeof X=="object"&&X!==null){switch(X.$$typeof){case v:return J=fo(X.type,X.key,X.props,null,Q.mode,J),Zi(J,X),J.return=Q,J;case S:return X=mu(X,Q.mode,J),X.return=Q,X;case K:return X=ba(X),de(Q,X,J)}if(W(X)||O(X))return X=ma(X,Q.mode,J,null),X.return=Q,X;if(typeof X.then=="function")return de(Q,bo(X),J);if(X.$$typeof===R)return de(Q,xo(Q,X),J);vo(Q,X)}return null}function te(Q,X,J,ce){var qe=X!==null?X.key:null;if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return qe!==null?null:N(Q,X,""+J,ce);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case v:return J.key===qe?H(Q,X,J,ce):null;case S:return J.key===qe?ee(Q,X,J,ce):null;case K:return J=ba(J),te(Q,X,J,ce)}if(W(J)||O(J))return qe!==null?null:oe(Q,X,J,ce,null);if(typeof J.then=="function")return te(Q,X,bo(J),ce);if(J.$$typeof===R)return te(Q,X,xo(Q,J),ce);vo(Q,J)}return null}function re(Q,X,J,ce,qe){if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return Q=Q.get(J)||null,N(X,Q,""+ce,qe);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case v:return Q=Q.get(ce.key===null?J:ce.key)||null,H(X,Q,ce,qe);case S:return Q=Q.get(ce.key===null?J:ce.key)||null,ee(X,Q,ce,qe);case K:return ce=ba(ce),re(Q,X,J,ce,qe)}if(W(ce)||O(ce))return Q=Q.get(J)||null,oe(X,Q,ce,qe,null);if(typeof ce.then=="function")return re(Q,X,J,bo(ce),qe);if(ce.$$typeof===R)return re(Q,X,J,xo(X,ce),qe);vo(X,ce)}return null}function _e(Q,X,J,ce){for(var qe=null,gt=null,$e=X,rt=X=0,ft=null;$e!==null&&rt<J.length;rt++){$e.index>rt?(ft=$e,$e=null):ft=$e.sibling;var bt=te(Q,$e,J[rt],ce);if(bt===null){$e===null&&($e=ft);break}e&&$e&&bt.alternate===null&&n(Q,$e),X=p(bt,X,rt),gt===null?qe=bt:gt.sibling=bt,gt=bt,$e=ft}if(rt===J.length)return a(Q,$e),xt&&Wl(Q,rt),qe;if($e===null){for(;rt<J.length;rt++)$e=de(Q,J[rt],ce),$e!==null&&(X=p($e,X,rt),gt===null?qe=$e:gt.sibling=$e,gt=$e);return xt&&Wl(Q,rt),qe}for($e=o($e);rt<J.length;rt++)ft=re($e,Q,rt,J[rt],ce),ft!==null&&(e&&ft.alternate!==null&&$e.delete(ft.key===null?rt:ft.key),X=p(ft,X,rt),gt===null?qe=ft:gt.sibling=ft,gt=ft);return e&&$e.forEach(function(Kr){return n(Q,Kr)}),xt&&Wl(Q,rt),qe}function Qe(Q,X,J,ce){if(J==null)throw Error(i(151));for(var qe=null,gt=null,$e=X,rt=X=0,ft=null,bt=J.next();$e!==null&&!bt.done;rt++,bt=J.next()){$e.index>rt?(ft=$e,$e=null):ft=$e.sibling;var Kr=te(Q,$e,bt.value,ce);if(Kr===null){$e===null&&($e=ft);break}e&&$e&&Kr.alternate===null&&n(Q,$e),X=p(Kr,X,rt),gt===null?qe=Kr:gt.sibling=Kr,gt=Kr,$e=ft}if(bt.done)return a(Q,$e),xt&&Wl(Q,rt),qe;if($e===null){for(;!bt.done;rt++,bt=J.next())bt=de(Q,bt.value,ce),bt!==null&&(X=p(bt,X,rt),gt===null?qe=bt:gt.sibling=bt,gt=bt);return xt&&Wl(Q,rt),qe}for($e=o($e);!bt.done;rt++,bt=J.next())bt=re($e,Q,rt,bt.value,ce),bt!==null&&(e&&bt.alternate!==null&&$e.delete(bt.key===null?rt:bt.key),X=p(bt,X,rt),gt===null?qe=bt:gt.sibling=bt,gt=bt);return e&&$e.forEach(function(B2){return n(Q,B2)}),xt&&Wl(Q,rt),qe}function Tt(Q,X,J,ce){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 qe=J.key;X!==null;){if(X.key===qe){if(qe=J.type,qe===j){if(X.tag===7){a(Q,X.sibling),ce=h(X,J.props.children),ce.return=Q,Q=ce;break e}}else if(X.elementType===qe||typeof qe=="object"&&qe!==null&&qe.$$typeof===K&&ba(qe)===X.type){a(Q,X.sibling),ce=h(X,J.props),Zi(ce,J),ce.return=Q,Q=ce;break e}a(Q,X);break}else n(Q,X);X=X.sibling}J.type===j?(ce=ma(J.props.children,Q.mode,ce,J.key),ce.return=Q,Q=ce):(ce=fo(J.type,J.key,J.props,null,Q.mode,ce),Zi(ce,J),ce.return=Q,Q=ce)}return w(Q);case S:e:{for(qe=J.key;X!==null;){if(X.key===qe)if(X.tag===4&&X.stateNode.containerInfo===J.containerInfo&&X.stateNode.implementation===J.implementation){a(Q,X.sibling),ce=h(X,J.children||[]),ce.return=Q,Q=ce;break e}else{a(Q,X);break}else n(Q,X);X=X.sibling}ce=mu(J,Q.mode,ce),ce.return=Q,Q=ce}return w(Q);case K:return J=ba(J),Tt(Q,X,J,ce)}if(W(J))return _e(Q,X,J,ce);if(O(J)){if(qe=O(J),typeof qe!="function")throw Error(i(150));return J=qe.call(J),Qe(Q,X,J,ce)}if(typeof J.then=="function")return Tt(Q,X,bo(J),ce);if(J.$$typeof===R)return Tt(Q,X,xo(Q,J),ce);vo(Q,J)}return typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint"?(J=""+J,X!==null&&X.tag===6?(a(Q,X.sibling),ce=h(X,J),ce.return=Q,Q=ce):(a(Q,X),ce=hu(J,Q.mode,ce),ce.return=Q,Q=ce),w(Q)):a(Q,X)}return function(Q,X,J,ce){try{Qi=0;var qe=Tt(Q,X,J,ce);return ni=null,qe}catch($e){if($e===ti||$e===yo)throw $e;var gt=Kn(29,$e,null,Q.mode);return gt.lanes=ce,gt.return=Q,gt}finally{}}}var wa=Sm(!0),Cm=Sm(!1),zr=!1;function Eu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Nu(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 Mr(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Fr(e,n,a){var o=e.updateQueue;if(o===null)return null;if(o=o.shared,(wt&2)!==0){var h=o.pending;return h===null?n.next=n:(n.next=h.next,h.next=n),o.pending=n,n=uo(e),om(e,null,a),n}return co(e,o,n,a),uo(e)}function Ji(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,Xn(e,a)}}function Au(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 Du=!1;function Pi(){if(Du){var e=ei;if(e!==null)throw e}}function es(e,n,a,o){Du=!1;var h=e.updateQueue;zr=!1;var p=h.firstBaseUpdate,w=h.lastBaseUpdate,N=h.shared.pending;if(N!==null){h.shared.pending=null;var H=N,ee=H.next;H.next=null,w===null?p=ee:w.next=ee,w=H;var oe=e.alternate;oe!==null&&(oe=oe.updateQueue,N=oe.lastBaseUpdate,N!==w&&(N===null?oe.firstBaseUpdate=ee:N.next=ee,oe.lastBaseUpdate=H))}if(p!==null){var de=h.baseState;w=0,oe=ee=H=null,N=p;do{var te=N.lane&-536870913,re=te!==N.lane;if(re?(dt&te)===te:(o&te)===te){te!==0&&te===Pa&&(Du=!0),oe!==null&&(oe=oe.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var _e=e,Qe=N;te=n;var Tt=a;switch(Qe.tag){case 1:if(_e=Qe.payload,typeof _e=="function"){de=_e.call(Tt,de,te);break e}de=_e;break e;case 3:_e.flags=_e.flags&-65537|128;case 0:if(_e=Qe.payload,te=typeof _e=="function"?_e.call(Tt,de,te):_e,te==null)break e;de=y({},de,te);break e;case 2:zr=!0}}te=N.callback,te!==null&&(e.flags|=64,re&&(e.flags|=8192),re=h.callbacks,re===null?h.callbacks=[te]:re.push(te))}else re={lane:te,tag:N.tag,payload:N.payload,callback:N.callback,next:null},oe===null?(ee=oe=re,H=de):oe=oe.next=re,w|=te;if(N=N.next,N===null){if(N=h.shared.pending,N===null)break;re=N,N=re.next,re.next=null,h.lastBaseUpdate=re,h.shared.pending=null}}while(!0);oe===null&&(H=de),h.baseState=H,h.firstBaseUpdate=ee,h.lastBaseUpdate=oe,p===null&&(h.shared.lanes=0),$r|=w,e.lanes=w,e.memoizedState=de}}function Em(e,n){if(typeof e!="function")throw Error(i(191,e));e.call(n)}function Nm(e,n){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)Em(a[e],n)}var li=z(null),wo=z(0);function Am(e,n){e=ir,D(wo,e),D(li,n),ir=e|n.baseLanes}function Tu(){D(wo,ir),D(li,li.current)}function zu(){ir=wo.current,G(li),G(wo)}var Wn=z(null),dl=null;function Rr(e){var n=e.alternate;D(Pt,Pt.current&1),D(Wn,e),dl===null&&(n===null||li.current!==null||n.memoizedState!==null)&&(dl=e)}function Mu(e){D(Pt,Pt.current),D(Wn,e),dl===null&&(dl=e)}function Dm(e){e.tag===22?(D(Pt,Pt.current),D(Wn,e),dl===null&&(dl=e)):_r()}function _r(){D(Pt,Pt.current),D(Wn,Wn.current)}function Qn(e){G(Wn),dl===e&&(dl=null),G(Pt)}var Pt=z(0);function ko(e){for(var n=e;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||$d(a)||Ld(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 Jl=0,lt=null,At=null,rn=null,jo=!1,ri=!1,ka=!1,So=0,ts=0,ai=null,Nb=0;function Gt(){throw Error(i(321))}function Fu(e,n){if(n===null)return!1;for(var a=0;a<n.length&&a<e.length;a++)if(!Gn(e[a],n[a]))return!1;return!0}function Ru(e,n,a,o,h,p){return Jl=p,lt=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,I.H=e===null||e.memoizedState===null?fx:Wu,ka=!1,p=a(o,h),ka=!1,ri&&(p=zm(n,a,o,h)),Tm(e),p}function Tm(e){I.H=rs;var n=At!==null&&At.next!==null;if(Jl=0,rn=At=lt=null,jo=!1,ts=0,ai=null,n)throw Error(i(300));e===null||an||(e=e.dependencies,e!==null&&mo(e)&&(an=!0))}function zm(e,n,a,o){lt=e;var h=0;do{if(ri&&(ai=null),ts=0,ri=!1,25<=h)throw Error(i(301));if(h+=1,rn=At=null,e.updateQueue!=null){var p=e.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}I.H=hx,p=n(a,o)}while(ri);return p}function Ab(){var e=I.H,n=e.useState()[0];return n=typeof n.then=="function"?ns(n):n,e=e.useState()[0],(At!==null?At.memoizedState:null)!==e&&(lt.flags|=1024),n}function _u(){var e=So!==0;return So=0,e}function Ou(e,n,a){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~a}function Bu(e){if(jo){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}jo=!1}Jl=0,rn=At=lt=null,ri=!1,ts=So=0,ai=null}function Mn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return rn===null?lt.memoizedState=rn=e:rn=rn.next=e,rn}function en(){if(At===null){var e=lt.alternate;e=e!==null?e.memoizedState:null}else e=At.next;var n=rn===null?lt.memoizedState:rn.next;if(n!==null)rn=n,At=e;else{if(e===null)throw lt.alternate===null?Error(i(467)):Error(i(310));At=e,e={memoizedState:At.memoizedState,baseState:At.baseState,baseQueue:At.baseQueue,queue:At.queue,next:null},rn===null?lt.memoizedState=rn=e:rn=rn.next=e}return rn}function Co(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ns(e){var n=ts;return ts+=1,ai===null&&(ai=[]),e=wm(ai,e,n),n=lt,(rn===null?n.memoizedState:rn.next)===null&&(n=n.alternate,I.H=n===null||n.memoizedState===null?fx:Wu),e}function Eo(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ns(e);if(e.$$typeof===R)return bn(e)}throw Error(i(438,String(e)))}function $u(e){var n=null,a=lt.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var o=lt.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=Co(),lt.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]=T;return n.index++,a}function Pl(e,n){return typeof n=="function"?n(e):n}function No(e){var n=en();return Lu(n,At,e)}function Lu(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,H=null,ee=n,oe=!1;do{var de=ee.lane&-536870913;if(de!==ee.lane?(dt&de)===de:(Jl&de)===de){var te=ee.revertLane;if(te===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null}),de===Pa&&(oe=!0);else if((Jl&te)===te){ee=ee.next,te===Pa&&(oe=!0);continue}else de={lane:0,revertLane:ee.revertLane,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},H===null?(N=H=de,w=p):H=H.next=de,lt.lanes|=te,$r|=te;de=ee.action,ka&&a(p,de),p=ee.hasEagerState?ee.eagerState:a(p,de)}else te={lane:de,revertLane:ee.revertLane,gesture:ee.gesture,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},H===null?(N=H=te,w=p):H=H.next=te,lt.lanes|=de,$r|=de;ee=ee.next}while(ee!==null&&ee!==n);if(H===null?w=p:H.next=N,!Gn(p,e.memoizedState)&&(an=!0,oe&&(a=ei,a!==null)))throw a;e.memoizedState=p,e.baseState=w,e.baseQueue=H,o.lastRenderedState=p}return h===null&&(o.lanes=0),[e.memoizedState,o.dispatch]}function Hu(e){var n=en(),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);Gn(p,n.memoizedState)||(an=!0),n.memoizedState=p,n.baseQueue===null&&(n.baseState=p),a.lastRenderedState=p}return[p,o]}function Mm(e,n,a){var o=lt,h=en(),p=xt;if(p){if(a===void 0)throw Error(i(407));a=a()}else a=n();var w=!Gn((At||h).memoizedState,a);if(w&&(h.memoizedState=a,an=!0),h=h.queue,Yu(_m.bind(null,o,h,e),[e]),h.getSnapshot!==n||w||rn!==null&&rn.memoizedState.tag&1){if(o.flags|=2048,ii(9,{destroy:void 0},Rm.bind(null,o,h,a,n),null),Mt===null)throw Error(i(349));p||(Jl&127)!==0||Fm(o,n,a)}return a}function Fm(e,n,a){e.flags|=16384,e={getSnapshot:n,value:a},n=lt.updateQueue,n===null?(n=Co(),lt.updateQueue=n,n.stores=[e]):(a=n.stores,a===null?n.stores=[e]:a.push(e))}function Rm(e,n,a,o){n.value=a,n.getSnapshot=o,Om(n)&&Bm(e)}function _m(e,n,a){return a(function(){Om(n)&&Bm(e)})}function Om(e){var n=e.getSnapshot;e=e.value;try{var a=n();return!Gn(e,a)}catch{return!0}}function Bm(e){var n=ha(e,2);n!==null&&In(n,e,2)}function Uu(e){var n=Mn();if(typeof e=="function"){var a=e;if(e=a(),ka){mt(!0);try{a()}finally{mt(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Pl,lastRenderedState:e},n}function $m(e,n,a,o){return e.baseState=a,Lu(e,At,typeof o=="function"?o:Pl)}function Db(e,n,a,o,h){if(To(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)}};I.T!==null?a(!0):p.isTransition=!1,o(p),a=n.pending,a===null?(p.next=n.pending=p,Lm(n,p)):(p.next=a.next,n.pending=a.next=p)}}function Lm(e,n){var a=n.action,o=n.payload,h=e.state;if(n.isTransition){var p=I.T,w={};I.T=w;try{var N=a(h,o),H=I.S;H!==null&&H(w,N),Hm(e,n,N)}catch(ee){Iu(e,n,ee)}finally{p!==null&&w.types!==null&&(p.types=w.types),I.T=p}}else try{p=a(h,o),Hm(e,n,p)}catch(ee){Iu(e,n,ee)}}function Hm(e,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(o){Um(e,n,o)},function(o){return Iu(e,n,o)}):Um(e,n,a)}function Um(e,n,a){n.status="fulfilled",n.value=a,Im(n),e.state=a,n=e.pending,n!==null&&(a=n.next,a===n?e.pending=null:(a=a.next,n.next=a,Lm(e,a)))}function Iu(e,n,a){var o=e.pending;if(e.pending=null,o!==null){o=o.next;do n.status="rejected",n.reason=a,Im(n),n=n.next;while(n!==o)}e.action=null}function Im(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function Ym(e,n){return n}function qm(e,n){if(xt){var a=Mt.formState;if(a!==null){e:{var o=lt;if(xt){if($t){t:{for(var h=$t,p=ul;h.nodeType!==8;){if(!p){h=null;break t}if(h=fl(h.nextSibling),h===null){h=null;break t}}p=h.data,h=p==="F!"||p==="F"?h:null}if(h){$t=fl(h.nextSibling),o=h.data==="F!";break e}}Dr(o)}o=!1}o&&(n=a[0])}}return a=Mn(),a.memoizedState=a.baseState=n,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ym,lastRenderedState:n},a.queue=o,a=cx.bind(null,lt,o),o.dispatch=a,o=Uu(!1),p=Ku.bind(null,lt,!1,o.queue),o=Mn(),h={state:n,dispatch:null,action:e,pending:null},o.queue=h,a=Db.bind(null,lt,h,p,a),h.dispatch=a,o.memoizedState=e,[n,a,!1]}function Xm(e){var n=en();return Vm(n,At,e)}function Vm(e,n,a){if(n=Lu(e,n,Ym)[0],e=No(Pl)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var o=ns(n)}catch(w){throw w===ti?yo:w}else o=n;n=en();var h=n.queue,p=h.dispatch;return a!==n.memoizedState&&(lt.flags|=2048,ii(9,{destroy:void 0},Tb.bind(null,h,a),null)),[o,p,e]}function Tb(e,n){e.action=n}function Gm(e){var n=en(),a=At;if(a!==null)return Vm(n,a,e);en(),n=n.memoizedState,a=en();var o=a.queue.dispatch;return a.memoizedState=e,[n,o,!1]}function ii(e,n,a,o){return e={tag:e,create:a,deps:o,inst:n,next:null},n=lt.updateQueue,n===null&&(n=Co(),lt.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 Km(){return en().memoizedState}function Ao(e,n,a,o){var h=Mn();lt.flags|=e,h.memoizedState=ii(1|n,{destroy:void 0},a,o===void 0?null:o)}function Do(e,n,a,o){var h=en();o=o===void 0?null:o;var p=h.memoizedState.inst;At!==null&&o!==null&&Fu(o,At.memoizedState.deps)?h.memoizedState=ii(n,p,a,o):(lt.flags|=e,h.memoizedState=ii(1|n,p,a,o))}function Wm(e,n){Ao(8390656,8,e,n)}function Yu(e,n){Do(2048,8,e,n)}function zb(e){lt.flags|=4;var n=lt.updateQueue;if(n===null)n=Co(),lt.updateQueue=n,n.events=[e];else{var a=n.events;a===null?n.events=[e]:a.push(e)}}function Qm(e){var n=en().memoizedState;return zb({ref:n,nextImpl:e}),function(){if((wt&2)!==0)throw Error(i(440));return n.impl.apply(void 0,arguments)}}function Zm(e,n){return Do(4,2,e,n)}function Jm(e,n){return Do(4,4,e,n)}function Pm(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 ex(e,n,a){a=a!=null?a.concat([e]):null,Do(4,4,Pm.bind(null,n,e),a)}function qu(){}function tx(e,n){var a=en();n=n===void 0?null:n;var o=a.memoizedState;return n!==null&&Fu(n,o[1])?o[0]:(a.memoizedState=[e,n],e)}function nx(e,n){var a=en();n=n===void 0?null:n;var o=a.memoizedState;if(n!==null&&Fu(n,o[1]))return o[0];if(o=e(),ka){mt(!0);try{e()}finally{mt(!1)}}return a.memoizedState=[o,n],o}function Xu(e,n,a){return a===void 0||(Jl&1073741824)!==0&&(dt&261930)===0?e.memoizedState=n:(e.memoizedState=a,e=lp(),lt.lanes|=e,$r|=e,a)}function lx(e,n,a,o){return Gn(a,n)?a:li.current!==null?(e=Xu(e,a,o),Gn(e,n)||(an=!0),e):(Jl&42)===0||(Jl&1073741824)!==0&&(dt&261930)===0?(an=!0,e.memoizedState=a):(e=lp(),lt.lanes|=e,$r|=e,n)}function rx(e,n,a,o,h){var p=P.p;P.p=p!==0&&8>p?p:8;var w=I.T,N={};I.T=N,Ku(e,!1,n,a);try{var H=h(),ee=I.S;if(ee!==null&&ee(N,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var oe=Eb(H,o);ls(e,n,oe,Pn(e))}else ls(e,n,o,Pn(e))}catch(de){ls(e,n,{then:function(){},status:"rejected",reason:de},Pn())}finally{P.p=p,w!==null&&N.types!==null&&(w.types=N.types),I.T=w}}function Mb(){}function Vu(e,n,a,o){if(e.tag!==5)throw Error(i(476));var h=ax(e).queue;rx(e,h,n,ae,a===null?Mb:function(){return ix(e),a(o)})}function ax(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:ae,baseState:ae,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Pl,lastRenderedState:ae},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Pl,lastRenderedState:a},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function ix(e){var n=ax(e);n.next===null&&(n=e.alternate.memoizedState),ls(e,n.next.queue,{},Pn())}function Gu(){return bn(vs)}function sx(){return en().memoizedState}function ox(){return en().memoizedState}function Fb(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var a=Pn();e=Mr(a);var o=Fr(n,e,a);o!==null&&(In(o,n,a),Ji(o,n,a)),n={cache:ku()},e.payload=n;return}n=n.return}}function Rb(e,n,a){var o=Pn();a={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},To(e)?ux(n,a):(a=du(e,n,a,o),a!==null&&(In(a,e,o),dx(a,n,o)))}function cx(e,n,a){var o=Pn();ls(e,n,a,o)}function ls(e,n,a,o){var h={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(To(e))ux(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,Gn(N,w))return co(e,n,h,0),Mt===null&&oo(),!1}catch{}finally{}if(a=du(e,n,h,o),a!==null)return In(a,e,o),dx(a,n,o),!0}return!1}function Ku(e,n,a,o){if(o={lane:2,revertLane:Ed(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},To(e)){if(n)throw Error(i(479))}else n=du(e,a,o,2),n!==null&&In(n,e,2)}function To(e){var n=e.alternate;return e===lt||n!==null&&n===lt}function ux(e,n){ri=jo=!0;var a=e.pending;a===null?n.next=n:(n.next=a.next,a.next=n),e.pending=n}function dx(e,n,a){if((a&4194048)!==0){var o=n.lanes;o&=e.pendingLanes,a|=o,n.lanes=a,Xn(e,a)}}var rs={readContext:bn,use:Eo,useCallback:Gt,useContext:Gt,useEffect:Gt,useImperativeHandle:Gt,useLayoutEffect:Gt,useInsertionEffect:Gt,useMemo:Gt,useReducer:Gt,useRef:Gt,useState:Gt,useDebugValue:Gt,useDeferredValue:Gt,useTransition:Gt,useSyncExternalStore:Gt,useId:Gt,useHostTransitionStatus:Gt,useFormState:Gt,useActionState:Gt,useOptimistic:Gt,useMemoCache:Gt,useCacheRefresh:Gt};rs.useEffectEvent=Gt;var fx={readContext:bn,use:Eo,useCallback:function(e,n){return Mn().memoizedState=[e,n===void 0?null:n],e},useContext:bn,useEffect:Wm,useImperativeHandle:function(e,n,a){a=a!=null?a.concat([e]):null,Ao(4194308,4,Pm.bind(null,n,e),a)},useLayoutEffect:function(e,n){return Ao(4194308,4,e,n)},useInsertionEffect:function(e,n){Ao(4,2,e,n)},useMemo:function(e,n){var a=Mn();n=n===void 0?null:n;var o=e();if(ka){mt(!0);try{e()}finally{mt(!1)}}return a.memoizedState=[o,n],o},useReducer:function(e,n,a){var o=Mn();if(a!==void 0){var h=a(n);if(ka){mt(!0);try{a(n)}finally{mt(!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,lt,e),[o.memoizedState,e]},useRef:function(e){var n=Mn();return e={current:e},n.memoizedState=e},useState:function(e){e=Uu(e);var n=e.queue,a=cx.bind(null,lt,n);return n.dispatch=a,[e.memoizedState,a]},useDebugValue:qu,useDeferredValue:function(e,n){var a=Mn();return Xu(a,e,n)},useTransition:function(){var e=Uu(!1);return e=rx.bind(null,lt,e.queue,!0,!1),Mn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,a){var o=lt,h=Mn();if(xt){if(a===void 0)throw Error(i(407));a=a()}else{if(a=n(),Mt===null)throw Error(i(349));(dt&127)!==0||Fm(o,n,a)}h.memoizedState=a;var p={value:a,getSnapshot:n};return h.queue=p,Wm(_m.bind(null,o,p,e),[e]),o.flags|=2048,ii(9,{destroy:void 0},Rm.bind(null,o,p,a,n),null),a},useId:function(){var e=Mn(),n=Mt.identifierPrefix;if(xt){var a=Tl,o=Dl;a=(o&~(1<<32-et(o)-1)).toString(32)+a,n="_"+n+"R_"+a,a=So++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=Nb++,n="_"+n+"r_"+a.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:Gu,useFormState:qm,useActionState:qm,useOptimistic:function(e){var n=Mn();n.memoizedState=n.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=Ku.bind(null,lt,!0,a),a.dispatch=n,[e,n]},useMemoCache:$u,useCacheRefresh:function(){return Mn().memoizedState=Fb.bind(null,lt)},useEffectEvent:function(e){var n=Mn(),a={impl:e};return n.memoizedState=a,function(){if((wt&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}},Wu={readContext:bn,use:Eo,useCallback:tx,useContext:bn,useEffect:Yu,useImperativeHandle:ex,useInsertionEffect:Zm,useLayoutEffect:Jm,useMemo:nx,useReducer:No,useRef:Km,useState:function(){return No(Pl)},useDebugValue:qu,useDeferredValue:function(e,n){var a=en();return lx(a,At.memoizedState,e,n)},useTransition:function(){var e=No(Pl)[0],n=en().memoizedState;return[typeof e=="boolean"?e:ns(e),n]},useSyncExternalStore:Mm,useId:sx,useHostTransitionStatus:Gu,useFormState:Xm,useActionState:Xm,useOptimistic:function(e,n){var a=en();return $m(a,At,e,n)},useMemoCache:$u,useCacheRefresh:ox};Wu.useEffectEvent=Qm;var hx={readContext:bn,use:Eo,useCallback:tx,useContext:bn,useEffect:Yu,useImperativeHandle:ex,useInsertionEffect:Zm,useLayoutEffect:Jm,useMemo:nx,useReducer:Hu,useRef:Km,useState:function(){return Hu(Pl)},useDebugValue:qu,useDeferredValue:function(e,n){var a=en();return At===null?Xu(a,e,n):lx(a,At.memoizedState,e,n)},useTransition:function(){var e=Hu(Pl)[0],n=en().memoizedState;return[typeof e=="boolean"?e:ns(e),n]},useSyncExternalStore:Mm,useId:sx,useHostTransitionStatus:Gu,useFormState:Gm,useActionState:Gm,useOptimistic:function(e,n){var a=en();return At!==null?$m(a,At,e,n):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:$u,useCacheRefresh:ox};hx.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 Zu={enqueueSetState:function(e,n,a){e=e._reactInternals;var o=Pn(),h=Mr(o);h.payload=n,a!=null&&(h.callback=a),n=Fr(e,h,o),n!==null&&(In(n,e,o),Ji(n,e,o))},enqueueReplaceState:function(e,n,a){e=e._reactInternals;var o=Pn(),h=Mr(o);h.tag=1,h.payload=n,a!=null&&(h.callback=a),n=Fr(e,h,o),n!==null&&(In(n,e,o),Ji(n,e,o))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var a=Pn(),o=Mr(a);o.tag=2,n!=null&&(o.callback=n),n=Fr(e,o,a),n!==null&&(In(n,e,a),Ji(n,e,a))}};function mx(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?!qi(a,o)||!qi(h,p):!0}function xx(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&&Zu.enqueueReplaceState(n,n.state,null)}function ja(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 px(e){so(e)}function yx(e){console.error(e)}function gx(e){so(e)}function zo(e,n){try{var a=e.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(o){setTimeout(function(){throw o})}}function bx(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 Ju(e,n,a){return a=Mr(a),a.tag=3,a.payload={element:null},a.callback=function(){zo(e,n)},a}function vx(e){return e=Mr(e),e.tag=3,e}function wx(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(){bx(n,a,o)}}var w=a.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(e.callback=function(){bx(n,a,o),typeof h!="function"&&(Lr===null?Lr=new Set([this]):Lr.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&&Ja(n,a,h,!0),a=Wn.current,a!==null){switch(a.tag){case 31:case 13:return dl===null?Yo():a.alternate===null&&Kt===0&&(Kt=3),a.flags&=-257,a.flags|=65536,a.lanes=h,o===go?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([o]):n.add(o),jd(e,o,h)),!1;case 22:return a.flags|=65536,o===go?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)),jd(e,o,h)),!1}throw Error(i(435,a.tag))}return jd(e,o,h),Yo(),!1}if(xt)return n=Wn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=h,o!==yu&&(e=Error(i(422),{cause:o}),Gi(sl(e,a)))):(o!==yu&&(n=Error(i(423),{cause:o}),Gi(sl(n,a))),e=e.current.alternate,e.flags|=65536,h&=-h,e.lanes|=h,o=sl(o,a),h=Ju(e.stateNode,o,h),Au(e,h),Kt!==4&&(Kt=2)),!1;var p=Error(i(520),{cause:o});if(p=sl(p,a),fs===null?fs=[p]:fs.push(p),Kt!==4&&(Kt=2),n===null)return!0;o=sl(o,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,e=h&-h,a.lanes|=e,e=Ju(a.stateNode,o,e),Au(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"&&(Lr===null||!Lr.has(p))))return a.flags|=65536,h&=-h,a.lanes|=h,h=vx(h),wx(h,e,a,o),Au(a,h),!1}a=a.return}while(a!==null);return!1}var Pu=Error(i(461)),an=!1;function vn(e,n,a,o){n.child=e===null?Cm(n,null,a,o):wa(n,e.child,a,o)}function kx(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 ya(n),o=Ru(e,n,a,w,p,h),N=_u(),e!==null&&!an?(Ou(e,n,h),er(e,n,h)):(xt&&N&&xu(n),n.flags|=1,vn(e,n,o,h),n.child)}function jx(e,n,a,o,h){if(e===null){var p=a.type;return typeof p=="function"&&!fu(p)&&p.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=p,Sx(e,n,p,o,h)):(e=fo(a.type,null,o,n,n.mode,h),e.ref=n.ref,e.return=n,n.child=e)}if(p=e.child,!sd(e,h)){var w=p.memoizedProps;if(a=a.compare,a=a!==null?a:qi,a(w,o)&&e.ref===n.ref)return er(e,n,h)}return n.flags|=1,e=Kl(p,o),e.ref=n.ref,e.return=n,n.child=e}function Sx(e,n,a,o,h){if(e!==null){var p=e.memoizedProps;if(qi(p,o)&&e.ref===n.ref)if(an=!1,n.pendingProps=o=p,sd(e,h))(e.flags&131072)!==0&&(an=!0);else return n.lanes=e.lanes,er(e,n,h)}return ed(e,n,a,o,h)}function Cx(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 Ex(e,n,p,a,o)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&po(n,p!==null?p.cachePool:null),p!==null?Am(n,p):Tu(),Dm(n);else return o=n.lanes=536870912,Ex(e,n,p!==null?p.baseLanes|a:a,a,o)}else p!==null?(po(n,p.cachePool),Am(n,p),_r(),n.memoizedState=null):(e!==null&&po(n,null),Tu(),_r());return vn(e,n,h,a),n.child}function as(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function Ex(e,n,a,o,h){var p=Su();return p=p===null?null:{parent:ln._currentValue,pool:p},n.memoizedState={baseLanes:a,cachePool:p},e!==null&&po(n,null),Tu(),Dm(n),e!==null&&Ja(e,n,o,!0),n.childLanes=h,null}function Mo(e,n){return n=Ro({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function Nx(e,n,a){return wa(n,e.child,null,a),e=Mo(n,n.pendingProps),e.flags|=2,Qn(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=Mo(n,o),n.lanes=536870912,as(null,e);if(Mu(n),(e=$t)?(e=Lp(e,ul),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:Nr!==null?{id:Dl,overflow:Tl}:null,retryLane:536870912,hydrationErrors:null},a=um(e),a.return=n,n.child=a,gn=n,$t=null)):e=null,e===null)throw Dr(n);return n.lanes=536870912,null}return Mo(n,o)}var p=e.memoizedState;if(p!==null){var w=p.dehydrated;if(Mu(n),h)if(n.flags&256)n.flags&=-257,n=Nx(e,n,a);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(i(558));else if(an||Ja(e,n,a,!1),h=(a&e.childLanes)!==0,an||h){if(o=Mt,o!==null&&(w=eo(o,a),w!==0&&w!==p.retryLane))throw p.retryLane=w,ha(e,w),In(o,e,w),Pu;Yo(),n=Nx(e,n,a)}else e=p.treeContext,$t=fl(w.nextSibling),gn=n,xt=!0,Ar=null,ul=!1,e!==null&&hm(n,e),n=Mo(n,o),n.flags|=4096;return n}return e=Kl(e.child,{mode:o.mode,children:o.children}),e.ref=n.ref,n.child=e,e.return=n,e}function Fo(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 ed(e,n,a,o,h){return ya(n),a=Ru(e,n,a,o,void 0,h),o=_u(),e!==null&&!an?(Ou(e,n,h),er(e,n,h)):(xt&&o&&xu(n),n.flags|=1,vn(e,n,a,h),n.child)}function Ax(e,n,a,o,h,p){return ya(n),n.updateQueue=null,a=zm(n,o,a,h),Tm(e),o=_u(),e!==null&&!an?(Ou(e,n,p),er(e,n,p)):(xt&&o&&xu(n),n.flags|=1,vn(e,n,a,p),n.child)}function Dx(e,n,a,o,h){if(ya(n),n.stateNode===null){var p=Ka,w=a.contextType;typeof w=="object"&&w!==null&&(p=bn(w)),p=new a(o,p),n.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=Zu,n.stateNode=p,p._reactInternals=n,p=n.stateNode,p.props=o,p.state=n.memoizedState,p.refs={},Eu(n),w=a.contextType,p.context=typeof w=="object"&&w!==null?bn(w):Ka,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&&Zu.enqueueReplaceState(p,p.state,null),es(n,o,p,h),Pi(),p.state=n.memoizedState),typeof p.componentDidMount=="function"&&(n.flags|=4194308),o=!0}else if(e===null){p=n.stateNode;var N=n.memoizedProps,H=ja(a,N);p.props=H;var ee=p.context,oe=a.contextType;w=Ka,typeof oe=="object"&&oe!==null&&(w=bn(oe));var de=a.getDerivedStateFromProps;oe=typeof de=="function"||typeof p.getSnapshotBeforeUpdate=="function",N=n.pendingProps!==N,oe||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(N||ee!==w)&&xx(n,p,o,w),zr=!1;var te=n.memoizedState;p.state=te,es(n,o,p,h),Pi(),ee=n.memoizedState,N||te!==ee||zr?(typeof de=="function"&&(Qu(n,a,de,o),ee=n.memoizedState),(H=zr||mx(n,a,H,o,te,ee,w))?(oe||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=ee),p.props=o,p.state=ee,p.context=w,o=H):(typeof p.componentDidMount=="function"&&(n.flags|=4194308),o=!1)}else{p=n.stateNode,Nu(e,n),w=n.memoizedProps,oe=ja(a,w),p.props=oe,de=n.pendingProps,te=p.context,ee=a.contextType,H=Ka,typeof ee=="object"&&ee!==null&&(H=bn(ee)),N=a.getDerivedStateFromProps,(ee=typeof N=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(w!==de||te!==H)&&xx(n,p,o,H),zr=!1,te=n.memoizedState,p.state=te,es(n,o,p,h),Pi();var re=n.memoizedState;w!==de||te!==re||zr||e!==null&&e.dependencies!==null&&mo(e.dependencies)?(typeof N=="function"&&(Qu(n,a,N,o),re=n.memoizedState),(oe=zr||mx(n,a,oe,o,te,re,H)||e!==null&&e.dependencies!==null&&mo(e.dependencies))?(ee||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(o,re,H),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(o,re,H)),typeof p.componentDidUpdate=="function"&&(n.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof p.componentDidUpdate!="function"||w===e.memoizedProps&&te===e.memoizedState||(n.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||w===e.memoizedProps&&te===e.memoizedState||(n.flags|=1024),n.memoizedProps=o,n.memoizedState=re),p.props=o,p.state=re,p.context=H,o=oe):(typeof p.componentDidUpdate!="function"||w===e.memoizedProps&&te===e.memoizedState||(n.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||w===e.memoizedProps&&te===e.memoizedState||(n.flags|=1024),o=!1)}return p=o,Fo(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=wa(n,e.child,null,h),n.child=wa(n,null,a,h)):vn(e,n,a,h),n.memoizedState=p.state,e=n.child):e=er(e,n,h),e}function Tx(e,n,a,o){return xa(),n.flags|=256,vn(e,n,a,o),n.child}var td={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function nd(e){return{baseLanes:e,cachePool:bm()}}function ld(e,n,a){return e=e!==null?e.childLanes&~a:0,n&&(e|=Jn),e}function zx(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:(Pt.current&2)!==0),w&&(h=!0,n.flags&=-129),w=(n.flags&32)!==0,n.flags&=-33,e===null){if(xt){if(h?Rr(n):_r(),(e=$t)?(e=Lp(e,ul),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:Nr!==null?{id:Dl,overflow:Tl}:null,retryLane:536870912,hydrationErrors:null},a=um(e),a.return=n,n.child=a,gn=n,$t=null)):e=null,e===null)throw Dr(n);return Ld(e)?n.lanes=32:n.lanes=536870912,null}var N=o.children;return o=o.fallback,h?(_r(),h=n.mode,N=Ro({mode:"hidden",children:N},h),o=ma(o,h,a,null),N.return=n,o.return=n,N.sibling=o,n.child=N,o=n.child,o.memoizedState=nd(a),o.childLanes=ld(e,w,a),n.memoizedState=td,as(null,o)):(Rr(n),rd(n,N))}var H=e.memoizedState;if(H!==null&&(N=H.dehydrated,N!==null)){if(p)n.flags&256?(Rr(n),n.flags&=-257,n=ad(e,n,a)):n.memoizedState!==null?(_r(),n.child=e.child,n.flags|=128,n=null):(_r(),N=o.fallback,h=n.mode,o=Ro({mode:"visible",children:o.children},h),N=ma(N,h,a,null),N.flags|=2,o.return=n,N.return=n,o.sibling=N,n.child=o,wa(n,e.child,null,a),o=n.child,o.memoizedState=nd(a),o.childLanes=ld(e,w,a),n.memoizedState=td,n=as(null,o));else if(Rr(n),Ld(N)){if(w=N.nextSibling&&N.nextSibling.dataset,w)var ee=w.dgst;w=ee,o=Error(i(419)),o.stack="",o.digest=w,Gi({value:o,source:null,stack:null}),n=ad(e,n,a)}else if(an||Ja(e,n,a,!1),w=(a&e.childLanes)!==0,an||w){if(w=Mt,w!==null&&(o=eo(w,a),o!==0&&o!==H.retryLane))throw H.retryLane=o,ha(e,o),In(w,e,o),Pu;$d(N)||Yo(),n=ad(e,n,a)}else $d(N)?(n.flags|=192,n.child=e.child,n=null):(e=H.treeContext,$t=fl(N.nextSibling),gn=n,xt=!0,Ar=null,ul=!1,e!==null&&hm(n,e),n=rd(n,o.children),n.flags|=4096);return n}return h?(_r(),N=o.fallback,h=n.mode,H=e.child,ee=H.sibling,o=Kl(H,{mode:"hidden",children:o.children}),o.subtreeFlags=H.subtreeFlags&65011712,ee!==null?N=Kl(ee,N):(N=ma(N,h,a,null),N.flags|=2),N.return=n,o.return=n,o.sibling=N,n.child=o,as(null,o),o=n.child,N=e.child.memoizedState,N===null?N=nd(a):(h=N.cachePool,h!==null?(H=ln._currentValue,h=h.parent!==H?{parent:H,pool:H}:h):h=bm(),N={baseLanes:N.baseLanes|a,cachePool:h}),o.memoizedState=N,o.childLanes=ld(e,w,a),n.memoizedState=td,as(e.child,o)):(Rr(n),a=e.child,e=a.sibling,a=Kl(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 rd(e,n){return n=Ro({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function Ro(e,n){return e=Kn(22,e,null,n),e.lanes=0,e}function ad(e,n,a){return wa(n,e.child,null,a),e=rd(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function Mx(e,n,a){e.lanes|=n;var o=e.alternate;o!==null&&(o.lanes|=n),vu(e.return,n,a)}function id(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 Fx(e,n,a){var o=n.pendingProps,h=o.revealOrder,p=o.tail;o=o.children;var w=Pt.current,N=(w&2)!==0;if(N?(w=w&1|2,n.flags|=128):w&=1,D(Pt,w),vn(e,n,o,a),o=xt?Vi:0,!N&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Mx(e,a,n);else if(e.tag===19)Mx(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&&ko(e)===null&&(h=a),a=a.sibling;a=h,a===null?(h=n.child,n.child=null):(h=a.sibling,a.sibling=null),id(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&&ko(e)===null){n.child=h;break}e=h.sibling,h.sibling=a,a=h,h=e}id(n,!0,a,null,p,o);break;case"together":id(n,!1,null,null,void 0,o);break;default:n.memoizedState=null}return n.child}function er(e,n,a){if(e!==null&&(n.dependencies=e.dependencies),$r|=n.lanes,(a&n.childLanes)===0)if(e!==null){if(Ja(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=Kl(e,e.pendingProps),n.child=a,a.return=n;e.sibling!==null;)e=e.sibling,a=a.sibling=Kl(e,e.pendingProps),a.return=n;a.sibling=null}return n.child}function sd(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&mo(e)))}function Bb(e,n,a){switch(n.tag){case 3:De(n,n.stateNode.containerInfo),Tr(n,ln,e.memoizedState.cache),xa();break;case 27:case 5:pe(n);break;case 4:De(n,n.stateNode.containerInfo);break;case 10:Tr(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,Mu(n),null;break;case 13:var o=n.memoizedState;if(o!==null)return o.dehydrated!==null?(Rr(n),n.flags|=128,null):(a&n.child.childLanes)!==0?zx(e,n,a):(Rr(n),e=er(e,n,a),e!==null?e.sibling:null);Rr(n);break;case 19:var h=(e.flags&128)!==0;if(o=(a&n.childLanes)!==0,o||(Ja(e,n,a,!1),o=(a&n.childLanes)!==0),h){if(o)return Fx(e,n,a);n.flags|=128}if(h=n.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),D(Pt,Pt.current),o)break;return null;case 22:return n.lanes=0,Cx(e,n,a,n.pendingProps);case 24:Tr(n,ln,e.memoizedState.cache)}return er(e,n,a)}function Rx(e,n,a){if(e!==null)if(e.memoizedProps!==n.pendingProps)an=!0;else{if(!sd(e,a)&&(n.flags&128)===0)return an=!1,Bb(e,n,a);an=(e.flags&131072)!==0}else an=!1,xt&&(n.flags&1048576)!==0&&fm(n,Vi,n.index);switch(n.lanes=0,n.tag){case 16:e:{var o=n.pendingProps;if(e=ba(n.elementType),n.type=e,typeof e=="function")fu(e)?(o=ja(e,o),n.tag=1,n=Dx(null,n,e,o,a)):(n.tag=0,n=ed(null,n,e,o,a));else{if(e!=null){var h=e.$$typeof;if(h===B){n.tag=11,n=kx(null,n,e,o,a);break e}else if(h===V){n.tag=14,n=jx(null,n,e,o,a);break e}}throw n=ne(e)||e,Error(i(306,n,""))}}return n;case 0:return ed(e,n,n.type,n.pendingProps,a);case 1:return o=n.type,h=ja(o,n.pendingProps),Dx(e,n,o,h,a);case 3:e:{if(De(n,n.stateNode.containerInfo),e===null)throw Error(i(387));o=n.pendingProps;var p=n.memoizedState;h=p.element,Nu(e,n),es(n,o,null,a);var w=n.memoizedState;if(o=w.cache,Tr(n,ln,o),o!==p.cache&&wu(n,[ln],a,!0),Pi(),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=Tx(e,n,o,a);break e}else if(o!==h){h=sl(Error(i(424)),n),Gi(h),n=Tx(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($t=fl(e.firstChild),gn=n,xt=!0,Ar=null,ul=!0,a=Cm(n,null,o,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(xa(),o===h){n=er(e,n,a);break e}vn(e,n,o,a)}n=n.child}return n;case 26:return Fo(e,n),e===null?(a=Xp(n.type,null,n.pendingProps,null))?n.memoizedState=a:xt||(a=n.type,e=n.pendingProps,o=Qo(ge.current).createElement(a),o[tn]=n,o[Zt]=e,wn(o,a,e),St(o),n.stateNode=o):n.memoizedState=Xp(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return pe(n),e===null&&xt&&(o=n.stateNode=Ip(n.type,n.pendingProps,ge.current),gn=n,ul=!0,h=$t,Yr(n.type)?(Hd=h,$t=fl(o.firstChild)):$t=h),vn(e,n,n.pendingProps.children,a),Fo(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&xt&&((h=o=$t)&&(o=h2(o,n.type,n.pendingProps,ul),o!==null?(n.stateNode=o,gn=n,$t=fl(o.firstChild),ul=!1,h=!0):h=!1),h||Dr(n)),pe(n),h=n.type,p=n.pendingProps,w=e!==null?e.memoizedProps:null,o=p.children,_d(h,p)?o=null:w!==null&&_d(h,w)&&(n.flags|=32),n.memoizedState!==null&&(h=Ru(e,n,Ab,null,null,a),vs._currentValue=h),Fo(e,n),vn(e,n,o,a),n.child;case 6:return e===null&&xt&&((e=a=$t)&&(a=m2(a,n.pendingProps,ul),a!==null?(n.stateNode=a,gn=n,$t=null,e=!0):e=!1),e||Dr(n)),null;case 13:return zx(e,n,a);case 4:return De(n,n.stateNode.containerInfo),o=n.pendingProps,e===null?n.child=wa(n,null,o,a):vn(e,n,o,a),n.child;case 11:return kx(e,n,n.type,n.pendingProps,a);case 7:return vn(e,n,n.pendingProps,a),n.child;case 8:return vn(e,n,n.pendingProps.children,a),n.child;case 12:return vn(e,n,n.pendingProps.children,a),n.child;case 10:return o=n.pendingProps,Tr(n,n.type,o.value),vn(e,n,o.children,a),n.child;case 9:return h=n.type._context,o=n.pendingProps.children,ya(n),h=bn(h),o=o(h),n.flags|=1,vn(e,n,o,a),n.child;case 14:return jx(e,n,n.type,n.pendingProps,a);case 15:return Sx(e,n,n.type,n.pendingProps,a);case 19:return Fx(e,n,a);case 31:return Ob(e,n,a);case 22:return Cx(e,n,a,n.pendingProps);case 24:return ya(n),o=bn(ln),e===null?(h=Su(),h===null&&(h=Mt,p=ku(),h.pooledCache=p,p.refCount++,p!==null&&(h.pooledCacheLanes|=a),h=p),n.memoizedState={parent:o,cache:h},Eu(n),Tr(n,ln,h)):((e.lanes&a)!==0&&(Nu(e,n),es(n,null,null,a),Pi()),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),Tr(n,ln,o)):(o=p.cache,Tr(n,ln,o),o!==h.cache&&wu(n,[ln],a,!0))),vn(e,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(i(156,n.tag))}function tr(e){e.flags|=4}function od(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(sp())e.flags|=8192;else throw va=go,Cu}else e.flags&=-16777217}function _x(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Qp(n))if(sp())e.flags|=8192;else throw va=go,Cu}function _o(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?Qt():536870912,e.lanes|=n,ui|=n)}function is(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 $b(e,n,a){var o=n.pendingProps;switch(pu(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),Zl(ln),Ie(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Za(n)?tr(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,gu())),Lt(n),null;case 26:var h=n.type,p=n.memoizedState;return e===null?(tr(n),p!==null?(Lt(n),_x(n,p)):(Lt(n),od(n,h,null,o,a))):p?p!==e.memoizedState?(tr(n),Lt(n),_x(n,p)):(Lt(n),n.flags&=-16777217):(e=e.memoizedProps,e!==o&&tr(n),Lt(n),od(n,h,e,o,a)),null;case 27:if(Pe(n),a=ge.current,h=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==o&&tr(n);else{if(!o){if(n.stateNode===null)throw Error(i(166));return Lt(n),null}e=ue.current,Za(n)?mm(n):(e=Ip(h,o,a),n.stateNode=e,tr(n))}return Lt(n),null;case 5:if(Pe(n),h=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==o&&tr(n);else{if(!o){if(n.stateNode===null)throw Error(i(166));return Lt(n),null}if(p=ue.current,Za(n))mm(n);else{var w=Qo(ge.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[tn]=n,p[Zt]=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(wn(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&&tr(n)}}return Lt(n),od(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,a),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==o&&tr(n);else{if(typeof o!="string"&&n.stateNode===null)throw Error(i(166));if(e=ge.current,Za(n)){if(e=n.stateNode,a=n.memoizedProps,o=null,h=gn,h!==null)switch(h.tag){case 27:case 5:o=h.memoizedProps}e[tn]=n,e=!!(e.nodeValue===a||o!==null&&o.suppressHydrationWarning===!0||zp(e.nodeValue,a)),e||Dr(n,!0)}else e=Qo(e).createTextNode(o),e[tn]=n,n.stateNode=e}return Lt(n),null;case 31:if(a=n.memoizedState,e===null||e.memoizedState!==null){if(o=Za(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[tn]=n}else xa(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Lt(n),e=!1}else a=gu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return n.flags&256?(Qn(n),n):(Qn(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=Za(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[tn]=n}else xa(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Lt(n),h=!1}else h=gu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=h),h=!0;if(!h)return n.flags&256?(Qn(n),n):(Qn(n),null)}return Qn(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),_o(n,n.updateQueue),Lt(n),null);case 4:return Ie(),e===null&&Td(n.stateNode.containerInfo),Lt(n),null;case 10:return Zl(n.type),Lt(n),null;case 19:if(G(Pt),o=n.memoizedState,o===null)return Lt(n),null;if(h=(n.flags&128)!==0,p=o.rendering,p===null)if(h)is(o,!1);else{if(Kt!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(p=ko(e),p!==null){for(n.flags|=128,is(o,!1),e=p.updateQueue,n.updateQueue=e,_o(n,e),n.subtreeFlags=0,e=a,a=n.child;a!==null;)cm(a,e),a=a.sibling;return D(Pt,Pt.current&1|2),xt&&Wl(n,o.treeForkCount),n.child}e=e.sibling}o.tail!==null&&yt()>Ho&&(n.flags|=128,h=!0,is(o,!1),n.lanes=4194304)}else{if(!h)if(e=ko(p),e!==null){if(n.flags|=128,h=!0,e=e.updateQueue,n.updateQueue=e,_o(n,e),is(o,!0),o.tail===null&&o.tailMode==="hidden"&&!p.alternate&&!xt)return Lt(n),null}else 2*yt()-o.renderingStartTime>Ho&&a!==536870912&&(n.flags|=128,h=!0,is(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=yt(),e.sibling=null,a=Pt.current,D(Pt,h?a&1|2:a&1),xt&&Wl(n,o.treeForkCount),e):(Lt(n),null);case 22:case 23:return Qn(n),zu(),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&&_o(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&&G(ga),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),Zl(ln),Lt(n),null;case 25:return null;case 30:return null}throw Error(i(156,n.tag))}function Lb(e,n){switch(pu(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return Zl(ln),Ie(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return Pe(n),null;case 31:if(n.memoizedState!==null){if(Qn(n),n.alternate===null)throw Error(i(340));xa()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(Qn(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(i(340));xa()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return G(Pt),null;case 4:return Ie(),null;case 10:return Zl(n.type),null;case 22:case 23:return Qn(n),zu(),e!==null&&G(ga),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return Zl(ln),null;case 25:return null;default:return null}}function Ox(e,n){switch(pu(n),n.tag){case 3:Zl(ln),Ie();break;case 26:case 27:case 5:Pe(n);break;case 4:Ie();break;case 31:n.memoizedState!==null&&Qn(n);break;case 13:Qn(n);break;case 19:G(Pt);break;case 10:Zl(n.type);break;case 22:case 23:Qn(n),zu(),e!==null&&G(ga);break;case 24:Zl(ln)}}function ss(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){Et(n,n.return,N)}}function Or(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 H=a,ee=N;try{ee()}catch(oe){Et(h,H,oe)}}}o=o.next}while(o!==p)}}catch(oe){Et(n,n.return,oe)}}function Bx(e){var n=e.updateQueue;if(n!==null){var a=e.stateNode;try{Nm(n,a)}catch(o){Et(e,e.return,o)}}}function $x(e,n,a){a.props=ja(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(o){Et(e,n,o)}}function os(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){Et(e,n,h)}}function zl(e,n){var a=e.ref,o=e.refCleanup;if(a!==null)if(typeof o=="function")try{o()}catch(h){Et(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){Et(e,n,h)}else a.current=null}function Lx(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){Et(e,e.return,h)}}function cd(e,n,a){try{var o=e.stateNode;s2(o,e.type,a,n),o[Zt]=n}catch(h){Et(e,e.return,h)}}function Hx(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Yr(e.type)||e.tag===4}function ud(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Hx(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&&Yr(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 dd(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=gl));else if(o!==4&&(o===27&&Yr(e.type)&&(a=e.stateNode,n=null),e=e.child,e!==null))for(dd(e,n,a),e=e.sibling;e!==null;)dd(e,n,a),e=e.sibling}function Oo(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&&Yr(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Oo(e,n,a),e=e.sibling;e!==null;)Oo(e,n,a),e=e.sibling}function Ux(e){var n=e.stateNode,a=e.memoizedProps;try{for(var o=e.type,h=n.attributes;h.length;)n.removeAttributeNode(h[0]);wn(n,o,a),n[tn]=e,n[Zt]=a}catch(p){Et(e,e.return,p)}}var nr=!1,sn=!1,fd=!1,Ix=typeof WeakSet=="function"?WeakSet:Set,pn=null;function Hb(e,n){if(e=e.containerInfo,Fd=lc,e=em(e),au(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,H=-1,ee=0,oe=0,de=e,te=null;t:for(;;){for(var re;de!==a||h!==0&&de.nodeType!==3||(N=w+h),de!==p||o!==0&&de.nodeType!==3||(H=w+o),de.nodeType===3&&(w+=de.nodeValue.length),(re=de.firstChild)!==null;)te=de,de=re;for(;;){if(de===e)break t;if(te===a&&++ee===h&&(N=w),te===p&&++oe===o&&(H=w),(re=de.nextSibling)!==null)break;de=te,te=de.parentNode}de=re}a=N===-1||H===-1?null:{start:N,end:H}}else a=null}a=a||{start:0,end:0}}else a=null;for(Rd={focusedElem:e,selectionRange:a},lc=!1,pn=n;pn!==null;)if(n=pn,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,pn=e;else for(;pn!==null;){switch(n=pn,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 _e=ja(a.type,h);e=o.getSnapshotBeforeUpdate(_e,p),o.__reactInternalSnapshotBeforeUpdate=e}catch(Qe){Et(a,a.return,Qe)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,a=e.nodeType,a===9)Bd(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Bd(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,pn=e;break}pn=n.return}}function Yx(e,n,a){var o=a.flags;switch(a.tag){case 0:case 11:case 15:rr(e,a),o&4&&ss(5,a);break;case 1:if(rr(e,a),o&4)if(e=a.stateNode,n===null)try{e.componentDidMount()}catch(w){Et(a,a.return,w)}else{var h=ja(a.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(h,n,e.__reactInternalSnapshotBeforeUpdate)}catch(w){Et(a,a.return,w)}}o&64&&Bx(a),o&512&&os(a,a.return);break;case 3:if(rr(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{Nm(e,n)}catch(w){Et(a,a.return,w)}}break;case 27:n===null&&o&4&&Ux(a);case 26:case 5:rr(e,a),n===null&&o&4&&Lx(a),o&512&&os(a,a.return);break;case 12:rr(e,a);break;case 31:rr(e,a),o&4&&Vx(e,a);break;case 13:rr(e,a),o&4&&Gx(e,a),o&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=Wb.bind(null,a),x2(e,a))));break;case 22:if(o=a.memoizedState!==null||nr,!o){n=n!==null&&n.memoizedState!==null||sn,h=nr;var p=sn;nr=o,(sn=n)&&!p?ar(e,a,(a.subtreeFlags&8772)!==0):rr(e,a),nr=h,sn=p}break;case 30:break;default:rr(e,a)}}function qx(e){var n=e.alternate;n!==null&&(e.alternate=null,qx(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&sa(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,$n=!1;function lr(e,n,a){for(a=a.child;a!==null;)Xx(e,n,a),a=a.sibling}function Xx(e,n,a){if(Je&&typeof Je.onCommitFiberUnmount=="function")try{Je.onCommitFiberUnmount(He,a)}catch{}switch(a.tag){case 26:sn||zl(a,n),lr(e,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:sn||zl(a,n);var o=It,h=$n;Yr(a.type)&&(It=a.stateNode,$n=!1),lr(e,n,a),ys(a.stateNode),It=o,$n=h;break;case 5:sn||zl(a,n);case 6:if(o=It,h=$n,It=null,lr(e,n,a),It=o,$n=h,It!==null)if($n)try{(It.nodeType===9?It.body:It.nodeName==="HTML"?It.ownerDocument.body:It).removeChild(a.stateNode)}catch(p){Et(a,n,p)}else try{It.removeChild(a.stateNode)}catch(p){Et(a,n,p)}break;case 18:It!==null&&($n?(e=It,Bp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),gi(e)):Bp(It,a.stateNode));break;case 4:o=It,h=$n,It=a.stateNode.containerInfo,$n=!0,lr(e,n,a),It=o,$n=h;break;case 0:case 11:case 14:case 15:Or(2,a,n),sn||Or(4,a,n),lr(e,n,a);break;case 1:sn||(zl(a,n),o=a.stateNode,typeof o.componentWillUnmount=="function"&&$x(a,n,o)),lr(e,n,a);break;case 21:lr(e,n,a);break;case 22:sn=(o=sn)||a.memoizedState!==null,lr(e,n,a),sn=o;break;default:lr(e,n,a)}}function Vx(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{gi(e)}catch(a){Et(n,n.return,a)}}}function Gx(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{gi(e)}catch(a){Et(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 Ix),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new Ix),n;default:throw Error(i(435,e.tag))}}function Bo(e,n){var a=Ub(e);n.forEach(function(o){if(!a.has(o)){a.add(o);var h=Qb.bind(null,e,o);o.then(h,h)}})}function Ln(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(Yr(N.type)){It=N.stateNode,$n=!1;break e}break;case 5:It=N.stateNode,$n=!1;break e;case 3:case 4:It=N.stateNode.containerInfo,$n=!0;break e}N=N.return}if(It===null)throw Error(i(160));Xx(p,w,h),It=null,$n=!1,p=h.alternate,p!==null&&(p.return=null),h.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Kx(n,e),n=n.sibling}var wl=null;function Kx(e,n){var a=e.alternate,o=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Ln(n,e),Hn(e),o&4&&(Or(3,e,e.return),ss(3,e),Or(5,e,e.return));break;case 1:Ln(n,e),Hn(e),o&512&&(sn||a===null||zl(a,a.return)),o&64&&nr&&(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=wl;if(Ln(n,e),Hn(e),o&512&&(sn||a===null||zl(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[Vn]||p[tn]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=h.createElement(o),h.head.insertBefore(p,h.querySelector("head > title"))),wn(p,o,a),p[tn]=e,St(p),o=p;break e;case"link":var w=Kp("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),wn(p,o,a),h.head.appendChild(p);break;case"meta":if(w=Kp("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),wn(p,o,a),h.head.appendChild(p);break;default:throw Error(i(468,o))}p[tn]=e,St(p),o=p}e.stateNode=o}else Wp(h,e.type,e.stateNode);else e.stateNode=Gp(h,o,e.memoizedProps);else p!==o?(p===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):p.count--,o===null?Wp(h,e.type,e.stateNode):Gp(h,o,e.memoizedProps)):o===null&&e.stateNode!==null&&cd(e,e.memoizedProps,a.memoizedProps)}break;case 27:Ln(n,e),Hn(e),o&512&&(sn||a===null||zl(a,a.return)),a!==null&&o&4&&cd(e,e.memoizedProps,a.memoizedProps);break;case 5:if(Ln(n,e),Hn(e),o&512&&(sn||a===null||zl(a,a.return)),e.flags&32){h=e.stateNode;try{vr(h,"")}catch(_e){Et(e,e.return,_e)}}o&4&&e.stateNode!=null&&(h=e.memoizedProps,cd(e,h,a!==null?a.memoizedProps:h)),o&1024&&(fd=!0);break;case 6:if(Ln(n,e),Hn(e),o&4){if(e.stateNode===null)throw Error(i(162));o=e.memoizedProps,a=e.stateNode;try{a.nodeValue=o}catch(_e){Et(e,e.return,_e)}}break;case 3:if(Po=null,h=wl,wl=Zo(n.containerInfo),Ln(n,e),wl=h,Hn(e),o&4&&a!==null&&a.memoizedState.isDehydrated)try{gi(n.containerInfo)}catch(_e){Et(e,e.return,_e)}fd&&(fd=!1,Wx(e));break;case 4:o=wl,wl=Zo(e.stateNode.containerInfo),Ln(n,e),Hn(e),wl=o;break;case 12:Ln(n,e),Hn(e);break;case 31:Ln(n,e),Hn(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,Bo(e,o)));break;case 13:Ln(n,e),Hn(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Lo=yt()),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,Bo(e,o)));break;case 22:h=e.memoizedState!==null;var H=a!==null&&a.memoizedState!==null,ee=nr,oe=sn;if(nr=ee||h,sn=oe||H,Ln(n,e),sn=oe,nr=ee,Hn(e),o&8192)e:for(n=e.stateNode,n._visibility=h?n._visibility&-2:n._visibility|1,h&&(a===null||H||nr||sn||Sa(e)),a=null,n=e;;){if(n.tag===5||n.tag===26){if(a===null){H=a=n;try{if(p=H.stateNode,h)w=p.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{N=H.stateNode;var de=H.memoizedProps.style,te=de!=null&&de.hasOwnProperty("display")?de.display:null;N.style.display=te==null||typeof te=="boolean"?"":(""+te).trim()}}catch(_e){Et(H,H.return,_e)}}}else if(n.tag===6){if(a===null){H=n;try{H.stateNode.nodeValue=h?"":H.memoizedProps}catch(_e){Et(H,H.return,_e)}}}else if(n.tag===18){if(a===null){H=n;try{var re=H.stateNode;h?$p(re,!0):$p(H.stateNode,!1)}catch(_e){Et(H,H.return,_e)}}}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,Bo(e,a))));break;case 19:Ln(n,e),Hn(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,Bo(e,o)));break;case 30:break;case 21:break;default:Ln(n,e),Hn(e)}}function Hn(e){var n=e.flags;if(n&2){try{for(var a,o=e.return;o!==null;){if(Hx(o)){a=o;break}o=o.return}if(a==null)throw Error(i(160));switch(a.tag){case 27:var h=a.stateNode,p=ud(e);Oo(e,p,h);break;case 5:var w=a.stateNode;a.flags&32&&(vr(w,""),a.flags&=-33);var N=ud(e);Oo(e,N,w);break;case 3:case 4:var H=a.stateNode.containerInfo,ee=ud(e);dd(e,ee,H);break;default:throw Error(i(161))}}catch(oe){Et(e,e.return,oe)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function Wx(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;Wx(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function rr(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Yx(e,n.alternate,n),n=n.sibling}function Sa(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:Or(4,n,n.return),Sa(n);break;case 1:zl(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&$x(n,n.return,a),Sa(n);break;case 27:ys(n.stateNode);case 26:case 5:zl(n,n.return),Sa(n);break;case 22:n.memoizedState===null&&Sa(n);break;case 30:Sa(n);break;default:Sa(n)}e=e.sibling}}function ar(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:ar(h,p,a),ss(4,p);break;case 1:if(ar(h,p,a),o=p,h=o.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(ee){Et(o,o.return,ee)}if(o=p,h=o.updateQueue,h!==null){var N=o.stateNode;try{var H=h.shared.hiddenCallbacks;if(H!==null)for(h.shared.hiddenCallbacks=null,h=0;h<H.length;h++)Em(H[h],N)}catch(ee){Et(o,o.return,ee)}}a&&w&64&&Bx(p),os(p,p.return);break;case 27:Ux(p);case 26:case 5:ar(h,p,a),a&&o===null&&w&4&&Lx(p),os(p,p.return);break;case 12:ar(h,p,a);break;case 31:ar(h,p,a),a&&w&4&&Vx(h,p);break;case 13:ar(h,p,a),a&&w&4&&Gx(h,p);break;case 22:p.memoizedState===null&&ar(h,p,a),os(p,p.return);break;case 30:break;default:ar(h,p,a)}n=n.sibling}}function hd(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&&Ki(a))}function md(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&Ki(e))}function kl(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:kl(e,n,a,o),h&2048&&ss(9,n);break;case 1:kl(e,n,a,o);break;case 3:kl(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&&Ki(e)));break;case 12:if(h&2048){kl(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(H){Et(n,n.return,H)}}else kl(e,n,a,o);break;case 31:kl(e,n,a,o);break;case 13:kl(e,n,a,o);break;case 23:break;case 22:p=n.stateNode,w=n.alternate,n.memoizedState!==null?p._visibility&2?kl(e,n,a,o):cs(e,n):p._visibility&2?kl(e,n,a,o):(p._visibility|=2,si(e,n,a,o,(n.subtreeFlags&10256)!==0||!1)),h&2048&&hd(w,n);break;case 24:kl(e,n,a,o),h&2048&&md(n.alternate,n);break;default:kl(e,n,a,o)}}function si(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,H=o,ee=w.flags;switch(w.tag){case 0:case 11:case 15:si(p,w,N,H,h),ss(8,w);break;case 23:break;case 22:var oe=w.stateNode;w.memoizedState!==null?oe._visibility&2?si(p,w,N,H,h):cs(p,w):(oe._visibility|=2,si(p,w,N,H,h)),h&&ee&2048&&hd(w.alternate,w);break;case 24:si(p,w,N,H,h),h&&ee&2048&&md(w.alternate,w);break;default:si(p,w,N,H,h)}n=n.sibling}}function cs(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:cs(a,o),h&2048&&hd(o.alternate,o);break;case 24:cs(a,o),h&2048&&md(o.alternate,o);break;default:cs(a,o)}n=n.sibling}}var us=8192;function oi(e,n,a){if(e.subtreeFlags&us)for(e=e.child;e!==null;)Zx(e,n,a),e=e.sibling}function Zx(e,n,a){switch(e.tag){case 26:oi(e,n,a),e.flags&us&&e.memoizedState!==null&&N2(a,wl,e.memoizedState,e.memoizedProps);break;case 5:oi(e,n,a);break;case 3:case 4:var o=wl;wl=Zo(e.stateNode.containerInfo),oi(e,n,a),wl=o;break;case 22:e.memoizedState===null&&(o=e.alternate,o!==null&&o.memoizedState!==null?(o=us,us=16777216,oi(e,n,a),us=o):oi(e,n,a));break;default:oi(e,n,a)}}function Jx(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 ds(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];pn=o,ep(o,e)}Jx(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Px(e),e=e.sibling}function Px(e){switch(e.tag){case 0:case 11:case 15:ds(e),e.flags&2048&&Or(9,e,e.return);break;case 3:ds(e);break;case 12:ds(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,$o(e)):ds(e);break;default:ds(e)}}function $o(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];pn=o,ep(o,e)}Jx(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:Or(8,n,n.return),$o(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,$o(n));break;default:$o(n)}e=e.sibling}}function ep(e,n){for(;pn!==null;){var a=pn;switch(a.tag){case 0:case 11:case 15:Or(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:Ki(a.memoizedState.cache)}if(o=a.child,o!==null)o.return=a,pn=o;else e:for(a=e;pn!==null;){o=pn;var h=o.sibling,p=o.return;if(qx(o),o===a){pn=null;break e}if(h!==null){h.return=p,pn=h;break e}pn=p}}}var Ib={getCacheForType:function(e){var n=bn(ln),a=n.data.get(e);return a===void 0&&(a=e(),n.data.set(e,a)),a},cacheSignal:function(){return bn(ln).controller.signal}},Yb=typeof WeakMap=="function"?WeakMap:Map,wt=0,Mt=null,ot=null,dt=0,Ct=0,Zn=null,Br=!1,ci=!1,xd=!1,ir=0,Kt=0,$r=0,Ca=0,pd=0,Jn=0,ui=0,fs=null,Un=null,yd=!1,Lo=0,tp=0,Ho=1/0,Uo=null,Lr=null,dn=0,Hr=null,di=null,sr=0,gd=0,bd=null,np=null,hs=0,vd=null;function Pn(){return(wt&2)!==0&&dt!==0?dt&-dt:I.T!==null?Ed():Ul()}function lp(){if(Jn===0)if((dt&536870912)===0||xt){var e=xl;xl<<=1,(xl&3932160)===0&&(xl=262144),Jn=e}else Jn=536870912;return e=Wn.current,e!==null&&(e.flags|=32),Jn}function In(e,n,a){(e===Mt&&(Ct===2||Ct===9)||e.cancelPendingCommit!==null)&&(fi(e,0),Ur(e,dt,Jn,!1)),pl(e,a),((wt&2)===0||e!==Mt)&&(e===Mt&&((wt&2)===0&&(Ca|=a),Kt===4&&Ur(e,dt,Jn,!1)),Ml(e))}function rp(e,n,a){if((wt&6)!==0)throw Error(i(327));var o=!a&&(n&127)===0&&(n&e.expiredLanes)===0||un(e,n),h=o?Vb(e,n):kd(e,n,!0),p=o;do{if(h===0){ci&&!o&&Ur(e,n,0,!1);break}else{if(a=e.current.alternate,p&&!qb(a)){h=kd(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=fs;var H=N.current.memoizedState.isDehydrated;if(H&&(fi(N,w).flags|=256),w=kd(N,w,!1),w!==2){if(xd&&!H){N.errorRecoveryDisabledLanes|=p,Ca|=p,h=4;break e}p=Un,Un=h,p!==null&&(Un===null?Un=p:Un.push.apply(Un,p))}h=w}if(p=!1,h!==2)continue}}if(h===1){fi(e,0),Ur(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:Ur(o,n,Jn,!Br);break e;case 2:Un=null;break;case 3:case 5:break;default:throw Error(i(329))}if((n&62914560)===n&&(h=Lo+300-yt(),10<h)){if(Ur(o,n,Jn,!Br),Nn(o,0,!0)!==0)break e;sr=n,o.timeoutHandle=_p(ap.bind(null,o,a,Un,Uo,yd,n,Jn,Ca,ui,Br,p,"Throttled",-0,0),h);break e}ap(o,a,Un,Uo,yd,n,Jn,Ca,ui,Br,p,null,-0,0)}}break}while(!0);Ml(e)}function ap(e,n,a,o,h,p,w,N,H,ee,oe,de,te,re){if(e.timeoutHandle=-1,de=n.subtreeFlags,de&8192||(de&16785408)===16785408){de={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:gl},Zx(n,p,de);var _e=(p&62914560)===p?Lo-yt():(p&4194048)===p?tp-yt():0;if(_e=A2(de,_e),_e!==null){sr=p,e.cancelPendingCommit=_e(hp.bind(null,e,n,p,a,o,h,w,N,H,oe,de,null,te,re)),Ur(e,p,w,!ee);return}}hp(e,n,p,a,o,h,w,N,H)}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(!Gn(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 Ur(e,n,a,o){n&=~pd,n&=~Ca,e.suspendedLanes|=n,e.pingedLanes&=~n,o&&(e.warmLanes|=n),o=e.expirationTimes;for(var h=n;0<h;){var p=31-et(h),w=1<<p;o[p]=-1,h&=~w}a!==0&&Ba(e,a,n)}function Io(){return(wt&6)===0?(ms(0),!1):!0}function wd(){if(ot!==null){if(Ct===0)var e=ot.return;else e=ot,Ql=pa=null,Bu(e),ni=null,Qi=0,e=ot;for(;e!==null;)Ox(e.alternate,e),e=e.return;ot=null}}function fi(e,n){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,u2(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),sr=0,wd(),Mt=e,ot=a=Kl(e.current,null),dt=n,Ct=0,Zn=null,Br=!1,ci=un(e,n),xd=!1,ui=Jn=pd=Ca=$r=Kt=0,Un=fs=null,yd=!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-et(o),p=1<<h;n|=e[h],o&=~p}return ir=n,oo(),a}function ip(e,n){lt=null,I.H=rs,n===ti||n===yo?(n=km(),Ct=3):n===Cu?(n=km(),Ct=4):Ct=n===Pu?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,Zn=n,ot===null&&(Kt=1,zo(e,sl(n,e.current)))}function sp(){var e=Wn.current;return e===null?!0:(dt&4194048)===dt?dl===null:(dt&62914560)===dt||(dt&536870912)!==0?e===dl:!1}function op(){var e=I.H;return I.H=rs,e===null?rs:e}function cp(){var e=I.A;return I.A=Ib,e}function Yo(){Kt=4,Br||(dt&4194048)!==dt&&Wn.current!==null||(ci=!0),($r&134217727)===0&&(Ca&134217727)===0||Mt===null||Ur(Mt,dt,Jn,!1)}function kd(e,n,a){var o=wt;wt|=2;var h=op(),p=cp();(Mt!==e||dt!==n)&&(Uo=null,fi(e,n)),n=!1;var w=Kt;e:do try{if(Ct!==0&&ot!==null){var N=ot,H=Zn;switch(Ct){case 8:wd(),w=6;break e;case 3:case 2:case 9:case 6:Wn.current===null&&(n=!0);var ee=Ct;if(Ct=0,Zn=null,hi(e,N,H,ee),a&&ci){w=0;break e}break;default:ee=Ct,Ct=0,Zn=null,hi(e,N,H,ee)}}Xb(),w=Kt;break}catch(oe){ip(e,oe)}while(!0);return n&&e.shellSuspendCounter++,Ql=pa=null,wt=o,I.H=h,I.A=p,ot===null&&(Mt=null,dt=0,oo()),w}function Xb(){for(;ot!==null;)up(ot)}function Vb(e,n){var a=wt;wt|=2;var o=op(),h=cp();Mt!==e||dt!==n?(Uo=null,Ho=yt()+500,fi(e,n)):ci=un(e,n);e:do try{if(Ct!==0&&ot!==null){n=ot;var p=Zn;t:switch(Ct){case 1:Ct=0,Zn=null,hi(e,n,p,1);break;case 2:case 9:if(vm(p)){Ct=0,Zn=null,dp(n);break}n=function(){Ct!==2&&Ct!==9||Mt!==e||(Ct=7),Ml(e)},p.then(n,n);break e;case 3:Ct=7;break e;case 4:Ct=5;break e;case 7:vm(p)?(Ct=0,Zn=null,dp(n)):(Ct=0,Zn=null,hi(e,n,p,7));break;case 5:var w=null;switch(ot.tag){case 26:w=ot.memoizedState;case 5:case 27:var N=ot;if(w?Qp(w):N.stateNode.complete){Ct=0,Zn=null;var H=N.sibling;if(H!==null)ot=H;else{var ee=N.return;ee!==null?(ot=ee,qo(ee)):ot=null}break t}}Ct=0,Zn=null,hi(e,n,p,5);break;case 6:Ct=0,Zn=null,hi(e,n,p,6);break;case 8:wd(),Kt=6;break e;default:throw Error(i(462))}}Gb();break}catch(oe){ip(e,oe)}while(!0);return Ql=pa=null,I.H=o,I.A=h,wt=a,ot!==null?0:(Mt=null,dt=0,oo(),Kt)}function Gb(){for(;ot!==null&&!jt();)up(ot)}function up(e){var n=Rx(e.alternate,e,ir);e.memoizedProps=e.pendingProps,n===null?qo(e):ot=n}function dp(e){var n=e,a=n.alternate;switch(n.tag){case 15:case 0:n=Ax(a,n,n.pendingProps,n.type,void 0,dt);break;case 11:n=Ax(a,n,n.pendingProps,n.type.render,n.ref,dt);break;case 5:Bu(n);default:Ox(a,n),n=ot=cm(n,ir),n=Rx(a,n,ir)}e.memoizedProps=e.pendingProps,n===null?qo(e):ot=n}function hi(e,n,a,o){Ql=pa=null,Bu(n),ni=null,Qi=0;var h=n.return;try{if(_b(e,h,n,a,dt)){Kt=1,zo(e,sl(a,e.current)),ot=null;return}}catch(p){if(h!==null)throw ot=h,p;Kt=1,zo(e,sl(a,e.current)),ot=null;return}n.flags&32768?(xt||o===1?e=!0:ci||(dt&536870912)!==0?e=!1:(Br=e=!0,(o===2||o===9||o===3||o===6)&&(o=Wn.current,o!==null&&o.tag===13&&(o.flags|=16384))),fp(n,e)):qo(n)}function qo(e){var n=e;do{if((n.flags&32768)!==0){fp(n,Br);return}e=n.return;var a=$b(n.alternate,n,ir);if(a!==null){ot=a;return}if(n=n.sibling,n!==null){ot=n;return}ot=n=e}while(n!==null);Kt===0&&(Kt=5)}function fp(e,n){do{var a=Lb(e.alternate,e);if(a!==null){a.flags&=32767,ot=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(e=e.sibling,e!==null)){ot=e;return}ot=e=a}while(e!==null);Kt=6,ot=null}function hp(e,n,a,o,h,p,w,N,H){e.cancelPendingCommit=null;do Xo();while(dn!==0);if((wt&6)!==0)throw Error(i(327));if(n!==null){if(n===e.current)throw Error(i(177));if(p=n.lanes|n.childLanes,p|=uu,Ps(e,a,p,w,N,H),e===Mt&&(ot=Mt=null,dt=0),di=n,Hr=e,sr=a,gd=p,bd=h,np=o,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Zb(Fe,function(){return gp(),null})):(e.callbackNode=null,e.callbackPriority=0),o=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||o){o=I.T,I.T=null,h=P.p,P.p=2,w=wt,wt|=4;try{Hb(e,n,a)}finally{wt=w,P.p=h,I.T=o}}dn=1,mp(),xp(),pp()}}function mp(){if(dn===1){dn=0;var e=Hr,n=di,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=I.T,I.T=null;var o=P.p;P.p=2;var h=wt;wt|=4;try{Kx(n,e);var p=Rd,w=em(e.containerInfo),N=p.focusedElem,H=p.selectionRange;if(w!==N&&N&&N.ownerDocument&&Ph(N.ownerDocument.documentElement,N)){if(H!==null&&au(N)){var ee=H.start,oe=H.end;if(oe===void 0&&(oe=ee),"selectionStart"in N)N.selectionStart=ee,N.selectionEnd=Math.min(oe,N.value.length);else{var de=N.ownerDocument||document,te=de&&de.defaultView||window;if(te.getSelection){var re=te.getSelection(),_e=N.textContent.length,Qe=Math.min(H.start,_e),Tt=H.end===void 0?Qe:Math.min(H.end,_e);!re.extend&&Qe>Tt&&(w=Tt,Tt=Qe,Qe=w);var Q=Jh(N,Qe),X=Jh(N,Tt);if(Q&&X&&(re.rangeCount!==1||re.anchorNode!==Q.node||re.anchorOffset!==Q.offset||re.focusNode!==X.node||re.focusOffset!==X.offset)){var J=de.createRange();J.setStart(Q.node,Q.offset),re.removeAllRanges(),Qe>Tt?(re.addRange(J),re.extend(X.node,X.offset)):(J.setEnd(X.node,X.offset),re.addRange(J))}}}}for(de=[],re=N;re=re.parentNode;)re.nodeType===1&&de.push({element:re,left:re.scrollLeft,top:re.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<de.length;N++){var ce=de[N];ce.element.scrollLeft=ce.left,ce.element.scrollTop=ce.top}}lc=!!Fd,Rd=Fd=null}finally{wt=h,P.p=o,I.T=a}}e.current=n,dn=2}}function xp(){if(dn===2){dn=0;var e=Hr,n=di,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=I.T,I.T=null;var o=P.p;P.p=2;var h=wt;wt|=4;try{Yx(e,n.alternate,n)}finally{wt=h,P.p=o,I.T=a}}dn=3}}function pp(){if(dn===4||dn===3){dn=0,Ut();var e=Hr,n=di,a=sr,o=np;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?dn=5:(dn=0,di=Hr=null,yp(e,e.pendingLanes));var h=e.pendingLanes;if(h===0&&(Lr=null),ia(a),n=n.stateNode,Je&&typeof Je.onCommitFiberRoot=="function")try{Je.onCommitFiberRoot(He,n,void 0,(n.current.flags&128)===128)}catch{}if(o!==null){n=I.T,h=P.p,P.p=2,I.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{I.T=n,P.p=h}}(sr&3)!==0&&Xo(),Ml(e),h=e.pendingLanes,(a&261930)!==0&&(h&42)!==0?e===vd?hs++:(hs=0,vd=e):hs=0,ms(0)}}function yp(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,Ki(n)))}function Xo(){return mp(),xp(),pp(),gp()}function gp(){if(dn!==5)return!1;var e=Hr,n=gd;gd=0;var a=ia(sr),o=I.T,h=P.p;try{P.p=32>a?32:a,I.T=null,a=bd,bd=null;var p=Hr,w=sr;if(dn=0,di=Hr=null,sr=0,(wt&6)!==0)throw Error(i(331));var N=wt;if(wt|=4,Px(p.current),Qx(p,p.current,w,a),wt=N,ms(0,!1),Je&&typeof Je.onPostCommitFiberRoot=="function")try{Je.onPostCommitFiberRoot(He,p)}catch{}return!0}finally{P.p=h,I.T=o,yp(e,n)}}function bp(e,n,a){n=sl(a,n),n=Ju(e.stateNode,n,2),e=Fr(e,n,2),e!==null&&(pl(e,2),Ml(e))}function Et(e,n,a){if(e.tag===3)bp(e,e,a);else for(;n!==null;){if(n.tag===3){bp(n,e,a);break}else if(n.tag===1){var o=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(Lr===null||!Lr.has(o))){e=sl(a,e),a=vx(2),o=Fr(n,a,2),o!==null&&(wx(a,o,n,e),pl(o,2),Ml(o));break}}n=n.return}}function jd(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)||(xd=!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,Mt===e&&(dt&a)===a&&(Kt===4||Kt===3&&(dt&62914560)===dt&&300>yt()-Lo?(wt&2)===0&&fi(e,0):pd|=a,ui===dt&&(ui=0)),Ml(e)}function vp(e,n){n===0&&(n=Qt()),e=ha(e,n),e!==null&&(pl(e,n),Ml(e))}function Wb(e){var n=e.memoizedState,a=0;n!==null&&(a=n.retryLane),vp(e,a)}function Qb(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),vp(e,a)}function Zb(e,n){return Be(e,n)}var Vo=null,mi=null,Sd=!1,Go=!1,Cd=!1,Ir=0;function Ml(e){e!==mi&&e.next===null&&(mi===null?Vo=mi=e:mi=mi.next=e),Go=!0,Sd||(Sd=!0,Pb())}function ms(e,n){if(!Cd&&Go){Cd=!0;do for(var a=!1,o=Vo;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-et(42|e)+1)-1,p&=h&~(w&~N),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(a=!0,Sp(o,p))}else p=dt,p=Nn(o,o===Mt?p:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(p&3)===0||un(o,p)||(a=!0,Sp(o,p));o=o.next}while(a);Cd=!1}}function Jb(){wp()}function wp(){Go=Sd=!1;var e=0;Ir!==0&&c2()&&(e=Ir);for(var n=yt(),a=null,o=Vo;o!==null;){var h=o.next,p=kp(o,n);p===0?(o.next=null,a===null?Vo=h:a.next=h,h===null&&(mi=a)):(a=o,(e!==0||(p&3)!==0)&&(Go=!0)),o=h}dn!==0&&dn!==5||ms(e),Ir!==0&&(Ir=0)}function kp(e,n){for(var a=e.suspendedLanes,o=e.pingedLanes,h=e.expirationTimes,p=e.pendingLanes&-62914561;0<p;){var w=31-et(p),N=1<<w,H=h[w];H===-1?((N&a)===0||(N&o)!==0)&&(h[w]=ke(N,n)):H<=n&&(e.expiredLanes|=N),p&=~N}if(n=Mt,a=dt,a=Nn(e,e===n?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o=e.callbackNode,a===0||e===n&&(Ct===2||Ct===9)||e.cancelPendingCommit!==null)return o!==null&&o!==null&&tt(o),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||un(e,a)){if(n=a&-a,n===e.callbackPriority)return n;switch(o!==null&&tt(o),ia(a)){case 2:case 8:a=me;break;case 32:a=Fe;break;case 268435456:a=ye;break;default:a=Fe}return o=jp.bind(null,e),a=Be(a,o),e.callbackPriority=n,e.callbackNode=a,n}return o!==null&&o!==null&&tt(o),e.callbackPriority=2,e.callbackNode=null,2}function jp(e,n){if(dn!==0&&dn!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Xo()&&e.callbackNode!==a)return null;var o=dt;return o=Nn(e,e===Mt?o:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o===0?null:(rp(e,o,n),kp(e,yt()),e.callbackNode!=null&&e.callbackNode===a?jp.bind(null,e):null)}function Sp(e,n){if(Xo())return null;rp(e,n,!0)}function Pb(){d2(function(){(wt&6)!==0?Be(ie,Jb):wp()})}function Ed(){if(Ir===0){var e=Pa;e===0&&(e=hr,hr<<=1,(hr&261888)===0&&(hr=256)),Ir=e}return Ir}function Cp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:wr(""+e)}function Ep(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=Cp((h[Zt]||null).action),w=o.submitter;w&&(n=(n=w[Zt]||null)?Cp(n.formAction):w.getAttribute("formAction"),n!==null&&(p=n,w=null));var N=new We("action","action",null,o,h);e.push({event:N,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(Ir!==0){var H=w?Ep(h,w):new FormData(h);Vu(a,{pending:!0,data:H,method:h.method,action:p},null,H)}}else typeof p=="function"&&(N.preventDefault(),H=w?Ep(h,w):new FormData(h),Vu(a,{pending:!0,data:H,method:h.method,action:p},p,H))},currentTarget:h}]})}}for(var Nd=0;Nd<cu.length;Nd++){var Ad=cu[Nd],t2=Ad.toLowerCase(),n2=Ad[0].toUpperCase()+Ad.slice(1);vl(t2,"on"+n2)}vl(lm,"onAnimationEnd"),vl(rm,"onAnimationIteration"),vl(am,"onAnimationStart"),vl("dblclick","onDoubleClick"),vl("focusin","onFocus"),vl("focusout","onBlur"),vl(gb,"onTransitionRun"),vl(bb,"onTransitionStart"),vl(vb,"onTransitionCancel"),vl(im,"onTransitionEnd"),Dn("onMouseEnter",["mouseout","mouseover"]),Dn("onMouseLeave",["mouseout","mouseover"]),Dn("onPointerEnter",["pointerout","pointerover"]),Dn("onPointerLeave",["pointerout","pointerover"]),Vl("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Vl("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Vl("onBeforeInput",["compositionend","keypress","textInput","paste"]),Vl("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Vl("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Vl("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var xs="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(xs));function Np(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],H=N.instance,ee=N.currentTarget;if(N=N.listener,H!==p&&h.isPropagationStopped())break e;p=N,h.currentTarget=ee;try{p(h)}catch(oe){so(oe)}h.currentTarget=null,p=H}else for(w=0;w<o.length;w++){if(N=o[w],H=N.instance,ee=N.currentTarget,N=N.listener,H!==p&&h.isPropagationStopped())break e;p=N,h.currentTarget=ee;try{p(h)}catch(oe){so(oe)}h.currentTarget=null,p=H}}}}function ct(e,n){var a=n[$a];a===void 0&&(a=n[$a]=new Set);var o=e+"__bubble";a.has(o)||(Ap(n,e,2,!1),a.add(o))}function Dd(e,n,a){var o=0;n&&(o|=4),Ap(a,e,o,n)}var Ko="_reactListening"+Math.random().toString(36).slice(2);function Td(e){if(!e[Ko]){e[Ko]=!0,yl.forEach(function(a){a!=="selectionchange"&&(l2.has(a)||Dd(a,!1,e),Dd(a,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[Ko]||(n[Ko]=!0,Dd("selectionchange",!1,n))}}function Ap(e,n,a,o){switch(l1(n)){case 2:var h=z2;break;case 8:h=M2;break;default:h=Xd}a=h.bind(null,n,a,e),h=void 0,!Ia||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 zd(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 H=w.tag;if((H===3||H===4)&&w.stateNode.containerInfo===h)return;w=w.return}for(;N!==null;){if(w=ql(N),w===null)return;if(H=w.tag,H===5||H===6||H===26||H===27){o=p=w;continue e}N=N.parentNode}}o=o.return}jr(function(){var ee=p,oe=ll(a),de=[];e:{var te=sm.get(e);if(te!==void 0){var re=We,_e=e;switch(e){case"keypress":if(Ve(a)===0)break e;case"keydown":case"keyup":re=Qg;break;case"focusin":_e="focus",re=eu;break;case"focusout":_e="blur",re=eu;break;case"beforeblur":case"afterblur":re=eu;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":re=al;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":re=Hi;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":re=Pg;break;case lm:case rm:case am:re=Ug;break;case im:re=tb;break;case"scroll":case"scrollend":re=Ya;break;case"wheel":re=lb;break;case"copy":case"cut":case"paste":re=Yg;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":re=$h;break;case"toggle":case"beforetoggle":re=ab}var Qe=(n&4)!==0,Tt=!Qe&&(e==="scroll"||e==="scrollend"),Q=Qe?te!==null?te+"Capture":null:te;Qe=[];for(var X=ee,J;X!==null;){var ce=X;if(J=ce.stateNode,ce=ce.tag,ce!==5&&ce!==26&&ce!==27||J===null||Q===null||(ce=Sr(X,Q),ce!=null&&Qe.push(ps(X,ce,J))),Tt)break;X=X.return}0<Qe.length&&(te=new re(te,_e,null,a,oe),de.push({event:te,listeners:Qe}))}}if((n&7)===0){e:{if(te=e==="mouseover"||e==="pointerover",re=e==="mouseout"||e==="pointerout",te&&a!==$i&&(_e=a.relatedTarget||a.fromElement)&&(ql(_e)||_e[Yl]))break e;if((re||te)&&(te=oe.window===oe?oe:(te=oe.ownerDocument)?te.defaultView||te.parentWindow:window,re?(_e=a.relatedTarget||a.toElement,re=ee,_e=_e?ql(_e):null,_e!==null&&(Tt=u(_e),Qe=_e.tag,_e!==Tt||Qe!==5&&Qe!==27&&Qe!==6)&&(_e=null)):(re=null,_e=ee),re!==_e)){if(Qe=al,ce="onMouseLeave",Q="onMouseEnter",X="mouse",(e==="pointerout"||e==="pointerover")&&(Qe=$h,ce="onPointerLeave",Q="onPointerEnter",X="pointer"),Tt=re==null?te:oa(re),J=_e==null?te:oa(_e),te=new Qe(ce,X+"leave",re,a,oe),te.target=Tt,te.relatedTarget=J,ce=null,ql(oe)===ee&&(Qe=new Qe(Q,X+"enter",_e,a,oe),Qe.target=J,Qe.relatedTarget=Tt,ce=Qe),Tt=ce,re&&_e)t:{for(Qe=r2,Q=re,X=_e,J=0,ce=Q;ce;ce=Qe(ce))J++;ce=0;for(var qe=X;qe;qe=Qe(qe))ce++;for(;0<J-ce;)Q=Qe(Q),J--;for(;0<ce-J;)X=Qe(X),ce--;for(;J--;){if(Q===X||X!==null&&Q===X.alternate){Qe=Q;break t}Q=Qe(Q),X=Qe(X)}Qe=null}else Qe=null;re!==null&&Dp(de,te,re,Qe,!1),_e!==null&&Tt!==null&&Dp(de,Tt,_e,Qe,!0)}}e:{if(te=ee?oa(ee):window,re=te.nodeName&&te.nodeName.toLowerCase(),re==="select"||re==="input"&&te.type==="file")var gt=Vh;else if(qh(te))if(Gh)gt=xb;else{gt=hb;var $e=fb}else re=te.nodeName,!re||re.toLowerCase()!=="input"||te.type!=="checkbox"&&te.type!=="radio"?ee&&Bi(ee.elementType)&&(gt=Vh):gt=mb;if(gt&&(gt=gt(e,ee))){Xh(de,gt,a,oe);break e}$e&&$e(e,te,ee),e==="focusout"&&ee&&te.type==="number"&&ee.memoizedProps.value!=null&&_i(te,"number",te.value)}switch($e=ee?oa(ee):window,e){case"focusin":(qh($e)||$e.contentEditable==="true")&&(Xa=$e,iu=ee,Xi=null);break;case"focusout":Xi=iu=Xa=null;break;case"mousedown":su=!0;break;case"contextmenu":case"mouseup":case"dragend":su=!1,tm(de,a,oe);break;case"selectionchange":if(yb)break;case"keydown":case"keyup":tm(de,a,oe)}var rt;if(nu)e:{switch(e){case"compositionstart":var ft="onCompositionStart";break e;case"compositionend":ft="onCompositionEnd";break e;case"compositionupdate":ft="onCompositionUpdate";break e}ft=void 0}else qa?Ih(e,a)&&(ft="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(ft="onCompositionStart");ft&&(Lh&&a.locale!=="ko"&&(qa||ft!=="onCompositionStart"?ft==="onCompositionEnd"&&qa&&(rt=ve()):(le=oe,se="value"in le?le.value:le.textContent,qa=!0)),$e=Wo(ee,ft),0<$e.length&&(ft=new Bh(ft,e,null,a,oe),de.push({event:ft,listeners:$e}),rt?ft.data=rt:(rt=Yh(a),rt!==null&&(ft.data=rt)))),(rt=sb?ob(e,a):cb(e,a))&&(ft=Wo(ee,"onBeforeInput"),0<ft.length&&($e=new Bh("onBeforeInput","beforeinput",null,a,oe),de.push({event:$e,listeners:ft}),$e.data=rt)),e2(de,e,ee,a,oe)}Np(de,n)})}function ps(e,n,a){return{instance:e,listener:n,currentTarget:a}}function Wo(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=Sr(e,a),h!=null&&o.unshift(ps(e,h,p)),h=Sr(e,n),h!=null&&o.push(ps(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 Dp(e,n,a,o,h){for(var p=n._reactName,w=[];a!==null&&a!==o;){var N=a,H=N.alternate,ee=N.stateNode;if(N=N.tag,H!==null&&H===o)break;N!==5&&N!==26&&N!==27||ee===null||(H=ee,h?(ee=Sr(a,p),ee!=null&&w.unshift(ps(a,ee,H))):h||(ee=Sr(a,p),ee!=null&&w.push(ps(a,ee,H)))),a=a.return}w.length!==0&&e.push({event:n,listeners:w})}var a2=/\r\n?/g,i2=/\u0000|\uFFFD/g;function Tp(e){return(typeof e=="string"?e:""+e).replace(a2,`
|
|
49
|
+
`).replace(i2,"")}function zp(e,n){return n=Tp(n),Tp(e)===n}function Dt(e,n,a,o,h,p){switch(a){case"children":typeof o=="string"?n==="body"||n==="textarea"&&o===""||vr(e,o):(typeof o=="number"||typeof o=="bigint")&&n!=="body"&&vr(e,""+o);break;case"className":La(e,"class",o);break;case"tabIndex":La(e,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":La(e,a,o);break;case"style":ro(e,o,p);break;case"data":if(n!=="object"){La(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=wr(""+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"&&Dt(e,n,"name",h.name,h,null),Dt(e,n,"formEncType",h.formEncType,h,null),Dt(e,n,"formMethod",h.formMethod,h,null),Dt(e,n,"formTarget",h.formTarget,h,null)):(Dt(e,n,"encType",h.encType,h,null),Dt(e,n,"method",h.method,h,null),Dt(e,n,"target",h.target,h,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(a);break}o=wr(""+o),e.setAttribute(a,o);break;case"onClick":o!=null&&(e.onclick=gl);break;case"onScroll":o!=null&&ct("scroll",e);break;case"onScrollEnd":o!=null&&ct("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=wr(""+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":ct("beforetoggle",e),ct("toggle",e),yr(e,"popover",o);break;case"xlinkActuate":zn(e,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":zn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":zn(e,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":zn(e,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":zn(e,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":zn(e,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":zn(e,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":zn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":zn(e,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":yr(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=Pc.get(a)||a,yr(e,a,o))}}function Md(e,n,a,o,h,p){switch(a){case"style":ro(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"?vr(e,o):(typeof o=="number"||typeof o=="bigint")&&vr(e,""+o);break;case"onScroll":o!=null&&ct("scroll",e);break;case"onScrollEnd":o!=null&&ct("scrollend",e);break;case"onClick":o!=null&&(e.onclick=gl);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!xr.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[Zt]||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,""):yr(e,a,o)}}}function wn(e,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ct("error",e),ct("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:Dt(e,n,p,w,a,null)}}h&&Dt(e,n,"srcSet",a.srcSet,a,null),o&&Dt(e,n,"src",a.src,a,null);return;case"input":ct("invalid",e);var N=p=w=h=null,H=null,ee=null;for(o in a)if(a.hasOwnProperty(o)){var oe=a[o];if(oe!=null)switch(o){case"name":h=oe;break;case"type":w=oe;break;case"checked":H=oe;break;case"defaultChecked":ee=oe;break;case"value":p=oe;break;case"defaultValue":N=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(i(137,n));break;default:Dt(e,n,o,oe,a,null)}}Ua(e,p,N,H,ee,w,h,!1);return;case"select":ct("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:Dt(e,n,h,N,a,null)}n=p,a=w,e.multiple=!!o,n!=null?br(e,!!o,n,!1):a!=null&&br(e,!!o,a,!0);return;case"textarea":ct("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:Dt(e,n,w,N,a,null)}no(e,o,h,p);return;case"option":for(H in a)if(a.hasOwnProperty(H)&&(o=a[H],o!=null))switch(H){case"selected":e.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:Dt(e,n,H,o,a,null)}return;case"dialog":ct("beforetoggle",e),ct("toggle",e),ct("cancel",e),ct("close",e);break;case"iframe":case"object":ct("load",e);break;case"video":case"audio":for(o=0;o<xs.length;o++)ct(xs[o],e);break;case"image":ct("error",e),ct("load",e);break;case"details":ct("toggle",e);break;case"embed":case"source":case"link":ct("error",e),ct("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(ee in a)if(a.hasOwnProperty(ee)&&(o=a[ee],o!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:Dt(e,n,ee,o,a,null)}return;default:if(Bi(n)){for(oe in a)a.hasOwnProperty(oe)&&(o=a[oe],o!==void 0&&Md(e,n,oe,o,a,void 0));return}}for(N in a)a.hasOwnProperty(N)&&(o=a[N],o!=null&&Dt(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,H=null,ee=null,oe=null;for(re in a){var de=a[re];if(a.hasOwnProperty(re)&&de!=null)switch(re){case"checked":break;case"value":break;case"defaultValue":H=de;default:o.hasOwnProperty(re)||Dt(e,n,re,null,o,de)}}for(var te in o){var re=o[te];if(de=a[te],o.hasOwnProperty(te)&&(re!=null||de!=null))switch(te){case"type":p=re;break;case"name":h=re;break;case"checked":ee=re;break;case"defaultChecked":oe=re;break;case"value":w=re;break;case"defaultValue":N=re;break;case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(i(137,n));break;default:re!==de&&Dt(e,n,te,re,o,de)}}ua(e,w,N,H,ee,oe,p,h);return;case"select":re=w=N=te=null;for(p in a)if(H=a[p],a.hasOwnProperty(p)&&H!=null)switch(p){case"value":break;case"multiple":re=H;default:o.hasOwnProperty(p)||Dt(e,n,p,null,o,H)}for(h in o)if(p=o[h],H=a[h],o.hasOwnProperty(h)&&(p!=null||H!=null))switch(h){case"value":te=p;break;case"defaultValue":N=p;break;case"multiple":w=p;default:p!==H&&Dt(e,n,h,p,o,H)}n=N,a=w,o=re,te!=null?br(e,!!a,te,!1):!!o!=!!a&&(n!=null?br(e,!!a,n,!0):br(e,!!a,a?[]:"",!1));return;case"textarea":re=te=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:Dt(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":te=h;break;case"defaultValue":re=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(i(91));break;default:h!==p&&Dt(e,n,w,h,o,p)}Oi(e,te,re);return;case"option":for(var _e in a)if(te=a[_e],a.hasOwnProperty(_e)&&te!=null&&!o.hasOwnProperty(_e))switch(_e){case"selected":e.selected=!1;break;default:Dt(e,n,_e,null,o,te)}for(H in o)if(te=o[H],re=a[H],o.hasOwnProperty(H)&&te!==re&&(te!=null||re!=null))switch(H){case"selected":e.selected=te&&typeof te!="function"&&typeof te!="symbol";break;default:Dt(e,n,H,te,o,re)}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 Qe in a)te=a[Qe],a.hasOwnProperty(Qe)&&te!=null&&!o.hasOwnProperty(Qe)&&Dt(e,n,Qe,null,o,te);for(ee in o)if(te=o[ee],re=a[ee],o.hasOwnProperty(ee)&&te!==re&&(te!=null||re!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(i(137,n));break;default:Dt(e,n,ee,te,o,re)}return;default:if(Bi(n)){for(var Tt in a)te=a[Tt],a.hasOwnProperty(Tt)&&te!==void 0&&!o.hasOwnProperty(Tt)&&Md(e,n,Tt,void 0,o,te);for(oe in o)te=o[oe],re=a[oe],!o.hasOwnProperty(oe)||te===re||te===void 0&&re===void 0||Md(e,n,oe,te,o,re);return}}for(var Q in a)te=a[Q],a.hasOwnProperty(Q)&&te!=null&&!o.hasOwnProperty(Q)&&Dt(e,n,Q,null,o,te);for(de in o)te=o[de],re=a[de],!o.hasOwnProperty(de)||te===re||te==null&&re==null||Dt(e,n,de,te,o,re)}function Mp(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&&Mp(w)){for(w=0,N=h.responseEnd,o+=1;o<a.length;o++){var H=a[o],ee=H.startTime;if(ee>N)break;var oe=H.transferSize,de=H.initiatorType;oe&&Mp(de)&&(H=H.responseEnd,w+=oe*(H<N?1:(N-ee)/(H-ee)))}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 Fd=null,Rd=null;function Qo(e){return e.nodeType===9?e:e.ownerDocument}function Fp(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 Rp(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 _d(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 Od=null;function c2(){var e=window.event;return e&&e.type==="popstate"?e===Od?!1:(Od=e,!0):(Od=null,!1)}var _p=typeof setTimeout=="function"?setTimeout:void 0,u2=typeof clearTimeout=="function"?clearTimeout:void 0,Op=typeof Promise=="function"?Promise:void 0,d2=typeof queueMicrotask=="function"?queueMicrotask:typeof Op<"u"?function(e){return Op.resolve(null).then(e).catch(f2)}:_p;function f2(e){setTimeout(function(){throw e})}function Yr(e){return e==="head"}function Bp(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),gi(n);return}o--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")o++;else if(a==="html")ys(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,ys(a);for(var p=a.firstChild;p;){var w=p.nextSibling,N=p.nodeName;p[Vn]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&p.rel.toLowerCase()==="stylesheet"||a.removeChild(p),p=w}}else a==="body"&&ys(e.ownerDocument.body);a=h}while(a);gi(n)}function $p(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 Bd(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":Bd(a),sa(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[Vn])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=fl(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=fl(e.nextSibling),e===null))return null;return e}function Lp(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=fl(e.nextSibling),e===null))return null;return e}function $d(e){return e.data==="$?"||e.data==="$~"}function Ld(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 fl(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 Hd=null;function Hp(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(n===0)return fl(e.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}e=e.nextSibling}return null}function Up(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 Ip(e,n,a){switch(n=Qo(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 ys(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);sa(e)}var hl=new Map,Yp=new Set;function Zo(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var or=P.d;P.d={f:p2,r:y2,D:g2,C:b2,L:v2,m:w2,X:j2,S:k2,M:S2};function p2(){var e=or.f(),n=Io();return e||n}function y2(e){var n=Xl(e);n!==null&&n.tag===5&&n.type==="form"?ix(n):or.r(e)}var xi=typeof document>"u"?null:document;function qp(e,n,a){var o=xi;if(o&&typeof n=="string"&&n){var h=Bn(n);h='link[rel="'+e+'"][href="'+h+'"]',typeof a=="string"&&(h+='[crossorigin="'+a+'"]'),Yp.has(h)||(Yp.add(h),e={rel:e,crossOrigin:a,href:n},o.querySelector(h)===null&&(n=o.createElement("link"),wn(n,"link",e),St(n),o.head.appendChild(n)))}}function g2(e){or.D(e),qp("dns-prefetch",e,null)}function b2(e,n){or.C(e,n),qp("preconnect",e,n)}function v2(e,n,a){or.L(e,n,a);var o=xi;if(o&&e&&n){var h='link[rel="preload"][as="'+Bn(n)+'"]';n==="image"&&a&&a.imageSrcSet?(h+='[imagesrcset="'+Bn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(h+='[imagesizes="'+Bn(a.imageSizes)+'"]')):h+='[href="'+Bn(e)+'"]';var p=h;switch(n){case"style":p=pi(e);break;case"script":p=yi(e)}hl.has(p)||(e=y({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:e,as:n},a),hl.set(p,e),o.querySelector(h)!==null||n==="style"&&o.querySelector(gs(p))||n==="script"&&o.querySelector(bs(p))||(n=o.createElement("link"),wn(n,"link",e),St(n),o.head.appendChild(n)))}}function w2(e,n){or.m(e,n);var a=xi;if(a&&e){var o=n&&typeof n.as=="string"?n.as:"script",h='link[rel="modulepreload"][as="'+Bn(o)+'"][href="'+Bn(e)+'"]',p=h;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=yi(e)}if(!hl.has(p)&&(e=y({rel:"modulepreload",href:e},n),hl.set(p,e),a.querySelector(h)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(bs(p)))return}o=a.createElement("link"),wn(o,"link",e),St(o),a.head.appendChild(o)}}}function k2(e,n,a){or.S(e,n,a);var o=xi;if(o&&e){var h=Nl(o).hoistableStyles,p=pi(e);n=n||"default";var w=h.get(p);if(!w){var N={loading:0,preload:null};if(w=o.querySelector(gs(p)))N.loading=5;else{e=y({rel:"stylesheet",href:e,"data-precedence":n},a),(a=hl.get(p))&&Ud(e,a);var H=w=o.createElement("link");St(H),wn(H,"link",e),H._p=new Promise(function(ee,oe){H.onload=ee,H.onerror=oe}),H.addEventListener("load",function(){N.loading|=1}),H.addEventListener("error",function(){N.loading|=2}),N.loading|=4,Jo(w,n,o)}w={type:"stylesheet",instance:w,count:1,state:N},h.set(p,w)}}}function j2(e,n){or.X(e,n);var a=xi;if(a&&e){var o=Nl(a).hoistableScripts,h=yi(e),p=o.get(h);p||(p=a.querySelector(bs(h)),p||(e=y({src:e,async:!0},n),(n=hl.get(h))&&Id(e,n),p=a.createElement("script"),St(p),wn(p,"link",e),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function S2(e,n){or.M(e,n);var a=xi;if(a&&e){var o=Nl(a).hoistableScripts,h=yi(e),p=o.get(h);p||(p=a.querySelector(bs(h)),p||(e=y({src:e,async:!0,type:"module"},n),(n=hl.get(h))&&Id(e,n),p=a.createElement("script"),St(p),wn(p,"link",e),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function Xp(e,n,a,o){var h=(h=ge.current)?Zo(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=pi(a.href),a=Nl(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=pi(a.href);var p=Nl(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(gs(e)))&&!p._p&&(w.instance=p,w.state.loading=5),hl.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},hl.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=yi(a),a=Nl(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 pi(e){return'href="'+Bn(e)+'"'}function gs(e){return'link[rel="stylesheet"]['+e+"]"}function Vp(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}),wn(n,"link",a),St(n),e.head.appendChild(n))}function yi(e){return'[src="'+Bn(e)+'"]'}function bs(e){return"script[async]"+e}function Gp(e,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var o=e.querySelector('style[data-href~="'+Bn(a.href)+'"]');if(o)return n.instance=o,St(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"),St(o),wn(o,"style",h),Jo(o,a.precedence,e),n.instance=o;case"stylesheet":h=pi(a.href);var p=e.querySelector(gs(h));if(p)return n.state.loading|=4,n.instance=p,St(p),p;o=Vp(a),(h=hl.get(h))&&Ud(o,h),p=(e.ownerDocument||e).createElement("link"),St(p);var w=p;return w._p=new Promise(function(N,H){w.onload=N,w.onerror=H}),wn(p,"link",o),n.state.loading|=4,Jo(p,a.precedence,e),n.instance=p;case"script":return p=yi(a.src),(h=e.querySelector(bs(p)))?(n.instance=h,St(h),h):(o=a,(h=hl.get(p))&&(o=y({},a),Id(o,h)),e=e.ownerDocument||e,h=e.createElement("script"),St(h),wn(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,Jo(o,a.precedence,e));return n.instance}function Jo(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 Ud(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function Id(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var Po=null;function Kp(e,n,a){if(Po===null){var o=new Map,h=Po=new Map;h.set(a,o)}else h=Po,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[Vn]||p[tn]||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 Wp(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=pi(o.href),p=n.querySelector(gs(h));if(p){n=p._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=ec.bind(e),n.then(e,e)),a.state.loading|=4,a.instance=p,St(p);return}p=n.ownerDocument||n,o=Vp(o),(h=hl.get(h))&&Ud(o,h),p=p.createElement("link"),St(p);var w=p;w._p=new Promise(function(N,H){w.onload=N,w.onerror=H}),wn(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=ec.bind(e),n.addEventListener("load",a),n.addEventListener("error",a))}}var Yd=0;function A2(e,n){return e.stylesheets&&e.count===0&&nc(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var o=setTimeout(function(){if(e.stylesheets&&nc(e,e.stylesheets),e.unsuspend){var p=e.unsuspend;e.unsuspend=null,p()}},6e4+n);0<e.imgBytes&&Yd===0&&(Yd=62500*o2());var h=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&nc(e,e.stylesheets),e.unsuspend)){var p=e.unsuspend;e.unsuspend=null,p()}},(e.imgBytes>Yd?50:800)+n);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(o),clearTimeout(h)}}:null}function ec(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)nc(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var tc=null;function nc(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,tc=new Map,n.forEach(D2,e),tc=null,ec.call(e))}function D2(e,n){if(!(n.state.loading&4)){var a=tc.get(e);if(a)var o=a.get(null);else{a=new Map,tc.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=ec.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 vs={$$typeof:R,Provider:null,Consumer:null,_currentValue:ae,_currentValue2:ae,_threadCount:0};function T2(e,n,a,o,h,p,w,N,H){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=Oa(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Oa(0),this.hiddenUpdates=Oa(null),this.identifierPrefix=o,this.onUncaughtError=h,this.onCaughtError=p,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function Zp(e,n,a,o,h,p,w,N,H,ee,oe,de){return e=new T2(e,n,a,w,H,ee,oe,de,N),n=1,p===!0&&(n|=24),p=Kn(3,null,null,n),e.current=p,p.stateNode=e,n=ku(),n.refCount++,e.pooledCache=n,n.refCount++,p.memoizedState={element:o,isDehydrated:a,cache:n},Eu(p),e}function Jp(e){return e?(e=Ka,e):Ka}function Pp(e,n,a,o,h,p){h=Jp(h),o.context===null?o.context=h:o.pendingContext=h,o=Mr(n),o.payload={element:a},p=p===void 0?null:p,p!==null&&(o.callback=p),a=Fr(e,o,n),a!==null&&(In(a,e,n),Ji(a,e,n))}function e1(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<n?a:n}}function qd(e,n){e1(e,n),(e=e.alternate)&&e1(e,n)}function t1(e){if(e.tag===13||e.tag===31){var n=ha(e,67108864);n!==null&&In(n,e,67108864),qd(e,67108864)}}function n1(e){if(e.tag===13||e.tag===31){var n=Pn();n=El(n);var a=ha(e,n);a!==null&&In(a,e,n),qd(e,n)}}var lc=!0;function z2(e,n,a,o){var h=I.T;I.T=null;var p=P.p;try{P.p=2,Xd(e,n,a,o)}finally{P.p=p,I.T=h}}function M2(e,n,a,o){var h=I.T;I.T=null;var p=P.p;try{P.p=8,Xd(e,n,a,o)}finally{P.p=p,I.T=h}}function Xd(e,n,a,o){if(lc){var h=Vd(o);if(h===null)zd(e,n,o,rc,a),r1(e,o);else if(R2(h,e,n,a,o))o.stopPropagation();else if(r1(e,o),n&4&&-1<F2.indexOf(e)){for(;h!==null;){var p=Xl(h);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var w=On(p.pendingLanes);if(w!==0){var N=p;for(N.pendingLanes|=2,N.entangledLanes|=2;w;){var H=1<<31-et(w);N.entanglements[1]|=H,w&=~H}Ml(p),(wt&6)===0&&(Ho=yt()+500,ms(0))}}break;case 31:case 13:N=ha(p,2),N!==null&&In(N,p,2),Io(),qd(p,2)}if(p=Vd(o),p===null&&zd(e,n,o,rc,a),p===h)break;h=p}h!==null&&o.stopPropagation()}else zd(e,n,o,null,a)}}function Vd(e){return e=ll(e),Gd(e)}var rc=null;function Gd(e){if(rc=null,e=ql(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 rc=e,null}function l1(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(Vt()){case ie:return 2;case me:return 8;case Fe:case Ge:return 32;case ye:return 268435456;default:return 32}default:return 32}}var Kd=!1,qr=null,Xr=null,Vr=null,ws=new Map,ks=new Map,Gr=[],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 r1(e,n){switch(e){case"focusin":case"focusout":qr=null;break;case"dragenter":case"dragleave":Xr=null;break;case"mouseover":case"mouseout":Vr=null;break;case"pointerover":case"pointerout":ws.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":ks.delete(n.pointerId)}}function js(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=Xl(n),n!==null&&t1(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 qr=js(qr,e,n,a,o,h),!0;case"dragenter":return Xr=js(Xr,e,n,a,o,h),!0;case"mouseover":return Vr=js(Vr,e,n,a,o,h),!0;case"pointerover":var p=h.pointerId;return ws.set(p,js(ws.get(p)||null,e,n,a,o,h)),!0;case"gotpointercapture":return p=h.pointerId,ks.set(p,js(ks.get(p)||null,e,n,a,o,h)),!0}return!1}function a1(e){var n=ql(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,Il(e.priority,function(){n1(a)});return}}else if(n===31){if(n=m(a),n!==null){e.blockedOn=n,Il(e.priority,function(){n1(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 ac(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var a=Vd(e.nativeEvent);if(a===null){a=e.nativeEvent;var o=new a.constructor(a.type,a);$i=o,a.target.dispatchEvent(o),$i=null}else return n=Xl(a),n!==null&&t1(n),e.blockedOn=a,!1;n.shift()}return!0}function i1(e,n,a){ac(e)&&a.delete(n)}function _2(){Kd=!1,qr!==null&&ac(qr)&&(qr=null),Xr!==null&&ac(Xr)&&(Xr=null),Vr!==null&&ac(Vr)&&(Vr=null),ws.forEach(i1),ks.forEach(i1)}function ic(e,n){e.blockedOn===n&&(e.blockedOn=null,Kd||(Kd=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,_2)))}var sc=null;function s1(e){sc!==e&&(sc=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){sc===e&&(sc=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(Gd(o||a)===null)continue;break}var p=Xl(a);p!==null&&(e.splice(n,3),n-=3,Vu(p,{pending:!0,data:h,method:a.method,action:o},o,h))}}))}function gi(e){function n(H){return ic(H,e)}qr!==null&&ic(qr,e),Xr!==null&&ic(Xr,e),Vr!==null&&ic(Vr,e),ws.forEach(n),ks.forEach(n);for(var a=0;a<Gr.length;a++){var o=Gr[a];o.blockedOn===e&&(o.blockedOn=null)}for(;0<Gr.length&&(a=Gr[0],a.blockedOn===null);)a1(a),a.blockedOn===null&&Gr.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[Zt]||null;if(typeof p=="function")w||s1(a);else if(w){var N=null;if(p&&p.hasAttribute("formAction")){if(h=p,w=p[Zt]||null)N=w.formAction;else if(Gd(h)!==null)continue}else N=w.action;typeof N=="function"?a[o+1]=N:(a.splice(o,3),o-=3),s1(a)}}}function o1(){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 Wd(e){this._internalRoot=e}oc.prototype.render=Wd.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(i(409));var a=n.current,o=Pn();Pp(a,o,e,n,null,null)},oc.prototype.unmount=Wd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;Pp(e.current,2,null,e,null,null),Io(),n[Yl]=null}};function oc(e){this._internalRoot=e}oc.prototype.unstable_scheduleHydration=function(e){if(e){var n=Ul();e={blockedOn:null,target:e,priority:n};for(var a=0;a<Gr.length&&n!==0&&n<Gr[a].priority;a++);Gr.splice(a,0,e),a===0&&a1(e)}};var c1=l.version;if(c1!=="19.2.4")throw Error(i(527,c1,"19.2.4"));P.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:I,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var cc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!cc.isDisabled&&cc.supportsFiber)try{He=cc.inject(O2),Je=cc}catch{}}return Cs.createRoot=function(e,n){if(!c(e))throw Error(i(299));var a=!1,o="",h=px,p=yx,w=gx;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=Zp(e,1,!1,null,null,a,o,null,h,p,w,o1),e[Yl]=n.current,Td(e),new Wd(n)},Cs.hydrateRoot=function(e,n,a){if(!c(e))throw Error(i(299));var o=!1,h="",p=px,w=yx,N=gx,H=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&&(H=a.formState)),n=Zp(e,1,!0,n,a??null,o,h,H,p,w,N,o1),n.context=Jp(null),a=n.current,o=Pn(),o=El(o),h=Mr(o),h.callback=null,Fr(a,h,o),a=o,n.current.lanes=a,pl(n,a),Ml(n),e[Yl]=n.current,Td(e),new oc(n)},Cs.version="19.2.4",Cs}var v1;function K2(){if(v1)return Jd.exports;v1=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(),Jd.exports=G2(),Jd.exports}var W2=K2();const Q2="modulepreload",Z2=function(t){return"/"+t},w1={},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 w1)return;w1[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":Q2,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);u1(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 Ks="/api";async function Ft(t){const l=await fetch(`${Ks}${t}`);if(!l.ok)throw new Error(`API error: ${l.status}`);return l.json()}async function kn(t,l){const r=await fetch(`${Ks}${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 nf(t,l){const r=await fetch(`${Ks}${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 Wr(t,l){const r={method:"DELETE"};l!==void 0&&(r.headers={"Content-Type":"application/json"},r.body=JSON.stringify(l));const i=await fetch(`${Ks}${t}`,r);if(!i.ok)throw new Error(`API error: ${i.status}`);return i.json()}const Ne={getCompany:()=>Ft("/company"),getRoles:()=>Ft("/roles"),getRole:t=>Ft(`/roles/${t}`),getProjects:()=>Ft("/projects"),getProject:t=>Ft(`/projects/${t}`),getStandups:()=>Ft("/operations/standups"),getWaves:()=>Ft("/operations/waves"),getDecisions:()=>Ft("/operations/decisions"),getOrgTree:()=>Ft("/engine/org"),getSkills:()=>Ft("/skills"),exportSkills:t=>Ft(`/skills/export/${t}`),getSkillRegistry:()=>Ft("/skills/registry"),installRegistrySkill:(t,l)=>kn("/skills/registry/install",{skillId:t,url:l}),createRole:t=>kn("/engine/roles",t),updateRole:(t,l)=>nf(`/engine/roles/${t}`,l),deleteRole:t=>Wr(`/engine/roles/${t}`),getSessions:()=>Ft("/sessions"),getSession:t=>Ft(`/sessions/${t}`),createSession:(t,l="talk")=>kn("/sessions",{roleId:t,mode:l}),deleteSession:t=>Wr(`/sessions/${t}`),deleteSessions:t=>Wr("/sessions",{ids:t}),deleteEmptySessions:()=>Wr("/sessions?empty=true"),updateSession:(t,l)=>nf(`/sessions/${t}`,l),startJob:t=>kn("/jobs",t),getJob:t=>Ft(`/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 Ft(`/jobs${r?"?"+r:""}`)},abortJob:t=>Wr(`/jobs/${t}`),replyToJob:(t,l)=>kn(`/jobs/${t}/reply`,{message:l}),saveWave:t=>kn("/waves/save",t),getStatus:()=>Ft("/status"),detectEngine:()=>kn("/setup/detect-engine",{}),validatePath:t=>kn("/setup/validate-path",{path:t}),scaffold:t=>kn("/setup/scaffold",t),getTeams:()=>Ft("/setup/teams"),browse:t=>kn("/setup/browse",{path:t}),connectAkb:t=>kn("/setup/connect-akb",{path:t}),getKnowledge:()=>Ft("/knowledge"),getKnowledgeDoc:t=>{const l=t.split("/").map(encodeURIComponent).join("/");return Ft(`/knowledge/${l}`)},createKnowledgeDoc:t=>kn("/knowledge",t),updateKnowledgeDoc:(t,l)=>{const r=t.split("/").map(encodeURIComponent).join("/");return fetch(`${Ks}/knowledge/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:l})}).then(i=>{if(!i.ok)throw new Error(`API error: ${i.status}`);return i.json()})},deleteKnowledgeDoc:t=>{const l=t.split("/").map(encodeURIComponent).join("/");return Wr(`/knowledge/${l}`)},getPreferences:()=>Ft("/preferences"),updatePreferences:t=>nf("/preferences",t),chatInChannel:t=>kn("/speech/chat",t),getSaveStatus:()=>Ft("/save/status"),save:t=>kn("/save",{message:t}),getSaveHistory:(t=20)=>Ft(`/save/history?limit=${t}`),restoreSave:(t,l)=>kn("/save/restore",{sha:t,paths:l}),initGit:()=>kn("/save/init",{}),getCostSummary:()=>Ft("/cost/summary"),getSyncRoles:()=>Ft("/sync/roles"),applySyncUpdate:t=>kn("/sync/apply",t),getCompanyStats:()=>Ft("/sync/stats"),getGitStatus:()=>Ft("/git/status"),deleteWorktree:t=>Wr(`/git/worktrees/${encodeURIComponent(t)}`),deleteBranch:t=>Wr(`/git/branches/${encodeURIComponent(t)}`)};function J0(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 R=A.body.getReader(),B=new TextDecoder;let L="";for(;;){const{done:_,value:V}=await R.read();if(_)break;L+=B.decode(V,{stream:!0});const K=L.split(`
|
|
50
|
+
`);L=K.pop()??"";let Y="";for(const T of K)if(T.startsWith("event: "))Y=T.slice(7).trim();else if(T.startsWith("data: ")){try{const U=JSON.parse(T.slice(6));if(Y==="activity"){const O=U;O.seq>f.current&&(f.current=O.seq),r(Z=>Z.some(ne=>ne.seq===O.seq)?Z:[...Z,O]),O.type==="text"&&d(Z=>Z+(O.data.text??"")),O.type==="dispatch:start"&&O.data.childJobId&&x(Z=>[...Z,O.data.childJobId]),O.type==="job:done"?c("done"):O.type==="job:error"&&c("error")}else if(Y==="stream:end"){const O=U.reason;c(O==="done"?"done":O==="error"?"error":"done")}}catch{}Y=""}}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 k1(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"?j1(t.value):!1:j1(t)}function j1(t){return t.replace(rv,"")===""}class Ws{constructor(l,r,i){this.normal=r,this.property=l,i&&(this.space=i)}}Ws.prototype.normal={};Ws.prototype.property={};Ws.prototype.space=void 0;function P0(t,l){const r={},i={};for(const c of t)Object.assign(r,c.property),Object.assign(i,c.normal);return new Ws(r,i,l)}function If(t){return t.toLowerCase()}class qn{constructor(l,r){this.attribute=r,this.property=l}}qn.prototype.attribute="";qn.prototype.booleanish=!1;qn.prototype.boolean=!1;qn.prototype.commaOrSpaceSeparated=!1;qn.prototype.commaSeparated=!1;qn.prototype.defined=!1;qn.prototype.mustUseProperty=!1;qn.prototype.number=!1;qn.prototype.overloadedBoolean=!1;qn.prototype.property="";qn.prototype.spaceSeparated=!1;qn.prototype.space=void 0;let iv=0;const at=_a(),on=_a(),Yf=_a(),Se=_a(),Ot=_a(),Si=_a(),el=_a();function _a(){return 2**++iv}const qf=Object.freeze(Object.defineProperty({__proto__:null,boolean:at,booleanish:on,commaOrSpaceSeparated:el,commaSeparated:Si,number:Se,overloadedBoolean:Yf,spaceSeparated:Ot},Symbol.toStringTag,{value:"Module"})),lf=Object.keys(qf);class ch extends qn{constructor(l,r,i,c){let u=-1;if(super(l,r),S1(this,"space",c),typeof i=="number")for(;++u<lf.length;){const d=lf[u];S1(this,lf[u],(i&qf[d])===qf[d])}}}ch.prototype.defined=!0;function S1(t,l,r){r&&(t[l]=r)}function Di(t){const l={},r={};for(const[i,c]of Object.entries(t.properties)){const u=new ch(i,t.transform(t.attributes||{},i),c,t.space);t.mustUseProperty&&t.mustUseProperty.includes(i)&&(u.mustUseProperty=!0),l[i]=u,r[If(i)]=i,r[If(u.attribute)]=i}return new Ws(l,r,t.space)}const ey=Di({properties:{ariaActiveDescendant:null,ariaAtomic:on,ariaAutoComplete:null,ariaBusy:on,ariaChecked:on,ariaColCount:Se,ariaColIndex:Se,ariaColSpan:Se,ariaControls:Ot,ariaCurrent:null,ariaDescribedBy:Ot,ariaDetails:null,ariaDisabled:on,ariaDropEffect:Ot,ariaErrorMessage:null,ariaExpanded:on,ariaFlowTo:Ot,ariaGrabbed:on,ariaHasPopup:null,ariaHidden:on,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ot,ariaLevel:Se,ariaLive:null,ariaModal:on,ariaMultiLine:on,ariaMultiSelectable:on,ariaOrientation:null,ariaOwns:Ot,ariaPlaceholder:null,ariaPosInSet:Se,ariaPressed:on,ariaReadOnly:on,ariaRelevant:null,ariaRequired:on,ariaRoleDescription:Ot,ariaRowCount:Se,ariaRowIndex:Se,ariaRowSpan:Se,ariaSelected:on,ariaSetSize:Se,ariaSort:null,ariaValueMax:Se,ariaValueMin:Se,ariaValueNow:Se,ariaValueText:null,role:null},transform(t,l){return l==="role"?l:"aria-"+l.slice(4).toLowerCase()}});function ty(t,l){return l in t?t[l]:l}function ny(t,l){return ty(t,l.toLowerCase())}const sv=Di({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Si,acceptCharset:Ot,accessKey:Ot,action:null,allow:null,allowFullScreen:at,allowPaymentRequest:at,allowUserMedia:at,alt:null,as:null,async:at,autoCapitalize:null,autoComplete:Ot,autoFocus:at,autoPlay:at,blocking:Ot,capture:null,charSet:null,checked:at,cite:null,className:Ot,cols:Se,colSpan:null,content:null,contentEditable:on,controls:at,controlsList:Ot,coords:Se|Si,crossOrigin:null,data:null,dateTime:null,decoding:null,default:at,defer:at,dir:null,dirName:null,disabled:at,download:Yf,draggable:on,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:at,formTarget:null,headers:Ot,height:Se,hidden:Yf,high:Se,href:null,hrefLang:null,htmlFor:Ot,httpEquiv:Ot,id:null,imageSizes:null,imageSrcSet:null,inert:at,inputMode:null,integrity:null,is:null,isMap:at,itemId:null,itemProp:Ot,itemRef:Ot,itemScope:at,itemType:Ot,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:at,low:Se,manifest:null,max:null,maxLength:Se,media:null,method:null,min:null,minLength:Se,multiple:at,muted:at,name:null,nonce:null,noModule:at,noValidate:at,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:at,optimum:Se,pattern:null,ping:Ot,placeholder:null,playsInline:at,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:at,referrerPolicy:null,rel:Ot,required:at,reversed:at,rows:Se,rowSpan:Se,sandbox:Ot,scope:null,scoped:at,seamless:at,selected:at,shadowRootClonable:at,shadowRootDelegatesFocus:at,shadowRootMode:null,shape:null,size:Se,sizes:null,slot:null,span:Se,spellCheck:on,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Se,step:null,style:null,tabIndex:Se,target:null,title:null,translate:null,type:null,typeMustMatch:at,useMap:null,value:on,width:Se,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ot,axis:null,background:null,bgColor:null,border:Se,borderColor:null,bottomMargin:Se,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:at,declare:at,event:null,face:null,frame:null,frameBorder:null,hSpace:Se,leftMargin:Se,link:null,longDesc:null,lowSrc:null,marginHeight:Se,marginWidth:Se,noResize:at,noHref:at,noShade:at,noWrap:at,object:null,profile:null,prompt:null,rev:null,rightMargin:Se,rules:null,scheme:null,scrolling:on,standby:null,summary:null,text:null,topMargin:Se,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Se,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:at,disableRemotePlayback:at,prefix:null,property:null,results:Se,security:null,unselectable:null},space:"html",transform:ny}),ov=Di({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:el,accentHeight:Se,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Se,amplitude:Se,arabicForm:null,ascent:Se,attributeName:null,attributeType:null,azimuth:Se,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Se,by:null,calcMode:null,capHeight:Se,className:Ot,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:Se,diffuseConstant:Se,direction:null,display:null,dur:null,divisor:Se,dominantBaseline:null,download:at,dx:null,dy:null,edgeMode:null,editable:null,elevation:Se,enableBackground:null,end:null,event:null,exponent:Se,externalResourcesRequired:null,fill:null,fillOpacity:Se,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:Si,g2:Si,glyphName:Si,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Se,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Se,horizOriginX:Se,horizOriginY:Se,id:null,ideographic:Se,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Se,k:Se,k1:Se,k2:Se,k3:Se,k4:Se,kernelMatrix:el,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Se,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:Se,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:Se,overlineThickness:Se,paintOrder:null,panose1:null,path:null,pathLength:Se,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ot,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Se,pointsAtY:Se,pointsAtZ:Se,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:el,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:el,rev:el,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:el,requiredFeatures:el,requiredFonts:el,requiredFormats:el,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:Se,specularExponent:Se,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Se,strikethroughThickness:Se,string:null,stroke:null,strokeDashArray:el,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Se,strokeOpacity:Se,strokeWidth:null,style:null,surfaceScale:Se,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:el,tabIndex:Se,tableValues:null,target:null,targetX:Se,targetY:Se,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:el,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Se,underlineThickness:Se,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Se,values:null,vAlphabetic:Se,vMathematical:Se,vectorEffect:null,vHanging:Se,vIdeographic:Se,version:null,vertAdvY:Se,vertOriginX:Se,vertOriginY:Se,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Se,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:ty}),ly=Di({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()}}),ry=Di({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:ny}),ay=Di({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,C1=/-[a-z]/g,dv=/^data[-\w.:]+$/i;function fv(t,l){const r=If(l);let i=l,c=qn;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(C1,mv);i="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=l.slice(4);if(!C1.test(u)){let d=u.replace(uv,hv);d.charAt(0)!=="-"&&(d="-"+d),l="data"+d}}c=ch}return new c(i,l)}function hv(t){return"-"+t.toLowerCase()}function mv(t){return t.charAt(1).toUpperCase()}const xv=P0([ey,sv,ly,ry,ay],"html"),uh=P0([ey,ov,ly,ry,ay],"svg");function pv(t){return t.join(" ").trim()}var bi={},rf,E1;function yv(){if(E1)return rf;E1=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,R=1;function B(ne){var W=ne.match(l);W&&(A+=W.length);var I=ne.lastIndexOf(x);R=~I?ne.length-I:R+ne.length}function L(){var ne={line:A,column:R};return function(W){return W.position=new _(ne),Y(),W}}function _(ne){this.start=ne,this.end={line:A,column:R},this.source=C.source}_.prototype.content=E;function V(ne){var W=new Error(C.source+":"+A+":"+R+": "+ne);if(W.reason=ne,W.filename=C.source,W.line=A,W.column=R,W.source=E,!C.silent)throw W}function K(ne){var W=ne.exec(E);if(W){var I=W[0];return B(I),E=E.slice(I.length),W}}function Y(){K(r)}function T(ne){var W;for(ne=ne||[];W=U();)W!==!1&&ne.push(W);return ne}function U(){var ne=L();if(!(f!=E.charAt(0)||g!=E.charAt(1))){for(var W=2;y!=E.charAt(W)&&(g!=E.charAt(W)||f!=E.charAt(W+1));)++W;if(W+=2,y===E.charAt(W-1))return V("End of comment missing");var I=E.slice(2,W-2);return R+=2,B(I),E=E.slice(W),R+=2,ne({type:b,comment:I})}}function O(){var ne=L(),W=K(i);if(W){if(U(),!K(c))return V("property missing ':'");var I=K(u),P=ne({type:v,property:j(W[0].replace(t,y)),value:I?j(I[0].replace(t,y)):y});return K(d),P}}function Z(){var ne=[];T(ne);for(var W;W=O();)W!==!1&&(ne.push(W),T(ne));return ne}return Y(),Z()}function j(E){return E?E.replace(m,y):y}return rf=S,rf}var N1;function gv(){if(N1)return bi;N1=1;var t=bi&&bi.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(bi,"__esModule",{value:!0}),bi.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 bi}var Es={},A1;function bv(){if(A1)return Es;A1=1,Object.defineProperty(Es,"__esModule",{value:!0}),Es.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 Es.camelCase=x,Es}var Ns,D1;function vv(){if(D1)return Ns;D1=1;var t=Ns&&Ns.__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,Ns=i,Ns}var wv=vv();const kv=Z0(wv),iy=sy("end"),dh=sy("start");function sy(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=dh(t),r=iy(t);if(l&&r)return{start:l,end:r}}function $s(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?T1(t.position):"start"in t||"end"in t?T1(t):"line"in t||"column"in t?Xf(t):""}function Xf(t){return z1(t&&t.line)+":"+z1(t&&t.column)}function T1(t){return Xf(t&&t.start)+"-"+Xf(t&&t.end)}function z1(t){return t&&typeof t=="number"?t:1}class En 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=$s(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}}En.prototype.file="";En.prototype.name="";En.prototype.reason="";En.prototype.message="";En.prototype.stack="";En.prototype.column=void 0;En.prototype.line=void 0;En.prototype.ancestors=void 0;En.prototype.cause=void 0;En.prototype.fatal=void 0;En.prototype.place=void 0;En.prototype.ruleId=void 0;En.prototype.source=void 0;const fh={}.hasOwnProperty,Sv=new Map,Cv=/[A-Z]/g,Ev=new Set(["table","tbody","thead","tfoot","tr"]),Nv=new Set(["td","th"]),oy="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"?uh:xv,stylePropertyNameCase:l.stylePropertyNameCase||"dom",tableCellAlignToStyle:l.tableCellAlignToStyle!==!1},u=cy(c,t,void 0);return u&&typeof u!="string"?u:c.create(t,c.Fragment,{children:u||void 0},void 0)}function cy(t,l,r){if(l.type==="element")return Dv(t,l,r);if(l.type==="mdxFlowExpression"||l.type==="mdxTextExpression")return Tv(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 Dv(t,l,r){const i=t.schema;let c=i;l.tagName.toLowerCase()==="svg"&&i.space==="html"&&(c=uh,t.schema=c),t.ancestors.push(l);const u=dy(t,l.tagName,!1),d=Bv(t,l);let m=mh(t,l);return Ev.has(l.tagName)&&(m=m.filter(function(x){return typeof x=="string"?!av(x):!0})),uy(t,d,u,l),hh(d,m),t.ancestors.pop(),t.schema=i,t.create(l,u,d,r)}function Tv(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)}Is(t,l.position)}function zv(t,l){if(l.data&&l.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(l.data.estree);Is(t,l.position)}function Mv(t,l,r){const i=t.schema;let c=i;l.name==="svg"&&i.space==="html"&&(c=uh,t.schema=c),t.ancestors.push(l);const u=l.name===null?t.Fragment:dy(t,l.name,!0),d=$v(t,l),m=mh(t,l);return uy(t,d,u,l),hh(d,m),t.ancestors.pop(),t.schema=i,t.create(l,u,d,r)}function Fv(t,l,r){const i={};return hh(i,mh(t,l)),t.create(l,t.Fragment,i,r)}function Rv(t,l){return l.value}function uy(t,l,r,i){typeof r!="string"&&r!==t.Fragment&&t.passNode&&(l.node=i)}function hh(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=dh(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"&&fh.call(l.properties,c)){const u=Lv(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 $v(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 Is(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 Is(t,l.position);else u=i.value===null?!0:i.value;r[c]=u}return r}function mh(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=cy(t,u,d);m!==void 0&&r.push(m)}return r}function Lv(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 En("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=oy+"#cannot-parse-style-attribute",c}}function dy(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=k1(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=k1(l)&&!/^[a-z]/.test(l)?{type:"Identifier",name:l}:{type:"Literal",value:l};if(i.type==="Literal"){const c=i.value;return fh.call(t.components,c)?t.components[c]:c}if(t.evaluater)return t.evaluater.evaluateExpression(i);Is(t)}function Is(t,l){const r=new En("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=oy+"#cannot-handle-mdx-estrees-without-createevaluater",r}function Uv(t){const l={};let r;for(r in t)fh.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 af={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 xh(t,l){const r=qv,i=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,c=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return fy(t,i,c)}function fy(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 M1(t.children,l,r)}return Array.isArray(t)?M1(t,l,r):""}function M1(t,l,r){const i=[];let c=-1;for(;++c<t.length;)i[c]=fy(t[c],l,r);return i.join("")}function Xv(t){return!!(t&&typeof t=="object")}const F1=document.createElement("i");function ph(t){const l="&"+t+";";F1.innerHTML=l;const r=F1.textContent;return r.charCodeAt(r.length-1)===59&&t!=="semi"||r===l?!1:r}function nl(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 ml(t,l){return t.length>0?(nl(t,t.length,0,l),t):l}const R1={}.hasOwnProperty;function hy(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=(R1.call(t,r)?t[r]:void 0)||(t[r]={}),u=l[r];let d;if(u)for(d in u){R1.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]);nl(t,0,0,i)}function my(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 Cl(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Fn=la(/[A-Za-z]/),Cn=la(/[\dA-Za-z]/),Kv=la(/[#-'*+\--9=?A-Z^-~]/);function Fc(t){return t!==null&&(t<32||t===127)}const Vf=la(/\d/),Wv=la(/[\dA-Fa-f]/),Qv=la(/[!-/:-@[-`{-~]/);function Ke(t){return t!==null&&t<-2}function Rt(t){return t!==null&&(t<0||t===32)}function ut(t){return t===-2||t===-1||t===32}const Yc=la(new RegExp("\\p{P}|\\p{S}","u")),Fa=la(/\s/);function la(t){return l;function l(r){return r!==null&&r>-1&&t.test(String.fromCharCode(r))}}function Ti(t){const l=[];let r=-1,i=0,c=0;for(;++r<t.length;){const u=t.charCodeAt(r);let d="";if(u===37&&Cn(t.charCodeAt(r+1))&&Cn(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 ut(x)?(t.enter(r),m(x)):l(x)}function m(x){return ut(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 Ke(m)?(t.consume(m),t.exit("chunkText"),u):(t.consume(m),d)}}const Pv={tokenize:ew},_1={tokenize:tw};function ew(t){const l=this,r=[];let i=0,c,u,d;return m;function m(R){if(i<r.length){const B=r[i];return l.containerState=B[1],t.attempt(B[0].continuation,x,f)(R)}return f(R)}function x(R){if(i++,l.containerState._closeFlow){l.containerState._closeFlow=void 0,c&&A();const B=l.events.length;let L=B,_;for(;L--;)if(l.events[L][0]==="exit"&&l.events[L][1].type==="chunkFlow"){_=l.events[L][1].end;break}C(i);let V=B;for(;V<l.events.length;)l.events[V][1].end={..._},V++;return nl(l.events,L+1,0,l.events.slice(B)),l.events.length=V,f(R)}return m(R)}function f(R){if(i===r.length){if(!c)return b(R);if(c.currentConstruct&&c.currentConstruct.concrete)return S(R);l.interrupt=!!(c.currentConstruct&&!c._gfmTableDynamicInterruptHack)}return l.containerState={},t.check(_1,g,y)(R)}function g(R){return c&&A(),C(i),b(R)}function y(R){return l.parser.lazy[l.now().line]=i!==r.length,d=l.now().offset,S(R)}function b(R){return l.containerState={},t.attempt(_1,v,S)(R)}function v(R){return i++,r.push([l.currentConstruct,l.containerState]),b(R)}function S(R){if(R===null){c&&A(),C(0),t.consume(R);return}return c=c||l.parser.flow(l.now()),t.enter("chunkFlow",{_tokenizer:c,contentType:"flow",previous:u}),j(R)}function j(R){if(R===null){E(t.exit("chunkFlow"),!0),C(0),t.consume(R);return}return Ke(R)?(t.consume(R),E(t.exit("chunkFlow")),i=0,l.interrupt=void 0,m):(t.consume(R),j)}function E(R,B){const L=l.sliceStream(R);if(B&&L.push(null),R.previous=u,u&&(u.next=R),u=R,c.defineSkip(R.start),c.write(L),l.parser.lazy[R.start.line]){let _=c.events.length;for(;_--;)if(c.events[_][1].start.offset<d&&(!c.events[_][1].end||c.events[_][1].end.offset>d))return;const V=l.events.length;let K=V,Y,T;for(;K--;)if(l.events[K][0]==="exit"&&l.events[K][1].type==="chunkFlow"){if(Y){T=l.events[K][1].end;break}Y=!0}for(C(i),_=V;_<l.events.length;)l.events[_][1].end={...T},_++;nl(l.events,K+1,0,l.events.slice(V)),l.events.length=_}}function C(R){let B=r.length;for(;B-- >R;){const L=r[B];l.containerState=L[1],L[0].exit.call(l,t)}r.length=R}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 Ei(t){if(t===null||Rt(t)||Fa(t))return 1;if(Yc(t))return 2}function qc(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 Gf={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};O1(y,-x),O1(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=ml(f,[["enter",t[i][1],l],["exit",t[i][1],l]])),f=ml(f,[["enter",c,l],["enter",d,l],["exit",d,l],["enter",u,l]]),f=ml(f,qc(l.parser.constructs.insideSpan.null,t.slice(i+1,r),l)),f=ml(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=ml(f,[["enter",t[r][1],l],["exit",t[r][1],l]])):g=0,nl(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=Ei(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=Ei(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 O1(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 Fn(v)?(t.consume(v),d):v===64?r(v):f(v)}function d(v){return v===43||v===45||v===46||Cn(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||Cn(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||Fc(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 Cn(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||Cn(v))&&i++<63){const S=v===45?b:y;return t.consume(v),S}return r(v)}}const Qs={partial:!0,tokenize:iw};function iw(t,l,r){return i;function i(u){return ut(u)?pt(t,c,"linePrefix")(u):c(u)}function c(u){return u===null||Ke(u)?l(u):r(u)}}const xy={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 ut(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 ut(d)?pt(t,u,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d):u(d)}function u(d){return t.attempt(xy,l,r)(d)}}function cw(t){t.exit("blockQuote")}const py={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 Qv(u)?(t.enter("characterEscapeValue"),t.consume(u),t.exit("characterEscapeValue"),t.exit("characterEscape"),l):r(u)}}const yy={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=Cn,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=Wv,g):(t.enter("characterReferenceValue"),u=7,d=Vf,g(y))}function g(y){if(y===59&&c){const b=t.exit("characterReferenceValue");return d===Cn&&!ph(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 B1={partial:!0,tokenize:hw},$1={concrete:!0,name:"codeFenced",tokenize:fw};function fw(t,l,r){const i=this,c={partial:!0,tokenize:L};let u=0,d=0,m;return x;function x(_){return f(_)}function f(_){const V=i.events[i.events.length-1];return u=V&&V[1].type==="linePrefix"?V[2].sliceSerialize(V[1],!0).length:0,m=_,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),g(_)}function g(_){return _===m?(d++,t.consume(_),g):d<3?r(_):(t.exit("codeFencedFenceSequence"),ut(_)?pt(t,y,"whitespace")(_):y(_))}function y(_){return _===null||Ke(_)?(t.exit("codeFencedFence"),i.interrupt?l(_):t.check(B1,j,B)(_)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),b(_))}function b(_){return _===null||Ke(_)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),y(_)):ut(_)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),pt(t,v,"whitespace")(_)):_===96&&_===m?r(_):(t.consume(_),b)}function v(_){return _===null||Ke(_)?y(_):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),S(_))}function S(_){return _===null||Ke(_)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),y(_)):_===96&&_===m?r(_):(t.consume(_),S)}function j(_){return t.attempt(c,B,E)(_)}function E(_){return t.enter("lineEnding"),t.consume(_),t.exit("lineEnding"),C}function C(_){return u>0&&ut(_)?pt(t,A,"linePrefix",u+1)(_):A(_)}function A(_){return _===null||Ke(_)?t.check(B1,j,B)(_):(t.enter("codeFlowValue"),R(_))}function R(_){return _===null||Ke(_)?(t.exit("codeFlowValue"),A(_)):(t.consume(_),R)}function B(_){return t.exit("codeFenced"),l(_)}function L(_,V,K){let Y=0;return T;function T(W){return _.enter("lineEnding"),_.consume(W),_.exit("lineEnding"),U}function U(W){return _.enter("codeFencedFence"),ut(W)?pt(_,O,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(W):O(W)}function O(W){return W===m?(_.enter("codeFencedFenceSequence"),Z(W)):K(W)}function Z(W){return W===m?(Y++,_.consume(W),Z):Y>=d?(_.exit("codeFencedFenceSequence"),ut(W)?pt(_,ne,"whitespace")(W):ne(W)):K(W)}function ne(W){return W===null||Ke(W)?(_.exit("codeFencedFence"),V(W)):K(W)}}}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 sf={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):Ke(f)?t.attempt(mw,d,x)(f):(t.enter("codeFlowValue"),m(f))}function m(f){return f===null||Ke(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):Ke(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):Ke(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)):Ke(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||Ke(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&&As(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),As(this.left,l)}unshift(l){this.setCursor(0),this.right.push(l)}unshiftMany(l){this.setCursor(0),As(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);As(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-l,Number.POSITIVE_INFINITY);As(this.left,r.reverse())}}}function As(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 gy(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 nl(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 gy(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):Ke(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||Ke(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 by(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||Fc(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||Ke(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||Rt(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||Fc(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 vy(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):Ke(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||Ke(v)||m++>999?(t.exit("chunkString"),g(v)):(t.consume(v),x||(x=!ut(v)),v===92?b:y)}function b(v){return v===91||v===92||v===93?(t.consume(v),m++,y):y(v)}}function wy(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):Ke(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||Ke(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 Ls(t,l){let r;return i;function i(c){return Ke(c)?(t.enter("lineEnding"),t.consume(c),t.exit("lineEnding"),r=!0,i):ut(c)?pt(t,i,r?"linePrefix":"lineSuffix")(c):l(c)}}const Aw={name:"definition",tokenize:Tw},Dw={partial:!0,tokenize:zw};function Tw(t,l,r){const i=this;let c;return u;function u(v){return t.enter("definition"),d(v)}function d(v){return vy.call(i,t,m,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function m(v){return c=Cl(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 Rt(v)?Ls(t,f)(v):f(v)}function f(v){return by(t,g,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function g(v){return t.attempt(Dw,y,y)(v)}function y(v){return ut(v)?pt(t,b,"whitespace")(v):b(v)}function b(v){return v===null||Ke(v)?(t.exit("definition"),i.parser.defined.push(c),l(v)):r(v)}}function zw(t,l,r){return i;function i(m){return Rt(m)?Ls(t,c)(m):r(m)}function c(m){return wy(t,u,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(m)}function u(m){return ut(m)?pt(t,d,"whitespace")(m):d(m)}function d(m){return m===null||Ke(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 Ke(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"},nl(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||Rt(g)?(t.exit("atxHeadingSequence"),m(g)):r(g)}function m(g){return g===35?(t.enter("atxHeadingSequence"),x(g)):g===null||Ke(g)?(t.exit("atxHeading"),l(g)):ut(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||Rt(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"],L1=["pre","script","style","textarea"],$w={concrete:!0,name:"htmlFlow",resolveTo:Uw,tokenize:Iw},Lw={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(D){return g(D)}function g(D){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(D),y}function y(D){return D===33?(t.consume(D),b):D===47?(t.consume(D),u=!0,j):D===63?(t.consume(D),c=3,i.interrupt?l:M):Fn(D)?(t.consume(D),d=String.fromCharCode(D),E):r(D)}function b(D){return D===45?(t.consume(D),c=2,v):D===91?(t.consume(D),c=5,m=0,S):Fn(D)?(t.consume(D),c=4,i.interrupt?l:M):r(D)}function v(D){return D===45?(t.consume(D),i.interrupt?l:M):r(D)}function S(D){const ue="CDATA[";return D===ue.charCodeAt(m++)?(t.consume(D),m===ue.length?i.interrupt?l:O:S):r(D)}function j(D){return Fn(D)?(t.consume(D),d=String.fromCharCode(D),E):r(D)}function E(D){if(D===null||D===47||D===62||Rt(D)){const ue=D===47,Ee=d.toLowerCase();return!ue&&!u&&L1.includes(Ee)?(c=1,i.interrupt?l(D):O(D)):Bw.includes(d.toLowerCase())?(c=6,ue?(t.consume(D),C):i.interrupt?l(D):O(D)):(c=7,i.interrupt&&!i.parser.lazy[i.now().line]?r(D):u?A(D):R(D))}return D===45||Cn(D)?(t.consume(D),d+=String.fromCharCode(D),E):r(D)}function C(D){return D===62?(t.consume(D),i.interrupt?l:O):r(D)}function A(D){return ut(D)?(t.consume(D),A):T(D)}function R(D){return D===47?(t.consume(D),T):D===58||D===95||Fn(D)?(t.consume(D),B):ut(D)?(t.consume(D),R):T(D)}function B(D){return D===45||D===46||D===58||D===95||Cn(D)?(t.consume(D),B):L(D)}function L(D){return D===61?(t.consume(D),_):ut(D)?(t.consume(D),L):R(D)}function _(D){return D===null||D===60||D===61||D===62||D===96?r(D):D===34||D===39?(t.consume(D),x=D,V):ut(D)?(t.consume(D),_):K(D)}function V(D){return D===x?(t.consume(D),x=null,Y):D===null||Ke(D)?r(D):(t.consume(D),V)}function K(D){return D===null||D===34||D===39||D===47||D===60||D===61||D===62||D===96||Rt(D)?L(D):(t.consume(D),K)}function Y(D){return D===47||D===62||ut(D)?R(D):r(D)}function T(D){return D===62?(t.consume(D),U):r(D)}function U(D){return D===null||Ke(D)?O(D):ut(D)?(t.consume(D),U):r(D)}function O(D){return D===45&&c===2?(t.consume(D),I):D===60&&c===1?(t.consume(D),P):D===62&&c===4?(t.consume(D),z):D===63&&c===3?(t.consume(D),M):D===93&&c===5?(t.consume(D),je):Ke(D)&&(c===6||c===7)?(t.exit("htmlFlowData"),t.check(Lw,G,Z)(D)):D===null||Ke(D)?(t.exit("htmlFlowData"),Z(D)):(t.consume(D),O)}function Z(D){return t.check(Hw,ne,G)(D)}function ne(D){return t.enter("lineEnding"),t.consume(D),t.exit("lineEnding"),W}function W(D){return D===null||Ke(D)?Z(D):(t.enter("htmlFlowData"),O(D))}function I(D){return D===45?(t.consume(D),M):O(D)}function P(D){return D===47?(t.consume(D),d="",ae):O(D)}function ae(D){if(D===62){const ue=d.toLowerCase();return L1.includes(ue)?(t.consume(D),z):O(D)}return Fn(D)&&d.length<8?(t.consume(D),d+=String.fromCharCode(D),ae):O(D)}function je(D){return D===93?(t.consume(D),M):O(D)}function M(D){return D===62?(t.consume(D),z):D===45&&c===2?(t.consume(D),M):O(D)}function z(D){return D===null||Ke(D)?(t.exit("htmlFlowData"),G(D)):(t.consume(D),z)}function G(D){return t.exit("htmlFlow"),l(D)}}function Yw(t,l,r){const i=this;return c;function c(d){return Ke(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(Qs,l,r)}}const Xw={name:"htmlText",tokenize:Vw};function Vw(t,l,r){const i=this;let c,u,d;return m;function m(M){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(M),x}function x(M){return M===33?(t.consume(M),f):M===47?(t.consume(M),L):M===63?(t.consume(M),R):Fn(M)?(t.consume(M),K):r(M)}function f(M){return M===45?(t.consume(M),g):M===91?(t.consume(M),u=0,S):Fn(M)?(t.consume(M),A):r(M)}function g(M){return M===45?(t.consume(M),v):r(M)}function y(M){return M===null?r(M):M===45?(t.consume(M),b):Ke(M)?(d=y,P(M)):(t.consume(M),y)}function b(M){return M===45?(t.consume(M),v):y(M)}function v(M){return M===62?I(M):M===45?b(M):y(M)}function S(M){const z="CDATA[";return M===z.charCodeAt(u++)?(t.consume(M),u===z.length?j:S):r(M)}function j(M){return M===null?r(M):M===93?(t.consume(M),E):Ke(M)?(d=j,P(M)):(t.consume(M),j)}function E(M){return M===93?(t.consume(M),C):j(M)}function C(M){return M===62?I(M):M===93?(t.consume(M),C):j(M)}function A(M){return M===null||M===62?I(M):Ke(M)?(d=A,P(M)):(t.consume(M),A)}function R(M){return M===null?r(M):M===63?(t.consume(M),B):Ke(M)?(d=R,P(M)):(t.consume(M),R)}function B(M){return M===62?I(M):R(M)}function L(M){return Fn(M)?(t.consume(M),_):r(M)}function _(M){return M===45||Cn(M)?(t.consume(M),_):V(M)}function V(M){return Ke(M)?(d=V,P(M)):ut(M)?(t.consume(M),V):I(M)}function K(M){return M===45||Cn(M)?(t.consume(M),K):M===47||M===62||Rt(M)?Y(M):r(M)}function Y(M){return M===47?(t.consume(M),I):M===58||M===95||Fn(M)?(t.consume(M),T):Ke(M)?(d=Y,P(M)):ut(M)?(t.consume(M),Y):I(M)}function T(M){return M===45||M===46||M===58||M===95||Cn(M)?(t.consume(M),T):U(M)}function U(M){return M===61?(t.consume(M),O):Ke(M)?(d=U,P(M)):ut(M)?(t.consume(M),U):Y(M)}function O(M){return M===null||M===60||M===61||M===62||M===96?r(M):M===34||M===39?(t.consume(M),c=M,Z):Ke(M)?(d=O,P(M)):ut(M)?(t.consume(M),O):(t.consume(M),ne)}function Z(M){return M===c?(t.consume(M),c=void 0,W):M===null?r(M):Ke(M)?(d=Z,P(M)):(t.consume(M),Z)}function ne(M){return M===null||M===34||M===39||M===60||M===61||M===96?r(M):M===47||M===62||Rt(M)?Y(M):(t.consume(M),ne)}function W(M){return M===47||M===62||Rt(M)?Y(M):r(M)}function I(M){return M===62?(t.consume(M),t.exit("htmlTextData"),t.exit("htmlText"),l):r(M)}function P(M){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(M),t.exit("lineEnding"),ae}function ae(M){return ut(M)?pt(t,je,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):je(M)}function je(M){return t.enter("htmlTextData"),d(M)}}const yh={name:"labelEnd",resolveAll:Qw,resolveTo:Zw,tokenize:Jw},Gw={tokenize:Pw},Kw={tokenize:e5},Ww={tokenize:t5};function Qw(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&&nl(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=ml(m,t.slice(u+1,u+i+3)),m=ml(m,[["enter",g,l]]),m=ml(m,qc(l.parser.constructs.insideSpan.null,t.slice(u+i+4,d-3),l)),m=ml(m,[["exit",g,l],t[d-2],t[d-1],["exit",f,l]]),m=ml(m,t.slice(d+1)),m=ml(m,[["exit",x,l]]),nl(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(Cl(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(Ww,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 Rt(y)?Ls(t,u)(y):u(y)}function u(y){return y===41?g(y):by(t,d,m,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(y)}function d(y){return Rt(y)?Ls(t,x)(y):g(y)}function m(y){return r(y)}function x(y){return y===34||y===39||y===40?wy(t,f,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(y):g(y)}function f(y){return Rt(y)?Ls(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 vy.call(i,t,u,d,"reference","referenceMarker","referenceString")(m)}function u(m){return i.parser.defined.includes(Cl(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:yh.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:yh.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 of={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 Nc={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||Ke(f))?(t.exit("thematicBreak"),l(f)):r(f)}function x(f){return f===c?(t.consume(f),i++,x):(t.exit("thematicBreakSequence"),ut(f)?pt(t,m,"whitespace")(f):m(f))}}const Yn={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:Vf(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(Nc,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 Vf(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(Qs,i.interrupt?r:g,t.attempt(o5,b,y))}function g(v){return i.containerState.initialBlankLine=!0,u++,b(v)}function y(v){return ut(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(Qs,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||!ut(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(Yn,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!ut(u)&&d&&d[1].type==="listItemPrefixWhitespace"?l(u):r(u)}}const H1={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"),ut(f)?pt(t,x,"lineSuffix")(f):x(f))}function x(f){return f===null||Ke(f)?(t.exit("setextHeadingLine"),l(f)):r(f)}}const y5={tokenize:g5};function g5(t){const l=this,r=t.attempt(Qs,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:jy()},v5=ky("string"),w5=ky("text");function ky(t){return{resolveAll:jy(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 jy(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:Yn,43:Yn,45:Yn,48:Yn,49:Yn,50:Yn,51:Yn,52:Yn,53:Yn,54:Yn,55:Yn,56:Yn,57:Yn,62:xy},S5={91:Aw},C5={[-2]:sf,[-1]:sf,32:sf},E5={35:Rw,42:Nc,45:[H1,Nc],60:$w,61:H1,95:Nc,96:$1,126:$1},N5={38:yy,92:py},A5={[-5]:of,[-4]:of,[-3]:of,33:n5,38:yy,42:Gf,60:[rw,Xw],91:r5,92:[Mw,py],93:yh,95:Gf,96:yw},D5={null:[Gf,b5]},T5={null:[42,95]},z5={null:[]},M5=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:T5,contentInitial:S5,disable:z5,document:j5,flow:E5,flowInitial:C5,insideSpan:D5,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:V(L),check:V(_),consume:A,enter:R,exit:B,interrupt:V(_,{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(U){return d=ml(d,U),E(),d[d.length-1]!==null?[]:(K(l,0),f.events=qc(u,f.events,f),f.events)}function b(U,O){return _5(v(U),O)}function v(U){return R5(d,U)}function S(){const{_bufferIndex:U,_index:O,line:Z,column:ne,offset:W}=i;return{_bufferIndex:U,_index:O,line:Z,column:ne,offset:W}}function j(U){c[U.line]=U.column,T()}function E(){let U;for(;i._index<d.length;){const O=d[i._index];if(typeof O=="string")for(U=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===U&&i._bufferIndex<O.length;)C(O.charCodeAt(i._bufferIndex));else C(O)}}function C(U){g=g(U)}function A(U){Ke(U)?(i.line++,i.column=1,i.offset+=U===-3?2:1,T()):U!==-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=U}function R(U,O){const Z=O||{};return Z.type=U,Z.start=S(),f.events.push(["enter",Z,f]),m.push(Z),Z}function B(U){const O=m.pop();return O.end=S(),f.events.push(["exit",O,f]),O}function L(U,O){K(U,O.from)}function _(U,O){O.restore()}function V(U,O){return Z;function Z(ne,W,I){let P,ae,je,M;return Array.isArray(ne)?G(ne):"tokenize"in ne?G([ne]):z(ne);function z(ge){return Ae;function Ae(De){const Ie=De!==null&&ge[De],pe=De!==null&&ge.null,Pe=[...Array.isArray(Ie)?Ie:Ie?[Ie]:[],...Array.isArray(pe)?pe:pe?[pe]:[]];return G(Pe)(De)}}function G(ge){return P=ge,ae=0,ge.length===0?I:D(ge[ae])}function D(ge){return Ae;function Ae(De){return M=Y(),je=ge,ge.partial||(f.currentConstruct=ge),ge.name&&f.parser.constructs.disable.null.includes(ge.name)?Ee():ge.tokenize.call(O?Object.assign(Object.create(f),O):f,x,ue,Ee)(De)}}function ue(ge){return U(je,M),W}function Ee(ge){return M.restore(),++ae<P.length?D(P[ae]):I}}}function K(U,O){U.resolveAll&&!u.includes(U)&&u.push(U),U.resolve&&nl(f.events,O,f.events.length-O,U.resolve(f.events.slice(O),f)),U.resolveTo&&(f.events=U.resolveTo(f.events,f))}function Y(){const U=S(),O=f.previous,Z=f.currentConstruct,ne=f.events.length,W=Array.from(m);return{from:ne,restore:I};function I(){i=U,f.previous=O,f.currentConstruct=Z,f.events.length=ne,m=W,T()}}function T(){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: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 dh(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(ve),autolinkProtocol:Y,autolinkEmail:Y,atxHeading:u(Ce),blockQuote:u(ye),characterEscape:Y,characterReference:Y,codeFenced:u(We),codeFencedFenceInfo:d,codeFencedFenceMeta:d,codeIndented:u(We,d),codeText:u(fe,d),codeTextData:Y,data:Y,codeFlowValue:Y,definition:u(he),definitionDestinationString:d,definitionLabelString:d,definitionTitleString:d,emphasis:u(be),hardBreakEscape:u(ze),hardBreakTrailing:u(ze),htmlFlow:u(_e,d),htmlFlowData:Y,htmlText:u(_e,d),htmlTextData:Y,image:u(Me),label:d,link:u(ve),listItem:u(Je),listItemValue:b,listOrdered:u(Oe,y),listUnordered:u(Oe),paragraph:u(jt),reference:D,referenceString:d,resourceDestinationString:d,resourceTitleString:d,setextHeading:u(Ce),strong:u($t),thematicBreak:u(Xt)},exit:{atxHeading:x(),atxHeadingSequence:$,autolink:x(),autolinkEmail:He,autolinkProtocol:De,blockQuote:x(),characterEscapeValue:T,characterReferenceMarkerHexadecimal:Ee,characterReferenceMarkerNumeric:Ee,characterReferenceValue:ge,characterReference:Ae,codeFenced:x(E),codeFencedFence:j,codeFencedFenceInfo:v,codeFencedFenceMeta:S,codeFlowValue:T,codeIndented:x(C),codeText:x(W),codeTextData:T,data:T,definition:x(),definitionDestinationString:B,definitionLabelString:A,definitionTitleString:F,emphasis:x(),hardBreakEscape:x(O),hardBreakTrailing:x(O),htmlFlow:x(Z),htmlFlowData:T,htmlText:x(ne),htmlTextData:T,image:x(P),label:ke,labelText:re,lineEnding:U,link:x(I),listItem:x(),listOrdered:x(),listUnordered:x(),paragraph:x(),referenceString:ue,resourceDestinationString:M,resourceTitleString:z,resource:G,setextHeading:x(K),setextHeadingLineSequence:V,setextHeadingText:_,strong:x(),thematicBreak:x()}};wy(l,(t||{}).mdastExtensions||[]);const r={};return i;function i(ae){let me={type:"root",children:[]};const Fe={stack:[me],tokenStack:[],config:l,enter:m,exit:f,buffer:d,resume:g,data:r},Ye=[];let xe=-1;for(;++xe<ae.length;)if(ae[xe][1].type==="listOrdered"||ae[xe][1].type==="listUnordered")if(ae[xe][0]==="enter")Ye.push(xe);else{const q=Ye.pop();xe=c(ae,q,xe)}for(xe=-1;++xe<ae.length;){const q=l[ae[xe][0]];vy.call(q,ae[xe][1].type)&&q[ae[xe][1].type].call(Object.assign({sliceSerialize:ae[xe][2].sliceSerialize},Fe),ae[xe][1])}if(Fe.tokenStack.length>0){const q=Fe.tokenStack[Fe.tokenStack.length-1];(q[1]||L1).call(Fe,void 0,q[0])}for(me.position={start:Br(ae.length>0?ae[0][1].start:{line:1,column:1,offset:0}),end:Br(ae.length>0?ae[ae.length-2][1].end:{line:1,column:1,offset:0})},xe=-1;++xe<l.transforms.length;)me=l.transforms[xe](me)||me;return me}function c(ae,me,Fe){let Ye=me-1,xe=-1,q=!1,Te,$e,Ke,mt;for(;++Ye<=Fe;){const Qe=ae[Ye];switch(Qe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Qe[0]==="enter"?xe++:xe--,mt=void 0;break}case"lineEndingBlank":{Qe[0]==="enter"&&(Te&&!mt&&!xe&&!Ke&&(Ke=Ye),mt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:mt=void 0}if(!xe&&Qe[0]==="enter"&&Qe[1].type==="listItemPrefix"||xe===-1&&Qe[0]==="exit"&&(Qe[1].type==="listUnordered"||Qe[1].type==="listOrdered")){if(Te){let It=Ye;for($e=void 0;It--;){const an=ae[It];if(an[1].type==="lineEnding"||an[1].type==="lineEndingBlank"){if(an[0]==="exit")continue;$e&&(ae[$e][1].type="lineEndingBlank",q=!0),an[1].type="lineEnding",$e=It}else if(!(an[1].type==="linePrefix"||an[1].type==="blockQuotePrefix"||an[1].type==="blockQuotePrefixWhitespace"||an[1].type==="blockQuoteMarker"||an[1].type==="listItemIndent"))break}Ke&&(!$e||Ke<$e)&&(Te._spread=!0),Te.end=Object.assign({},$e?ae[$e][1].start:Qe[1].end),ae.splice($e||Ye,0,["exit",Te,Qe[2]]),Ye++,Fe++}if(Qe[1].type==="listItemPrefix"){const It={type:"listItem",_spread:!1,start:Object.assign({},Qe[1].start),end:void 0};Te=It,ae.splice(Ye,0,["enter",It,Qe[2]]),Ye++,Fe++,Ke=void 0,mt=!0}}}return ae[me][1]._spread=q,Fe}function u(ae,me){return Fe;function Fe(Ye){m.call(this,ae(Ye),Ye),me&&me.call(this,Ye)}}function d(){this.stack.push({type:"fragment",children:[]})}function m(ae,me,Fe){this.stack[this.stack.length-1].children.push(ae),this.stack.push(ae),this.tokenStack.push([me,Fe||void 0]),ae.position={start:Br(me.start),end:void 0}}function x(ae){return me;function me(Fe){ae&&ae.call(this,Fe),f.call(this,Fe)}}function f(ae,me){const Fe=this.stack.pop(),Ye=this.tokenStack.pop();if(Ye)Ye[0].type!==ae.type&&(me?me.call(this,ae,Ye[0]):(Ye[1]||L1).call(this,ae,Ye[0]));else throw new Error("Cannot close `"+ae.type+"` ("+As({start:ae.start,end:ae.end})+"): it’s not open");Fe.position.end=Br(ae.end)}function g(){return uh(this.stack.pop())}function y(){this.data.expectingFirstListItemValue=!0}function b(ae){if(this.data.expectingFirstListItemValue){const me=this.stack[this.stack.length-2];me.start=Number.parseInt(this.sliceSerialize(ae),10),this.data.expectingFirstListItemValue=void 0}}function v(){const ae=this.resume(),me=this.stack[this.stack.length-1];me.lang=ae}function S(){const ae=this.resume(),me=this.stack[this.stack.length-1];me.meta=ae}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function E(){const ae=this.resume(),me=this.stack[this.stack.length-1];me.value=ae.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function C(){const ae=this.resume(),me=this.stack[this.stack.length-1];me.value=ae.replace(/(\r?\n|\r)$/g,"")}function A(ae){const me=this.resume(),Fe=this.stack[this.stack.length-1];Fe.label=me,Fe.identifier=gl(this.sliceSerialize(ae)).toLowerCase()}function F(){const ae=this.resume(),me=this.stack[this.stack.length-1];me.title=ae}function B(){const ae=this.resume(),me=this.stack[this.stack.length-1];me.url=ae}function $(ae){const me=this.stack[this.stack.length-1];if(!me.depth){const Fe=this.sliceSerialize(ae).length;me.depth=Fe}}function _(){this.data.setextHeadingSlurpLineEnding=!0}function V(ae){const me=this.stack[this.stack.length-1];me.depth=this.sliceSerialize(ae).codePointAt(0)===61?1:2}function K(){this.data.setextHeadingSlurpLineEnding=void 0}function Y(ae){const Fe=this.stack[this.stack.length-1].children;let Ye=Fe[Fe.length-1];(!Ye||Ye.type!=="text")&&(Ye=yt(),Ye.position={start:Br(ae.start),end:void 0},Fe.push(Ye)),this.stack.push(Ye)}function T(ae){const me=this.stack.pop();me.value+=this.sliceSerialize(ae),me.position.end=Br(ae.end)}function U(ae){const me=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Fe=me.children[me.children.length-1];Fe.position.end=Br(ae.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&l.canContainEols.includes(me.type)&&(Y.call(this,ae),T.call(this,ae))}function O(){this.data.atHardBreak=!0}function Z(){const ae=this.resume(),me=this.stack[this.stack.length-1];me.value=ae}function ne(){const ae=this.resume(),me=this.stack[this.stack.length-1];me.value=ae}function W(){const ae=this.resume(),me=this.stack[this.stack.length-1];me.value=ae}function I(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const me=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=me,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function P(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const me=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=me,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function re(ae){const me=this.sliceSerialize(ae),Fe=this.stack[this.stack.length-2];Fe.label=H5(me),Fe.identifier=gl(me).toLowerCase()}function ke(){const ae=this.stack[this.stack.length-1],me=this.resume(),Fe=this.stack[this.stack.length-1];if(this.data.inReference=!0,Fe.type==="link"){const Ye=ae.children;Fe.children=Ye}else Fe.alt=me}function M(){const ae=this.resume(),me=this.stack[this.stack.length-1];me.url=ae}function z(){const ae=this.resume(),me=this.stack[this.stack.length-1];me.title=ae}function G(){this.data.inReference=void 0}function D(){this.data.referenceType="collapsed"}function ue(ae){const me=this.resume(),Fe=this.stack[this.stack.length-1];Fe.label=me,Fe.identifier=gl(this.sliceSerialize(ae)).toLowerCase(),this.data.referenceType="full"}function Ee(ae){this.data.characterReferenceType=ae.type}function ge(ae){const me=this.sliceSerialize(ae),Fe=this.data.characterReferenceType;let Ye;Fe?(Ye=uy(me,Fe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ye=dh(me);const xe=this.stack[this.stack.length-1];xe.value+=Ye}function Ae(ae){const me=this.stack.pop();me.position.end=Br(ae.end)}function De(ae){T.call(this,ae);const me=this.stack[this.stack.length-1];me.url=this.sliceSerialize(ae)}function He(ae){T.call(this,ae);const me=this.stack[this.stack.length-1];me.url="mailto:"+this.sliceSerialize(ae)}function ye(){return{type:"blockquote",children:[]}}function We(){return{type:"code",lang:null,meta:null,value:""}}function fe(){return{type:"inlineCode",value:""}}function he(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function be(){return{type:"emphasis",children:[]}}function Ce(){return{type:"heading",depth:0,children:[]}}function ze(){return{type:"break"}}function _e(){return{type:"html",value:""}}function Me(){return{type:"image",title:null,url:"",alt:null}}function ve(){return{type:"link",title:null,url:"",children:[]}}function Oe(ae){return{type:"list",ordered:ae.type==="listOrdered",start:null,spread:ae._spread,children:[]}}function Je(ae){return{type:"listItem",spread:ae._spread,checked:null,children:[]}}function jt(){return{type:"paragraph",children:[]}}function $t(){return{type:"strong",children:[]}}function yt(){return{type:"text",value:""}}function Xt(){return{type:"thematicBreak"}}}function Br(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:`
|
|
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:hy([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(;!gy(t););return t}const U1=/[\0\t\n\r]/g;function $5(){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(U1.lastIndex=y,f=U1.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 L5=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function H5(t){return t.replace(L5,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 my(r.slice(u?2:1),u?16:10)}return ph(r)||t}const Sy={}.hasOwnProperty;function I5(t,l,r){return l&&typeof l=="object"&&(r=l,l=void 0),Y5(r)(B5(O5(r).document().write($5()(t,l,!0))))}function Y5(t){const l={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(we),autolinkProtocol:Y,autolinkEmail:Y,atxHeading:u(Ce),blockQuote:u(pe),characterEscape:Y,characterReference:Y,codeFenced:u(Pe),codeFencedFenceInfo:d,codeFencedFenceMeta:d,codeIndented:u(Pe,d),codeText:u(fe,d),codeTextData:Y,data:Y,codeFlowValue:Y,definition:u(he),definitionDestinationString:d,definitionLabelString:d,definitionTitleString:d,emphasis:u(be),hardBreakEscape:u(ze),hardBreakTrailing:u(ze),htmlFlow:u(Oe,d),htmlFlowData:Y,htmlText:u(Oe,d),htmlTextData:Y,image:u(Me),label:d,link:u(we),listItem:u(tt),listItemValue:b,listOrdered:u(Be,y),listUnordered:u(Be),paragraph:u(jt),reference:D,referenceString:d,resourceDestinationString:d,resourceTitleString:d,setextHeading:u(Ce),strong:u(Ut),thematicBreak:u(Vt)},exit:{atxHeading:x(),atxHeadingSequence:L,autolink:x(),autolinkEmail:Ie,autolinkProtocol:De,blockQuote:x(),characterEscapeValue:T,characterReferenceMarkerHexadecimal:Ee,characterReferenceMarkerNumeric:Ee,characterReferenceValue:ge,characterReference:Ae,codeFenced:x(E),codeFencedFence:j,codeFencedFenceInfo:v,codeFencedFenceMeta:S,codeFlowValue:T,codeIndented:x(C),codeText:x(W),codeTextData:T,data:T,definition:x(),definitionDestinationString:B,definitionLabelString:A,definitionTitleString:R,emphasis:x(),hardBreakEscape:x(O),hardBreakTrailing:x(O),htmlFlow:x(Z),htmlFlowData:T,htmlText:x(ne),htmlTextData:T,image:x(P),label:je,labelText:ae,lineEnding:U,link:x(I),listItem:x(),listOrdered:x(),listUnordered:x(),paragraph:x(),referenceString:ue,resourceDestinationString:M,resourceTitleString:z,resource:G,setextHeading:x(K),setextHeadingLineSequence:V,setextHeadingText:_,strong:x(),thematicBreak:x()}};Cy(l,(t||{}).mdastExtensions||[]);const r={};return i;function i(ie){let me={type:"root",children:[]};const Fe={stack:[me],tokenStack:[],config:l,enter:m,exit:f,buffer:d,resume:g,data:r},Ge=[];let ye=-1;for(;++ye<ie.length;)if(ie[ye][1].type==="listOrdered"||ie[ye][1].type==="listUnordered")if(ie[ye][0]==="enter")Ge.push(ye);else{const q=Ge.pop();ye=c(ie,q,ye)}for(ye=-1;++ye<ie.length;){const q=l[ie[ye][0]];Sy.call(q,ie[ye][1].type)&&q[ie[ye][1].type].call(Object.assign({sliceSerialize:ie[ye][2].sliceSerialize},Fe),ie[ye][1])}if(Fe.tokenStack.length>0){const q=Fe.tokenStack[Fe.tokenStack.length-1];(q[1]||I1).call(Fe,void 0,q[0])}for(me.position={start:Qr(ie.length>0?ie[0][1].start:{line:1,column:1,offset:0}),end:Qr(ie.length>0?ie[ie.length-2][1].end:{line:1,column:1,offset:0})},ye=-1;++ye<l.transforms.length;)me=l.transforms[ye](me)||me;return me}function c(ie,me,Fe){let Ge=me-1,ye=-1,q=!1,Te,He,Je,mt;for(;++Ge<=Fe;){const et=ie[Ge];switch(et[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{et[0]==="enter"?ye++:ye--,mt=void 0;break}case"lineEndingBlank":{et[0]==="enter"&&(Te&&!mt&&!ye&&!Je&&(Je=Ge),mt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:mt=void 0}if(!ye&&et[0]==="enter"&&et[1].type==="listItemPrefix"||ye===-1&&et[0]==="exit"&&(et[1].type==="listUnordered"||et[1].type==="listOrdered")){if(Te){let Yt=Ge;for(He=void 0;Yt--;){const cn=ie[Yt];if(cn[1].type==="lineEnding"||cn[1].type==="lineEndingBlank"){if(cn[0]==="exit")continue;He&&(ie[He][1].type="lineEndingBlank",q=!0),cn[1].type="lineEnding",He=Yt}else if(!(cn[1].type==="linePrefix"||cn[1].type==="blockQuotePrefix"||cn[1].type==="blockQuotePrefixWhitespace"||cn[1].type==="blockQuoteMarker"||cn[1].type==="listItemIndent"))break}Je&&(!He||Je<He)&&(Te._spread=!0),Te.end=Object.assign({},He?ie[He][1].start:et[1].end),ie.splice(He||Ge,0,["exit",Te,et[2]]),Ge++,Fe++}if(et[1].type==="listItemPrefix"){const Yt={type:"listItem",_spread:!1,start:Object.assign({},et[1].start),end:void 0};Te=Yt,ie.splice(Ge,0,["enter",Yt,et[2]]),Ge++,Fe++,Je=void 0,mt=!0}}}return ie[me][1]._spread=q,Fe}function u(ie,me){return Fe;function Fe(Ge){m.call(this,ie(Ge),Ge),me&&me.call(this,Ge)}}function d(){this.stack.push({type:"fragment",children:[]})}function m(ie,me,Fe){this.stack[this.stack.length-1].children.push(ie),this.stack.push(ie),this.tokenStack.push([me,Fe||void 0]),ie.position={start:Qr(me.start),end:void 0}}function x(ie){return me;function me(Fe){ie&&ie.call(this,Fe),f.call(this,Fe)}}function f(ie,me){const Fe=this.stack.pop(),Ge=this.tokenStack.pop();if(Ge)Ge[0].type!==ie.type&&(me?me.call(this,ie,Ge[0]):(Ge[1]||I1).call(this,ie,Ge[0]));else throw new Error("Cannot close `"+ie.type+"` ("+$s({start:ie.start,end:ie.end})+"): it’s not open");Fe.position.end=Qr(ie.end)}function g(){return xh(this.stack.pop())}function y(){this.data.expectingFirstListItemValue=!0}function b(ie){if(this.data.expectingFirstListItemValue){const me=this.stack[this.stack.length-2];me.start=Number.parseInt(this.sliceSerialize(ie),10),this.data.expectingFirstListItemValue=void 0}}function v(){const ie=this.resume(),me=this.stack[this.stack.length-1];me.lang=ie}function S(){const ie=this.resume(),me=this.stack[this.stack.length-1];me.meta=ie}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function E(){const ie=this.resume(),me=this.stack[this.stack.length-1];me.value=ie.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function C(){const ie=this.resume(),me=this.stack[this.stack.length-1];me.value=ie.replace(/(\r?\n|\r)$/g,"")}function A(ie){const me=this.resume(),Fe=this.stack[this.stack.length-1];Fe.label=me,Fe.identifier=Cl(this.sliceSerialize(ie)).toLowerCase()}function R(){const ie=this.resume(),me=this.stack[this.stack.length-1];me.title=ie}function B(){const ie=this.resume(),me=this.stack[this.stack.length-1];me.url=ie}function L(ie){const me=this.stack[this.stack.length-1];if(!me.depth){const Fe=this.sliceSerialize(ie).length;me.depth=Fe}}function _(){this.data.setextHeadingSlurpLineEnding=!0}function V(ie){const me=this.stack[this.stack.length-1];me.depth=this.sliceSerialize(ie).codePointAt(0)===61?1:2}function K(){this.data.setextHeadingSlurpLineEnding=void 0}function Y(ie){const Fe=this.stack[this.stack.length-1].children;let Ge=Fe[Fe.length-1];(!Ge||Ge.type!=="text")&&(Ge=yt(),Ge.position={start:Qr(ie.start),end:void 0},Fe.push(Ge)),this.stack.push(Ge)}function T(ie){const me=this.stack.pop();me.value+=this.sliceSerialize(ie),me.position.end=Qr(ie.end)}function U(ie){const me=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Fe=me.children[me.children.length-1];Fe.position.end=Qr(ie.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&l.canContainEols.includes(me.type)&&(Y.call(this,ie),T.call(this,ie))}function O(){this.data.atHardBreak=!0}function Z(){const ie=this.resume(),me=this.stack[this.stack.length-1];me.value=ie}function ne(){const ie=this.resume(),me=this.stack[this.stack.length-1];me.value=ie}function W(){const ie=this.resume(),me=this.stack[this.stack.length-1];me.value=ie}function I(){const ie=this.stack[this.stack.length-1];if(this.data.inReference){const me=this.data.referenceType||"shortcut";ie.type+="Reference",ie.referenceType=me,delete ie.url,delete ie.title}else delete ie.identifier,delete ie.label;this.data.referenceType=void 0}function P(){const ie=this.stack[this.stack.length-1];if(this.data.inReference){const me=this.data.referenceType||"shortcut";ie.type+="Reference",ie.referenceType=me,delete ie.url,delete ie.title}else delete ie.identifier,delete ie.label;this.data.referenceType=void 0}function ae(ie){const me=this.sliceSerialize(ie),Fe=this.stack[this.stack.length-2];Fe.label=H5(me),Fe.identifier=Cl(me).toLowerCase()}function je(){const ie=this.stack[this.stack.length-1],me=this.resume(),Fe=this.stack[this.stack.length-1];if(this.data.inReference=!0,Fe.type==="link"){const Ge=ie.children;Fe.children=Ge}else Fe.alt=me}function M(){const ie=this.resume(),me=this.stack[this.stack.length-1];me.url=ie}function z(){const ie=this.resume(),me=this.stack[this.stack.length-1];me.title=ie}function G(){this.data.inReference=void 0}function D(){this.data.referenceType="collapsed"}function ue(ie){const me=this.resume(),Fe=this.stack[this.stack.length-1];Fe.label=me,Fe.identifier=Cl(this.sliceSerialize(ie)).toLowerCase(),this.data.referenceType="full"}function Ee(ie){this.data.characterReferenceType=ie.type}function ge(ie){const me=this.sliceSerialize(ie),Fe=this.data.characterReferenceType;let Ge;Fe?(Ge=my(me,Fe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ge=ph(me);const ye=this.stack[this.stack.length-1];ye.value+=Ge}function Ae(ie){const me=this.stack.pop();me.position.end=Qr(ie.end)}function De(ie){T.call(this,ie);const me=this.stack[this.stack.length-1];me.url=this.sliceSerialize(ie)}function Ie(ie){T.call(this,ie);const me=this.stack[this.stack.length-1];me.url="mailto:"+this.sliceSerialize(ie)}function pe(){return{type:"blockquote",children:[]}}function Pe(){return{type:"code",lang:null,meta:null,value:""}}function fe(){return{type:"inlineCode",value:""}}function he(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function be(){return{type:"emphasis",children:[]}}function Ce(){return{type:"heading",depth:0,children:[]}}function ze(){return{type:"break"}}function Oe(){return{type:"html",value:""}}function Me(){return{type:"image",title:null,url:"",alt:null}}function we(){return{type:"link",title:null,url:"",children:[]}}function Be(ie){return{type:"list",ordered:ie.type==="listOrdered",start:null,spread:ie._spread,children:[]}}function tt(ie){return{type:"listItem",spread:ie._spread,checked:null,children:[]}}function jt(){return{type:"paragraph",children:[]}}function Ut(){return{type:"strong",children:[]}}function yt(){return{type:"text",value:""}}function Vt(){return{type:"thematicBreak"}}}function Qr(t){return{line:t.line,column:t.column,offset:t.offset}}function Cy(t,l){let r=-1;for(;++r<l.length;){const i=l[r];Array.isArray(i)?Cy(t,i):q5(t,i)}}function q5(t,l){let r;for(r in l)if(Sy.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 I1(t,l){throw t?new Error("Cannot close `"+t.type+"` ("+$s({start:t.start,end:t.end})+"): a different token (`"+l.type+"`, "+$s({start:l.start,end:l.end})+") is open"):new Error("Cannot close document, a token (`"+l.type+"`, "+$s({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 W5(t,l){const r={type:"element",tagName:"del",properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}function Q5(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=
|
|
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 W5(t,l){const r={type:"element",tagName:"del",properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}function Q5(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=Ti(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 Ey(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 ek(t,l){const r=String(l.identifier).toUpperCase(),i=t.definitionById.get(r);if(!i)return Ey(t,l);const c={src:Ti(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 tk(t,l){const r={src:Ti(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 nk(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 lk(t,l){const r=String(l.identifier).toUpperCase(),i=t.definitionById.get(r);if(!i)return Ey(t,l);const c={href:Ti(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 rk(t,l){const r={href:Ti(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 ak(t,l,r){const i=t.all(l),c=r?ik(r):Ny(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
|
|
57
|
+
`});const f={type:"element",tagName:"li",properties:u,children:d};return t.patch(l,f),t.applyData(l,f)}function ik(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=Ny(r[i])}return l}function Ny(t){const l=t.spread;return l??t.children.length>1}function sk(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 ok(t,l){const r={type:"element",tagName:"p",properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}function ck(t,l){const r={type:"root",children:t.wrap(t.all(l))};return t.patch(l,r),t.applyData(l,r)}function uk(t,l){const r={type:"element",tagName:"strong",properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}function dk(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=dh(l.children[1]),x=iy(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 fk(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 hk(t,l){const r={type:"element",tagName:"td",properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}const Y1=9,q1=32;function mk(t){const l=String(t),r=/\r?\n|\r/g;let i=r.exec(l),c=0;const u=[];for(;i;)u.push(X1(l.slice(c,i.index),c>0,!0),i[0]),c=i.index+i[0].length,i=r.exec(l);return u.push(X1(l.slice(c),c>0,!1)),u.join("")}function X1(t,l,r){let i=0,c=t.length;if(l){let u=t.codePointAt(i);for(;u===Y1||u===q1;)i++,u=t.codePointAt(i)}if(r){let u=t.codePointAt(c-1);for(;u===Y1||u===q1;)c--,u=t.codePointAt(c-1)}return c>i?t.slice(i,c):""}function xk(t,l){const r={type:"text",value:mk(String(l.value))};return t.patch(l,r),t.applyData(l,r)}function pk(t,l){const r={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(l,r),t.applyData(l,r)}const yk={blockquote:V5,break:G5,code:K5,delete:W5,emphasis:Q5,footnoteReference:Z5,heading:J5,html:P5,imageReference:ek,image:tk,inlineCode:nk,linkReference:lk,link:rk,listItem:ak,list:sk,paragraph:ok,root:ck,strong:uk,table:dk,tableCell:hk,tableRow:fk,text:xk,thematicBreak:pk,toml:uc,yaml:uc,definition:uc,footnoteDefinition:uc};function uc(){}const Ay=-1,Xc=0,Hs=1,Rc=2,gh=3,bh=4,vh=5,wh=6,Dy=7,Ty=8,V1=typeof self=="object"?self:globalThis,gk=(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 Xc:case Ay:return r(d,c);case Hs:{const m=r([],c);for(const x of d)m.push(i(x));return m}case Rc:{const m=r({},c);for(const[x,f]of d)m[i(x)]=i(f);return m}case gh:return r(new Date(d),c);case bh:{const{source:m,flags:x}=d;return r(new RegExp(m,x),c)}case vh:{const m=r(new Map,c);for(const[x,f]of d)m.set(i(x),i(f));return m}case wh:{const m=r(new Set,c);for(const x of d)m.add(i(x));return m}case Dy:{const{name:m,message:x}=d;return r(new V1[m](x),c)}case Ty: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 V1[u](d),c)};return i},G1=t=>gk(new Map,t)(0),vi="",{toString:bk}={},{keys:vk}=Object,Ds=t=>{const l=typeof t;if(l!=="object"||!t)return[Xc,l];const r=bk.call(t).slice(8,-1);switch(r){case"Array":return[Hs,vi];case"Object":return[Rc,vi];case"Date":return[gh,vi];case"RegExp":return[bh,vi];case"Map":return[vh,vi];case"Set":return[wh,vi];case"DataView":return[Hs,r]}return r.includes("Array")?[Hs,r]:r.includes("Error")?[Dy,r]:[Rc,r]},dc=([t,l])=>t===Xc&&(l==="function"||l==="symbol"),wk=(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]=Ds(d);switch(m){case Xc:{let g=d;switch(x){case"bigint":m=Ty,g=d.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+x);g=null;break;case"undefined":return c([Ay],d)}return c([m,g],d)}case Hs:{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 Rc:{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 vk(d))(t||!dc(Ds(d[b])))&&g.push([u(b),u(d[b])]);return y}case gh:return c([m,d.toISOString()],d);case bh:{const{source:g,flags:y}=d;return c([m,{source:g,flags:y}],d)}case vh:{const g=[],y=c([m,g],d);for(const[b,v]of d)(t||!(dc(Ds(b))||dc(Ds(v))))&&g.push([u(b),u(v)]);return y}case wh:{const g=[],y=c([m,g],d);for(const b of d)(t||!dc(Ds(b)))&&g.push(u(b));return y}}const{message:f}=d;return c([m,{name:x,message:f}],d)};return u},K1=(t,{json:l,lossy:r}={})=>{const i=[];return wk(!(l||r),!!l,new Map,i)(t),i},_c=typeof structuredClone=="function"?(t,l)=>l&&("json"in l||"lossy"in l)?G1(K1(t,l)):structuredClone(t):(t,l)=>G1(K1(t,l));function kk(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 jk(t,l){return"Back to reference "+(t+1)+(l>1?"-"+l:"")}function Sk(t){const l=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=t.options.footnoteBackContent||kk,i=t.options.footnoteBackLabel||jk,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=Ti(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:{..._c(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
|
|
59
|
+
`}]}}const Vc=(function(t){if(t==null)return Ak;if(typeof t=="function")return Gc(t);if(typeof t=="object")return Array.isArray(t)?Ck(t):Ek(t);if(typeof t=="string")return Nk(t);throw new Error("Expected function, string, or object as test")});function Ck(t){const l=[];let r=-1;for(;++r<t.length;)l[r]=Vc(t[r]);return Gc(i);function i(...c){let u=-1;for(;++u<l.length;)if(l[u].apply(this,c))return!0;return!1}}function Ek(t){const l=t;return Gc(r);function r(i){const c=i;let u;for(u in t)if(c[u]!==l[u])return!1;return!0}}function Nk(t){return Gc(l);function l(r){return r&&r.type===t}}function Gc(t){return l;function l(r,i,c){return!!(Dk(r)&&t.call(this,r,typeof i=="number"?i:void 0,c||void 0))}}function Ak(){return!0}function Dk(t){return t!==null&&typeof t=="object"&&"type"in t}const zy=[],Tk=!0,Kf=!1,zk="skip";function My(t,l,r,i){let c;typeof l=="function"&&typeof r!="function"?(i=r,r=l):c=l;const u=Vc(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=zy,S,j,E;if((!l||u(x,f,g[g.length-1]||void 0))&&(v=Mk(r(x,g)),v[0]===Kf))return v;if("children"in x&&x.children){const C=x;if(C.children&&v[0]!==zk)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]===Kf)return S;j=typeof S[1]=="number"?S[1]:j+d}}return v}}}function Mk(t){return Array.isArray(t)?t:typeof t=="number"?[Tk,t]:t==null?zy:[t]}function kh(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),My(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 Wf={}.hasOwnProperty,Fk={};function Rk(t,l){const r=l||Fk,i=new Map,c=new Map,u=new Map,d={...yk,...r.handlers},m={all:f,applyData:Ok,definitionById:i,footnoteById:c,footnoteCounts:u,footnoteOrder:[],handlers:d,one:x,options:r,patch:_k,wrap:$k};return kh(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(Wf.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=_c(E);return C.children=m.all(g),C}return _c(g)}return(m.options.unknownHandler||Bk)(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=W1(S.value)),!Array.isArray(S)&&S.type==="element")){const j=S.children[0];j&&j.type==="text"&&(j.value=W1(j.value))}Array.isArray(S)?y.push(...S):y.push(S)}}}return y}}function _k(t,l){t.position&&(l.position=jv(t))}function Ok(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,_c(u)),"children"in r&&r.children&&c!==null&&c!==void 0&&(r.children=c)}return r}function Bk(t,l){const r=l.data||{},i="value"in l&&!(Wf.call(r,"hProperties")||Wf.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 $k(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=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 lf,K1;function H3(){if(K1)return lf;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 lf=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},lf}var U3=H3();const rf=G0(U3);function Xf(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 Al={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=W3(t,!l);return r.length===0&&!l&&(r="."),r.length>0&&t.codePointAt(t.length-1)===47&&(r+="/"),l?"/"+r:r}function W3(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 Q3={cwd:Z3};function Z3(){return"/"}function Vf(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(!Vf(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 af=["history","path","basename","stem","extname","dirname"];class Dy{constructor(l){let r;l?Vf(l)?r={path:l}:typeof l=="string"||ek(l)?r={value:l}:r=l:r={},this.cwd="cwd"in r?"":Q3.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<af.length;){const u=af[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)af.includes(c)||(this[c]=r[c])}get basename(){return typeof this.path=="string"?Al.basename(this.path):void 0}set basename(l){of(l,"basename"),sf(l,"basename"),this.path=Al.join(this.dirname||"",l)}get dirname(){return typeof this.path=="string"?Al.dirname(this.path):void 0}set dirname(l){W1(this.basename,"dirname"),this.path=Al.join(l||"",this.basename)}get extname(){return typeof this.path=="string"?Al.extname(this.path):void 0}set extname(l){if(sf(l,"extname"),W1(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=Al.join(this.dirname,this.stem+(l||""))}get path(){return this.history[this.history.length-1]}set path(l){Vf(l)&&(l=J3(l)),of(l,"path"),this.path!==l&&this.history.push(l)}get stem(){return typeof this.path=="string"?Al.basename(this.path,this.extname):void 0}set stem(l){of(l,"stem"),sf(l,"stem"),this.path=Al.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 Cn(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 sf(t,l){if(t&&t.includes(Al.sep))throw new Error("`"+l+"` cannot be a path: did not expect `"+Al.sep+"`")}function of(t,l){if(!t)throw new Error("`"+l+"` cannot be empty")}function W1(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 gh 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 gh;let r=-1;for(;++r<this.attachers.length;){const i=this.attachers[r];l.use(...i)}return l.data(rf(!0,{},this.namespace)),l}data(l,r){return typeof l=="string"?arguments.length===2?(df("data",this.frozen),this.namespace[l]=r,this):nk.call(this.namespace,l)&&this.namespace[l]||void 0:l?(df("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=sc(l),i=this.parser||this.Parser;return cf("parse",i),i(String(r),r)}process(l,r){const i=this;return this.freeze(),cf("process",this.parser||this.Parser),uf("process",this.compiler||this.Compiler),r?c(void 0,r):new Promise(c);function c(u,d){const m=sc(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(),cf("processSync",this.parser||this.Parser),uf("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){Q1(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=sc(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=sc(r),c=this.compiler||this.Compiler;return uf("stringify",c),Q1(l),c(l,i)}use(l,...r){const i=this.attachers,c=this.namespace;if(df("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=rf(!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];Xf(j)&&Xf(v)&&(v=rf(!0,j,v)),i[b]=[f,v,...S]}}}}const lk=new gh().freeze();function cf(t,l){if(typeof l!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function uf(t,l){if(typeof l!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function df(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 Q1(t){if(!Xf(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 sc(t){return rk(t)?t:new Dy(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 bh(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 Dy;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 yh(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 ef)if(Object.hasOwn(ef,v)&&Object.hasOwn(g.properties,v)){const S=g.properties[v],j=ef[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=Uc((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 B=F.index,$={index:F.index,input:F.input,stack:[...g,f]};let _=v(...F,$);if(typeof _=="string"&&(_=_.length>0?{type:"text",value:_}:void 0),_===!1?b.lastIndex=B+1:(S!==B&&A.push({type:"text",value:f.value.slice(S,B)}),Array.isArray(_)?A.push(..._):_&&A.push(_),S=B+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 ff="phrasing",hf=["autolink","link","image","label"];function bk(){return{transforms:[Ek],enter:{literalAutolink:wk,literalAutolinkEmail:mf,literalAutolinkHttp:mf,literalAutolinkWww:mf},exit:{literalAutolink:Ck,literalAutolinkEmail:Sk,literalAutolinkHttp:kk,literalAutolinkWww:jk}}}function vk(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:ff,notInConstruct:hf},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:ff,notInConstruct:hf},{character:":",before:"[ps]",after:"\\/",inConstruct:ff,notInConstruct:hf}]}}function wk(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function mf(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://"),!Dk(r)))return!1;const d=Tk(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 Dk(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 Tk(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 Ty(t,l){const r=t.input.charCodeAt(t.index-1);return(t.index===0||wa(r)||Lc(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=gl(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=gl(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?
|
|
65
|
-
`)}function
|
|
62
|
+
`}),r}function W1(t){let l=0,r=t.charCodeAt(l);for(;r===9||r===32;)l++,r=t.charCodeAt(l);return t.slice(l)}function Q1(t,l){const r=Rk(t,l),i=r.one(t,void 0),c=Sk(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 Lk(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 Z1(t){if(t)throw t}var cf,J1;function Hk(){if(J1)return cf;J1=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 cf=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},cf}var Uk=Hk();const uf=Z0(Uk);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 Ik(){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?Yk(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 Yk(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 _l={basename:qk,dirname:Xk,extname:Vk,join:Gk,sep:"/"};function qk(t,l){if(l!==void 0&&typeof l!="string")throw new TypeError('"ext" argument must be a string');Zs(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 Xk(t){if(Zs(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 Vk(t){Zs(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 Gk(...t){let l=-1,r;for(;++l<t.length;)Zs(t[l]),t[l]&&(r=r===void 0?t[l]:r+"/"+t[l]);return r===void 0?".":Kk(r)}function Kk(t){Zs(t);const l=t.codePointAt(0)===47;let r=Wk(t,!l);return r.length===0&&!l&&(r="."),r.length>0&&t.codePointAt(t.length-1)===47&&(r+="/"),l?"/"+r:r}function Wk(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 Zs(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const Qk={cwd:Zk};function Zk(){return"/"}function Zf(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function Jk(t){if(typeof t=="string")t=new URL(t);else if(!Zf(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 Pk(t)}function Pk(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 df=["history","path","basename","stem","extname","dirname"];class Fy{constructor(l){let r;l?Zf(l)?r={path:l}:typeof l=="string"||e3(l)?r={value:l}:r=l:r={},this.cwd="cwd"in r?"":Qk.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<df.length;){const u=df[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)df.includes(c)||(this[c]=r[c])}get basename(){return typeof this.path=="string"?_l.basename(this.path):void 0}set basename(l){hf(l,"basename"),ff(l,"basename"),this.path=_l.join(this.dirname||"",l)}get dirname(){return typeof this.path=="string"?_l.dirname(this.path):void 0}set dirname(l){P1(this.basename,"dirname"),this.path=_l.join(l||"",this.basename)}get extname(){return typeof this.path=="string"?_l.extname(this.path):void 0}set extname(l){if(ff(l,"extname"),P1(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=_l.join(this.dirname,this.stem+(l||""))}get path(){return this.history[this.history.length-1]}set path(l){Zf(l)&&(l=Jk(l)),hf(l,"path"),this.path!==l&&this.history.push(l)}get stem(){return typeof this.path=="string"?_l.basename(this.path,this.extname):void 0}set stem(l){hf(l,"stem"),ff(l,"stem"),this.path=_l.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 En(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 ff(t,l){if(t&&t.includes(_l.sep))throw new Error("`"+l+"` cannot be a path: did not expect `"+_l.sep+"`")}function hf(t,l){if(!t)throw new Error("`"+l+"` cannot be empty")}function P1(t,l){if(!t)throw new Error("Setting `"+l+"` requires `path` to be set too")}function e3(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const t3=(function(t){const i=this.constructor.prototype,c=i[t],u=function(){return c.apply(u,arguments)};return Object.setPrototypeOf(u,i),u}),n3={}.hasOwnProperty;class jh extends t3{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=Ik()}copy(){const l=new jh;let r=-1;for(;++r<this.attachers.length;){const i=this.attachers[r];l.use(...i)}return l.data(uf(!0,{},this.namespace)),l}data(l,r){return typeof l=="string"?arguments.length===2?(pf("data",this.frozen),this.namespace[l]=r,this):n3.call(this.namespace,l)&&this.namespace[l]||void 0:l?(pf("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=fc(l),i=this.parser||this.Parser;return mf("parse",i),i(String(r),r)}process(l,r){const i=this;return this.freeze(),mf("process",this.parser||this.Parser),xf("process",this.compiler||this.Compiler),r?c(void 0,r):new Promise(c);function c(u,d){const m=fc(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);a3(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(),mf("processSync",this.parser||this.Parser),xf("processSync",this.compiler||this.Compiler),this.process(l,c),t0("processSync","process",r),i;function c(u,d){r=!0,Z1(u),i=d}}run(l,r,i){e0(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=fc(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),t0("runSync","run",i),c;function u(d,m){Z1(d),c=m,i=!0}}stringify(l,r){this.freeze();const i=fc(r),c=this.compiler||this.Compiler;return xf("stringify",c),e0(l),c(l,i)}use(l,...r){const i=this.attachers,c=this.namespace;if(pf("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=uf(!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=uf(!0,j,v)),i[b]=[f,v,...S]}}}}const l3=new jh().freeze();function mf(t,l){if(typeof l!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function xf(t,l){if(typeof l!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function pf(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 e0(t){if(!Qf(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function t0(t,l,r){if(!r)throw new Error("`"+t+"` finished async. Use `"+l+"` instead")}function fc(t){return r3(t)?t:new Fy(t)}function r3(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function a3(t){return typeof t=="string"||i3(t)}function i3(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const s3="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",n0=[],l0={allowDangerousHtml:!0},o3=/^(https?|ircs?|mailto|xmpp)$/i,c3=[{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 Sh(t){const l=u3(t),r=d3(t);return f3(l.runSync(l.parse(r),r),t)}function u3(t){const l=t.rehypePlugins||n0,r=t.remarkPlugins||n0,i=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...l0}:l0;return l3().use(X5).use(r).use(Lk,i).use(l)}function d3(t){const l=t.children||"",r=new Fy;return typeof l=="string"&&(r.value=l),r}function f3(t,l){const r=l.allowedElements,i=l.allowElement,c=l.components,u=l.disallowedElements,d=l.skipHtml,m=l.unwrapDisallowed,x=l.urlTransform||h3;for(const g of c3)Object.hasOwn(l,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+s3+g.id,void 0);return kh(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 af)if(Object.hasOwn(af,v)&&Object.hasOwn(g.properties,v)){const S=g.properties[v],j=af[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 h3(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||o3.test(t.slice(0,l))?t:""}function r0(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 m3(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function x3(t,l,r){const c=Vc((r||{}).ignore||[]),u=p3(l);let d=-1;for(;++d<u.length;)My(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 R=b.exec(f.value);for(;R;){const B=R.index,L={index:R.index,input:R.input,stack:[...g,f]};let _=v(...R,L);if(typeof _=="string"&&(_=_.length>0?{type:"text",value:_}:void 0),_===!1?b.lastIndex=B+1:(S!==B&&A.push({type:"text",value:f.value.slice(S,B)}),Array.isArray(_)?A.push(..._):_&&A.push(_),S=B+R[0].length,C=!0),!b.global)break;R=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 p3(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([y3(c[0]),g3(c[1])])}return l}function y3(t){return typeof t=="string"?new RegExp(m3(t),"g"):t}function g3(t){return typeof t=="function"?t:function(){return t}}const yf="phrasing",gf=["autolink","link","image","label"];function b3(){return{transforms:[E3],enter:{literalAutolink:w3,literalAutolinkEmail:bf,literalAutolinkHttp:bf,literalAutolinkWww:bf},exit:{literalAutolink:C3,literalAutolinkEmail:S3,literalAutolinkHttp:k3,literalAutolinkWww:j3}}}function v3(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:yf,notInConstruct:gf},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:yf,notInConstruct:gf},{character:":",before:"[ps]",after:"\\/",inConstruct:yf,notInConstruct:gf}]}}function w3(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function bf(t){this.config.enter.autolinkProtocol.call(this,t)}function k3(t){this.config.exit.autolinkProtocol.call(this,t)}function j3(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 S3(t){this.config.exit.autolinkEmail.call(this,t)}function C3(t){this.exit(t)}function E3(t){x3(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,N3],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),A3]],{ignore:["link","linkReference"]})}function N3(t,l,r,i,c){let u="";if(!Ry(c)||(/^w/i.test(l)&&(r=l+r,l="",u="http://"),!D3(r)))return!1;const d=T3(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 A3(t,l,r,i){return!Ry(i,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+l+"@"+r,children:[{type:"text",value:l+"@"+r}]}}function D3(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 T3(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=r0(t,"(");let u=r0(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 Ry(t,l){const r=t.input.charCodeAt(t.index-1);return(t.index===0||Fa(r)||Yc(r))&&(!l||r!==47)}_y.peek=L3;function z3(){this.buffer()}function M3(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function F3(){this.buffer()}function R3(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function _3(t){const l=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Cl(this.sliceSerialize(t)).toLowerCase(),r.label=l}function O3(t){this.exit(t)}function B3(t){const l=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Cl(this.sliceSerialize(t)).toLowerCase(),r.label=l}function $3(t){this.exit(t)}function L3(){return"["}function _y(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 H3(){return{enter:{gfmFootnoteCallString:z3,gfmFootnoteCall:M3,gfmFootnoteDefinitionLabelString:F3,gfmFootnoteDefinition:R3},exit:{gfmFootnoteCallString:_3,gfmFootnoteCall:O3,gfmFootnoteDefinitionLabelString:B3,gfmFootnoteDefinition:$3}}}function U3(t){let l=!1;return t&&t.firstLineBlank&&(l=!0),{handlers:{footnoteDefinition:r,footnoteReference:_y},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?Oy:I3))),f(),x}}function I3(t,l,r){return l===0?t:Oy(t,l,r)}function Oy(t,l,r){return(r?"":" ")+t}const Y3=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];By.peek=K3;function q3(){return{canContainEols:["delete"],enter:{strikethrough:V3},exit:{strikethrough:G3}}}function X3(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Y3}],handlers:{delete:By}}}function V3(t){this.enter({type:"delete",children:[]},t)}function G3(t){this.exit(t)}function By(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 K3(){return"~"}function W3(t){return t.length}function Q3(t,l){const r=l||{},i=(r.align||[]).concat(),c=r.stringLength||W3,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=Z3(t[g][C]);if(r.alignDelimiters!==!1){const R=c(A);E[C]=R,(x[C]===void 0||R>x[C])&&(x[C]=R)}j.push(A)}d[g]=j,m[g]=E}let y=-1;if(typeof i=="object"&&"length"in i)for(;++y<f;)u[y]=a0(i[y]);else{const j=a0(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 R=E+"-".repeat(A)+C;r.alignDelimiters!==!1&&(A=E.length+A+C.length,A>x[y]&&(x[y]=A),v[y]=A),b[y]=R}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 R="",B="";if(r.alignDelimiters!==!1){const L=x[y]-(E[y]||0),_=u[y];_===114?R=" ".repeat(L):_===99?L%2?(R=" ".repeat(L/2+.5),B=" ".repeat(L/2-.5)):(R=" ".repeat(L/2),B=R):B=" ".repeat(L)}r.delimiterStart!==!1&&!y&&C.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&A==="")&&(r.delimiterStart!==!1||y)&&C.push(" "),r.alignDelimiters!==!1&&C.push(R),C.push(A),r.alignDelimiters!==!1&&C.push(B),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 Z3(t){return t==null?"":String(t)}function a0(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 J3(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()),P3);return c(),d}function P3(t,l,r){return">"+(r?"":" ")+t}function e4(t,l){return i0(t,l.inConstruct,!0)&&!i0(t,l.notInConstruct,!1)}function i0(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 s0(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
|
|
70
|
+
`)),g+=m.move(x),f(),g}function a4(t,l,r){return(r?"":" ")+t}function Ch(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=Ch(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 Ys(t){return"&#x"+t.toString(16).toUpperCase()+";"}function Oc(t,l,r){const i=Ei(t),c=Ei(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}}$y.peek=o4;function $y(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=Oc(i.before.charCodeAt(i.before.length-1),f,c);g.inside&&(x=Ys(f)+x.slice(1));const y=x.charCodeAt(x.length-1),b=Oc(i.after.charCodeAt(0),y,c);b.inside&&(x=x.slice(0,-1)+Ys(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 kh(t,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return r=!0,Kf}),!!((!t.depth||t.depth<3)&&xh(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=
|
|
76
|
+
`,...u.current()});return/^[\t ]/.test(f)&&(f=Ys(f.charCodeAt(0))+f.slice(1)),f=f?d+" "+f:d,r.options.closeAtx&&(f+=" "+d),x(),m(),f}Ly.peek=d4;function Ly(t){return t.value||""}function d4(){return"<"}Hy.peek=f4;function Hy(t,l,r,i){const c=Ch(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"!"}Uy.peek=h4;function Uy(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"!"}Iy.peek=m4;function Iy(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 Yy(t,l){const r=xh(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))}qy.peek=x4;function qy(t,l,r,i){const c=Ch(r),u=c==='"'?"Quote":"Apostrophe",d=r.createTracker(i);let m,x;if(Yy(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 Yy(t,r)?"<":"["}Xy.peek=p4;function Xy(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 Eh(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=Eh(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 Vy(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):Eh(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),Vy(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||Eh(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=Vc(["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}Gy.peek=E4;function Gy(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=Oc(i.before.charCodeAt(i.before.length-1),f,c);g.inside&&(x=Ys(f)+x.slice(1));const y=x.charCodeAt(x.length-1),b=Oc(i.after.charCodeAt(0),y,c);b.inside&&(x=x.slice(0,-1)+Ys(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 D4(t,l,r){const i=(Vy(r)+(r.options.ruleSpaces?" ":"")).repeat(A4(r));return r.options.ruleSpaces?i.slice(0,-1):i}const Ky={blockquote:J3,break:s0,code:r4,definition:i4,emphasis:$y,hardBreak:s0,heading:u4,html:Ly,image:Hy,imageReference:Uy,inlineCode:Iy,link:qy,linkReference:Xy,list:b4,listItem:w4,paragraph:k4,root:S4,strong:Gy,text:N4,thematicBreak:D4};function T4(){return{enter:{table:z4,tableData:o0,tableHeader:o0,tableRow:F4},exit:{codeText:R4,table:M4,tableData:vf,tableHeader:vf,tableRow:vf}}}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 vf(t){this.exit(t)}function o0(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 Qk(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(),T4(),B4()]}function I4(t){return{extensions:[vk(),Uk(t),Xk(),O4(t),L4()]}}const Y4={tokenize:W4,partial:!0},Xy={tokenize:Q4,partial:!0},Vy={tokenize:Z4,partial:!0},Gy={tokenize:J4,partial:!0},q4={tokenize:P4,partial:!0},Ky={name:"wwwAutolink",tokenize:G4,previous:Qy},Wy={name:"protocolAutolink",tokenize:K4,previous:Zy},rr={name:"emailAutolink",tokenize:V4,previous:Jy},Ml={};function X4(){return{text:Ml}}let ma=48;for(;ma<123;)Ml[ma]=rr,ma++,ma===58?ma=65:ma===91&&(ma=97);Ml[43]=rr;Ml[45]=rr;Ml[46]=rr;Ml[95]=rr;Ml[72]=[rr,Wy];Ml[104]=[rr,Wy];Ml[87]=[rr,Ky];Ml[119]=[rr,Ky];function V4(t,l,r){const i=this;let c,u;return d;function d(y){return!Gf(y)||!Jy.call(i,i.previous)||kh(i.events)?r(y):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),m(y))}function m(y){return Gf(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||Sn(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&&Tn(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)||kh(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)&&!kh(i.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),c+=String.fromCodePoint(y),t.consume(y),m):r(y)}function m(y){if(Tn(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||Ac(y)||Rt(y)||wa(y)||Lc(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 W4(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 Q4(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||Rt(f)||wa(f)||f!==45&&Lc(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||Rt(d)||wa(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||Rt(m)||wa(m)?l(m):r(m)}function c(m){return m===null||m===40||m===91||Rt(m)||wa(m)?l(m):i(m)}function u(m){return Tn(m)?d(m):r(m)}function d(m){return m===59?(t.consume(m),i):Tn(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 Sn(u)?r(u):l(u)}}function Qy(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||Rt(t)}function Zy(t){return!Tn(t)}function Jy(t){return!(t===47||Gf(t))}function Gf(t){return t===43||t===45||t===46||t===95||Sn(t)}function kh(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=gl(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||Rt(y))return r(y);if(y===93){t.exit("chunkString");const b=t.exit("gfmFootnoteCallString");return c.includes(gl(i.sliceSerialize(b)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(y),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),l):r(y)}return Rt(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||Rt(S))return r(S);if(S===93){t.exit("chunkString");const j=t.exit("gfmFootnoteDefinitionLabelString");return u=gl(i.sliceSerialize(j)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(S),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),b}return Rt(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&&el(b,b.length,0,$c(v,d.slice(f+1,x),m)),el(b,b.length,0,[["exit",y,m],["enter",d[x][1],m],["exit",d[x][1],m],["exit",g,m]]),el(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=pi(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=pi(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(T){let U=i.events.length-1;for(;U>-1;){const ne=i.events[U][1].type;if(ne==="lineEnding"||ne==="linePrefix")U--;else break}const O=U>-1?i.events[U][1].type:null,Z=O==="tableHead"||O==="tableRow"?_:x;return Z===_&&i.parser.lazy[i.now().line]?r(T):Z(T)}function x(T){return t.enter("tableHead"),t.enter("tableRow"),f(T)}function f(T){return T===124||(d=!0,u+=1),g(T)}function g(T){return T===null?r(T):qe(T)?u>1?(u=0,i.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(T),t.exit("lineEnding"),v):r(T):ut(T)?pt(t,g,"whitespace")(T):(u+=1,d&&(d=!1,c+=1),T===124?(t.enter("tableCellDivider"),t.consume(T),t.exit("tableCellDivider"),d=!0,g):(t.enter("data"),y(T)))}function y(T){return T===null||T===124||Rt(T)?(t.exit("data"),g(T)):(t.consume(T),T===92?b:y)}function b(T){return T===92||T===124?(t.consume(T),y):y(T)}function v(T){return i.interrupt=!1,i.parser.lazy[i.now().line]?r(T):(t.enter("tableDelimiterRow"),d=!1,ut(T)?pt(t,S,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):S(T))}function S(T){return T===45||T===58?E(T):T===124?(d=!0,t.enter("tableCellDivider"),t.consume(T),t.exit("tableCellDivider"),j):$(T)}function j(T){return ut(T)?pt(t,E,"whitespace")(T):E(T)}function E(T){return T===58?(u+=1,d=!0,t.enter("tableDelimiterMarker"),t.consume(T),t.exit("tableDelimiterMarker"),C):T===45?(u+=1,C(T)):T===null||qe(T)?B(T):$(T)}function C(T){return T===45?(t.enter("tableDelimiterFiller"),A(T)):$(T)}function A(T){return T===45?(t.consume(T),A):T===58?(d=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(T),t.exit("tableDelimiterMarker"),F):(t.exit("tableDelimiterFiller"),F(T))}function F(T){return ut(T)?pt(t,B,"whitespace")(T):B(T)}function B(T){return T===124?S(T):T===null||qe(T)?!d||c!==u?$(T):(t.exit("tableDelimiterRow"),t.exit("tableHead"),l(T)):$(T)}function $(T){return r(T)}function _(T){return t.enter("tableRow"),V(T)}function V(T){return T===124?(t.enter("tableCellDivider"),t.consume(T),t.exit("tableCellDivider"),V):T===null||qe(T)?(t.exit("tableRow"),l(T)):ut(T)?pt(t,V,"whitespace")(T):(t.enter("data"),K(T))}function K(T){return T===null||T===124||Rt(T)?(t.exit("data"),V(T)):(t.consume(T),T===92?Y:K)}function Y(T){return T===92||T===124?(t.consume(T),K):K(T)}}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=oc(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=oc(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=oc(b,l,u,c,r,y)):d[1]!==0&&(y=oc(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 oc(t,l,r,i,c,u){const d=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",m="tableContent";r[0]!==0&&(u.end=Object.assign({},fi(l.events,r[0])),t.add(r[0],0,[["exit",u,l]]));const x=fi(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=fi(l.events,r[2]),g=fi(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({},fi(l.events,c)),t.add(c,0,[["exit",u,l]]),u=void 0),u}function i0(t,l,r,i,c){const u=[],d=fi(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 fi(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 Rt(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):ut(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 jh(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(bh,{remarkPlugins:[jh],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 Kf(t,"hair",l,1)}function Kf(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 Sh=new Map,Ch=new Map;function eg(t,l){Sh.set(t,l)}function Yc(t,l){Ch.set(t,l)}function Wf(t){return Sh.get(t)}function Dj(t){return Ch.get(t)}function jN(){return Array.from(Sh.keys())}function SN(){return Array.from(Ch.keys())}function Tj(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 Mc=new Map;function Xr(t,l,r){if("down"in r&&!("pixels"in r)){const c=r;Mc.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;Mc.set(t,{id:t,name:l,layer:{...c,name:"hair"}})}}function Mj(t){return Mc.get(t)}function ng(){return Array.from(Mc.values())}Xr("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}]}});Xr("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}]}});Xr("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}]}});Xr("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}]}});Xr("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"}]}});Xr("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}]}});Xr("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}]}});Xr("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 Fc=new Map;function Fl(t,l,r){if("down"in r&&!("pixels"in r)){const c=r;Fc.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;Fc.set(t,{id:t,name:l,layer:{...c,name:"torso"}})}}function Fj(t){return Fc.get(t)}function lg(){return Array.from(Fc.values())}Fl("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"}]}});Fl("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"}]}});Fl("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"}]}});Fl("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)"}]}});Fl("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)"}]}});Fl("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"}]}});Fl("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"}]}});Fl("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"}]}});Fl("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"}]}});Fl("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 kt(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())}kt("none","None",{name:"accessory",pixels:[]});kt("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}]}});kt("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}]}});kt("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}]}});kt("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}]}});kt("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}]}});kt("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}]}});kt("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}]}});kt("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}]}});kt("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}]}});kt("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}]}});kt("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}]}});kt("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"}]}});kt("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}]}});kt("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}]}});kt("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"}]}});kt("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}]}});kt("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}]}});kt("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}]}});kt("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}]}});kt("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"}]}});kt("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}]}});kt("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}]}});kt("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}]}});kt("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}]}});kt("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"}]}});kt("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"}]}});kt("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}]}});kt("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}]}});kt("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)}kt("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 jc(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,jc(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=jc(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)};jc(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=jc(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"}],Wj=[{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 Qj(){return{width:12,height:22,layers:[{name:"torso",pixels:Gj},{name:"head",pixels:Kj},{name:"hair",pixels:Wj},{name:"accessory",pixels:[]}]}}eg("mini-seated:default",Qj());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"}]};Yc("meeting",Zj);Yc("bulletin",Jj);Yc("decision",eS);Yc("knowledge",Pj);const pf=16,yf=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=Kf(r,"torso",i.layer,1))}if(l!=null&&l.accessory&&l.accessory!=="none"){const i=Rj(l.accessory);i&&(r=Kf(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=pf*x,g=yf*x,y=k.useMemo(()=>{const b=Wf(`mini:${t}`)??Wf("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,pf,yf),v.save(),v.translate(2,1),Tj(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:pf,height:yf,className:l,style:{imageRendering:"pixelated",display:"block",width:f,height:g}})}const lS="https://api.tycono.ai",Eh=lS;async function cc(t){const l=await fetch(`${Eh}${t}`);if(!l.ok)throw new Error(`Cloud API error: ${l.status}`);return l.json()}async function uc(t,l){const r=await fetch(`${Eh}${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 xi={health:()=>cc("/api/health"),getCharacters:()=>cc("/api/store/characters"),getCharacter:t=>cc(`/api/store/characters/${t}`),getCharacterVersion:t=>cc(`/api/store/characters/${t}/version`),syncCheck:t=>uc("/api/sync/check",{roles:t}),syncPull:t=>uc("/api/sync/pull",{sourceId:t}),publishCharacter:t=>uc("/api/store/publish",t),deleteCharacter:t=>fetch(`${Eh}/api/store/characters/${t}`,{method:"DELETE"}).then(l=>l.json()),uploadTelemetry:t=>uc("/api/telemetry",t)},rS={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"},gf={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:B}){var Fe,Ye;const[$,_]=k.useState(iS),[V,K]=k.useState(!1),Y=k.useRef(0),T=k.useRef(0),[U,O]=k.useState(!1),[Z,ne]=k.useState(!1),[W,I]=k.useState(!1),[P,re]=k.useState(!1),[ke,M]=k.useState("talk"),[z,G]=k.useState(!1),[D,ue]=k.useState(""),[Ee,ge]=k.useState(!1),Ae=k.useRef(null),{events:De,status:He}=K0(d??null),[ye,We]=k.useState(0);k.useEffect(()=>{if(!x||!f){We(0);return}const xe=new Date(f).getTime(),q=()=>We(Math.floor((Date.now()-xe)/1e3));q();const Te=setInterval(q,1e3);return()=>clearInterval(Te)},[x,f]);const fe=u>0,he=fe?u:0,be=fe?Math.max(d0,window.innerWidth-u-100):f0,Ce=Math.min($,be),ze=k.useCallback(xe=>{xe.preventDefault(),Y.current=xe.clientX,T.current=Ce,K(!0);const q=$e=>{const Ke=Y.current-$e.clientX,mt=Math.min(f0,Math.max(d0,T.current+Ke));_(mt)},Te=()=>{K(!1),document.removeEventListener("mousemove",q),document.removeEventListener("mouseup",Te)};document.addEventListener("mousemove",q),document.addEventListener("mouseup",Te)},[Ce]),_e=k.useRef(null),Me=t?y.find(xe=>xe.roleId===t.id):null,ve=xe=>{if(!t)return;const q=x?"talk":ke;Me?(S(Me.id,xe,q),j(t.id)):(_e.current={content:xe,mode:q},v(t.id))};k.useEffect(()=>{if(Me&&_e.current){const{content:xe,mode:q}=_e.current;_e.current=null,S(Me.id,xe,q),t&&j(t.id)}},[Me==null?void 0:Me.id]);const Oe=(()=>{if(!De.length)return null;const xe=[];let q=0,Te=0,$e=0;for(const Ke of De)if(Ke.type==="thinking")q++;else if(Ke.type==="text")Te++;else if(Ke.type==="tool:start"){const mt=String(Ke.data.name??"");xe.includes(mt)||xe.push(mt)}else Ke.type==="dispatch:start"&&$e++;return{tools:xe,thinkCount:q,textCount:Te,dispatchCount:$e,total:De.length}})(),Je=m||(()=>{if(!Me)return null;const xe=Me.messages;for(let q=xe.length-1;q>=0;q--)if(xe[q].from==="ceo")return xe[q].content;return null})(),jt=(()=>{if(!Me)return null;const xe=Me.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:Ce,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 $t=gf[t.id]??"#666",yt=rS[t.id]??"👤",Xt=l.filter(xe=>xe.reportsTo===t.id),ae=Me&&b===Me.id,me=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)] ${V?"resizing":""}`,style:{borderLeftColor:$t,right:he,width:Ce,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 ${V?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:ze}),s.jsxs("div",{className:"relative shrink-0 overflow-hidden",style:{background:`linear-gradient(135deg, ${$t}ee, ${$t}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:[yt," ",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"})]}),z?s.jsxs("form",{className:"flex items-center gap-1.5 mt-0.5",onSubmit:async xe=>{xe.preventDefault();const q=D.trim();if(!q||q===me||!C){G(!1);return}ge(!0);try{await C(t.id,{name:q})}catch{}ge(!1),G(!1)},children:[s.jsx("input",{ref:Ae,value:D,onChange:xe=>ue(xe.target.value),onKeyDown:xe=>{xe.key==="Escape"&&G(!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:()=>G(!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&&(ue(me),G(!0))},title:C?"Click to edit name":void 0,children:[me,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.",B??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",ye>0?` · ${sS(ye)}`:""]})]}),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"})]})]}),Je&&s.jsx("div",{className:"text-xs truncate",style:{color:"var(--terminal-text-secondary)"},children:Je})]}),x&&d&&Oe&&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:[Oe.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 ×",Oe.thinkCount]}),Oe.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)),Oe.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 ×",Oe.dispatchCount]}),Oe.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 ×",Oe.textCount]}),(He==="streaming"||He==="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:[Oe.total," events"]})]}),x&&jt&&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:[jt.slice(0,200),jt.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:ve,disabled:!!ae,placeholder:"Ask something...",color:$t})}),!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:yt,roleId:t.id,roleName:me,color:$t,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:[jt&&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:[jt.slice(0,150),jt.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:()=>M("talk"),className:"px-2 py-1 text-[10px] font-semibold cursor-pointer transition-colors",style:{background:ke==="talk"?"var(--accent)":"transparent",color:ke==="talk"?"#fff":"var(--terminal-text-secondary)"},children:"Talk"}),s.jsx("button",{onClick:()=>M("do"),className:"px-2 py-1 text-[10px] font-semibold cursor-pointer transition-colors",style:{background:ke==="do"?"var(--idle-amber)":"transparent",color:ke==="do"?"#fff":"var(--terminal-text-secondary)"},children:"Do"})]}),s.jsx(h0,{onSend:ve,disabled:!!ae,placeholder:ke==="talk"?"Ask something...":"Give a directive...",color:$t})]})})]})}),s.jsxs("div",{className:"px-4 py-2 space-y-1",children:[s.jsxs(dc,{title:`Profile${t.persona?"":" (empty)"}`,open:U,onToggle:()=>O(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(bf,{label:"Level",value:t.level}),s.jsx(bf,{label:"Reports to",value:t.reportsTo}),s.jsx(bf,{label:"Status",value:t.status})]}),Xt.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:Xt.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:gf[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(dc,{title:"Authority",open:Z,onToggle:()=>ne(xe=>!xe),children:[((Fe=t.authority.autonomous)==null?void 0:Fe.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,Te)=>Te.familiarity-q.familiarity);return xe.length===0?null:s.jsx(dc,{title:`Relationships (${xe.length})`,open:W,onToggle:()=>I(q=>!q),children:s.jsx("div",{className:"space-y-1.5",children:xe.map((q,Te)=>{const $e=q.roleA===t.id?q.roleB:q.roleA,Ke=l.find(It=>It.id===$e),mt=q.familiarity>=80?"Best Partner":q.familiarity>=50?"Friend":q.familiarity>=20?"Colleague":"Acquaintance",Qe=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:gf[$e]??"var(--terminal-text-secondary)"},children:(Ke==null?void 0:Ke.name)??$e}),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:Qe}})}),s.jsx("span",{className:"text-[10px] w-16 text-right",style:{color:"var(--terminal-text-muted)"},children:mt})]},Te)})})})})(),t.journal&&s.jsx(dc,{title:`Journal (${(t.journal.match(/### /g)??[]).length})`,open:P,onToggle:()=>re(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 Ne.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 xi.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 xi.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 dc({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 bf({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 zn(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 zn(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 zn(v[3],E,C,x,f),new zn(v[2],d,C,E,f),new zn(v[1],E,m,x,C),new zn(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),B=A*A+F*F;if(B<r){var $=Math.sqrt(r=B);c=t-$,u=l-$,g=t+$,y=l+$,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 zn(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 zn(c,f,g,m,x)),(c=i[2])&&l.push(new zn(c,u,g,f,x)),(c=i[1])&&l.push(new zn(c,f,d,m,g)),(c=i[0])&&l.push(new zn(c,u,d,f,g))}return this}function jS(t){var l=[],r=[],i;for(this._root&&l.push(new zn(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 zn(u,d,m,g,y)),(u=c[1])&&l.push(new zn(u,g,m,x,y)),(u=c[2])&&l.push(new zn(u,d,y,g,f)),(u=c[3])&&l.push(new zn(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 Nh(t,l,r){var i=new Ah(l??SS,r??ES,NaN,NaN,NaN,NaN);return t==null?i:i.addAll(t)}function Ah(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 Mn=Nh.prototype=Ah.prototype;Mn.copy=function(){var t=new Ah(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};Mn.add=fS;Mn.addAll=hS;Mn.cover=mS;Mn.data=xS;Mn.extent=pS;Mn.find=yS;Mn.remove=gS;Mn.removeAll=bS;Mn.root=vS;Mn.size=wS;Mn.visit=kS;Mn.visitAfter=jS;Mn.x=CS;Mn.y=NS;function va(t){return function(){return t}}function Ir(t){return(t()-.5)*1e-6}function AS(t){return t.x+t.vx}function DS(t){return t.y+t.vy}function TS(t){var l,r,i,c=1,u=1;typeof t!="function"&&(t=va(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=Nh(l,AS,DS).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,B,$,_,V){var K=F.data,Y=F.r,T=j+Y;if(K){if(K.index>b.index){var U=v-K.x-K.vx,O=S-K.y-K.vy,Z=U*U+O*O;Z<T*T&&(U===0&&(U=Ir(i),Z+=U*U),O===0&&(O=Ir(i),Z+=O*O),Z=(T-(Z=Math.sqrt(Z)))/Z*c,b.vx+=(U*=Z)*(T=(Y*=Y)/(E+Y)),b.vy+=(O*=Z)*T,K.vx-=U*(T=1-T),K.vy-=O*T)}return}return B>v+T||_<v-T||$>S+T||V<S-T}}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:va(+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=va(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,B,$,_,V,K,Y,T;F<A;++F)B=t[F],$=B.source,_=B.target,V=_.x+_.vx-$.x-$.vx||Ir(f),K=_.y+_.vy-$.y-$.vy||Ir(f),Y=Math.sqrt(V*V+K*K),Y=(Y-u[F])/Y*E*i[F],V*=Y,K*=Y,_.vx-=V*(T=x[F]),_.vy-=K*T,$.vx+=V*(T=1-T),$.vy+=K*T}function v(){if(d){var E,C=d.length,A=t.length,F=new Map(d.map(($,_)=>[l($,_,d),$])),B;for(E=0,m=new Array(C);E<A;++E)B=t[E],B.index=E,typeof B.source!="object"&&(B.source=x0(F,B.source)),typeof B.target!="object"&&(B.target=x0(F,B.target)),m[B.source.index]=(m[B.source.index]||0)+1,m[B.target.index]=(m[B.target.index]||0)+1;for(E=0,x=new Array(A);E<A;++E)B=t[E],x[E]=m[B.source.index]/(m[B.source.index]+m[B.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:va(+E),S(),b):r},b.distance=function(E){return arguments.length?(c=typeof E=="function"?E:va(+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 Sc(r)}function Sc(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}})}Sc.prototype=cg.prototype={constructor:Sc,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 Sc(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 yi=0,Cs=0,ws=0,ug=1e3,Rc,Es,_c=0,ka=0,qc=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 ka||(dg(OS),ka=Os.now()+qc)}function OS(){ka=0}function Zf(){this._call=this._time=this._next=null}Zf.prototype=hg.prototype={constructor:Zf,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:Rc=this,Es=this),this._call=t,this._time=r,Jf()},stop:function(){this._call&&(this._call=null,this._time=1/0,Jf())}};function hg(t,l,r){var i=new Zf;return i.restart(t,l,r),i}function BS(){fg(),++yi;for(var t=Rc,l;t;)(l=ka-t._time)>=0&&t._call.call(void 0,l),t=t._next;--yi}function y0(){ka=(_c=Os.now())+qc,yi=Cs=0;try{BS()}finally{yi=0,$S(),ka=0}}function LS(){var t=Os.now(),l=t-_c;l>ug&&(qc-=l,_c=t)}function $S(){for(var t,l=Rc,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:Rc=r);Es=t,Jf(i)}function Jf(t){if(!yi){Cs&&(Cs=clearTimeout(Cs));var l=t-ka;l>24?(t<1/0&&(Cs=setTimeout(y0,t-Os.now()-qc)),ws&&(ws=clearInterval(ws))):(ws||(_c=Os.now(),ws=setInterval(LS,ug)),yi=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(B){B(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,B,$,_,V,K;for(C==null?C=1/0:C*=C,A=0;A<F;++A)V=t[A],B=j-V.x,$=E-V.y,_=B*B+$*$,_<C&&(K=V,C=_);return K},on:function(j,E){return arguments.length>1?(f.on(j,E),l):f.on(j)}}}function KS(){var t,l,r,i,c=va(-30),u,d=1,m=1/0,x=.81;function f(v){var S,j=t.length,E=Nh(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,B;if(v.length){for(A=F=B=0;B<4;++B)(j=v[B])&&(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,B=C*C+A*A;if(F*F/x<B)return B<m&&(C===0&&(C=Ir(r),B+=C*C),A===0&&(A=Ir(r),B+=A*A),B<d&&(B=Math.sqrt(d*B)),l.vx+=C*v.value*i/B,l.vy+=A*v.value*i/B),!0;if(v.length||B>=m)return;(v.data!==l||v.next)&&(C===0&&(C=Ir(r),B+=C*C),A===0&&(A=Ir(r),B+=A*A),B<d&&(B=Math.sqrt(d*B)));do v.data!==l&&(F=u[v.data.index]*i/B,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:va(+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 WS(t){return Bs[t]??Bs.general}function QS({docs:t,onNodeClick:l,selectedDocId:r}){var U;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),B=k.useRef(null);k.useEffect(()=>{const O=i.current;if(!O)return;const Z=new ResizeObserver(ne=>{const{width:W,height:I}=ne[0].contentRect;W>0&&I>0&&(d({width:W,height:I}),E(P=>({...P,w:W,h:I})))});return Z.observe(O),()=>Z.disconnect()},[]),k.useEffect(()=>{if(t.length===0)return;const O=new Set(t.map(ge=>ge.id)),Z=t.map(ge=>({id:ge.id,title:ge.title,category:ge.category,akb_type:ge.akb_type})),ne=(ge,Ae)=>{if(!Ae.startsWith(".")&&!Ae.startsWith("/"))return Ae;const De=ge.split("/");De.pop();const He=Ae.split("/");for(const ye of He)ye===".."?De.pop():ye!=="."&&ye!==""&&De.push(ye);return De.join("/")},W=[];for(const ge of t)for(const Ae of ge.links){const De=ne(ge.id,Ae.href);O.has(De)&&De!==ge.id&&(W.some(He=>He.source===ge.id&&He.target===De||He.source===De&&He.target===ge.id)||W.push({source:ge.id,target:De,label:Ae.text}))}const{width:I,height:P}=u,re=Z.length,ke=re>100?-600:re>50?-500:-400,M=re>100?180:re>50?160:140,z=re>100?60:50,G=Math.max(I,re*12),D=Math.max(P,re*10),ue=GS(Z).force("link",MS(W).id(ge=>ge.id).distance(M)).force("charge",KS().strength(ke)).force("center",dS(G/2,D/2)).force("collide",TS(z));B.current=ue,ue.on("tick",()=>{x({nodes:[...Z],links:[...W]})}),ue.alpha(1).restart();const Ee=re>100?300:150;for(let ge=0;ge<Ee;ge++)ue.tick();if(ue.stop(),x({nodes:[...Z],links:[...W]}),Z.length>0){let ge=1/0,Ae=1/0,De=-1/0,He=-1/0;for(const We of Z){const fe=We.x??0,he=We.y??0;fe<ge&&(ge=fe),he<Ae&&(Ae=he),fe>De&&(De=fe),he>He&&(He=he)}const ye=100;E({x:ge-ye,y:Ae-ye,w:Math.max(I,De-ge+ye*2),h:Math.max(P,He-Ae+ye*2)})}return()=>{ue.stop()}},[t,u]);const $=O=>{if(typeof O=="string"){const Z=m.nodes.find(ne=>ne.id===O);return{x:(Z==null?void 0:Z.x)??0,y:(Z==null?void 0:Z.y)??0}}return{x:O.x??0,y:O.y??0}},_=k.useCallback(O=>{O.preventDefault();const Z=O.deltaY>0?1.1:.9;E(ne=>{const W=Math.max(200,Math.min(u.width*3,ne.w*Z)),I=Math.max(150,Math.min(u.height*3,ne.h*Z)),P=(W-ne.w)/2,re=(I-ne.h)/2;return{x:ne.x-P,y:ne.y-re,w:W,h:I}})},[u]),V=k.useCallback(O=>{O.button===0&&(C.current=!0,A.current={x:O.clientX,y:O.clientY,vx:j.x,vy:j.y})},[j]),K=k.useCallback(O=>{var Z;if(F.current){const ne=c.current;if(!ne)return;const W=ne.getBoundingClientRect(),I=j.w/W.width,P=j.h/W.height,re=j.x+(O.clientX-W.left)*I,ke=j.y+(O.clientY-W.top)*P;F.current.fx=re,F.current.fy=ke,(Z=B.current)==null||Z.alpha(.3).restart();return}if(C.current){const ne=(O.clientX-A.current.x)*(j.w/u.width),W=(O.clientY-A.current.y)*(j.h/u.height);E(I=>({...I,x:A.current.vx-ne,y:A.current.vy-W}))}},[j,u]),Y=k.useCallback(()=>{C.current=!1,F.current&&(F.current.fx=null,F.current.fy=null,F.current=null)},[]),T=k.useCallback((O,Z)=>{var ne;O.stopPropagation(),F.current=Z,(ne=B.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:_,onMouseDown:V,onMouseMove:K,onMouseUp:Y,onMouseLeave:Y,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((O,Z)=>{const ne=$(O.source),W=$(O.target),I=y===Z,P=(ne.x+W.x)/2,re=(ne.y+W.y)/2;return s.jsxs("g",{children:[s.jsx("line",{x1:ne.x,y1:ne.y,x2:W.x,y2:W.y,stroke:"transparent",strokeWidth:12,style:{cursor:"default"},onMouseEnter:()=>b(Z),onMouseLeave:()=>b(null)}),s.jsx("line",{x1:ne.x,y1:ne.y,x2:W.x,y2:W.y,stroke:I?"rgba(148,163,184,0.7)":"rgba(148,163,184,0.3)",strokeWidth:I?2:1.5,strokeDasharray:"4 3",pointerEvents:"none"}),I&&O.label&&s.jsx("text",{x:P,y:re-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:O.label.length>30?O.label.slice(0,28)+"..":O.label})})]},Z)}),m.nodes.map(O=>{const Z=Bs[O.category]??Bs.general,ne=O.akb_type==="hub",W=ne?24:16,I=(f==null?void 0:f.id)===O.id,P=r===O.id,re=I?1.2:P?1.15:1;return s.jsxs("g",{transform:`translate(${O.x??0}, ${O.y??0}) scale(${re})`,style:{cursor:"pointer",transition:"transform 0.15s ease"},onClick:ke=>{ke.stopPropagation();const M=t.find(z=>z.id===O.id);M&&l(M)},onMouseDown:ke=>T(ke,O),onMouseEnter:ke=>{var z;g(O);const M=(z=i.current)==null?void 0:z.getBoundingClientRect();M&&S({x:ke.clientX-M.left,y:ke.clientY-M.top})},onMouseLeave:()=>g(null),children:[P&&s.jsx("rect",{x:-W/2-4,y:-W/2-4,width:W+8,height:W+8,fill:"none",stroke:"#22c55e",strokeWidth:2,rx:ne?5:2,opacity:.6}),s.jsx("rect",{x:-W/2,y:-W/2,width:W,height:W,fill:Z.border,rx:ne?4:2,opacity:I?1:.9}),s.jsx("rect",{x:-W/2+3,y:-W/2+3,width:Math.max(0,W-6),height:Math.max(0,W-6),fill:Z.bg,rx:ne?3:1}),s.jsx("text",{y:W/2+14,textAnchor:"middle",fill:P?"#e2e8f0":"#94a3b8",fontSize:11,fontFamily:"monospace",fontWeight:P?"bold":"normal",style:{pointerEvents:"none"},children:O.title.length>24?O.title.slice(0,22)+"..":O.title})]},O.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]}),((U=t.find(O=>O.id===f.id))==null?void 0:U.tldr)&&s.jsx("div",{className:"text-[10px] opacity-80 mb-1",children:t.find(O=>O.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=WS(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($=>$.id)),C=k.useCallback($=>{const _=$.split("#")[0];if(!_.match(/\.(md|html)$/))return null;const V=t.includes("/")?t.replace(/\/[^/]+$/,""):"";let K;if(_.startsWith("./"))K=V?`${V}/${_.slice(2)}`:_.slice(2);else if(_.startsWith("../")){const U=V.split("/").filter(Boolean);let O=_;for(;O.startsWith("../");)U.length>0&&U.pop(),O=O.slice(3);K=U.length>0?`${U.join("/")}/${O}`:O}else K=_;if(E.has(K))return K;const Y=K.split("/").pop()??"",T=u.find(U=>U.id===Y||U.id.endsWith("/"+Y));return T?T.id:null},[t,E,u]),A=k.useCallback($=>{const V=$.target.closest("a");if(!V)return;const K=V.getAttribute("href");if(!K||K.startsWith("http://")||K.startsWith("https://")||!K.match(/\.(md|html)(#.*)?$/))return;$.preventDefault(),$.stopPropagation();const Y=C(K);Y&&c(Y)},[C,c]);k.useEffect(()=>{f(!0),Ne.getKnowledgeDoc(t).then($=>{m($),v($.content)}).catch(console.error).finally(()=>f(!1))},[t]);const F=async()=>{if(d){j(!0);try{await Ne.updateKnowledgeDoc(t,b),m({...d,content:b}),y(!1),r()}catch($){console.error("Save failed:",$)}finally{j(!1)}}},B=async()=>{if(confirm(`Delete "${d==null?void 0:d.title}"?`))try{await Ne.deleteKnowledgeDoc(t),i(t)}catch($){console.error("Delete failed:",$)}};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:B,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:$=>v($.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:$=>v($.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 Ne.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 Dh(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:B}=Dh(i),$=["all",...Array.from(new Set(t.map(U=>U.category))).sort()],_=t.filter(U=>{if(m!=="all"&&U.category!==m)return!1;if(y){const O=y.toLowerCase();return U.title.toLowerCase().includes(O)||(U.tldr??"").toLowerCase().includes(O)||U.tags.some(Z=>Z.toLowerCase().includes(O))}return!0}),V=U=>{S(!1),r(),g(U)},K=U=>{g(null),r()},Y=U=>{E(U.id)},T=j?t.find(U=>U.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:B}),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:U=>b(U.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:$.map(U=>s.jsx("button",{onClick:()=>x(U),className:"px-3 py-1.5 text-[10px] font-medium cursor-pointer whitespace-nowrap",style:{color:m===U?"#4ade80":"var(--terminal-text-muted)",borderBottom:m===U?"2px solid #4ade80":"2px solid transparent"},children:U==="all"?`All (${t.length})`:`${U} (${t.filter(O=>O.category===U).length})`},U))}),s.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:_.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"}):_.map(U=>s.jsx(ZS,{doc:U,allDocs:t,onOpen:O=>g(O.id),onNavigateDoc:O=>g(O)},U.id))})]}),u==="list"&&f&&!v&&s.jsx(JS,{docId:f,onBack:()=>g(null),onDocUpdated:r,onDelete:K,onNavigateDoc:U=>g(U),allDocs:t}),u==="list"&&v&&s.jsx(PS,{onCreated:V,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(QS,{docs:t,onNodeClick:Y,selectedDocId:j}),T&&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:T.title}),s.jsx("div",{className:"w-2 h-2 rounded-full mb-2",style:{background:T.status==="active"?"#16a34a":T.status==="draft"?"#f59e0b":"#94a3b8"}}),T.tldr&&s.jsx("div",{className:"text-[10px] mb-2 leading-relaxed",style:{color:"var(--terminal-text-secondary)"},children:T.tldr}),T.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"}),T.links.slice(0,5).map((U,O)=>s.jsxs("div",{className:"text-[9px] mb-0.5 truncate",style:{color:"var(--terminal-text-secondary)"},children:["🔗"," ",U.text]},O))]}),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(T.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(([U,O])=>s.jsxs("div",{className:"flex items-center gap-1 text-[9px]",children:[s.jsx("div",{className:"w-2 h-2",style:{background:O.border}}),s.jsx("span",{style:{color:"var(--terminal-text-muted)"},children:U})]},U))})})]})]})]})}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}=Dh(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(vf,{label:`Standups (${t.length})`,active:d==="standups",onClick:()=>m("standups")}),s.jsx(vf,{label:`Waves (${l.length})`,active:d==="waves",onClick:()=>m("waves")})]}):s.jsx(vf,{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(wf,{title:`Standup ${b.date}`,content:b.content},v)),d==="waves"&&l.map((b,v)=>s.jsx(wf,{title:`Wave ${b.id}`,subtitle:b.timestamp,content:b.content},v)),d==="decisions"&&r.map((b,v)=>s.jsx(wf,{title:`#${b.id} ${b.title}`,subtitle:b.date,content:b.content},v))]})]})]})}function vf({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 wf({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}=Dh(r);if(k.useEffect(()=>{Ne.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(bh,{remarkPlugins:[jh],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()),B=k.useRef(!1);k.useEffect(()=>{const U=setInterval(()=>{j(Math.floor((Date.now()-F.current)/1e3))},1e3);return()=>clearInterval(U)},[]),k.useEffect(()=>{A.current&&(A.current.scrollTop=A.current.scrollHeight)},[g]),k.useEffect(()=>{(y==="done"||y==="error")&&!B.current&&(B.current=!0,m==null||m())},[y,m]);const $=U=>{C(O=>{const Z=new Set(O);return Z.has(U)?Z.delete(U):Z.add(U),Z})},_={idle:"Waiting",connecting:"Connecting...",streaming:"Working",done:"Complete",error:"Error"}[y],V={idle:"#888",connecting:"#888",streaming:r,done:"#2E7D32",error:"#C62828"}[y],K=U=>`${Math.floor(U/60)}:${String(U%60).padStart(2,"0")}`,Y=y==="done"||y==="error",T=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:V}}),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:K(S)}),s.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full font-semibold",style:{background:`${V}22`,color:V},children:_}),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:"–"}),Y&&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(U=>s.jsx(mg,{event:U,isThinkingCollapsed:E.has(U.seq),onToggleThinking:()=>$(U.seq),onNavigateToJob:x,onOpenKnowledgeDoc:f},U.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`]}),Y&&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:Y?u:void 0}),T]}):T}const kf={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:kf[m.id]??"#888",color:kf[m.id]??"#888",background:`${kf[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(V=>{const K=new Map(V),Y=K.get(v);return Y&&K.set(v,{...Y,streamStatus:"error"}),K});return}c(V=>{const K=new Map(V),Y=K.get(v);return Y&&K.set(v,{...Y,streamStatus:"streaming",status:"running"}),K});const B=F.body.getReader(),$=new TextDecoder;let _="";for(;;){const{done:V,value:K}=await B.read();if(V)break;_+=$.decode(K,{stream:!0});const Y=_.split(`
|
|
81
|
-
`);_=Y.pop()??"";let T="";for(const U of Y)if(U.startsWith("event: "))T=U.slice(7).trim();else if(U.startsWith("data: ")){try{const O=JSON.parse(U.slice(6));if(T==="activity"){const Z=O;Z.seq>E.lastSeq&&(E.lastSeq=Z.seq),c(ne=>{const W=new Map(ne),I=W.get(v);if(!I||I.events.some(re=>re.seq===Z.seq))return ne;const P={...I,events:[...I.events,Z]};if(Z.type==="dispatch:start"&&Z.data.childJobId){const re=Z.data.childJobId,ke=Z.data.targetRoleId??Z.data.roleId;if(ke){const M=W.get(ke);M&&(W.set(ke,{...M,jobId:re,status:"running",streamStatus:"connecting"}),setTimeout(()=>f(re,ke),0))}}return Z.type==="job:done"?(P.status="done",P.streamStatus="done"):Z.type==="job:error"?(P.status="error",P.streamStatus="error"):Z.type==="job:awaiting_input"?(P.status="awaiting_input",P.streamStatus="done"):Z.type==="job:reply"&&(P.status="running",P.streamStatus="streaming"),W.set(v,P),W})}else if(T==="stream:end"){const Z=O.reason;Z!=="replied"&&c(ne=>{const W=new Map(ne),I=W.get(v);if(!I)return ne;const P=Z==="error"?"error":Z==="awaiting_input"?"awaiting_input":"done";return W.set(v,{...I,status:I.status==="running"?P:I.status,streamStatus:P==="error"?"error":"done"}),W})}}catch{}T=""}}}).catch(F=>{F.name!=="AbortError"&&c(B=>{const $=new Map(B),_=$.get(v);return _&&$.set(v,{..._,streamStatus:"error"}),$})})},[]);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"},ga=120,tr=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))*(ga+16),x=Math.max(m,280);for(const g of c){const y=g.length*(ga+16)-16,b=(x-y)/2;g.forEach((v,S)=>{const j=i.find(E=>E.roleId===v);j&&(j.x=b+S*(ga+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+ga/2,cy:g.y+tr/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:Math.max(u,280),height:d,className:"block",style:{minWidth:u},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+tr/2-4,x2:y.cx,y2:y.cy-tr/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:ga,height:tr,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:tr/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:tr/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:tr/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:ga-18,y:tr/2+4,fontSize:14,fill:"#2E7D32",children:"✓"}),g.status==="error"&&s.jsx("text",{x:ga-18,y:tr/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,onSave:x}){const{nodes:f,selectedRoleId:g,selectNode:y,progress:b,allDone:v,connectStream:S}=dC(l,r,i),[j,E]=k.useState(0),[C,A]=k.useState(new Set),[F,B]=k.useState(""),[$,_]=k.useState(!1),[V,K]=k.useState(!1),Y=k.useRef(null),T=k.useRef(Date.now()),U=k.useRef(!1),O=k.useCallback(async()=>{if(x){K(!0);try{const z=l.map(G=>G.jobId);await x(z)}catch(z){console.error("Save failed:",z)}finally{K(!1),c()}}},[x,l,c]),Z=k.useCallback(async()=>{if(!g||!F.trim())return;const z=f.get(g);if(!(!(z!=null&&z.jobId)||z.status!=="awaiting_input")){_(!0);try{const{jobId:G}=await Ne.replyToJob(z.jobId,F.trim());B(""),S(G,g)}catch(G){console.error("Reply failed:",G)}finally{_(!1)}}},[g,F,f,S]),ne=k.useCallback(async z=>{const G=f.get(z);if(G!=null&&G.jobId)try{await Ne.abortJob(G.jobId)}catch(D){console.error("Abort failed:",D)}},[f]),W=k.useCallback(async()=>{for(const[,z]of f)if((z.status==="running"||z.status==="awaiting_input")&&z.jobId)try{await Ne.abortJob(z.jobId)}catch{}},[f]);k.useEffect(()=>{const z=setInterval(()=>{E(Math.floor((Date.now()-T.current)/1e3))},1e3);return()=>clearInterval(z)},[]);const I=k.useRef(!1);k.useEffect(()=>{const z=Y.current;if(!z)return;const G=()=>{const D=z.scrollHeight-z.scrollTop-z.clientHeight<60;I.current=!D};return z.addEventListener("scroll",G),()=>z.removeEventListener("scroll",G)},[]),k.useEffect(()=>{I.current=!1,Y.current&&(Y.current.scrollTop=Y.current.scrollHeight)},[g]),k.useEffect(()=>{Y.current&&!I.current&&(Y.current.scrollTop=Y.current.scrollHeight)},[f]),k.useEffect(()=>{v&&!U.current&&(U.current=!0,d==null||d())},[v,d]);const P=z=>`${Math.floor(z/60)}:${String(z%60).padStart(2,"0")}`,re=g?f.get(g):null,ke=g?mC[g]??"#888":"#888",M=z=>{A(G=>{const D=new Set(G);return D.has(z)?D.delete(z):D.add(z),D})};return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm pointer-events-none"}),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:v?"#2E7D32":"#B71C1C",animation:v?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:v?"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:P(j)}),b.awaitingInput>0&&s.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full font-semibold",style:{background:"#F59E0B22",color:"#F59E0B"},children:[b.awaitingInput," awaiting reply"]}),s.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full font-semibold",style:{background:v?"#2E7D3222":"#B71C1C22",color:v?"#2E7D32":"#B71C1C"},children:[b.done,"/",b.total," done"]}),!v&&(b.running>0||b.awaitingInput>0)&&s.jsx("button",{onClick:W,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:"–"}),s.jsx("button",{onClick:c,className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-lg cursor-pointer",title:v?"Dismiss wave":"Close (jobs keep running)",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-col flex-1 min-h-0",children:[s.jsxs("div",{className:"shrink-0 border-b border-[var(--terminal-border)] flex flex-col",children:[s.jsxs("div",{className:"flex items-center gap-3 px-4 py-1.5",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 gap-x-3 ml-auto",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(z=>s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"w-2 h-2 rounded-full inline-block",style:{background:z.color,animation:z.dot?"wave-pulse 1.5s ease-in-out infinite":void 0}}),s.jsx("span",{className:"text-[8px] text-[var(--terminal-text-muted)]",children:z.label})]},z.label))})]}),s.jsx("div",{className:"overflow-x-auto overflow-y-auto px-3 pb-2",style:{maxHeight:"35vh"},children:s.jsx(hC,{nodes:f,rootId:i,selectedRoleId:g,onSelectNode:y})})]}),s.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[re&&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:ke}}),s.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-xs",children:re.roleId.toUpperCase()}),s.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs",children:re.roleName}),s.jsx("span",{className:"ml-auto text-[10px] px-2 py-0.5 rounded-full font-semibold",style:{background:re.status==="awaiting_input"?"#F59E0B22":`${ke}22`,color:re.status==="awaiting_input"?"#F59E0B":ke},children:re.status==="running"?"Working":re.status==="done"?"Complete":re.status==="error"?"Error":re.status==="waiting"?"Waiting":re.status==="awaiting_input"?"Awaiting Reply":"Not dispatched"}),(re.status==="running"||re.status==="awaiting_input")&&re.jobId&&s.jsx("button",{onClick:()=>ne(re.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:Y,className:"flex-1 overflow-y-auto p-4 space-y-1 text-xs font-mono select-text",children:[re&&re.events.length===0&&s.jsx("div",{className:"text-[var(--terminal-text-muted)]",children:re.status==="waiting"?"Waiting for dispatch...":re.status==="running"?"Connecting to activity stream...":re.status==="not-dispatched"?"This role was not dispatched in this wave.":""}),re==null?void 0:re.events.map(z=>s.jsx(mg,{event:z,isThinkingCollapsed:C.has(z.seq),onToggleThinking:()=>M(z.seq),onNavigateToJob:G=>{for(const[,D]of f)if(D.jobId===G){y(D.roleId);return}},onOpenKnowledgeDoc:m},z.seq)),(re==null?void 0:re.status)==="running"&&s.jsx("span",{className:"inline-block w-2 h-4 bg-green-400 animate-pulse ml-0.5"})]}),(re==null?void 0:re.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:[re.roleName," is waiting for your response"]})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{type:"text",value:F,onChange:z=>B(z.target.value),onKeyDown:z=>{z.key==="Enter"&&!z.shiftKey&&(z.preventDefault(),Z())},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:Z,disabled:$||!F.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"})]})]}),!re&&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:re&&re.events.length>0&&`${re.events.length} events`}),v&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:c,className:"px-4 py-1.5 text-xs rounded-lg font-semibold cursor-pointer",style:{background:"rgba(255,255,255,0.08)",color:"var(--terminal-text-muted)"},children:"Dismiss"}),x&&s.jsx("button",{onClick:O,disabled:V,className:"px-4 py-1.5 text-xs text-white rounded-lg font-semibold cursor-pointer disabled:opacity-50",style:{background:"#2E7D32"},children:V?"Saving...":"Save Wave"})]})]})]})]})]})]})}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"],Yr={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 jf({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 Sf({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 Lr(t){return t[Math.floor(Math.random()*t.length)]}function hi(t){var c,u,d;const l=ng(),r=lg(),i=rg().filter(m=>!t||ig(m.id,t));return{skinColor:Lr(xg),hairColor:Lr(pg),shirtColor:Lr(yg),pantsColor:Lr(gg),shoeColor:Lr(bg),hairStyle:(c=Lr(l))==null?void 0:c.id,outfitStyle:(u=Lr(r))==null?void 0:u.id,accessory:(d=Lr(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 B=Hj(A);r({...B,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(Sf,{label:"LOOK",active:m==="look",onClick:()=>x("look")}),s.jsx(Sf,{label:"OUTFIT",active:m==="outfit",onClick:()=>x("outfit")}),s.jsx(Sf,{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(jf,{label:"HAIR STYLE",items:b,value:l.hairStyle,onChange:E=>f("hairStyle",E)})]}),m==="outfit"&&s.jsxs(s.Fragment,{children:[s.jsx(jf,{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(jf,{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 Pf(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,24)}function Cf(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=Pf(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,B]=k.useState("ceo"),[$,_]=k.useState(1),[V,K]=k.useState(""),[Y,T]=k.useState(""),[U,O]=k.useState(!1),[Z,ne]=k.useState("member"),[W,I]=k.useState("ceo"),[P,re]=k.useState(""),[ke,M]=k.useState(hi),[z,G]=k.useState(!1),[D,ue]=k.useState(""),[Ee,ge]=k.useState([]),[Ae,De]=k.useState(new Set),[He,ye]=k.useState(""),[We,fe]=k.useState("input"),[he,be]=k.useState({done:0,total:0}),Ce=k.useRef(null),ze=k.useRef(null),_e=k.useRef(null);k.useEffect(()=>{Ne.getSkills().then(q=>ge(q.filter(Te=>Te.installed))).catch(()=>{})},[]),k.useEffect(()=>{var q,Te,$e;i==="single"?($===1&&((q=Ce.current)==null||q.focus()),$===2&&((Te=ze.current)==null||Te.focus())):We==="input"&&(($e=_e.current)==null||$e.focus())},[$,i,We]);const Me=k.useMemo(()=>new Set(t.map(q=>q.id)),[t]),ve=k.useMemo(()=>{const q=He.split(`
|
|
82
|
-
`),Te=new Set;return q.map($e=>bC($e,Me,Te)).filter($e=>$e!==null)},[He,Me]),Oe=ve.length>0&&ve.every(q=>!q.error),Je=q=>{K(q),U||T(Pf(q))},jt=V.trim().length>0&&Y.trim().length>0&&!t.some(q=>q.id===Y),$t=P.trim().length>0,yt=async()=>{G(!0),ue("");const q=Cf(Z);try{await r({id:Y,name:V.trim(),level:Z,reportsTo:W,persona:P.trim(),...q,skills:Ae.size>0?[...Ae]:void 0},ke),l()}catch(Te){ue(Te instanceof Error?Te.message:"Failed to create role"),G(!1)}},Xt=q=>q===1?jt:q===2?$t:!0,ae=async()=>{G(!0),ue(""),be({done:0,total:ve.length});try{for(let q=0;q<ve.length;q++){const Te=ve[q],$e=Cf(Te.level),Ke=hi(),mt=`${Te.name}. A ${Te.level} role reporting to ${Te.reportsTo}.`;await r({id:Te.id,name:Te.name,level:Te.level,reportsTo:Te.reportsTo,persona:mt,...$e},Ke),be({done:q+1,total:ve.length})}l()}catch(q){ue(q instanceof Error?q.message:"Failed to create roles"),G(!1)}},me=async()=>{g(!0),b("");try{const q=u.replace(/^tycono:/,"").trim();if(!q){b("Please enter a character ID"),g(!1);return}const Te=await xi.getCharacter(q);x(Te),E(Te.name||""),A(Pf(Te.name||q)),S("review")}catch{b("Character not found. Check the ID and try again.")}finally{g(!1)}},Fe=async()=>{if(!m)return;G(!0),ue("");const q=m,Te=q.level==="c-level"||q.level==="team-lead"?q.level:"member",$e=Cf(Te),Ke=q.skills!=null&&typeof q.skills=="object"&&!Array.isArray(q.skills)&&"primary"in q.skills;try{await r({id:C,name:j.trim(),level:Te,reportsTo:F,persona:q.persona||`${j}. Imported from Tycono Store.`,authority:q.authority||$e.authority,knowledge:$e.knowledge,reports:$e.reports,source:{id:`tycono/${q.id}`,sync:"manual",forked_at:"1.0.0",upstream_version:"1.0.0"},skillContent:Ke?q.skills:void 0},q.appearance?q.appearance:hi()),l()}catch(mt){ue(mt instanceof Error?mt.message:"Failed to hire"),G(!1)}},Ye=q=>{q.key==="Escape"&&l(),q.key==="Enter"&&(q.metaKey||q.ctrlKey)&&(i==="single"?$<js&&Xt($)?_($+1):$===js&&yt():i==="bulk"?We==="input"&&Oe?fe("review"):We==="review"&&ae():i==="store"&&(v==="input"&&u.trim()?me():v==="review"&&Fe()))},xe=t.some(q=>q.id===Y)&&Y.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"),ue("")},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"),ue("")},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"),ue("")},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 ${$} of ${js}`:i==="bulk"?We==="input"?"Enter roles, one per line":`Review ${ve.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,Te)=>Te+1).map(q=>s.jsx("div",{className:"flex-1 h-1 rounded-full transition-colors",style:{background:q<=$?"#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()&&me()},autoFocus:!0}),s.jsx("button",{onClick:me,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=>B(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 Ke,mt;const q=m.skills;if(q&&typeof q=="object"&&!Array.isArray(q)&&"primary"in q){const Qe=[];return(mt=(Ke=q.primary)==null?void 0:Ke.frontmatter)!=null&&mt.name&&Qe.push(q.primary.frontmatter.name),q.shared&&q.shared.forEach(It=>{var an;return Qe.push(((an=It.frontmatter)==null?void 0:an.name)||It.id)}),Qe.map(It=>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:It},It))}return(Array.isArray(q)?q:[]).map((Qe,It)=>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 Qe=="string"?Qe:Qe.name},It))})()})]})]}),D&&s.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 p-2 rounded-lg border border-red-800/30",children:D})]})]}):i==="single"?s.jsxs(s.Fragment,{children:[$===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:Ce,value:V,onChange:q=>Je(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:Y,onChange:q=>{T(q.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"")),O(!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 ${Z===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:W,onChange:q=>I(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))]})]})]}),$===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:ze,value:P,onChange:q=>re(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:Ae.has(q.id),onChange:()=>De(Te=>{const $e=new Set(Te);return $e.has(q.id)?$e.delete(q.id):$e.add(q.id),$e}),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))})]})]}),$===3&&s.jsx("div",{className:"customize-body",style:{padding:0},children:s.jsx(vg,{roleId:"default",appearance:ke,onChange:M,onRandomize:()=>M(hi()),onReset:()=>M(hi()),label:s.jsxs("span",{children:[Y||"new-role"," — ",V||"New Role"]})})}),$===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:ke,scale:4})}),s.jsxs("div",{className:"flex-1 space-y-2.5",children:[s.jsx(Ss,{label:"Name",value:V}),s.jsx(Ss,{label:"ID",value:Y,mono:!0}),s.jsx(Ss,{label:"Level",value:Z}),s.jsx(Ss,{label:"Reports To",value:W}),Ae.size>0&&s.jsx(Ss,{label:"Skills",value:[...Ae].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:P})]})]}),D&&s.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 p-2 rounded-lg border border-red-800/30",children:D})]})]}):s.jsxs(s.Fragment,{children:[We==="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:_e,value:He,onChange:q=>ye(q.target.value),placeholder:`Name, Level, ReportsTo
|
|
78
|
+
`))}function x(v,S,j,E){const C=j.enter("tableCell"),A=j.enter("phrasing"),R=j.containerPhrasing(v,{...E,before:u,after:u});return A(),C(),R}function f(v,S){return Q3(v,{align:S,alignDelimiters:i,padding:r,stringLength:c})}function g(v,S,j){const E=v.children;let C=-1;const A=[],R=S.enter("table");for(;++C<E.length;)A[C]=y(E[C],S,j);return R(),A}function y(v,S,j){const E=v.children;let C=-1;const A=[],R=S.enter("tableRow");for(;++C<E.length;)A[C]=x(E[C],v,S,j);return R(),A}function b(v,S,j){let E=Ky.inlineCode(v,S,j);return j.stack.includes("tableCell")&&(E=E.replace(/\|/g,"\\$&")),E}}function B4(){return{exit:{taskListCheckValueChecked:c0,taskListCheckValueUnchecked:c0,paragraph:L4}}}function $4(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:H4}}}function c0(t){const l=this.stack[this.stack.length-2];l.type,l.checked=t.type==="taskListCheckValueChecked"}function L4(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=Ky.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[b3(),H3(),q3(),T4(),B4()]}function I4(t){return{extensions:[v3(),U3(t),X3(),O4(t),$4()]}}const Y4={tokenize:W4,partial:!0},Wy={tokenize:Q4,partial:!0},Qy={tokenize:Z4,partial:!0},Zy={tokenize:J4,partial:!0},q4={tokenize:P4,partial:!0},Jy={name:"wwwAutolink",tokenize:G4,previous:eg},Py={name:"protocolAutolink",tokenize:K4,previous:tg},fr={name:"emailAutolink",tokenize:V4,previous:ng},Ll={};function X4(){return{text:Ll}}let Ea=48;for(;Ea<123;)Ll[Ea]=fr,Ea++,Ea===58?Ea=65:Ea===91&&(Ea=97);Ll[43]=fr;Ll[45]=fr;Ll[46]=fr;Ll[95]=fr;Ll[72]=[fr,Py];Ll[104]=[fr,Py];Ll[87]=[fr,Jy];Ll[119]=[fr,Jy];function V4(t,l,r){const i=this;let c,u;return d;function d(y){return!Jf(y)||!ng.call(i,i.previous)||Nh(i.events)?r(y):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),m(y))}function m(y){return Jf(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||Cn(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&&Fn(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||!eg.call(i,i.previous)||Nh(i.events)?r(d):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(Y4,t.attempt(Wy,t.attempt(Qy,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)&&tg.call(i,i.previous)&&!Nh(i.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),c+=String.fromCodePoint(y),t.consume(y),m):r(y)}function m(y){if(Fn(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||Fc(y)||Rt(y)||Fa(y)||Yc(y)?r(y):t.attempt(Wy,t.attempt(Qy,g),r)(y)}function g(y){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),l(y)}}function W4(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 Q4(t,l,r){let i,c,u;return d;function d(f){return f===46||f===95?t.check(Zy,x,m)(f):f===null||Rt(f)||Fa(f)||f!==45&&Yc(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(Zy,l,u)(d):d===null||Rt(d)||Fa(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||Rt(m)||Fa(m)?l(m):r(m)}function c(m){return m===null||m===40||m===91||Rt(m)||Fa(m)?l(m):i(m)}function u(m){return Fn(m)?d(m):r(m)}function d(m){return m===59?(t.consume(m),i):Fn(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 Cn(u)?r(u):l(u)}}function eg(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||Rt(t)}function tg(t){return!Fn(t)}function ng(t){return!(t===47||Jf(t))}function Jf(t){return t===43||t===45||t===46||t===95||Cn(t)}function Nh(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=Cl(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||Rt(y))return r(y);if(y===93){t.exit("chunkString");const b=t.exit("gfmFootnoteCallString");return c.includes(Cl(i.sliceSerialize(b)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(y),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),l):r(y)}return Rt(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||Rt(S))return r(S);if(S===93){t.exit("chunkString");const j=t.exit("gfmFootnoteDefinitionLabelString");return u=Cl(i.sliceSerialize(j)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(S),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),b}return Rt(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(Qs,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&&nl(b,b.length,0,qc(v,d.slice(f+1,x),m)),nl(b,b.length,0,[["exit",y,m],["enter",d[x][1],m],["exit",d[x][1],m],["exit",g,m]]),nl(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=Ei(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=Ei(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(T){let U=i.events.length-1;for(;U>-1;){const ne=i.events[U][1].type;if(ne==="lineEnding"||ne==="linePrefix")U--;else break}const O=U>-1?i.events[U][1].type:null,Z=O==="tableHead"||O==="tableRow"?_:x;return Z===_&&i.parser.lazy[i.now().line]?r(T):Z(T)}function x(T){return t.enter("tableHead"),t.enter("tableRow"),f(T)}function f(T){return T===124||(d=!0,u+=1),g(T)}function g(T){return T===null?r(T):Ke(T)?u>1?(u=0,i.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(T),t.exit("lineEnding"),v):r(T):ut(T)?pt(t,g,"whitespace")(T):(u+=1,d&&(d=!1,c+=1),T===124?(t.enter("tableCellDivider"),t.consume(T),t.exit("tableCellDivider"),d=!0,g):(t.enter("data"),y(T)))}function y(T){return T===null||T===124||Rt(T)?(t.exit("data"),g(T)):(t.consume(T),T===92?b:y)}function b(T){return T===92||T===124?(t.consume(T),y):y(T)}function v(T){return i.interrupt=!1,i.parser.lazy[i.now().line]?r(T):(t.enter("tableDelimiterRow"),d=!1,ut(T)?pt(t,S,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):S(T))}function S(T){return T===45||T===58?E(T):T===124?(d=!0,t.enter("tableCellDivider"),t.consume(T),t.exit("tableCellDivider"),j):L(T)}function j(T){return ut(T)?pt(t,E,"whitespace")(T):E(T)}function E(T){return T===58?(u+=1,d=!0,t.enter("tableDelimiterMarker"),t.consume(T),t.exit("tableDelimiterMarker"),C):T===45?(u+=1,C(T)):T===null||Ke(T)?B(T):L(T)}function C(T){return T===45?(t.enter("tableDelimiterFiller"),A(T)):L(T)}function A(T){return T===45?(t.consume(T),A):T===58?(d=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(T),t.exit("tableDelimiterMarker"),R):(t.exit("tableDelimiterFiller"),R(T))}function R(T){return ut(T)?pt(t,B,"whitespace")(T):B(T)}function B(T){return T===124?S(T):T===null||Ke(T)?!d||c!==u?L(T):(t.exit("tableDelimiterRow"),t.exit("tableHead"),l(T)):L(T)}function L(T){return r(T)}function _(T){return t.enter("tableRow"),V(T)}function V(T){return T===124?(t.enter("tableCellDivider"),t.consume(T),t.exit("tableCellDivider"),V):T===null||Ke(T)?(t.exit("tableRow"),l(T)):ut(T)?pt(t,V,"whitespace")(T):(t.enter("data"),K(T))}function K(T){return T===null||T===124||Rt(T)?(t.exit("data"),V(T)):(t.consume(T),T===92?Y:K)}function Y(T){return T===92||T===124?(t.consume(T),K):K(T)}}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&&(u0(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=hc(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=hc(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=hc(b,l,u,c,r,y)):d[1]!==0&&(y=hc(b,l,d,c,r,y)),c=0):c&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")&&(d[3]=r)}for(x!==0&&u0(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 hc(t,l,r,i,c,u){const d=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",m="tableContent";r[0]!==0&&(u.end=Object.assign({},ki(l.events,r[0])),t.add(r[0],0,[["exit",u,l]]));const x=ki(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=ki(l.events,r[2]),g=ki(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({},ki(l.events,c)),t.add(c,0,[["exit",u,l]]),u=void 0),u}function u0(t,l,r,i,c){const u=[],d=ki(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 ki(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 Rt(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 Ke(x)?l(x):ut(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 hy([X4(),tj(),cj(t),hj(),yj()])}const wj={};function Ah(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 Js({content:t,className:l=""}){return s.jsx("div",{className:`office-markdown ${l}`,children:s.jsx(Sh,{remarkPlugins:[Ah],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 d0={$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 lg(t,l){const r=d0[t];if(r&&l)return l[r];const i=Sj.exec(t);if(i){const[,c,u,d]=i,m=d0[u],x=m&&l?l[m]:u,f=parseInt(d,10);return c==="darken"?Cj(x,f):Ej(x,f)}return t}function f0(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:f0(t.left.pixels)}:l==="left"&&t.right?{name:t.right.name,pixels:f0(t.right.pixels)}:t.down}function Aj(t,l){return Pf(t,"hair",l,1)}function Pf(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 Dh=new Map,Th=new Map;function rg(t,l){Dh.set(t,l)}function Kc(t,l){Th.set(t,l)}function eh(t){return Dh.get(t)}function Dj(t){return Th.get(t)}function jN(){return Array.from(Dh.keys())}function SN(){return Array.from(Th.keys())}function Tj(t,l,r,i,c=2){t.clearRect(0,0,l.width*c,l.height*c);for(const u of l.layers)ag(t,u.pixels,c,r,i)}function th(t,l,r,i,c){for(const u of l){const d=lg(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),ag(t,l.pixels,r,0)}function ag(t,l,r,i,c){for(const u of l){const d=lg(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 Bc=new Map;function ra(t,l,r){if("down"in r&&!("pixels"in r)){const c=r;Bc.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;Bc.set(t,{id:t,name:l,layer:{...c,name:"hair"}})}}function Mj(t){return Bc.get(t)}function ig(){return Array.from(Bc.values())}ra("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}]}});ra("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}]}});ra("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}]}});ra("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}]}});ra("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"}]}});ra("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}]}});ra("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}]}});ra("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 $c=new Map;function Hl(t,l,r){if("down"in r&&!("pixels"in r)){const c=r;$c.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;$c.set(t,{id:t,name:l,layer:{...c,name:"torso"}})}}function Fj(t){return $c.get(t)}function sg(){return Array.from($c.values())}Hl("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"}]}});Hl("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"}]}});Hl("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"}]}});Hl("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)"}]}});Hl("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)"}]}});Hl("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"}]}});Hl("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"}]}});Hl("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"}]}});Hl("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"}]}});Hl("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 qs=new Map;function kt(t,l,r){if("down"in r&&!("pixels"in r)){const c=r;qs.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;qs.set(t,{id:t,name:l,layer:{...c,name:"accessory"}})}}function Rj(t){return qs.get(t)}function _j(t,l){const r=qs.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 og(){return Array.from(qs.values())}kt("none","None",{name:"accessory",pixels:[]});kt("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}]}});kt("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}]}});kt("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}]}});kt("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}]}});kt("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}]}});kt("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}]}});kt("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}]}});kt("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}]}});kt("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}]}});kt("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}]}});kt("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}]}});kt("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"}]}});kt("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}]}});kt("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}]}});kt("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"}]}});kt("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}]}});kt("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}]}});kt("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}]}});kt("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}]}});kt("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"}]}});kt("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}]}});kt("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}]}});kt("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}]}});kt("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}]}});kt("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"}]}});kt("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"}]}});kt("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}]}});kt("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}]}});kt("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 cg(t){return Oj[t]??1}function ug(t,l){return l>=cg(t)}kt("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 Ts({r:t,g:l,b:r}){return`#${(t<<16|l<<8|r).toString(16).padStart(6,"0")}`}function Ac(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,Ac(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 $j(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=Ac(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)};Ac(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=Ac(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 Lj(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 h0(t){return .299*t.r+.587*t.g+.114*t.b}function m0(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=Lj(t),i=$j(r,l);if(i.length<5)return{skinColor:"#F5CBA7",hairColor:"#2C1810",shirtColor:"#1565C0",pantsColor:"#37474F",shoeColor:"#212121"};const c=[...i].sort((y,b)=>h0(b)-h0(y)),u=[...i].sort((y,b)=>m0(b)-m0(y)),d=c[0],m=c[c.length-1],x=u[0],f=c[c.length-2],g=c[c.length-1];return{skinColor:Ts(d),hairColor:Ts(m),shirtColor:Ts(x),pantsColor:Ts(f),shoeColor:Ts(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)rg(`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"}],Wj=[{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 Qj(){return{width:12,height:22,layers:[{name:"torso",pixels:Gj},{name:"head",pixels:Kj},{name:"hair",pixels:Wj},{name:"accessory",pixels:[]}]}}rg("mini-seated:default",Qj());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"}]};Kc("meeting",Zj);Kc("bulletin",Jj);Kc("decision",eS);Kc("knowledge",Pj);const wf=16,kf=24,tS=60,nS={cbo:0,cto:8,pm:15,engineer:22,designer:5,qa:12};function dg(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=Pf(r,"torso",i.layer,1))}if(l!=null&&l.accessory&&l.accessory!=="none"){const i=Rj(l.accessory);i&&(r=Pf(r,"accessory",i.layer))}return r}function Xs({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=wf*x,g=kf*x,y=k.useMemo(()=>{const b=eh(`mini:${t}`)??eh("mini:default");return dg(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,wf,kf),v.save(),v.translate(2,1),Tj(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:wf,height:kf,className:l,style:{imageRendering:"pixelated",display:"block",width:f,height:g}})}const lS="https://api.tycono.ai",zh=lS;async function mc(t){const l=await fetch(`${zh}${t}`);if(!l.ok)throw new Error(`Cloud API error: ${l.status}`);return l.json()}async function xc(t,l){const r=await fetch(`${zh}${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 Ci={health:()=>mc("/api/health"),getCharacters:()=>mc("/api/store/characters"),getCharacter:t=>mc(`/api/store/characters/${t}`),getCharacterVersion:t=>mc(`/api/store/characters/${t}/version`),syncCheck:t=>xc("/api/sync/check",{roles:t}),syncPull:t=>xc("/api/sync/pull",{sourceId:t}),publishCharacter:t=>xc("/api/store/publish",t),deleteCharacter:t=>fetch(`${zh}/api/store/characters/${t}`,{method:"DELETE"}).then(l=>l.json()),uploadTelemetry:t=>xc("/api/telemetry",t)},rS={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"},jf={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,x0=360,p0=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:R,roleLevel:B}){var Fe,Ge;const[L,_]=k.useState(iS),[V,K]=k.useState(!1),Y=k.useRef(0),T=k.useRef(0),[U,O]=k.useState(!1),[Z,ne]=k.useState(!1),[W,I]=k.useState(!1),[P,ae]=k.useState(!1),[je,M]=k.useState("talk"),[z,G]=k.useState(!1),[D,ue]=k.useState(""),[Ee,ge]=k.useState(!1),Ae=k.useRef(null),{events:De,status:Ie}=J0(d??null),[pe,Pe]=k.useState(0);k.useEffect(()=>{if(!x||!f){Pe(0);return}const ye=new Date(f).getTime(),q=()=>Pe(Math.floor((Date.now()-ye)/1e3));q();const Te=setInterval(q,1e3);return()=>clearInterval(Te)},[x,f]);const fe=u>0,he=fe?u:0,be=fe?Math.max(x0,window.innerWidth-u-100):p0,Ce=Math.min(L,be),ze=k.useCallback(ye=>{ye.preventDefault(),Y.current=ye.clientX,T.current=Ce,K(!0);const q=He=>{const Je=Y.current-He.clientX,mt=Math.min(p0,Math.max(x0,T.current+Je));_(mt)},Te=()=>{K(!1),document.removeEventListener("mousemove",q),document.removeEventListener("mouseup",Te)};document.addEventListener("mousemove",q),document.addEventListener("mouseup",Te)},[Ce]),Oe=k.useRef(null),Me=t?y.find(ye=>ye.roleId===t.id):null,we=ye=>{if(!t)return;const q=x?"talk":je;Me?(S(Me.id,ye,q),j(t.id)):(Oe.current={content:ye,mode:q},v(t.id))};k.useEffect(()=>{if(Me&&Oe.current){const{content:ye,mode:q}=Oe.current;Oe.current=null,S(Me.id,ye,q),t&&j(t.id)}},[Me==null?void 0:Me.id]);const Be=(()=>{if(!De.length)return null;const ye=[];let q=0,Te=0,He=0;for(const Je of De)if(Je.type==="thinking")q++;else if(Je.type==="text")Te++;else if(Je.type==="tool:start"){const mt=String(Je.data.name??"");ye.includes(mt)||ye.push(mt)}else Je.type==="dispatch:start"&&He++;return{tools:ye,thinkCount:q,textCount:Te,dispatchCount:He,total:De.length}})(),tt=m||(()=>{if(!Me)return null;const ye=Me.messages;for(let q=ye.length-1;q>=0;q--)if(ye[q].from==="ceo")return ye[q].content;return null})(),jt=(()=>{if(!Me)return null;const ye=Me.messages;for(let q=ye.length-1;q>=0;q--)if(ye[q].from==="role"&&ye[q].content)return ye[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:Ce,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 Ut=jf[t.id]??"#666",yt=rS[t.id]??"👤",Vt=l.filter(ye=>ye.reportsTo===t.id),ie=Me&&b===Me.id,me=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)] ${V?"resizing":""}`,style:{borderLeftColor:Ut,right:he,width:Ce,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 ${V?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:ze}),s.jsxs("div",{className:"relative shrink-0 overflow-hidden",style:{background:`linear-gradient(135deg, ${Ut}ee, ${Ut}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(Xs,{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:[yt," ",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"})]}),z?s.jsxs("form",{className:"flex items-center gap-1.5 mt-0.5",onSubmit:async ye=>{ye.preventDefault();const q=D.trim();if(!q||q===me||!C){G(!1);return}ge(!0);try{await C(t.id,{name:q})}catch{}ge(!1),G(!1)},children:[s.jsx("input",{ref:Ae,value:D,onChange:ye=>ue(ye.target.value),onKeyDown:ye=>{ye.key==="Escape"&&G(!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:()=>G(!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&&(ue(me),G(!0))},title:C?"Click to edit name":void 0,children:[me,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.",B??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",pe>0?` · ${sS(pe)}`:""]})]}),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"})]})]}),tt&&s.jsx("div",{className:"text-xs truncate",style:{color:"var(--terminal-text-secondary)"},children:tt})]}),x&&d&&Be&&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:[Be.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 ×",Be.thinkCount]}),Be.tools.map(ye=>s.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(59,130,246,0.15)",color:"#60a5fa"},children:ye},ye)),Be.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 ×",Be.dispatchCount]}),Be.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 ×",Be.textCount]}),(Ie==="streaming"||Ie==="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:[Be.total," events"]})]}),x&&jt&&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:[jt.slice(0,200),jt.length>200&&"..."]})]}),x&&s.jsx("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:s.jsx(y0,{onSend:we,disabled:!!ie,placeholder:"Ask something...",color:Ut})}),!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:yt,roleId:t.id,roleName:me,color:Ut,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:[jt&&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:[jt.slice(0,150),jt.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:()=>M("talk"),className:"px-2 py-1 text-[10px] font-semibold cursor-pointer transition-colors",style:{background:je==="talk"?"var(--accent)":"transparent",color:je==="talk"?"#fff":"var(--terminal-text-secondary)"},children:"Talk"}),s.jsx("button",{onClick:()=>M("do"),className:"px-2 py-1 text-[10px] font-semibold cursor-pointer transition-colors",style:{background:je==="do"?"var(--idle-amber)":"transparent",color:je==="do"?"#fff":"var(--terminal-text-secondary)"},children:"Do"})]}),s.jsx(y0,{onSend:we,disabled:!!ie,placeholder:je==="talk"?"Ask something...":"Give a directive...",color:Ut})]})})]})}),s.jsxs("div",{className:"px-4 py-2 space-y-1",children:[s.jsxs(pc,{title:`Profile${t.persona?"":" (empty)"}`,open:U,onToggle:()=>O(ye=>!ye),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(Sf,{label:"Level",value:t.level}),s.jsx(Sf,{label:"Reports to",value:t.reportsTo}),s.jsx(Sf,{label:"Status",value:t.status})]}),Vt.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:Vt.map(ye=>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:jf[ye.id]??"#666"},children:ye.id.slice(0,2).toUpperCase()}),s.jsx("div",{className:"text-xs",style:{color:"var(--terminal-text)"},children:ye.name})]},ye.id))})]})]}),t.authority&&s.jsxs(pc,{title:"Authority",open:Z,onToggle:()=>ne(ye=>!ye),children:[((Fe=t.authority.autonomous)==null?void 0:Fe.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((ye,q)=>s.jsxs("div",{className:"text-xs pl-3 py-0.5",style:{color:"var(--terminal-text-secondary)"},children:["- ",ye]},q))]}),((Ge=t.authority.needsApproval)==null?void 0:Ge.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((ye,q)=>s.jsxs("div",{className:"text-xs pl-3 py-0.5",style:{color:"var(--terminal-text-secondary)"},children:["- ",ye]},q))]})]}),t&&R&&(()=>{const ye=R.filter(q=>q.roleA===t.id||q.roleB===t.id).filter(q=>q.familiarity>0).sort((q,Te)=>Te.familiarity-q.familiarity);return ye.length===0?null:s.jsx(pc,{title:`Relationships (${ye.length})`,open:W,onToggle:()=>I(q=>!q),children:s.jsx("div",{className:"space-y-1.5",children:ye.map((q,Te)=>{const He=q.roleA===t.id?q.roleB:q.roleA,Je=l.find(Yt=>Yt.id===He),mt=q.familiarity>=80?"Best Partner":q.familiarity>=50?"Friend":q.familiarity>=20?"Colleague":"Acquaintance",et=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:jf[He]??"var(--terminal-text-secondary)"},children:(Je==null?void 0:Je.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:et}})}),s.jsx("span",{className:"text-[10px] w-16 text-right",style:{color:"var(--terminal-text-muted)"},children:mt})]},Te)})})})})(),t.journal&&s.jsx(pc,{title:`Journal (${(t.journal.match(/### /g)??[]).length})`,open:P,onToggle:()=>ae(ye=>!ye),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(Js,{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 Ne.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 Ci.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 Ci.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(Js,{content:c})}):s.jsx("div",{className:"text-sm italic",style:{color:"var(--terminal-text-muted)"},children:"No recent activity."})]})]})})]})})}function pc({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 y0({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 Sf({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 fg(this.cover(l,r),l,r,t)}function fg(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)fg(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 Rn(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 Rn(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 Rn(v[3],E,C,x,f),new Rn(v[2],d,C,E,f),new Rn(v[1],E,m,x,C),new Rn(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),R=l-+this._y.call(null,v.data),B=A*A+R*R;if(B<r){var L=Math.sqrt(r=B);c=t-L,u=l-L,g=t+L,y=l+L,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 Rn(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 Rn(c,f,g,m,x)),(c=i[2])&&l.push(new Rn(c,u,g,f,x)),(c=i[1])&&l.push(new Rn(c,f,d,m,g)),(c=i[0])&&l.push(new Rn(c,u,d,f,g))}return this}function jS(t){var l=[],r=[],i;for(this._root&&l.push(new Rn(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 Rn(u,d,m,g,y)),(u=c[1])&&l.push(new Rn(u,g,m,x,y)),(u=c[2])&&l.push(new Rn(u,d,y,g,f)),(u=c[3])&&l.push(new Rn(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 Mh(t,l,r){var i=new Fh(l??SS,r??ES,NaN,NaN,NaN,NaN);return t==null?i:i.addAll(t)}function Fh(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 g0(t){for(var l={data:t.data},r=l;t=t.next;)r=r.next={data:t.data};return l}var _n=Mh.prototype=Fh.prototype;_n.copy=function(){var t=new Fh(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=g0(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]=g0(i));return t};_n.add=fS;_n.addAll=hS;_n.cover=mS;_n.data=xS;_n.extent=pS;_n.find=yS;_n.remove=gS;_n.removeAll=bS;_n.root=vS;_n.size=wS;_n.visit=kS;_n.visitAfter=jS;_n.x=CS;_n.y=NS;function Ma(t){return function(){return t}}function ta(t){return(t()-.5)*1e-6}function AS(t){return t.x+t.vx}function DS(t){return t.y+t.vy}function TS(t){var l,r,i,c=1,u=1;typeof t!="function"&&(t=Ma(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=Mh(l,AS,DS).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(R,B,L,_,V){var K=R.data,Y=R.r,T=j+Y;if(K){if(K.index>b.index){var U=v-K.x-K.vx,O=S-K.y-K.vy,Z=U*U+O*O;Z<T*T&&(U===0&&(U=ta(i),Z+=U*U),O===0&&(O=ta(i),Z+=O*O),Z=(T-(Z=Math.sqrt(Z)))/Z*c,b.vx+=(U*=Z)*(T=(Y*=Y)/(E+Y)),b.vy+=(O*=Z)*T,K.vx-=U*(T=1-T),K.vy-=O*T)}return}return B>v+T||_<v-T||L>S+T||V<S-T}}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:Ma(+f),x(),d):t},d}function zS(t){return t.index}function b0(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=Ma(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 R=0,B,L,_,V,K,Y,T;R<A;++R)B=t[R],L=B.source,_=B.target,V=_.x+_.vx-L.x-L.vx||ta(f),K=_.y+_.vy-L.y-L.vy||ta(f),Y=Math.sqrt(V*V+K*K),Y=(Y-u[R])/Y*E*i[R],V*=Y,K*=Y,_.vx-=V*(T=x[R]),_.vy-=K*T,L.vx+=V*(T=1-T),L.vy+=K*T}function v(){if(d){var E,C=d.length,A=t.length,R=new Map(d.map((L,_)=>[l(L,_,d),L])),B;for(E=0,m=new Array(C);E<A;++E)B=t[E],B.index=E,typeof B.source!="object"&&(B.source=b0(R,B.source)),typeof B.target!="object"&&(B.target=b0(R,B.target)),m[B.source.index]=(m[B.source.index]||0)+1,m[B.target.index]=(m[B.target.index]||0)+1;for(E=0,x=new Array(A);E<A;++E)B=t[E],x[E]=m[B.source.index]/(m[B.source.index]+m[B.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:Ma(+E),S(),b):r},b.distance=function(E){return arguments.length?(c=typeof E=="function"?E:Ma(+E),j(),b):c},b}var FS={value:()=>{}};function hg(){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 Dc(r)}function Dc(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}})}Dc.prototype=hg.prototype={constructor:Dc,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]=v0(r[c],t.name,l);else if(l==null)for(c in r)r[c]=v0(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 Dc(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 v0(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 Ni=0,_s=0,zs=0,mg=1e3,Lc,Os,Hc=0,Ra=0,Wc=0,Vs=typeof performance=="object"&&performance.now?performance:Date,xg=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function pg(){return Ra||(xg(OS),Ra=Vs.now()+Wc)}function OS(){Ra=0}function nh(){this._call=this._time=this._next=null}nh.prototype=yg.prototype={constructor:nh,restart:function(t,l,r){if(typeof t!="function")throw new TypeError("callback is not a function");r=(r==null?pg():+r)+(l==null?0:+l),!this._next&&Os!==this&&(Os?Os._next=this:Lc=this,Os=this),this._call=t,this._time=r,lh()},stop:function(){this._call&&(this._call=null,this._time=1/0,lh())}};function yg(t,l,r){var i=new nh;return i.restart(t,l,r),i}function BS(){pg(),++Ni;for(var t=Lc,l;t;)(l=Ra-t._time)>=0&&t._call.call(void 0,l),t=t._next;--Ni}function w0(){Ra=(Hc=Vs.now())+Wc,Ni=_s=0;try{BS()}finally{Ni=0,LS(),Ra=0}}function $S(){var t=Vs.now(),l=t-Hc;l>mg&&(Wc-=l,Hc=t)}function LS(){for(var t,l=Lc,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:Lc=r);Os=t,lh(i)}function lh(t){if(!Ni){_s&&(_s=clearTimeout(_s));var l=t-Ra;l>24?(t<1/0&&(_s=setTimeout(w0,t-Vs.now()-Wc)),zs&&(zs=clearInterval(zs))):(zs||(Hc=Vs.now(),zs=setInterval($S,mg)),Ni=1,xg(w0))}}const HS=1664525,US=1013904223,k0=4294967296;function IS(){let t=1;return()=>(t=(HS*t+US)%k0)/k0}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=yg(y),f=hg("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 R=0;R<j;++R)for(r+=(u-r)*c,m.forEach(function(B){B(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),R=j*VS;C.x=A*Math.cos(R),C.y=A*Math.sin(R)}(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,R=t.length,B,L,_,V,K;for(C==null?C=1/0:C*=C,A=0;A<R;++A)V=t[A],B=j-V.x,L=E-V.y,_=B*B+L*L,_<C&&(K=V,C=_);return K},on:function(j,E){return arguments.length>1?(f.on(j,E),l):f.on(j)}}}function KS(){var t,l,r,i,c=Ma(-30),u,d=1,m=1/0,x=.81;function f(v){var S,j=t.length,E=Mh(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,R,B;if(v.length){for(A=R=B=0;B<4;++B)(j=v[B])&&(E=Math.abs(j.value))&&(S+=j.value,C+=E,A+=E*j.x,R+=E*j.y);v.x=A/C,v.y=R/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,R=E-S,B=C*C+A*A;if(R*R/x<B)return B<m&&(C===0&&(C=ta(r),B+=C*C),A===0&&(A=ta(r),B+=A*A),B<d&&(B=Math.sqrt(d*B)),l.vx+=C*v.value*i/B,l.vy+=A*v.value*i/B),!0;if(v.length||B>=m)return;(v.data!==l||v.next)&&(C===0&&(C=ta(r),B+=C*C),A===0&&(A=ta(r),B+=A*A),B<d&&(B=Math.sqrt(d*B)));do v.data!==l&&(R=u[v.data.index]*i/B,l.vx+=C*R,l.vy+=A*R);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:Ma(+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 Gs={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 WS(t){return Gs[t]??Gs.general}function QS({docs:t,onNodeClick:l,selectedDocId:r}){var U;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}),R=k.useRef(null),B=k.useRef(null);k.useEffect(()=>{const O=i.current;if(!O)return;const Z=new ResizeObserver(ne=>{const{width:W,height:I}=ne[0].contentRect;W>0&&I>0&&(d({width:W,height:I}),E(P=>({...P,w:W,h:I})))});return Z.observe(O),()=>Z.disconnect()},[]),k.useEffect(()=>{if(t.length===0)return;const O=new Set(t.map(ge=>ge.id)),Z=t.map(ge=>({id:ge.id,title:ge.title,category:ge.category,akb_type:ge.akb_type})),ne=(ge,Ae)=>{if(!Ae.startsWith(".")&&!Ae.startsWith("/"))return Ae;const De=ge.split("/");De.pop();const Ie=Ae.split("/");for(const pe of Ie)pe===".."?De.pop():pe!=="."&&pe!==""&&De.push(pe);return De.join("/")},W=[];for(const ge of t)for(const Ae of ge.links){const De=ne(ge.id,Ae.href);O.has(De)&&De!==ge.id&&(W.some(Ie=>Ie.source===ge.id&&Ie.target===De||Ie.source===De&&Ie.target===ge.id)||W.push({source:ge.id,target:De,label:Ae.text}))}const{width:I,height:P}=u,ae=Z.length,je=ae>100?-600:ae>50?-500:-400,M=ae>100?180:ae>50?160:140,z=ae>100?60:50,G=Math.max(I,ae*12),D=Math.max(P,ae*10),ue=GS(Z).force("link",MS(W).id(ge=>ge.id).distance(M)).force("charge",KS().strength(je)).force("center",dS(G/2,D/2)).force("collide",TS(z));B.current=ue,ue.on("tick",()=>{x({nodes:[...Z],links:[...W]})}),ue.alpha(1).restart();const Ee=ae>100?300:150;for(let ge=0;ge<Ee;ge++)ue.tick();if(ue.stop(),x({nodes:[...Z],links:[...W]}),Z.length>0){let ge=1/0,Ae=1/0,De=-1/0,Ie=-1/0;for(const Pe of Z){const fe=Pe.x??0,he=Pe.y??0;fe<ge&&(ge=fe),he<Ae&&(Ae=he),fe>De&&(De=fe),he>Ie&&(Ie=he)}const pe=100;E({x:ge-pe,y:Ae-pe,w:Math.max(I,De-ge+pe*2),h:Math.max(P,Ie-Ae+pe*2)})}return()=>{ue.stop()}},[t,u]);const L=O=>{if(typeof O=="string"){const Z=m.nodes.find(ne=>ne.id===O);return{x:(Z==null?void 0:Z.x)??0,y:(Z==null?void 0:Z.y)??0}}return{x:O.x??0,y:O.y??0}},_=k.useCallback(O=>{O.preventDefault();const Z=O.deltaY>0?1.1:.9;E(ne=>{const W=Math.max(200,Math.min(u.width*3,ne.w*Z)),I=Math.max(150,Math.min(u.height*3,ne.h*Z)),P=(W-ne.w)/2,ae=(I-ne.h)/2;return{x:ne.x-P,y:ne.y-ae,w:W,h:I}})},[u]),V=k.useCallback(O=>{O.button===0&&(C.current=!0,A.current={x:O.clientX,y:O.clientY,vx:j.x,vy:j.y})},[j]),K=k.useCallback(O=>{var Z;if(R.current){const ne=c.current;if(!ne)return;const W=ne.getBoundingClientRect(),I=j.w/W.width,P=j.h/W.height,ae=j.x+(O.clientX-W.left)*I,je=j.y+(O.clientY-W.top)*P;R.current.fx=ae,R.current.fy=je,(Z=B.current)==null||Z.alpha(.3).restart();return}if(C.current){const ne=(O.clientX-A.current.x)*(j.w/u.width),W=(O.clientY-A.current.y)*(j.h/u.height);E(I=>({...I,x:A.current.vx-ne,y:A.current.vy-W}))}},[j,u]),Y=k.useCallback(()=>{C.current=!1,R.current&&(R.current.fx=null,R.current.fy=null,R.current=null)},[]),T=k.useCallback((O,Z)=>{var ne;O.stopPropagation(),R.current=Z,(ne=B.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:_,onMouseDown:V,onMouseMove:K,onMouseUp:Y,onMouseLeave:Y,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((O,Z)=>{const ne=L(O.source),W=L(O.target),I=y===Z,P=(ne.x+W.x)/2,ae=(ne.y+W.y)/2;return s.jsxs("g",{children:[s.jsx("line",{x1:ne.x,y1:ne.y,x2:W.x,y2:W.y,stroke:"transparent",strokeWidth:12,style:{cursor:"default"},onMouseEnter:()=>b(Z),onMouseLeave:()=>b(null)}),s.jsx("line",{x1:ne.x,y1:ne.y,x2:W.x,y2:W.y,stroke:I?"rgba(148,163,184,0.7)":"rgba(148,163,184,0.3)",strokeWidth:I?2:1.5,strokeDasharray:"4 3",pointerEvents:"none"}),I&&O.label&&s.jsx("text",{x:P,y:ae-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:O.label.length>30?O.label.slice(0,28)+"..":O.label})})]},Z)}),m.nodes.map(O=>{const Z=Gs[O.category]??Gs.general,ne=O.akb_type==="hub",W=ne?24:16,I=(f==null?void 0:f.id)===O.id,P=r===O.id,ae=I?1.2:P?1.15:1;return s.jsxs("g",{transform:`translate(${O.x??0}, ${O.y??0}) scale(${ae})`,style:{cursor:"pointer",transition:"transform 0.15s ease"},onClick:je=>{je.stopPropagation();const M=t.find(z=>z.id===O.id);M&&l(M)},onMouseDown:je=>T(je,O),onMouseEnter:je=>{var z;g(O);const M=(z=i.current)==null?void 0:z.getBoundingClientRect();M&&S({x:je.clientX-M.left,y:je.clientY-M.top})},onMouseLeave:()=>g(null),children:[P&&s.jsx("rect",{x:-W/2-4,y:-W/2-4,width:W+8,height:W+8,fill:"none",stroke:"#22c55e",strokeWidth:2,rx:ne?5:2,opacity:.6}),s.jsx("rect",{x:-W/2,y:-W/2,width:W,height:W,fill:Z.border,rx:ne?4:2,opacity:I?1:.9}),s.jsx("rect",{x:-W/2+3,y:-W/2+3,width:Math.max(0,W-6),height:Math.max(0,W-6),fill:Z.bg,rx:ne?3:1}),s.jsx("text",{y:W/2+14,textAnchor:"middle",fill:P?"#e2e8f0":"#94a3b8",fontSize:11,fontFamily:"monospace",fontWeight:P?"bold":"normal",style:{pointerEvents:"none"},children:O.title.length>24?O.title.slice(0,22)+"..":O.title})]},O.id)})]}),f&&!R.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]}),((U=t.find(O=>O.id===f.id))==null?void 0:U.tldr)&&s.jsx("div",{className:"text-[10px] opacity-80 mb-1",children:t.find(O=>O.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=WS(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(L=>L.id)),C=k.useCallback(L=>{const _=L.split("#")[0];if(!_.match(/\.(md|html)$/))return null;const V=t.includes("/")?t.replace(/\/[^/]+$/,""):"";let K;if(_.startsWith("./"))K=V?`${V}/${_.slice(2)}`:_.slice(2);else if(_.startsWith("../")){const U=V.split("/").filter(Boolean);let O=_;for(;O.startsWith("../");)U.length>0&&U.pop(),O=O.slice(3);K=U.length>0?`${U.join("/")}/${O}`:O}else K=_;if(E.has(K))return K;const Y=K.split("/").pop()??"",T=u.find(U=>U.id===Y||U.id.endsWith("/"+Y));return T?T.id:null},[t,E,u]),A=k.useCallback(L=>{const V=L.target.closest("a");if(!V)return;const K=V.getAttribute("href");if(!K||K.startsWith("http://")||K.startsWith("https://")||!K.match(/\.(md|html)(#.*)?$/))return;L.preventDefault(),L.stopPropagation();const Y=C(K);Y&&c(Y)},[C,c]);k.useEffect(()=>{f(!0),Ne.getKnowledgeDoc(t).then(L=>{m(L),v(L.content)}).catch(console.error).finally(()=>f(!1))},[t]);const R=async()=>{if(d){j(!0);try{await Ne.updateKnowledgeDoc(t,b),m({...d,content:b}),y(!1),r()}catch(L){console.error("Save failed:",L)}finally{j(!1)}}},B=async()=>{if(confirm(`Delete "${d==null?void 0:d.title}"?`))try{await Ne.deleteKnowledgeDoc(t),i(t)}catch(L){console.error("Delete failed:",L)}};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:R,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:B,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:L=>v(L.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:L=>v(L.target.value),spellCheck:!1}):s.jsx("div",{className:"text-xs leading-relaxed",style:{color:"var(--terminal-text-secondary)"},onClick:A,children:s.jsx(Js,{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 Ne.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,j0=360,S0=700;function Rh(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(j0,window.innerWidth-t-100):S0,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(S0,Math.max(j0,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:R,handleResizeStart:B}=Rh(i),L=["all",...Array.from(new Set(t.map(U=>U.category))).sort()],_=t.filter(U=>{if(m!=="all"&&U.category!==m)return!1;if(y){const O=y.toLowerCase();return U.title.toLowerCase().includes(O)||(U.tldr??"").toLowerCase().includes(O)||U.tags.some(Z=>Z.toLowerCase().includes(O))}return!0}),V=U=>{S(!1),r(),g(U)},K=U=>{g(null),r()},Y=U=>{E(U.id)},T=j?t.find(U=>U.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)] ${R?"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 ${R?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:B}),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(C0,{label:"List",active:u==="list",onClick:()=>{d("list"),E(null)}}),s.jsx(C0,{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:U=>b(U.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:L.map(U=>s.jsx("button",{onClick:()=>x(U),className:"px-3 py-1.5 text-[10px] font-medium cursor-pointer whitespace-nowrap",style:{color:m===U?"#4ade80":"var(--terminal-text-muted)",borderBottom:m===U?"2px solid #4ade80":"2px solid transparent"},children:U==="all"?`All (${t.length})`:`${U} (${t.filter(O=>O.category===U).length})`},U))}),s.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:_.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"}):_.map(U=>s.jsx(ZS,{doc:U,allDocs:t,onOpen:O=>g(O.id),onNavigateDoc:O=>g(O)},U.id))})]}),u==="list"&&f&&!v&&s.jsx(JS,{docId:f,onBack:()=>g(null),onDocUpdated:r,onDelete:K,onNavigateDoc:U=>g(U),allDocs:t}),u==="list"&&v&&s.jsx(PS,{onCreated:V,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(QS,{docs:t,onNodeClick:Y,selectedDocId:j}),T&&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:T.title}),s.jsx("div",{className:"w-2 h-2 rounded-full mb-2",style:{background:T.status==="active"?"#16a34a":T.status==="draft"?"#f59e0b":"#94a3b8"}}),T.tldr&&s.jsx("div",{className:"text-[10px] mb-2 leading-relaxed",style:{color:"var(--terminal-text-secondary)"},children:T.tldr}),T.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"}),T.links.slice(0,5).map((U,O)=>s.jsxs("div",{className:"text-[9px] mb-0.5 truncate",style:{color:"var(--terminal-text-secondary)"},children:["🔗"," ",U.text]},O))]}),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(T.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(Gs).map(([U,O])=>s.jsxs("div",{className:"flex items-center gap-1 text-[9px]",children:[s.jsx("div",{className:"w-2 h-2",style:{background:O.border}}),s.jsx("span",{style:{color:"var(--terminal-text-muted)"},children:U})]},U))})})]})]})]})}function C0({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}=Rh(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(Cf,{label:`Standups (${t.length})`,active:d==="standups",onClick:()=>m("standups")}),s.jsx(Cf,{label:`Waves (${l.length})`,active:d==="waves",onClick:()=>m("waves")})]}):s.jsx(Cf,{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(Ef,{title:`Standup ${b.date}`,content:b.content},v)),d==="waves"&&l.map((b,v)=>s.jsx(Ef,{title:`Wave ${b.id}`,subtitle:b.timestamp,content:b.content},v)),d==="decisions"&&r.map((b,v)=>s.jsx(Ef,{title:`#${b.id} ${b.title}`,subtitle:b.date,content:b.content},v))]})]})]})}function Cf({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 Ef({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(Js,{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}=Rh(r);if(k.useEffect(()=>{Ne.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(Js,{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 E0={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"};function gg({event:t,isThinkingCollapsed:l,onToggleThinking:r,onNavigateToJob:i,onOpenKnowledgeDoc:c,compact:u}){var m;const d=E0[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(Sh,{remarkPlugins:[Ah],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=E0[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}=J0(t),[S,j]=k.useState(0),[E,C]=k.useState(new Set),A=k.useRef(null),R=k.useRef(Date.now()),B=k.useRef(!1);k.useEffect(()=>{const U=setInterval(()=>{j(Math.floor((Date.now()-R.current)/1e3))},1e3);return()=>clearInterval(U)},[]),k.useEffect(()=>{A.current&&(A.current.scrollTop=A.current.scrollHeight)},[g]),k.useEffect(()=>{(y==="done"||y==="error")&&!B.current&&(B.current=!0,m==null||m())},[y,m]);const L=U=>{C(O=>{const Z=new Set(O);return Z.has(U)?Z.delete(U):Z.add(U),Z})},_={idle:"Waiting",connecting:"Connecting...",streaming:"Working",done:"Complete",error:"Error"}[y],V={idle:"#888",connecting:"#888",streaming:r,done:"#2E7D32",error:"#C62828"}[y],K=U=>`${Math.floor(U/60)}:${String(U%60).padStart(2,"0")}`,Y=y==="done"||y==="error",T=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:V}}),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:K(S)}),s.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full font-semibold",style:{background:`${V}22`,color:V},children:_}),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:"–"}),Y&&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(U=>s.jsx(gg,{event:U,isThinkingCollapsed:E.has(U.seq),onToggleThinking:()=>L(U.seq),onNavigateToJob:x,onOpenKnowledgeDoc:f},U.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`]}),Y&&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:Y?u:void 0}),T]}):T}const Nf={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:Nf[m.id]??"#888",color:Nf[m.id]??"#888",background:`${Nf[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 R=>{if(!R.ok||!R.body){c(V=>{const K=new Map(V),Y=K.get(v);return Y&&K.set(v,{...Y,streamStatus:"error"}),K});return}c(V=>{const K=new Map(V),Y=K.get(v);return Y&&K.set(v,{...Y,streamStatus:"streaming",status:"running"}),K});const B=R.body.getReader(),L=new TextDecoder;let _="";for(;;){const{done:V,value:K}=await B.read();if(V)break;_+=L.decode(K,{stream:!0});const Y=_.split(`
|
|
81
|
+
`);_=Y.pop()??"";let T="";for(const U of Y)if(U.startsWith("event: "))T=U.slice(7).trim();else if(U.startsWith("data: ")){try{const O=JSON.parse(U.slice(6));if(T==="activity"){const Z=O;Z.seq>E.lastSeq&&(E.lastSeq=Z.seq),c(ne=>{const W=new Map(ne),I=W.get(v);if(!I||I.events.some(ae=>ae.seq===Z.seq))return ne;const P={...I,events:[...I.events,Z]};if(Z.type==="dispatch:start"&&Z.data.childJobId){const ae=Z.data.childJobId,je=Z.data.targetRoleId??Z.data.roleId;if(je){const M=W.get(je);M&&(W.set(je,{...M,jobId:ae,status:"running",streamStatus:"connecting"}),setTimeout(()=>f(ae,je),0))}}return Z.type==="job:done"?(P.status="done",P.streamStatus="done"):Z.type==="job:error"?(P.status="error",P.streamStatus="error"):Z.type==="job:awaiting_input"?(P.status="awaiting_input",P.streamStatus="done"):Z.type==="job:reply"&&(P.status="running",P.streamStatus="streaming"),W.set(v,P),W})}else if(T==="stream:end"){const Z=O.reason;Z!=="replied"&&c(ne=>{const W=new Map(ne),I=W.get(v);if(!I)return ne;const P=Z==="error"?"error":Z==="awaiting_input"?"awaiting_input":"done";return W.set(v,{...I,status:I.status==="running"?P:I.status,streamStatus:P==="error"?"error":"done"}),W})}}catch{}T=""}}}).catch(R=>{R.name!=="AbortError"&&c(B=>{const L=new Map(B),_=L.get(v);return _&&L.set(v,{..._,streamStatus:"error"}),L})})},[]);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 N0={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},Ta=120,cr=44,A0=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*A0+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))*(Ta+16),x=Math.max(m,280);for(const g of c){const y=g.length*(Ta+16)-16,b=(x-y)/2;g.forEach((v,S)=>{const j=i.find(E=>E.roleId===v);j&&(j.x=b+S*(Ta+16))})}const f=c.length*A0+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+Ta/2,cy:g.y+cr/2}:{cx:0,cy:0}},x=f=>{switch(f.status){case"running":return N0[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:Math.max(u,280),height:d,className:"block",style:{minWidth:u},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=N0[f.roleId]??"#FBBF24",j="6 4",E="wave-edge-flow"),s.jsx("line",{x1:g.cx,y1:g.cy+cr/2-4,x2:y.cx,y2:y.cy-cr/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:Ta,height:cr,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:cr/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:cr/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:cr/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:Ta-18,y:cr/2+4,fontSize:14,fill:"#2E7D32",children:"✓"}),g.status==="error"&&s.jsx("text",{x:Ta-18,y:cr/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,onSave:x}){const{nodes:f,selectedRoleId:g,selectNode:y,progress:b,allDone:v,connectStream:S}=dC(l,r,i),[j,E]=k.useState(0),[C,A]=k.useState(new Set),[R,B]=k.useState(""),[L,_]=k.useState(!1),[V,K]=k.useState(!1),Y=k.useRef(null),T=k.useRef(Date.now()),U=k.useRef(!1),O=k.useCallback(async()=>{if(x){K(!0);try{const z=l.map(G=>G.jobId);await x(z)}catch(z){console.error("Save failed:",z)}finally{K(!1),c()}}},[x,l,c]),Z=k.useCallback(async()=>{if(!g||!R.trim())return;const z=f.get(g);if(!(!(z!=null&&z.jobId)||z.status!=="awaiting_input")){_(!0);try{const{jobId:G}=await Ne.replyToJob(z.jobId,R.trim());B(""),S(G,g)}catch(G){console.error("Reply failed:",G)}finally{_(!1)}}},[g,R,f,S]),ne=k.useCallback(async z=>{const G=f.get(z);if(G!=null&&G.jobId)try{await Ne.abortJob(G.jobId)}catch(D){console.error("Abort failed:",D)}},[f]),W=k.useCallback(async()=>{for(const[,z]of f)if((z.status==="running"||z.status==="awaiting_input")&&z.jobId)try{await Ne.abortJob(z.jobId)}catch{}},[f]);k.useEffect(()=>{const z=setInterval(()=>{E(Math.floor((Date.now()-T.current)/1e3))},1e3);return()=>clearInterval(z)},[]);const I=k.useRef(!1);k.useEffect(()=>{const z=Y.current;if(!z)return;const G=()=>{const D=z.scrollHeight-z.scrollTop-z.clientHeight<60;I.current=!D};return z.addEventListener("scroll",G),()=>z.removeEventListener("scroll",G)},[]),k.useEffect(()=>{I.current=!1,Y.current&&(Y.current.scrollTop=Y.current.scrollHeight)},[g]),k.useEffect(()=>{Y.current&&!I.current&&(Y.current.scrollTop=Y.current.scrollHeight)},[f]),k.useEffect(()=>{v&&!U.current&&(U.current=!0,d==null||d())},[v,d]);const P=z=>`${Math.floor(z/60)}:${String(z%60).padStart(2,"0")}`,ae=g?f.get(g):null,je=g?mC[g]??"#888":"#888",M=z=>{A(G=>{const D=new Set(G);return D.has(z)?D.delete(z):D.add(z),D})};return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm pointer-events-none"}),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:v?"#2E7D32":"#B71C1C",animation:v?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:v?"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:P(j)}),b.awaitingInput>0&&s.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full font-semibold",style:{background:"#F59E0B22",color:"#F59E0B"},children:[b.awaitingInput," awaiting reply"]}),s.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full font-semibold",style:{background:v?"#2E7D3222":"#B71C1C22",color:v?"#2E7D32":"#B71C1C"},children:[b.done,"/",b.total," done"]}),!v&&(b.running>0||b.awaitingInput>0)&&s.jsx("button",{onClick:W,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:"–"}),s.jsx("button",{onClick:c,className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-lg cursor-pointer",title:v?"Dismiss wave":"Close (jobs keep running)",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-col flex-1 min-h-0",children:[s.jsxs("div",{className:"shrink-0 border-b border-[var(--terminal-border)] flex flex-col",children:[s.jsxs("div",{className:"flex items-center gap-3 px-4 py-1.5",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 gap-x-3 ml-auto",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(z=>s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"w-2 h-2 rounded-full inline-block",style:{background:z.color,animation:z.dot?"wave-pulse 1.5s ease-in-out infinite":void 0}}),s.jsx("span",{className:"text-[8px] text-[var(--terminal-text-muted)]",children:z.label})]},z.label))})]}),s.jsx("div",{className:"overflow-x-auto overflow-y-auto px-3 pb-2",style:{maxHeight:"35vh"},children:s.jsx(hC,{nodes:f,rootId:i,selectedRoleId:g,onSelectNode:y})})]}),s.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[ae&&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:je}}),s.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-xs",children:ae.roleId.toUpperCase()}),s.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs",children:ae.roleName}),s.jsx("span",{className:"ml-auto text-[10px] px-2 py-0.5 rounded-full font-semibold",style:{background:ae.status==="awaiting_input"?"#F59E0B22":`${je}22`,color:ae.status==="awaiting_input"?"#F59E0B":je},children:ae.status==="running"?"Working":ae.status==="done"?"Complete":ae.status==="error"?"Error":ae.status==="waiting"?"Waiting":ae.status==="awaiting_input"?"Awaiting Reply":"Not dispatched"}),(ae.status==="running"||ae.status==="awaiting_input")&&ae.jobId&&s.jsx("button",{onClick:()=>ne(ae.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:Y,className:"flex-1 overflow-y-auto p-4 space-y-1 text-xs font-mono select-text",children:[ae&&ae.events.length===0&&s.jsx("div",{className:"text-[var(--terminal-text-muted)]",children:ae.status==="waiting"?"Waiting for dispatch...":ae.status==="running"?"Connecting to activity stream...":ae.status==="not-dispatched"?"This role was not dispatched in this wave.":""}),ae==null?void 0:ae.events.map(z=>s.jsx(gg,{event:z,isThinkingCollapsed:C.has(z.seq),onToggleThinking:()=>M(z.seq),onNavigateToJob:G=>{for(const[,D]of f)if(D.jobId===G){y(D.roleId);return}},onOpenKnowledgeDoc:m},z.seq)),(ae==null?void 0:ae.status)==="running"&&s.jsx("span",{className:"inline-block w-2 h-4 bg-green-400 animate-pulse ml-0.5"})]}),(ae==null?void 0:ae.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:[ae.roleName," is waiting for your response"]})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{type:"text",value:R,onChange:z=>B(z.target.value),onKeyDown:z=>{z.key==="Enter"&&!z.shiftKey&&(z.preventDefault(),Z())},placeholder:"Type your response...",disabled:L,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:Z,disabled:L||!R.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:L?"...":"Reply"})]})]}),!ae&&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:ae&&ae.events.length>0&&`${ae.events.length} events`}),v&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:c,className:"px-4 py-1.5 text-xs rounded-lg font-semibold cursor-pointer",style:{background:"rgba(255,255,255,0.08)",color:"var(--terminal-text-muted)"},children:"Dismiss"}),x&&s.jsx("button",{onClick:O,disabled:V,className:"px-4 py-1.5 text-xs text-white rounded-lg font-semibold cursor-pointer disabled:opacity-50",style:{background:"#2E7D32"},children:V?"Saving...":"Save Wave"})]})]})]})]})]})]})}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 _h(t){return pC[t]??{skinColor:"#B0BEC5",hairColor:"#78909C",shirtColor:"#607D8B",pantsColor:"#455A64",shoeColor:"#37474F"}}const bg=["#FDEBD0","#F5CBA7","#D4A07A","#C68642","#8D5524","#5C3A1E","#F3D1C7","#E8BEAC","#B07D62","#704214"],vg=["#1A0A00","#2C1810","#4E342E","#6D4C41","#8D6E63","#D4A574","#F5E6CA","#FFD700","#B71C1C","#AD1457","#4A148C","#1A237E","#004D40","#1A1A1A","#78909C","#E0E0E0"],wg=["#1565C0","#E65100","#2E7D32","#4A148C","#AD1457","#00695C","#D32F2F","#F57F17","#1B5E20","#283593","#4E342E","#37474F","#880E4F","#00838F","#6A1B9A","#FF6F00"],kg=["#37474F","#1A237E","#3E2723","#263238","#1B5E20","#455A64","#212121","#4E342E","#0D47A1","#311B92"],jg=["#212121","#1A1A1A","#37474F","#4E342E","#7B1FA2","#D32F2F","#1565C0","#F57F17","#2E7D32","#FFFFFF"],na={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 Ms({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 Af({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 Df({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 Zr(t){return t[Math.floor(Math.random()*t.length)]}function ji(t){var c,u,d;const l=ig(),r=sg(),i=og().filter(m=>!t||ug(m.id,t));return{skinColor:Zr(bg),hairColor:Zr(vg),shirtColor:Zr(wg),pantsColor:Zr(kg),shoeColor:Zr(jg),hairStyle:(c=Zr(l))==null?void 0:c.id,outfitStyle:(u=Zr(r))==null?void 0:u.id,accessory:(d=Zr(i))==null?void 0:d.id}}function Sg({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 R;const C=(R=E.target.files)==null?void 0:R[0];if(!C)return;const A=new Image;A.onload=()=>{const B=Hj(A);r({...B,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=ig(),v=sg(),S=og(),j=d!==void 0?S.filter(E=>ug(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(Xs,{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(Df,{label:"LOOK",active:m==="look",onClick:()=>x("look")}),s.jsx(Df,{label:"OUTFIT",active:m==="outfit",onClick:()=>x("outfit")}),s.jsx(Df,{label:"ACCESSORY",active:m==="accessory",onClick:()=>x("accessory")})]}),m==="look"&&s.jsxs(s.Fragment,{children:[s.jsx(Ms,{label:"SKIN",presets:bg,value:l.skinColor,onChange:E=>f("skinColor",E)}),s.jsx(Ms,{label:"HAIR COLOR",presets:vg,value:l.hairColor,onChange:E=>f("hairColor",E)}),s.jsx(Af,{label:"HAIR STYLE",items:b,value:l.hairStyle,onChange:E=>f("hairStyle",E)})]}),m==="outfit"&&s.jsxs(s.Fragment,{children:[s.jsx(Af,{label:"STYLE",items:v,value:l.outfitStyle,onChange:E=>f("outfitStyle",E)}),s.jsx(Ms,{label:"TOP",presets:wg,value:l.shirtColor,onChange:E=>f("shirtColor",E)}),s.jsx(Ms,{label:"PANTS",presets:kg,value:l.pantsColor,onChange:E=>f("pantsColor",E)}),s.jsx(Ms,{label:"SHOES",presets:jg,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(Af,{label:"ACCESSORY",items:S,value:l.accessory,onChange:E=>f("accessory",E),lockInfo:d!==void 0?{roleLevel:d,getLockLevel:cg}: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 rh(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,24)}function Tf(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 Fs=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=rh(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(""),[R,B]=k.useState("ceo"),[L,_]=k.useState(1),[V,K]=k.useState(""),[Y,T]=k.useState(""),[U,O]=k.useState(!1),[Z,ne]=k.useState("member"),[W,I]=k.useState("ceo"),[P,ae]=k.useState(""),[je,M]=k.useState(ji),[z,G]=k.useState(!1),[D,ue]=k.useState(""),[Ee,ge]=k.useState([]),[Ae,De]=k.useState(new Set),[Ie,pe]=k.useState(""),[Pe,fe]=k.useState("input"),[he,be]=k.useState({done:0,total:0}),Ce=k.useRef(null),ze=k.useRef(null),Oe=k.useRef(null);k.useEffect(()=>{Ne.getSkills().then(q=>ge(q.filter(Te=>Te.installed))).catch(()=>{})},[]),k.useEffect(()=>{var q,Te,He;i==="single"?(L===1&&((q=Ce.current)==null||q.focus()),L===2&&((Te=ze.current)==null||Te.focus())):Pe==="input"&&((He=Oe.current)==null||He.focus())},[L,i,Pe]);const Me=k.useMemo(()=>new Set(t.map(q=>q.id)),[t]),we=k.useMemo(()=>{const q=Ie.split(`
|
|
82
|
+
`),Te=new Set;return q.map(He=>bC(He,Me,Te)).filter(He=>He!==null)},[Ie,Me]),Be=we.length>0&&we.every(q=>!q.error),tt=q=>{K(q),U||T(rh(q))},jt=V.trim().length>0&&Y.trim().length>0&&!t.some(q=>q.id===Y),Ut=P.trim().length>0,yt=async()=>{G(!0),ue("");const q=Tf(Z);try{await r({id:Y,name:V.trim(),level:Z,reportsTo:W,persona:P.trim(),...q,skills:Ae.size>0?[...Ae]:void 0},je),l()}catch(Te){ue(Te instanceof Error?Te.message:"Failed to create role"),G(!1)}},Vt=q=>q===1?jt:q===2?Ut:!0,ie=async()=>{G(!0),ue(""),be({done:0,total:we.length});try{for(let q=0;q<we.length;q++){const Te=we[q],He=Tf(Te.level),Je=ji(),mt=`${Te.name}. A ${Te.level} role reporting to ${Te.reportsTo}.`;await r({id:Te.id,name:Te.name,level:Te.level,reportsTo:Te.reportsTo,persona:mt,...He},Je),be({done:q+1,total:we.length})}l()}catch(q){ue(q instanceof Error?q.message:"Failed to create roles"),G(!1)}},me=async()=>{g(!0),b("");try{const q=u.replace(/^tycono:/,"").trim();if(!q){b("Please enter a character ID"),g(!1);return}const Te=await Ci.getCharacter(q);x(Te),E(Te.name||""),A(rh(Te.name||q)),S("review")}catch{b("Character not found. Check the ID and try again.")}finally{g(!1)}},Fe=async()=>{if(!m)return;G(!0),ue("");const q=m,Te=q.level==="c-level"||q.level==="team-lead"?q.level:"member",He=Tf(Te),Je=q.skills!=null&&typeof q.skills=="object"&&!Array.isArray(q.skills)&&"primary"in q.skills;try{await r({id:C,name:j.trim(),level:Te,reportsTo:R,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:Je?q.skills:void 0},q.appearance?q.appearance:ji()),l()}catch(mt){ue(mt instanceof Error?mt.message:"Failed to hire"),G(!1)}},Ge=q=>{q.key==="Escape"&&l(),q.key==="Enter"&&(q.metaKey||q.ctrlKey)&&(i==="single"?L<Fs&&Vt(L)?_(L+1):L===Fs&&yt():i==="bulk"?Pe==="input"&&Be?fe("review"):Pe==="review"&&ie():i==="store"&&(v==="input"&&u.trim()?me():v==="review"&&Fe()))},ye=t.some(q=>q.id===Y)&&Y.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:Ge,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"),ue("")},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"),ue("")},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"),ue("")},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 ${L} of ${Fs}`:i==="bulk"?Pe==="input"?"Enter roles, one per line":`Review ${we.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:Fs},(q,Te)=>Te+1).map(q=>s.jsx("div",{className:"flex-1 h-1 rounded-full transition-colors",style:{background:q<=L?"#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()&&me()},autoFocus:!0}),s.jsx("button",{onClick:me,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(Xs,{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:R,onChange:q=>B(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 Je,mt;const q=m.skills;if(q&&typeof q=="object"&&!Array.isArray(q)&&"primary"in q){const et=[];return(mt=(Je=q.primary)==null?void 0:Je.frontmatter)!=null&&mt.name&&et.push(q.primary.frontmatter.name),q.shared&&q.shared.forEach(Yt=>{var cn;return et.push(((cn=Yt.frontmatter)==null?void 0:cn.name)||Yt.id)}),et.map(Yt=>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:Yt},Yt))}return(Array.isArray(q)?q:[]).map((et,Yt)=>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 et=="string"?et:et.name},Yt))})()})]})]}),D&&s.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 p-2 rounded-lg border border-red-800/30",children:D})]})]}):i==="single"?s.jsxs(s.Fragment,{children:[L===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:Ce,value:V,onChange:q=>tt(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:Y,onChange:q=>{T(q.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"")),O(!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 ${ye?"border-red-400":"border-white/10 focus:border-white/25"}`}),ye&&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 ${Z===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:W,onChange:q=>I(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))]})]})]}),L===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:ze,value:P,onChange:q=>ae(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:Ae.has(q.id),onChange:()=>De(Te=>{const He=new Set(Te);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))})]})]}),L===3&&s.jsx("div",{className:"customize-body",style:{padding:0},children:s.jsx(Sg,{roleId:"default",appearance:je,onChange:M,onRandomize:()=>M(ji()),onReset:()=>M(ji()),label:s.jsxs("span",{children:[Y||"new-role"," — ",V||"New Role"]})})}),L===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(Xs,{roleId:"default",appearance:je,scale:4})}),s.jsxs("div",{className:"flex-1 space-y-2.5",children:[s.jsx(Rs,{label:"Name",value:V}),s.jsx(Rs,{label:"ID",value:Y,mono:!0}),s.jsx(Rs,{label:"Level",value:Z}),s.jsx(Rs,{label:"Reports To",value:W}),Ae.size>0&&s.jsx(Rs,{label:"Skills",value:[...Ae].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:P})]})]}),D&&s.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 p-2 rounded-lg border border-red-800/30",children:D})]})]}):s.jsxs(s.Fragment,{children:[Pe==="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:Oe,value:Ie,onChange:q=>pe(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."})]}),
|
|
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 AC({attachments:t}){const[l,r]=k.useState(null);return t.length===0?null:s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:t.map((i,c)=>s.jsxs("button",{onClick:()=>r(c),className:"relative w-20 h-20 rounded-lg overflow-hidden border border-[var(--terminal-border)] bg-[var(--terminal-inline-bg)] cursor-pointer hover:border-[var(--terminal-border-hover)] transition-colors",children:[s.jsx("img",{src:`data:${i.mediaType};base64,${i.data}`,alt:i.name,className:"w-full h-full object-cover"}),s.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-black/60 text-[8px] text-white truncate px-1 py-0.5",children:i.name})]},c))}),l!==null&&s.jsx("div",{className:"fixed inset-0 z-[100] bg-black/80 flex items-center justify-center",onClick:()=>r(null),children:s.jsxs("div",{className:"relative max-w-[90vw] max-h-[90vh]",children:[s.jsx("img",{src:`data:${t[l].mediaType};base64,${t[l].data}`,alt:t[l].name,className:"max-w-full max-h-[90vh] object-contain rounded-lg"}),s.jsx("button",{onClick:()=>r(null),className:"absolute top-2 right-2 w-8 h-8 rounded-full bg-black/70 text-white flex items-center justify-center cursor-pointer hover:bg-black/90",children:"x"}),s.jsx("div",{className:"absolute bottom-2 left-1/2 -translate-x-1/2 bg-black/70 text-white text-sm px-3 py-1 rounded",children:t[l].name})]})})]})}function Ef(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 DC(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:Ef(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=Ef(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?Ef(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 zC({events:t,isStreaming:l}){const[r,i]=k.useState(!1);if(t.length===0)return null;const c=DC(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 MC({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"}),t.attachments&&t.attachments.length>0&&s.jsx("div",{className:"flex justify-end mb-1",children:s.jsx(AC,{attachments:t.attachments})}),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(zC,{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 FC({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(MC,{message:u,roleId:l,roleColor:r},u.id)),s.jsx("div",{ref:i})]})}const RC=5*1024*1024,_C=["image/png","image/jpeg","image/gif","image/webp"];function OC({mode:t,onModeChange:l,onSend:r,disabled:i,disabledReason:c}){const[u,d]=k.useState(""),[m,x]=k.useState([]),[f,g]=k.useState(!1),[y,b]=k.useState(null),v=k.useRef(null),S=k.useRef(null);k.useEffect(()=>{const Y=v.current;Y&&(Y.style.height="0",Y.style.height=Math.min(Y.scrollHeight,120)+"px")},[u]),k.useEffect(()=>{if(y){const Y=setTimeout(()=>b(null),3e3);return()=>clearTimeout(Y)}},[y]);const j=k.useCallback(async Y=>_C.includes(Y.type)?Y.size>RC?(b(`File too large: ${(Y.size/1024/1024).toFixed(1)}MB. Max 5MB.`),null):new Promise(T=>{const U=new FileReader;U.onload=()=>{const Z=U.result.split(",")[1];T({type:"image",data:Z,name:Y.name,mediaType:Y.type})},U.onerror=()=>{b("Failed to read file"),T(null)},U.readAsDataURL(Y)}):(b(`Unsupported format: ${Y.type}. Use PNG, JPG, GIF, or WebP.`),null),[]),E=k.useCallback(async Y=>{const T=Array.from(Y),U=[];for(const O of T){const Z=await j(O);Z&&U.push(Z)}U.length>0&&x(O=>[...O,...U])},[j]),C=k.useCallback(Y=>{Y.preventDefault(),Y.stopPropagation(),g(!0)},[]),A=k.useCallback(Y=>{Y.preventDefault(),Y.stopPropagation(),g(!1)},[]),F=k.useCallback(Y=>{Y.preventDefault(),Y.stopPropagation(),g(!1);const T=Y.dataTransfer.files;T.length>0&&E(T)},[E]),B=k.useCallback(Y=>{const T=Y.clipboardData.items,U=[];for(let O=0;O<T.length;O++){const Z=T[O];if(Z.type.startsWith("image/")){const ne=Z.getAsFile();ne&&U.push(ne)}}U.length>0&&(Y.preventDefault(),E(U))},[E]),$=k.useCallback(Y=>{const T=Y.target.files;T&&T.length>0&&E(T),Y.target.value=""},[E]),_=k.useCallback(Y=>{x(T=>T.filter((U,O)=>O!==Y))},[]),V=()=>{const Y=u.trim();!Y&&m.length===0||i||(r(Y,m.length>0?m:void 0),d(""),x([]))},K=Y=>{Y.key==="Enter"&&!Y.shiftKey&&(Y.preventDefault(),V())};return s.jsxs("div",{className:`border-t border-[var(--terminal-border)] p-3 shrink-0 transition-colors ${f?"bg-[var(--terminal-surface-light)] border-amber-500/50":""}`,onDragOver:C,onDragLeave:A,onDrop:F,children:[y&&s.jsx("div",{className:"text-[10px] text-red-400 mb-2 text-center",children:y}),c&&s.jsx("div",{className:"text-[10px] text-amber-400/70 mb-2 text-center",children:c}),m.length>0&&s.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:m.map((Y,T)=>s.jsxs("div",{className:"relative group w-16 h-16 rounded-lg overflow-hidden border border-[var(--terminal-border)] bg-[var(--terminal-inline-bg)]",children:[s.jsx("img",{src:`data:${Y.mediaType};base64,${Y.data}`,alt:Y.name,className:"w-full h-full object-cover"}),s.jsx("button",{onClick:()=>_(T),className:"absolute top-0.5 right-0.5 w-4 h-4 rounded-full bg-black/70 text-white text-xs flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",children:"x"}),s.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-black/60 text-[8px] text-white truncate px-1 py-0.5",children:Y.name})]},T))}),f&&s.jsx("div",{className:"text-[11px] text-amber-400 text-center mb-2",children:"Drop image here"}),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("button",{onClick:()=>{var Y;return(Y=S.current)==null?void 0:Y.click()},disabled:i,className:"w-8 h-8 rounded-lg bg-[var(--terminal-inline-bg)] border border-[var(--terminal-border)] text-[var(--terminal-text-muted)] flex items-center justify-center shrink-0 cursor-pointer hover:bg-[var(--terminal-surface-light)] hover:text-[var(--terminal-text-secondary)] disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:"Attach image (PNG, JPG, GIF, WebP)",children:s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})})}),s.jsx("input",{ref:S,type:"file",accept:"image/png,image/jpeg,image/gif,image/webp",multiple:!0,onChange:$,className:"hidden"}),s.jsx("textarea",{ref:v,value:u,onChange:Y=>d(Y.target.value),onKeyDown:K,onPaste:B,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:V,disabled:i||!u.trim()&&m.length===0,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 BC={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 LC({msg:t}){const l=BC[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 $C({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(LC,{msg:b},b.id)),s.jsx("div",{ref:c})]})}const Nf={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"},HC=400,UC=800;function IC({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:B,unreadChannels:$}){const[_,V]=k.useState(!1),[K,Y]=k.useState(!1),[T,U]=k.useState(!1),[O,Z]=k.useState(""),ne=j!=null,W=S==null?void 0:S.find(ye=>ye.id===j),[I,P]=k.useState(!1),[re,ke]=k.useState(!1),[M,z]=k.useState(!1),G=k.useRef(0),D=k.useRef(0),ue=k.useRef(null),Ee=t.find(ye=>ye.id===l),ge=i===l,Ae=t.filter(ye=>ye.messages.length===0).length,De=k.useCallback(()=>{const ye=ue.current;ye&&(ke(ye.scrollLeft>0),z(ye.scrollLeft+ye.clientWidth<ye.scrollWidth-1))},[]);k.useEffect(()=>{if(!l||!ue.current)return;const ye=ue.current.querySelector(`[data-session-id="${l}"]`);ye&&ye.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"}),De()},[l,t.length,De]),k.useEffect(()=>{const ye=ue.current;if(!ye)return;De(),ye.addEventListener("scroll",De);const We=new ResizeObserver(De);return We.observe(ye),()=>{ye.removeEventListener("scroll",De),We.disconnect()}},[De]);const He=k.useCallback(ye=>{ye.preventDefault(),G.current=ye.clientX,D.current=c,P(!0);const We=he=>{const be=G.current-he.clientX,Ce=Math.min(UC,Math.max(HC,D.current+be));u==null||u(Ce)},fe=()=>{P(!1),document.removeEventListener("mousemove",We),document.removeEventListener("mouseup",fe)};document.addEventListener("mousemove",We),document.addEventListener("mouseup",fe)},[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 ${I?"bg-[var(--terminal-border-hover)]":"bg-transparent"}`,onMouseDown:He}),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:[re&&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:ue,className:"flex items-center overflow-x-auto terminal-tab-scroll gap-px px-1 py-1",children:[S==null?void 0:S.map(ye=>s.jsxs("button",{onClick:()=>{E==null||E(ye.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===ye.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===ye.id?{borderTop:"2px solid #4CAF50"}:void 0,children:[s.jsx("span",{className:"text-[10px]",children:"💬"}),s.jsx("span",{className:"truncate",children:ye.name}),($==null?void 0:$.has(ye.id))&&j!==ye.id&&s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-400 shrink-0"}),!ye.isDefault&&s.jsx("span",{onClick:We=>{We.stopPropagation(),A==null||A(ye.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:"×"})]},ye.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(ye=>s.jsx(jC,{roleId:ye.roleId,title:ye.title,roleColor:Nf[ye.roleId]??"#666",active:!ne&&ye.id===l,onClick:()=>{E==null||E(null),d(ye.id)},onClose:We=>{We.stopPropagation(),m(ye.id)},"data-session-id":ye.id},ye.id))]}),M&&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:()=>{V(!_),Y(!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:"+"}),_&&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:[T?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:O,onChange:ye=>Z(ye.target.value),onKeyDown:ye=>{ye.key==="Enter"&&O.trim()&&(C(O.trim(),[]),Z(""),U(!1),V(!1)),ye.key==="Escape"&&(U(!1),Z(""))},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:()=>U(!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(ye=>s.jsxs("button",{onClick:()=>{x(ye.id),E==null||E(null),V(!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:Nf[ye.id]??"#666"}}),ye.id.toUpperCase()," — ",ye.name]},ye.id))]})]}),s.jsxs("div",{className:"relative shrink-0",children:[s.jsx("button",{onClick:()=>{Y(!K),V(!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:"···"}),K&&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":""]}),Ae>0&&f&&s.jsxs("button",{onClick:()=>{f(),Y(!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 (",Ae,")"]}),t.length>0&&g&&s.jsx("button",{onClick:()=>{g(),Y(!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&&W?s.jsx($C,{channel:W,allRoles:r,onUpdateMembers:F,onUpdateTopic:B}):Ee?s.jsxs(s.Fragment,{children:[s.jsx(FC,{messages:Ee.messages,roleId:Ee.roleId,roleColor:Nf[Ee.roleId]??"#666"}),s.jsx(OC,{mode:Ee.mode,onModeChange:ye=>b(Ee.id,ye),onSend:(ye,We)=>y(Ee.id,ye,Ee.mode,We),disabled:ge,disabledReason:ge?`${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 YC(){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,m)=>{l();const x=new AbortController;return t.current=x,fetch(`/api/exec/session/${i}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:c,mode:u,attachments:m}),signal:x.signal}).then(async f=>{var v,S,j,E,C;if(!f.ok||!f.body){d.onError("Failed to connect");return}const g=f.body.getReader(),y=new TextDecoder;let b="";for(;;){const{done:A,value:F}=await g.read();if(A)break;b+=y.decode(F,{stream:!0});const B=b.split(`
|
|
88
|
-
`);b=B.pop()??"";let $="";for(let _=0;_<B.length;_++){const V=B[_];if(V.startsWith("event: ")){$=V.slice(7).trim();continue}if(V.startsWith("data: ")){let K;try{K=JSON.parse(V.slice(6))}catch{$="";continue}switch($){case"thinking":K.text&&((v=d.onThinking)==null||v.call(d,K.text));break;case"output":K.text&&d.onText(K.text);break;case"tool":(S=d.onToolUse)==null||S.call(d,K.name,K.input);break;case"dispatch":(j=d.onDispatch)==null||j.call(d,K.roleId,K.task);break;case"dispatch:progress":(E=d.onDispatchProgress)==null||E.call(d,K.roleId,K.type,K);break;case"turn":(C=d.onTurn)==null||C.call(d,K.turn);break;case"done":d.onDone(K);break;case"error":d.onError(K.message??"Unknown error");break;default:K.text&&d.onText(K.text);break}$=""}}}}).catch(f=>{f.name!=="AbortError"&&d.onError(f.message)}),{abort:l}},[l]),abort:l}}const kg="tycono-appearances",eh="tycono-theme";function E0(){try{const t=localStorage.getItem(kg);return t?JSON.parse(t):{}}catch{return{}}}function Af(t){localStorage.setItem(kg,JSON.stringify(t))}function N0(){try{const t=localStorage.getItem(eh);if(t&&t in Yr)return t}catch{}return"default"}function qC(t){var i;const l=(i=Yr[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 Df={mode:"auto",intervalSec:18,dailyBudgetUsd:1},th="tycono-speech-settings",Tf="tycono-language";function XC(){try{const t=localStorage.getItem(th);return t?{...Df,...JSON.parse(t)}:Df}catch{return Df}}function VC(){const[t,l]=k.useState(E0),[r,i]=k.useState(N0),[c,u]=k.useState(XC),[d,m]=k.useState(()=>{try{return localStorage.getItem(Tf)??"auto"}catch{return"auto"}}),x=k.useRef(!1);k.useEffect(()=>{x.current||(x.current=!0,Ne.getPreferences().then(j=>{const E=Object.keys(j.appearances??{}).length>0||j.theme!=="default";if(j.speech&&(u(C=>({...C,...j.speech})),localStorage.setItem(th,JSON.stringify(j.speech))),j.language&&(m(j.language),localStorage.setItem(Tf,j.language)),E){const C=j.appearances;l(C),Af(C),j.theme&&j.theme in Yr&&(i(j.theme),localStorage.setItem(eh,j.theme))}else{const C=E0(),A=N0();(Object.keys(C).length>0||A!=="default")&&Ne.updatePreferences({appearances:C,theme:A}).catch(()=>{})}}).catch(()=>{}))},[]),k.useEffect(()=>{qC(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 Af(A),Ne.updatePreferences({appearances:A}).catch(()=>{}),A})},[]),y=k.useCallback(j=>{l(E=>{const C={...E};return delete C[j],Af(C),Ne.updatePreferences({appearances:C}).catch(()=>{}),C})},[]),b=k.useCallback(j=>{i(j),localStorage.setItem(eh,j),Ne.updatePreferences({theme:j}).catch(()=>{})},[]),v=k.useCallback(j=>{u(E=>{const C={...E,...j};return localStorage.setItem(th,JSON.stringify(C)),Ne.updatePreferences({speech:C}).catch(()=>{}),C})},[]),S=k.useCallback(j=>{m(j),localStorage.setItem(Tf,j),Ne.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 GC=3e4;function KC(){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 Ne.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,GC))},[m]);k.useEffect(()=>()=>{d.current&&clearInterval(d.current)},[]);const f=k.useCallback(async C=>{i("saving");try{const A=await Ne.save(C);return await m(),A}catch(A){throw i("error"),A}},[m]),g=k.useCallback(async()=>{try{const C=await Ne.getSaveHistory(20);u(C)}catch{}},[]),y=k.useCallback(async C=>{i("saving");try{await Ne.restoreSave(C),await m()}catch(A){throw i("error"),A}},[m]),b=k.useCallback(async()=>{try{await Ne.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."]},D0={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."]},WC=[{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."}]}],QC=18e3,T0=6e3,ZC=2500,JC=30*6e4,jg="tycono:relationships";function PC(){try{const t=localStorage.getItem(jg);return t?JSON.parse(t):[]}catch{return[]}}function eE(t){localStorage.setItem(jg,JSON.stringify(t))}function fc(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 hc(t){return Math.min(100,t.dispatches*5+t.wavesTogether*10+t.conversations*2)}function mc(t){return t[Math.floor(Math.random()*t.length)]}function tE(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 nE(t,l){return t.relation==="any"?!0:t.relation===l}function lE({roles:t,roleStatuses:l,activeExecs:r,getStandupSpeech:i}){const[c,u]=k.useState(new Map),[d,m]=k.useState(PC),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 B=Date.now();for(const[$,_]of Object.entries(l))_==="working"&&(x.current[$]=B)},[l]),k.useEffect(()=>{eE(d)},[d]);const j=k.useCallback(B=>{const $=y.current[B],_=b.current.find(U=>U.roleId===B);if($==="working"&&(_!=null&&_.task))return null;const V=v.current(B);if(V&&Math.random()<.3)return{text:V,type:"work",ts:Date.now()};const K=Date.now(),Y=x.current[B]??0;if(K-Y>JC&&Math.random()<.5){const U=D0[B]??D0.engineer;return{text:mc(U),type:"guilt",ts:K}}const T=A0[B]??A0.engineer;return{text:mc(T),type:"personality",ts:K}},[]),E=k.useCallback(B=>{if(f.current)return!1;const $=B.filter(P=>y.current[P.id]!=="working");if($.length<2)return!1;const _=[...$].sort(()=>Math.random()-.5),V=_[0],K=_[1],Y=tE(V.id,K.id,B);if(!Y)return!1;const T=fc(S.current,V.id,K.id),U=hc(T),O=WC.filter(P=>nE(P,Y)&&U>=P.minFamiliarity);if(O.length===0)return!1;const Z=mc(O);let ne=V.id,W=K.id;Z.relation==="superior-subordinate"&&(K.reportsTo===V.id||V.level==="c-level"?(ne=V.id,W=K.id):(ne=K.id,W=V.id)),f.current={templateId:Z.id,roleA:ne,roleB:W,turnIdx:0,timer:null};const I=P=>{if(!f.current||P>=Z.turns.length){f.current=null,m(z=>{const G=[...z],D=fc(G,ne,W);return D.conversations++,D.familiarity=hc(D),D.lastInteraction=new Date().toISOString(),G}),setTimeout(()=>{u(z=>{const G=new Map(z);return G.delete(ne),G.delete(W),G})},T0);return}const re=Z.turns[P],ke=re.speaker==="A"?ne:W,M=re.speaker==="A"?W:ne;u(z=>{const G=new Map(z);if(G.set(ke,{text:re.text,type:"social",partnerId:M,ts:Date.now()}),P>0){const D=Z.turns[P-1].speaker==="A"?ne:W;D!==ke&&G.delete(D)}return G}),f.current.turnIdx=P,f.current.timer=setTimeout(()=>I(P+1),ZC)};return I(0),!0},[]);k.useEffect(()=>{const B=setInterval(()=>{const $=g.current;if($.length===0||f.current||Math.random()<.35&&E($))return;const _=$.filter(Y=>y.current[Y.id]!=="working");if(_.length===0)return;const V=mc(_),K=j(V.id);K&&(u(Y=>{const T=new Map(Y);return T.set(V.id,K),T}),setTimeout(()=>{u(Y=>{const T=new Map(Y),U=T.get(V.id);return U&&U.ts===K.ts&&T.delete(V.id),T})},T0))},QC);return()=>{var $;clearInterval(B),($=f.current)!=null&&$.timer&&clearTimeout(f.current.timer)}},[j,E]);const C=k.useCallback(B=>{const $=c.get(B);return($==null?void 0:$.text)??""},[c]),A=k.useCallback((B,$)=>{m(_=>{const V=[..._],K=fc(V,B,$);return K.dispatches++,K.familiarity=hc(K),K.lastInteraction=new Date().toISOString(),V})},[]),F=k.useCallback(B=>{B.length<2||m($=>{const _=[...$];for(let V=0;V<B.length;V++)for(let K=V+1;K<B.length;K++){const Y=fc(_,B[V],B[K]);Y.wavesTogether++,Y.familiarity=hc(Y),Y.lastInteraction=new Date().toISOString()}return _})},[]);return{speeches:c,getSpeech:C,relationships:d,notifyDispatch:A,notifyWave:F}}const Sg="tycono:office-chat";let rE=0;function aE(){return`chat-${Date.now()}-${++rE}`}function zf(){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 iE(){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[...zf(),...i]}const r=zf();for(const i of r)l.find(c=>c.id===i.id)||l.unshift(i);return l}}catch{}return zf()}function sE(t){const l=t.map(r=>({...r,messages:r.messages.slice(-200)}));localStorage.setItem(Sg,JSON.stringify(l))}function oE(){const[t,l]=k.useState(iE),[r,i]=k.useState(null),[c,u]=k.useState(new Set);k.useEffect(()=>{sE(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:aE()};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 B=j.find($=>$.id===F.id);B&&F.messages.length>B.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 cE=45e3,uE=5e3,dE=4,fE=20;function hE({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)??cE/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 B=k.useCallback(async(_,V)=>{if(F.current)return!1;F.current=!0;try{if(!b.current.find(W=>W.id===_))return!1;const Y=V.messages.slice(-fE).map(W=>({roleId:W.roleId,text:W.text,ts:W.ts})),T=b.current.filter(W=>V.members.includes(W.id)),U=E.current.filter(W=>W.roleA===_||W.roleB===_).map(W=>({partnerId:W.roleA===_?W.roleB:W.roleA,familiarity:W.familiarity})),O=S.current.find(W=>W.roleId===_),Z=O?{currentTask:O.task,taskProgress:null}:{currentTask:null,taskProgress:null},ne=await Ne.chatInChannel({channelId:V.name.replace("#",""),channelTopic:V.topic,roleId:_,history:Y,members:T.map(W=>({id:W.id,name:W.name,level:W.level})),relationships:U,workContext:Z});return ne.message?(C.current({ts:Date.now(),roleId:_,text:ne.message,type:"chat",channelId:V.id}),!0):!1}catch{return!1}finally{F.current=!1}},[]),$=k.useCallback(async(_,V)=>{if(A.current>=dE){A.current=0;return}const K=_.members.filter(O=>O!==V&&v.current[O]!=="working");if(K.length===0){A.current=0;return}const Y=K[Math.floor(Math.random()*K.length)];if(Math.random()>.7){A.current=0;return}const T=A.current*2e3,U=Math.random()*5e3;setTimeout(async()=>{A.current++;const O=j.current.find(ne=>ne.id===_.id);if(!O)return;if(await B(Y,O)){const ne=.6-A.current*.1;Math.random()<ne?$(O,Y):A.current=0}else A.current=0},uE+T+U)},[B]);k.useEffect(()=>{if(!g)return;const _=setInterval(async()=>{const V=b.current;if(V.length===0||F.current)return;const K=V.filter(Z=>v.current[Z.id]!=="working");if(K.length===0)return;const Y=K[Math.floor(Math.random()*K.length)],T=j.current.filter(Z=>Z.members.length===0?!0:Z.members.includes(Y.id));if(T.length===0)return;const U=T[Math.floor(Math.random()*T.length)];A.current=0,await B(Y.id,U)&&$(U,Y.id)},y);return()=>clearInterval(_)},[g,y,B,$])}function xc({type:t,className:l}){const r=k.useRef(null),i=Dj(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]],mE=[[1,4],[2,3],[4,1],[3,2]];function pc(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 yc(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 $r(t,l){const r=t===1||t===3?-1:0,i=mE[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:[pc(0),pc(1),pc(2),pc(3)],up:[yc(0),yc(1),yc(2),yc(3)],right:[$r(0,!0),$r(1,!0),$r(2,!0),$r(3,!0)],left:[$r(0,!1),$r(1,!1),$r(2,!1),$r(3,!1)]},Ve=4,zt=28,dn=2,ht=4,it=4,lr=[{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 zh(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 xE(t){const i=lr[0],c={id:"main",wx:Ve+it,wy:Ve,ww:160-2*(Ve+it),wh:zt,fx:Ve+it,fy:Ve+zt+dn,fw:160-2*(Ve+it),fh:120-Ve-zt-dn-Ve,...i},u=zh(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*(Ve+it))/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 pE(t){const c={id:"exec",wx:Ve+it,wy:Ve,ww:144-Ve-it-ht/2,wh:zt,fx:Ve+it,fy:Ve+zt+dn,fw:144-Ve-it-ht/2,fh:66,...lr[0]},u={id:"work",wx:144+ht/2+it,wy:Ve,ww:144-ht/2-it-Ve,wh:zt,fx:144+ht/2+it,fy:Ve+zt+dn,fw:144-ht/2-it-Ve,fh:66,...lr[1]},d={id:"meet",wx:Ve+it,wy:Ve+zt+dn+66+ht,ww:144-Ve-it-ht/2,wh:zt,fx:Ve+it,fy:Ve+zt+dn+66+ht+zt+dn,fw:144-Ve-it-ht/2,fh:70,...lr[2]},m={id:"comm",wx:144+ht/2+it,wy:Ve+zt+dn+66+ht,ww:144-ht/2-it-Ve,wh:zt,fx:144+ht/2+it,fy:Ve+zt+dn+66+ht+zt+dn,fw:144-ht/2-it-Ve,fh:70,...lr[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[_,V]of[...y,...b])V>0&&f.push(...zh(_,V,3));const S=Ve+zt+dn+66,j=144-ht/2,E={exec_work:{id:"exec_work",type:"v",doorY:Ve+zt+dn+20+12,xA:j-2,xB:u.fx+2},meet_comm:{id:"meet_comm",type:"v",doorY:Ve+zt+dn+66+ht+zt+dn+20+12,xA:j-2,xB:m.fx+2},exec_meet:{id:"exec_meet",type:"h",doorX:Ve+it+40+14,yA:S-2,yB:d.fy+2},work_comm:{id:"work_comm",type:"h",doorX:144+ht/2+it+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}]},B=[{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}],$=[{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:B,furniture:$}}function yE(t){const d={id:"exec",wx:Ve+it,wy:Ve,ww:180-Ve-it-ht/2,wh:zt,fx:Ve+it,fy:Ve+zt+dn,fw:180-Ve-it-ht/2,fh:82,...lr[0]},m={id:"work",wx:180+ht/2+it,wy:Ve,ww:180-ht/2-it-Ve,wh:zt,fx:180+ht/2+it,fy:Ve+zt+dn,fw:180-ht/2-it-Ve,fh:82,...lr[1]},x=Ve+zt+dn+82,f={id:"meet",wx:Ve+it,wy:x+ht,ww:180-Ve-it-ht/2,wh:zt,fx:Ve+it,fy:x+ht+zt+dn,fw:180-Ve-it-ht/2,fh:86,...lr[2]},g={id:"comm",wx:180+ht/2+it,wy:x+ht,ww:180-ht/2-it-Ve,wh:zt,fx:180+ht/2+it,fy:x+ht+zt+dn,fw:180-ht/2-it-Ve,fh:86,...lr[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[K,Y]of[...S,...j])Y>0&&b.push(...zh(K,Y,4));const C=180-ht/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"}]},B={exec:d.fy+82-12,work:m.fy+82-12,meet:f.fy+86-12,comm:g.fy+86-12},$={exec:[{x:d.fx+10,y:B.exec},{x:d.fx+d.fw/2,y:B.exec},{x:d.fx+d.fw-10,y:B.exec}],work:[{x:m.fx+10,y:B.work},{x:m.fx+m.fw/2,y:B.work},{x:m.fx+m.fw-10,y:B.work}],meet:[{x:f.fx+10,y:B.meet},{x:f.fx+f.fw/2,y:B.meet},{x:f.fx+f.fw-10,y:B.meet}],comm:[{x:g.fx+10,y:B.comm},{x:g.fx+g.fw/2,y:B.comm},{x:g.fx+g.fw-10,y:B.comm}]},_=[{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}],V=[{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:B,waypoints:$,wallDecorations:_,furniture:V}}const gE=2;function Eg(t,l){return l?l==="L"&&t<=12-gE?"M":l==="M"&&t>12?"L":l:t<=12?"M":"L"}function Ng(t,l){switch(l??Eg(t)){case"S":return xE(t);case"M":return pE(t);case"L":return yE(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 Mf(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 bE(t){Ns=t}function L(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 st(t,l,r,i){L(t,l,1,1,r,i)}let Cc=1;function wi(t){Cc=t}function Tl(){return Cc=Cc*16807%2147483647,(Cc&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 Dg(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 zl(t,l=1){const[r,i,c]=Ag(t);return Dg(r+15*l,Math.min(100,i+8),c-12*l)}function qt(t,l=1){const[r,i,c]=Ag(t);return Dg(r-10*l,i-3,c+10*l)}const un={hi:"#D4AA5C",base:"#B08040",sh:"#7A5038",deep:"#4E3028"},Dl={hi:"#8A6848",base:"#604832",sh:"#3A2E24",deep:"#2A1E18"},El={hi:"#5A6A80",base:"#485868",sh:"#364858",deep:"#283848"},Vr="#100A06";function vE(t,l,r=14,i=12){L(t,l,r,i,"#4A3828"),L(t+1,l+1,r-2,i-2,"#5A4838"),L(t+2,l+2,r-4,i-4,"#4A7098"),L(t+2,l+2,r-4,Math.floor((i-4)/2),"#6A90B8",.35);const c=Math.floor(r/2);L(t+c,l+1,1,i-2,"#4A3828"),L(t+1,l+Math.floor(i/2),r-2,1,"#4A3828",.5),st(t+3,l+3,"#8AB8E8",.35),st(t+c+2,l+3,"#8AB8E8",.25),L(t-1,l+i,r+2,2,"#5A4838"),L(t-1,l+i,r+2,1,qt("#5A4838",.5),.35)}function wE(t,l,r){L(t,l,10,8,"#3A2818"),L(t+1,l+1,8,6,r),L(t+2,l+2,4,3,qt(r,1.2),.3),st(t+3,l+2,qt(r,2),.25)}function kE(t,l){L(t,l,7,7,"#3A2818"),L(t+1,l+1,5,5,"#F0EDE5"),st(t+3,l+1,"#AAA"),st(t+3,l+5,"#AAA"),st(t+1,l+3,"#AAA"),st(t+5,l+3,"#AAA"),st(t+3,l+3,"#222"),L(t+3,l+1,1,2,"#333"),st(t+4,l+3,"#D32F2F")}function jE(t,l){L(t,l,26,16,"#586878"),L(t+1,l+1,24,13,"#ECEFF1"),L(t+1,l+1,24,1,"#F5F5F5",.4),L(t+3,l+3,14,1,"#1565C0",.6),L(t+3,l+5,18,1,"#333",.2),L(t+3,l+7,12,1,"#D32F2F",.35),L(t+3,l+9,16,1,"#333",.15),L(t+1,l+14,24,2,"#708898"),L(t+3,l+14,3,1,"#D32F2F"),L(t+7,l+14,3,1,"#1565C0"),L(t+11,l+14,3,1,"#2E7D32")}function SE(t,l){L(t,l,22,16,"#6A5030"),L(t+1,l+1,20,14,"#C4A66A"),wi(88);for(let r=0;r<14;r++)for(let i=0;i<20;i++)Tl()>.5&&st(t+1+i,l+1+r,Tl()>.5?"#B89858":"#D4B87A",.18);L(t+2,l+2,5,4,"#FFF176"),L(t+8,l+2,5,4,"#90CAF9"),L(t+14,l+3,5,4,"#CE93D8"),L(t+3,l+8,7,4,"#C8E6C9"),L(t+11,l+8,8,4,"#F8BBD0"),st(t+4,l+2,"#E53935"),st(t+10,l+2,"#1E88E5"),st(t+16,l+3,"#FF9800")}function CE(t,l){L(t,l,20,3,"#5A4030"),L(t,l,20,1,qt("#5A4030",.5),.35),L(t,l+2,20,1,zl("#5A4030",.5),.3),L(t+2,l-4,3,4,"#E53935"),L(t+2,l-4,3,1,qt("#E53935",1),.3),L(t+6,l-3,2,3,"#1E88E5"),L(t+9,l-5,4,5,"#43A047"),L(t+14,l-3,3,3,"#FFD54F"),st(t+15,l-3,"#FFF176",.4)}function EE(t,l){L(t,l,16,12,"#1E1E28"),L(t+1,l+1,14,9,"#0C1420"),L(t+2,l+2,12,1,"#EF4444",.6),st(t+2,l+4,"#4CAF50"),L(t+4,l+4,7,1,"#8b949e",.4),st(t+2,l+6,"#FF9800"),L(t+4,l+6,5,1,"#8b949e",.3),st(t+2,l+8,"#42A5F5"),L(t+4,l+8,8,1,"#8b949e",.25),L(t+7,l+10,2,2,"#1E1E28"),L(t+5,l+11,6,1,"#586878")}function NE(t,l,r){L(t+2,l+20,22,2,Vr,.15),L(t,l,22,20,Dl.deep),L(t+1,l+1,20,18,Dl.base),L(t,l,22,1,Dl.hi,.35),L(t,l,1,20,Dl.hi,.2);for(const u of[6,12])L(t+1,l+u,20,2,Dl.sh),L(t+1,l+u,20,1,Dl.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;L(c,l+1,d,5,i[u]),L(c,l+1,d,1,qt(i[u],1),.35),c+=d+1}c=t+2;for(let u=0;u<4;u++)L(c,l+7,4,5,i[u+3]),L(c,l+7,4,1,qt(i[u+3],1),.25),c+=5;L(t+2,l+14,4,4,"#FFD54F"),L(t+8,l+14,7,4,"#90CAF9"),r&&L(t,l-1,22,1,r,.7)}function AE(t,l){L(t+2,l+11,6,2,Vr,.1),L(t+2,l+8,6,4,"#8B5E3C"),L(t+1,l+7,8,2,zl("#A06E48",.3)),L(t+2,l+7,6,1,qt("#A06E48",.5),.4),L(t+1,l+3,3,4,"#2E7D32"),L(t+5,l+2,3,4,"#2E7D32"),L(t+2,l+1,4,4,"#43A047"),L(t+3,l+0,3,3,"#66BB6A"),st(t+4,l,"#81C784"),st(t+3,l+1,"#A5D6A7",.4)}function DE(t,l){pa(t+4,l-4,"down"),pa(t+16,l-4,"down"),pa(t+28,l-4,"down"),L(t+3,l+24,34,3,Vr,.15),L(t,l+2,36,18,un.deep),L(t+1,l+3,34,16,un.base),L(t+1,l+3,34,1,un.hi,.35);for(let r=0;r<14;r+=3)L(t+1,l+4+r,34,1,zl(un.base,.2),.08);L(t,l+20,36,4,un.deep),L(t+1,l+21,34,2,un.sh),L(t+6,l+7,10,6,"#1A1A24"),L(t+7,l+8,8,4,"#0C1420"),L(t+8,l+9,4,1,"#2A6898",.4),L(t+20,l+8,6,4,"#F0F0F0"),L(t+15,l+7,3,3,"#ECEFF1"),st(t+16,l+8,"#795548"),pa(t+4,l+24,"up"),pa(t+16,l+24,"up"),pa(t+28,l+24,"up")}function TE(t,l){L(t+2,l+16,36,3,Vr,.15),L(t,l,36,5,"#5D4037"),L(t+1,l+1,34,3,"#6D4C41"),L(t+1,l+1,34,1,qt("#6D4C41",.5),.3),L(t,l+5,36,8,"#5D4037"),L(t+2,l+6,15,6,"#6D4C41"),L(t+3,l+6,13,1,qt("#6D4C41",.5),.35),L(t+19,l+6,15,6,"#6D4C41"),L(t+20,l+6,13,1,qt("#6D4C41",.5),.35),L(t+17,l+6,2,6,"#5D4037"),L(t,l+13,36,3,zl("#5D4037",1)),L(t-2,l+2,3,12,"#5D4037"),L(t+35,l+2,3,12,"#5D4037"),L(t+4,l+7,6,4,"#FF8A65"),L(t+5,l+7,4,1,qt("#FF8A65",1),.35)}function zE(t,l){L(t+2,l+10,22,2,Vr,.12),L(t,l,22,8,Dl.deep),L(t+1,l+1,20,6,Dl.base),L(t+1,l+1,20,1,Dl.hi,.3),L(t,l+8,22,2,Dl.sh),L(t+3,l+2,6,4,"#F0F0F0"),L(t+13,l+3,3,3,"#ECEFF1"),st(t+14,l+4,"#795548")}function ME(t,l){L(t+1,l+14,10,2,Vr,.12),L(t,l,10,14,"#546E7A"),L(t,l,10,1,qt("#546E7A",1),.35),L(t+1,l+1,8,3,"#78909C"),L(t+1,l+5,8,4,"#37474F"),st(t+2,l+6,"#EF5350"),st(t+4,l+6,"#66BB6A"),L(t+2,l+11,4,2,"#ECEFF1")}function FE(t,l){L(t+2,l+16,26,3,Vr,.18),L(t,l,26,10,un.deep),L(t+1,l+1,24,8,un.base),L(t+1,l+2,24,1,un.hi,.2),L(t+1,l+4,24,1,zl(un.base,.2),.1),L(t+1,l+6,24,1,un.hi,.15),L(t+1,l+1,24,1,un.hi,.4),L(t+1,l+1,1,8,un.hi,.2),L(t,l+10,26,5,un.deep),L(t+1,l+11,24,3,un.sh),L(t+1,l+10,24,1,zl(un.base,1.5),.4),L(t+1,l+14,24,1,un.base,.15),L(t+2,l+12,10,1,un.deep,.4),L(t+14,l+12,10,1,un.deep,.4),st(t+7,l+11,"#C8D0D8",.6),st(t+19,l+11,"#C8D0D8",.6),L(t+6,l-5,14,7,"#1E1E28"),L(t+7,l-4,12,5,"#0C1420"),L(t+8,l-3,5,1,"#2A6898",.6),L(t+8,l-2,8,1,"#1A3858",.4),L(t+8,l-1,3,1,"#2A6898",.35),st(t+7,l-4,"#4A98D8",.25),st(t+12,l+1,"#4CAF50",.4),L(t+12,l+2,2,3,"#586878"),L(t+10,l+4,6,1,"#8898A8"),L(t+6,l+4,12,4,"#222228"),L(t+6,l+4,12,1,"#333338",.4);for(let r=0;r<5;r++)st(t+7+r*2,l+5,"#444",.6),st(t+7+r*2,l+6,"#3A3A3E",.4);L(t+20,l+5,3,4,"#333338"),L(t+20,l+5,3,1,"#444448"),L(t+1,l+3,4,4,"#F0EDE8"),L(t+1,l+3,4,1,"#F8F6F2"),st(t+2,l+5,"#6D4C41")}function pa(t,l,r){L(t+1,l+9,10,2,Vr,.1),st(t+5,l+9,"#1E1E22"),st(t+1,l+10,"#1A1A1E"),st(t+9,l+10,"#1A1A1E"),st(t+3,l+11,"#1A1A1E"),st(t+7,l+11,"#1A1A1E"),L(t+1,l+2,8,6,El.base),L(t+2,l+3,6,4,El.hi,.35),L(t+2,l+3,6,1,qt(El.hi,.5),.25),L(t+1,l+7,8,1,El.deep),r==="up"?(L(t,l+7,10,3,El.deep),L(t+1,l+8,8,1,El.sh)):(L(t,l-1,10,3,El.deep),L(t+1,l,8,1,El.sh)),L(t,l+3,1,4,El.sh),L(t+9,l+3,1,4,El.sh)}const Tg={bookshelf:(t,l,r)=>NE(t,l,r.accent),plant:(t,l)=>AE(t,l),"meeting-table":(t,l)=>DE(t,l),sofa:(t,l)=>TE(t,l),"coffee-table":(t,l)=>zE(t,l),"coffee-machine":(t,l)=>ME(t,l),window:(t,l,r)=>vE(t,l,r.windowW??16,r.windowH??14),picture:(t,l,r)=>wE(t,l,r.pictureColor??"#1565C0"),clock:(t,l)=>kE(t,l),whiteboard:(t,l)=>jE(t,l),"bulletin-board":(t,l)=>SE(t,l),shelf:(t,l)=>CE(t,l),screen:(t,l)=>EE(t,l)};function gi(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 RE(t){for(const l of t.wallDecorations){const r=t.rooms[l.room];if(!r)continue;const{x:i,y:c}=gi(l,r),u=Tg[l.type];u&&u(i,c,l)}}function _E(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}=gi(i,c),m=Tg[i.type];m&&l.push({y:d,draw:()=>m(u,d,i)})}}function Hr(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}=gi(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 OE={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 nh(t){return OE[t]??{w:16,h:16}}function Ff(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}=gi(u,d),f=nh(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}=gi(u,d),f=nh(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}=gi(d,m),g=nh(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 BE=[{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:"🖥️"}],gc=16,LE=4,xa=4,Ec=2,vt=4,Ur=4;let Le=Ng(7);const Oc={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};let pl=Hr(Le);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 Kt={};function $E(t){const l={};for(let r=0;r<t.length&&r<Le.desks.length;r++)l[t[r]]=Le.desks[r];return l}let Lt,ba=null,ya=null,nr=!1,yl=null,Pn=null,jn=null,cn=null,di=null,Nl=null;function HE(t,l){const{wx:r,wy:i,ww:c,wh:u,wallColor:d,baseboardColor:m}=t,x=zl(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){L(y.sx,i,y.sw,u,d);for(let b=0;b<u;b+=4)L(y.sx,i+b,y.sw,1,f,.08),L(y.sx,i+b+2,y.sw,1,x,.05);wi(Math.round(y.sx*7+i*13));for(let b=0;b<y.sw;b+=3)Tl()>.4&&L(y.sx+b,i,1,u,f,.04);L(y.sx,i,y.sw,2,f,.3),L(y.sx,i,y.sw,1,qt(d,1),.2),L(y.sx,i+u-2,y.sw,2,x,.3),L(y.sx,i+u,y.sw,Ec,m),L(y.sx,i+u,y.sw,1,qt(m,.5),.4)}l&&(L(l.x-1,i,1,u+Ec,"#4A3828"),L(l.x+l.w,i,1,u+Ec,"#4A3828"),L(l.x,i,l.w,1,"#0A0808",.12)),L(t.fx,t.fy,t.fw,3,"#0A0808",.12),L(t.fx,t.fy+3,t.fw,2,"#0A0808",.06)}function UE(t){const l="#504038",r=zl(l,.5),i=qt(l,.5),c=t.wx-Ur,u=t.wy,d=t.wh+Ec+t.fh;L(c,u,Ur,d,l),L(c,u,1,d,i,.3),L(c+Ur-1,u,1,d,r,.4);for(let x=0;x<d;x+=6)L(c+1,u+x,Ur-2,1,i,.06);const m=t.wx+t.ww;L(m,u,Ur,d,l),L(m,u,1,d,i,.2),L(m+Ur-1,u,1,d,r,.3)}function Rf(t){const{fx:l,fy:r,fw:i,fh:c}=t,u="#B08040",d="#C89848",m="#8A6030",x="#6A4820";L(l,r,i,c,u),wi(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=Tl()>.5?d:u;L(v,r+f,S,4,j,.25),L(v,r+f,S,1,d,.3),L(v,r+f+4,S,1,x,.35),b>=l&&b<l+i&&L(b,r+f,1,4,x,.2),L(v,r+f+2,S,1,m,.1)}}L(l,r,i,2,"#0A0808",.08),L(l,r,2,c,"#0A0808",.06)}function L0(t){const{fx:l,fy:r,fw:i,fh:c}=t,u="#1C2A38",d="#101820";wi(99),L(l,r,i,c,u);for(let m=0;m<c;m+=gc)for(let x=0;x<i;x+=gc){const f=Math.min(gc,i-x),g=Math.min(gc,c-m);Tl()>.5&&L(l+x,r+m,f,g,qt(u,.2),.15),L(l+x+2,r+m+2,f-4,g-4,qt(u,.3),.08),L(l+x,r+m,f,1,d,.5),L(l+x,r+m,1,g,d,.5),L(l+x+1,r+m+1,1,g-1,qt(u,.4),.1),Tl()>.85&&st(l+x+4+Math.floor(Tl()*8),r+m+4+Math.floor(Tl()*8),"#3A6A9A",.08)}}function IE(t){const{fx:l,fy:r,fw:i,fh:c}=t,u="#387848",d="#4A9058",m="#285E38";L(l,r,i,c,u),wi(77);for(let f=0;f<c;f+=2)for(let g=0;g<i;g+=2)Tl()>.5&&st(l+g,r+f,d,.1),Tl()>.8&&st(l+g+1,r+f+1,m,.12);const x=5;L(l+x,r+x,i-x*2,1,d,.45),L(l+x,r+c-x-1,i-x*2,1,m,.45),L(l+x,r+x,1,c-x*2,d,.35),L(l+i-x-1,r+x,1,c-x*2,m,.35)}function YE(t){const{fx:l,fy:r,fw:i,fh:c}=t,u="#D8C490",d="#B09060",m="#907848";wi(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(l+f,r+x,g,y,b),L(l+f+1,r+x+1,g-2,1,qt(b,.4),.2),L(l+f+1,r+x+1,1,y-2,qt(b,.4),.15),L(l+f+g-2,r+x+2,1,y-3,zl(b,.4),.15),L(l+f+2,r+x+y-2,g-3,1,zl(b,.4),.15),L(l+f,r+x,g,1,m,.3),L(l+f,r+x,1,y,m,.3)}}function qE(){const{canvasW:t,canvasH:l,rooms:r,doors:i}=Le,c="#2A1E14",u="#3A2E24";if(L(0,0,t,xa,c),L(0,l-xa,t,xa,c),L(0,0,xa,l,c),L(t-xa,0,xa,l,c),L(0,0,t,1,u,.3),L(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-vt/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)??xa+Ur+54)-E/2,F=((S==null?void 0:S.doorX)??x+vt/2+Ur+54)-E/2,B=((b==null?void 0:b.doorY)??m.fy+20)-j/2;L(0,g,A,vt,c),L(A+E,g,f-A-E,vt,c),L(f+vt,g,F-f-vt,vt,c),L(F+E,g,t-F-E,vt,c),L(0,g,A,1,u,.3),L(A+E,g,f-A-E,1,u,.3),L(f+vt,g,F-f-vt,1,u,.3),L(F+E,g,t-F-E,1,u,.3),L(f,0,vt,C,c),L(f,C+j,vt,g-C-j,c),L(f,g+vt,vt,B-g-vt,c),L(f,B+j,vt,l-B-j,c),L(f,0,1,C,u,.2),L(f,C+j,1,g-C-j,u,.2),L(f,g+vt,1,B-g-vt,u,.2),L(f,B+j,1,l-B-j,u,.2),L(f,C,vt,j,"#C4A070"),L(f+vt/2,C,vt/2,j,"#3A4858"),L(f,B,vt,j,"#7AA880"),L(f+vt/2,B,vt/2,j,"#C8B890");const $="#4A3828";L(f,C-1,vt,1,$),L(f,C+j,vt,1,$),L(A-1,g,1,vt,$),L(A+E,g,1,vt,$),L(F-1,g,1,vt,$),L(F+E,g,1,vt,$),L(f,B-1,vt,1,$),L(f,B+j,vt,1,$)}const $0=new Map;function XE(t){const l=`${t.hairStyle??""}|${t.outfitStyle??""}|${t.accessory??""}`;let r=$0.get(l);if(!r){const i=Wf("mini-seated:default"),c=sg(i,t);r=c?c.layers.flatMap(u=>u.pixels):[],$0.set(l,r)}return r}function VE(t,l,r){Qf(Lt,XE(r),t,l,r)}function GE(t,l,r,i,c){pa(t+8,l+20,"up"),c||VE(t+8,l+0+i,r),FE(t,l+14)}function KE(t,l,r,i,c){const u=i in z0?i:"down",d=c%4,m=z0[u][d];Qf(Lt,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(Lt,f.pixels,t,l+x,r)}Lt.globalAlpha=1}function WE(t){const l={};let r=0;for(const i of t){const c=Kt[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=Le.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 _f(t,l,r,i){const c=Le.adjacency[r];if(!c)return[];const u=c.find(g=>g.room===i);if(!u)return[];const d=Le.doors[u.door];if(!d)return[];const m=[],x=Le.corridorY[r]??l,f=Le.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=Le.adjacency[t.room];if(!r)return[];if(!r.find(c=>c.room===l)){for(const c of r){const u=Le.adjacency[c.room];if(u!=null&&u.find(d=>d.room===l)){const d=_f(t.x,t.y,t.room,c.room),m=d[d.length-1],x=_f((m==null?void 0:m.x)??t.x,(m==null?void 0:m.y)??t.y,c.room,l);return[...d,...x]}}return[]}return _f(t.x,t.y,t.room,l)}function QE(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 ZE(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(Le.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=Le.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=Le.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(Le.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=Le.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=QE(r),r.walkTimer=0}function JE(t,l,r){const{canvasW:i,canvasH:c,rooms:u}=Le;Lt.clearRect(0,0,i,c),L(0,0,i,c,"#2A1E14");const d={wood:Rf,dark:L0,carpet:IE,tile:YE};for(const y of Object.values(u))(d[y.floorType]??Rf)(y);const m=Object.keys(u);if(m.length>=4){const y=u.exec,b=u.meet,{doors:v}=Le;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;Rf({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}=Le,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))HE(y,x[y.id]),UE(y);qE(),RE(Le);const f=[],g=new Set(Object.values(Kt).map(y=>y.room));_E(Le,f,g);for(const[y,b]of Object.entries(Kt)){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(GE(b.dx,b.dy,j,S?v.bobY:0,!S),S&&E){const C=Oc[y]??"#388bfd";L(b.dx+7,b.dy+14-4,12,5,C,.15),st(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:()=>KE(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 pl){const b=ya===y.id,v=Mg(y);if(Lt.save(),Lt.globalAlpha=b?.9:.5,Lt.fillStyle=y.color,Lt.fillRect(v.cx-1,v.botY-2,3,3),b){const S=zg(y);Lt.globalAlpha=.3,Lt.strokeStyle=y.color,Lt.lineWidth=1,Lt.strokeRect(S.x-1,S.y-1,S.w+2,S.h+2)}Lt.restore()}if(nr){const y=new Set(Object.values(Kt).map(b=>b.room));if(yl&&yl!==Pn)if(yl.startsWith("desk:")){const b=yl.slice(5),v=Kt[b];v&&O0(Lt,v.dx,v.dy,"#FBBF24")}else _0(Lt,Le,yl,"#FBBF24",y);if(Pn)if(Pn.startsWith("desk:")){const b=Pn.slice(5),v=Kt[b];v&&O0(Lt,v.dx,v.dy,"#3B82F6")}else _0(Lt,Le,Pn,"#3B82F6",y)}if(ba){const y=Kt[ba],b=t[ba];y&&b&&(Lt.save(),Lt.globalAlpha=.25,Lt.fillStyle=Oc[ba]??"#fff",b.state==="sitting"?Lt.fillRect(y.dx-1,y.dy+6,28,30):Lt.fillRect(Math.round(b.x)-1,Math.round(b.y)-1,14,24),Lt.restore())}}function PE({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),B=k.useRef(LE),[$,_]=k.useState(!1),[V,K]=k.useState(null),[Y,T]=k.useState(null),U=k.useRef({}),O=k.useRef({}),Z=k.useRef([]),ne=k.useRef([]);k.useEffect(()=>{nr=$},[$]),k.useEffect(()=>{di=V,Nl=Y},[V,Y]),k.useEffect(()=>{Ne.getPreferences().then(fe=>{const he=fe.furnitureOverrides;he&&Object.keys(he).length>0&&(U.current=he,Le=M0(Le,he));const be=fe.deskOverrides;if(be&&Object.keys(be).length>0){O.current=be,F0(Kt,be);for(const[_e,Me]of Object.entries(Kt)){const ve=A.current[_e];ve&&(ve.homeX=Me.dx+8,ve.homeY=Me.dy+34)}}const Ce=fe.removedFurniture;Ce&&Ce.length>0&&(Z.current=Ce,Le=Mf(Le,Ce));const ze=fe.addedFurniture;ze&&ze.length>0&&(ne.current=ze,Le=R0(Le,ze)),pl=Hr(Le)}).catch(()=>{})},[]);const W=k.useRef({roleStatuses:r,activeExecs:i,getRoleSpeech:b,getAppearance:v});W.current={roleStatuses:r,activeExecs:i,getRoleSpeech:b,getAppearance:v};const I=k.useMemo(()=>t.map(fe=>fe.id),[t]),P=k.useRef(Le);k.useEffect(()=>{const fe=I.length,he=Eg(fe,P.current.preset);let be=Ng(fe,he);Z.current.length>0&&(be=Mf(be,Z.current)),ne.current.length>0&&(be=R0(be,ne.current)),Object.keys(U.current).length>0&&(be=M0(be,U.current)),Le=be,P.current=be,Kt=$E(I),Object.keys(O.current).length>0&&F0(Kt,O.current),pl=Hr(be),A.current=WE(I);const Ce=j.current;Ce&&(Ce.width=be.canvasW,Ce.height=be.canvasH),ke()},[I]);const re=k.useCallback(fe=>{var he,be;return((be=(he=W.current).getAppearance)==null?void 0:be.call(he,fe))??Th(fe)},[]),ke=k.useCallback(()=>{const fe=E.current,he=j.current;if(!fe||!he)return;const be=fe.parentElement;if(!be)return;const Ce=be.clientWidth,ze=be.clientHeight;if(Ce===0||ze===0)return;const{canvasW:_e,canvasH:Me}=Le;let ve=Math.floor(Math.min(Ce/_e,ze/Me));ve=Math.max(2,Math.min(ve,5)),B.current=ve,he.style.width=_e*ve+"px",he.style.height=Me*ve+"px",fe.style.width=_e*ve+"px",fe.style.height=Me*ve+"px"},[]);k.useEffect(()=>{var Me;const fe=j.current;if(!fe)return;const he=fe.getContext("2d");if(!he)return;Lt=he,bE(he),ke();const be=new ResizeObserver(()=>ke()),Ce=(Me=E.current)==null?void 0:Me.parentElement;Ce&&be.observe(Ce);let ze;const _e=()=>{F.current++,ZE(A.current,F.current),JE(A.current,re,W.current.roleStatuses),M(),ze=requestAnimationFrame(_e)};return ze=requestAnimationFrame(_e),()=>{cancelAnimationFrame(ze),be.disconnect()}},[re,ke]),k.useEffect(()=>{const fe=C.current;if(!fe)return;fe.innerHTML="";const he={};for(const Ce of t)he[Ce.id]=Ce.name;for(const Ce of I){const ze=Oc[Ce]??"#8b949e",_e=he[Ce],Me=_e&&_e.toLowerCase()!==Ce.toLowerCase()?`${Ce.toUpperCase()} · ${_e}`:Ce.toUpperCase(),ve=document.createElement("div");ve.className="td-nametag",ve.dataset.role=Ce;const Oe=document.createElement("span");Oe.className="td-dot",Oe.style.background=ze,ve.appendChild(Oe),ve.appendChild(document.createTextNode(Me)),fe.appendChild(ve);const Je=document.createElement("div");Je.className="td-bubble",Je.dataset.role=Ce,Je.dataset.type="bubble",fe.appendChild(Je)}const be={meeting:()=>{const Ce=l[0];Ce?u(Ce.id):d()},bulletin:d,decisions:m,knowledge:x,settings:f,theme:g,stats:y};for(const Ce of pl){const ze=document.createElement("div");ze.className="td-facility-label",ze.dataset.facility=Ce.id,ze.textContent=`${Ce.icon} ${Ce.label}`,ze.style.borderColor=`${Ce.color}44`;const _e=be[Ce.id];_e&&ze.addEventListener("click",_e),ze.addEventListener("mouseenter",()=>{ya=Ce.id}),ze.addEventListener("mouseleave",()=>{ya=null}),fe.appendChild(ze)}},[I,t,l,u,d,m,x,f,g,y]);const M=k.useCallback(()=>{var Me;const fe=C.current;if(!fe)return;const he=B.current,be=A.current,{getRoleSpeech:Ce,roleStatuses:ze,activeExecs:_e}=W.current;for(const ve of Object.keys(be)){const Oe=be[ve],Je=Kt[ve];if(!Je)continue;let jt,$t,yt;Oe.state==="sitting"?(jt=Je.dx+13,yt=Je.dy+2,$t=Je.dy+37):(jt=Math.round(Oe.x)+6,yt=Math.round(Oe.y)-2,$t=Math.round(Oe.y)+18);const Xt=jt/Le.canvasW*100,ae=fe.querySelector(`.td-nametag[data-role="${ve}"]`);if(ae){ae.style.left=Xt+"%",ae.style.top=$t*he+2+"px";const Fe=ae.querySelector(".td-dot");if(Fe){const Ye=ze[ve]==="working";Fe.style.background=Ye?"#FBBF24":Oc[ve]??"#8b949e",Ye?Fe.style.animation="td-pulse 1s ease-in-out infinite":Fe.style.animation=""}}const me=fe.querySelector(`.td-bubble[data-role="${ve}"]`);if(me){const Fe=ze[ve]==="working",Ye=(Me=_e.find(Te=>Te.roleId===ve))==null?void 0:Me.task,xe=Ce(ve),q=Fe&&Ye?Ye.slice(0,60):xe?xe.slice(0,60):"";q&&Oe.state==="sitting"?(me.style.display="",me.style.left=Xt+"%",me.style.top=(yt-10)*he+"px",me.textContent=q):me.style.display="none"}}for(const ve of pl){const Oe=fe.querySelector(`.td-facility-label[data-facility="${ve.id}"]`);if(Oe){const Je=Mg(ve);Oe.style.left=Je.cx/Le.canvasW*100+"%",Oe.style.top=Je.botY*he-4+"px",Oe.classList.toggle("td-facility-label--hover",ya===ve.id)}}},[]),z=k.useCallback(fe=>{const he=j.current;if(!he)return null;const be=he.getBoundingClientRect(),Ce=B.current,ze=(fe.clientX-be.left)/Ce,_e=(fe.clientY-be.top)/Ce,Me=A.current;for(const[ve,Oe]of Object.entries(Kt)){if(!Me[ve])continue;const Je=Me[ve];if(Je.state==="sitting"){if(ze>=Oe.dx&&ze<=Oe.dx+26&&_e>=Oe.dy&&_e<=Oe.dy+40)return{type:"role",id:ve}}else if(ze>=Je.x-2&&ze<=Je.x+14&&_e>=Je.y-2&&_e<=Je.y+20)return{type:"role",id:ve}}for(const ve of pl){const Oe=zg(ve);if(ze>=Oe.x&&ze<=Oe.x+Oe.w&&_e>=Oe.y&&_e<=Oe.y+Oe.h)return{type:"facility",id:ve.id}}return null},[]),G=k.useCallback(fe=>{const he=j.current;if(!he)return{mx:0,my:0};const be=he.getBoundingClientRect(),Ce=B.current;return{mx:(fe.clientX-be.left)/Ce,my:(fe.clientY-be.top)/Ce}},[]),D=k.useCallback(fe=>{Ne.updatePreferences(fe).catch(()=>{})},[]),ue=k.useCallback(fe=>{const he=[...Z.current,fe];Z.current=he,Le=Mf(Le,[fe]),pl=Hr(Le),Pn=null,yl=null,D({removedFurniture:he})},[D]),Ee=k.useCallback((fe,he)=>{if(!di||!Nl)return;let be=null;for(const[Oe,Je]of Object.entries(Le.rooms)){const jt=Nl==="wall"?Je.wx:Je.fx,$t=Nl==="wall"?Je.wy:Je.fy,yt=Nl==="wall"?Je.ww:Je.fw,Xt=Nl==="wall"?Je.wh:Je.fh;if(fe>=jt&&fe<=jt+yt&&he>=$t&&he<=$t+Xt){be=Oe;break}}if(!be)return;const Ce=Le.rooms[be],ze=Nl==="wall"?Ce.wx:Ce.fx,_e=Nl==="wall"?Ce.wy:Ce.fy,Me={id:`user-${di}-${Date.now()}`,type:di,room:be,zone:Nl,offsetX:Math.round(fe-ze),offsetY:Math.round(he-_e)},ve=[...ne.current,Me];ne.current=ve,Nl==="wall"?Le.wallDecorations.push(Me):Le.furniture.push(Me),pl=Hr(Le),D({addedFurniture:ve}),K(null),T(null)},[D]),ge=k.useCallback(fe=>{const he=j.current;if(nr&&jn){const{mx:Ce,my:ze}=G(fe),Me=[...Le.furniture,...Le.wallDecorations].find(Je=>Je.id===jn.defId);if(!Me)return;const ve=Ce-jn.startMx,Oe=ze-jn.startMy;Me.offsetX=Math.round(jn.origOffX+ve),Me.offsetY=Math.round(jn.origOffY+Oe),pl=Hr(Le),he&&(he.style.cursor="grabbing");return}if(nr&&cn){const{mx:Ce,my:ze}=G(fe),_e=Kt[cn.roleId];if(!_e)return;_e.dx=Math.round(cn.origDx+(Ce-cn.startMx)),_e.dy=Math.round(cn.origDy+(ze-cn.startMy));const Me=A.current[cn.roleId];Me&&(Me.homeX=_e.dx+8,Me.homeY=_e.dy+34),he&&(he.style.cursor="grabbing");return}if(nr){const{mx:Ce,my:ze}=G(fe);if(di){he&&(he.style.cursor="crosshair");return}const _e=new Set(Object.values(Kt).map(ve=>ve.room)),Me=Ff(Le,Ce,ze,_e);if(Me)yl=Me;else{const ve=B0(Kt,Ce,ze);yl=ve?`desk:${ve}`:null}ba=null,ya=null,he&&(he.style.cursor=yl?"grab":"default");return}const be=z(fe);ba=(be==null?void 0:be.type)==="role"?be.id:null,ya=(be==null?void 0:be.type)==="facility"?be.id:null,yl=null,he&&(he.style.cursor=be?"pointer":"default")},[z,G]),Ae=k.useCallback(fe=>{if(!nr)return;const{mx:he,my:be}=G(fe);if(di){Ee(he,be),fe.preventDefault();return}const Ce=new Set(Object.values(Kt).map(Me=>Me.room)),ze=Ff(Le,he,be,Ce);if(ze){const ve=[...Le.furniture,...Le.wallDecorations].find(Oe=>Oe.id===ze);ve&&(Pn=ze,jn={defId:ze,startMx:he,startMy:be,origOffX:ve.offsetX,origOffY:ve.offsetY},fe.preventDefault());return}const _e=B0(Kt,he,be);if(_e){const Me=Kt[_e];Pn=`desk:${_e}`,cn={roleId:_e,startMx:he,startMy:be,origDx:Me.dx,origDy:Me.dy},fe.preventDefault();return}Pn=null},[G,Ee]),De=k.useCallback(fe=>{if(jn){const be=[...Le.furniture,...Le.wallDecorations].find(Ce=>Ce.id===jn.defId);if(be){const Ce={...U.current,[be.id]:{offsetX:be.offsetX,offsetY:be.offsetY}};U.current=Ce,D({furnitureOverrides:Ce}),pl=Hr(Le)}jn=null,j.current&&(j.current.style.cursor="grab");return}if(cn){const he=Kt[cn.roleId];if(he){const be={...O.current,[cn.roleId]:{dx:he.dx,dy:he.dy}};O.current=be,D({deskOverrides:be})}cn=null,j.current&&(j.current.style.cursor="grab")}},[D]),He=k.useCallback(fe=>{if(!nr)return;fe.preventDefault();const{mx:he,my:be}=G(fe),Ce=new Set(Object.values(Kt).map(_e=>_e.room)),ze=Ff(Le,he,be,Ce);ze&&ue(ze)},[G,ue]);k.useEffect(()=>{const fe=he=>{!nr||!Pn||(he.key==="Delete"||he.key==="Backspace")&&(Pn.startsWith("desk:")||ue(Pn))};return window.addEventListener("keydown",fe),()=>window.removeEventListener("keydown",fe)},[ue]);const ye=k.useCallback(()=>{if(jn){const he=[...Le.furniture,...Le.wallDecorations].find(be=>be.id===jn.defId);he&&(he.offsetX=jn.origOffX,he.offsetY=jn.origOffY,pl=Hr(Le)),jn=null}if(cn){const fe=Kt[cn.roleId];fe&&(fe.dx=cn.origDx,fe.dy=cn.origDy);const he=A.current[cn.roleId];he&&(he.homeX=fe.dx+8,he.homeY=fe.dy+34),cn=null}ba=null,ya=null,yl=null,j.current&&(j.current.style.cursor="default")},[]),We=k.useCallback(fe=>{if(nr)return;const he=z(fe);if(he){if(he.type==="role"){c(he.id);return}switch(he.id){case"meeting":{const be=l[0];be?u(be.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}}},[z,c,u,d,m,x,f,g,y]);return s.jsxs("div",{className:`td-scene${$?" td-scene--editing":""}`,children:[s.jsxs("div",{ref:E,className:"td-wrap",children:[s.jsx("canvas",{ref:j,width:Le.canvasW,height:Le.canvasH,className:"td-canvas",onClick:We,onMouseDown:Ae,onMouseUp:De,onMouseMove:ge,onMouseLeave:ye,onContextMenu:He}),s.jsx("div",{ref:C,className:"td-overlay"})]}),$&&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${$?" td-edit-btn--active":""}`,onClick:()=>{_(fe=>{const he=!fe;return he||(K(null),T(null)),he}),Pn=null,jn=null,cn=null},title:$?"Exit Edit Mode":"Edit Furniture Layout",children:[s.jsx("span",{className:"td-edit-btn__icon",children:$?"✓":"✎"}),s.jsx("span",{className:"td-edit-btn__label",children:$?"DONE":"EDIT"})]}),$&&s.jsx("div",{className:"td-palette",children:BE.map(fe=>s.jsx("button",{className:`td-palette__item${V===fe.type?" td-palette__item--active":""}`,onClick:()=>{V===fe.type?(K(null),T(null)):(K(fe.type),T(fe.zone))},title:fe.label,children:s.jsx("span",{children:fe.icon})},fe.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 eN({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 U;const[j,E]=k.useState(x??"character"),[C,A]=k.useState({...l}),[F,B]=k.useState(t.name),[$,_]=k.useState(!1),V=k.useCallback(()=>A(hi(S)),[S]),K=k.useCallback(()=>{const O=Th(t.id);A({...O}),i()},[t.id,i]),Y=k.useCallback(async()=>{r(C);const O=F.trim();if(m&&O&&O!==t.name){_(!0);try{await m(t.id,O)}catch{}_(!1)}c()},[C,r,c,F,t.name,t.id,m]),T=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:O=>B(O.target.value),disabled:$,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:O=>O.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:V,onReset:K,label:T,roleLevel:S})}):j==="office"?s.jsx("div",{className:"customize-body",children:s.jsx("div",{className:"customize-themes",children:Object.entries(Yr).map(([O,Z])=>s.jsxs("button",{className:`customize-theme-card ${u===O?"active":""}`,onClick:()=>d(O),children:[s.jsxs("div",{className:"customize-theme-preview",style:{background:Z.vars["--floor-light"],borderColor:Z.vars["--pixel-border"]},children:[s.jsx("div",{style:{background:Z.vars["--hud-bg"],height:8,borderBottom:`2px solid ${Z.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:Z.vars["--accent"],borderRadius:1}}),s.jsx("div",{style:{width:10,height:14,background:Z.vars["--active-green"],borderRadius:1}}),s.jsx("div",{style:{width:10,height:14,background:Z.vars["--idle-amber"],borderRadius:1}})]}),s.jsx("div",{style:{background:Z.vars["--hud-bg"],height:6,borderTop:`2px solid ${Z.vars["--pixel-border"]}`}})]}),s.jsxs("div",{className:"customize-theme-name",children:[Z.icon," ",Z.name]})]},O))})}):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(O=>s.jsxs("button",{onClick:()=>y==null?void 0:y({mode:O}),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(g==null?void 0:g.mode)===O?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(g==null?void 0:g.mode)===O?"rgba(255,255,255,0.08)":"transparent",color:(g==null?void 0:g.mode)===O?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center"},children:[s.jsx("div",{style:{fontWeight:600,marginBottom:2},children:O==="template"?"TEMPLATE":O==="llm"?"AI":"AUTO"}),s.jsx("div",{style:{fontSize:9,opacity:.7},children:O==="template"?"Static pool ($0)":O==="llm"?"LLM generated":"Detect engine"})]},O))}),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:O=>y==null?void 0:y({intervalSec:Number(O.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: $",((U=g==null?void 0:g.dailyBudgetUsd)==null?void 0:U.toFixed(2))??"1.00"]}),s.jsx("input",{type:"range",min:0,max:5,step:.25,value:(g==null?void 0:g.dailyBudgetUsd)??1,onChange:O=>y==null?void 0:y({dailyBudgetUsd:Number(O.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:O,label:Z})=>s.jsx("button",{onClick:()=>v==null?void 0:v(O),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(b??"auto")===O?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(b??"auto")===O?"rgba(255,255,255,0.08)":"transparent",color:(b??"auto")===O?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center",fontWeight:600},children:Z},O))}),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:Y,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 tN({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 T;(T=F.current)==null||T.focus()},[]);const B=[...((t==null?void 0:t.modified)??[]).map(T=>({status:"M",file:T})),...((t==null?void 0:t.untracked)??[]).map(T=>({status:"A",file:T}))],$=k.useRef(!1);k.useEffect(()=>{!$.current&&B.length>0&&!y&&(b(H0(B)),$.current=!0)},[B.length]);const _=k.useCallback(()=>{b(H0(B))},[B]),V=async()=>{S(null),A(null);try{const T=await i(y||void 0);A(T),b("")}catch(T){S(T instanceof Error?T.message:"Save failed")}},K=async T=>{if(confirm(`Restore from commit ${T.slice(0,7)}? This creates a new commit with those files.`)){E(!0);try{await u(T),E(!1)}catch(U){S(U instanceof Error?U.message:"Restore failed"),E(!1)}}};k.useEffect(()=>{const T=U=>{U.key==="Escape"&&r()};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[r]);const Y=T=>{T.key==="Enter"&&(T.metaKey||T.ctrlKey)&&V()};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:Y,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(T=>s.jsx("button",{onClick:()=>g(T),className:"flex-1 py-2 text-[11px] font-bold uppercase tracking-wider cursor-pointer",style:{background:f===T?"var(--hud-bg-alt)":"transparent",color:f===T?"var(--terminal-text)":"var(--terminal-text-muted)",borderBottom:f===T?"2px solid var(--accent)":"2px solid transparent"},children:T==="save"?"SAVE":"HISTORY"},T))}),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:B.length>0?s.jsxs("span",{style:{color:"var(--idle-amber)"},children:["* ",B.length," unsaved change",B.length>1?"s":""]}):s.jsx("span",{style:{color:"var(--active-green)"},children:"All changes saved"})}),B.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:B.map(({status:T,file:U})=>s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{style:{color:T==="A"?"var(--active-green)":"var(--idle-amber)",width:"14px"},children:T}),s.jsx("span",{style:{color:"var(--terminal-text-secondary)"},children:U})]},U))})]}),B.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:_,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:T=>b(T.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)"}})]}),B.length>0&&s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:V,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 T=B.map(U=>`${U.status} ${U.file}`).join(`
|
|
89
|
-
`);m(T)},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"]})]}),B.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(T=>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:T.shortSha}),s.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--terminal-text)"},children:T.message})]}),s.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:U0(T.date)})]}),s.jsx("button",{onClick:()=>K(T.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"})]},T.sha))})]})]})]})]})}function nN({onClose:t}){const[l,r]=k.useState(null),[i,c]=k.useState(!0),[u,d]=k.useState(null);return k.useEffect(()=>{Ne.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(bc,{label:"Roles",value:String(l.company.roleCount)}),s.jsx(bc,{label:"Avg Level",value:`Lv.${l.company.avgLevel}`}),s.jsx(bc,{label:"Total Tokens",value:l.company.formattedTokens}),s.jsx(bc,{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(lN,{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:rN(m)}),s.jsxs("span",{style:{color:"rgba(255,255,255,0.5)"},children:["$",x.costUsd.toFixed(2)]})]},m))})]})]})}function bc({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 lN({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 rN(t){return t.includes("opus")?"Opus":t.includes("sonnet")?"Sonnet":t.includes("haiku")?"Haiku":t.split("-").slice(0,2).join(" ")}function aN({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 Ne.getSyncRoles();i(A);const F=A.filter(B=>B.source.sync!=="off");if(F.length===0){u([]),j(null);return}try{const B=await xi.syncCheck(F.map(_=>({roleId:_.roleId,sourceId:_.source.id,currentVersion:_.source.upstream_version??_.source.forked_at??"0.0.0"})));j(!0);const $=[];for(const _ of B.updates){if(!_.hasUpdate)continue;const V=F.find(O=>O.roleId===_.roleId);if(!V)continue;const{character:K}=await xi.syncPull(_.sourceId),Y=[];V.persona.trim()!==K.persona.trim()&&Y.push({field:"persona",local:V.persona.slice(0,120)+(V.persona.length>120?"...":""),upstream:K.persona.slice(0,120)+(K.persona.length>120?"...":"")});const T=JSON.stringify(V.authority),U=JSON.stringify(K.authority);T!==U&&Y.push({field:"authority",local:`${V.authority.autonomous.length} autonomous, ${V.authority.needsApproval.length} approval`,upstream:`${K.authority.autonomous.length} autonomous, ${K.authority.needsApproval.length} approval`}),Y.length>0&&$.push({roleId:_.roleId,roleName:V.name,sourceId:_.sourceId,currentVersion:_.currentVersion,latestVersion:_.latestVersion,fields:Y})}u($)}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:B}=await xi.syncPull(A.sourceId);await Ne.applySyncUpdate({roleId:A.roleId,changes:{persona:F.persona,authority:F.authority},upstreamVersion:B}),y($=>new Set($).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 iN({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 Ne.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 Ne.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 Ne.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 B=F[F.length-1],$=["cto","cbo","pm","engineer","designer","qa","data-analyst"];for(const _ of $)if(B.toLowerCase().includes(_))return _}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(),B=Math.floor(F/6e4);if(B<1)return"just now";if(B<60)return`${B}m ago`;const $=Math.floor(B/60);return $<24?`${$}h ago`:`${Math.floor($/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(vc,{label:"Active Worktrees",count:b.length}),b.map(A=>s.jsx(Of,{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(vc,{label:"Pending Merge",count:v.length}),v.map(A=>s.jsx(Of,{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(vc,{label:"Stale",count:S.length}),S.map(A=>s.jsx(Of,{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(vc,{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 vc({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 Of({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 sN({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 oN({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(Yr).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 Bc=[0,1e4,5e4,15e4,4e5,1e6,25e5,5e6,1e7,25e6];function Rg(t){let l=1;for(let r=Bc.length-1;r>=0;r--)if(t>=Bc[r]){l=r+1;break}return Math.min(l,10)}function cN(t){const l=Rg(t);if(l>=10)return 1;const r=Bc[l-1],i=Bc[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:cN(c)}}return l}const uN=[{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 uN.filter(l=>l.check(t))}const dN={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍","data-analyst":"📊"},Nc={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},fN={cto:"아키텍처",cbo:"시장 분석",pm:"PRD 작성",engineer:"코딩",designer:"시안 제작",qa:"품질 검증"};function hN(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 mN({importJob:t,onImportDone:l}){var Fa,Ai,hr;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),[B,$]=k.useState({type:"none"}),[_,V]=k.useState(null),[K,Y]=k.useState(null),[T,U]=k.useState([]),[O,Z]=k.useState(!1),[ne,W]=k.useState([]),[I,P]=k.useState(0),[re,ke]=k.useState(!1),[M,z]=k.useState({}),[G,D]=k.useState("ceo"),[ue,Ee]=k.useState(null),[ge,Ae]=k.useState(!1),[De,He]=k.useState(!1),[ye,We]=k.useState({}),fe=k.useRef({}),[he,be]=k.useState(!1),[Ce,ze]=k.useState(null),[_e,Me]=k.useState({}),[ve,Oe]=k.useState([]),[Je,jt]=k.useState([]),[$t,yt]=k.useState(void 0),[Xt,ae]=k.useState(!1);k.useEffect(()=>{Ne.getStatus().then(R=>{yt(R.engine),ae(!!R.hasApiKey)}).catch(()=>{})},[]);const{getAppearance:me,setAppearance:Fe,resetAppearance:Ye,theme:xe,setTheme:q,speechSettings:Te,setSpeechSettings:$e,language:Ke,setLanguage:mt}=VC(),[Qe,It]=k.useState(null),[,an]=k.useState("character"),Nt=KC(),[ar,dl]=k.useState(!1),[ir,Fn]=k.useState(!1),[En,sn]=k.useState(!1),[we,Wt]=k.useState(!1),[Sa,fl]=k.useState(!1),[Ys,Ca]=k.useState(!1),[Un,qs]=k.useState(null);k.useEffect(()=>{const R=ie=>{(ie.metaKey||ie.ctrlKey)&&ie.key==="s"&&(ie.preventDefault(),Nt.dirtyCount>0&&dl(!0))};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[Nt.dirtyCount]),k.useEffect(()=>{if(!we)return;let R=!1;const ie=async()=>{try{const pe=await Ne.getGitStatus();R||qs(pe)}catch{}};ie();const ce=setInterval(ie,1e4);return()=>{R=!0,clearInterval(ce)}},[we]);const[bl,Gr]=k.useState(null),[Rl,_l]=k.useState(null),[Nn,Pt]=k.useState([]),[Qt,Ol]=k.useState(!1),Ea=k.useRef(!1),ki=k.useRef(null);let Xs=k.useRef(0);const ji=k.useRef(new Set),In=(R,ie,ce)=>{const pe={id:Xs.current++,type:R,text:ie,detail:ce};Pt(Se=>[...Se,pe])};k.useEffect(()=>{var R;Qt&&((R=ki.current)==null||R.scrollIntoView({behavior:"smooth"}))},[Nn,Qt]),k.useEffect(()=>{t&&(Ea.current||(Ea.current=!0,_l("Scanning knowledge sources..."),Pt([{id:0,type:"scan",text:"Starting knowledge import..."}]),Xs.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 R=>{var Se;const ie=(Se=R.body)==null?void 0:Se.getReader();if(!ie)return;const ce=new TextDecoder;let pe="";for(;;){const{done:et,value:Ze}=await ie.read();if(et)break;pe+=ce.decode(Ze,{stream:!0});const Ge=pe.split(`
|
|
90
|
-
`);pe=Ge.pop()||"";let rt="";for(const at of Ge)if(at.startsWith("event: "))rt=at.slice(7).trim();else if(at.startsWith("data: ")&&rt){try{const Ue=JSON.parse(at.slice(6));switch(rt){case"scanning":_l(`Scanning: ${Ue.path} (${Ue.fileCount} files)`),In("scan",`Found ${Ue.fileCount} files`,Ue.path);break;case"processing":Gr({index:Ue.index,total:Ue.total}),_l(`Importing knowledge... (${Ue.index}/${Ue.total})`),In("process",`Processing: ${Ue.file}`,`${Ue.index} / ${Ue.total}`);break;case"created":In("created",Ue.title,Ue.summary);break;case"skipped":In("process",`Skipped: ${Ue.file}`,Ue.reason);break;case"done":_l(null),Gr(null),In("done",`Import complete! ${Ue.created} created, ${Ue.skipped} skipped.`),Ht(`Knowledge import complete! ${Ue.created} documents imported.`,"#2E7D32"),l==null||l();break;case"error":_l(null),Gr(null),In("error",Ue.message),Ht(`Import failed: ${Ue.message}`,"#B71C1C"),l==null||l();break}}catch{}rt=""}}}).catch(R=>{_l(null),In("error",R.message),Ht(`Import error: ${R.message}`,"#B71C1C"),l==null||l()})))},[t]);const[Kr,Bl]=k.useState("iso"),[Ll,Wr]=k.useState(typeof window<"u"?window.innerWidth:1200);k.useEffect(()=>{const R=()=>Wr(window.innerWidth);return window.addEventListener("resize",R),()=>window.removeEventListener("resize",R)},[]);const vl=Ll<1024,[St,wl]=k.useState(!1),[sr,$l]=k.useState(560),[Yn,xn]=k.useState([]),[Qr,qn]=k.useState(null),[Zr,or]=k.useState(null),{sendMessage:Na}=YC();k.useEffect(()=>{Promise.all([Ne.getCompany().then(R=>{j(R.name),i(R.roles)}),Ne.getOrgTree().then(R=>{z(R.nodes),D(R.root)}).catch(()=>{}),Ne.getCostSummary().then(R=>Aa(Y0(R.byRole))).catch(()=>{})]).catch(R=>F(`Failed to load: ${R.message}`)).finally(()=>C(!1)),Ne.getProjects().then(u).catch(()=>{}),Ne.getStandups().then(m).catch(()=>{}),Ne.getWaves().then(f).catch(()=>{}),Ne.getDecisions().then(y).catch(()=>{}),Ne.getKnowledge().then(v).catch(()=>{})},[]),k.useEffect(()=>{Ne.getSessions().then(R=>{if(R.length>0){const ie=R.map(pe=>({...pe,messages:[]}));xn(ie);const ce=ie.find(pe=>pe.status==="active")??ie[0];qn(ce.id),wl(!0)}}).catch(R=>{console.error("Failed to load sessions",R)})},[]),k.useEffect(()=>{const R=()=>{fetch("/api/exec/status").then(ce=>ce.json()).then(ce=>{Me(ce.statuses??{}),Oe(ce.activeExecutions??[])}).catch(()=>{})};R();const ie=setInterval(R,3e3);return()=>clearInterval(ie)},[]);const An=k.useMemo(()=>{const R={..._e};if(Zr){const ie=Yn.find(ce=>ce.id===Zr);ie&&(R[ie.roleId]="working")}return R},[_e,Zr,Yn]);k.useEffect(()=>{B.type==="role"?Ne.getRole(B.roleId).then(V).catch(console.error):V(null)},[B]);const fn=()=>$({type:"none"}),Vs=async(R,ie)=>{const ce=r.find(Se=>Se.id===R),pe=(K==null?void 0:K.mode)==="ask";Y(null);try{const{jobId:Se}=await Ne.startJob({type:"assign",roleId:R,task:ie,readOnly:pe}),et=Nc[R]??"#666",Ze=`${R.toUpperCase()} · ${(ce==null?void 0:ce.name)??R}`;ke(!1),U([{jobId:Se,title:Ze,color:et}]),Yt.pushMessage({ts:Date.now(),roleId:"ceo",text:`[CEO → ${(ce==null?void 0:ce.name)??R}] ${pe?"Ask":"Assign"}: ${ie}`,type:"dispatch",targetRoleId:R})}catch(Se){Ht(`Failed to start job: ${Se instanceof Error?Se.message:"unknown"}`,"#C62828")}},Ht=(R,ie)=>{const ce=Date.now();jt(pe=>[...pe,{id:ce,message:R,color:ie}]),setTimeout(()=>jt(pe=>pe.filter(Se=>Se.id!==ce)),4e3)},Aa=R=>{var ce,pe;const ie=fe.current;for(const[Se,et]of Object.entries(R)){const Ze=((ce=ie[Se])==null?void 0:ce.level)??0;if(Ze>0&&et.level>Ze){const Ge=((pe=r.find(rt=>rt.id===Se))==null?void 0:pe.name)??Se.toUpperCase();Ht(`${Ge} leveled up to Lv.${et.level}!`,"#7C3AED")}}fe.current=R,We(R)};k.useEffect(()=>{const R={roles:Object.entries(ye).map(([pe,Se])=>({id:pe,level:Se.level,totalTokens:Se.totalTokens})),totalTokens:Object.values(ye).reduce((pe,Se)=>pe+Se.totalTokens,0),roleCount:r.length},ie=q0(R),ce=ji.current;for(const pe of ie)ce.has(pe.id)||ce.size>0&&Ht(`${pe.icon} Badge earned: ${pe.name}!`,"#D4A017");ji.current=new Set(ie.map(pe=>pe.id))},[ye,r.length]);const Gs=()=>{var ie;const R=T[T.length-1];R&&(Ht(`${R.title} completed`,R.color),Yt.pushMessage({ts:Date.now(),roleId:((ie=R.title.split(" · ")[0])==null?void 0:ie.toLowerCase())??"unknown",text:`[${R.title}] Job completed`,type:"dispatch"})),Ne.getStandups().then(m).catch(console.error),Ne.getCompany().then(ce=>i(ce.roles)).catch(console.error),Ne.getCostSummary().then(ce=>Aa(Y0(ce.byRole))).catch(()=>{})},Da=async R=>{Z(!1);try{const ie=await Ne.startJob({type:"wave",directive:R}),ce=ie.jobIds??(ie.jobId?[ie.jobId]:[]),pe=r.filter(et=>et.level==="c-level"),Se=ce.map((et,Ze)=>{var Ge,rt;return{jobId:et,roleId:((Ge=pe[Ze])==null?void 0:Ge.id)??`role-${Ze}`,roleName:((rt=pe[Ze])==null?void 0:rt.name)??`C-Level ${Ze+1}`}});Yt.pushMessage({ts:Date.now(),roleId:"ceo",text:`[CEO WAVE] "${R}" → ${Se.map(et=>et.roleName).join(", ")}`,type:"dispatch"}),Object.keys(M).length>0?(Ee({directive:R,rootJobs:Se}),Ae(!1)):(W(Se),P(0),ke(!1),Se.length>0&&U([{jobId:Se[0].jobId,title:`CEO WAVE · ${Se[0].roleId.toUpperCase()}`,color:"#B71C1C"}]))}catch(ie){Ht(`Failed to start wave: ${ie instanceof Error?ie.message:"unknown"}`,"#C62828")}},Si=()=>{Ne.getWaves().then(f).catch(console.error),Ne.getStandups().then(m).catch(console.error)},wn=()=>{Ne.getCompany().then(R=>i(R.roles)).catch(console.error)},Ci=async(R,ie)=>{await Ne.createRole(R),Fe(R.id,ie),wn(),Ht(`${R.name} hired!`,"#2E7D32")},Ks=async R=>{await Ne.deleteRole(R),wn(),ze(null),Ht(`${R.toUpperCase()} removed`,"#B71C1C")},Ta=async(R,ie)=>{await Ne.updateRole(R,ie),wn(),B.type==="role"&&B.roleId===R&&Ne.getRole(R).then(V).catch(console.error),ie.name&&Ht(`${R.toUpperCase()} renamed to "${ie.name}"`,"#1565C0")},cr=R=>{wl(!0)},Ws=async R=>{try{const ie=await Ne.createSession(R,"talk");xn(ce=>[ie,...ce]),qn(ie.id),wl(!0)}catch(ie){console.error("Failed to create session",ie),Ht(`Failed to create session: ${ie instanceof Error?ie.message:"API unreachable"}`,"#B71C1C")}},Qs=async R=>{try{const ie=await Ne.createSession(R,"talk");xn(ce=>[ie,...ce]),qn(ie.id)}catch(ie){console.error("Failed to create session",ie),Ht(`Failed to create session: ${ie instanceof Error?ie.message:"API unreachable"}`,"#B71C1C")}},ur=async R=>{const ie=ve.find(Se=>Se.roleId===R),ce=(ie==null?void 0:ie.jobId)??(ie==null?void 0:ie.id);if(ce&&An[R]==="working"){const Se=r.find(Ge=>Ge.id===R),et=Nc[R]??"#666",Ze=`${R.toUpperCase()} · ${(Se==null?void 0:Se.name)??R}`;U([{jobId:ce,title:Ze,color:et}]),ke(!1);return}const pe=Yn.find(Se=>Se.roleId===R);if(pe)qn(pe.id),Yt.setActiveChannelId(null);else try{const Se=await Ne.createSession(R,"talk");xn(et=>[Se,...et]),qn(Se.id),Yt.setActiveChannelId(null)}catch(Se){console.error("Failed to create session",Se)}wl(!0)},Xc=async R=>{try{await Ne.deleteSession(R),xn(ie=>{var pe;const ce=ie.filter(Se=>Se.id!==R);return Qr===R&&qn(((pe=ce[0])==null?void 0:pe.id)??null),ce})}catch(ie){console.error("Failed to delete session",ie),Ht(`Failed to close session: ${ie instanceof Error?ie.message:"API error"}`,"#B71C1C")}},Zs=async()=>{try{const{ids:R}=await Ne.deleteEmptySessions();if(R.length===0)return;xn(ie=>{var pe;const ce=ie.filter(Se=>!R.includes(Se.id));return Qr&&R.includes(Qr)&&qn(((pe=ce[0])==null?void 0:pe.id)??null),ce}),Ht(`Cleared ${R.length} empty session${R.length!==1?"s":""}`,"#2E7D32")}catch(R){Ht(`Failed to clear empty sessions: ${R instanceof Error?R.message:"API error"}`,"#B71C1C")}},Js=async()=>{if(!confirm("Close all sessions? This cannot be undone."))return;const R=Yn.map(ie=>ie.id);try{await Ne.deleteSessions(R),xn([]),qn(null),Ht("All sessions closed","#2E7D32")}catch(ie){Ht(`Failed to close sessions: ${ie instanceof Error?ie.message:"API error"}`,"#B71C1C")}},tl=(R,ie)=>{xn(ce=>ce.map(pe=>{if(pe.id!==R)return pe;const Se=[...pe.messages],et=Se[Se.length-1];if(et&&et.from==="role"&&et.status==="streaming"){const Ze=[...et.streamEvents??[],ie];Se[Se.length-1]={...et,streamEvents:Ze}}return{...pe,messages:Se}}))},Ei=(R,ie,ce,pe)=>{const Se={id:`msg-${Date.now()}-ceo`,from:"ceo",content:ie,type:ce==="do"?"directive":"conversation",status:"done",timestamp:new Date().toISOString(),attachments:pe},et={id:`msg-${Date.now()+1}-role`,from:"role",content:"",type:"conversation",status:"streaming",timestamp:new Date().toISOString(),streamEvents:[]};xn(Ze=>Ze.map(Ge=>Ge.id===R?{...Ge,messages:[...Ge.messages,Se,et],updatedAt:new Date().toISOString()}:Ge)),or(R),Na(R,ie,ce,{onThinking:Ze=>{xn(Ge=>Ge.map(rt=>{if(rt.id!==R)return rt;const at=[...rt.messages],Ue=at[at.length-1];return Ue&&Ue.from==="role"&&Ue.status==="streaming"&&(at[at.length-1]={...Ue,thinking:(Ue.thinking??"")+Ze}),{...rt,messages:at}})),tl(R,{type:"thinking",timestamp:Date.now(),text:Ze})},onText:Ze=>{xn(Ge=>Ge.map(rt=>{if(rt.id!==R)return rt;const at=[...rt.messages],Ue=at[at.length-1];return Ue&&Ue.from==="role"&&Ue.status==="streaming"&&(at[at.length-1]={...Ue,content:Ue.content+Ze}),{...rt,messages:at}}))},onToolUse:(Ze,Ge)=>{tl(R,{type:"tool",timestamp:Date.now(),toolName:Ze,toolInput:Ge})},onDispatch:(Ze,Ge)=>{tl(R,{type:"dispatch",timestamp:Date.now(),roleId:Ze,task:Ge})},onDispatchProgress:(Ze,Ge,rt)=>{var at;Ge==="tool"?tl(R,{type:"dispatch:progress",timestamp:Date.now(),roleId:Ze,progressType:"tool",toolName:rt.name,toolInput:rt.input}):Ge==="thinking"?tl(R,{type:"dispatch:progress",timestamp:Date.now(),roleId:Ze,progressType:"thinking",text:rt.text}):Ge==="text"?tl(R,{type:"dispatch:progress",timestamp:Date.now(),roleId:Ze,progressType:"text",text:(at=rt.text)==null?void 0:at.slice(-200)}):(Ge==="done"||Ge==="error")&&tl(R,{type:"dispatch:progress",timestamp:Date.now(),roleId:Ze,progressType:Ge})},onTurn:Ze=>{tl(R,{type:"turn",timestamp:Date.now(),turn:Ze})},onDone:()=>{xn(Ze=>Ze.map(Ge=>{if(Ge.id!==R)return Ge;const rt=Ge.messages.map(Ue=>Ue.status==="streaming"?{...Ue,status:"done"}:Ue),at=Ge.messages.length<=2?ie.slice(0,40).replace(/\n/g," "):Ge.title;return{...Ge,messages:rt,title:at}})),or(null)},onError:Ze=>{xn(Ge=>Ge.map(rt=>{if(rt.id!==R)return rt;const at=rt.messages.map(Ue=>Ue.status==="streaming"?{...Ue,status:"error",content:Ue.content||Ze}:Ue);return{...rt,messages:at}})),or(null)}},pe)},Vc=(R,ie)=>{xn(ce=>ce.map(pe=>pe.id===R?{...pe,mode:ie}:pe)),Ne.updateSession(R,{mode:ie}).catch(console.error)},za=new Date().toISOString().slice(0,10),hn=c[0],Ma={cto:"Chief Technology Officer",cbo:"Chief Business Officer",pm:"Product Manager",engineer:"Software Engineer",designer:"UI/UX Designer",qa:"QA Engineer"},Ni=R=>{const ie=Ma[R];if(!ie)return"";for(const ce of d){const pe=ce.content,Se=pe.indexOf(`## ${ie}`);if(Se===-1)continue;const et=pe.indexOf(`
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
## `,Se+10),Ge=(et===-1?pe.slice(Se):pe.slice(Se,et)).replace(/^## .+\n/,"").trim();if(Ge)return Ge.slice(0,1500)}return""},Yt=oE();k.useEffect(()=>{r.length>0&&Yt.syncDefaultMembers(r)},[r]);const fr=lE({roles:r,roleStatuses:_e,activeExecs:ve,getStandupSpeech:Ni});return hE({roles:r,roleStatuses:_e,activeExecs:ve,channels:Yt.channels,relationships:fr.relationships,pushMessage:Yt.pushMessage,speechSettings:Te,engineType:$t,hasApiKey:Xt}),E?s.jsxs("div",{className:"h-screen flex flex-col bg-[var(--floor-light)]",style:{fontFamily:"var(--pixel-font)"},children:[(Rl||Nn.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:()=>Ol(R=>!R),children:[Rl?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:Rl||"Knowledge import finished"}),bl&&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:`${bl.index/bl.total*100}%`,background:"#fff"}})}),s.jsx("span",{className:"text-[10px] opacity-70 shrink-0",children:Qt?"▲":"▼"})]}),Qt&&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:[Nn.map(R=>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:[R.type==="scan"&&"🔍",R.type==="process"&&"⚙️",R.type==="created"&&"✅",R.type==="done"&&"🎉",R.type==="error"&&"❌"]}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{style:{color:R.type==="error"?"#EF4444":R.type==="done"?"var(--active-green)":"var(--terminal-text)"},children:R.text}),R.detail&&s.jsx("div",{className:"text-[10px] truncate",style:{color:"var(--terminal-text-muted)"},children:R.detail})]})]},R.id)),s.jsx("div",{ref:ki})]})]}),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 R=Object.values(ye).reduce((et,Ze)=>et+Ze.totalTokens,0),ie=R>=1e6?`${(R/1e6).toFixed(1)}M`:R>=1e3?`${Math.round(R/1e3)}K`:String(R),ce=Math.min(100,Math.round(R/25e4*100)),pe=ve.length,Se=r.length>0?Math.round(pe/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:`${ce}%`,background:"linear-gradient(90deg,#22c55e,#34D399)"}})}),s.jsx("strong",{className:"text-[var(--active-green)]",children:ie})]}),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,#3b82f6,#60A5FA)"}})}),s.jsx("strong",{className:"text-[var(--terminal-text)]",children:Se})]})]})})(),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})]}),ve.length>0&&s.jsxs("span",{className:"text-amber-400",children:["Working: ",s.jsx("strong",{children:ve.length})]}),(()=>{const R={roles:Object.entries(ye).map(([ce,pe])=>({id:ce,level:pe.level,totalTokens:pe.totalTokens})),totalTokens:Object.values(ye).reduce((ce,pe)=>ce+pe.totalTokens,0),roleCount:r.length},ie=q0(R);return ie.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:ie.map(ce=>s.jsx("span",{title:`${ce.name}: ${ce.description}`,style:{fontSize:12,cursor:"default"},children:ce.icon},ce.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:za})]})]}),(Rl||Nn.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:()=>Ol(R=>!R),children:[Rl?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:Rl||"Knowledge import finished"}),bl&&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:`${bl.index/bl.total*100}%`,background:"#fff"}})}),s.jsx("span",{className:"text-[10px] opacity-70 shrink-0",children:Qt?"▲":"▼"})]}),Qt&&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:[Nn.map(R=>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:[R.type==="scan"&&"🔍",R.type==="process"&&"⚙️",R.type==="created"&&"✅",R.type==="done"&&"🎉",R.type==="error"&&"❌"]}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{style:{color:R.type==="error"?"#EF4444":R.type==="done"?"var(--active-green)":"var(--terminal-text)"},children:R.text}),R.detail&&s.jsx("div",{className:"text-[10px] truncate",style:{color:"var(--terminal-text-muted)"},children:R.detail})]})]},R.id)),s.jsx("div",{ref:ki}),Nn.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:Kr==="iso"?s.jsx(PE,{roles:r,projects:c,waves:x,standups:d,decisions:g,roleStatuses:An,activeExecs:ve,onRoleClick:R=>$({type:"role",roleId:R}),onProjectClick:R=>$({type:"project",projectId:R}),onBulletinClick:()=>$({type:"bulletin"}),onDecisionsClick:()=>$({type:"decisions"}),onKnowledgeClick:()=>$({type:"knowledge"}),onSettingsClick:()=>fl(!0),onThemeClick:()=>Ca(R=>!R),onStatsClick:()=>Fn(!0),knowledgeDocsCount:b.length,getRoleSpeech:fr.getSpeech,getAppearance:me,onHireClick:()=>be(!0)}):s.jsxs("div",{className:`${St?"max-w-full":"max-w-[1100px]"} mx-auto h-full p-4 flex flex-col gap-3 relative z-[1]`,children:[(()=>{const R=r.filter(ce=>ce.level==="c-level"),ie=r.filter(ce=>ce.level!=="c-level");return s.jsxs(s.Fragment,{children:[R.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"pixel-section-label",children:"LEADERSHIP"}),s.jsx("div",{className:`grid gap-2 ${R.length===1?"grid-cols-1":"grid-cols-2"}`,children:R.map(ce=>{var pe,Se;return s.jsx(X0,{role:ce,speech:fr.getSpeech(ce.id),onClick:()=>$({type:"role",roleId:ce.id}),liveStatus:An[ce.id],activeTask:(pe=ve.find(et=>et.roleId===ce.id))==null?void 0:pe.task,featured:!0,appearance:me(ce.id),xpLevel:(Se=ye[ce.id])==null?void 0:Se.level},ce.id)})})]}),s.jsx("div",{className:"pixel-section-label",children:"TEAM"}),s.jsxs("div",{className:`grid gap-2 ${St?"grid-cols-3":"grid-cols-4"}`,children:[ie.map(ce=>{var pe,Se;return s.jsx(X0,{role:ce,speech:fr.getSpeech(ce.id),onClick:()=>$({type:"role",roleId:ce.id}),liveStatus:An[ce.id],activeTask:(pe=ve.find(et=>et.roleId===ce.id))==null?void 0:pe.task,appearance:me(ce.id),xpLevel:(Se=ye[ce.id])==null?void 0:Se.level},ce.id)}),s.jsx("div",{className:"pixel-card pixel-card--hire",onClick:()=>be(!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:hn?()=>$({type:"project",projectId:hn.id}):void 0,style:hn?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(xc,{type:"meeting"})}),s.jsxs("div",{className:"fcc-body",children:[s.jsx("div",{className:"fcc-desc",children:"Projects, PRDs, and task boards"}),hn?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"fcc-title",children:['"',hn.name,'"']}),s.jsxs("div",{className:"fcc-meta",children:["Status: ",s.jsx("strong",{style:{color:"var(--active-green)"},children:hn.status})]})]}):s.jsx("div",{className:"fcc-meta",style:{fontStyle:"italic"},children:"No active projects"})]})]}),s.jsxs("div",{className:"facility-card-compact",onClick:()=>$({type:"bulletin"}),children:[s.jsxs("div",{className:"fcc-hdr",style:{background:"#64748b"},children:["📋"," BULLETIN"]}),s.jsx("div",{className:"fcc-canvas",children:s.jsx(xc,{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(R=>s.jsxs("div",{className:"fcc-item",children:["Wave ",R.id]},R.id)),d.slice(0,1).map(R=>s.jsxs("div",{className:"fcc-item",children:["Standup ",R.date]},R.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:()=>$({type:"decisions"}),children:[s.jsxs("div",{className:"fcc-hdr",style:{background:"#EF4444"},children:["📜"," DECISIONS"]}),s.jsx("div",{className:"fcc-canvas",children:s.jsx(xc,{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(R=>s.jsxs("div",{className:"fcc-item",children:["#",R.id," ",R.title]},R.id))]})]}),s.jsxs("div",{className:"facility-card-compact",onClick:()=>$({type:"knowledge"}),children:[s.jsxs("div",{className:"fcc-hdr",style:{background:"#0D9488"},children:["📚"," KNOWLEDGE"]}),s.jsx("div",{className:"fcc-canvas",children:s.jsx(xc,{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(R=>s.jsx("div",{className:"fcc-item",children:R.title},R.id))]})]})]})]})}),St&&s.jsx("div",{className:vl?"absolute inset-0 z-50":"contents",children:s.jsx(IC,{sessions:Yn,activeSessionId:Qr,roles:r,streamingSessionId:Zr,width:vl?Ll:sr,onWidthChange:vl?void 0:$l,onSwitchSession:qn,onCloseSession:Xc,onCreateSession:Ws,onClearEmpty:Zs,onCloseAll:Js,onSendMessage:Ei,onModeChange:Vc,onCloseTerminal:()=>wl(!1),chatChannels:Yt.channels,activeChatChannelId:Yt.activeChannelId,onSwitchChatChannel:Yt.setActiveChannelId,onCreateChatChannel:Yt.createChannel,onDeleteChatChannel:Yt.deleteChannel,onUpdateChatMembers:Yt.updateMembers,onUpdateChatTopic:Yt.updateTopic,unreadChannels:Yt.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:()=>Bl("card"),className:`view-toggle-btn ${Kr==="card"?"active":""}`,children:"CARD"}),s.jsx("button",{onClick:()=>Bl("iso"),className:`view-toggle-btn ${Kr==="iso"?"active":""}`,children:"OFFICE"}),s.jsx("span",{className:"mx-1",children:"|"}),s.jsxs("div",{style:{position:"relative"},children:[s.jsxs("button",{className:`theme-btn${Ys?" active":""}`,onClick:()=>Ca(R=>!R),title:"Office Theme",children:[((Fa=Yr[xe])==null?void 0:Fa.icon)??"","▾"]}),Ys&&s.jsx(oN,{theme:xe,onThemeChange:q,onClose:()=>Ca(!1)})]}),s.jsx("button",{className:"theme-btn",onClick:()=>fl(!0),title:"Settings",children:"⚙"}),s.jsx("span",{className:"mx-1",children:"|"}),s.jsxs("button",{onClick:()=>{Nt.state==="no-git"?Nt.initGit():Nt.state==="dirty"?dl(!0):Wt(!0)},title:Nt.state==="dirty"?`${Nt.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:Nt.state==="no-git"?"var(--terminal-text-muted)":Nt.state==="saving"||Nt.state==="dirty"?"var(--idle-amber)":Nt.state==="error"?"#EF5350":"var(--active-green)",animation:Nt.state==="saving"?"pulse 1s infinite":void 0}}),s.jsx("span",{style:{color:Nt.state==="dirty"?"var(--idle-amber)":"var(--terminal-text-muted)"},children:Nt.state==="no-git"?"No git":Nt.state==="saving"?"Saving...":Nt.state==="dirty"?`${Nt.dirtyCount} unsaved`:"Saved"}),Un&&(Un.worktrees.length>0||Un.staleBranches.length>0)&&s.jsxs("span",{style:{color:Un.worktrees.some(R=>R.status==="stale")?"#ff6b6b":Un.worktrees.some(R=>R.status==="pending-merge")?"#FFB74D":"#4FC3F7"},children:["·"," ","📂"," ",Un.worktrees.length," worktree",Un.worktrees.length!==1?"s":"",Un.staleBranches.length>0&&` · ⚠ ${Un.staleBranches.length} branch${Un.staleBranches.length!==1?"es":""}`]})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[ue&&ge&&s.jsx("button",{onClick:()=>Ae(!1),className:`px-3 py-1 font-black text-white cursor-pointer ${De?"":"animate-pulse"}`,style:{background:De?"#2E7D32":"#B71C1C",border:`2px solid ${De?"#1b5e2088":"#7f121288"}`,fontFamily:"var(--pixel-font)",borderRadius:4},children:De?"WAVE DONE":"WAVE"}),T.length>0&&re&&s.jsxs("button",{onClick:()=>ke(!1),className:"px-3 py-1 font-black text-white cursor-pointer animate-pulse",style:{background:T[T.length-1].color,border:`2px solid ${T[T.length-1].color}88`,fontFamily:"var(--pixel-font)",borderRadius:4},children:[T[T.length-1].title.slice(0,20),T[T.length-1].title.length>20?"..":""]}),s.jsxs("button",{onClick:()=>Z(!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:()=>St?wl(!1):cr(),className:"px-3 py-1 font-black cursor-pointer",style:{background:St?"var(--terminal-bg)":"var(--hud-bg-alt)",color:"var(--terminal-text)",border:`2px solid ${St?"var(--terminal-border-hover)":"var(--pixel-border)"}`,fontFamily:"var(--pixel-font)"},children:"TERMINAL"})]})]}),B.type==="role"&&_&&(()=>{var ie;const R=ve.find(ce=>ce.roleId===_.id);return s.jsx(oS,{role:_,allRoles:r,recentActivity:dr(_.id),onClose:fn,onFireRole:(ce,pe)=>{ze({roleId:ce,roleName:pe}),fn()},terminalWidth:St?sr:0,activeJobId:R==null?void 0:R.id,activeTask:R==null?void 0:R.task,isWorking:An[_.id]==="working",jobStartedAt:R==null?void 0:R.startedAt,onStopJob:ce=>Ne.abortJob(ce),sessions:Yn,streamingSessionId:Zr,onCreateSessionSilent:Qs,onSendMessage:Ei,onFocusTerminal:ur,onCustomize:ce=>{const pe=r.find(Se=>Se.id===ce);pe&&(an("character"),It(pe))},onUpdateRole:Ta,appearance:me(_.id),relationships:fr.relationships,roleLevel:(ie=ye[_.id])==null?void 0:ie.level})})(),B.type==="project"&&hn&&s.jsx(rC,{projectId:hn.id,onClose:fn,terminalWidth:St?sr:0}),(B.type==="bulletin"||B.type==="decisions")&&s.jsx(nC,{standups:d,waves:x,decisions:g,mode:B.type==="bulletin"?"bulletin":"decisions",onClose:fn,terminalWidth:St?sr:0}),B.type==="knowledge"&&s.jsx(tC,{docs:b,onClose:fn,onRefresh:()=>Ne.getKnowledge().then(v).catch(()=>{}),terminalWidth:St?sr:0,initialDocId:B.docId}),K&&s.jsx(sC,{roleId:K.roleId,roleName:K.roleName,mode:K.mode,onClose:()=>Y(null),onExecutionStart:Vs}),ue&&!ge&&s.jsx(xC,{directive:ue.directive,rootJobs:ue.rootJobs,orgNodes:M,rootRoleId:G,onClose:()=>{Ee(null),Ae(!1),He(!1)},onMinimize:()=>Ae(!0),onDone:()=>{Si(),He(!0),Ht("Wave complete — review & save results","#2E7D32")},onSave:async R=>{try{await Ne.saveWave({directive:ue.directive,jobIds:R}),Si(),Ht("Wave saved to bulletin","#2E7D32")}catch(ie){Ht(`Save failed: ${ie instanceof Error?ie.message:"unknown"}`,"#C62828")}},onOpenKnowledgeDoc:R=>{Ee(null),Ae(!1),He(!1),$({type:"knowledge",docId:R}),Ne.getKnowledge().then(v).catch(()=>{})}}),T.length>0&&!re&&(()=>{var ce;const R=T[T.length-1],ie=ne.length>1;return s.jsxs(s.Fragment,{children:[ie&&T.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((pe,Se)=>s.jsx("button",{onClick:()=>{P(Se),U([{jobId:pe.jobId,title:`CEO WAVE · ${pe.roleId.toUpperCase()}`,color:"#B71C1C"}])},className:"px-3 py-1.5 text-xs font-bold rounded-t-lg cursor-pointer transition-colors",style:{background:I===Se?"#B71C1C":"var(--terminal-bg)",color:I===Se?"#fff":"var(--terminal-text-secondary)",border:`1px solid ${I===Se?"#B71C1C":"var(--terminal-border)"}`,borderBottom:"none"},children:pe.roleId.toUpperCase()},pe.jobId))}),s.jsx(oC,{jobId:R.jobId,title:T.length>1?R.title:ie?`CEO WAVE · ${((ce=ne[I])==null?void 0:ce.roleName)??""}`:R.title,color:R.color,variant:"modal",style:ie&&T.length===1?{marginTop:28}:void 0,onClose:()=>{U([]),W([]),P(0),ke(!1)},onMinimize:()=>ke(!0),onDone:()=>{Gs(),Si()},onNavigateToJob:pe=>{Ne.getJob(pe).then(Se=>{const et=Nc[Se.roleId]??"#888";U(Ze=>[...Ze,{jobId:pe,title:`${Se.roleId.toUpperCase()} · ${Se.task.slice(0,40)}`,color:et}])}).catch(console.error)},onOpenKnowledgeDoc:pe=>{U([]),W([]),P(0),ke(!1),$({type:"knowledge",docId:pe}),Ne.getKnowledge().then(v).catch(()=>{})}},R.jobId)]})})(),T.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:()=>U(R=>R.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=T[T.length-2])==null?void 0:Ai.title]})})}),O&&s.jsx(uC,{cLevelRoles:r.filter(R=>R.level==="c-level"),orgNodes:M,rootId:G,onClose:()=>Z(!1),onDispatch:Da}),he&&s.jsx(vC,{existingRoles:r,onClose:()=>be(!1),onHire:Ci}),Ce&&s.jsx(wC,{roleId:Ce.roleId,roleName:Ce.roleName,onClose:()=>ze(null),onConfirm:Ks}),Qe&&s.jsx(eN,{role:Qe,appearance:me(Qe.id),onSave:R=>Fe(Qe.id,R),onReset:()=>Ye(Qe.id),onClose:()=>{It(null),an("character")},theme:xe,onThemeChange:q,onUpdateName:async(R,ie)=>{await Ta(R,{name:ie})},initialTab:"character",characterOnly:!0,speechSettings:Te,onSpeechSettingsChange:$e,language:Ke,onLanguageChange:mt,roleLevel:(hr=ye[Qe.id])==null?void 0:hr.level}),ar&&(()=>{const R=r.find(ie=>ie.id==="cto")??r.find(ie=>ie.level==="c-level")??r[0];return s.jsx(tN,{status:Nt.status,history:Nt.history,onClose:()=>dl(!1),onSave:async ie=>await Nt.save(ie),onLoadHistory:Nt.loadHistory,onRestore:Nt.restore,saving:Nt.state==="saving",delegateRoleName:(R==null?void 0:R.name)??(R==null?void 0:R.id),onDelegate:R?async ie=>{dl(!1);try{const ce=await Ne.createSession(R.id,"do");xn(Se=>[ce,...Se]),qn(ce.id),wl(!0);const pe=`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.
|
|
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."})]}),we.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 (",we.length," role",we.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:we.map((q,Te)=>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})]},Te))})]})})]})]}),Pe==="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 — ",we.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:we.map((q,Te)=>s.jsxs("tr",{className:"border-b border-white/5",children:[s.jsx("td",{className:"p-2 text-white/30",children:Te+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})]},Te))})]})}),z&&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."}),D&&s.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 p-2 rounded-lg border border-red-800/30",children:D})]})]})}),s.jsxs("div",{className:"flex justify-between px-5 pb-5",children:[s.jsxs("div",{children:[i==="single"&&L>1&&s.jsx("button",{onClick:()=>_(L-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"&&Pe==="review"&&s.jsx("button",{onClick:()=>fe("input"),disabled:z,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),ue("")},disabled:z,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"?L<Fs?s.jsx("button",{onClick:()=>_(L+1),disabled:!Vt(L),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:yt,disabled:z,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:z?"Hiring...":"HIRE"}):i==="bulk"?Pe==="input"?s.jsxs("button",{onClick:()=>fe("review"),disabled:!Be,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 (",we.length,")"]}):s.jsx("button",{onClick:ie,disabled:z,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:z?`Hiring ${he.done}/${he.total}...`:`HIRE ALL (${we.length})`}):v==="review"?s.jsx("button",{onClick:Fe,disabled:z||!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:z?"Hiring...":"HIRE"}):null]})]})]})]})}function Rs({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,isWave:c,isWaveStreaming:u,onClick:d,onClose:m,"data-session-id":x}){const f=c?"#F59E0B":r;return s.jsxs("button",{onClick:d,"data-session-id":x,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 ${f}`}:void 0,children:[c&&u&&s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse shrink-0"}),s.jsx("span",{className:"text-xs",children:kC[t]??"👤"}),s.jsx("span",{className:`truncate ${c?"text-amber-400/90":""}`,children:l}),s.jsx("span",{onClick:m,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(Sh,{remarkPlugins:[Ah],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 AC({attachments:t}){const[l,r]=k.useState(null);return t.length===0?null:s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:t.map((i,c)=>s.jsxs("button",{onClick:()=>r(c),className:"relative w-20 h-20 rounded-lg overflow-hidden border border-[var(--terminal-border)] bg-[var(--terminal-inline-bg)] cursor-pointer hover:border-[var(--terminal-border-hover)] transition-colors",children:[s.jsx("img",{src:`data:${i.mediaType};base64,${i.data}`,alt:i.name,className:"w-full h-full object-cover"}),s.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-black/60 text-[8px] text-white truncate px-1 py-0.5",children:i.name})]},c))}),l!==null&&s.jsx("div",{className:"fixed inset-0 z-[100] bg-black/80 flex items-center justify-center",onClick:()=>r(null),children:s.jsxs("div",{className:"relative max-w-[90vw] max-h-[90vh]",children:[s.jsx("img",{src:`data:${t[l].mediaType};base64,${t[l].data}`,alt:t[l].name,className:"max-w-full max-h-[90vh] object-contain rounded-lg"}),s.jsx("button",{onClick:()=>r(null),className:"absolute top-2 right-2 w-8 h-8 rounded-full bg-black/70 text-white flex items-center justify-center cursor-pointer hover:bg-black/90",children:"x"}),s.jsx("div",{className:"absolute bottom-2 left-1/2 -translate-x-1/2 bg-black/70 text-white text-sm px-3 py-1 rounded",children:t[l].name})]})})]})}function zf(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 DC(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:zf(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=zf(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?zf(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 zC({events:t,isStreaming:l}){const[r,i]=k.useState(!1);if(t.length===0)return null;const c=DC(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 MC({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"}),t.attachments&&t.attachments.length>0&&s.jsx("div",{className:"flex justify-end mb-1",children:s.jsx(AC,{attachments:t.attachments})}),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(zC,{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 FC({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(MC,{message:u,roleId:l,roleColor:r},u.id)),s.jsx("div",{ref:i})]})}const RC=5*1024*1024,_C=["image/png","image/jpeg","image/gif","image/webp"];function OC({mode:t,onModeChange:l,onSend:r,disabled:i,disabledReason:c}){const[u,d]=k.useState(""),[m,x]=k.useState([]),[f,g]=k.useState(!1),[y,b]=k.useState(null),v=k.useRef(null),S=k.useRef(null);k.useEffect(()=>{const Y=v.current;Y&&(Y.style.height="0",Y.style.height=Math.min(Y.scrollHeight,120)+"px")},[u]),k.useEffect(()=>{if(y){const Y=setTimeout(()=>b(null),3e3);return()=>clearTimeout(Y)}},[y]);const j=k.useCallback(async Y=>_C.includes(Y.type)?Y.size>RC?(b(`File too large: ${(Y.size/1024/1024).toFixed(1)}MB. Max 5MB.`),null):new Promise(T=>{const U=new FileReader;U.onload=()=>{const Z=U.result.split(",")[1];T({type:"image",data:Z,name:Y.name,mediaType:Y.type})},U.onerror=()=>{b("Failed to read file"),T(null)},U.readAsDataURL(Y)}):(b(`Unsupported format: ${Y.type}. Use PNG, JPG, GIF, or WebP.`),null),[]),E=k.useCallback(async Y=>{const T=Array.from(Y),U=[];for(const O of T){const Z=await j(O);Z&&U.push(Z)}U.length>0&&x(O=>[...O,...U])},[j]),C=k.useCallback(Y=>{Y.preventDefault(),Y.stopPropagation(),g(!0)},[]),A=k.useCallback(Y=>{Y.preventDefault(),Y.stopPropagation(),g(!1)},[]),R=k.useCallback(Y=>{Y.preventDefault(),Y.stopPropagation(),g(!1);const T=Y.dataTransfer.files;T.length>0&&E(T)},[E]),B=k.useCallback(Y=>{const T=Y.clipboardData.items,U=[];for(let O=0;O<T.length;O++){const Z=T[O];if(Z.type.startsWith("image/")){const ne=Z.getAsFile();ne&&U.push(ne)}}U.length>0&&(Y.preventDefault(),E(U))},[E]),L=k.useCallback(Y=>{const T=Y.target.files;T&&T.length>0&&E(T),Y.target.value=""},[E]),_=k.useCallback(Y=>{x(T=>T.filter((U,O)=>O!==Y))},[]),V=()=>{const Y=u.trim();!Y&&m.length===0||i||(r(Y,m.length>0?m:void 0),d(""),x([]))},K=Y=>{Y.key==="Enter"&&!Y.shiftKey&&(Y.preventDefault(),V())};return s.jsxs("div",{className:`border-t border-[var(--terminal-border)] p-3 shrink-0 transition-colors ${f?"bg-[var(--terminal-surface-light)] border-amber-500/50":""}`,onDragOver:C,onDragLeave:A,onDrop:R,children:[y&&s.jsx("div",{className:"text-[10px] text-red-400 mb-2 text-center",children:y}),c&&s.jsx("div",{className:"text-[10px] text-amber-400/70 mb-2 text-center",children:c}),m.length>0&&s.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:m.map((Y,T)=>s.jsxs("div",{className:"relative group w-16 h-16 rounded-lg overflow-hidden border border-[var(--terminal-border)] bg-[var(--terminal-inline-bg)]",children:[s.jsx("img",{src:`data:${Y.mediaType};base64,${Y.data}`,alt:Y.name,className:"w-full h-full object-cover"}),s.jsx("button",{onClick:()=>_(T),className:"absolute top-0.5 right-0.5 w-4 h-4 rounded-full bg-black/70 text-white text-xs flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",children:"x"}),s.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-black/60 text-[8px] text-white truncate px-1 py-0.5",children:Y.name})]},T))}),f&&s.jsx("div",{className:"text-[11px] text-amber-400 text-center mb-2",children:"Drop image here"}),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("button",{onClick:()=>{var Y;return(Y=S.current)==null?void 0:Y.click()},disabled:i,className:"w-8 h-8 rounded-lg bg-[var(--terminal-inline-bg)] border border-[var(--terminal-border)] text-[var(--terminal-text-muted)] flex items-center justify-center shrink-0 cursor-pointer hover:bg-[var(--terminal-surface-light)] hover:text-[var(--terminal-text-secondary)] disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:"Attach image (PNG, JPG, GIF, WebP)",children:s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})})}),s.jsx("input",{ref:S,type:"file",accept:"image/png,image/jpeg,image/gif,image/webp",multiple:!0,onChange:L,className:"hidden"}),s.jsx("textarea",{ref:v,value:u,onChange:Y=>d(Y.target.value),onKeyDown:K,onPaste:B,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:V,disabled:i||!u.trim()&&m.length===0,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 BC={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},Cg={cto:"CTO",cbo:"CBO",pm:"PM",engineer:"Engineer",designer:"Designer",qa:"QA","data-analyst":"Data Analyst"};function D0(t){return new Date(t).toLocaleTimeString("ko-KR",{hour:"2-digit",minute:"2-digit"})}function $C({msg:t}){const l=BC[t.roleId]??"#888",r=Cg[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:D0(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:D0(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 LC({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=>Cg[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 Mf={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"},HC=400,UC=800;function IC({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:R,onUpdateChatTopic:B,unreadChannels:L}){const[_,V]=k.useState(!1),[K,Y]=k.useState(!1),[T,U]=k.useState(!1),[O,Z]=k.useState(""),ne=j!=null,W=S==null?void 0:S.find(pe=>pe.id===j),[I,P]=k.useState(!1),[ae,je]=k.useState(!1),[M,z]=k.useState(!1),G=k.useRef(0),D=k.useRef(0),ue=k.useRef(null),Ee=t.find(pe=>pe.id===l),ge=i===l,Ae=t.filter(pe=>pe.messages.length===0).length,De=k.useCallback(()=>{const pe=ue.current;pe&&(je(pe.scrollLeft>0),z(pe.scrollLeft+pe.clientWidth<pe.scrollWidth-1))},[]);k.useEffect(()=>{if(!l||!ue.current)return;const pe=ue.current.querySelector(`[data-session-id="${l}"]`);pe&&pe.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"}),De()},[l,t.length,De]),k.useEffect(()=>{const pe=ue.current;if(!pe)return;De(),pe.addEventListener("scroll",De);const Pe=new ResizeObserver(De);return Pe.observe(pe),()=>{pe.removeEventListener("scroll",De),Pe.disconnect()}},[De]);const Ie=k.useCallback(pe=>{pe.preventDefault(),G.current=pe.clientX,D.current=c,P(!0);const Pe=he=>{const be=G.current-he.clientX,Ce=Math.min(UC,Math.max(HC,D.current+be));u==null||u(Ce)},fe=()=>{P(!1),document.removeEventListener("mousemove",Pe),document.removeEventListener("mouseup",fe)};document.addEventListener("mousemove",Pe),document.addEventListener("mouseup",fe)},[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 ${I?"bg-[var(--terminal-border-hover)]":"bg-transparent"}`,onMouseDown:Ie}),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:[ae&&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:ue,className:"flex items-center overflow-x-auto terminal-tab-scroll gap-px px-1 py-1",children:[S==null?void 0:S.map(pe=>s.jsxs("button",{onClick:()=>{E==null||E(pe.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===pe.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===pe.id?{borderTop:"2px solid #4CAF50"}:void 0,children:[s.jsx("span",{className:"text-[10px]",children:"💬"}),s.jsx("span",{className:"truncate",children:pe.name}),(L==null?void 0:L.has(pe.id))&&j!==pe.id&&s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-400 shrink-0"}),!pe.isDefault&&s.jsx("span",{onClick:Pe=>{Pe.stopPropagation(),A==null||A(pe.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:"×"})]},pe.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(pe=>s.jsx(jC,{roleId:pe.roleId,title:pe.title,roleColor:Mf[pe.roleId]??"#666",active:!ne&&pe.id===l,isWave:pe.source==="wave",isWaveStreaming:pe.source==="wave"&&pe.status==="active",onClick:()=>{E==null||E(null),d(pe.id)},onClose:Pe=>{Pe.stopPropagation(),m(pe.id)},"data-session-id":pe.id},pe.id))]}),M&&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:()=>{V(!_),Y(!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:"+"}),_&&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:[T?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:O,onChange:pe=>Z(pe.target.value),onKeyDown:pe=>{pe.key==="Enter"&&O.trim()&&(C(O.trim(),[]),Z(""),U(!1),V(!1)),pe.key==="Escape"&&(U(!1),Z(""))},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:()=>U(!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(pe=>s.jsxs("button",{onClick:()=>{x(pe.id),E==null||E(null),V(!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:Mf[pe.id]??"#666"}}),pe.id.toUpperCase()," — ",pe.name]},pe.id))]})]}),s.jsxs("div",{className:"relative shrink-0",children:[s.jsx("button",{onClick:()=>{Y(!K),V(!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:"···"}),K&&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":""]}),Ae>0&&f&&s.jsxs("button",{onClick:()=>{f(),Y(!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 (",Ae,")"]}),t.length>0&&g&&s.jsx("button",{onClick:()=>{g(),Y(!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&&W?s.jsx(LC,{channel:W,allRoles:r,onUpdateMembers:R,onUpdateTopic:B}):Ee?s.jsxs(s.Fragment,{children:[s.jsx(FC,{messages:Ee.messages,roleId:Ee.roleId,roleColor:Mf[Ee.roleId]??"#666"}),Ee.source==="wave"?s.jsxs("div",{className:"shrink-0 px-4 py-2 border-t border-[var(--terminal-border)] bg-[var(--terminal-bg-deeper)] flex items-center gap-2",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 shrink-0",style:Ee.status==="active"?{animation:"pulse 2s infinite"}:void 0}),s.jsx("span",{className:"text-[11px] text-amber-400/80",children:"Wave execution · read-only"}),s.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)] ml-auto",children:"Interact via Wave Command Center"})]}):s.jsx(OC,{mode:Ee.mode,onModeChange:pe=>b(Ee.id,pe),onSend:(pe,Pe)=>y(Ee.id,pe,Ee.mode,Pe),disabled:ge,disabledReason:ge?`${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 YC(){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,m)=>{l();const x=new AbortController;return t.current=x,fetch(`/api/exec/session/${i}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:c,mode:u,attachments:m}),signal:x.signal}).then(async f=>{var v,S,j,E,C;if(!f.ok||!f.body){d.onError("Failed to connect");return}const g=f.body.getReader(),y=new TextDecoder;let b="";for(;;){const{done:A,value:R}=await g.read();if(A)break;b+=y.decode(R,{stream:!0});const B=b.split(`
|
|
88
|
+
`);b=B.pop()??"";let L="";for(let _=0;_<B.length;_++){const V=B[_];if(V.startsWith("event: ")){L=V.slice(7).trim();continue}if(V.startsWith("data: ")){let K;try{K=JSON.parse(V.slice(6))}catch{L="";continue}switch(L){case"thinking":K.text&&((v=d.onThinking)==null||v.call(d,K.text));break;case"output":K.text&&d.onText(K.text);break;case"tool":(S=d.onToolUse)==null||S.call(d,K.name,K.input);break;case"dispatch":(j=d.onDispatch)==null||j.call(d,K.roleId,K.task);break;case"dispatch:progress":(E=d.onDispatchProgress)==null||E.call(d,K.roleId,K.type,K);break;case"turn":(C=d.onTurn)==null||C.call(d,K.turn);break;case"done":d.onDone(K);break;case"error":d.onError(K.message??"Unknown error");break;default:K.text&&d.onText(K.text);break}L=""}}}}).catch(f=>{f.name!=="AbortError"&&d.onError(f.message)}),{abort:l}},[l]),abort:l}}const Eg="tycono-appearances",ah="tycono-theme";function T0(){try{const t=localStorage.getItem(Eg);return t?JSON.parse(t):{}}catch{return{}}}function Ff(t){localStorage.setItem(Eg,JSON.stringify(t))}function z0(){try{const t=localStorage.getItem(ah);if(t&&t in na)return t}catch{}return"default"}function qC(t){var i;const l=(i=na[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 Rf={mode:"auto",intervalSec:18,dailyBudgetUsd:1},ih="tycono-speech-settings",_f="tycono-language";function XC(){try{const t=localStorage.getItem(ih);return t?{...Rf,...JSON.parse(t)}:Rf}catch{return Rf}}function VC(){const[t,l]=k.useState(T0),[r,i]=k.useState(z0),[c,u]=k.useState(XC),[d,m]=k.useState(()=>{try{return localStorage.getItem(_f)??"auto"}catch{return"auto"}}),x=k.useRef(!1);k.useEffect(()=>{x.current||(x.current=!0,Ne.getPreferences().then(j=>{const E=Object.keys(j.appearances??{}).length>0||j.theme!=="default";if(j.speech&&(u(C=>({...C,...j.speech})),localStorage.setItem(ih,JSON.stringify(j.speech))),j.language&&(m(j.language),localStorage.setItem(_f,j.language)),E){const C=j.appearances;l(C),Ff(C),j.theme&&j.theme in na&&(i(j.theme),localStorage.setItem(ah,j.theme))}else{const C=T0(),A=z0();(Object.keys(C).length>0||A!=="default")&&Ne.updatePreferences({appearances:C,theme:A}).catch(()=>{})}}).catch(()=>{}))},[]),k.useEffect(()=>{qC(r)},[r]);const f=k.useCallback(j=>t[j]??_h(j),[t]),g=k.useCallback((j,E)=>{l(C=>{const A={...C,[j]:E};return Ff(A),Ne.updatePreferences({appearances:A}).catch(()=>{}),A})},[]),y=k.useCallback(j=>{l(E=>{const C={...E};return delete C[j],Ff(C),Ne.updatePreferences({appearances:C}).catch(()=>{}),C})},[]),b=k.useCallback(j=>{i(j),localStorage.setItem(ah,j),Ne.updatePreferences({theme:j}).catch(()=>{})},[]),v=k.useCallback(j=>{u(E=>{const C={...E,...j};return localStorage.setItem(ih,JSON.stringify(C)),Ne.updatePreferences({speech:C}).catch(()=>{}),C})},[]),S=k.useCallback(j=>{m(j),localStorage.setItem(_f,j),Ne.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 GC=3e4;function KC(){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 Ne.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,GC))},[m]);k.useEffect(()=>()=>{d.current&&clearInterval(d.current)},[]);const f=k.useCallback(async C=>{i("saving");try{const A=await Ne.save(C);return await m(),A}catch(A){throw i("error"),A}},[m]),g=k.useCallback(async()=>{try{const C=await Ne.getSaveHistory(20);u(C)}catch{}},[]),y=k.useCallback(async C=>{i("saving");try{await Ne.restoreSave(C),await m()}catch(A){throw i("error"),A}},[m]),b=k.useCallback(async()=>{try{await Ne.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 M0={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."]},F0={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."]},WC=[{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."}]}],QC=18e3,R0=6e3,ZC=2500,JC=30*6e4,Ng="tycono:relationships";function PC(){try{const t=localStorage.getItem(Ng);return t?JSON.parse(t):[]}catch{return[]}}function eE(t){localStorage.setItem(Ng,JSON.stringify(t))}function yc(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 gc(t){return Math.min(100,t.dispatches*5+t.wavesTogether*10+t.conversations*2)}function bc(t){return t[Math.floor(Math.random()*t.length)]}function tE(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 nE(t,l){return t.relation==="any"?!0:t.relation===l}function lE({roles:t,roleStatuses:l,activeExecs:r,getStandupSpeech:i}){const[c,u]=k.useState(new Map),[d,m]=k.useState(PC),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 B=Date.now();for(const[L,_]of Object.entries(l))_==="working"&&(x.current[L]=B)},[l]),k.useEffect(()=>{eE(d)},[d]);const j=k.useCallback(B=>{const L=y.current[B],_=b.current.find(U=>U.roleId===B);if(L==="working"&&(_!=null&&_.task))return null;const V=v.current(B);if(V&&Math.random()<.3)return{text:V,type:"work",ts:Date.now()};const K=Date.now(),Y=x.current[B]??0;if(K-Y>JC&&Math.random()<.5){const U=F0[B]??F0.engineer;return{text:bc(U),type:"guilt",ts:K}}const T=M0[B]??M0.engineer;return{text:bc(T),type:"personality",ts:K}},[]),E=k.useCallback(B=>{if(f.current)return!1;const L=B.filter(P=>y.current[P.id]!=="working");if(L.length<2)return!1;const _=[...L].sort(()=>Math.random()-.5),V=_[0],K=_[1],Y=tE(V.id,K.id,B);if(!Y)return!1;const T=yc(S.current,V.id,K.id),U=gc(T),O=WC.filter(P=>nE(P,Y)&&U>=P.minFamiliarity);if(O.length===0)return!1;const Z=bc(O);let ne=V.id,W=K.id;Z.relation==="superior-subordinate"&&(K.reportsTo===V.id||V.level==="c-level"?(ne=V.id,W=K.id):(ne=K.id,W=V.id)),f.current={templateId:Z.id,roleA:ne,roleB:W,turnIdx:0,timer:null};const I=P=>{if(!f.current||P>=Z.turns.length){f.current=null,m(z=>{const G=[...z],D=yc(G,ne,W);return D.conversations++,D.familiarity=gc(D),D.lastInteraction=new Date().toISOString(),G}),setTimeout(()=>{u(z=>{const G=new Map(z);return G.delete(ne),G.delete(W),G})},R0);return}const ae=Z.turns[P],je=ae.speaker==="A"?ne:W,M=ae.speaker==="A"?W:ne;u(z=>{const G=new Map(z);if(G.set(je,{text:ae.text,type:"social",partnerId:M,ts:Date.now()}),P>0){const D=Z.turns[P-1].speaker==="A"?ne:W;D!==je&&G.delete(D)}return G}),f.current.turnIdx=P,f.current.timer=setTimeout(()=>I(P+1),ZC)};return I(0),!0},[]);k.useEffect(()=>{const B=setInterval(()=>{const L=g.current;if(L.length===0||f.current||Math.random()<.35&&E(L))return;const _=L.filter(Y=>y.current[Y.id]!=="working");if(_.length===0)return;const V=bc(_),K=j(V.id);K&&(u(Y=>{const T=new Map(Y);return T.set(V.id,K),T}),setTimeout(()=>{u(Y=>{const T=new Map(Y),U=T.get(V.id);return U&&U.ts===K.ts&&T.delete(V.id),T})},R0))},QC);return()=>{var L;clearInterval(B),(L=f.current)!=null&&L.timer&&clearTimeout(f.current.timer)}},[j,E]);const C=k.useCallback(B=>{const L=c.get(B);return(L==null?void 0:L.text)??""},[c]),A=k.useCallback((B,L)=>{m(_=>{const V=[..._],K=yc(V,B,L);return K.dispatches++,K.familiarity=gc(K),K.lastInteraction=new Date().toISOString(),V})},[]),R=k.useCallback(B=>{B.length<2||m(L=>{const _=[...L];for(let V=0;V<B.length;V++)for(let K=V+1;K<B.length;K++){const Y=yc(_,B[V],B[K]);Y.wavesTogether++,Y.familiarity=gc(Y),Y.lastInteraction=new Date().toISOString()}return _})},[]);return{speeches:c,getSpeech:C,relationships:d,notifyDispatch:A,notifyWave:R}}const Ag="tycono:office-chat";let rE=0;function aE(){return`chat-${Date.now()}-${++rE}`}function Of(){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 iE(){try{const t=localStorage.getItem(Ag);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[...Of(),...i]}const r=Of();for(const i of r)l.find(c=>c.id===i.id)||l.unshift(i);return l}}catch{}return Of()}function sE(t){const l=t.map(r=>({...r,messages:r.messages.slice(-200)}));localStorage.setItem(Ag,JSON.stringify(l))}function oE(){const[t,l]=k.useState(iE),[r,i]=k.useState(null),[c,u]=k.useState(new Set);k.useEffect(()=>{sE(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:aE()};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 R of E){const B=j.find(L=>L.id===R.id);B&&R.messages.length>B.messages.length&&A.add(R.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 cE=45e3,uE=5e3,dE=4,fE=20;function hE({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)??cE/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),R=k.useRef(!1);b.current=t,v.current=l,S.current=r,j.current=i,E.current=c,C.current=u;const B=k.useCallback(async(_,V)=>{if(R.current)return!1;R.current=!0;try{if(!b.current.find(W=>W.id===_))return!1;const Y=V.messages.slice(-fE).map(W=>({roleId:W.roleId,text:W.text,ts:W.ts})),T=b.current.filter(W=>V.members.includes(W.id)),U=E.current.filter(W=>W.roleA===_||W.roleB===_).map(W=>({partnerId:W.roleA===_?W.roleB:W.roleA,familiarity:W.familiarity})),O=S.current.find(W=>W.roleId===_),Z=O?{currentTask:O.task,taskProgress:null}:{currentTask:null,taskProgress:null},ne=await Ne.chatInChannel({channelId:V.name.replace("#",""),channelTopic:V.topic,roleId:_,history:Y,members:T.map(W=>({id:W.id,name:W.name,level:W.level})),relationships:U,workContext:Z});return ne.message?(C.current({ts:Date.now(),roleId:_,text:ne.message,type:"chat",channelId:V.id}),!0):!1}catch{return!1}finally{R.current=!1}},[]),L=k.useCallback(async(_,V)=>{if(A.current>=dE){A.current=0;return}const K=_.members.filter(O=>O!==V&&v.current[O]!=="working");if(K.length===0){A.current=0;return}const Y=K[Math.floor(Math.random()*K.length)];if(Math.random()>.7){A.current=0;return}const T=A.current*2e3,U=Math.random()*5e3;setTimeout(async()=>{A.current++;const O=j.current.find(ne=>ne.id===_.id);if(!O)return;if(await B(Y,O)){const ne=.6-A.current*.1;Math.random()<ne?L(O,Y):A.current=0}else A.current=0},uE+T+U)},[B]);k.useEffect(()=>{if(!g)return;const _=setInterval(async()=>{const V=b.current;if(V.length===0||R.current)return;const K=V.filter(Z=>v.current[Z.id]!=="working");if(K.length===0)return;const Y=K[Math.floor(Math.random()*K.length)],T=j.current.filter(Z=>Z.members.length===0?!0:Z.members.includes(Y.id));if(T.length===0)return;const U=T[Math.floor(Math.random()*T.length)];A.current=0,await B(Y.id,U)&&L(U,Y.id)},y);return()=>clearInterval(_)},[g,y,B,L])}function vc({type:t,className:l}){const r=k.useRef(null),i=Dj(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 Dg=[[1,8],[3,5],[8,1],[5,3]],mE=[[1,4],[2,3],[4,1],[3,2]];function wc(t){const l=t===1||t===3?-1:0,r=Dg[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 kc(t){const l=t===1||t===3?-1:0,r=Dg[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 Jr(t,l){const r=t===1||t===3?-1:0,i=mE[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 _0={down:[wc(0),wc(1),wc(2),wc(3)],up:[kc(0),kc(1),kc(2),kc(3)],right:[Jr(0,!0),Jr(1,!0),Jr(2,!0),Jr(3,!0)],left:[Jr(0,!1),Jr(1,!1),Jr(2,!1),Jr(3,!1)]},Ze=4,zt=28,mn=2,ht=4,it=4,dr=[{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 Oh(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 xE(t){const i=dr[0],c={id:"main",wx:Ze+it,wy:Ze,ww:160-2*(Ze+it),wh:zt,fx:Ze+it,fy:Ze+zt+mn,fw:160-2*(Ze+it),fh:120-Ze-zt-mn-Ze,...i},u=Oh(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*(Ze+it))/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 pE(t){const c={id:"exec",wx:Ze+it,wy:Ze,ww:144-Ze-it-ht/2,wh:zt,fx:Ze+it,fy:Ze+zt+mn,fw:144-Ze-it-ht/2,fh:66,...dr[0]},u={id:"work",wx:144+ht/2+it,wy:Ze,ww:144-ht/2-it-Ze,wh:zt,fx:144+ht/2+it,fy:Ze+zt+mn,fw:144-ht/2-it-Ze,fh:66,...dr[1]},d={id:"meet",wx:Ze+it,wy:Ze+zt+mn+66+ht,ww:144-Ze-it-ht/2,wh:zt,fx:Ze+it,fy:Ze+zt+mn+66+ht+zt+mn,fw:144-Ze-it-ht/2,fh:70,...dr[2]},m={id:"comm",wx:144+ht/2+it,wy:Ze+zt+mn+66+ht,ww:144-ht/2-it-Ze,wh:zt,fx:144+ht/2+it,fy:Ze+zt+mn+66+ht+zt+mn,fw:144-ht/2-it-Ze,fh:70,...dr[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[_,V]of[...y,...b])V>0&&f.push(...Oh(_,V,3));const S=Ze+zt+mn+66,j=144-ht/2,E={exec_work:{id:"exec_work",type:"v",doorY:Ze+zt+mn+20+12,xA:j-2,xB:u.fx+2},meet_comm:{id:"meet_comm",type:"v",doorY:Ze+zt+mn+66+ht+zt+mn+20+12,xA:j-2,xB:m.fx+2},exec_meet:{id:"exec_meet",type:"h",doorX:Ze+it+40+14,yA:S-2,yB:d.fy+2},work_comm:{id:"work_comm",type:"h",doorX:144+ht/2+it+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},R={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}]},B=[{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}],L=[{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:R,wallDecorations:B,furniture:L}}function yE(t){const d={id:"exec",wx:Ze+it,wy:Ze,ww:180-Ze-it-ht/2,wh:zt,fx:Ze+it,fy:Ze+zt+mn,fw:180-Ze-it-ht/2,fh:82,...dr[0]},m={id:"work",wx:180+ht/2+it,wy:Ze,ww:180-ht/2-it-Ze,wh:zt,fx:180+ht/2+it,fy:Ze+zt+mn,fw:180-ht/2-it-Ze,fh:82,...dr[1]},x=Ze+zt+mn+82,f={id:"meet",wx:Ze+it,wy:x+ht,ww:180-Ze-it-ht/2,wh:zt,fx:Ze+it,fy:x+ht+zt+mn,fw:180-Ze-it-ht/2,fh:86,...dr[2]},g={id:"comm",wx:180+ht/2+it,wy:x+ht,ww:180-ht/2-it-Ze,wh:zt,fx:180+ht/2+it,fy:x+ht+zt+mn,fw:180-ht/2-it-Ze,fh:86,...dr[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[K,Y]of[...S,...j])Y>0&&b.push(...Oh(K,Y,4));const C=180-ht/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}},R={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"}]},B={exec:d.fy+82-12,work:m.fy+82-12,meet:f.fy+86-12,comm:g.fy+86-12},L={exec:[{x:d.fx+10,y:B.exec},{x:d.fx+d.fw/2,y:B.exec},{x:d.fx+d.fw-10,y:B.exec}],work:[{x:m.fx+10,y:B.work},{x:m.fx+m.fw/2,y:B.work},{x:m.fx+m.fw-10,y:B.work}],meet:[{x:f.fx+10,y:B.meet},{x:f.fx+f.fw/2,y:B.meet},{x:f.fx+f.fw-10,y:B.meet}],comm:[{x:g.fx+10,y:B.comm},{x:g.fx+g.fw/2,y:B.comm},{x:g.fx+g.fw-10,y:B.comm}]},_=[{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}],V=[{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:R,corridorY:B,waypoints:L,wallDecorations:_,furniture:V}}const gE=2;function Tg(t,l){return l?l==="L"&&t<=12-gE?"M":l==="M"&&t>12?"L":l:t<=12?"M":"L"}function zg(t,l){switch(l??Tg(t)){case"S":return xE(t);case"M":return pE(t);case"L":return yE(t)}}function O0(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 B0(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 Bf(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 $0(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 Bs;function bE(t){Bs=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&&(Bs.globalAlpha=u),Bs.fillStyle=c,Bs.fillRect(t,l,r,i),u!==void 0&&u!==1&&(Bs.globalAlpha=1))}function st(t,l,r,i){$(t,l,1,1,r,i)}let Tc=1;function zi(t){Tc=t}function Bl(){return Tc=Tc*16807%2147483647,(Tc&65535)/65535}function Mg(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 Fg(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 $l(t,l=1){const[r,i,c]=Mg(t);return Fg(r+15*l,Math.min(100,i+8),c-12*l)}function Xt(t,l=1){const[r,i,c]=Mg(t);return Fg(r-10*l,i-3,c+10*l)}const hn={hi:"#D4AA5C",base:"#B08040",sh:"#7A5038",deep:"#4E3028"},Ol={hi:"#8A6848",base:"#604832",sh:"#3A2E24",deep:"#2A1E18"},Fl={hi:"#5A6A80",base:"#485868",sh:"#364858",deep:"#283848"},aa="#100A06";function vE(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),st(t+3,l+3,"#8AB8E8",.35),st(t+c+2,l+3,"#8AB8E8",.25),$(t-1,l+i,r+2,2,"#5A4838"),$(t-1,l+i,r+2,1,Xt("#5A4838",.5),.35)}function wE(t,l,r){$(t,l,10,8,"#3A2818"),$(t+1,l+1,8,6,r),$(t+2,l+2,4,3,Xt(r,1.2),.3),st(t+3,l+2,Xt(r,2),.25)}function kE(t,l){$(t,l,7,7,"#3A2818"),$(t+1,l+1,5,5,"#F0EDE5"),st(t+3,l+1,"#AAA"),st(t+3,l+5,"#AAA"),st(t+1,l+3,"#AAA"),st(t+5,l+3,"#AAA"),st(t+3,l+3,"#222"),$(t+3,l+1,1,2,"#333"),st(t+4,l+3,"#D32F2F")}function jE(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 SE(t,l){$(t,l,22,16,"#6A5030"),$(t+1,l+1,20,14,"#C4A66A"),zi(88);for(let r=0;r<14;r++)for(let i=0;i<20;i++)Bl()>.5&&st(t+1+i,l+1+r,Bl()>.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"),st(t+4,l+2,"#E53935"),st(t+10,l+2,"#1E88E5"),st(t+16,l+3,"#FF9800")}function CE(t,l){$(t,l,20,3,"#5A4030"),$(t,l,20,1,Xt("#5A4030",.5),.35),$(t,l+2,20,1,$l("#5A4030",.5),.3),$(t+2,l-4,3,4,"#E53935"),$(t+2,l-4,3,1,Xt("#E53935",1),.3),$(t+6,l-3,2,3,"#1E88E5"),$(t+9,l-5,4,5,"#43A047"),$(t+14,l-3,3,3,"#FFD54F"),st(t+15,l-3,"#FFF176",.4)}function EE(t,l){$(t,l,16,12,"#1E1E28"),$(t+1,l+1,14,9,"#0C1420"),$(t+2,l+2,12,1,"#EF4444",.6),st(t+2,l+4,"#4CAF50"),$(t+4,l+4,7,1,"#8b949e",.4),st(t+2,l+6,"#FF9800"),$(t+4,l+6,5,1,"#8b949e",.3),st(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 NE(t,l,r){$(t+2,l+20,22,2,aa,.15),$(t,l,22,20,Ol.deep),$(t+1,l+1,20,18,Ol.base),$(t,l,22,1,Ol.hi,.35),$(t,l,1,20,Ol.hi,.2);for(const u of[6,12])$(t+1,l+u,20,2,Ol.sh),$(t+1,l+u,20,1,Ol.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,Xt(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,Xt(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 AE(t,l){$(t+2,l+11,6,2,aa,.1),$(t+2,l+8,6,4,"#8B5E3C"),$(t+1,l+7,8,2,$l("#A06E48",.3)),$(t+2,l+7,6,1,Xt("#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"),st(t+4,l,"#81C784"),st(t+3,l+1,"#A5D6A7",.4)}function DE(t,l){Aa(t+4,l-4,"down"),Aa(t+16,l-4,"down"),Aa(t+28,l-4,"down"),$(t+3,l+24,34,3,aa,.15),$(t,l+2,36,18,hn.deep),$(t+1,l+3,34,16,hn.base),$(t+1,l+3,34,1,hn.hi,.35);for(let r=0;r<14;r+=3)$(t+1,l+4+r,34,1,$l(hn.base,.2),.08);$(t,l+20,36,4,hn.deep),$(t+1,l+21,34,2,hn.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"),st(t+16,l+8,"#795548"),Aa(t+4,l+24,"up"),Aa(t+16,l+24,"up"),Aa(t+28,l+24,"up")}function TE(t,l){$(t+2,l+16,36,3,aa,.15),$(t,l,36,5,"#5D4037"),$(t+1,l+1,34,3,"#6D4C41"),$(t+1,l+1,34,1,Xt("#6D4C41",.5),.3),$(t,l+5,36,8,"#5D4037"),$(t+2,l+6,15,6,"#6D4C41"),$(t+3,l+6,13,1,Xt("#6D4C41",.5),.35),$(t+19,l+6,15,6,"#6D4C41"),$(t+20,l+6,13,1,Xt("#6D4C41",.5),.35),$(t+17,l+6,2,6,"#5D4037"),$(t,l+13,36,3,$l("#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,Xt("#FF8A65",1),.35)}function zE(t,l){$(t+2,l+10,22,2,aa,.12),$(t,l,22,8,Ol.deep),$(t+1,l+1,20,6,Ol.base),$(t+1,l+1,20,1,Ol.hi,.3),$(t,l+8,22,2,Ol.sh),$(t+3,l+2,6,4,"#F0F0F0"),$(t+13,l+3,3,3,"#ECEFF1"),st(t+14,l+4,"#795548")}function ME(t,l){$(t+1,l+14,10,2,aa,.12),$(t,l,10,14,"#546E7A"),$(t,l,10,1,Xt("#546E7A",1),.35),$(t+1,l+1,8,3,"#78909C"),$(t+1,l+5,8,4,"#37474F"),st(t+2,l+6,"#EF5350"),st(t+4,l+6,"#66BB6A"),$(t+2,l+11,4,2,"#ECEFF1")}function FE(t,l){$(t+2,l+16,26,3,aa,.18),$(t,l,26,10,hn.deep),$(t+1,l+1,24,8,hn.base),$(t+1,l+2,24,1,hn.hi,.2),$(t+1,l+4,24,1,$l(hn.base,.2),.1),$(t+1,l+6,24,1,hn.hi,.15),$(t+1,l+1,24,1,hn.hi,.4),$(t+1,l+1,1,8,hn.hi,.2),$(t,l+10,26,5,hn.deep),$(t+1,l+11,24,3,hn.sh),$(t+1,l+10,24,1,$l(hn.base,1.5),.4),$(t+1,l+14,24,1,hn.base,.15),$(t+2,l+12,10,1,hn.deep,.4),$(t+14,l+12,10,1,hn.deep,.4),st(t+7,l+11,"#C8D0D8",.6),st(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),st(t+7,l-4,"#4A98D8",.25),st(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++)st(t+7+r*2,l+5,"#444",.6),st(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"),st(t+2,l+5,"#6D4C41")}function Aa(t,l,r){$(t+1,l+9,10,2,aa,.1),st(t+5,l+9,"#1E1E22"),st(t+1,l+10,"#1A1A1E"),st(t+9,l+10,"#1A1A1E"),st(t+3,l+11,"#1A1A1E"),st(t+7,l+11,"#1A1A1E"),$(t+1,l+2,8,6,Fl.base),$(t+2,l+3,6,4,Fl.hi,.35),$(t+2,l+3,6,1,Xt(Fl.hi,.5),.25),$(t+1,l+7,8,1,Fl.deep),r==="up"?($(t,l+7,10,3,Fl.deep),$(t+1,l+8,8,1,Fl.sh)):($(t,l-1,10,3,Fl.deep),$(t+1,l,8,1,Fl.sh)),$(t,l+3,1,4,Fl.sh),$(t+9,l+3,1,4,Fl.sh)}const Rg={bookshelf:(t,l,r)=>NE(t,l,r.accent),plant:(t,l)=>AE(t,l),"meeting-table":(t,l)=>DE(t,l),sofa:(t,l)=>TE(t,l),"coffee-table":(t,l)=>zE(t,l),"coffee-machine":(t,l)=>ME(t,l),window:(t,l,r)=>vE(t,l,r.windowW??16,r.windowH??14),picture:(t,l,r)=>wE(t,l,r.pictureColor??"#1565C0"),clock:(t,l)=>kE(t,l),whiteboard:(t,l)=>jE(t,l),"bulletin-board":(t,l)=>SE(t,l),shelf:(t,l)=>CE(t,l),screen:(t,l)=>EE(t,l)};function Ai(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 RE(t){for(const l of t.wallDecorations){const r=t.rooms[l.room];if(!r)continue;const{x:i,y:c}=Ai(l,r),u=Rg[l.type];u&&u(i,c,l)}}function _E(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}=Ai(i,c),m=Rg[i.type];m&&l.push({y:d,draw:()=>m(u,d,i)})}}function Pr(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}=Ai(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 OE={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 sh(t){return OE[t]??{w:16,h:16}}function $f(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}=Ai(u,d),f=sh(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}=Ai(u,d),f=sh(u.type);if(l>=m&&l<=m+f.w&&r>=x&&r<=x+f.h)return u.id}return null}function L0(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}=Ai(d,m),g=sh(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 H0(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 U0(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 BE=[{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:"🖥️"}],jc=16,$E=4,Na=4,zc=2,vt=4,ea=4;let Le=zg(7);const Uc={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};let jl=Pr(Le);function _g(t){return{x:t.dx,y:t.dy,w:t.pw,h:t.ph}}function Og(t){return{cx:t.dx+t.pw/2,botY:t.dy+t.ph}}let Wt={};function LE(t){const l={};for(let r=0;r<t.length&&r<Le.desks.length;r++)l[t[r]]=Le.desks[r];return l}let Ht,za=null,Da=null,ur=!1,Sl=null,tl=null,Sn=null,fn=null,wi=null,Rl=null;function HE(t,l){const{wx:r,wy:i,ww:c,wh:u,wallColor:d,baseboardColor:m}=t,x=$l(d,.5),f=Xt(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);zi(Math.round(y.sx*7+i*13));for(let b=0;b<y.sw;b+=3)Bl()>.4&&$(y.sx+b,i,1,u,f,.04);$(y.sx,i,y.sw,2,f,.3),$(y.sx,i,y.sw,1,Xt(d,1),.2),$(y.sx,i+u-2,y.sw,2,x,.3),$(y.sx,i+u,y.sw,zc,m),$(y.sx,i+u,y.sw,1,Xt(m,.5),.4)}l&&($(l.x-1,i,1,u+zc,"#4A3828"),$(l.x+l.w,i,1,u+zc,"#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 UE(t){const l="#504038",r=$l(l,.5),i=Xt(l,.5),c=t.wx-ea,u=t.wy,d=t.wh+zc+t.fh;$(c,u,ea,d,l),$(c,u,1,d,i,.3),$(c+ea-1,u,1,d,r,.4);for(let x=0;x<d;x+=6)$(c+1,u+x,ea-2,1,i,.06);const m=t.wx+t.ww;$(m,u,ea,d,l),$(m,u,1,d,i,.2),$(m+ea-1,u,1,d,r,.3)}function Lf(t){const{fx:l,fy:r,fw:i,fh:c}=t,u="#B08040",d="#C89848",m="#8A6030",x="#6A4820";$(l,r,i,c,u),zi(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=Bl()>.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 I0(t){const{fx:l,fy:r,fw:i,fh:c}=t,u="#1C2A38",d="#101820";zi(99),$(l,r,i,c,u);for(let m=0;m<c;m+=jc)for(let x=0;x<i;x+=jc){const f=Math.min(jc,i-x),g=Math.min(jc,c-m);Bl()>.5&&$(l+x,r+m,f,g,Xt(u,.2),.15),$(l+x+2,r+m+2,f-4,g-4,Xt(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,Xt(u,.4),.1),Bl()>.85&&st(l+x+4+Math.floor(Bl()*8),r+m+4+Math.floor(Bl()*8),"#3A6A9A",.08)}}function IE(t){const{fx:l,fy:r,fw:i,fh:c}=t,u="#387848",d="#4A9058",m="#285E38";$(l,r,i,c,u),zi(77);for(let f=0;f<c;f+=2)for(let g=0;g<i;g+=2)Bl()>.5&&st(l+g,r+f,d,.1),Bl()>.8&&st(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 YE(t){const{fx:l,fy:r,fw:i,fh:c}=t,u="#D8C490",d="#B09060",m="#907848";zi(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,Xt(b,.4),.2),$(l+f+1,r+x+1,1,y-2,Xt(b,.4),.15),$(l+f+g-2,r+x+2,1,y-3,$l(b,.4),.15),$(l+f+2,r+x+y-2,g-3,1,$l(b,.4),.15),$(l+f,r+x,g,1,m,.3),$(l+f,r+x,1,y,m,.3)}}function qE(){const{canvasW:t,canvasH:l,rooms:r,doors:i}=Le,c="#2A1E14",u="#3A2E24";if($(0,0,t,Na,c),$(0,l-Na,t,Na,c),$(0,0,Na,l,c),$(t-Na,0,Na,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-vt/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)??Na+ea+54)-E/2,R=((S==null?void 0:S.doorX)??x+vt/2+ea+54)-E/2,B=((b==null?void 0:b.doorY)??m.fy+20)-j/2;$(0,g,A,vt,c),$(A+E,g,f-A-E,vt,c),$(f+vt,g,R-f-vt,vt,c),$(R+E,g,t-R-E,vt,c),$(0,g,A,1,u,.3),$(A+E,g,f-A-E,1,u,.3),$(f+vt,g,R-f-vt,1,u,.3),$(R+E,g,t-R-E,1,u,.3),$(f,0,vt,C,c),$(f,C+j,vt,g-C-j,c),$(f,g+vt,vt,B-g-vt,c),$(f,B+j,vt,l-B-j,c),$(f,0,1,C,u,.2),$(f,C+j,1,g-C-j,u,.2),$(f,g+vt,1,B-g-vt,u,.2),$(f,B+j,1,l-B-j,u,.2),$(f,C,vt,j,"#C4A070"),$(f+vt/2,C,vt/2,j,"#3A4858"),$(f,B,vt,j,"#7AA880"),$(f+vt/2,B,vt/2,j,"#C8B890");const L="#4A3828";$(f,C-1,vt,1,L),$(f,C+j,vt,1,L),$(A-1,g,1,vt,L),$(A+E,g,1,vt,L),$(R-1,g,1,vt,L),$(R+E,g,1,vt,L),$(f,B-1,vt,1,L),$(f,B+j,vt,1,L)}const Y0=new Map;function XE(t){const l=`${t.hairStyle??""}|${t.outfitStyle??""}|${t.accessory??""}`;let r=Y0.get(l);if(!r){const i=eh("mini-seated:default"),c=dg(i,t);r=c?c.layers.flatMap(u=>u.pixels):[],Y0.set(l,r)}return r}function VE(t,l,r){th(Ht,XE(r),t,l,r)}function GE(t,l,r,i,c){Aa(t+8,l+20,"up"),c||VE(t+8,l+0+i,r),FE(t,l+14)}function KE(t,l,r,i,c){const u=i in _0?i:"down",d=c%4,m=_0[u][d];th(Ht,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&&th(Ht,f.pixels,t,l+x,r)}Ht.globalAlpha=1}function WE(t){const l={};let r=0;for(const i of t){const c=Wt[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 Us(t,l,r,i,c){const u=Le.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 Hf(t,l,r,i){const c=Le.adjacency[r];if(!c)return[];const u=c.find(g=>g.room===i);if(!u)return[];const d=Le.doors[u.door];if(!d)return[];const m=[],x=Le.corridorY[r]??l,f=Le.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 Bg(t,l){const r=Le.adjacency[t.room];if(!r)return[];if(!r.find(c=>c.room===l)){for(const c of r){const u=Le.adjacency[c.room];if(u!=null&&u.find(d=>d.room===l)){const d=Hf(t.x,t.y,t.room,c.room),m=d[d.length-1],x=Hf((m==null?void 0:m.x)??t.x,(m==null?void 0:m.y)??t.y,c.room,l);return[...d,...x]}}return[]}return Hf(t.x,t.y,t.room,l)}function QE(t){if(t.room!==t.homeRoom){const l=Bg({...t},t.homeRoom),r=l[l.length-1],i=Us((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 Us(t.x,t.y,t.homeX,t.homeY,t.room)}function ZE(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(Le.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=Bg(r,u),m=Le.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=Us(f.x,f.y,x.x,x.y,u);r.path=[...d,...g]}else r.path=d;r.walkTimer=0}else{const c=Le.waypoints[r.room];if(c&&c.length>0){const u=c[Math.floor(Math.random()*c.length)];r.path=Us(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(Le.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=Le.waypoints[r.room];if(i&&i.length>0){const c=i[Math.floor(Math.random()*i.length)];r.path=Us(r.x,r.y,c.x,c.y,r.room)}r.walkTimer=0}else r.state="returning",r.path=QE(r),r.walkTimer=0}function JE(t,l,r){const{canvasW:i,canvasH:c,rooms:u}=Le;Ht.clearRect(0,0,i,c),$(0,0,i,c,"#2A1E14");const d={wood:Lf,dark:I0,carpet:IE,tile:YE};for(const y of Object.values(u))(d[y.floorType]??Lf)(y);const m=Object.keys(u);if(m.length>=4){const y=u.exec,b=u.meet,{doors:v}=Le;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;Lf({fx:j,fy:C,fw:28,fh:A-C}),I0({fx:E,fy:C,fw:28,fh:A-C})}}const x={};if(m.length>=4){const{doors:y}=Le,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))HE(y,x[y.id]),UE(y);qE(),RE(Le);const f=[],g=new Set(Object.values(Wt).map(y=>y.room));_E(Le,f,g);for(const[y,b]of Object.entries(Wt)){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(GE(b.dx,b.dy,j,S?v.bobY:0,!S),S&&E){const C=Uc[y]??"#388bfd";$(b.dx+7,b.dy+14-4,12,5,C,.15),st(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:()=>KE(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 jl){const b=Da===y.id,v=Og(y);if(Ht.save(),Ht.globalAlpha=b?.9:.5,Ht.fillStyle=y.color,Ht.fillRect(v.cx-1,v.botY-2,3,3),b){const S=_g(y);Ht.globalAlpha=.3,Ht.strokeStyle=y.color,Ht.lineWidth=1,Ht.strokeRect(S.x-1,S.y-1,S.w+2,S.h+2)}Ht.restore()}if(ur){const y=new Set(Object.values(Wt).map(b=>b.room));if(Sl&&Sl!==tl)if(Sl.startsWith("desk:")){const b=Sl.slice(5),v=Wt[b];v&&H0(Ht,v.dx,v.dy,"#FBBF24")}else L0(Ht,Le,Sl,"#FBBF24",y);if(tl)if(tl.startsWith("desk:")){const b=tl.slice(5),v=Wt[b];v&&H0(Ht,v.dx,v.dy,"#3B82F6")}else L0(Ht,Le,tl,"#3B82F6",y)}if(za){const y=Wt[za],b=t[za];y&&b&&(Ht.save(),Ht.globalAlpha=.25,Ht.fillStyle=Uc[za]??"#fff",b.state==="sitting"?Ht.fillRect(y.dx-1,y.dy+6,28,30):Ht.fillRect(Math.round(b.x)-1,Math.round(b.y)-1,14,24),Ht.restore())}}function PE({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({}),R=k.useRef(0),B=k.useRef($E),[L,_]=k.useState(!1),[V,K]=k.useState(null),[Y,T]=k.useState(null),U=k.useRef({}),O=k.useRef({}),Z=k.useRef([]),ne=k.useRef([]);k.useEffect(()=>{ur=L},[L]),k.useEffect(()=>{wi=V,Rl=Y},[V,Y]),k.useEffect(()=>{Ne.getPreferences().then(fe=>{const he=fe.furnitureOverrides;he&&Object.keys(he).length>0&&(U.current=he,Le=O0(Le,he));const be=fe.deskOverrides;if(be&&Object.keys(be).length>0){O.current=be,B0(Wt,be);for(const[Oe,Me]of Object.entries(Wt)){const we=A.current[Oe];we&&(we.homeX=Me.dx+8,we.homeY=Me.dy+34)}}const Ce=fe.removedFurniture;Ce&&Ce.length>0&&(Z.current=Ce,Le=Bf(Le,Ce));const ze=fe.addedFurniture;ze&&ze.length>0&&(ne.current=ze,Le=$0(Le,ze)),jl=Pr(Le)}).catch(()=>{})},[]);const W=k.useRef({roleStatuses:r,activeExecs:i,getRoleSpeech:b,getAppearance:v});W.current={roleStatuses:r,activeExecs:i,getRoleSpeech:b,getAppearance:v};const I=k.useMemo(()=>t.map(fe=>fe.id),[t]),P=k.useRef(Le);k.useEffect(()=>{const fe=I.length,he=Tg(fe,P.current.preset);let be=zg(fe,he);Z.current.length>0&&(be=Bf(be,Z.current)),ne.current.length>0&&(be=$0(be,ne.current)),Object.keys(U.current).length>0&&(be=O0(be,U.current)),Le=be,P.current=be,Wt=LE(I),Object.keys(O.current).length>0&&B0(Wt,O.current),jl=Pr(be),A.current=WE(I);const Ce=j.current;Ce&&(Ce.width=be.canvasW,Ce.height=be.canvasH),je()},[I]);const ae=k.useCallback(fe=>{var he,be;return((be=(he=W.current).getAppearance)==null?void 0:be.call(he,fe))??_h(fe)},[]),je=k.useCallback(()=>{const fe=E.current,he=j.current;if(!fe||!he)return;const be=fe.parentElement;if(!be)return;const Ce=be.clientWidth,ze=be.clientHeight;if(Ce===0||ze===0)return;const{canvasW:Oe,canvasH:Me}=Le;let we=Math.floor(Math.min(Ce/Oe,ze/Me));we=Math.max(2,Math.min(we,5)),B.current=we,he.style.width=Oe*we+"px",he.style.height=Me*we+"px",fe.style.width=Oe*we+"px",fe.style.height=Me*we+"px"},[]);k.useEffect(()=>{var Me;const fe=j.current;if(!fe)return;const he=fe.getContext("2d");if(!he)return;Ht=he,bE(he),je();const be=new ResizeObserver(()=>je()),Ce=(Me=E.current)==null?void 0:Me.parentElement;Ce&&be.observe(Ce);let ze;const Oe=()=>{R.current++,ZE(A.current,R.current),JE(A.current,ae,W.current.roleStatuses),M(),ze=requestAnimationFrame(Oe)};return ze=requestAnimationFrame(Oe),()=>{cancelAnimationFrame(ze),be.disconnect()}},[ae,je]),k.useEffect(()=>{const fe=C.current;if(!fe)return;fe.innerHTML="";const he={};for(const Ce of t)he[Ce.id]=Ce.name;for(const Ce of I){const ze=Uc[Ce]??"#8b949e",Oe=he[Ce],Me=Oe&&Oe.toLowerCase()!==Ce.toLowerCase()?`${Ce.toUpperCase()} · ${Oe}`:Ce.toUpperCase(),we=document.createElement("div");we.className="td-nametag",we.dataset.role=Ce;const Be=document.createElement("span");Be.className="td-dot",Be.style.background=ze,we.appendChild(Be),we.appendChild(document.createTextNode(Me)),fe.appendChild(we);const tt=document.createElement("div");tt.className="td-bubble",tt.dataset.role=Ce,tt.dataset.type="bubble",fe.appendChild(tt)}const be={meeting:()=>{const Ce=l[0];Ce?u(Ce.id):d()},bulletin:d,decisions:m,knowledge:x,settings:f,theme:g,stats:y};for(const Ce of jl){const ze=document.createElement("div");ze.className="td-facility-label",ze.dataset.facility=Ce.id,ze.textContent=`${Ce.icon} ${Ce.label}`,ze.style.borderColor=`${Ce.color}44`;const Oe=be[Ce.id];Oe&&ze.addEventListener("click",Oe),ze.addEventListener("mouseenter",()=>{Da=Ce.id}),ze.addEventListener("mouseleave",()=>{Da=null}),fe.appendChild(ze)}},[I,t,l,u,d,m,x,f,g,y]);const M=k.useCallback(()=>{var Me;const fe=C.current;if(!fe)return;const he=B.current,be=A.current,{getRoleSpeech:Ce,roleStatuses:ze,activeExecs:Oe}=W.current;for(const we of Object.keys(be)){const Be=be[we],tt=Wt[we];if(!tt)continue;let jt,Ut,yt;Be.state==="sitting"?(jt=tt.dx+13,yt=tt.dy+2,Ut=tt.dy+37):(jt=Math.round(Be.x)+6,yt=Math.round(Be.y)-2,Ut=Math.round(Be.y)+18);const Vt=jt/Le.canvasW*100,ie=fe.querySelector(`.td-nametag[data-role="${we}"]`);if(ie){ie.style.left=Vt+"%",ie.style.top=Ut*he+2+"px";const Fe=ie.querySelector(".td-dot");if(Fe){const Ge=ze[we]==="working";Fe.style.background=Ge?"#FBBF24":Uc[we]??"#8b949e",Ge?Fe.style.animation="td-pulse 1s ease-in-out infinite":Fe.style.animation=""}}const me=fe.querySelector(`.td-bubble[data-role="${we}"]`);if(me){const Fe=ze[we]==="working",Ge=(Me=Oe.find(Te=>Te.roleId===we))==null?void 0:Me.task,ye=Ce(we),q=Fe&&Ge?Ge.slice(0,60):ye?ye.slice(0,60):"";q&&Be.state==="sitting"?(me.style.display="",me.style.left=Vt+"%",me.style.top=(yt-10)*he+"px",me.textContent=q):me.style.display="none"}}for(const we of jl){const Be=fe.querySelector(`.td-facility-label[data-facility="${we.id}"]`);if(Be){const tt=Og(we);Be.style.left=tt.cx/Le.canvasW*100+"%",Be.style.top=tt.botY*he-4+"px",Be.classList.toggle("td-facility-label--hover",Da===we.id)}}},[]),z=k.useCallback(fe=>{const he=j.current;if(!he)return null;const be=he.getBoundingClientRect(),Ce=B.current,ze=(fe.clientX-be.left)/Ce,Oe=(fe.clientY-be.top)/Ce,Me=A.current;for(const[we,Be]of Object.entries(Wt)){if(!Me[we])continue;const tt=Me[we];if(tt.state==="sitting"){if(ze>=Be.dx&&ze<=Be.dx+26&&Oe>=Be.dy&&Oe<=Be.dy+40)return{type:"role",id:we}}else if(ze>=tt.x-2&&ze<=tt.x+14&&Oe>=tt.y-2&&Oe<=tt.y+20)return{type:"role",id:we}}for(const we of jl){const Be=_g(we);if(ze>=Be.x&&ze<=Be.x+Be.w&&Oe>=Be.y&&Oe<=Be.y+Be.h)return{type:"facility",id:we.id}}return null},[]),G=k.useCallback(fe=>{const he=j.current;if(!he)return{mx:0,my:0};const be=he.getBoundingClientRect(),Ce=B.current;return{mx:(fe.clientX-be.left)/Ce,my:(fe.clientY-be.top)/Ce}},[]),D=k.useCallback(fe=>{Ne.updatePreferences(fe).catch(()=>{})},[]),ue=k.useCallback(fe=>{const he=[...Z.current,fe];Z.current=he,Le=Bf(Le,[fe]),jl=Pr(Le),tl=null,Sl=null,D({removedFurniture:he})},[D]),Ee=k.useCallback((fe,he)=>{if(!wi||!Rl)return;let be=null;for(const[Be,tt]of Object.entries(Le.rooms)){const jt=Rl==="wall"?tt.wx:tt.fx,Ut=Rl==="wall"?tt.wy:tt.fy,yt=Rl==="wall"?tt.ww:tt.fw,Vt=Rl==="wall"?tt.wh:tt.fh;if(fe>=jt&&fe<=jt+yt&&he>=Ut&&he<=Ut+Vt){be=Be;break}}if(!be)return;const Ce=Le.rooms[be],ze=Rl==="wall"?Ce.wx:Ce.fx,Oe=Rl==="wall"?Ce.wy:Ce.fy,Me={id:`user-${wi}-${Date.now()}`,type:wi,room:be,zone:Rl,offsetX:Math.round(fe-ze),offsetY:Math.round(he-Oe)},we=[...ne.current,Me];ne.current=we,Rl==="wall"?Le.wallDecorations.push(Me):Le.furniture.push(Me),jl=Pr(Le),D({addedFurniture:we}),K(null),T(null)},[D]),ge=k.useCallback(fe=>{const he=j.current;if(ur&&Sn){const{mx:Ce,my:ze}=G(fe),Me=[...Le.furniture,...Le.wallDecorations].find(tt=>tt.id===Sn.defId);if(!Me)return;const we=Ce-Sn.startMx,Be=ze-Sn.startMy;Me.offsetX=Math.round(Sn.origOffX+we),Me.offsetY=Math.round(Sn.origOffY+Be),jl=Pr(Le),he&&(he.style.cursor="grabbing");return}if(ur&&fn){const{mx:Ce,my:ze}=G(fe),Oe=Wt[fn.roleId];if(!Oe)return;Oe.dx=Math.round(fn.origDx+(Ce-fn.startMx)),Oe.dy=Math.round(fn.origDy+(ze-fn.startMy));const Me=A.current[fn.roleId];Me&&(Me.homeX=Oe.dx+8,Me.homeY=Oe.dy+34),he&&(he.style.cursor="grabbing");return}if(ur){const{mx:Ce,my:ze}=G(fe);if(wi){he&&(he.style.cursor="crosshair");return}const Oe=new Set(Object.values(Wt).map(we=>we.room)),Me=$f(Le,Ce,ze,Oe);if(Me)Sl=Me;else{const we=U0(Wt,Ce,ze);Sl=we?`desk:${we}`:null}za=null,Da=null,he&&(he.style.cursor=Sl?"grab":"default");return}const be=z(fe);za=(be==null?void 0:be.type)==="role"?be.id:null,Da=(be==null?void 0:be.type)==="facility"?be.id:null,Sl=null,he&&(he.style.cursor=be?"pointer":"default")},[z,G]),Ae=k.useCallback(fe=>{if(!ur)return;const{mx:he,my:be}=G(fe);if(wi){Ee(he,be),fe.preventDefault();return}const Ce=new Set(Object.values(Wt).map(Me=>Me.room)),ze=$f(Le,he,be,Ce);if(ze){const we=[...Le.furniture,...Le.wallDecorations].find(Be=>Be.id===ze);we&&(tl=ze,Sn={defId:ze,startMx:he,startMy:be,origOffX:we.offsetX,origOffY:we.offsetY},fe.preventDefault());return}const Oe=U0(Wt,he,be);if(Oe){const Me=Wt[Oe];tl=`desk:${Oe}`,fn={roleId:Oe,startMx:he,startMy:be,origDx:Me.dx,origDy:Me.dy},fe.preventDefault();return}tl=null},[G,Ee]),De=k.useCallback(fe=>{if(Sn){const be=[...Le.furniture,...Le.wallDecorations].find(Ce=>Ce.id===Sn.defId);if(be){const Ce={...U.current,[be.id]:{offsetX:be.offsetX,offsetY:be.offsetY}};U.current=Ce,D({furnitureOverrides:Ce}),jl=Pr(Le)}Sn=null,j.current&&(j.current.style.cursor="grab");return}if(fn){const he=Wt[fn.roleId];if(he){const be={...O.current,[fn.roleId]:{dx:he.dx,dy:he.dy}};O.current=be,D({deskOverrides:be})}fn=null,j.current&&(j.current.style.cursor="grab")}},[D]),Ie=k.useCallback(fe=>{if(!ur)return;fe.preventDefault();const{mx:he,my:be}=G(fe),Ce=new Set(Object.values(Wt).map(Oe=>Oe.room)),ze=$f(Le,he,be,Ce);ze&&ue(ze)},[G,ue]);k.useEffect(()=>{const fe=he=>{!ur||!tl||(he.key==="Delete"||he.key==="Backspace")&&(tl.startsWith("desk:")||ue(tl))};return window.addEventListener("keydown",fe),()=>window.removeEventListener("keydown",fe)},[ue]);const pe=k.useCallback(()=>{if(Sn){const he=[...Le.furniture,...Le.wallDecorations].find(be=>be.id===Sn.defId);he&&(he.offsetX=Sn.origOffX,he.offsetY=Sn.origOffY,jl=Pr(Le)),Sn=null}if(fn){const fe=Wt[fn.roleId];fe&&(fe.dx=fn.origDx,fe.dy=fn.origDy);const he=A.current[fn.roleId];he&&(he.homeX=fe.dx+8,he.homeY=fe.dy+34),fn=null}za=null,Da=null,Sl=null,j.current&&(j.current.style.cursor="default")},[]),Pe=k.useCallback(fe=>{if(ur)return;const he=z(fe);if(he){if(he.type==="role"){c(he.id);return}switch(he.id){case"meeting":{const be=l[0];be?u(be.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}}},[z,c,u,d,m,x,f,g,y]);return s.jsxs("div",{className:`td-scene${L?" td-scene--editing":""}`,children:[s.jsxs("div",{ref:E,className:"td-wrap",children:[s.jsx("canvas",{ref:j,width:Le.canvasW,height:Le.canvasH,className:"td-canvas",onClick:Pe,onMouseDown:Ae,onMouseUp:De,onMouseMove:ge,onMouseLeave:pe,onContextMenu:Ie}),s.jsx("div",{ref:C,className:"td-overlay"})]}),L&&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${L?" td-edit-btn--active":""}`,onClick:()=>{_(fe=>{const he=!fe;return he||(K(null),T(null)),he}),tl=null,Sn=null,fn=null},title:L?"Exit Edit Mode":"Edit Furniture Layout",children:[s.jsx("span",{className:"td-edit-btn__icon",children:L?"✓":"✎"}),s.jsx("span",{className:"td-edit-btn__label",children:L?"DONE":"EDIT"})]}),L&&s.jsx("div",{className:"td-palette",children:BE.map(fe=>s.jsx("button",{className:`td-palette__item${V===fe.type?" td-palette__item--active":""}`,onClick:()=>{V===fe.type?(K(null),T(null)):(K(fe.type),T(fe.zone))},title:fe.label,children:s.jsx("span",{children:fe.icon})},fe.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 eN({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 U;const[j,E]=k.useState(x??"character"),[C,A]=k.useState({...l}),[R,B]=k.useState(t.name),[L,_]=k.useState(!1),V=k.useCallback(()=>A(ji(S)),[S]),K=k.useCallback(()=>{const O=_h(t.id);A({...O}),i()},[t.id,i]),Y=k.useCallback(async()=>{r(C);const O=R.trim();if(m&&O&&O!==t.name){_(!0);try{await m(t.id,O)}catch{}_(!1)}c()},[C,r,c,R,t.name,t.id,m]),T=s.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6},children:[s.jsxs("span",{children:[t.id.toUpperCase()," –"]}),m?s.jsx("input",{value:R,onChange:O=>B(O.target.value),disabled:L,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:O=>O.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(Sg,{roleId:t.id,appearance:C,onChange:A,onRandomize:V,onReset:K,label:T,roleLevel:S})}):j==="office"?s.jsx("div",{className:"customize-body",children:s.jsx("div",{className:"customize-themes",children:Object.entries(na).map(([O,Z])=>s.jsxs("button",{className:`customize-theme-card ${u===O?"active":""}`,onClick:()=>d(O),children:[s.jsxs("div",{className:"customize-theme-preview",style:{background:Z.vars["--floor-light"],borderColor:Z.vars["--pixel-border"]},children:[s.jsx("div",{style:{background:Z.vars["--hud-bg"],height:8,borderBottom:`2px solid ${Z.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:Z.vars["--accent"],borderRadius:1}}),s.jsx("div",{style:{width:10,height:14,background:Z.vars["--active-green"],borderRadius:1}}),s.jsx("div",{style:{width:10,height:14,background:Z.vars["--idle-amber"],borderRadius:1}})]}),s.jsx("div",{style:{background:Z.vars["--hud-bg"],height:6,borderTop:`2px solid ${Z.vars["--pixel-border"]}`}})]}),s.jsxs("div",{className:"customize-theme-name",children:[Z.icon," ",Z.name]})]},O))})}):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(O=>s.jsxs("button",{onClick:()=>y==null?void 0:y({mode:O}),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(g==null?void 0:g.mode)===O?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(g==null?void 0:g.mode)===O?"rgba(255,255,255,0.08)":"transparent",color:(g==null?void 0:g.mode)===O?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center"},children:[s.jsx("div",{style:{fontWeight:600,marginBottom:2},children:O==="template"?"TEMPLATE":O==="llm"?"AI":"AUTO"}),s.jsx("div",{style:{fontSize:9,opacity:.7},children:O==="template"?"Static pool ($0)":O==="llm"?"LLM generated":"Detect engine"})]},O))}),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:O=>y==null?void 0:y({intervalSec:Number(O.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: $",((U=g==null?void 0:g.dailyBudgetUsd)==null?void 0:U.toFixed(2))??"1.00"]}),s.jsx("input",{type:"range",min:0,max:5,step:.25,value:(g==null?void 0:g.dailyBudgetUsd)??1,onChange:O=>y==null?void 0:y({dailyBudgetUsd:Number(O.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:O,label:Z})=>s.jsx("button",{onClick:()=>v==null?void 0:v(O),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(b??"auto")===O?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(b??"auto")===O?"rgba(255,255,255,0.08)":"transparent",color:(b??"auto")===O?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center",fontWeight:600},children:Z},O))}),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:Y,children:"SAVE"})]})]})})}function q0(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 X0(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 tN({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),R=k.useRef(null);k.useEffect(()=>{f==="history"&&c()},[f,c]),k.useEffect(()=>{var T;(T=R.current)==null||T.focus()},[]);const B=[...((t==null?void 0:t.modified)??[]).map(T=>({status:"M",file:T})),...((t==null?void 0:t.untracked)??[]).map(T=>({status:"A",file:T}))],L=k.useRef(!1);k.useEffect(()=>{!L.current&&B.length>0&&!y&&(b(q0(B)),L.current=!0)},[B.length]);const _=k.useCallback(()=>{b(q0(B))},[B]),V=async()=>{S(null),A(null);try{const T=await i(y||void 0);A(T),b("")}catch(T){S(T instanceof Error?T.message:"Save failed")}},K=async T=>{if(confirm(`Restore from commit ${T.slice(0,7)}? This creates a new commit with those files.`)){E(!0);try{await u(T),E(!1)}catch(U){S(U instanceof Error?U.message:"Restore failed"),E(!1)}}};k.useEffect(()=>{const T=U=>{U.key==="Escape"&&r()};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[r]);const Y=T=>{T.key==="Enter"&&(T.metaKey||T.ctrlKey)&&V()};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:Y,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(T=>s.jsx("button",{onClick:()=>g(T),className:"flex-1 py-2 text-[11px] font-bold uppercase tracking-wider cursor-pointer",style:{background:f===T?"var(--hud-bg-alt)":"transparent",color:f===T?"var(--terminal-text)":"var(--terminal-text-muted)",borderBottom:f===T?"2px solid var(--accent)":"2px solid transparent"},children:T==="save"?"SAVE":"HISTORY"},T))}),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:B.length>0?s.jsxs("span",{style:{color:"var(--idle-amber)"},children:["* ",B.length," unsaved change",B.length>1?"s":""]}):s.jsx("span",{style:{color:"var(--active-green)"},children:"All changes saved"})}),B.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:B.map(({status:T,file:U})=>s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{style:{color:T==="A"?"var(--active-green)":"var(--idle-amber)",width:"14px"},children:T}),s.jsx("span",{style:{color:"var(--terminal-text-secondary)"},children:U})]},U))})]}),B.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:_,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:R,type:"text",value:y,onChange:T=>b(T.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)"}})]}),B.length>0&&s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:V,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 T=B.map(U=>`${U.status} ${U.file}`).join(`
|
|
89
|
+
`);m(T)},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"]})]}),B.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," (",X0(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(T=>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:T.shortSha}),s.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--terminal-text)"},children:T.message})]}),s.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:X0(T.date)})]}),s.jsx("button",{onClick:()=>K(T.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"})]},T.sha))})]})]})]})]})}function nN({onClose:t}){const[l,r]=k.useState(null),[i,c]=k.useState(!0),[u,d]=k.useState(null);return k.useEffect(()=>{Ne.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(Sc,{label:"Roles",value:String(l.company.roleCount)}),s.jsx(Sc,{label:"Avg Level",value:`Lv.${l.company.avgLevel}`}),s.jsx(Sc,{label:"Total Tokens",value:l.company.formattedTokens}),s.jsx(Sc,{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(lN,{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:rN(m)}),s.jsxs("span",{style:{color:"rgba(255,255,255,0.5)"},children:["$",x.costUsd.toFixed(2)]})]},m))})]})]})}function Sc({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 lN({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:V0(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:V0(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 V0(t){return t>=9?"#FFD700":t>=7?"#C0A0FF":t>=5?"#4FC3F7":t>=3?"#81C784":"rgba(255,255,255,0.4)"}function rN(t){return t.includes("opus")?"Opus":t.includes("sonnet")?"Sonnet":t.includes("haiku")?"Haiku":t.split("-").slice(0,2).join(" ")}function aN({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 Ne.getSyncRoles();i(A);const R=A.filter(B=>B.source.sync!=="off");if(R.length===0){u([]),j(null);return}try{const B=await Ci.syncCheck(R.map(_=>({roleId:_.roleId,sourceId:_.source.id,currentVersion:_.source.upstream_version??_.source.forked_at??"0.0.0"})));j(!0);const L=[];for(const _ of B.updates){if(!_.hasUpdate)continue;const V=R.find(O=>O.roleId===_.roleId);if(!V)continue;const{character:K}=await Ci.syncPull(_.sourceId),Y=[];V.persona.trim()!==K.persona.trim()&&Y.push({field:"persona",local:V.persona.slice(0,120)+(V.persona.length>120?"...":""),upstream:K.persona.slice(0,120)+(K.persona.length>120?"...":"")});const T=JSON.stringify(V.authority),U=JSON.stringify(K.authority);T!==U&&Y.push({field:"authority",local:`${V.authority.autonomous.length} autonomous, ${V.authority.needsApproval.length} approval`,upstream:`${K.authority.autonomous.length} autonomous, ${K.authority.needsApproval.length} approval`}),Y.length>0&&L.push({roleId:_.roleId,roleName:V.name,sourceId:_.sourceId,currentVersion:_.currentVersion,latestVersion:_.latestVersion,fields:Y})}u(L)}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:R,version:B}=await Ci.syncPull(A.sourceId);await Ne.applySyncUpdate({roleId:A.roleId,changes:{persona:R.persona,authority:R.authority},upstreamVersion:B}),y(L=>new Set(L).add(A.roleId)),l==null||l()}catch(R){v(R instanceof Error?R.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(R=>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:R.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",{}),R.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",{}),R.upstream]})]})]},R.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 iN({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 Ne.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 Ne.deleteWorktree(A.path),await f()}catch(R){d(R instanceof Error?R.message:"Failed to remove worktree")}finally{x(null)}},y=async A=>{x(A);try{await Ne.deleteBranch(A),await f()}catch(R){d(R instanceof Error?R.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 R=A.split("/");if(R.length>1){const B=R[R.length-1],L=["cto","cbo","pm","engineer","designer","qa","data-analyst"];for(const _ of L)if(B.toLowerCase().includes(_))return _}return null}function E(A,R=40){return A.length<=R?A:"..."+A.slice(A.length-R+3)}function C(A){const R=Date.now()-new Date(A).getTime(),B=Math.floor(R/6e4);if(B<1)return"just now";if(B<60)return`${B}m ago`;const L=Math.floor(B/60);return L<24?`${L}h ago`:`${Math.floor(L/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(Cc,{label:"Active Worktrees",count:b.length}),b.map(A=>s.jsx(Uf,{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(Cc,{label:"Pending Merge",count:v.length}),v.map(A=>s.jsx(Uf,{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(Cc,{label:"Stale",count:S.length}),S.map(A=>s.jsx(Uf,{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(Cc,{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 Cc({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 Uf({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 sN({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 oN({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(na).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 Ic=[0,1e4,5e4,15e4,4e5,1e6,25e5,5e6,1e7,25e6];function $g(t){let l=1;for(let r=Ic.length-1;r>=0;r--)if(t>=Ic[r]){l=r+1;break}return Math.min(l,10)}function cN(t){const l=$g(t);if(l>=10)return 1;const r=Ic[l-1],i=Ic[l];return Math.min(1,(t-r)/(i-r))}function G0(t){const l={};for(const[r,i]of Object.entries(t)){const c=i.inputTokens+i.outputTokens;l[r]={level:$g(c),totalTokens:c,progress:cN(c)}}return l}const uN=[{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 K0(t){return uN.filter(l=>l.check(t))}const dN={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍","data-analyst":"📊"},Mc={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},fN={cto:"아키텍처",cbo:"시장 분석",pm:"PRD 작성",engineer:"코딩",designer:"시안 제작",qa:"품질 검증"};function hN(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 mN({importJob:t,onImportDone:l}){var Sr,rl,Ia;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,R]=k.useState(null),[B,L]=k.useState({type:"none"}),[_,V]=k.useState(null),[K,Y]=k.useState(null),[T,U]=k.useState([]),[O,Z]=k.useState(!1),[ne,W]=k.useState([]),[I,P]=k.useState(0),[ae,je]=k.useState(!1),[M,z]=k.useState({}),[G,D]=k.useState("ceo"),[ue,Ee]=k.useState(null),[ge,Ae]=k.useState(!1),[De,Ie]=k.useState(!1),[pe,Pe]=k.useState({}),fe=k.useRef({}),[he,be]=k.useState(!1),[Ce,ze]=k.useState(null),[Oe,Me]=k.useState({}),[we,Be]=k.useState([]),[tt,jt]=k.useState([]),[Ut,yt]=k.useState(void 0),[Vt,ie]=k.useState(!1);k.useEffect(()=>{Ne.getStatus().then(F=>{yt(F.engine),ie(!!F.hasApiKey)}).catch(()=>{})},[]);const{getAppearance:me,setAppearance:Fe,resetAppearance:Ge,theme:ye,setTheme:q,speechSettings:Te,setSpeechSettings:He,language:Je,setLanguage:mt}=VC(),[et,Yt]=k.useState(null),[,cn]=k.useState("character"),Nt=KC(),[hr,xl]=k.useState(!1),[mr,On]=k.useState(!1),[Nn,un]=k.useState(!1),[ke,Qt]=k.useState(!1),[Oa,pl]=k.useState(!1),[Ps,Ba]=k.useState(!1),[Xn,eo]=k.useState(null);k.useEffect(()=>{const F=le=>{(le.metaKey||le.ctrlKey)&&le.key==="s"&&(le.preventDefault(),Nt.dirtyCount>0&&xl(!0))};return window.addEventListener("keydown",F),()=>window.removeEventListener("keydown",F)},[Nt.dirtyCount]),k.useEffect(()=>{if(!ke)return;let F=!1;const le=async()=>{try{const xe=await Ne.getGitStatus();F||eo(xe)}catch{}};le();const se=setInterval(le,1e4);return()=>{F=!0,clearInterval(se)}},[ke]);const[El,ia]=k.useState(null),[Ul,Il]=k.useState(null),[An,tn]=k.useState([]),[Zt,Yl]=k.useState(!1),$a=k.useRef(!1),Mi=k.useRef(null);let to=k.useRef(0);const Fi=k.useRef(new Set),Vn=(F,le,se)=>{const xe={id:to.current++,type:F,text:le,detail:se};tn(ve=>[...ve,xe])};k.useEffect(()=>{var F;Zt&&((F=Mi.current)==null||F.scrollIntoView({behavior:"smooth"}))},[An,Zt]),k.useEffect(()=>{t&&($a.current||($a.current=!0,Il("Scanning knowledge sources..."),tn([{id:0,type:"scan",text:"Starting knowledge import..."}]),to.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 F=>{var ve;const le=(ve=F.body)==null?void 0:ve.getReader();if(!le)return;const se=new TextDecoder;let xe="";for(;;){const{done:Ve,value:Ye}=await le.read();if(Ve)break;xe+=se.decode(Ye,{stream:!0});const Re=xe.split(`
|
|
90
|
+
`);xe=Re.pop()||"";let Ue="";for(const Xe of Re)if(Xe.startsWith("event: "))Ue=Xe.slice(7).trim();else if(Xe.startsWith("data: ")&&Ue){try{const We=JSON.parse(Xe.slice(6));switch(Ue){case"scanning":Il(`Scanning: ${We.path} (${We.fileCount} files)`),Vn("scan",`Found ${We.fileCount} files`,We.path);break;case"processing":ia({index:We.index,total:We.total}),Il(`Importing knowledge... (${We.index}/${We.total})`),Vn("process",`Processing: ${We.file}`,`${We.index} / ${We.total}`);break;case"created":Vn("created",We.title,We.summary);break;case"skipped":Vn("process",`Skipped: ${We.file}`,We.reason);break;case"done":Il(null),ia(null),Vn("done",`Import complete! ${We.created} created, ${We.skipped} skipped.`),_t(`Knowledge import complete! ${We.created} documents imported.`,"#2E7D32"),l==null||l();break;case"error":Il(null),ia(null),Vn("error",We.message),_t(`Import failed: ${We.message}`,"#B71C1C"),l==null||l();break}}catch{}Ue=""}}}).catch(F=>{Il(null),Vn("error",F.message),_t(`Import error: ${F.message}`,"#B71C1C"),l==null||l()})))},[t]);const[sa,ql]=k.useState("iso"),[Xl,oa]=k.useState(typeof window<"u"?window.innerWidth:1200);k.useEffect(()=>{const F=()=>oa(window.innerWidth);return window.addEventListener("resize",F),()=>window.removeEventListener("resize",F)},[]);const Nl=Xl<1024,[St,yl]=k.useState(!1),[xr,Vl]=k.useState(560),[Dn,qt]=k.useState([]),[pr,Tn]=k.useState(null),[ca,yr]=k.useState(null),{sendMessage:La}=YC(),zn=k.useRef(new Map);k.useEffect(()=>{Promise.all([Ne.getCompany().then(F=>{j(F.name),i(F.roles)}),Ne.getOrgTree().then(F=>{z(F.nodes),D(F.root)}).catch(()=>{}),Ne.getCostSummary().then(F=>Ri(G0(F.byRole))).catch(()=>{})]).catch(F=>R(`Failed to load: ${F.message}`)).finally(()=>C(!1)),Ne.getProjects().then(u).catch(()=>{}),Ne.getStandups().then(m).catch(()=>{}),Ne.getWaves().then(f).catch(()=>{}),Ne.getDecisions().then(y).catch(()=>{}),Ne.getKnowledge().then(v).catch(()=>{})},[]),k.useEffect(()=>{Ne.getSessions().then(F=>{if(F.length>0){const le=F.map(xe=>({...xe,messages:[]}));qt(le);const se=le.find(xe=>xe.status==="active")??le[0];Tn(se.id),yl(!0)}}).catch(F=>{console.error("Failed to load sessions",F)})},[]),k.useEffect(()=>{const F=()=>{fetch("/api/exec/status").then(se=>se.json()).then(se=>{Me(se.statuses??{}),Be(se.activeExecutions??[])}).catch(()=>{})};F();const le=setInterval(F,3e3);return()=>clearInterval(le)},[]);const xn=k.useMemo(()=>{const F={...Oe};if(ca){const le=Dn.find(se=>se.id===ca);le&&(F[le.roleId]="working")}return F},[Oe,ca,Dn]);k.useEffect(()=>{B.type==="role"?Ne.getRole(B.roleId).then(V).catch(console.error):V(null)},[B]);const gr=()=>L({type:"none"}),Qc=async(F,le)=>{const se=r.find(ve=>ve.id===F),xe=(K==null?void 0:K.mode)==="ask";Y(null);try{const{jobId:ve}=await Ne.startJob({type:"assign",roleId:F,task:le,readOnly:xe}),Ve=Mc[F]??"#666",Ye=`${F.toUpperCase()} · ${(se==null?void 0:se.name)??F}`;je(!1),U([{jobId:ve,title:Ye,color:Ve}]),nn.pushMessage({ts:Date.now(),roleId:"ceo",text:`[CEO → ${(se==null?void 0:se.name)??F}] ${xe?"Ask":"Assign"}: ${le}`,type:"dispatch",targetRoleId:F})}catch(ve){_t(`Failed to start job: ${ve instanceof Error?ve.message:"unknown"}`,"#C62828")}},_t=(F,le)=>{const se=Date.now();jt(xe=>[...xe,{id:se,message:F,color:le}]),setTimeout(()=>jt(xe=>xe.filter(ve=>ve.id!==se)),4e3)},Ri=F=>{var se,xe;const le=fe.current;for(const[ve,Ve]of Object.entries(F)){const Ye=((se=le[ve])==null?void 0:se.level)??0;if(Ye>0&&Ve.level>Ye){const Re=((xe=r.find(Ue=>Ue.id===ve))==null?void 0:xe.name)??ve.toUpperCase();_t(`${Re} leveled up to Lv.${Ve.level}!`,"#7C3AED")}}fe.current=F,Pe(F)};k.useEffect(()=>{const F={roles:Object.entries(pe).map(([xe,ve])=>({id:xe,level:ve.level,totalTokens:ve.totalTokens})),totalTokens:Object.values(pe).reduce((xe,ve)=>xe+ve.totalTokens,0),roleCount:r.length},le=K0(F),se=Fi.current;for(const xe of le)se.has(xe.id)||se.size>0&&_t(`${xe.icon} Badge earned: ${xe.name}!`,"#D4A017");Fi.current=new Set(le.map(xe=>xe.id))},[pe,r.length]);const Ha=()=>{var le;const F=T[T.length-1];F&&(_t(`${F.title} completed`,F.color),nn.pushMessage({ts:Date.now(),roleId:((le=F.title.split(" · ")[0])==null?void 0:le.toLowerCase())??"unknown",text:`[${F.title}] Job completed`,type:"dispatch"})),Ne.getStandups().then(m).catch(console.error),Ne.getCompany().then(se=>i(se.roles)).catch(console.error),Ne.getCostSummary().then(se=>Ri(G0(se.byRole))).catch(()=>{})},Zc=(F,le)=>{const se=`wave-${F}`,xe=new AbortController;zn.current.set(F,xe);const ve={id:`msg-wave-${F}-role`,from:"role",content:"",type:"conversation",status:"streaming",timestamp:new Date().toISOString(),streamEvents:[]};qt(Ve=>Ve.map(Ye=>Ye.id===se?{...Ye,messages:[...Ye.messages,ve]}:Ye)),fetch(`/api/jobs/${F}/stream?from=0`,{signal:xe.signal}).then(async Ve=>{if(!Ve.ok||!Ve.body)return;const Ye=Ve.body.getReader(),Re=new TextDecoder;let Ue="";for(;;){const{done:Xe,value:We}=await Ye.read();if(Xe)break;Ue+=Re.decode(We,{stream:!0});const Cr=Ue.split(`
|
|
91
|
+
`);Ue=Cr.pop()??"";let Ya="";for(const Er of Cr)if(Er.startsWith("event: "))Ya=Er.slice(7).trim();else if(Er.startsWith("data: ")){try{const Li=JSON.parse(Er.slice(6));if(Ya==="activity"){const Bt=Li;qt(bl=>bl.map(al=>{if(al.id!==se)return al;const yn=[...al.messages],Hi=yn[yn.length-1];if(!Hi||Hi.from!=="role")return al;const Jt={...Hi};if(Bt.type==="text")Jt.content=(Jt.content??"")+(Bt.data.text??"");else if(Bt.type==="thinking")Jt.thinking=(Jt.thinking??"")+(Bt.data.text??""),Jt.streamEvents=[...Jt.streamEvents??[],{type:"thinking",timestamp:Date.now(),text:Bt.data.text}];else if(Bt.type==="tool:start")Jt.streamEvents=[...Jt.streamEvents??[],{type:"tool",timestamp:Date.now(),toolName:Bt.data.name,toolInput:Bt.data.input}];else if(Bt.type==="dispatch:start")Jt.streamEvents=[...Jt.streamEvents??[],{type:"dispatch",timestamp:Date.now(),roleId:Bt.data.targetRoleId,task:Bt.data.task}];else if(Bt.type==="turn:complete")Jt.streamEvents=[...Jt.streamEvents??[],{type:"turn",timestamp:Date.now(),turn:Bt.data.turn}];else{if(Bt.type==="job:done")return Jt.status="done",yn[yn.length-1]=Jt,{...al,messages:yn,status:"closed"};if(Bt.type==="job:error")return Jt.status="error",Bt.data.message&&(Jt.content=Jt.content||Bt.data.message),yn[yn.length-1]=Jt,{...al,messages:yn,status:"closed"}}return yn[yn.length-1]=Jt,{...al,messages:yn}}))}else Ya==="stream:end"&&qt(Bt=>Bt.map(bl=>{if(bl.id!==se)return bl;const al=bl.messages.map(yn=>yn.status==="streaming"?{...yn,status:"done"}:yn);return{...bl,messages:al,status:"closed"}}))}catch{}Ya=""}}}).catch(Ve=>{Ve.name!=="AbortError"&&qt(Ye=>Ye.map(Re=>{if(Re.id!==se)return Re;const Ue=Re.messages.map(Xe=>Xe.status==="streaming"?{...Xe,status:"error"}:Xe);return{...Re,messages:Ue,status:"closed"}}))})},Bn=async F=>{Z(!1);try{const le=await Ne.startJob({type:"wave",directive:F}),se=le.jobIds??(le.jobId?[le.jobId]:[]),xe=r.filter(Re=>Re.level==="c-level"),ve=se.map((Re,Ue)=>{var Xe,We;return{jobId:Re,roleId:((Xe=xe[Ue])==null?void 0:Xe.id)??`role-${Ue}`,roleName:((We=xe[Ue])==null?void 0:We.name)??`C-Level ${Ue+1}`}});nn.pushMessage({ts:Date.now(),roleId:"ceo",text:`[CEO WAVE] "${F}" → ${ve.map(Re=>Re.roleName).join(", ")}`,type:"dispatch"}),Object.keys(M).length>0?(Ee({directive:F,rootJobs:ve}),Ae(!1)):(W(ve),P(0),je(!1),ve.length>0&&U([{jobId:ve[0].jobId,title:`CEO WAVE · ${ve[0].roleId.toUpperCase()}`,color:"#B71C1C"}]));const Ve=new Date().toISOString(),Ye=ve.map(Re=>({id:`wave-${Re.jobId}`,roleId:Re.roleId,title:`WAVE: ${Re.roleName}`,mode:"do",source:"wave",jobId:Re.jobId,messages:[{id:`msg-wave-${Re.jobId}-ceo`,from:"ceo",content:F,type:"directive",status:"done",timestamp:Ve}],status:"active",createdAt:Ve,updatedAt:Ve}));qt(Re=>[...Ye,...Re]),Ye.length>0&&(Tn(Ye[0].id),yl(!0));for(const Re of ve)Zc(Re.jobId,Re.roleId)}catch(le){_t(`Failed to start wave: ${le instanceof Error?le.message:"unknown"}`,"#C62828")}},ua=()=>{Ne.getWaves().then(f).catch(console.error),Ne.getStandups().then(m).catch(console.error)},Ua=()=>{Ne.getCompany().then(F=>i(F.roles)).catch(console.error)},_i=async(F,le)=>{await Ne.createRole(F),Fe(F.id,le),Ua(),_t(`${F.name} hired!`,"#2E7D32")},br=async F=>{await Ne.deleteRole(F),Ua(),ze(null),_t(`${F.toUpperCase()} removed`,"#B71C1C")},Oi=async(F,le)=>{await Ne.updateRole(F,le),Ua(),B.type==="role"&&B.roleId===F&&Ne.getRole(F).then(V).catch(console.error),le.name&&_t(`${F.toUpperCase()} renamed to "${le.name}"`,"#1565C0")},no=F=>{yl(!0)},vr=async F=>{try{const le=await Ne.createSession(F,"talk");qt(se=>[le,...se]),Tn(le.id),yl(!0)}catch(le){console.error("Failed to create session",le),_t(`Failed to create session: ${le instanceof Error?le.message:"API unreachable"}`,"#B71C1C")}},Jc=async F=>{try{const le=await Ne.createSession(F,"talk");qt(se=>[le,...se]),Tn(le.id)}catch(le){console.error("Failed to create session",le),_t(`Failed to create session: ${le instanceof Error?le.message:"API unreachable"}`,"#B71C1C")}},lo=async F=>{const le=we.find(ve=>ve.roleId===F),se=(le==null?void 0:le.jobId)??(le==null?void 0:le.id);if(se&&xn[F]==="working"){const ve=r.find(Re=>Re.id===F),Ve=Mc[F]??"#666",Ye=`${F.toUpperCase()} · ${(ve==null?void 0:ve.name)??F}`;U([{jobId:se,title:Ye,color:Ve}]),je(!1);return}const xe=Dn.find(ve=>ve.roleId===F);if(xe)Tn(xe.id),nn.setActiveChannelId(null);else try{const ve=await Ne.createSession(F,"talk");qt(Ve=>[ve,...Ve]),Tn(ve.id),nn.setActiveChannelId(null)}catch(ve){console.error("Failed to create session",ve)}yl(!0)},ro=async F=>{const le=Dn.find(se=>se.id===F);if((le==null?void 0:le.source)==="wave"){if(le.jobId){const se=zn.current.get(le.jobId);se&&(se.abort(),zn.current.delete(le.jobId))}qt(se=>{var ve;const xe=se.filter(Ve=>Ve.id!==F);return pr===F&&Tn(((ve=xe[0])==null?void 0:ve.id)??null),xe});return}try{await Ne.deleteSession(F),qt(se=>{var ve;const xe=se.filter(Ve=>Ve.id!==F);return pr===F&&Tn(((ve=xe[0])==null?void 0:ve.id)??null),xe})}catch(se){console.error("Failed to delete session",se),_t(`Failed to close session: ${se instanceof Error?se.message:"API error"}`,"#B71C1C")}},Bi=async()=>{try{const{ids:F}=await Ne.deleteEmptySessions();if(F.length===0)return;qt(le=>{var xe;const se=le.filter(ve=>!F.includes(ve.id));return pr&&F.includes(pr)&&Tn(((xe=se[0])==null?void 0:xe.id)??null),se}),_t(`Cleared ${F.length} empty session${F.length!==1?"s":""}`,"#2E7D32")}catch(F){_t(`Failed to clear empty sessions: ${F instanceof Error?F.message:"API error"}`,"#B71C1C")}},Pc=async()=>{if(!confirm("Close all sessions? This cannot be undone."))return;const F=Dn.filter(le=>le.source!=="wave").map(le=>le.id);for(const le of Dn)if(le.source==="wave"&&le.jobId){const se=zn.current.get(le.jobId);se&&(se.abort(),zn.current.delete(le.jobId))}try{F.length>0&&await Ne.deleteSessions(F),qt([]),Tn(null),_t("All sessions closed","#2E7D32")}catch(le){_t(`Failed to close sessions: ${le instanceof Error?le.message:"API error"}`,"#B71C1C")}},Al=(F,le)=>{qt(se=>se.map(xe=>{if(xe.id!==F)return xe;const ve=[...xe.messages],Ve=ve[ve.length-1];if(Ve&&Ve.from==="role"&&Ve.status==="streaming"){const Ye=[...Ve.streamEvents??[],le];ve[ve.length-1]={...Ve,streamEvents:Ye}}return{...xe,messages:ve}}))},wr=(F,le,se,xe)=>{const ve={id:`msg-${Date.now()}-ceo`,from:"ceo",content:le,type:se==="do"?"directive":"conversation",status:"done",timestamp:new Date().toISOString(),attachments:xe},Ve={id:`msg-${Date.now()+1}-role`,from:"role",content:"",type:"conversation",status:"streaming",timestamp:new Date().toISOString(),streamEvents:[]};qt(Ye=>Ye.map(Re=>Re.id===F?{...Re,messages:[...Re.messages,ve,Ve],updatedAt:new Date().toISOString()}:Re)),yr(F),La(F,le,se,{onThinking:Ye=>{qt(Re=>Re.map(Ue=>{if(Ue.id!==F)return Ue;const Xe=[...Ue.messages],We=Xe[Xe.length-1];return We&&We.from==="role"&&We.status==="streaming"&&(Xe[Xe.length-1]={...We,thinking:(We.thinking??"")+Ye}),{...Ue,messages:Xe}})),Al(F,{type:"thinking",timestamp:Date.now(),text:Ye})},onText:Ye=>{qt(Re=>Re.map(Ue=>{if(Ue.id!==F)return Ue;const Xe=[...Ue.messages],We=Xe[Xe.length-1];return We&&We.from==="role"&&We.status==="streaming"&&(Xe[Xe.length-1]={...We,content:We.content+Ye}),{...Ue,messages:Xe}}))},onToolUse:(Ye,Re)=>{Al(F,{type:"tool",timestamp:Date.now(),toolName:Ye,toolInput:Re})},onDispatch:(Ye,Re)=>{Al(F,{type:"dispatch",timestamp:Date.now(),roleId:Ye,task:Re})},onDispatchProgress:(Ye,Re,Ue)=>{var Xe;Re==="tool"?Al(F,{type:"dispatch:progress",timestamp:Date.now(),roleId:Ye,progressType:"tool",toolName:Ue.name,toolInput:Ue.input}):Re==="thinking"?Al(F,{type:"dispatch:progress",timestamp:Date.now(),roleId:Ye,progressType:"thinking",text:Ue.text}):Re==="text"?Al(F,{type:"dispatch:progress",timestamp:Date.now(),roleId:Ye,progressType:"text",text:(Xe=Ue.text)==null?void 0:Xe.slice(-200)}):(Re==="done"||Re==="error")&&Al(F,{type:"dispatch:progress",timestamp:Date.now(),roleId:Ye,progressType:Re})},onTurn:Ye=>{Al(F,{type:"turn",timestamp:Date.now(),turn:Ye})},onDone:()=>{qt(Ye=>Ye.map(Re=>{if(Re.id!==F)return Re;const Ue=Re.messages.map(We=>We.status==="streaming"?{...We,status:"done"}:We),Xe=Re.messages.length<=2?le.slice(0,40).replace(/\n/g," "):Re.title;return{...Re,messages:Ue,title:Xe}})),yr(null)},onError:Ye=>{qt(Re=>Re.map(Ue=>{if(Ue.id!==F)return Ue;const Xe=Ue.messages.map(We=>We.status==="streaming"?{...We,status:"error",content:We.content||Ye}:We);return{...Ue,messages:Xe}})),yr(null)}},xe)},gl=(F,le)=>{qt(se=>se.map(xe=>xe.id===F?{...xe,mode:le}:xe)),Ne.updateSession(F,{mode:le}).catch(console.error)},$i=new Date().toISOString().slice(0,10),ll=c[0],Gl={cto:"Chief Technology Officer",cbo:"Chief Business Officer",pm:"Product Manager",engineer:"Software Engineer",designer:"UI/UX Designer",qa:"QA Engineer"},kr=F=>{const le=Gl[F];if(!le)return"";for(const se of d){const xe=se.content,ve=xe.indexOf(`## ${le}`);if(ve===-1)continue;const Ve=xe.indexOf(`
|
|
92
|
+
## `,ve+10),Re=(Ve===-1?xe.slice(ve):xe.slice(ve,Ve)).split(`
|
|
93
|
+
`).filter(Ue=>Ue.trim().length>0);for(const Ue of Re){const Xe=Ue.replace(/^#+\s*/,"").replace(/\*\*/g,"").replace(/^[-*]\s+/,"").trim();if(!(Xe.startsWith("|")||Xe.startsWith("{")||Xe.startsWith("[")||Xe.startsWith("```")||Xe.startsWith("---")||Xe.includes("Journal")||Xe.includes("(c-level)")||Xe.includes("(team-lead)")||Xe.includes("(member)")||/^(CEO |작업 결과|생성\/수정|APPROVAL|비고|상황 보고|태스크$)/.test(Xe))&&Xe.length>15&&Xe.length<120)return Xe}}return""},ao=F=>{const le=Gl[F];if(!le)return"";for(const se of d){const xe=se.content,ve=xe.indexOf(`## ${le}`);if(ve===-1)continue;const Ve=xe.indexOf(`
|
|
94
|
+
## `,ve+10),Re=(Ve===-1?xe.slice(ve):xe.slice(ve,Ve)).replace(/^## .+\n/,"").trim();if(Re)return Re.slice(0,1500)}return""},nn=oE();k.useEffect(()=>{r.length>0&&nn.syncDefaultMembers(r)},[r]);const jr=lE({roles:r,roleStatuses:Oe,activeExecs:we,getStandupSpeech:kr});return hE({roles:r,roleStatuses:Oe,activeExecs:we,channels:nn.channels,relationships:jr.relationships,pushMessage:nn.pushMessage,speechSettings:Te,engineType:Ut,hasApiKey:Vt}),E?s.jsxs("div",{className:"h-screen flex flex-col bg-[var(--floor-light)]",style:{fontFamily:"var(--pixel-font)"},children:[(Ul||An.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:()=>Yl(F=>!F),children:[Ul?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:Ul||"Knowledge import finished"}),El&&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:`${El.index/El.total*100}%`,background:"#fff"}})}),s.jsx("span",{className:"text-[10px] opacity-70 shrink-0",children:Zt?"▲":"▼"})]}),Zt&&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:[An.map(F=>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:[F.type==="scan"&&"🔍",F.type==="process"&&"⚙️",F.type==="created"&&"✅",F.type==="done"&&"🎉",F.type==="error"&&"❌"]}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{style:{color:F.type==="error"?"#EF4444":F.type==="done"?"var(--active-green)":"var(--terminal-text)"},children:F.text}),F.detail&&s.jsx("div",{className:"text-[10px] truncate",style:{color:"var(--terminal-text-muted)"},children:F.detail})]})]},F.id)),s.jsx("div",{ref:Mi})]})]}),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 F=Object.values(pe).reduce((Ve,Ye)=>Ve+Ye.totalTokens,0),le=F>=1e6?`${(F/1e6).toFixed(1)}M`:F>=1e3?`${Math.round(F/1e3)}K`:String(F),se=Math.min(100,Math.round(F/25e4*100)),xe=we.length,ve=r.length>0?Math.round(xe/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:le})]}),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:`${ve}%`,background:"linear-gradient(90deg,#3b82f6,#60A5FA)"}})}),s.jsx("strong",{className:"text-[var(--terminal-text)]",children:ve})]})]})})(),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})]}),we.length>0&&s.jsxs("span",{className:"text-amber-400",children:["Working: ",s.jsx("strong",{children:we.length})]}),(()=>{const F={roles:Object.entries(pe).map(([se,xe])=>({id:se,level:xe.level,totalTokens:xe.totalTokens})),totalTokens:Object.values(pe).reduce((se,xe)=>se+xe.totalTokens,0),roleCount:r.length},le=K0(F);return le.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:le.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:$i})]})]}),(Ul||An.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:()=>Yl(F=>!F),children:[Ul?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:Ul||"Knowledge import finished"}),El&&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:`${El.index/El.total*100}%`,background:"#fff"}})}),s.jsx("span",{className:"text-[10px] opacity-70 shrink-0",children:Zt?"▲":"▼"})]}),Zt&&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:[An.map(F=>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:[F.type==="scan"&&"🔍",F.type==="process"&&"⚙️",F.type==="created"&&"✅",F.type==="done"&&"🎉",F.type==="error"&&"❌"]}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{style:{color:F.type==="error"?"#EF4444":F.type==="done"?"var(--active-green)":"var(--terminal-text)"},children:F.text}),F.detail&&s.jsx("div",{className:"text-[10px] truncate",style:{color:"var(--terminal-text-muted)"},children:F.detail})]})]},F.id)),s.jsx("div",{ref:Mi}),An.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:sa==="iso"?s.jsx(PE,{roles:r,projects:c,waves:x,standups:d,decisions:g,roleStatuses:xn,activeExecs:we,onRoleClick:F=>L({type:"role",roleId:F}),onProjectClick:F=>L({type:"project",projectId:F}),onBulletinClick:()=>L({type:"bulletin"}),onDecisionsClick:()=>L({type:"decisions"}),onKnowledgeClick:()=>L({type:"knowledge"}),onSettingsClick:()=>pl(!0),onThemeClick:()=>Ba(F=>!F),onStatsClick:()=>On(!0),knowledgeDocsCount:b.length,getRoleSpeech:jr.getSpeech,getAppearance:me,onHireClick:()=>be(!0)}):s.jsxs("div",{className:`${St?"max-w-full":"max-w-[1100px]"} mx-auto h-full p-4 flex flex-col gap-3 relative z-[1]`,children:[(()=>{const F=r.filter(se=>se.level==="c-level"),le=r.filter(se=>se.level!=="c-level");return s.jsxs(s.Fragment,{children:[F.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"pixel-section-label",children:"LEADERSHIP"}),s.jsx("div",{className:`grid gap-2 ${F.length===1?"grid-cols-1":"grid-cols-2"}`,children:F.map(se=>{var xe,ve;return s.jsx(W0,{role:se,speech:jr.getSpeech(se.id),onClick:()=>L({type:"role",roleId:se.id}),liveStatus:xn[se.id],activeTask:(xe=we.find(Ve=>Ve.roleId===se.id))==null?void 0:xe.task,featured:!0,appearance:me(se.id),xpLevel:(ve=pe[se.id])==null?void 0:ve.level},se.id)})})]}),s.jsx("div",{className:"pixel-section-label",children:"TEAM"}),s.jsxs("div",{className:`grid gap-2 ${St?"grid-cols-3":"grid-cols-4"}`,children:[le.map(se=>{var xe,ve;return s.jsx(W0,{role:se,speech:jr.getSpeech(se.id),onClick:()=>L({type:"role",roleId:se.id}),liveStatus:xn[se.id],activeTask:(xe=we.find(Ve=>Ve.roleId===se.id))==null?void 0:xe.task,appearance:me(se.id),xpLevel:(ve=pe[se.id])==null?void 0:ve.level},se.id)}),s.jsx("div",{className:"pixel-card pixel-card--hire",onClick:()=>be(!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:ll?()=>L({type:"project",projectId:ll.id}):void 0,style:ll?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(vc,{type:"meeting"})}),s.jsxs("div",{className:"fcc-body",children:[s.jsx("div",{className:"fcc-desc",children:"Projects, PRDs, and task boards"}),ll?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"fcc-title",children:['"',ll.name,'"']}),s.jsxs("div",{className:"fcc-meta",children:["Status: ",s.jsx("strong",{style:{color:"var(--active-green)"},children:ll.status})]})]}):s.jsx("div",{className:"fcc-meta",style:{fontStyle:"italic"},children:"No active projects"})]})]}),s.jsxs("div",{className:"facility-card-compact",onClick:()=>L({type:"bulletin"}),children:[s.jsxs("div",{className:"fcc-hdr",style:{background:"#64748b"},children:["📋"," BULLETIN"]}),s.jsx("div",{className:"fcc-canvas",children:s.jsx(vc,{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(F=>s.jsxs("div",{className:"fcc-item",children:["Wave ",F.id]},F.id)),d.slice(0,1).map(F=>s.jsxs("div",{className:"fcc-item",children:["Standup ",F.date]},F.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:()=>L({type:"decisions"}),children:[s.jsxs("div",{className:"fcc-hdr",style:{background:"#EF4444"},children:["📜"," DECISIONS"]}),s.jsx("div",{className:"fcc-canvas",children:s.jsx(vc,{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(F=>s.jsxs("div",{className:"fcc-item",children:["#",F.id," ",F.title]},F.id))]})]}),s.jsxs("div",{className:"facility-card-compact",onClick:()=>L({type:"knowledge"}),children:[s.jsxs("div",{className:"fcc-hdr",style:{background:"#0D9488"},children:["📚"," KNOWLEDGE"]}),s.jsx("div",{className:"fcc-canvas",children:s.jsx(vc,{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(F=>s.jsx("div",{className:"fcc-item",children:F.title},F.id))]})]})]})]})}),St&&s.jsx("div",{className:Nl?"absolute inset-0 z-50":"contents",children:s.jsx(IC,{sessions:Dn,activeSessionId:pr,roles:r,streamingSessionId:ca,width:Nl?Xl:xr,onWidthChange:Nl?void 0:Vl,onSwitchSession:Tn,onCloseSession:ro,onCreateSession:vr,onClearEmpty:Bi,onCloseAll:Pc,onSendMessage:wr,onModeChange:gl,onCloseTerminal:()=>yl(!1),chatChannels:nn.channels,activeChatChannelId:nn.activeChannelId,onSwitchChatChannel:nn.setActiveChannelId,onCreateChatChannel:nn.createChannel,onDeleteChatChannel:nn.deleteChannel,onUpdateChatMembers:nn.updateMembers,onUpdateChatTopic:nn.updateTopic,unreadChannels:nn.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:()=>ql("card"),className:`view-toggle-btn ${sa==="card"?"active":""}`,children:"CARD"}),s.jsx("button",{onClick:()=>ql("iso"),className:`view-toggle-btn ${sa==="iso"?"active":""}`,children:"OFFICE"}),s.jsx("span",{className:"mx-1",children:"|"}),s.jsxs("div",{style:{position:"relative"},children:[s.jsxs("button",{className:`theme-btn${Ps?" active":""}`,onClick:()=>Ba(F=>!F),title:"Office Theme",children:[((Sr=na[ye])==null?void 0:Sr.icon)??"","▾"]}),Ps&&s.jsx(oN,{theme:ye,onThemeChange:q,onClose:()=>Ba(!1)})]}),s.jsx("button",{className:"theme-btn",onClick:()=>pl(!0),title:"Settings",children:"⚙"}),s.jsx("span",{className:"mx-1",children:"|"}),s.jsxs("button",{onClick:()=>{Nt.state==="no-git"?Nt.initGit():Nt.state==="dirty"?xl(!0):Qt(!0)},title:Nt.state==="dirty"?`${Nt.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:Nt.state==="no-git"?"var(--terminal-text-muted)":Nt.state==="saving"||Nt.state==="dirty"?"var(--idle-amber)":Nt.state==="error"?"#EF5350":"var(--active-green)",animation:Nt.state==="saving"?"pulse 1s infinite":void 0}}),s.jsx("span",{style:{color:Nt.state==="dirty"?"var(--idle-amber)":"var(--terminal-text-muted)"},children:Nt.state==="no-git"?"No git":Nt.state==="saving"?"Saving...":Nt.state==="dirty"?`${Nt.dirtyCount} unsaved`:"Saved"}),Xn&&(Xn.worktrees.length>0||Xn.staleBranches.length>0)&&s.jsxs("span",{style:{color:Xn.worktrees.some(F=>F.status==="stale")?"#ff6b6b":Xn.worktrees.some(F=>F.status==="pending-merge")?"#FFB74D":"#4FC3F7"},children:["·"," ","📂"," ",Xn.worktrees.length," worktree",Xn.worktrees.length!==1?"s":"",Xn.staleBranches.length>0&&` · ⚠ ${Xn.staleBranches.length} branch${Xn.staleBranches.length!==1?"es":""}`]})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[ue&&ge&&s.jsx("button",{onClick:()=>Ae(!1),className:`px-3 py-1 font-black text-white cursor-pointer ${De?"":"animate-pulse"}`,style:{background:De?"#2E7D32":"#B71C1C",border:`2px solid ${De?"#1b5e2088":"#7f121288"}`,fontFamily:"var(--pixel-font)",borderRadius:4},children:De?"WAVE DONE":"WAVE"}),T.length>0&&ae&&s.jsxs("button",{onClick:()=>je(!1),className:"px-3 py-1 font-black text-white cursor-pointer animate-pulse",style:{background:T[T.length-1].color,border:`2px solid ${T[T.length-1].color}88`,fontFamily:"var(--pixel-font)",borderRadius:4},children:[T[T.length-1].title.slice(0,20),T[T.length-1].title.length>20?"..":""]}),s.jsxs("button",{onClick:()=>Z(!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:()=>St?yl(!1):no(),className:"px-3 py-1 font-black cursor-pointer",style:{background:St?"var(--terminal-bg)":"var(--hud-bg-alt)",color:"var(--terminal-text)",border:`2px solid ${St?"var(--terminal-border-hover)":"var(--pixel-border)"}`,fontFamily:"var(--pixel-font)"},children:"TERMINAL"})]})]}),B.type==="role"&&_&&(()=>{var le;const F=we.find(se=>se.roleId===_.id);return s.jsx(oS,{role:_,allRoles:r,recentActivity:ao(_.id),onClose:gr,onFireRole:(se,xe)=>{ze({roleId:se,roleName:xe}),gr()},terminalWidth:St?xr:0,activeJobId:F==null?void 0:F.id,activeTask:F==null?void 0:F.task,isWorking:xn[_.id]==="working",jobStartedAt:F==null?void 0:F.startedAt,onStopJob:se=>Ne.abortJob(se),sessions:Dn,streamingSessionId:ca,onCreateSessionSilent:Jc,onSendMessage:wr,onFocusTerminal:lo,onCustomize:se=>{const xe=r.find(ve=>ve.id===se);xe&&(cn("character"),Yt(xe))},onUpdateRole:Oi,appearance:me(_.id),relationships:jr.relationships,roleLevel:(le=pe[_.id])==null?void 0:le.level})})(),B.type==="project"&&ll&&s.jsx(rC,{projectId:ll.id,onClose:gr,terminalWidth:St?xr:0}),(B.type==="bulletin"||B.type==="decisions")&&s.jsx(nC,{standups:d,waves:x,decisions:g,mode:B.type==="bulletin"?"bulletin":"decisions",onClose:gr,terminalWidth:St?xr:0}),B.type==="knowledge"&&s.jsx(tC,{docs:b,onClose:gr,onRefresh:()=>Ne.getKnowledge().then(v).catch(()=>{}),terminalWidth:St?xr:0,initialDocId:B.docId}),K&&s.jsx(sC,{roleId:K.roleId,roleName:K.roleName,mode:K.mode,onClose:()=>Y(null),onExecutionStart:Qc}),ue&&!ge&&s.jsx(xC,{directive:ue.directive,rootJobs:ue.rootJobs,orgNodes:M,rootRoleId:G,onClose:()=>{Ee(null),Ae(!1),Ie(!1)},onMinimize:()=>Ae(!0),onDone:()=>{ua(),Ie(!0),_t("Wave complete — review & save results","#2E7D32")},onSave:async F=>{try{await Ne.saveWave({directive:ue.directive,jobIds:F}),ua(),_t("Wave saved to bulletin","#2E7D32")}catch(le){_t(`Save failed: ${le instanceof Error?le.message:"unknown"}`,"#C62828")}},onOpenKnowledgeDoc:F=>{Ee(null),Ae(!1),Ie(!1),L({type:"knowledge",docId:F}),Ne.getKnowledge().then(v).catch(()=>{})}}),T.length>0&&!ae&&(()=>{var se;const F=T[T.length-1],le=ne.length>1;return s.jsxs(s.Fragment,{children:[le&&T.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((xe,ve)=>s.jsx("button",{onClick:()=>{P(ve),U([{jobId:xe.jobId,title:`CEO WAVE · ${xe.roleId.toUpperCase()}`,color:"#B71C1C"}])},className:"px-3 py-1.5 text-xs font-bold rounded-t-lg cursor-pointer transition-colors",style:{background:I===ve?"#B71C1C":"var(--terminal-bg)",color:I===ve?"#fff":"var(--terminal-text-secondary)",border:`1px solid ${I===ve?"#B71C1C":"var(--terminal-border)"}`,borderBottom:"none"},children:xe.roleId.toUpperCase()},xe.jobId))}),s.jsx(oC,{jobId:F.jobId,title:T.length>1?F.title:le?`CEO WAVE · ${((se=ne[I])==null?void 0:se.roleName)??""}`:F.title,color:F.color,variant:"modal",style:le&&T.length===1?{marginTop:28}:void 0,onClose:()=>{U([]),W([]),P(0),je(!1)},onMinimize:()=>je(!0),onDone:()=>{Ha(),ua()},onNavigateToJob:xe=>{Ne.getJob(xe).then(ve=>{const Ve=Mc[ve.roleId]??"#888";U(Ye=>[...Ye,{jobId:xe,title:`${ve.roleId.toUpperCase()} · ${ve.task.slice(0,40)}`,color:Ve}])}).catch(console.error)},onOpenKnowledgeDoc:xe=>{U([]),W([]),P(0),je(!1),L({type:"knowledge",docId:xe}),Ne.getKnowledge().then(v).catch(()=>{})}},F.jobId)]})})(),T.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:()=>U(F=>F.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 ",(rl=T[T.length-2])==null?void 0:rl.title]})})}),O&&s.jsx(uC,{cLevelRoles:r.filter(F=>F.level==="c-level"),orgNodes:M,rootId:G,onClose:()=>Z(!1),onDispatch:Bn}),he&&s.jsx(vC,{existingRoles:r,onClose:()=>be(!1),onHire:_i}),Ce&&s.jsx(wC,{roleId:Ce.roleId,roleName:Ce.roleName,onClose:()=>ze(null),onConfirm:br}),et&&s.jsx(eN,{role:et,appearance:me(et.id),onSave:F=>Fe(et.id,F),onReset:()=>Ge(et.id),onClose:()=>{Yt(null),cn("character")},theme:ye,onThemeChange:q,onUpdateName:async(F,le)=>{await Oi(F,{name:le})},initialTab:"character",characterOnly:!0,speechSettings:Te,onSpeechSettingsChange:He,language:Je,onLanguageChange:mt,roleLevel:(Ia=pe[et.id])==null?void 0:Ia.level}),hr&&(()=>{const F=r.find(le=>le.id==="cto")??r.find(le=>le.level==="c-level")??r[0];return s.jsx(tN,{status:Nt.status,history:Nt.history,onClose:()=>xl(!1),onSave:async le=>await Nt.save(le),onLoadHistory:Nt.loadHistory,onRestore:Nt.restore,saving:Nt.state==="saving",delegateRoleName:(F==null?void 0:F.name)??(F==null?void 0:F.id),onDelegate:F?async le=>{xl(!1);try{const se=await Ne.createSession(F.id,"do");qt(ve=>[se,...ve]),Tn(se.id),yl(!0);const xe=`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
95
|
|
|
95
96
|
Changed files:
|
|
96
|
-
${
|
|
97
|
+
${le}`;wr(se.id,xe,"do")}catch(se){_t(`Failed to delegate: ${se instanceof Error?se.message:"error"}`,"#B71C1C")}}:void 0})})(),mr&&s.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>On(!1),children:s.jsx("div",{style:{width:420,maxHeight:"80vh",background:"var(--terminal-bg)",border:"2px solid var(--pixel-border)",borderRadius:8},onClick:F=>F.stopPropagation(),children:s.jsx(nN,{onClose:()=>On(!1)})})}),Nn&&s.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>un(!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:F=>F.stopPropagation(),children:s.jsx(aN,{onClose:()=>un(!1),onSyncComplete:()=>{}})})}),Oa&&s.jsx(sN,{onClose:()=>pl(!1),speechSettings:Te,onSpeechSettingsChange:He,language:Je,onLanguageChange:mt,onOpenSync:()=>un(!0),onOpenGitStatus:()=>Qt(!0),onOpenStats:()=>On(!0)}),ke&&s.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>Qt(!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:F=>F.stopPropagation(),children:s.jsx(iN,{onClose:()=>Qt(!1)})})}),s.jsx("div",{className:"fixed top-16 right-4 z-[70] flex flex-col gap-2",children:tt.map(F=>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:F.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"}),F.message]},F.id))})]})}function W0({role:t,speech:l,onClick:r,liveStatus:i,activeTask:c,featured:u,appearance:d,xpLevel:m}){const x=Mc[t.id]??hN(t.id),f=m??1,g=fN[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(Xs,{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?"🛠️":dN[t.id]??"👤"}),s.jsx("span",{className:"pixel-card-task-text",children:b||g})]})]})}function Ec({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 Ne.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 xN={engine:"AI Engine",company:"Company Info",project:"Project",knowledge:"Knowledge",team:"Team Template",create:"Create"};function Q0(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 pN({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(""),[R,B]=k.useState(""),[L,_]=k.useState(!1),[V,K]=k.useState(!1),Y=k.useRef(null),[T,U]=k.useState("fresh"),[O,Z]=k.useState(""),[ne,W]=k.useState(null),[I,P]=k.useState(!1),[ae,je]=k.useState(!1),[M,z]=k.useState("skip"),[G,D]=k.useState([]),[ue,Ee]=k.useState(""),[ge,Ae]=k.useState(!1),[De,Ie]=k.useState(""),[pe,Pe]=k.useState(null),[fe,he]=k.useState(!1),[be,Ce]=k.useState(!1),[ze,Oe]=k.useState([]),[Me,we]=k.useState("startup"),[Be,tt]=k.useState(!1),[jt,Ut]=k.useState(!1),[yt,Vt]=k.useState(null),[ie,me]=k.useState([]),[Fe,Ge]=k.useState(""),[ye,q]=k.useState(!1),Te=k.useMemo(()=>Q0(M),[M]),He=Te[l]??"engine";k.useEffect(()=>{Ne.detectEngine().then(ke=>{c(ke),d(ke.recommended),g(!1)}).catch(()=>g(!1)),Ne.getTeams().then(Oe).catch(()=>{}),Ne.getStatus().then(ke=>{B(ke.companyRoot||"")}).catch(()=>{})},[]),k.useEffect(()=>{var ke;He==="company"&&((ke=Y.current)==null||ke.focus())},[He]),k.useEffect(()=>{if(L||!R)return;const ke=y.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");A(ke?`${R}/${ke}`:R)},[y,R,L]);const Je=()=>{switch(He){case"engine":return u!=="none"||m.length>10;case"company":return y.trim().length>0;case"project":return T==="fresh"||T==="existing"&&ne===!0;case"knowledge":return M==="existing-akb"?pe===!0:M==="import"?G.length>0:!0;case"team":return!0;case"create":return!jt;default:return!1}},mt=()=>{l<Te.length-1&&Je()&&r(l+1),He==="create"&&!Be&&!ye&&(M==="existing-akb"?xl():hr())},et=()=>{l>0&&r(l-1)};k.useEffect(()=>{const ke=Q0(M);l>=ke.length&&r(ke.length-1)},[M,l]);const Yt=async()=>{if(O.trim()){P(!0);try{const ke=await Ne.validatePath(O.trim());W(ke.valid)}catch{W(!1)}finally{P(!1)}}},cn=async()=>{if(De.trim()){he(!0);try{const ke=await Ne.validatePath(De.trim());Pe(ke.valid&&ke.hasClaudeMd===!0)}catch{Pe(!1)}finally{he(!1)}}},Nt=()=>{const ke=ue.trim();ke&&!G.includes(ke)&&(D([...G,ke]),Ee(""))},hr=async()=>{tt(!0),Vt(null);try{const ke={companyName:y.trim(),description:v.trim()||"An AI-powered organization",team:Me,existingProjectPath:T==="existing"?O.trim():void 0,knowledgePaths:M==="import"&&G.length>0?G:void 0,language:j!=="auto"?j:void 0,location:C.trim()||void 0};(u==="direct-api"||m)&&(ke.apiKey=m||void 0);const Qt=await Ne.scaffold(ke);me(Qt.created),Ge(Qt.projectRoot),Ut(!0)}catch(ke){Vt(ke instanceof Error?ke.message:"Scaffold failed")}finally{tt(!1)}},xl=async()=>{q(!0),Vt(null);try{const ke=await Ne.connectAkb(De.trim());ke.ok?(Ut(!0),me([`Connected to: ${ke.companyRoot}`])):Vt(ke.error||"Failed to connect")}catch(ke){Vt(ke instanceof Error?ke.message:"Connect failed")}finally{q(!1)}},mr=()=>{M==="import"&&G.length>0?t({paths:G,companyRoot:""}):t()},On=ke=>{ke.key==="Enter"&&Je()&&(ke.preventDefault(),mt())},Nn=`w-full px-3 py-2 rounded text-sm outline-none transition-colors
|
|
97
98
|
bg-[var(--terminal-bg)] text-[var(--terminal-text)]
|
|
98
99
|
border border-[var(--terminal-border)]
|
|
99
100
|
focus:border-[var(--terminal-border-hover)]
|
|
100
|
-
placeholder:text-[var(--terminal-text-muted)]`,sn=we=>`p-4 rounded-lg border-2 cursor-pointer transition-all text-[var(--terminal-text)] ${we?"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:Fn,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:Te.map((we,Wt)=>s.jsxs("div",{className:"flex-1",children:[s.jsx("div",{className:"h-1 rounded-full transition-colors",style:{background:Wt<=l?"var(--accent)":"var(--terminal-surface-light)"}}),s.jsx("div",{className:"text-[9px] mt-1 truncate",style:{color:Wt===l?"var(--terminal-text)":"var(--terminal-text-muted)"},children:xN[we]})]},we))})]}),s.jsxs("div",{className:"px-6 py-5 min-h-[280px]",children:[$e==="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:sn(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:sn(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:`${En} mt-3`,placeholder:"sk-ant-...",value:m,onChange:we=>x(we.target.value),autoFocus:!0})]})]})]}),$e==="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:Y,className:En,placeholder:"e.g. Acme Corp",value:y,onChange:we=>b(we.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:`${En} resize-none`,rows:3,placeholder:"What does your AI company do?",value:v,onChange:we=>S(we.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:`${En} flex-1`,placeholder:"/path/to/your-company",value:C,onChange:we=>{A(we.target.value),_(!0)}}),s.jsx("button",{onClick:()=>K(!V),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."}),V&&s.jsx(wc,{onSelect:we=>{A(we),_(!0),K(!1)},onClose:()=>K(!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:En,value:j,onChange:we=>E(we.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:"日本語"})]})]})]}),$e==="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:sn(T==="fresh"),onClick:()=>{U("fresh"),W(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:sn(T==="existing"),onClick:()=>U("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."}),T==="existing"&&s.jsxs("div",{className:"mt-3",onClick:we=>we.stopPropagation(),children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{className:`${En} flex-1`,placeholder:"/path/to/your/project",value:O,onChange:we=>{Z(we.target.value),W(null)},autoFocus:!0}),s.jsx("button",{onClick:()=>ke(!re),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:It,disabled:I||!O.trim(),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--accent)",color:"#fff",opacity:I||!O.trim()?.5:1},children:I?"...":"Verify"})]}),ne===!0&&s.jsxs("div",{className:"text-xs mt-2",style:{color:"var(--active-green)"},children:["✅"," Path verified: ",O]}),ne===!1&&s.jsxs("div",{className:"text-xs mt-2",style:{color:"#EF4444"},children:["❌"," Invalid path"]}),re&&s.jsx(wc,{onSelect:we=>{Z(we),W(!0),ke(!1)},onClose:()=>ke(!1)})]})]})]}),$e==="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:sn(M==="skip"),onClick:()=>z("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:sn(M==="import"),onClick:()=>z("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."}),M==="import"&&s.jsxs("div",{className:"mt-3 space-y-2",onClick:we=>we.stopPropagation(),children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{className:`${En} flex-1`,placeholder:"/path/to/docs",value:ue,onChange:we=>Ee(we.target.value),onKeyDown:we=>{we.key==="Enter"&&(we.preventDefault(),Nt())},autoFocus:!0}),s.jsx("button",{onClick:()=>Ae(!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:Nt,disabled:!ue.trim(),className:"px-3 py-2 rounded text-xs font-medium",style:{background:"var(--accent)",color:"#fff",opacity:ue.trim()?1:.5},children:"Add"})]}),ge&&s.jsx(wc,{onSelect:we=>{G.includes(we)||D([...G,we]),Ae(!1)},onClose:()=>Ae(!1)}),G.length>0&&s.jsx("div",{className:"space-y-1",children:G.map((we,Wt)=>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:we}),s.jsx("button",{onClick:()=>D(G.filter((Sa,fl)=>fl!==Wt)),className:"opacity-50 hover:opacity-100",children:"✕"})]},Wt))}),G.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:sn(M==="existing-akb"),onClick:()=>z("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."}),M==="existing-akb"&&s.jsxs("div",{className:"mt-3",onClick:we=>we.stopPropagation(),children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{className:`${En} flex-1`,placeholder:"/path/to/your/akb",value:De,onChange:we=>{He(we.target.value),We(null)},autoFocus:!0}),s.jsx("button",{onClick:()=>Ce(!be),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:an,disabled:fe||!De.trim(),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--accent)",color:"#fff",opacity:fe||!De.trim()?.5:1},children:fe?"...":"Verify"})]}),ye===!0&&s.jsxs("div",{className:"text-xs mt-2",style:{color:"var(--active-green)"},children:["✅"," Valid AKB found: ",De]}),ye===!1&&s.jsxs("div",{className:"text-xs mt-2",style:{color:"#EF4444"},children:["❌"," No valid AKB (CLAUDE.md required)"]}),be&&s.jsx(wc,{onSelect:we=>{He(we),We(null),Ce(!1)},onClose:()=>Ce(!1)})]})]})]}),$e==="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."}),ze.map(we=>s.jsxs("div",{className:sn(Me===we.id),onClick:()=>ve(we.id),children:[s.jsx("div",{className:"font-medium text-sm capitalize",children:we.id}),s.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:we.roles.map(Wt=>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:Wt.name},Wt.id))})]},we.id)),s.jsxs("div",{className:sn(Me==="custom"),onClick:()=>ve("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."})]})]}),$e==="create"&&s.jsxs("div",{className:"space-y-4",children:[s.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:jt?M==="existing-akb"?"AKB Connected!":"Company Created!":"Review & Create"}),!jt&&!Oe&&!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:M==="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:"})," ",De]}),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:"})," ",T==="fresh"?"Start Fresh":`Existing (${O})`]}),s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Knowledge:"})," ",M==="skip"?"Fresh (empty)":`Import ${G.length} source(s)`]}),s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Team:"})," ",Me]}),M==="import"&&G.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."})]})}),yt&&s.jsx("div",{className:"text-xs p-3 rounded",style:{background:"rgba(220,38,38,0.15)",color:"#f87171"},children:yt})]}),(Oe||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..."})]}),jt&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"text-center py-4 text-4xl",children:"🏢"}),Fe&&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:"})," ",Fe]}),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:ae.map((we,Wt)=>s.jsxs("div",{className:"py-0.5",children:[s.jsx("span",{style:{color:"var(--active-green)"},children:"✓"})," ",we]},Wt))}),M==="import"&&G.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&&!jt&&s.jsx("button",{onClick:Qe,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," / ",Te.length]}),s.jsx("div",{children:jt?s.jsx("button",{onClick:ir,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:mt,disabled:!Ke()||Oe||xe,className:"px-5 py-2 rounded text-sm font-medium transition-colors",style:{background:Ke()?"var(--accent)":"var(--terminal-border)",color:"#fff",opacity:Ke()&&!Oe&&!xe?1:.5},children:$e==="create"?Oe||xe?xe?"Connecting...":"Creating...":M==="existing-akb"?"Connect AKB":"Create Company":"Next"})})]})]})})}function yN(){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 Ne.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 gN=k.lazy(()=>J2(()=>import("./preview-app-DtCHQ2CL.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 bN(){var t;try{const l=localStorage.getItem("tycono-theme"),r=l&&l in Yr?l:"default",i=(t=Yr[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 vN(){const{initialized:t,loading:l,refetch:r}=yN(),[i,c]=k.useState(null);k.useEffect(()=>{bN()},[]);const u=d=>{d&&c(d),r()};return l?s.jsx(_g,{}):t?s.jsx(mN,{importJob:i,onImportDone:()=>c(null)}):s.jsx(pN,{onComplete:u})}function wN(){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(gN,{})}):s.jsx(vN,{})})}W2.createRoot(document.getElementById("root")).render(s.jsx(k.StrictMode,{children:s.jsx(wN,{})}));export{pg as H,gg as P,bg as S,SN as a,yg as b,xg as c,Wf as d,Tj as e,Dj as f,jN as g,zj as h,s as j,k as r};
|
|
101
|
+
placeholder:text-[var(--terminal-text-muted)]`,un=ke=>`p-4 rounded-lg border-2 cursor-pointer transition-all text-[var(--terminal-text)] ${ke?"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:On,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:Te.map((ke,Qt)=>s.jsxs("div",{className:"flex-1",children:[s.jsx("div",{className:"h-1 rounded-full transition-colors",style:{background:Qt<=l?"var(--accent)":"var(--terminal-surface-light)"}}),s.jsx("div",{className:"text-[9px] mt-1 truncate",style:{color:Qt===l?"var(--terminal-text)":"var(--terminal-text-muted)"},children:xN[ke]})]},ke))})]}),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:un(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:un(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:`${Nn} mt-3`,placeholder:"sk-ant-...",value:m,onChange:ke=>x(ke.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:Y,className:Nn,placeholder:"e.g. Acme Corp",value:y,onChange:ke=>b(ke.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:`${Nn} resize-none`,rows:3,placeholder:"What does your AI company do?",value:v,onChange:ke=>S(ke.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:`${Nn} flex-1`,placeholder:"/path/to/your-company",value:C,onChange:ke=>{A(ke.target.value),_(!0)}}),s.jsx("button",{onClick:()=>K(!V),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."}),V&&s.jsx(Ec,{onSelect:ke=>{A(ke),_(!0),K(!1)},onClose:()=>K(!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:Nn,value:j,onChange:ke=>E(ke.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:un(T==="fresh"),onClick:()=>{U("fresh"),W(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:un(T==="existing"),onClick:()=>U("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."}),T==="existing"&&s.jsxs("div",{className:"mt-3",onClick:ke=>ke.stopPropagation(),children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{className:`${Nn} flex-1`,placeholder:"/path/to/your/project",value:O,onChange:ke=>{Z(ke.target.value),W(null)},autoFocus:!0}),s.jsx("button",{onClick:()=>je(!ae),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:Yt,disabled:I||!O.trim(),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--accent)",color:"#fff",opacity:I||!O.trim()?.5:1},children:I?"...":"Verify"})]}),ne===!0&&s.jsxs("div",{className:"text-xs mt-2",style:{color:"var(--active-green)"},children:["✅"," Path verified: ",O]}),ne===!1&&s.jsxs("div",{className:"text-xs mt-2",style:{color:"#EF4444"},children:["❌"," Invalid path"]}),ae&&s.jsx(Ec,{onSelect:ke=>{Z(ke),W(!0),je(!1)},onClose:()=>je(!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:un(M==="skip"),onClick:()=>z("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:un(M==="import"),onClick:()=>z("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."}),M==="import"&&s.jsxs("div",{className:"mt-3 space-y-2",onClick:ke=>ke.stopPropagation(),children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{className:`${Nn} flex-1`,placeholder:"/path/to/docs",value:ue,onChange:ke=>Ee(ke.target.value),onKeyDown:ke=>{ke.key==="Enter"&&(ke.preventDefault(),Nt())},autoFocus:!0}),s.jsx("button",{onClick:()=>Ae(!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:Nt,disabled:!ue.trim(),className:"px-3 py-2 rounded text-xs font-medium",style:{background:"var(--accent)",color:"#fff",opacity:ue.trim()?1:.5},children:"Add"})]}),ge&&s.jsx(Ec,{onSelect:ke=>{G.includes(ke)||D([...G,ke]),Ae(!1)},onClose:()=>Ae(!1)}),G.length>0&&s.jsx("div",{className:"space-y-1",children:G.map((ke,Qt)=>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:ke}),s.jsx("button",{onClick:()=>D(G.filter((Oa,pl)=>pl!==Qt)),className:"opacity-50 hover:opacity-100",children:"✕"})]},Qt))}),G.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:un(M==="existing-akb"),onClick:()=>z("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."}),M==="existing-akb"&&s.jsxs("div",{className:"mt-3",onClick:ke=>ke.stopPropagation(),children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{className:`${Nn} flex-1`,placeholder:"/path/to/your/akb",value:De,onChange:ke=>{Ie(ke.target.value),Pe(null)},autoFocus:!0}),s.jsx("button",{onClick:()=>Ce(!be),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:cn,disabled:fe||!De.trim(),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--accent)",color:"#fff",opacity:fe||!De.trim()?.5:1},children:fe?"...":"Verify"})]}),pe===!0&&s.jsxs("div",{className:"text-xs mt-2",style:{color:"var(--active-green)"},children:["✅"," Valid AKB found: ",De]}),pe===!1&&s.jsxs("div",{className:"text-xs mt-2",style:{color:"#EF4444"},children:["❌"," No valid AKB (CLAUDE.md required)"]}),be&&s.jsx(Ec,{onSelect:ke=>{Ie(ke),Pe(null),Ce(!1)},onClose:()=>Ce(!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."}),ze.map(ke=>s.jsxs("div",{className:un(Me===ke.id),onClick:()=>we(ke.id),children:[s.jsx("div",{className:"font-medium text-sm capitalize",children:ke.id}),s.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:ke.roles.map(Qt=>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:Qt.name},Qt.id))})]},ke.id)),s.jsxs("div",{className:un(Me==="custom"),onClick:()=>we("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:jt?M==="existing-akb"?"AKB Connected!":"Company Created!":"Review & Create"}),!jt&&!Be&&!ye&&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:M==="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:"})," ",De]}),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:"})," ",T==="fresh"?"Start Fresh":`Existing (${O})`]}),s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Knowledge:"})," ",M==="skip"?"Fresh (empty)":`Import ${G.length} source(s)`]}),s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Team:"})," ",Me]}),M==="import"&&G.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."})]})}),yt&&s.jsx("div",{className:"text-xs p-3 rounded",style:{background:"rgba(220,38,38,0.15)",color:"#f87171"},children:yt})]}),(Be||ye)&&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:ye?"Connecting to AKB...":"Scaffolding your company..."})]}),jt&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"text-center py-4 text-4xl",children:"🏢"}),Fe&&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:"})," ",Fe]}),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:ie.map((ke,Qt)=>s.jsxs("div",{className:"py-0.5",children:[s.jsx("span",{style:{color:"var(--active-green)"},children:"✓"})," ",ke]},Qt))}),M==="import"&&G.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&&!jt&&s.jsx("button",{onClick:et,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," / ",Te.length]}),s.jsx("div",{children:jt?s.jsx("button",{onClick:mr,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:mt,disabled:!Je()||Be||ye,className:"px-5 py-2 rounded text-sm font-medium transition-colors",style:{background:Je()?"var(--accent)":"var(--terminal-border)",color:"#fff",opacity:Je()&&!Be&&!ye?1:.5},children:He==="create"?Be||ye?ye?"Connecting...":"Creating...":M==="existing-akb"?"Connect AKB":"Create Company":"Next"})})]})]})})}function yN(){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 Ne.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 gN=k.lazy(()=>J2(()=>import("./preview-app-F1hM5BWu.js"),[]));function Lg(){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 bN(){var t;try{const l=localStorage.getItem("tycono-theme"),r=l&&l in na?l:"default",i=(t=na[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 vN(){const{initialized:t,loading:l,refetch:r}=yN(),[i,c]=k.useState(null);k.useEffect(()=>{bN()},[]);const u=d=>{d&&c(d),r()};return l?s.jsx(Lg,{}):t?s.jsx(mN,{importJob:i,onImportDone:()=>c(null)}):s.jsx(pN,{onComplete:u})}function wN(){const t=new URLSearchParams(window.location.search).has("sprite-preview");return s.jsx(P2,{children:t?s.jsx(k.Suspense,{fallback:s.jsx(Lg,{}),children:s.jsx(gN,{})}):s.jsx(vN,{})})}W2.createRoot(document.getElementById("root")).render(s.jsx(k.StrictMode,{children:s.jsx(wN,{})}));export{vg as H,kg as P,jg as S,SN as a,wg as b,bg as c,eh as d,Tj as e,Dj as f,jN as g,zj as h,s as j,k as r};
|