tycono 0.1.12 → 0.1.14

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.
@@ -1,96 +0,0 @@
1
- var Bb=Object.defineProperty;var Lb=(t,l,r)=>l in t?Bb(t,l,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[l]=r;var l1=(t,l,r)=>Lb(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 f of u.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&i(f)}).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 q0(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Xf={exports:{}},ss={};/**
2
- * @license React
3
- * react-jsx-runtime.production.js
4
- *
5
- * Copyright (c) Meta Platforms, Inc. and affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var r1;function $b(){if(r1)return ss;r1=1;var t=Symbol.for("react.transitional.element"),l=Symbol.for("react.fragment");function r(i,c,u){var f=null;if(u!==void 0&&(f=""+u),c.key!==void 0&&(f=""+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:f,ref:c!==void 0?c:null,props:u}}return ss.Fragment=l,ss.jsx=r,ss.jsxs=r,ss}var a1;function Hb(){return a1||(a1=1,Xf.exports=$b()),Xf.exports}var o=Hb(),Vf={exports:{}},Ge={};/**
10
- * @license React
11
- * react.production.js
12
- *
13
- * Copyright (c) Meta Platforms, Inc. and affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var i1;function Ub(){if(i1)return Ge;i1=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"),f=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),b=Symbol.iterator;function v(_){return _===null||typeof _!="object"?null:(_=b&&_[b]||_["@@iterator"],typeof _=="function"?_:null)}var j={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,C={};function E(_,J,D){this.props=_,this.context=J,this.refs=C,this.updater=D||j}E.prototype.isReactComponent={},E.prototype.setState=function(_,J){if(typeof _!="object"&&typeof _!="function"&&_!=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,_,J,"setState")},E.prototype.forceUpdate=function(_){this.updater.enqueueForceUpdate(this,_,"forceUpdate")};function A(){}A.prototype=E.prototype;function R(_,J,D){this.props=_,this.context=J,this.refs=C,this.updater=D||j}var O=R.prototype=new A;O.constructor=R,S(O,E.prototype),O.isPureReactComponent=!0;var B=Array.isArray;function T(){}var I={H:null,A:null,T:null,S:null},X=Object.prototype.hasOwnProperty;function ee(_,J,D){var pe=D.ref;return{$$typeof:t,type:_,key:J,ref:pe!==void 0?pe:null,props:D}}function z(_,J){return ee(_.type,J,_.props)}function $(_){return typeof _=="object"&&_!==null&&_.$$typeof===t}function U(_){var J={"=":"=0",":":"=2"};return"$"+_.replace(/[=:]/g,function(D){return J[D]})}var ne=/\/+/g;function re(_,J){return typeof _=="object"&&_!==null&&_.key!=null?U(""+_.key):J.toString(36)}function V(_){switch(_.status){case"fulfilled":return _.value;case"rejected":throw _.reason;default:switch(typeof _.status=="string"?_.then(T,T):(_.status="pending",_.then(function(J){_.status==="pending"&&(_.status="fulfilled",_.value=J)},function(J){_.status==="pending"&&(_.status="rejected",_.reason=J)})),_.status){case"fulfilled":return _.value;case"rejected":throw _.reason}}throw _}function Y(_,J,D,pe,Ce){var Ne=typeof _;(Ne==="undefined"||Ne==="boolean")&&(_=null);var He=!1;if(_===null)He=!0;else switch(Ne){case"bigint":case"string":case"number":He=!0;break;case"object":switch(_.$$typeof){case t:case l:He=!0;break;case g:return He=_._init,Y(He(_._payload),J,D,pe,Ce)}}if(He)return Ce=Ce(_),He=pe===""?"."+re(_,0):pe,B(Ce)?(D="",He!=null&&(D=He.replace(ne,"$&/")+"/"),Y(Ce,J,D,"",function(K){return K})):Ce!=null&&($(Ce)&&(Ce=z(Ce,D+(Ce.key==null||_&&_.key===Ce.key?"":(""+Ce.key).replace(ne,"$&/")+"/")+He)),J.push(Ce)),1;He=0;var _e=pe===""?".":pe+":";if(B(_))for(var oe=0;oe<_.length;oe++)pe=_[oe],Ne=_e+re(pe,oe),He+=Y(pe,J,D,Ne,Ce);else if(oe=v(_),typeof oe=="function")for(_=oe.call(_),oe=0;!(pe=_.next()).done;)pe=pe.value,Ne=_e+re(pe,oe++),He+=Y(pe,J,D,Ne,Ce);else if(Ne==="object"){if(typeof _.then=="function")return Y(V(_),J,D,pe,Ce);throw J=String(_),Error("Objects are not valid as a React child (found: "+(J==="[object Object]"?"object with keys {"+Object.keys(_).join(", ")+"}":J)+"). If you meant to render a collection of children, use an array instead.")}return He}function Q(_,J,D){if(_==null)return _;var pe=[],Ce=0;return Y(_,pe,"","",function(Ne){return J.call(D,Ne,Ce++)}),pe}function se(_){if(_._status===-1){var J=_._result;J=J(),J.then(function(D){(_._status===0||_._status===-1)&&(_._status=1,_._result=D)},function(D){(_._status===0||_._status===-1)&&(_._status=2,_._result=D)}),_._status===-1&&(_._status=0,_._result=J)}if(_._status===1)return _._result.default;throw _._result}var ve=typeof reportError=="function"?reportError:function(_){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var J=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof _=="object"&&_!==null&&typeof _.message=="string"?String(_.message):String(_),error:_});if(!window.dispatchEvent(J))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",_);return}console.error(_)},M={map:Q,forEach:function(_,J,D){Q(_,function(){J.apply(this,arguments)},D)},count:function(_){var J=0;return Q(_,function(){J++}),J},toArray:function(_){return Q(_,function(J){return J})||[]},only:function(_){if(!$(_))throw Error("React.Children.only expected to receive a single React element child.");return _}};return Ge.Activity=y,Ge.Children=M,Ge.Component=E,Ge.Fragment=r,Ge.Profiler=c,Ge.PureComponent=R,Ge.StrictMode=i,Ge.Suspense=p,Ge.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=I,Ge.__COMPILER_RUNTIME={__proto__:null,c:function(_){return I.H.useMemoCache(_)}},Ge.cache=function(_){return function(){return _.apply(null,arguments)}},Ge.cacheSignal=function(){return null},Ge.cloneElement=function(_,J,D){if(_==null)throw Error("The argument must be a React element, but you passed "+_+".");var pe=S({},_.props),Ce=_.key;if(J!=null)for(Ne in J.key!==void 0&&(Ce=""+J.key),J)!X.call(J,Ne)||Ne==="key"||Ne==="__self"||Ne==="__source"||Ne==="ref"&&J.ref===void 0||(pe[Ne]=J[Ne]);var Ne=arguments.length-2;if(Ne===1)pe.children=D;else if(1<Ne){for(var He=Array(Ne),_e=0;_e<Ne;_e++)He[_e]=arguments[_e+2];pe.children=He}return ee(_.type,Ce,pe)},Ge.createContext=function(_){return _={$$typeof:f,_currentValue:_,_currentValue2:_,_threadCount:0,Provider:null,Consumer:null},_.Provider=_,_.Consumer={$$typeof:u,_context:_},_},Ge.createElement=function(_,J,D){var pe,Ce={},Ne=null;if(J!=null)for(pe in J.key!==void 0&&(Ne=""+J.key),J)X.call(J,pe)&&pe!=="key"&&pe!=="__self"&&pe!=="__source"&&(Ce[pe]=J[pe]);var He=arguments.length-2;if(He===1)Ce.children=D;else if(1<He){for(var _e=Array(He),oe=0;oe<He;oe++)_e[oe]=arguments[oe+2];Ce.children=_e}if(_&&_.defaultProps)for(pe in He=_.defaultProps,He)Ce[pe]===void 0&&(Ce[pe]=He[pe]);return ee(_,Ne,Ce)},Ge.createRef=function(){return{current:null}},Ge.forwardRef=function(_){return{$$typeof:m,render:_}},Ge.isValidElement=$,Ge.lazy=function(_){return{$$typeof:g,_payload:{_status:-1,_result:_},_init:se}},Ge.memo=function(_,J){return{$$typeof:d,type:_,compare:J===void 0?null:J}},Ge.startTransition=function(_){var J=I.T,D={};I.T=D;try{var pe=_(),Ce=I.S;Ce!==null&&Ce(D,pe),typeof pe=="object"&&pe!==null&&typeof pe.then=="function"&&pe.then(T,ve)}catch(Ne){ve(Ne)}finally{J!==null&&D.types!==null&&(J.types=D.types),I.T=J}},Ge.unstable_useCacheRefresh=function(){return I.H.useCacheRefresh()},Ge.use=function(_){return I.H.use(_)},Ge.useActionState=function(_,J,D){return I.H.useActionState(_,J,D)},Ge.useCallback=function(_,J){return I.H.useCallback(_,J)},Ge.useContext=function(_){return I.H.useContext(_)},Ge.useDebugValue=function(){},Ge.useDeferredValue=function(_,J){return I.H.useDeferredValue(_,J)},Ge.useEffect=function(_,J){return I.H.useEffect(_,J)},Ge.useEffectEvent=function(_){return I.H.useEffectEvent(_)},Ge.useId=function(){return I.H.useId()},Ge.useImperativeHandle=function(_,J,D){return I.H.useImperativeHandle(_,J,D)},Ge.useInsertionEffect=function(_,J){return I.H.useInsertionEffect(_,J)},Ge.useLayoutEffect=function(_,J){return I.H.useLayoutEffect(_,J)},Ge.useMemo=function(_,J){return I.H.useMemo(_,J)},Ge.useOptimistic=function(_,J){return I.H.useOptimistic(_,J)},Ge.useReducer=function(_,J,D){return I.H.useReducer(_,J,D)},Ge.useRef=function(_){return I.H.useRef(_)},Ge.useState=function(_){return I.H.useState(_)},Ge.useSyncExternalStore=function(_,J,D){return I.H.useSyncExternalStore(_,J,D)},Ge.useTransition=function(){return I.H.useTransition()},Ge.version="19.2.4",Ge}var s1;function eh(){return s1||(s1=1,Vf.exports=Ub()),Vf.exports}var k=eh(),Gf={exports:{}},os={},Kf={exports:{}},Qf={};/**
18
- * @license React
19
- * scheduler.production.js
20
- *
21
- * Copyright (c) Meta Platforms, Inc. and affiliates.
22
- *
23
- * This source code is licensed under the MIT license found in the
24
- * LICENSE file in the root directory of this source tree.
25
- */var o1;function Ib(){return o1||(o1=1,(function(t){function l(Y,Q){var se=Y.length;Y.push(Q);e:for(;0<se;){var ve=se-1>>>1,M=Y[ve];if(0<c(M,Q))Y[ve]=Q,Y[se]=M,se=ve;else break e}}function r(Y){return Y.length===0?null:Y[0]}function i(Y){if(Y.length===0)return null;var Q=Y[0],se=Y.pop();if(se!==Q){Y[0]=se;e:for(var ve=0,M=Y.length,_=M>>>1;ve<_;){var J=2*(ve+1)-1,D=Y[J],pe=J+1,Ce=Y[pe];if(0>c(D,se))pe<M&&0>c(Ce,D)?(Y[ve]=Ce,Y[pe]=se,ve=pe):(Y[ve]=D,Y[J]=se,ve=J);else if(pe<M&&0>c(Ce,se))Y[ve]=Ce,Y[pe]=se,ve=pe;else break e}}return Q}function c(Y,Q){var se=Y.sortIndex-Q.sortIndex;return se!==0?se:Y.id-Q.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 f=Date,m=f.now();t.unstable_now=function(){return f.now()-m}}var p=[],d=[],g=1,y=null,b=3,v=!1,j=!1,S=!1,C=!1,E=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,R=typeof setImmediate<"u"?setImmediate:null;function O(Y){for(var Q=r(d);Q!==null;){if(Q.callback===null)i(d);else if(Q.startTime<=Y)i(d),Q.sortIndex=Q.expirationTime,l(p,Q);else break;Q=r(d)}}function B(Y){if(S=!1,O(Y),!j)if(r(p)!==null)j=!0,T||(T=!0,U());else{var Q=r(d);Q!==null&&V(B,Q.startTime-Y)}}var T=!1,I=-1,X=5,ee=-1;function z(){return C?!0:!(t.unstable_now()-ee<X)}function $(){if(C=!1,T){var Y=t.unstable_now();ee=Y;var Q=!0;try{e:{j=!1,S&&(S=!1,A(I),I=-1),v=!0;var se=b;try{t:{for(O(Y),y=r(p);y!==null&&!(y.expirationTime>Y&&z());){var ve=y.callback;if(typeof ve=="function"){y.callback=null,b=y.priorityLevel;var M=ve(y.expirationTime<=Y);if(Y=t.unstable_now(),typeof M=="function"){y.callback=M,O(Y),Q=!0;break t}y===r(p)&&i(p),O(Y)}else i(p);y=r(p)}if(y!==null)Q=!0;else{var _=r(d);_!==null&&V(B,_.startTime-Y),Q=!1}}break e}finally{y=null,b=se,v=!1}Q=void 0}}finally{Q?U():T=!1}}}var U;if(typeof R=="function")U=function(){R($)};else if(typeof MessageChannel<"u"){var ne=new MessageChannel,re=ne.port2;ne.port1.onmessage=$,U=function(){re.postMessage(null)}}else U=function(){E($,0)};function V(Y,Q){I=E(function(){Y(t.unstable_now())},Q)}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(Y){Y.callback=null},t.unstable_forceFrameRate=function(Y){0>Y||125<Y?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):X=0<Y?Math.floor(1e3/Y):5},t.unstable_getCurrentPriorityLevel=function(){return b},t.unstable_next=function(Y){switch(b){case 1:case 2:case 3:var Q=3;break;default:Q=b}var se=b;b=Q;try{return Y()}finally{b=se}},t.unstable_requestPaint=function(){C=!0},t.unstable_runWithPriority=function(Y,Q){switch(Y){case 1:case 2:case 3:case 4:case 5:break;default:Y=3}var se=b;b=Y;try{return Q()}finally{b=se}},t.unstable_scheduleCallback=function(Y,Q,se){var ve=t.unstable_now();switch(typeof se=="object"&&se!==null?(se=se.delay,se=typeof se=="number"&&0<se?ve+se:ve):se=ve,Y){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=se+M,Y={id:g++,callback:Q,priorityLevel:Y,startTime:se,expirationTime:M,sortIndex:-1},se>ve?(Y.sortIndex=se,l(d,Y),r(p)===null&&Y===r(d)&&(S?(A(I),I=-1):S=!0,V(B,se-ve))):(Y.sortIndex=M,l(p,Y),j||v||(j=!0,T||(T=!0,U()))),Y},t.unstable_shouldYield=z,t.unstable_wrapCallback=function(Y){var Q=b;return function(){var se=b;b=Q;try{return Y.apply(this,arguments)}finally{b=se}}}})(Qf)),Qf}var c1;function Yb(){return c1||(c1=1,Kf.exports=Ib()),Kf.exports}var Wf={exports:{}},hn={};/**
26
- * @license React
27
- * react-dom.production.js
28
- *
29
- * Copyright (c) Meta Platforms, Inc. and affiliates.
30
- *
31
- * This source code is licensed under the MIT license found in the
32
- * LICENSE file in the root directory of this source tree.
33
- */var u1;function qb(){if(u1)return hn;u1=1;var t=eh();function l(p){var d="https://react.dev/errors/"+p;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)d+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+p+"; visit "+d+" 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(p,d,g){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:y==null?null:""+y,children:p,containerInfo:d,implementation:g}}var f=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(p,d){if(p==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return hn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,hn.createPortal=function(p,d){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(l(299));return u(p,d,null,g)},hn.flushSync=function(p){var d=f.T,g=i.p;try{if(f.T=null,i.p=2,p)return p()}finally{f.T=d,i.p=g,i.d.f()}},hn.preconnect=function(p,d){typeof p=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,i.d.C(p,d))},hn.prefetchDNS=function(p){typeof p=="string"&&i.d.D(p)},hn.preinit=function(p,d){if(typeof p=="string"&&d&&typeof d.as=="string"){var g=d.as,y=m(g,d.crossOrigin),b=typeof d.integrity=="string"?d.integrity:void 0,v=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;g==="style"?i.d.S(p,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:y,integrity:b,fetchPriority:v}):g==="script"&&i.d.X(p,{crossOrigin:y,integrity:b,fetchPriority:v,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},hn.preinitModule=function(p,d){if(typeof p=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var g=m(d.as,d.crossOrigin);i.d.M(p,{crossOrigin:g,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&i.d.M(p)},hn.preload=function(p,d){if(typeof p=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var g=d.as,y=m(g,d.crossOrigin);i.d.L(p,g,{crossOrigin:y,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},hn.preloadModule=function(p,d){if(typeof p=="string")if(d){var g=m(d.as,d.crossOrigin);i.d.m(p,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:g,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else i.d.m(p)},hn.requestFormReset=function(p){i.d.r(p)},hn.unstable_batchedUpdates=function(p,d){return p(d)},hn.useFormState=function(p,d,g){return f.H.useFormState(p,d,g)},hn.useFormStatus=function(){return f.H.useHostTransitionStatus()},hn.version="19.2.4",hn}var f1;function Xb(){if(f1)return Wf.exports;f1=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(),Wf.exports=qb(),Wf.exports}/**
34
- * @license React
35
- * react-dom-client.production.js
36
- *
37
- * Copyright (c) Meta Platforms, Inc. and affiliates.
38
- *
39
- * This source code is licensed under the MIT license found in the
40
- * LICENSE file in the root directory of this source tree.
41
- */var d1;function Vb(){if(d1)return os;d1=1;var t=Yb(),l=eh(),r=Xb();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 f(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 p(e){if(u(e)!==e)throw Error(i(188))}function d(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,s=n;;){var h=a.return;if(h===null)break;var x=h.alternate;if(x===null){if(s=h.return,s!==null){a=s;continue}break}if(h.child===x.child){for(x=h.child;x;){if(x===a)return p(h),e;if(x===s)return p(h),n;x=x.sibling}throw Error(i(188))}if(a.return!==s.return)a=h,s=x;else{for(var w=!1,N=h.child;N;){if(N===a){w=!0,a=h,s=x;break}if(N===s){w=!0,s=h,a=x;break}N=N.sibling}if(!w){for(N=x.child;N;){if(N===a){w=!0,a=x,s=h;break}if(N===s){w=!0,s=x,a=h;break}N=N.sibling}if(!w)throw Error(i(189))}}if(a.alternate!==s)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"),j=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),R=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),I=Symbol.for("react.memo"),X=Symbol.for("react.lazy"),ee=Symbol.for("react.activity"),z=Symbol.for("react.memo_cache_sentinel"),$=Symbol.iterator;function U(e){return e===null||typeof e!="object"?null:(e=$&&e[$]||e["@@iterator"],typeof e=="function"?e:null)}var ne=Symbol.for("react.client.reference");function re(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ne?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case S:return"Fragment";case E:return"Profiler";case C:return"StrictMode";case B:return"Suspense";case T:return"SuspenseList";case ee:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case j:return"Portal";case R:return e.displayName||"Context";case A:return(e._context.displayName||"Context")+".Consumer";case O:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case I:return n=e.displayName||null,n!==null?n:re(e.type)||"Memo";case X:n=e._payload,e=e._init;try{return re(e(n))}catch{}}return null}var V=Array.isArray,Y=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,se={pending:!1,data:null,method:null,action:null},ve=[],M=-1;function _(e){return{current:e}}function J(e){0>M||(e.current=ve[M],ve[M]=null,M--)}function D(e,n){M++,ve[M]=e.current,e.current=n}var pe=_(null),Ce=_(null),Ne=_(null),He=_(null);function _e(e,n){switch(D(Ne,n),D(Ce,e),D(pe,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?Ep(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=Ep(n),e=Np(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}J(pe),D(pe,e)}function oe(){J(pe),J(Ce),J(Ne)}function K(e){e.memoizedState!==null&&D(He,e);var n=pe.current,a=Np(n,e.type);n!==a&&(D(Ce,e),D(pe,a))}function fe(e){Ce.current===e&&(J(pe),J(Ce)),He.current===e&&(J(He),ls._currentValue=se)}var Se,te;function ke(e){if(Se===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);Se=n&&n[1]||"",te=-1<a.stack.indexOf(`
42
- at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
43
- `+Se+e+te}var je=!1;function Te(e,n){if(!e||je)return"";je=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(n){var he=function(){throw Error()};if(Object.defineProperty(he.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(he,[])}catch(le){var P=le}Reflect.construct(e,[],he)}else{try{he.call()}catch(le){P=le}e.call(he.prototype)}}else{try{throw Error()}catch(le){P=le}(he=e())&&typeof he.catch=="function"&&he.catch(function(){})}}catch(le){if(le&&P&&typeof le.stack=="string")return[le.stack,P.stack]}return[null,null]}};s.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var h=Object.getOwnPropertyDescriptor(s.DetermineComponentFrameRoot,"name");h&&h.configurable&&Object.defineProperty(s.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=s.DetermineComponentFrameRoot(),w=x[0],N=x[1];if(w&&N){var H=w.split(`
44
- `),Z=N.split(`
45
- `);for(h=s=0;s<H.length&&!H[s].includes("DetermineComponentFrameRoot");)s++;for(;h<Z.length&&!Z[h].includes("DetermineComponentFrameRoot");)h++;if(s===H.length||h===Z.length)for(s=H.length-1,h=Z.length-1;1<=s&&0<=h&&H[s]!==Z[h];)h--;for(;1<=s&&0<=h;s--,h--)if(H[s]!==Z[h]){if(s!==1||h!==1)do if(s--,h--,0>h||H[s]!==Z[h]){var ie=`
46
- `+H[s].replace(" at new "," at ");return e.displayName&&ie.includes("<anonymous>")&&(ie=ie.replace("<anonymous>",e.displayName)),ie}while(1<=s&&0<=h);break}}}finally{je=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?ke(a):""}function Le(e,n){switch(e.tag){case 26:case 27:case 5:return ke(e.type);case 16:return ke("Lazy");case 13:return e.child!==n&&n!==null?ke("Suspense Fallback"):ke("Suspense");case 19:return ke("SuspenseList");case 0:case 15:return Te(e.type,!1);case 11:return Te(e.type.render,!1);case 1:return Te(e.type,!0);case 31:return ke("Activity");default:return""}}function $e(e){try{var n="",a=null;do n+=Le(e,a),a=e,e=e.return;while(e);return n}catch(s){return`
47
- Error generating stack: `+s.message+`
48
- `+s.stack}}var Yt=Object.prototype.hasOwnProperty,pt=t.unstable_scheduleCallback,St=t.unstable_cancelCallback,Bt=t.unstable_shouldYield,Kt=t.unstable_requestPaint,vt=t.unstable_now,qt=t.unstable_getCurrentPriorityLevel,ae=t.unstable_ImmediatePriority,ye=t.unstable_UserBlockingPriority,Re=t.unstable_NormalPriority,qe=t.unstable_LowPriority,we=t.unstable_IdlePriority,Ae=t.log,bt=t.unstable_setDisableYieldValue,rt=null,de=null;function Pe(e){if(typeof Ae=="function"&&bt(e),de&&typeof de.setStrictMode=="function")try{de.setStrictMode(rt,e)}catch{}}var dt=Math.clz32?Math.clz32:$c,dn=Math.log,et=Math.LN2;function $c(e){return e>>>=0,e===0?32:31-(dn(e)/et|0)|0}var rr=256,wa=262144,ar=4194304;function zl(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 ir(e,n,a){var s=e.pendingLanes;if(s===0)return 0;var h=0,x=e.suspendedLanes,w=e.pingedLanes;e=e.warmLanes;var N=s&134217727;return N!==0?(s=N&~x,s!==0?h=zl(s):(w&=N,w!==0?h=zl(w):a||(a=N&~e,a!==0&&(h=zl(a))))):(N=s&~x,N!==0?h=zl(N):w!==0?h=zl(w):a||(a=s&~e,a!==0&&(h=zl(a)))),h===0?0:n!==0&&n!==h&&(n&x)===0&&(x=h&-h,a=n&-n,x>=a||x===32&&(a&4194048)!==0)?n:h}function Yr(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function di(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 yn(){var e=ar;return ar<<=1,(ar&62914560)===0&&(ar=4194304),e}function hi(e){for(var n=[],a=0;31>a;a++)n.push(e);return n}function Qn(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function mi(e,n,a,s,h,x){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,Z=e.hiddenUpdates;for(a=w&~a;0<a;){var ie=31-dt(a),he=1<<ie;N[ie]=0,H[ie]=-1;var P=Z[ie];if(P!==null)for(Z[ie]=null,ie=0;ie<P.length;ie++){var le=P[ie];le!==null&&(le.lane&=-536870913)}a&=~he}s!==0&&Ml(e,s,0),x!==0&&h===0&&e.tag!==0&&(e.suspendedLanes|=x&~(w&~n))}function Ml(e,n,a){e.pendingLanes|=n,e.suspendedLanes&=~n;var s=31-dt(n);e.entangledLanes|=n,e.entanglements[s]=e.entanglements[s]|1073741824|a&261930}function Rl(e,n){var a=e.entangledLanes|=n;for(e=e.entanglements;a;){var s=31-dt(a),h=1<<s;h&n|e[s]&n&&(e[s]|=n),a&=~h}}function Fl(e,n){var a=n&-n;return a=(a&42)!==0?1:ka(a),(a&(e.suspendedLanes|n))!==0?0:a}function ka(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 yl(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function xi(){var e=Q.p;return e!==0?e:(e=window.event,e===void 0?32:Wp(e.type))}function pi(e,n){var a=Q.p;try{return Q.p=e,n()}finally{Q.p=a}}var Wn=Math.random().toString(36).slice(2),Qt="__reactFiber$"+Wn,sn="__reactProps$"+Wn,Sn="__reactContainer$"+Wn,qr="__reactEvents$"+Wn,Bs="__reactListeners$"+Wn,Ls="__reactHandles$"+Wn,$s="__reactResources$"+Wn,_l="__reactMarker$"+Wn;function jn(e){delete e[Qt],delete e[sn],delete e[qr],delete e[Bs],delete e[Ls]}function On(e){var n=e[Qt];if(n)return n;for(var a=e.parentNode;a;){if(n=a[Sn]||a[Qt]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(e=Fp(e);e!==null;){if(a=e[Qt])return a;e=Fp(e)}return n}e=a,a=e.parentNode}return null}function Zn(e){if(e=e[Qt]||e[Sn]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function Xr(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(i(33))}function Bn(e){var n=e[$s];return n||(n=e[$s]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function ft(e){e[_l]=!0}var Vr=new Set,Jn={};function Ln(e,n){gl(e,n),gl(e+"Capture",n)}function gl(e,n){for(Jn[e]=n,e=0;e<n.length;e++)Vr.add(n[e])}var Hc=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]*$"),sr={},or={};function Uc(e){return Yt.call(or,e)?!0:Yt.call(sr,e)?!1:Hc.test(e)?or[e]=!0:(sr[e]=!0,!1)}function _t(e,n,a){if(Uc(n))if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(n);return;case"boolean":var s=n.toLowerCase().slice(0,5);if(s!=="data-"&&s!=="aria-"){e.removeAttribute(n);return}}e.setAttribute(n,""+a)}}function Gr(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 ol(e,n,a,s){if(s===null)e.removeAttribute(a);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(n,a,""+s)}}function Cn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function yi(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function gi(e,n,a){var s=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var h=s.get,x=s.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return h.call(this)},set:function(w){a=""+w,x.call(this,w)}}),Object.defineProperty(e,n,{enumerable:s.enumerable}),{getValue:function(){return a},setValue:function(w){a=""+w},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function bi(e){if(!e._valueTracker){var n=yi(e)?"checked":"value";e._valueTracker=gi(e,n,""+e[n])}}function Hs(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var a=n.getValue(),s="";return e&&(s=yi(e)?e.checked?"true":"false":e.value),e=s,e!==a?(n.setValue(e),!0):!1}function Kr(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 Ic=/[\n"\\]/g;function En(e){return e.replace(Ic,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function vi(e,n,a,s,h,x,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=""+Cn(n)):e.value!==""+Cn(n)&&(e.value=""+Cn(n)):w!=="submit"&&w!=="reset"||e.removeAttribute("value"),n!=null?wi(e,w,Cn(n)):a!=null?wi(e,w,Cn(a)):s!=null&&e.removeAttribute("value"),h==null&&x!=null&&(e.defaultChecked=!!x),h!=null&&(e.checked=h&&typeof h!="function"&&typeof h!="symbol"),N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?e.name=""+Cn(N):e.removeAttribute("name")}function Us(e,n,a,s,h,x,w,N){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(e.type=x),n!=null||a!=null){if(!(x!=="submit"&&x!=="reset"||n!=null)){bi(e);return}a=a!=null?""+Cn(a):"",n=n!=null?""+Cn(n):a,N||n===e.value||(e.value=n),e.defaultValue=n}s=s??h,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=N?e.checked:!!s,e.defaultChecked=!!s,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(e.name=w),bi(e)}function wi(e,n,a){n==="number"&&Kr(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function cr(e,n,a,s){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&&s&&(e[a].defaultSelected=!0)}else{for(a=""+Cn(a),n=null,h=0;h<e.length;h++){if(e[h].value===a){e[h].selected=!0,s&&(e[h].defaultSelected=!0);return}n!==null||e[h].disabled||(n=e[h])}n!==null&&(n.selected=!0)}}function Is(e,n,a){if(n!=null&&(n=""+Cn(n),n!==e.value&&(e.value=n),a==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=a!=null?""+Cn(a):""}function cl(e,n,a,s){if(n==null){if(s!=null){if(a!=null)throw Error(i(92));if(V(s)){if(1<s.length)throw Error(i(93));s=s[0]}a=s}a==null&&(a=""),n=a}a=Cn(n),e.defaultValue=a,s=e.textContent,s===a&&s!==""&&s!==null&&(e.value=s),bi(e)}function Ol(e,n){if(n){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=n;return}}e.textContent=n}var Yc=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 Ys(e,n,a){var s=n.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?s?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":s?e.setProperty(n,a):typeof a!="number"||a===0||Yc.has(n)?n==="float"?e.cssFloat=a:e[n]=(""+a).trim():e[n]=a+"px"}function ul(e,n,a){if(n!=null&&typeof n!="object")throw Error(i(62));if(e=e.style,a!=null){for(var s in a)!a.hasOwnProperty(s)||n!=null&&n.hasOwnProperty(s)||(s.indexOf("--")===0?e.setProperty(s,""):s==="float"?e.cssFloat="":e[s]="");for(var h in n)s=n[h],n.hasOwnProperty(h)&&a[h]!==s&&Ys(e,h,s)}else for(var x in n)n.hasOwnProperty(x)&&Ys(e,x,n[x])}function Sa(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 qc=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"]]),Xc=/^[\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 Xt(e){return Xc.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function gn(){}var ja=null;function Ca(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Bl=null,Ll=null;function F(e){var n=Zn(e);if(n&&(e=n.stateNode)){var a=e[sn]||null;e:switch(e=n.stateNode,n.type){case"input":if(vi(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="'+En(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var s=a[n];if(s!==e&&s.form===e.form){var h=s[sn]||null;if(!h)throw Error(i(90));vi(s,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name)}}for(n=0;n<a.length;n++)s=a[n],s.form===e.form&&Hs(s)}break e;case"textarea":Is(e,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&cr(e,!!a.multiple,n,!1)}}}var ue=!1;function me(e,n,a){if(ue)return e(n,a);ue=!0;try{var s=e(n);return s}finally{if(ue=!1,(Bl!==null||Ll!==null)&&(To(),Bl&&(n=Bl,e=Ll,Ll=Bl=null,F(n),e)))for(n=0;n<e.length;n++)F(e[n])}}function xe(e,n){var a=e.stateNode;if(a===null)return null;var s=a[sn]||null;if(s===null)return null;a=s[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":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(i(231,n,typeof a));return a}var ge=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ze=!1;if(ge)try{var Oe={};Object.defineProperty(Oe,"passive",{get:function(){ze=!0}}),window.addEventListener("test",Oe,Oe),window.removeEventListener("test",Oe,Oe)}catch{ze=!1}var Xe=null,at=null,Ve=null;function Lt(){if(Ve)return Ve;var e,n=at,a=n.length,s,h="value"in Xe?Xe.value:Xe.textContent,x=h.length;for(e=0;e<a&&n[e]===h[e];e++);var w=a-e;for(s=1;s<=w&&n[a-s]===h[x-s];s++);return Ve=h.slice(e,1<s?1-s:void 0)}function qs(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 Xs(){return!0}function Ah(){return!1}function Nn(e){function n(a,s,h,x,w){this._reactName=a,this._targetInst=h,this.type=s,this.nativeEvent=x,this.target=w,this.currentTarget=null;for(var N in e)e.hasOwnProperty(N)&&(a=e[N],this[N]=a?a(x):x[N]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Xs:Ah,this.isPropagationStopped=Ah,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=Xs)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Xs)},persist:function(){},isPersistent:Xs}),n}var Qr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Vs=Nn(Qr),ki=y({},Qr,{view:0,detail:0}),_g=Nn(ki),Vc,Gc,Si,Gs=y({},ki,{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!==Si&&(Si&&e.type==="mousemove"?(Vc=e.screenX-Si.screenX,Gc=e.screenY-Si.screenY):Gc=Vc=0,Si=e),Vc)},movementY:function(e){return"movementY"in e?e.movementY:Gc}}),Dh=Nn(Gs),Og=y({},Gs,{dataTransfer:0}),Bg=Nn(Og),Lg=y({},ki,{relatedTarget:0}),Kc=Nn(Lg),$g=y({},Qr,{animationName:0,elapsedTime:0,pseudoElement:0}),Hg=Nn($g),Ug=y({},Qr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Ig=Nn(Ug),Yg=y({},Qr,{data:0}),Th=Nn(Yg),qg={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Xg={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"},Vg={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Gg(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=Vg[e])?!!n[e]:!1}function Qc(){return Gg}var Kg=y({},ki,{key:function(e){if(e.key){var n=qg[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=qs(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Xg[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"?qs(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?qs(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Qg=Nn(Kg),Wg=y({},Gs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),zh=Nn(Wg),Zg=y({},ki,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Qc}),Jg=Nn(Zg),Pg=y({},Qr,{propertyName:0,elapsedTime:0,pseudoElement:0}),e2=Nn(Pg),t2=y({},Gs,{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}),n2=Nn(t2),l2=y({},Qr,{newState:0,oldState:0}),r2=Nn(l2),a2=[9,13,27,32],Wc=ge&&"CompositionEvent"in window,ji=null;ge&&"documentMode"in document&&(ji=document.documentMode);var i2=ge&&"TextEvent"in window&&!ji,Mh=ge&&(!Wc||ji&&8<ji&&11>=ji),Rh=" ",Fh=!1;function _h(e,n){switch(e){case"keyup":return a2.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Oh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ea=!1;function s2(e,n){switch(e){case"compositionend":return Oh(n);case"keypress":return n.which!==32?null:(Fh=!0,Rh);case"textInput":return e=n.data,e===Rh&&Fh?null:e;default:return null}}function o2(e,n){if(Ea)return e==="compositionend"||!Wc&&_h(e,n)?(e=Lt(),Ve=at=Xe=null,Ea=!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 Mh&&n.locale!=="ko"?null:n.data;default:return null}}var c2={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 Bh(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!c2[e.type]:n==="textarea"}function Lh(e,n,a,s){Bl?Ll?Ll.push(s):Ll=[s]:Bl=s,n=Bo(n,"onChange"),0<n.length&&(a=new Vs("onChange","change",null,a,s),e.push({event:a,listeners:n}))}var Ci=null,Ei=null;function u2(e){vp(e,0)}function Ks(e){var n=Xr(e);if(Hs(n))return e}function $h(e,n){if(e==="change")return n}var Hh=!1;if(ge){var Zc;if(ge){var Jc="oninput"in document;if(!Jc){var Uh=document.createElement("div");Uh.setAttribute("oninput","return;"),Jc=typeof Uh.oninput=="function"}Zc=Jc}else Zc=!1;Hh=Zc&&(!document.documentMode||9<document.documentMode)}function Ih(){Ci&&(Ci.detachEvent("onpropertychange",Yh),Ei=Ci=null)}function Yh(e){if(e.propertyName==="value"&&Ks(Ei)){var n=[];Lh(n,Ei,e,Ca(e)),me(u2,n)}}function f2(e,n,a){e==="focusin"?(Ih(),Ci=n,Ei=a,Ci.attachEvent("onpropertychange",Yh)):e==="focusout"&&Ih()}function d2(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ks(Ei)}function h2(e,n){if(e==="click")return Ks(n)}function m2(e,n){if(e==="input"||e==="change")return Ks(n)}function x2(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var $n=typeof Object.is=="function"?Object.is:x2;function Ni(e,n){if($n(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var a=Object.keys(e),s=Object.keys(n);if(a.length!==s.length)return!1;for(s=0;s<a.length;s++){var h=a[s];if(!Yt.call(n,h)||!$n(e[h],n[h]))return!1}return!0}function qh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Xh(e,n){var a=qh(e);e=0;for(var s;a;){if(a.nodeType===3){if(s=e+a.textContent.length,e<=n&&s>=n)return{node:a,offset:n-e};e=s}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=qh(a)}}function Vh(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Vh(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Gh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=Kr(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=Kr(e.document)}return n}function Pc(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}var p2=ge&&"documentMode"in document&&11>=document.documentMode,Na=null,eu=null,Ai=null,tu=!1;function Kh(e,n,a){var s=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;tu||Na==null||Na!==Kr(s)||(s=Na,"selectionStart"in s&&Pc(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),Ai&&Ni(Ai,s)||(Ai=s,s=Bo(eu,"onSelect"),0<s.length&&(n=new Vs("onSelect","select",null,n,a),e.push({event:n,listeners:s}),n.target=Na)))}function Wr(e,n){var a={};return a[e.toLowerCase()]=n.toLowerCase(),a["Webkit"+e]="webkit"+n,a["Moz"+e]="moz"+n,a}var Aa={animationend:Wr("Animation","AnimationEnd"),animationiteration:Wr("Animation","AnimationIteration"),animationstart:Wr("Animation","AnimationStart"),transitionrun:Wr("Transition","TransitionRun"),transitionstart:Wr("Transition","TransitionStart"),transitioncancel:Wr("Transition","TransitionCancel"),transitionend:Wr("Transition","TransitionEnd")},nu={},Qh={};ge&&(Qh=document.createElement("div").style,"AnimationEvent"in window||(delete Aa.animationend.animation,delete Aa.animationiteration.animation,delete Aa.animationstart.animation),"TransitionEvent"in window||delete Aa.transitionend.transition);function Zr(e){if(nu[e])return nu[e];if(!Aa[e])return e;var n=Aa[e],a;for(a in n)if(n.hasOwnProperty(a)&&a in Qh)return nu[e]=n[a];return e}var Wh=Zr("animationend"),Zh=Zr("animationiteration"),Jh=Zr("animationstart"),y2=Zr("transitionrun"),g2=Zr("transitionstart"),b2=Zr("transitioncancel"),Ph=Zr("transitionend"),em=new Map,lu="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");lu.push("scrollEnd");function fl(e,n){em.set(e,n),Ln(n,[e])}var Qs=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Pn=[],Da=0,ru=0;function Ws(){for(var e=Da,n=ru=Da=0;n<e;){var a=Pn[n];Pn[n++]=null;var s=Pn[n];Pn[n++]=null;var h=Pn[n];Pn[n++]=null;var x=Pn[n];if(Pn[n++]=null,s!==null&&h!==null){var w=s.pending;w===null?h.next=h:(h.next=w.next,w.next=h),s.pending=h}x!==0&&tm(a,h,x)}}function Zs(e,n,a,s){Pn[Da++]=e,Pn[Da++]=n,Pn[Da++]=a,Pn[Da++]=s,ru|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function au(e,n,a,s){return Zs(e,n,a,s),Js(e)}function Jr(e,n){return Zs(e,null,null,n),Js(e)}function tm(e,n,a){e.lanes|=a;var s=e.alternate;s!==null&&(s.lanes|=a);for(var h=!1,x=e.return;x!==null;)x.childLanes|=a,s=x.alternate,s!==null&&(s.childLanes|=a),x.tag===22&&(e=x.stateNode,e===null||e._visibility&1||(h=!0)),e=x,x=x.return;return e.tag===3?(x=e.stateNode,h&&n!==null&&(h=31-dt(a),e=x.hiddenUpdates,s=e[h],s===null?e[h]=[n]:s.push(n),n.lane=a|536870912),x):null}function Js(e){if(50<Wi)throw Wi=0,xf=null,Error(i(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var Ta={};function v2(e,n,a,s){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=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Hn(e,n,a,s){return new v2(e,n,a,s)}function iu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function $l(e,n){var a=e.alternate;return a===null?(a=Hn(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 nm(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 Ps(e,n,a,s,h,x){var w=0;if(s=e,typeof e=="function")iu(e)&&(w=1);else if(typeof e=="string")w=Cb(e,a,pe.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case ee:return e=Hn(31,a,n,h),e.elementType=ee,e.lanes=x,e;case S:return Pr(a.children,h,x,n);case C:w=8,h|=24;break;case E:return e=Hn(12,a,n,h|2),e.elementType=E,e.lanes=x,e;case B:return e=Hn(13,a,n,h),e.elementType=B,e.lanes=x,e;case T:return e=Hn(19,a,n,h),e.elementType=T,e.lanes=x,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case R:w=10;break e;case A:w=9;break e;case O:w=11;break e;case I:w=14;break e;case X:w=16,s=null;break e}w=29,a=Error(i(130,e===null?"null":typeof e,"")),s=null}return n=Hn(w,a,n,h),n.elementType=e,n.type=s,n.lanes=x,n}function Pr(e,n,a,s){return e=Hn(7,e,s,n),e.lanes=a,e}function su(e,n,a){return e=Hn(6,e,null,n),e.lanes=a,e}function lm(e){var n=Hn(18,null,null,0);return n.stateNode=e,n}function ou(e,n,a){return n=Hn(4,e.children!==null?e.children:[],e.key,n),n.lanes=a,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var rm=new WeakMap;function el(e,n){if(typeof e=="object"&&e!==null){var a=rm.get(e);return a!==void 0?a:(n={value:e,source:n,stack:$e(n)},rm.set(e,n),n)}return{value:e,source:n,stack:$e(n)}}var za=[],Ma=0,eo=null,Di=0,tl=[],nl=0,ur=null,bl=1,vl="";function Hl(e,n){za[Ma++]=Di,za[Ma++]=eo,eo=e,Di=n}function am(e,n,a){tl[nl++]=bl,tl[nl++]=vl,tl[nl++]=ur,ur=e;var s=bl;e=vl;var h=32-dt(s)-1;s&=~(1<<h),a+=1;var x=32-dt(n)+h;if(30<x){var w=h-h%5;x=(s&(1<<w)-1).toString(32),s>>=w,h-=w,bl=1<<32-dt(n)+h|a<<h|s,vl=x+e}else bl=1<<x|a<<h|s,vl=e}function cu(e){e.return!==null&&(Hl(e,1),am(e,1,0))}function uu(e){for(;e===eo;)eo=za[--Ma],za[Ma]=null,Di=za[--Ma],za[Ma]=null;for(;e===ur;)ur=tl[--nl],tl[nl]=null,vl=tl[--nl],tl[nl]=null,bl=tl[--nl],tl[nl]=null}function im(e,n){tl[nl++]=bl,tl[nl++]=vl,tl[nl++]=ur,bl=n.id,vl=n.overflow,ur=e}var on=null,zt=null,ct=!1,fr=null,ll=!1,fu=Error(i(519));function dr(e){var n=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ti(el(n,e)),fu}function sm(e){var n=e.stateNode,a=e.type,s=e.memoizedProps;switch(n[Qt]=e,n[sn]=s,a){case"dialog":nt("cancel",n),nt("close",n);break;case"iframe":case"object":case"embed":nt("load",n);break;case"video":case"audio":for(a=0;a<Ji.length;a++)nt(Ji[a],n);break;case"source":nt("error",n);break;case"img":case"image":case"link":nt("error",n),nt("load",n);break;case"details":nt("toggle",n);break;case"input":nt("invalid",n),Us(n,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":nt("invalid",n);break;case"textarea":nt("invalid",n),cl(n,s.value,s.defaultValue,s.children)}a=s.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||n.textContent===""+a||s.suppressHydrationWarning===!0||jp(n.textContent,a)?(s.popover!=null&&(nt("beforetoggle",n),nt("toggle",n)),s.onScroll!=null&&nt("scroll",n),s.onScrollEnd!=null&&nt("scrollend",n),s.onClick!=null&&(n.onclick=gn),n=!0):n=!1,n||dr(e,!0)}function om(e){for(on=e.return;on;)switch(on.tag){case 5:case 31:case 13:ll=!1;return;case 27:case 3:ll=!0;return;default:on=on.return}}function Ra(e){if(e!==on)return!1;if(!ct)return om(e),ct=!0,!1;var n=e.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||Tf(e.type,e.memoizedProps)),a=!a),a&&zt&&dr(e),om(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));zt=Rp(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));zt=Rp(e)}else n===27?(n=zt,Er(e.type)?(e=_f,_f=null,zt=e):zt=n):zt=on?al(e.stateNode.nextSibling):null;return!0}function ea(){zt=on=null,ct=!1}function du(){var e=fr;return e!==null&&(zn===null?zn=e:zn.push.apply(zn,e),fr=null),e}function Ti(e){fr===null?fr=[e]:fr.push(e)}var hu=_(null),ta=null,Ul=null;function hr(e,n,a){D(hu,n._currentValue),n._currentValue=a}function Il(e){e._currentValue=hu.current,J(hu)}function mu(e,n,a){for(;e!==null;){var s=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,s!==null&&(s.childLanes|=n)):s!==null&&(s.childLanes&n)!==n&&(s.childLanes|=n),e===a)break;e=e.return}}function xu(e,n,a,s){var h=e.child;for(h!==null&&(h.return=e);h!==null;){var x=h.dependencies;if(x!==null){var w=h.child;x=x.firstContext;e:for(;x!==null;){var N=x;x=h;for(var H=0;H<n.length;H++)if(N.context===n[H]){x.lanes|=a,N=x.alternate,N!==null&&(N.lanes|=a),mu(x.return,a,e),s||(w=null);break e}x=N.next}}else if(h.tag===18){if(w=h.return,w===null)throw Error(i(341));w.lanes|=a,x=w.alternate,x!==null&&(x.lanes|=a),mu(w,a,e),w=null}else w=h.child;if(w!==null)w.return=h;else for(w=h;w!==null;){if(w===e){w=null;break}if(h=w.sibling,h!==null){h.return=w.return,w=h;break}w=w.return}h=w}}function Fa(e,n,a,s){e=null;for(var h=n,x=!1;h!==null;){if(!x){if((h.flags&524288)!==0)x=!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;$n(h.pendingProps.value,w.value)||(e!==null?e.push(N):e=[N])}}else if(h===He.current){if(w=h.alternate,w===null)throw Error(i(387));w.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(e!==null?e.push(ls):e=[ls])}h=h.return}e!==null&&xu(n,e,a,s),n.flags|=262144}function to(e){for(e=e.firstContext;e!==null;){if(!$n(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function na(e){ta=e,Ul=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function cn(e){return cm(ta,e)}function no(e,n){return ta===null&&na(e),cm(e,n)}function cm(e,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},Ul===null){if(e===null)throw Error(i(308));Ul=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else Ul=Ul.next=n;return a}var w2=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(a,s){e.push(s)}};this.abort=function(){n.aborted=!0,e.forEach(function(a){return a()})}},k2=t.unstable_scheduleCallback,S2=t.unstable_NormalPriority,Wt={$$typeof:R,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function pu(){return{controller:new w2,data:new Map,refCount:0}}function zi(e){e.refCount--,e.refCount===0&&k2(S2,function(){e.controller.abort()})}var Mi=null,yu=0,_a=0,Oa=null;function j2(e,n){if(Mi===null){var a=Mi=[];yu=0,_a=wf(),Oa={status:"pending",value:void 0,then:function(s){a.push(s)}}}return yu++,n.then(um,um),n}function um(){if(--yu===0&&Mi!==null){Oa!==null&&(Oa.status="fulfilled");var e=Mi;Mi=null,_a=0,Oa=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function C2(e,n){var a=[],s={status:"pending",value:null,reason:null,then:function(h){a.push(h)}};return e.then(function(){s.status="fulfilled",s.value=n;for(var h=0;h<a.length;h++)(0,a[h])(n)},function(h){for(s.status="rejected",s.reason=h,h=0;h<a.length;h++)(0,a[h])(void 0)}),s}var fm=Y.S;Y.S=function(e,n){Kx=vt(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&j2(e,n),fm!==null&&fm(e,n)};var la=_(null);function gu(){var e=la.current;return e!==null?e:At.pooledCache}function lo(e,n){n===null?D(la,la.current):D(la,n.pool)}function dm(){var e=gu();return e===null?null:{parent:Wt._currentValue,pool:e}}var Ba=Error(i(460)),bu=Error(i(474)),ro=Error(i(542)),ao={then:function(){}};function hm(e){return e=e.status,e==="fulfilled"||e==="rejected"}function mm(e,n,a){switch(a=e[a],a===void 0?e.push(n):a!==n&&(n.then(gn,gn),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,pm(e),e;default:if(typeof n.status=="string")n.then(gn,gn);else{if(e=At,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=n,e.status="pending",e.then(function(s){if(n.status==="pending"){var h=n;h.status="fulfilled",h.value=s}},function(s){if(n.status==="pending"){var h=n;h.status="rejected",h.reason=s}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,pm(e),e}throw aa=n,Ba}}function ra(e){try{var n=e._init;return n(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(aa=a,Ba):a}}var aa=null;function xm(){if(aa===null)throw Error(i(459));var e=aa;return aa=null,e}function pm(e){if(e===Ba||e===ro)throw Error(i(483))}var La=null,Ri=0;function io(e){var n=Ri;return Ri+=1,La===null&&(La=[]),mm(La,e,n)}function Fi(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function so(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 ym(e){function n(G,q){if(e){var W=G.deletions;W===null?(G.deletions=[q],G.flags|=16):W.push(q)}}function a(G,q){if(!e)return null;for(;q!==null;)n(G,q),q=q.sibling;return null}function s(G){for(var q=new Map;G!==null;)G.key!==null?q.set(G.key,G):q.set(G.index,G),G=G.sibling;return q}function h(G,q){return G=$l(G,q),G.index=0,G.sibling=null,G}function x(G,q,W){return G.index=W,e?(W=G.alternate,W!==null?(W=W.index,W<q?(G.flags|=67108866,q):W):(G.flags|=67108866,q)):(G.flags|=1048576,q)}function w(G){return e&&G.alternate===null&&(G.flags|=67108866),G}function N(G,q,W,ce){return q===null||q.tag!==6?(q=su(W,G.mode,ce),q.return=G,q):(q=h(q,W),q.return=G,q)}function H(G,q,W,ce){var Be=W.type;return Be===S?ie(G,q,W.props.children,ce,W.key):q!==null&&(q.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===X&&ra(Be)===q.type)?(q=h(q,W.props),Fi(q,W),q.return=G,q):(q=Ps(W.type,W.key,W.props,null,G.mode,ce),Fi(q,W),q.return=G,q)}function Z(G,q,W,ce){return q===null||q.tag!==4||q.stateNode.containerInfo!==W.containerInfo||q.stateNode.implementation!==W.implementation?(q=ou(W,G.mode,ce),q.return=G,q):(q=h(q,W.children||[]),q.return=G,q)}function ie(G,q,W,ce,Be){return q===null||q.tag!==7?(q=Pr(W,G.mode,ce,Be),q.return=G,q):(q=h(q,W),q.return=G,q)}function he(G,q,W){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return q=su(""+q,G.mode,W),q.return=G,q;if(typeof q=="object"&&q!==null){switch(q.$$typeof){case v:return W=Ps(q.type,q.key,q.props,null,G.mode,W),Fi(W,q),W.return=G,W;case j:return q=ou(q,G.mode,W),q.return=G,q;case X:return q=ra(q),he(G,q,W)}if(V(q)||U(q))return q=Pr(q,G.mode,W,null),q.return=G,q;if(typeof q.then=="function")return he(G,io(q),W);if(q.$$typeof===R)return he(G,no(G,q),W);so(G,q)}return null}function P(G,q,W,ce){var Be=q!==null?q.key:null;if(typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint")return Be!==null?null:N(G,q,""+W,ce);if(typeof W=="object"&&W!==null){switch(W.$$typeof){case v:return W.key===Be?H(G,q,W,ce):null;case j:return W.key===Be?Z(G,q,W,ce):null;case X:return W=ra(W),P(G,q,W,ce)}if(V(W)||U(W))return Be!==null?null:ie(G,q,W,ce,null);if(typeof W.then=="function")return P(G,q,io(W),ce);if(W.$$typeof===R)return P(G,q,no(G,W),ce);so(G,W)}return null}function le(G,q,W,ce,Be){if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return G=G.get(W)||null,N(q,G,""+ce,Be);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case v:return G=G.get(ce.key===null?W:ce.key)||null,H(q,G,ce,Be);case j:return G=G.get(ce.key===null?W:ce.key)||null,Z(q,G,ce,Be);case X:return ce=ra(ce),le(G,q,W,ce,Be)}if(V(ce)||U(ce))return G=G.get(W)||null,ie(q,G,ce,Be,null);if(typeof ce.then=="function")return le(G,q,W,io(ce),Be);if(ce.$$typeof===R)return le(G,q,W,no(q,ce),Be);so(q,ce)}return null}function De(G,q,W,ce){for(var Be=null,ht=null,Me=q,Qe=q=0,st=null;Me!==null&&Qe<W.length;Qe++){Me.index>Qe?(st=Me,Me=null):st=Me.sibling;var mt=P(G,Me,W[Qe],ce);if(mt===null){Me===null&&(Me=st);break}e&&Me&&mt.alternate===null&&n(G,Me),q=x(mt,q,Qe),ht===null?Be=mt:ht.sibling=mt,ht=mt,Me=st}if(Qe===W.length)return a(G,Me),ct&&Hl(G,Qe),Be;if(Me===null){for(;Qe<W.length;Qe++)Me=he(G,W[Qe],ce),Me!==null&&(q=x(Me,q,Qe),ht===null?Be=Me:ht.sibling=Me,ht=Me);return ct&&Hl(G,Qe),Be}for(Me=s(Me);Qe<W.length;Qe++)st=le(Me,G,Qe,W[Qe],ce),st!==null&&(e&&st.alternate!==null&&Me.delete(st.key===null?Qe:st.key),q=x(st,q,Qe),ht===null?Be=st:ht.sibling=st,ht=st);return e&&Me.forEach(function(zr){return n(G,zr)}),ct&&Hl(G,Qe),Be}function Ie(G,q,W,ce){if(W==null)throw Error(i(151));for(var Be=null,ht=null,Me=q,Qe=q=0,st=null,mt=W.next();Me!==null&&!mt.done;Qe++,mt=W.next()){Me.index>Qe?(st=Me,Me=null):st=Me.sibling;var zr=P(G,Me,mt.value,ce);if(zr===null){Me===null&&(Me=st);break}e&&Me&&zr.alternate===null&&n(G,Me),q=x(zr,q,Qe),ht===null?Be=zr:ht.sibling=zr,ht=zr,Me=st}if(mt.done)return a(G,Me),ct&&Hl(G,Qe),Be;if(Me===null){for(;!mt.done;Qe++,mt=W.next())mt=he(G,mt.value,ce),mt!==null&&(q=x(mt,q,Qe),ht===null?Be=mt:ht.sibling=mt,ht=mt);return ct&&Hl(G,Qe),Be}for(Me=s(Me);!mt.done;Qe++,mt=W.next())mt=le(Me,G,Qe,mt.value,ce),mt!==null&&(e&&mt.alternate!==null&&Me.delete(mt.key===null?Qe:mt.key),q=x(mt,q,Qe),ht===null?Be=mt:ht.sibling=mt,ht=mt);return e&&Me.forEach(function(Ob){return n(G,Ob)}),ct&&Hl(G,Qe),Be}function Et(G,q,W,ce){if(typeof W=="object"&&W!==null&&W.type===S&&W.key===null&&(W=W.props.children),typeof W=="object"&&W!==null){switch(W.$$typeof){case v:e:{for(var Be=W.key;q!==null;){if(q.key===Be){if(Be=W.type,Be===S){if(q.tag===7){a(G,q.sibling),ce=h(q,W.props.children),ce.return=G,G=ce;break e}}else if(q.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===X&&ra(Be)===q.type){a(G,q.sibling),ce=h(q,W.props),Fi(ce,W),ce.return=G,G=ce;break e}a(G,q);break}else n(G,q);q=q.sibling}W.type===S?(ce=Pr(W.props.children,G.mode,ce,W.key),ce.return=G,G=ce):(ce=Ps(W.type,W.key,W.props,null,G.mode,ce),Fi(ce,W),ce.return=G,G=ce)}return w(G);case j:e:{for(Be=W.key;q!==null;){if(q.key===Be)if(q.tag===4&&q.stateNode.containerInfo===W.containerInfo&&q.stateNode.implementation===W.implementation){a(G,q.sibling),ce=h(q,W.children||[]),ce.return=G,G=ce;break e}else{a(G,q);break}else n(G,q);q=q.sibling}ce=ou(W,G.mode,ce),ce.return=G,G=ce}return w(G);case X:return W=ra(W),Et(G,q,W,ce)}if(V(W))return De(G,q,W,ce);if(U(W)){if(Be=U(W),typeof Be!="function")throw Error(i(150));return W=Be.call(W),Ie(G,q,W,ce)}if(typeof W.then=="function")return Et(G,q,io(W),ce);if(W.$$typeof===R)return Et(G,q,no(G,W),ce);so(G,W)}return typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint"?(W=""+W,q!==null&&q.tag===6?(a(G,q.sibling),ce=h(q,W),ce.return=G,G=ce):(a(G,q),ce=su(W,G.mode,ce),ce.return=G,G=ce),w(G)):a(G,q)}return function(G,q,W,ce){try{Ri=0;var Be=Et(G,q,W,ce);return La=null,Be}catch(Me){if(Me===Ba||Me===ro)throw Me;var ht=Hn(29,Me,null,G.mode);return ht.lanes=ce,ht.return=G,ht}finally{}}}var ia=ym(!0),gm=ym(!1),mr=!1;function vu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function wu(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function xr(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function pr(e,n,a){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(yt&2)!==0){var h=s.pending;return h===null?n.next=n:(n.next=h.next,h.next=n),s.pending=n,n=Js(e),tm(e,null,a),n}return Zs(e,s,n,a),Js(e)}function _i(e,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var s=n.lanes;s&=e.pendingLanes,a|=s,n.lanes=a,Rl(e,a)}}function ku(e,n){var a=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,a===s)){var h=null,x=null;if(a=a.firstBaseUpdate,a!==null){do{var w={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};x===null?h=x=w:x=x.next=w,a=a.next}while(a!==null);x===null?h=x=n:x=x.next=n}else h=x=n;a={baseState:s.baseState,firstBaseUpdate:h,lastBaseUpdate:x,shared:s.shared,callbacks:s.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=n:e.next=n,a.lastBaseUpdate=n}var Su=!1;function Oi(){if(Su){var e=Oa;if(e!==null)throw e}}function Bi(e,n,a,s){Su=!1;var h=e.updateQueue;mr=!1;var x=h.firstBaseUpdate,w=h.lastBaseUpdate,N=h.shared.pending;if(N!==null){h.shared.pending=null;var H=N,Z=H.next;H.next=null,w===null?x=Z:w.next=Z,w=H;var ie=e.alternate;ie!==null&&(ie=ie.updateQueue,N=ie.lastBaseUpdate,N!==w&&(N===null?ie.firstBaseUpdate=Z:N.next=Z,ie.lastBaseUpdate=H))}if(x!==null){var he=h.baseState;w=0,ie=Z=H=null,N=x;do{var P=N.lane&-536870913,le=P!==N.lane;if(le?(it&P)===P:(s&P)===P){P!==0&&P===_a&&(Su=!0),ie!==null&&(ie=ie.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var De=e,Ie=N;P=n;var Et=a;switch(Ie.tag){case 1:if(De=Ie.payload,typeof De=="function"){he=De.call(Et,he,P);break e}he=De;break e;case 3:De.flags=De.flags&-65537|128;case 0:if(De=Ie.payload,P=typeof De=="function"?De.call(Et,he,P):De,P==null)break e;he=y({},he,P);break e;case 2:mr=!0}}P=N.callback,P!==null&&(e.flags|=64,le&&(e.flags|=8192),le=h.callbacks,le===null?h.callbacks=[P]:le.push(P))}else le={lane:P,tag:N.tag,payload:N.payload,callback:N.callback,next:null},ie===null?(Z=ie=le,H=he):ie=ie.next=le,w|=P;if(N=N.next,N===null){if(N=h.shared.pending,N===null)break;le=N,N=le.next,le.next=null,h.lastBaseUpdate=le,h.shared.pending=null}}while(!0);ie===null&&(H=he),h.baseState=H,h.firstBaseUpdate=Z,h.lastBaseUpdate=ie,x===null&&(h.shared.lanes=0),wr|=w,e.lanes=w,e.memoizedState=he}}function bm(e,n){if(typeof e!="function")throw Error(i(191,e));e.call(n)}function vm(e,n){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)bm(a[e],n)}var $a=_(null),oo=_(0);function wm(e,n){e=Zl,D(oo,e),D($a,n),Zl=e|n.baseLanes}function ju(){D(oo,Zl),D($a,$a.current)}function Cu(){Zl=oo.current,J($a),J(oo)}var Un=_(null),rl=null;function yr(e){var n=e.alternate;D(Vt,Vt.current&1),D(Un,e),rl===null&&(n===null||$a.current!==null||n.memoizedState!==null)&&(rl=e)}function Eu(e){D(Vt,Vt.current),D(Un,e),rl===null&&(rl=e)}function km(e){e.tag===22?(D(Vt,Vt.current),D(Un,e),rl===null&&(rl=e)):gr()}function gr(){D(Vt,Vt.current),D(Un,Un.current)}function In(e){J(Un),rl===e&&(rl=null),J(Vt)}var Vt=_(0);function co(e){for(var n=e;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Rf(a)||Ff(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 Yl=0,Ke=null,jt=null,Zt=null,uo=!1,Ha=!1,sa=!1,fo=0,Li=0,Ua=null,E2=0;function Ht(){throw Error(i(321))}function Nu(e,n){if(n===null)return!1;for(var a=0;a<n.length&&a<e.length;a++)if(!$n(e[a],n[a]))return!1;return!0}function Au(e,n,a,s,h,x){return Yl=x,Ke=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,Y.H=e===null||e.memoizedState===null?ax:Yu,sa=!1,x=a(s,h),sa=!1,Ha&&(x=jm(n,a,s,h)),Sm(e),x}function Sm(e){Y.H=Ui;var n=jt!==null&&jt.next!==null;if(Yl=0,Zt=jt=Ke=null,uo=!1,Li=0,Ua=null,n)throw Error(i(300));e===null||Jt||(e=e.dependencies,e!==null&&to(e)&&(Jt=!0))}function jm(e,n,a,s){Ke=e;var h=0;do{if(Ha&&(Ua=null),Li=0,Ha=!1,25<=h)throw Error(i(301));if(h+=1,Zt=jt=null,e.updateQueue!=null){var x=e.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}Y.H=ix,x=n(a,s)}while(Ha);return x}function N2(){var e=Y.H,n=e.useState()[0];return n=typeof n.then=="function"?$i(n):n,e=e.useState()[0],(jt!==null?jt.memoizedState:null)!==e&&(Ke.flags|=1024),n}function Du(){var e=fo!==0;return fo=0,e}function Tu(e,n,a){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~a}function zu(e){if(uo){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}uo=!1}Yl=0,Zt=jt=Ke=null,Ha=!1,Li=fo=0,Ua=null}function bn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Zt===null?Ke.memoizedState=Zt=e:Zt=Zt.next=e,Zt}function Gt(){if(jt===null){var e=Ke.alternate;e=e!==null?e.memoizedState:null}else e=jt.next;var n=Zt===null?Ke.memoizedState:Zt.next;if(n!==null)Zt=n,jt=e;else{if(e===null)throw Ke.alternate===null?Error(i(467)):Error(i(310));jt=e,e={memoizedState:jt.memoizedState,baseState:jt.baseState,baseQueue:jt.baseQueue,queue:jt.queue,next:null},Zt===null?Ke.memoizedState=Zt=e:Zt=Zt.next=e}return Zt}function ho(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function $i(e){var n=Li;return Li+=1,Ua===null&&(Ua=[]),e=mm(Ua,e,n),n=Ke,(Zt===null?n.memoizedState:Zt.next)===null&&(n=n.alternate,Y.H=n===null||n.memoizedState===null?ax:Yu),e}function mo(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return $i(e);if(e.$$typeof===R)return cn(e)}throw Error(i(438,String(e)))}function Mu(e){var n=null,a=Ke.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var s=Ke.alternate;s!==null&&(s=s.updateQueue,s!==null&&(s=s.memoCache,s!=null&&(n={data:s.data.map(function(h){return h.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),a===null&&(a=ho(),Ke.updateQueue=a),a.memoCache=n,a=n.data[n.index],a===void 0)for(a=n.data[n.index]=Array(e),s=0;s<e;s++)a[s]=z;return n.index++,a}function ql(e,n){return typeof n=="function"?n(e):n}function xo(e){var n=Gt();return Ru(n,jt,e)}function Ru(e,n,a){var s=e.queue;if(s===null)throw Error(i(311));s.lastRenderedReducer=a;var h=e.baseQueue,x=s.pending;if(x!==null){if(h!==null){var w=h.next;h.next=x.next,x.next=w}n.baseQueue=h=x,s.pending=null}if(x=e.baseState,h===null)e.memoizedState=x;else{n=h.next;var N=w=null,H=null,Z=n,ie=!1;do{var he=Z.lane&-536870913;if(he!==Z.lane?(it&he)===he:(Yl&he)===he){var P=Z.revertLane;if(P===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null}),he===_a&&(ie=!0);else if((Yl&P)===P){Z=Z.next,P===_a&&(ie=!0);continue}else he={lane:0,revertLane:Z.revertLane,gesture:null,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null},H===null?(N=H=he,w=x):H=H.next=he,Ke.lanes|=P,wr|=P;he=Z.action,sa&&a(x,he),x=Z.hasEagerState?Z.eagerState:a(x,he)}else P={lane:he,revertLane:Z.revertLane,gesture:Z.gesture,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null},H===null?(N=H=P,w=x):H=H.next=P,Ke.lanes|=he,wr|=he;Z=Z.next}while(Z!==null&&Z!==n);if(H===null?w=x:H.next=N,!$n(x,e.memoizedState)&&(Jt=!0,ie&&(a=Oa,a!==null)))throw a;e.memoizedState=x,e.baseState=w,e.baseQueue=H,s.lastRenderedState=x}return h===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function Fu(e){var n=Gt(),a=n.queue;if(a===null)throw Error(i(311));a.lastRenderedReducer=e;var s=a.dispatch,h=a.pending,x=n.memoizedState;if(h!==null){a.pending=null;var w=h=h.next;do x=e(x,w.action),w=w.next;while(w!==h);$n(x,n.memoizedState)||(Jt=!0),n.memoizedState=x,n.baseQueue===null&&(n.baseState=x),a.lastRenderedState=x}return[x,s]}function Cm(e,n,a){var s=Ke,h=Gt(),x=ct;if(x){if(a===void 0)throw Error(i(407));a=a()}else a=n();var w=!$n((jt||h).memoizedState,a);if(w&&(h.memoizedState=a,Jt=!0),h=h.queue,Bu(Am.bind(null,s,h,e),[e]),h.getSnapshot!==n||w||Zt!==null&&Zt.memoizedState.tag&1){if(s.flags|=2048,Ia(9,{destroy:void 0},Nm.bind(null,s,h,a,n),null),At===null)throw Error(i(349));x||(Yl&127)!==0||Em(s,n,a)}return a}function Em(e,n,a){e.flags|=16384,e={getSnapshot:n,value:a},n=Ke.updateQueue,n===null?(n=ho(),Ke.updateQueue=n,n.stores=[e]):(a=n.stores,a===null?n.stores=[e]:a.push(e))}function Nm(e,n,a,s){n.value=a,n.getSnapshot=s,Dm(n)&&Tm(e)}function Am(e,n,a){return a(function(){Dm(n)&&Tm(e)})}function Dm(e){var n=e.getSnapshot;e=e.value;try{var a=n();return!$n(e,a)}catch{return!0}}function Tm(e){var n=Jr(e,2);n!==null&&Mn(n,e,2)}function _u(e){var n=bn();if(typeof e=="function"){var a=e;if(e=a(),sa){Pe(!0);try{a()}finally{Pe(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ql,lastRenderedState:e},n}function zm(e,n,a,s){return e.baseState=a,Ru(e,jt,typeof s=="function"?s:ql)}function A2(e,n,a,s,h){if(go(e))throw Error(i(485));if(e=n.action,e!==null){var x={payload:h,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){x.listeners.push(w)}};Y.T!==null?a(!0):x.isTransition=!1,s(x),a=n.pending,a===null?(x.next=n.pending=x,Mm(n,x)):(x.next=a.next,n.pending=a.next=x)}}function Mm(e,n){var a=n.action,s=n.payload,h=e.state;if(n.isTransition){var x=Y.T,w={};Y.T=w;try{var N=a(h,s),H=Y.S;H!==null&&H(w,N),Rm(e,n,N)}catch(Z){Ou(e,n,Z)}finally{x!==null&&w.types!==null&&(x.types=w.types),Y.T=x}}else try{x=a(h,s),Rm(e,n,x)}catch(Z){Ou(e,n,Z)}}function Rm(e,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(s){Fm(e,n,s)},function(s){return Ou(e,n,s)}):Fm(e,n,a)}function Fm(e,n,a){n.status="fulfilled",n.value=a,_m(n),e.state=a,n=e.pending,n!==null&&(a=n.next,a===n?e.pending=null:(a=a.next,n.next=a,Mm(e,a)))}function Ou(e,n,a){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do n.status="rejected",n.reason=a,_m(n),n=n.next;while(n!==s)}e.action=null}function _m(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function Om(e,n){return n}function Bm(e,n){if(ct){var a=At.formState;if(a!==null){e:{var s=Ke;if(ct){if(zt){t:{for(var h=zt,x=ll;h.nodeType!==8;){if(!x){h=null;break t}if(h=al(h.nextSibling),h===null){h=null;break t}}x=h.data,h=x==="F!"||x==="F"?h:null}if(h){zt=al(h.nextSibling),s=h.data==="F!";break e}}dr(s)}s=!1}s&&(n=a[0])}}return a=bn(),a.memoizedState=a.baseState=n,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Om,lastRenderedState:n},a.queue=s,a=nx.bind(null,Ke,s),s.dispatch=a,s=_u(!1),x=Iu.bind(null,Ke,!1,s.queue),s=bn(),h={state:n,dispatch:null,action:e,pending:null},s.queue=h,a=A2.bind(null,Ke,h,x,a),h.dispatch=a,s.memoizedState=e,[n,a,!1]}function Lm(e){var n=Gt();return $m(n,jt,e)}function $m(e,n,a){if(n=Ru(e,n,Om)[0],e=xo(ql)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var s=$i(n)}catch(w){throw w===Ba?ro:w}else s=n;n=Gt();var h=n.queue,x=h.dispatch;return a!==n.memoizedState&&(Ke.flags|=2048,Ia(9,{destroy:void 0},D2.bind(null,h,a),null)),[s,x,e]}function D2(e,n){e.action=n}function Hm(e){var n=Gt(),a=jt;if(a!==null)return $m(n,a,e);Gt(),n=n.memoizedState,a=Gt();var s=a.queue.dispatch;return a.memoizedState=e,[n,s,!1]}function Ia(e,n,a,s){return e={tag:e,create:a,deps:s,inst:n,next:null},n=Ke.updateQueue,n===null&&(n=ho(),Ke.updateQueue=n),a=n.lastEffect,a===null?n.lastEffect=e.next=e:(s=a.next,a.next=e,e.next=s,n.lastEffect=e),e}function Um(){return Gt().memoizedState}function po(e,n,a,s){var h=bn();Ke.flags|=e,h.memoizedState=Ia(1|n,{destroy:void 0},a,s===void 0?null:s)}function yo(e,n,a,s){var h=Gt();s=s===void 0?null:s;var x=h.memoizedState.inst;jt!==null&&s!==null&&Nu(s,jt.memoizedState.deps)?h.memoizedState=Ia(n,x,a,s):(Ke.flags|=e,h.memoizedState=Ia(1|n,x,a,s))}function Im(e,n){po(8390656,8,e,n)}function Bu(e,n){yo(2048,8,e,n)}function T2(e){Ke.flags|=4;var n=Ke.updateQueue;if(n===null)n=ho(),Ke.updateQueue=n,n.events=[e];else{var a=n.events;a===null?n.events=[e]:a.push(e)}}function Ym(e){var n=Gt().memoizedState;return T2({ref:n,nextImpl:e}),function(){if((yt&2)!==0)throw Error(i(440));return n.impl.apply(void 0,arguments)}}function qm(e,n){return yo(4,2,e,n)}function Xm(e,n){return yo(4,4,e,n)}function Vm(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 Gm(e,n,a){a=a!=null?a.concat([e]):null,yo(4,4,Vm.bind(null,n,e),a)}function Lu(){}function Km(e,n){var a=Gt();n=n===void 0?null:n;var s=a.memoizedState;return n!==null&&Nu(n,s[1])?s[0]:(a.memoizedState=[e,n],e)}function Qm(e,n){var a=Gt();n=n===void 0?null:n;var s=a.memoizedState;if(n!==null&&Nu(n,s[1]))return s[0];if(s=e(),sa){Pe(!0);try{e()}finally{Pe(!1)}}return a.memoizedState=[s,n],s}function $u(e,n,a){return a===void 0||(Yl&1073741824)!==0&&(it&261930)===0?e.memoizedState=n:(e.memoizedState=a,e=Wx(),Ke.lanes|=e,wr|=e,a)}function Wm(e,n,a,s){return $n(a,n)?a:$a.current!==null?(e=$u(e,a,s),$n(e,n)||(Jt=!0),e):(Yl&42)===0||(Yl&1073741824)!==0&&(it&261930)===0?(Jt=!0,e.memoizedState=a):(e=Wx(),Ke.lanes|=e,wr|=e,n)}function Zm(e,n,a,s,h){var x=Q.p;Q.p=x!==0&&8>x?x:8;var w=Y.T,N={};Y.T=N,Iu(e,!1,n,a);try{var H=h(),Z=Y.S;if(Z!==null&&Z(N,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var ie=C2(H,s);Hi(e,n,ie,Xn(e))}else Hi(e,n,s,Xn(e))}catch(he){Hi(e,n,{then:function(){},status:"rejected",reason:he},Xn())}finally{Q.p=x,w!==null&&N.types!==null&&(w.types=N.types),Y.T=w}}function z2(){}function Hu(e,n,a,s){if(e.tag!==5)throw Error(i(476));var h=Jm(e).queue;Zm(e,h,n,se,a===null?z2:function(){return Pm(e),a(s)})}function Jm(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:se,baseState:se,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ql,lastRenderedState:se},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ql,lastRenderedState:a},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function Pm(e){var n=Jm(e);n.next===null&&(n=e.alternate.memoizedState),Hi(e,n.next.queue,{},Xn())}function Uu(){return cn(ls)}function ex(){return Gt().memoizedState}function tx(){return Gt().memoizedState}function M2(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var a=Xn();e=xr(a);var s=pr(n,e,a);s!==null&&(Mn(s,n,a),_i(s,n,a)),n={cache:pu()},e.payload=n;return}n=n.return}}function R2(e,n,a){var s=Xn();a={lane:s,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},go(e)?lx(n,a):(a=au(e,n,a,s),a!==null&&(Mn(a,e,s),rx(a,n,s)))}function nx(e,n,a){var s=Xn();Hi(e,n,a,s)}function Hi(e,n,a,s){var h={lane:s,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(go(e))lx(n,h);else{var x=e.alternate;if(e.lanes===0&&(x===null||x.lanes===0)&&(x=n.lastRenderedReducer,x!==null))try{var w=n.lastRenderedState,N=x(w,a);if(h.hasEagerState=!0,h.eagerState=N,$n(N,w))return Zs(e,n,h,0),At===null&&Ws(),!1}catch{}finally{}if(a=au(e,n,h,s),a!==null)return Mn(a,e,s),rx(a,n,s),!0}return!1}function Iu(e,n,a,s){if(s={lane:2,revertLane:wf(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},go(e)){if(n)throw Error(i(479))}else n=au(e,a,s,2),n!==null&&Mn(n,e,2)}function go(e){var n=e.alternate;return e===Ke||n!==null&&n===Ke}function lx(e,n){Ha=uo=!0;var a=e.pending;a===null?n.next=n:(n.next=a.next,a.next=n),e.pending=n}function rx(e,n,a){if((a&4194048)!==0){var s=n.lanes;s&=e.pendingLanes,a|=s,n.lanes=a,Rl(e,a)}}var Ui={readContext:cn,use:mo,useCallback:Ht,useContext:Ht,useEffect:Ht,useImperativeHandle:Ht,useLayoutEffect:Ht,useInsertionEffect:Ht,useMemo:Ht,useReducer:Ht,useRef:Ht,useState:Ht,useDebugValue:Ht,useDeferredValue:Ht,useTransition:Ht,useSyncExternalStore:Ht,useId:Ht,useHostTransitionStatus:Ht,useFormState:Ht,useActionState:Ht,useOptimistic:Ht,useMemoCache:Ht,useCacheRefresh:Ht};Ui.useEffectEvent=Ht;var ax={readContext:cn,use:mo,useCallback:function(e,n){return bn().memoizedState=[e,n===void 0?null:n],e},useContext:cn,useEffect:Im,useImperativeHandle:function(e,n,a){a=a!=null?a.concat([e]):null,po(4194308,4,Vm.bind(null,n,e),a)},useLayoutEffect:function(e,n){return po(4194308,4,e,n)},useInsertionEffect:function(e,n){po(4,2,e,n)},useMemo:function(e,n){var a=bn();n=n===void 0?null:n;var s=e();if(sa){Pe(!0);try{e()}finally{Pe(!1)}}return a.memoizedState=[s,n],s},useReducer:function(e,n,a){var s=bn();if(a!==void 0){var h=a(n);if(sa){Pe(!0);try{a(n)}finally{Pe(!1)}}}else h=n;return s.memoizedState=s.baseState=h,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:h},s.queue=e,e=e.dispatch=R2.bind(null,Ke,e),[s.memoizedState,e]},useRef:function(e){var n=bn();return e={current:e},n.memoizedState=e},useState:function(e){e=_u(e);var n=e.queue,a=nx.bind(null,Ke,n);return n.dispatch=a,[e.memoizedState,a]},useDebugValue:Lu,useDeferredValue:function(e,n){var a=bn();return $u(a,e,n)},useTransition:function(){var e=_u(!1);return e=Zm.bind(null,Ke,e.queue,!0,!1),bn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,a){var s=Ke,h=bn();if(ct){if(a===void 0)throw Error(i(407));a=a()}else{if(a=n(),At===null)throw Error(i(349));(it&127)!==0||Em(s,n,a)}h.memoizedState=a;var x={value:a,getSnapshot:n};return h.queue=x,Im(Am.bind(null,s,x,e),[e]),s.flags|=2048,Ia(9,{destroy:void 0},Nm.bind(null,s,x,a,n),null),a},useId:function(){var e=bn(),n=At.identifierPrefix;if(ct){var a=vl,s=bl;a=(s&~(1<<32-dt(s)-1)).toString(32)+a,n="_"+n+"R_"+a,a=fo++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=E2++,n="_"+n+"r_"+a.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:Uu,useFormState:Bm,useActionState:Bm,useOptimistic:function(e){var n=bn();n.memoizedState=n.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=Iu.bind(null,Ke,!0,a),a.dispatch=n,[e,n]},useMemoCache:Mu,useCacheRefresh:function(){return bn().memoizedState=M2.bind(null,Ke)},useEffectEvent:function(e){var n=bn(),a={impl:e};return n.memoizedState=a,function(){if((yt&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}},Yu={readContext:cn,use:mo,useCallback:Km,useContext:cn,useEffect:Bu,useImperativeHandle:Gm,useInsertionEffect:qm,useLayoutEffect:Xm,useMemo:Qm,useReducer:xo,useRef:Um,useState:function(){return xo(ql)},useDebugValue:Lu,useDeferredValue:function(e,n){var a=Gt();return Wm(a,jt.memoizedState,e,n)},useTransition:function(){var e=xo(ql)[0],n=Gt().memoizedState;return[typeof e=="boolean"?e:$i(e),n]},useSyncExternalStore:Cm,useId:ex,useHostTransitionStatus:Uu,useFormState:Lm,useActionState:Lm,useOptimistic:function(e,n){var a=Gt();return zm(a,jt,e,n)},useMemoCache:Mu,useCacheRefresh:tx};Yu.useEffectEvent=Ym;var ix={readContext:cn,use:mo,useCallback:Km,useContext:cn,useEffect:Bu,useImperativeHandle:Gm,useInsertionEffect:qm,useLayoutEffect:Xm,useMemo:Qm,useReducer:Fu,useRef:Um,useState:function(){return Fu(ql)},useDebugValue:Lu,useDeferredValue:function(e,n){var a=Gt();return jt===null?$u(a,e,n):Wm(a,jt.memoizedState,e,n)},useTransition:function(){var e=Fu(ql)[0],n=Gt().memoizedState;return[typeof e=="boolean"?e:$i(e),n]},useSyncExternalStore:Cm,useId:ex,useHostTransitionStatus:Uu,useFormState:Hm,useActionState:Hm,useOptimistic:function(e,n){var a=Gt();return jt!==null?zm(a,jt,e,n):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:Mu,useCacheRefresh:tx};ix.useEffectEvent=Ym;function qu(e,n,a,s){n=e.memoizedState,a=a(s,n),a=a==null?n:y({},n,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Xu={enqueueSetState:function(e,n,a){e=e._reactInternals;var s=Xn(),h=xr(s);h.payload=n,a!=null&&(h.callback=a),n=pr(e,h,s),n!==null&&(Mn(n,e,s),_i(n,e,s))},enqueueReplaceState:function(e,n,a){e=e._reactInternals;var s=Xn(),h=xr(s);h.tag=1,h.payload=n,a!=null&&(h.callback=a),n=pr(e,h,s),n!==null&&(Mn(n,e,s),_i(n,e,s))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var a=Xn(),s=xr(a);s.tag=2,n!=null&&(s.callback=n),n=pr(e,s,a),n!==null&&(Mn(n,e,a),_i(n,e,a))}};function sx(e,n,a,s,h,x,w){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,x,w):n.prototype&&n.prototype.isPureReactComponent?!Ni(a,s)||!Ni(h,x):!0}function ox(e,n,a,s){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,s),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,s),n.state!==e&&Xu.enqueueReplaceState(n,n.state,null)}function oa(e,n){var a=n;if("ref"in n){a={};for(var s in n)s!=="ref"&&(a[s]=n[s])}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 cx(e){Qs(e)}function ux(e){console.error(e)}function fx(e){Qs(e)}function bo(e,n){try{var a=e.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(s){setTimeout(function(){throw s})}}function dx(e,n,a){try{var s=e.onCaughtError;s(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(h){setTimeout(function(){throw h})}}function Vu(e,n,a){return a=xr(a),a.tag=3,a.payload={element:null},a.callback=function(){bo(e,n)},a}function hx(e){return e=xr(e),e.tag=3,e}function mx(e,n,a,s){var h=a.type.getDerivedStateFromError;if(typeof h=="function"){var x=s.value;e.payload=function(){return h(x)},e.callback=function(){dx(n,a,s)}}var w=a.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(e.callback=function(){dx(n,a,s),typeof h!="function"&&(kr===null?kr=new Set([this]):kr.add(this));var N=s.stack;this.componentDidCatch(s.value,{componentStack:N!==null?N:""})})}function F2(e,n,a,s,h){if(a.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(n=a.alternate,n!==null&&Fa(n,a,h,!0),a=Un.current,a!==null){switch(a.tag){case 31:case 13:return rl===null?zo():a.alternate===null&&Ut===0&&(Ut=3),a.flags&=-257,a.flags|=65536,a.lanes=h,s===ao?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([s]):n.add(s),gf(e,s,h)),!1;case 22:return a.flags|=65536,s===ao?a.flags|=16384:(n=a.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([s])},a.updateQueue=n):(a=n.retryQueue,a===null?n.retryQueue=new Set([s]):a.add(s)),gf(e,s,h)),!1}throw Error(i(435,a.tag))}return gf(e,s,h),zo(),!1}if(ct)return n=Un.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=h,s!==fu&&(e=Error(i(422),{cause:s}),Ti(el(e,a)))):(s!==fu&&(n=Error(i(423),{cause:s}),Ti(el(n,a))),e=e.current.alternate,e.flags|=65536,h&=-h,e.lanes|=h,s=el(s,a),h=Vu(e.stateNode,s,h),ku(e,h),Ut!==4&&(Ut=2)),!1;var x=Error(i(520),{cause:s});if(x=el(x,a),Qi===null?Qi=[x]:Qi.push(x),Ut!==4&&(Ut=2),n===null)return!0;s=el(s,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,e=h&-h,a.lanes|=e,e=Vu(a.stateNode,s,e),ku(a,e),!1;case 1:if(n=a.type,x=a.stateNode,(a.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(kr===null||!kr.has(x))))return a.flags|=65536,h&=-h,a.lanes|=h,h=hx(h),mx(h,e,a,s),ku(a,h),!1}a=a.return}while(a!==null);return!1}var Gu=Error(i(461)),Jt=!1;function un(e,n,a,s){n.child=e===null?gm(n,null,a,s):ia(n,e.child,a,s)}function xx(e,n,a,s,h){a=a.render;var x=n.ref;if("ref"in s){var w={};for(var N in s)N!=="ref"&&(w[N]=s[N])}else w=s;return na(n),s=Au(e,n,a,w,x,h),N=Du(),e!==null&&!Jt?(Tu(e,n,h),Xl(e,n,h)):(ct&&N&&cu(n),n.flags|=1,un(e,n,s,h),n.child)}function px(e,n,a,s,h){if(e===null){var x=a.type;return typeof x=="function"&&!iu(x)&&x.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=x,yx(e,n,x,s,h)):(e=Ps(a.type,null,s,n,n.mode,h),e.ref=n.ref,e.return=n,n.child=e)}if(x=e.child,!tf(e,h)){var w=x.memoizedProps;if(a=a.compare,a=a!==null?a:Ni,a(w,s)&&e.ref===n.ref)return Xl(e,n,h)}return n.flags|=1,e=$l(x,s),e.ref=n.ref,e.return=n,n.child=e}function yx(e,n,a,s,h){if(e!==null){var x=e.memoizedProps;if(Ni(x,s)&&e.ref===n.ref)if(Jt=!1,n.pendingProps=s=x,tf(e,h))(e.flags&131072)!==0&&(Jt=!0);else return n.lanes=e.lanes,Xl(e,n,h)}return Ku(e,n,a,s,h)}function gx(e,n,a,s){var h=s.children,x=e!==null?e.memoizedState:null;if(e===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.mode==="hidden"){if((n.flags&128)!==0){if(x=x!==null?x.baseLanes|a:a,e!==null){for(s=n.child=e.child,h=0;s!==null;)h=h|s.lanes|s.childLanes,s=s.sibling;s=h&~x}else s=0,n.child=null;return bx(e,n,x,a,s)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&lo(n,x!==null?x.cachePool:null),x!==null?wm(n,x):ju(),km(n);else return s=n.lanes=536870912,bx(e,n,x!==null?x.baseLanes|a:a,a,s)}else x!==null?(lo(n,x.cachePool),wm(n,x),gr(),n.memoizedState=null):(e!==null&&lo(n,null),ju(),gr());return un(e,n,h,a),n.child}function Ii(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function bx(e,n,a,s,h){var x=gu();return x=x===null?null:{parent:Wt._currentValue,pool:x},n.memoizedState={baseLanes:a,cachePool:x},e!==null&&lo(n,null),ju(),km(n),e!==null&&Fa(e,n,s,!0),n.childLanes=h,null}function vo(e,n){return n=ko({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function vx(e,n,a){return ia(n,e.child,null,a),e=vo(n,n.pendingProps),e.flags|=2,In(n),n.memoizedState=null,e}function _2(e,n,a){var s=n.pendingProps,h=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(ct){if(s.mode==="hidden")return e=vo(n,s),n.lanes=536870912,Ii(null,e);if(Eu(n),(e=zt)?(e=Mp(e,ll),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:ur!==null?{id:bl,overflow:vl}:null,retryLane:536870912,hydrationErrors:null},a=lm(e),a.return=n,n.child=a,on=n,zt=null)):e=null,e===null)throw dr(n);return n.lanes=536870912,null}return vo(n,s)}var x=e.memoizedState;if(x!==null){var w=x.dehydrated;if(Eu(n),h)if(n.flags&256)n.flags&=-257,n=vx(e,n,a);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(i(558));else if(Jt||Fa(e,n,a,!1),h=(a&e.childLanes)!==0,Jt||h){if(s=At,s!==null&&(w=Fl(s,a),w!==0&&w!==x.retryLane))throw x.retryLane=w,Jr(e,w),Mn(s,e,w),Gu;zo(),n=vx(e,n,a)}else e=x.treeContext,zt=al(w.nextSibling),on=n,ct=!0,fr=null,ll=!1,e!==null&&im(n,e),n=vo(n,s),n.flags|=4096;return n}return e=$l(e.child,{mode:s.mode,children:s.children}),e.ref=n.ref,n.child=e,e.return=n,e}function wo(e,n){var a=n.ref;if(a===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(i(284));(e===null||e.ref!==a)&&(n.flags|=4194816)}}function Ku(e,n,a,s,h){return na(n),a=Au(e,n,a,s,void 0,h),s=Du(),e!==null&&!Jt?(Tu(e,n,h),Xl(e,n,h)):(ct&&s&&cu(n),n.flags|=1,un(e,n,a,h),n.child)}function wx(e,n,a,s,h,x){return na(n),n.updateQueue=null,a=jm(n,s,a,h),Sm(e),s=Du(),e!==null&&!Jt?(Tu(e,n,x),Xl(e,n,x)):(ct&&s&&cu(n),n.flags|=1,un(e,n,a,x),n.child)}function kx(e,n,a,s,h){if(na(n),n.stateNode===null){var x=Ta,w=a.contextType;typeof w=="object"&&w!==null&&(x=cn(w)),x=new a(s,x),n.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=Xu,n.stateNode=x,x._reactInternals=n,x=n.stateNode,x.props=s,x.state=n.memoizedState,x.refs={},vu(n),w=a.contextType,x.context=typeof w=="object"&&w!==null?cn(w):Ta,x.state=n.memoizedState,w=a.getDerivedStateFromProps,typeof w=="function"&&(qu(n,a,w,s),x.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(w=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),w!==x.state&&Xu.enqueueReplaceState(x,x.state,null),Bi(n,s,x,h),Oi(),x.state=n.memoizedState),typeof x.componentDidMount=="function"&&(n.flags|=4194308),s=!0}else if(e===null){x=n.stateNode;var N=n.memoizedProps,H=oa(a,N);x.props=H;var Z=x.context,ie=a.contextType;w=Ta,typeof ie=="object"&&ie!==null&&(w=cn(ie));var he=a.getDerivedStateFromProps;ie=typeof he=="function"||typeof x.getSnapshotBeforeUpdate=="function",N=n.pendingProps!==N,ie||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(N||Z!==w)&&ox(n,x,s,w),mr=!1;var P=n.memoizedState;x.state=P,Bi(n,s,x,h),Oi(),Z=n.memoizedState,N||P!==Z||mr?(typeof he=="function"&&(qu(n,a,he,s),Z=n.memoizedState),(H=mr||sx(n,a,H,s,P,Z,w))?(ie||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(n.flags|=4194308)):(typeof x.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=s,n.memoizedState=Z),x.props=s,x.state=Z,x.context=w,s=H):(typeof x.componentDidMount=="function"&&(n.flags|=4194308),s=!1)}else{x=n.stateNode,wu(e,n),w=n.memoizedProps,ie=oa(a,w),x.props=ie,he=n.pendingProps,P=x.context,Z=a.contextType,H=Ta,typeof Z=="object"&&Z!==null&&(H=cn(Z)),N=a.getDerivedStateFromProps,(Z=typeof N=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(w!==he||P!==H)&&ox(n,x,s,H),mr=!1,P=n.memoizedState,x.state=P,Bi(n,s,x,h),Oi();var le=n.memoizedState;w!==he||P!==le||mr||e!==null&&e.dependencies!==null&&to(e.dependencies)?(typeof N=="function"&&(qu(n,a,N,s),le=n.memoizedState),(ie=mr||sx(n,a,ie,s,P,le,H)||e!==null&&e.dependencies!==null&&to(e.dependencies))?(Z||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(s,le,H),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(s,le,H)),typeof x.componentDidUpdate=="function"&&(n.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof x.componentDidUpdate!="function"||w===e.memoizedProps&&P===e.memoizedState||(n.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===e.memoizedProps&&P===e.memoizedState||(n.flags|=1024),n.memoizedProps=s,n.memoizedState=le),x.props=s,x.state=le,x.context=H,s=ie):(typeof x.componentDidUpdate!="function"||w===e.memoizedProps&&P===e.memoizedState||(n.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===e.memoizedProps&&P===e.memoizedState||(n.flags|=1024),s=!1)}return x=s,wo(e,n),s=(n.flags&128)!==0,x||s?(x=n.stateNode,a=s&&typeof a.getDerivedStateFromError!="function"?null:x.render(),n.flags|=1,e!==null&&s?(n.child=ia(n,e.child,null,h),n.child=ia(n,null,a,h)):un(e,n,a,h),n.memoizedState=x.state,e=n.child):e=Xl(e,n,h),e}function Sx(e,n,a,s){return ea(),n.flags|=256,un(e,n,a,s),n.child}var Qu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Wu(e){return{baseLanes:e,cachePool:dm()}}function Zu(e,n,a){return e=e!==null?e.childLanes&~a:0,n&&(e|=qn),e}function jx(e,n,a){var s=n.pendingProps,h=!1,x=(n.flags&128)!==0,w;if((w=x)||(w=e!==null&&e.memoizedState===null?!1:(Vt.current&2)!==0),w&&(h=!0,n.flags&=-129),w=(n.flags&32)!==0,n.flags&=-33,e===null){if(ct){if(h?yr(n):gr(),(e=zt)?(e=Mp(e,ll),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:ur!==null?{id:bl,overflow:vl}:null,retryLane:536870912,hydrationErrors:null},a=lm(e),a.return=n,n.child=a,on=n,zt=null)):e=null,e===null)throw dr(n);return Ff(e)?n.lanes=32:n.lanes=536870912,null}var N=s.children;return s=s.fallback,h?(gr(),h=n.mode,N=ko({mode:"hidden",children:N},h),s=Pr(s,h,a,null),N.return=n,s.return=n,N.sibling=s,n.child=N,s=n.child,s.memoizedState=Wu(a),s.childLanes=Zu(e,w,a),n.memoizedState=Qu,Ii(null,s)):(yr(n),Ju(n,N))}var H=e.memoizedState;if(H!==null&&(N=H.dehydrated,N!==null)){if(x)n.flags&256?(yr(n),n.flags&=-257,n=Pu(e,n,a)):n.memoizedState!==null?(gr(),n.child=e.child,n.flags|=128,n=null):(gr(),N=s.fallback,h=n.mode,s=ko({mode:"visible",children:s.children},h),N=Pr(N,h,a,null),N.flags|=2,s.return=n,N.return=n,s.sibling=N,n.child=s,ia(n,e.child,null,a),s=n.child,s.memoizedState=Wu(a),s.childLanes=Zu(e,w,a),n.memoizedState=Qu,n=Ii(null,s));else if(yr(n),Ff(N)){if(w=N.nextSibling&&N.nextSibling.dataset,w)var Z=w.dgst;w=Z,s=Error(i(419)),s.stack="",s.digest=w,Ti({value:s,source:null,stack:null}),n=Pu(e,n,a)}else if(Jt||Fa(e,n,a,!1),w=(a&e.childLanes)!==0,Jt||w){if(w=At,w!==null&&(s=Fl(w,a),s!==0&&s!==H.retryLane))throw H.retryLane=s,Jr(e,s),Mn(w,e,s),Gu;Rf(N)||zo(),n=Pu(e,n,a)}else Rf(N)?(n.flags|=192,n.child=e.child,n=null):(e=H.treeContext,zt=al(N.nextSibling),on=n,ct=!0,fr=null,ll=!1,e!==null&&im(n,e),n=Ju(n,s.children),n.flags|=4096);return n}return h?(gr(),N=s.fallback,h=n.mode,H=e.child,Z=H.sibling,s=$l(H,{mode:"hidden",children:s.children}),s.subtreeFlags=H.subtreeFlags&65011712,Z!==null?N=$l(Z,N):(N=Pr(N,h,a,null),N.flags|=2),N.return=n,s.return=n,s.sibling=N,n.child=s,Ii(null,s),s=n.child,N=e.child.memoizedState,N===null?N=Wu(a):(h=N.cachePool,h!==null?(H=Wt._currentValue,h=h.parent!==H?{parent:H,pool:H}:h):h=dm(),N={baseLanes:N.baseLanes|a,cachePool:h}),s.memoizedState=N,s.childLanes=Zu(e,w,a),n.memoizedState=Qu,Ii(e.child,s)):(yr(n),a=e.child,e=a.sibling,a=$l(a,{mode:"visible",children:s.children}),a.return=n,a.sibling=null,e!==null&&(w=n.deletions,w===null?(n.deletions=[e],n.flags|=16):w.push(e)),n.child=a,n.memoizedState=null,a)}function Ju(e,n){return n=ko({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function ko(e,n){return e=Hn(22,e,null,n),e.lanes=0,e}function Pu(e,n,a){return ia(n,e.child,null,a),e=Ju(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function Cx(e,n,a){e.lanes|=n;var s=e.alternate;s!==null&&(s.lanes|=n),mu(e.return,n,a)}function ef(e,n,a,s,h,x){var w=e.memoizedState;w===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:s,tail:a,tailMode:h,treeForkCount:x}:(w.isBackwards=n,w.rendering=null,w.renderingStartTime=0,w.last=s,w.tail=a,w.tailMode=h,w.treeForkCount=x)}function Ex(e,n,a){var s=n.pendingProps,h=s.revealOrder,x=s.tail;s=s.children;var w=Vt.current,N=(w&2)!==0;if(N?(w=w&1|2,n.flags|=128):w&=1,D(Vt,w),un(e,n,s,a),s=ct?Di:0,!N&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Cx(e,a,n);else if(e.tag===19)Cx(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&&co(e)===null&&(h=a),a=a.sibling;a=h,a===null?(h=n.child,n.child=null):(h=a.sibling,a.sibling=null),ef(n,!1,h,a,x,s);break;case"backwards":case"unstable_legacy-backwards":for(a=null,h=n.child,n.child=null;h!==null;){if(e=h.alternate,e!==null&&co(e)===null){n.child=h;break}e=h.sibling,h.sibling=a,a=h,h=e}ef(n,!0,a,null,x,s);break;case"together":ef(n,!1,null,null,void 0,s);break;default:n.memoizedState=null}return n.child}function Xl(e,n,a){if(e!==null&&(n.dependencies=e.dependencies),wr|=n.lanes,(a&n.childLanes)===0)if(e!==null){if(Fa(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=$l(e,e.pendingProps),n.child=a,a.return=n;e.sibling!==null;)e=e.sibling,a=a.sibling=$l(e,e.pendingProps),a.return=n;a.sibling=null}return n.child}function tf(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&to(e)))}function O2(e,n,a){switch(n.tag){case 3:_e(n,n.stateNode.containerInfo),hr(n,Wt,e.memoizedState.cache),ea();break;case 27:case 5:K(n);break;case 4:_e(n,n.stateNode.containerInfo);break;case 10:hr(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,Eu(n),null;break;case 13:var s=n.memoizedState;if(s!==null)return s.dehydrated!==null?(yr(n),n.flags|=128,null):(a&n.child.childLanes)!==0?jx(e,n,a):(yr(n),e=Xl(e,n,a),e!==null?e.sibling:null);yr(n);break;case 19:var h=(e.flags&128)!==0;if(s=(a&n.childLanes)!==0,s||(Fa(e,n,a,!1),s=(a&n.childLanes)!==0),h){if(s)return Ex(e,n,a);n.flags|=128}if(h=n.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),D(Vt,Vt.current),s)break;return null;case 22:return n.lanes=0,gx(e,n,a,n.pendingProps);case 24:hr(n,Wt,e.memoizedState.cache)}return Xl(e,n,a)}function Nx(e,n,a){if(e!==null)if(e.memoizedProps!==n.pendingProps)Jt=!0;else{if(!tf(e,a)&&(n.flags&128)===0)return Jt=!1,O2(e,n,a);Jt=(e.flags&131072)!==0}else Jt=!1,ct&&(n.flags&1048576)!==0&&am(n,Di,n.index);switch(n.lanes=0,n.tag){case 16:e:{var s=n.pendingProps;if(e=ra(n.elementType),n.type=e,typeof e=="function")iu(e)?(s=oa(e,s),n.tag=1,n=kx(null,n,e,s,a)):(n.tag=0,n=Ku(null,n,e,s,a));else{if(e!=null){var h=e.$$typeof;if(h===O){n.tag=11,n=xx(null,n,e,s,a);break e}else if(h===I){n.tag=14,n=px(null,n,e,s,a);break e}}throw n=re(e)||e,Error(i(306,n,""))}}return n;case 0:return Ku(e,n,n.type,n.pendingProps,a);case 1:return s=n.type,h=oa(s,n.pendingProps),kx(e,n,s,h,a);case 3:e:{if(_e(n,n.stateNode.containerInfo),e===null)throw Error(i(387));s=n.pendingProps;var x=n.memoizedState;h=x.element,wu(e,n),Bi(n,s,null,a);var w=n.memoizedState;if(s=w.cache,hr(n,Wt,s),s!==x.cache&&xu(n,[Wt],a,!0),Oi(),s=w.element,x.isDehydrated)if(x={element:s,isDehydrated:!1,cache:w.cache},n.updateQueue.baseState=x,n.memoizedState=x,n.flags&256){n=Sx(e,n,s,a);break e}else if(s!==h){h=el(Error(i(424)),n),Ti(h),n=Sx(e,n,s,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(zt=al(e.firstChild),on=n,ct=!0,fr=null,ll=!0,a=gm(n,null,s,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(ea(),s===h){n=Xl(e,n,a);break e}un(e,n,s,a)}n=n.child}return n;case 26:return wo(e,n),e===null?(a=Lp(n.type,null,n.pendingProps,null))?n.memoizedState=a:ct||(a=n.type,e=n.pendingProps,s=Lo(Ne.current).createElement(a),s[Qt]=n,s[sn]=e,fn(s,a,e),ft(s),n.stateNode=s):n.memoizedState=Lp(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return K(n),e===null&&ct&&(s=n.stateNode=_p(n.type,n.pendingProps,Ne.current),on=n,ll=!0,h=zt,Er(n.type)?(_f=h,zt=al(s.firstChild)):zt=h),un(e,n,n.pendingProps.children,a),wo(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&ct&&((h=s=zt)&&(s=db(s,n.type,n.pendingProps,ll),s!==null?(n.stateNode=s,on=n,zt=al(s.firstChild),ll=!1,h=!0):h=!1),h||dr(n)),K(n),h=n.type,x=n.pendingProps,w=e!==null?e.memoizedProps:null,s=x.children,Tf(h,x)?s=null:w!==null&&Tf(h,w)&&(n.flags|=32),n.memoizedState!==null&&(h=Au(e,n,N2,null,null,a),ls._currentValue=h),wo(e,n),un(e,n,s,a),n.child;case 6:return e===null&&ct&&((e=a=zt)&&(a=hb(a,n.pendingProps,ll),a!==null?(n.stateNode=a,on=n,zt=null,e=!0):e=!1),e||dr(n)),null;case 13:return jx(e,n,a);case 4:return _e(n,n.stateNode.containerInfo),s=n.pendingProps,e===null?n.child=ia(n,null,s,a):un(e,n,s,a),n.child;case 11:return xx(e,n,n.type,n.pendingProps,a);case 7:return un(e,n,n.pendingProps,a),n.child;case 8:return un(e,n,n.pendingProps.children,a),n.child;case 12:return un(e,n,n.pendingProps.children,a),n.child;case 10:return s=n.pendingProps,hr(n,n.type,s.value),un(e,n,s.children,a),n.child;case 9:return h=n.type._context,s=n.pendingProps.children,na(n),h=cn(h),s=s(h),n.flags|=1,un(e,n,s,a),n.child;case 14:return px(e,n,n.type,n.pendingProps,a);case 15:return yx(e,n,n.type,n.pendingProps,a);case 19:return Ex(e,n,a);case 31:return _2(e,n,a);case 22:return gx(e,n,a,n.pendingProps);case 24:return na(n),s=cn(Wt),e===null?(h=gu(),h===null&&(h=At,x=pu(),h.pooledCache=x,x.refCount++,x!==null&&(h.pooledCacheLanes|=a),h=x),n.memoizedState={parent:s,cache:h},vu(n),hr(n,Wt,h)):((e.lanes&a)!==0&&(wu(e,n),Bi(n,null,null,a),Oi()),h=e.memoizedState,x=n.memoizedState,h.parent!==s?(h={parent:s,cache:s},n.memoizedState=h,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=h),hr(n,Wt,s)):(s=x.cache,hr(n,Wt,s),s!==h.cache&&xu(n,[Wt],a,!0))),un(e,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(i(156,n.tag))}function Vl(e){e.flags|=4}function nf(e,n,a,s,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(ep())e.flags|=8192;else throw aa=ao,bu}else e.flags&=-16777217}function Ax(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Yp(n))if(ep())e.flags|=8192;else throw aa=ao,bu}function So(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?yn():536870912,e.lanes|=n,Va|=n)}function Yi(e,n){if(!ct)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 s=null;a!==null;)a.alternate!==null&&(s=a),a=a.sibling;s===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function Mt(e){var n=e.alternate!==null&&e.alternate.child===e.child,a=0,s=0;if(n)for(var h=e.child;h!==null;)a|=h.lanes|h.childLanes,s|=h.subtreeFlags&65011712,s|=h.flags&65011712,h.return=e,h=h.sibling;else for(h=e.child;h!==null;)a|=h.lanes|h.childLanes,s|=h.subtreeFlags,s|=h.flags,h.return=e,h=h.sibling;return e.subtreeFlags|=s,e.childLanes=a,n}function B2(e,n,a){var s=n.pendingProps;switch(uu(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Mt(n),null;case 1:return Mt(n),null;case 3:return a=n.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),n.memoizedState.cache!==s&&(n.flags|=2048),Il(Wt),oe(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Ra(n)?Vl(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,du())),Mt(n),null;case 26:var h=n.type,x=n.memoizedState;return e===null?(Vl(n),x!==null?(Mt(n),Ax(n,x)):(Mt(n),nf(n,h,null,s,a))):x?x!==e.memoizedState?(Vl(n),Mt(n),Ax(n,x)):(Mt(n),n.flags&=-16777217):(e=e.memoizedProps,e!==s&&Vl(n),Mt(n),nf(n,h,e,s,a)),null;case 27:if(fe(n),a=Ne.current,h=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==s&&Vl(n);else{if(!s){if(n.stateNode===null)throw Error(i(166));return Mt(n),null}e=pe.current,Ra(n)?sm(n):(e=_p(h,s,a),n.stateNode=e,Vl(n))}return Mt(n),null;case 5:if(fe(n),h=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==s&&Vl(n);else{if(!s){if(n.stateNode===null)throw Error(i(166));return Mt(n),null}if(x=pe.current,Ra(n))sm(n);else{var w=Lo(Ne.current);switch(x){case 1:x=w.createElementNS("http://www.w3.org/2000/svg",h);break;case 2:x=w.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;default:switch(h){case"svg":x=w.createElementNS("http://www.w3.org/2000/svg",h);break;case"math":x=w.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;case"script":x=w.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof s.is=="string"?w.createElement("select",{is:s.is}):w.createElement("select"),s.multiple?x.multiple=!0:s.size&&(x.size=s.size);break;default:x=typeof s.is=="string"?w.createElement(h,{is:s.is}):w.createElement(h)}}x[Qt]=n,x[sn]=s;e:for(w=n.child;w!==null;){if(w.tag===5||w.tag===6)x.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=x;e:switch(fn(x,h,s),h){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&Vl(n)}}return Mt(n),nf(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,a),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==s&&Vl(n);else{if(typeof s!="string"&&n.stateNode===null)throw Error(i(166));if(e=Ne.current,Ra(n)){if(e=n.stateNode,a=n.memoizedProps,s=null,h=on,h!==null)switch(h.tag){case 27:case 5:s=h.memoizedProps}e[Qt]=n,e=!!(e.nodeValue===a||s!==null&&s.suppressHydrationWarning===!0||jp(e.nodeValue,a)),e||dr(n,!0)}else e=Lo(e).createTextNode(s),e[Qt]=n,n.stateNode=e}return Mt(n),null;case 31:if(a=n.memoizedState,e===null||e.memoizedState!==null){if(s=Ra(n),a!==null){if(e===null){if(!s)throw Error(i(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(557));e[Qt]=n}else ea(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Mt(n),e=!1}else a=du(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return n.flags&256?(In(n),n):(In(n),null);if((n.flags&128)!==0)throw Error(i(558))}return Mt(n),null;case 13:if(s=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(h=Ra(n),s!==null&&s.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[Qt]=n}else ea(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Mt(n),h=!1}else h=du(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=h),h=!0;if(!h)return n.flags&256?(In(n),n):(In(n),null)}return In(n),(n.flags&128)!==0?(n.lanes=a,n):(a=s!==null,e=e!==null&&e.memoizedState!==null,a&&(s=n.child,h=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(h=s.alternate.memoizedState.cachePool.pool),x=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(x=s.memoizedState.cachePool.pool),x!==h&&(s.flags|=2048)),a!==e&&a&&(n.child.flags|=8192),So(n,n.updateQueue),Mt(n),null);case 4:return oe(),e===null&&Cf(n.stateNode.containerInfo),Mt(n),null;case 10:return Il(n.type),Mt(n),null;case 19:if(J(Vt),s=n.memoizedState,s===null)return Mt(n),null;if(h=(n.flags&128)!==0,x=s.rendering,x===null)if(h)Yi(s,!1);else{if(Ut!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(x=co(e),x!==null){for(n.flags|=128,Yi(s,!1),e=x.updateQueue,n.updateQueue=e,So(n,e),n.subtreeFlags=0,e=a,a=n.child;a!==null;)nm(a,e),a=a.sibling;return D(Vt,Vt.current&1|2),ct&&Hl(n,s.treeForkCount),n.child}e=e.sibling}s.tail!==null&&vt()>Ao&&(n.flags|=128,h=!0,Yi(s,!1),n.lanes=4194304)}else{if(!h)if(e=co(x),e!==null){if(n.flags|=128,h=!0,e=e.updateQueue,n.updateQueue=e,So(n,e),Yi(s,!0),s.tail===null&&s.tailMode==="hidden"&&!x.alternate&&!ct)return Mt(n),null}else 2*vt()-s.renderingStartTime>Ao&&a!==536870912&&(n.flags|=128,h=!0,Yi(s,!1),n.lanes=4194304);s.isBackwards?(x.sibling=n.child,n.child=x):(e=s.last,e!==null?e.sibling=x:n.child=x,s.last=x)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=vt(),e.sibling=null,a=Vt.current,D(Vt,h?a&1|2:a&1),ct&&Hl(n,s.treeForkCount),e):(Mt(n),null);case 22:case 23:return In(n),Cu(),s=n.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(n.flags|=8192):s&&(n.flags|=8192),s?(a&536870912)!==0&&(n.flags&128)===0&&(Mt(n),n.subtreeFlags&6&&(n.flags|=8192)):Mt(n),a=n.updateQueue,a!==null&&So(n,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),s=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(s=n.memoizedState.cachePool.pool),s!==a&&(n.flags|=2048),e!==null&&J(la),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),Il(Wt),Mt(n),null;case 25:return null;case 30:return null}throw Error(i(156,n.tag))}function L2(e,n){switch(uu(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return Il(Wt),oe(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return fe(n),null;case 31:if(n.memoizedState!==null){if(In(n),n.alternate===null)throw Error(i(340));ea()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(In(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(i(340));ea()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return J(Vt),null;case 4:return oe(),null;case 10:return Il(n.type),null;case 22:case 23:return In(n),Cu(),e!==null&&J(la),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return Il(Wt),null;case 25:return null;default:return null}}function Dx(e,n){switch(uu(n),n.tag){case 3:Il(Wt),oe();break;case 26:case 27:case 5:fe(n);break;case 4:oe();break;case 31:n.memoizedState!==null&&In(n);break;case 13:In(n);break;case 19:J(Vt);break;case 10:Il(n.type);break;case 22:case 23:In(n),Cu(),e!==null&&J(la);break;case 24:Il(Wt)}}function qi(e,n){try{var a=n.updateQueue,s=a!==null?a.lastEffect:null;if(s!==null){var h=s.next;a=h;do{if((a.tag&e)===e){s=void 0;var x=a.create,w=a.inst;s=x(),w.destroy=s}a=a.next}while(a!==h)}}catch(N){kt(n,n.return,N)}}function br(e,n,a){try{var s=n.updateQueue,h=s!==null?s.lastEffect:null;if(h!==null){var x=h.next;s=x;do{if((s.tag&e)===e){var w=s.inst,N=w.destroy;if(N!==void 0){w.destroy=void 0,h=n;var H=a,Z=N;try{Z()}catch(ie){kt(h,H,ie)}}}s=s.next}while(s!==x)}}catch(ie){kt(n,n.return,ie)}}function Tx(e){var n=e.updateQueue;if(n!==null){var a=e.stateNode;try{vm(n,a)}catch(s){kt(e,e.return,s)}}}function zx(e,n,a){a.props=oa(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(s){kt(e,n,s)}}function Xi(e,n){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof a=="function"?e.refCleanup=a(s):a.current=s}}catch(h){kt(e,n,h)}}function wl(e,n){var a=e.ref,s=e.refCleanup;if(a!==null)if(typeof s=="function")try{s()}catch(h){kt(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){kt(e,n,h)}else a.current=null}function Mx(e){var n=e.type,a=e.memoizedProps,s=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&s.focus();break e;case"img":a.src?s.src=a.src:a.srcSet&&(s.srcset=a.srcSet)}}catch(h){kt(e,e.return,h)}}function lf(e,n,a){try{var s=e.stateNode;ib(s,e.type,a,n),s[sn]=n}catch(h){kt(e,e.return,h)}}function Rx(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Er(e.type)||e.tag===4}function rf(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Rx(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Er(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 af(e,n,a){var s=e.tag;if(s===5||s===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=gn));else if(s!==4&&(s===27&&Er(e.type)&&(a=e.stateNode,n=null),e=e.child,e!==null))for(af(e,n,a),e=e.sibling;e!==null;)af(e,n,a),e=e.sibling}function jo(e,n,a){var s=e.tag;if(s===5||s===6)e=e.stateNode,n?a.insertBefore(e,n):a.appendChild(e);else if(s!==4&&(s===27&&Er(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(jo(e,n,a),e=e.sibling;e!==null;)jo(e,n,a),e=e.sibling}function Fx(e){var n=e.stateNode,a=e.memoizedProps;try{for(var s=e.type,h=n.attributes;h.length;)n.removeAttributeNode(h[0]);fn(n,s,a),n[Qt]=e,n[sn]=a}catch(x){kt(e,e.return,x)}}var Gl=!1,Pt=!1,sf=!1,_x=typeof WeakSet=="function"?WeakSet:Set,an=null;function $2(e,n){if(e=e.containerInfo,Af=Xo,e=Gh(e),Pc(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var s=a.getSelection&&a.getSelection();if(s&&s.rangeCount!==0){a=s.anchorNode;var h=s.anchorOffset,x=s.focusNode;s=s.focusOffset;try{a.nodeType,x.nodeType}catch{a=null;break e}var w=0,N=-1,H=-1,Z=0,ie=0,he=e,P=null;t:for(;;){for(var le;he!==a||h!==0&&he.nodeType!==3||(N=w+h),he!==x||s!==0&&he.nodeType!==3||(H=w+s),he.nodeType===3&&(w+=he.nodeValue.length),(le=he.firstChild)!==null;)P=he,he=le;for(;;){if(he===e)break t;if(P===a&&++Z===h&&(N=w),P===x&&++ie===s&&(H=w),(le=he.nextSibling)!==null)break;he=P,P=he.parentNode}he=le}a=N===-1||H===-1?null:{start:N,end:H}}else a=null}a=a||{start:0,end:0}}else a=null;for(Df={focusedElem:e,selectionRange:a},Xo=!1,an=n;an!==null;)if(n=an,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,an=e;else for(;an!==null;){switch(n=an,x=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&&x!==null){e=void 0,a=n,h=x.memoizedProps,x=x.memoizedState,s=a.stateNode;try{var De=oa(a.type,h);e=s.getSnapshotBeforeUpdate(De,x),s.__reactInternalSnapshotBeforeUpdate=e}catch(Ie){kt(a,a.return,Ie)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,a=e.nodeType,a===9)Mf(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Mf(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,an=e;break}an=n.return}}function Ox(e,n,a){var s=a.flags;switch(a.tag){case 0:case 11:case 15:Ql(e,a),s&4&&qi(5,a);break;case 1:if(Ql(e,a),s&4)if(e=a.stateNode,n===null)try{e.componentDidMount()}catch(w){kt(a,a.return,w)}else{var h=oa(a.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(h,n,e.__reactInternalSnapshotBeforeUpdate)}catch(w){kt(a,a.return,w)}}s&64&&Tx(a),s&512&&Xi(a,a.return);break;case 3:if(Ql(e,a),s&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{vm(e,n)}catch(w){kt(a,a.return,w)}}break;case 27:n===null&&s&4&&Fx(a);case 26:case 5:Ql(e,a),n===null&&s&4&&Mx(a),s&512&&Xi(a,a.return);break;case 12:Ql(e,a);break;case 31:Ql(e,a),s&4&&$x(e,a);break;case 13:Ql(e,a),s&4&&Hx(e,a),s&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=K2.bind(null,a),mb(e,a))));break;case 22:if(s=a.memoizedState!==null||Gl,!s){n=n!==null&&n.memoizedState!==null||Pt,h=Gl;var x=Pt;Gl=s,(Pt=n)&&!x?Wl(e,a,(a.subtreeFlags&8772)!==0):Ql(e,a),Gl=h,Pt=x}break;case 30:break;default:Ql(e,a)}}function Bx(e){var n=e.alternate;n!==null&&(e.alternate=null,Bx(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&jn(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 Ot=null,An=!1;function Kl(e,n,a){for(a=a.child;a!==null;)Lx(e,n,a),a=a.sibling}function Lx(e,n,a){if(de&&typeof de.onCommitFiberUnmount=="function")try{de.onCommitFiberUnmount(rt,a)}catch{}switch(a.tag){case 26:Pt||wl(a,n),Kl(e,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Pt||wl(a,n);var s=Ot,h=An;Er(a.type)&&(Ot=a.stateNode,An=!1),Kl(e,n,a),es(a.stateNode),Ot=s,An=h;break;case 5:Pt||wl(a,n);case 6:if(s=Ot,h=An,Ot=null,Kl(e,n,a),Ot=s,An=h,Ot!==null)if(An)try{(Ot.nodeType===9?Ot.body:Ot.nodeName==="HTML"?Ot.ownerDocument.body:Ot).removeChild(a.stateNode)}catch(x){kt(a,n,x)}else try{Ot.removeChild(a.stateNode)}catch(x){kt(a,n,x)}break;case 18:Ot!==null&&(An?(e=Ot,Tp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),ei(e)):Tp(Ot,a.stateNode));break;case 4:s=Ot,h=An,Ot=a.stateNode.containerInfo,An=!0,Kl(e,n,a),Ot=s,An=h;break;case 0:case 11:case 14:case 15:br(2,a,n),Pt||br(4,a,n),Kl(e,n,a);break;case 1:Pt||(wl(a,n),s=a.stateNode,typeof s.componentWillUnmount=="function"&&zx(a,n,s)),Kl(e,n,a);break;case 21:Kl(e,n,a);break;case 22:Pt=(s=Pt)||a.memoizedState!==null,Kl(e,n,a),Pt=s;break;default:Kl(e,n,a)}}function $x(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{ei(e)}catch(a){kt(n,n.return,a)}}}function Hx(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{ei(e)}catch(a){kt(n,n.return,a)}}function H2(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new _x),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new _x),n;default:throw Error(i(435,e.tag))}}function Co(e,n){var a=H2(e);n.forEach(function(s){if(!a.has(s)){a.add(s);var h=Q2.bind(null,e,s);s.then(h,h)}})}function Dn(e,n){var a=n.deletions;if(a!==null)for(var s=0;s<a.length;s++){var h=a[s],x=e,w=n,N=w;e:for(;N!==null;){switch(N.tag){case 27:if(Er(N.type)){Ot=N.stateNode,An=!1;break e}break;case 5:Ot=N.stateNode,An=!1;break e;case 3:case 4:Ot=N.stateNode.containerInfo,An=!0;break e}N=N.return}if(Ot===null)throw Error(i(160));Lx(x,w,h),Ot=null,An=!1,x=h.alternate,x!==null&&(x.return=null),h.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Ux(n,e),n=n.sibling}var dl=null;function Ux(e,n){var a=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Dn(n,e),Tn(e),s&4&&(br(3,e,e.return),qi(3,e),br(5,e,e.return));break;case 1:Dn(n,e),Tn(e),s&512&&(Pt||a===null||wl(a,a.return)),s&64&&Gl&&(e=e.updateQueue,e!==null&&(s=e.callbacks,s!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?s:a.concat(s))));break;case 26:var h=dl;if(Dn(n,e),Tn(e),s&512&&(Pt||a===null||wl(a,a.return)),s&4){var x=a!==null?a.memoizedState:null;if(s=e.memoizedState,a===null)if(s===null)if(e.stateNode===null){e:{s=e.type,a=e.memoizedProps,h=h.ownerDocument||h;t:switch(s){case"title":x=h.getElementsByTagName("title")[0],(!x||x[_l]||x[Qt]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=h.createElement(s),h.head.insertBefore(x,h.querySelector("head > title"))),fn(x,s,a),x[Qt]=e,ft(x),s=x;break e;case"link":var w=Up("link","href",h).get(s+(a.href||""));if(w){for(var N=0;N<w.length;N++)if(x=w[N],x.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&x.getAttribute("rel")===(a.rel==null?null:a.rel)&&x.getAttribute("title")===(a.title==null?null:a.title)&&x.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){w.splice(N,1);break t}}x=h.createElement(s),fn(x,s,a),h.head.appendChild(x);break;case"meta":if(w=Up("meta","content",h).get(s+(a.content||""))){for(N=0;N<w.length;N++)if(x=w[N],x.getAttribute("content")===(a.content==null?null:""+a.content)&&x.getAttribute("name")===(a.name==null?null:a.name)&&x.getAttribute("property")===(a.property==null?null:a.property)&&x.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&x.getAttribute("charset")===(a.charSet==null?null:a.charSet)){w.splice(N,1);break t}}x=h.createElement(s),fn(x,s,a),h.head.appendChild(x);break;default:throw Error(i(468,s))}x[Qt]=e,ft(x),s=x}e.stateNode=s}else Ip(h,e.type,e.stateNode);else e.stateNode=Hp(h,s,e.memoizedProps);else x!==s?(x===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):x.count--,s===null?Ip(h,e.type,e.stateNode):Hp(h,s,e.memoizedProps)):s===null&&e.stateNode!==null&&lf(e,e.memoizedProps,a.memoizedProps)}break;case 27:Dn(n,e),Tn(e),s&512&&(Pt||a===null||wl(a,a.return)),a!==null&&s&4&&lf(e,e.memoizedProps,a.memoizedProps);break;case 5:if(Dn(n,e),Tn(e),s&512&&(Pt||a===null||wl(a,a.return)),e.flags&32){h=e.stateNode;try{Ol(h,"")}catch(De){kt(e,e.return,De)}}s&4&&e.stateNode!=null&&(h=e.memoizedProps,lf(e,h,a!==null?a.memoizedProps:h)),s&1024&&(sf=!0);break;case 6:if(Dn(n,e),Tn(e),s&4){if(e.stateNode===null)throw Error(i(162));s=e.memoizedProps,a=e.stateNode;try{a.nodeValue=s}catch(De){kt(e,e.return,De)}}break;case 3:if(Uo=null,h=dl,dl=$o(n.containerInfo),Dn(n,e),dl=h,Tn(e),s&4&&a!==null&&a.memoizedState.isDehydrated)try{ei(n.containerInfo)}catch(De){kt(e,e.return,De)}sf&&(sf=!1,Ix(e));break;case 4:s=dl,dl=$o(e.stateNode.containerInfo),Dn(n,e),Tn(e),dl=s;break;case 12:Dn(n,e),Tn(e);break;case 31:Dn(n,e),Tn(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Co(e,s)));break;case 13:Dn(n,e),Tn(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(No=vt()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Co(e,s)));break;case 22:h=e.memoizedState!==null;var H=a!==null&&a.memoizedState!==null,Z=Gl,ie=Pt;if(Gl=Z||h,Pt=ie||H,Dn(n,e),Pt=ie,Gl=Z,Tn(e),s&8192)e:for(n=e.stateNode,n._visibility=h?n._visibility&-2:n._visibility|1,h&&(a===null||H||Gl||Pt||ca(e)),a=null,n=e;;){if(n.tag===5||n.tag===26){if(a===null){H=a=n;try{if(x=H.stateNode,h)w=x.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{N=H.stateNode;var he=H.memoizedProps.style,P=he!=null&&he.hasOwnProperty("display")?he.display:null;N.style.display=P==null||typeof P=="boolean"?"":(""+P).trim()}}catch(De){kt(H,H.return,De)}}}else if(n.tag===6){if(a===null){H=n;try{H.stateNode.nodeValue=h?"":H.memoizedProps}catch(De){kt(H,H.return,De)}}}else if(n.tag===18){if(a===null){H=n;try{var le=H.stateNode;h?zp(le,!0):zp(H.stateNode,!1)}catch(De){kt(H,H.return,De)}}}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}s&4&&(s=e.updateQueue,s!==null&&(a=s.retryQueue,a!==null&&(s.retryQueue=null,Co(e,a))));break;case 19:Dn(n,e),Tn(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Co(e,s)));break;case 30:break;case 21:break;default:Dn(n,e),Tn(e)}}function Tn(e){var n=e.flags;if(n&2){try{for(var a,s=e.return;s!==null;){if(Rx(s)){a=s;break}s=s.return}if(a==null)throw Error(i(160));switch(a.tag){case 27:var h=a.stateNode,x=rf(e);jo(e,x,h);break;case 5:var w=a.stateNode;a.flags&32&&(Ol(w,""),a.flags&=-33);var N=rf(e);jo(e,N,w);break;case 3:case 4:var H=a.stateNode.containerInfo,Z=rf(e);af(e,Z,H);break;default:throw Error(i(161))}}catch(ie){kt(e,e.return,ie)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function Ix(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;Ix(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;)Ox(e,n.alternate,n),n=n.sibling}function ca(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:br(4,n,n.return),ca(n);break;case 1:wl(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&zx(n,n.return,a),ca(n);break;case 27:es(n.stateNode);case 26:case 5:wl(n,n.return),ca(n);break;case 22:n.memoizedState===null&&ca(n);break;case 30:ca(n);break;default:ca(n)}e=e.sibling}}function Wl(e,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var s=n.alternate,h=e,x=n,w=x.flags;switch(x.tag){case 0:case 11:case 15:Wl(h,x,a),qi(4,x);break;case 1:if(Wl(h,x,a),s=x,h=s.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(Z){kt(s,s.return,Z)}if(s=x,h=s.updateQueue,h!==null){var N=s.stateNode;try{var H=h.shared.hiddenCallbacks;if(H!==null)for(h.shared.hiddenCallbacks=null,h=0;h<H.length;h++)bm(H[h],N)}catch(Z){kt(s,s.return,Z)}}a&&w&64&&Tx(x),Xi(x,x.return);break;case 27:Fx(x);case 26:case 5:Wl(h,x,a),a&&s===null&&w&4&&Mx(x),Xi(x,x.return);break;case 12:Wl(h,x,a);break;case 31:Wl(h,x,a),a&&w&4&&$x(h,x);break;case 13:Wl(h,x,a),a&&w&4&&Hx(h,x);break;case 22:x.memoizedState===null&&Wl(h,x,a),Xi(x,x.return);break;case 30:break;default:Wl(h,x,a)}n=n.sibling}}function of(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&&zi(a))}function cf(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&zi(e))}function hl(e,n,a,s){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Yx(e,n,a,s),n=n.sibling}function Yx(e,n,a,s){var h=n.flags;switch(n.tag){case 0:case 11:case 15:hl(e,n,a,s),h&2048&&qi(9,n);break;case 1:hl(e,n,a,s);break;case 3:hl(e,n,a,s),h&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&zi(e)));break;case 12:if(h&2048){hl(e,n,a,s),e=n.stateNode;try{var x=n.memoizedProps,w=x.id,N=x.onPostCommit;typeof N=="function"&&N(w,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(H){kt(n,n.return,H)}}else hl(e,n,a,s);break;case 31:hl(e,n,a,s);break;case 13:hl(e,n,a,s);break;case 23:break;case 22:x=n.stateNode,w=n.alternate,n.memoizedState!==null?x._visibility&2?hl(e,n,a,s):Vi(e,n):x._visibility&2?hl(e,n,a,s):(x._visibility|=2,Ya(e,n,a,s,(n.subtreeFlags&10256)!==0||!1)),h&2048&&of(w,n);break;case 24:hl(e,n,a,s),h&2048&&cf(n.alternate,n);break;default:hl(e,n,a,s)}}function Ya(e,n,a,s,h){for(h=h&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var x=e,w=n,N=a,H=s,Z=w.flags;switch(w.tag){case 0:case 11:case 15:Ya(x,w,N,H,h),qi(8,w);break;case 23:break;case 22:var ie=w.stateNode;w.memoizedState!==null?ie._visibility&2?Ya(x,w,N,H,h):Vi(x,w):(ie._visibility|=2,Ya(x,w,N,H,h)),h&&Z&2048&&of(w.alternate,w);break;case 24:Ya(x,w,N,H,h),h&&Z&2048&&cf(w.alternate,w);break;default:Ya(x,w,N,H,h)}n=n.sibling}}function Vi(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=e,s=n,h=s.flags;switch(s.tag){case 22:Vi(a,s),h&2048&&of(s.alternate,s);break;case 24:Vi(a,s),h&2048&&cf(s.alternate,s);break;default:Vi(a,s)}n=n.sibling}}var Gi=8192;function qa(e,n,a){if(e.subtreeFlags&Gi)for(e=e.child;e!==null;)qx(e,n,a),e=e.sibling}function qx(e,n,a){switch(e.tag){case 26:qa(e,n,a),e.flags&Gi&&e.memoizedState!==null&&Eb(a,dl,e.memoizedState,e.memoizedProps);break;case 5:qa(e,n,a);break;case 3:case 4:var s=dl;dl=$o(e.stateNode.containerInfo),qa(e,n,a),dl=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=Gi,Gi=16777216,qa(e,n,a),Gi=s):qa(e,n,a));break;default:qa(e,n,a)}}function Xx(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 Ki(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var s=n[a];an=s,Gx(s,e)}Xx(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Vx(e),e=e.sibling}function Vx(e){switch(e.tag){case 0:case 11:case 15:Ki(e),e.flags&2048&&br(9,e,e.return);break;case 3:Ki(e);break;case 12:Ki(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,Eo(e)):Ki(e);break;default:Ki(e)}}function Eo(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var s=n[a];an=s,Gx(s,e)}Xx(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:br(8,n,n.return),Eo(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,Eo(n));break;default:Eo(n)}e=e.sibling}}function Gx(e,n){for(;an!==null;){var a=an;switch(a.tag){case 0:case 11:case 15:br(8,a,n);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var s=a.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:zi(a.memoizedState.cache)}if(s=a.child,s!==null)s.return=a,an=s;else e:for(a=e;an!==null;){s=an;var h=s.sibling,x=s.return;if(Bx(s),s===a){an=null;break e}if(h!==null){h.return=x,an=h;break e}an=x}}}var U2={getCacheForType:function(e){var n=cn(Wt),a=n.data.get(e);return a===void 0&&(a=e(),n.data.set(e,a)),a},cacheSignal:function(){return cn(Wt).controller.signal}},I2=typeof WeakMap=="function"?WeakMap:Map,yt=0,At=null,tt=null,it=0,wt=0,Yn=null,vr=!1,Xa=!1,uf=!1,Zl=0,Ut=0,wr=0,ua=0,ff=0,qn=0,Va=0,Qi=null,zn=null,df=!1,No=0,Kx=0,Ao=1/0,Do=null,kr=null,tn=0,Sr=null,Ga=null,Jl=0,hf=0,mf=null,Qx=null,Wi=0,xf=null;function Xn(){return(yt&2)!==0&&it!==0?it&-it:Y.T!==null?wf():xi()}function Wx(){if(qn===0)if((it&536870912)===0||ct){var e=wa;wa<<=1,(wa&3932160)===0&&(wa=262144),qn=e}else qn=536870912;return e=Un.current,e!==null&&(e.flags|=32),qn}function Mn(e,n,a){(e===At&&(wt===2||wt===9)||e.cancelPendingCommit!==null)&&(Ka(e,0),jr(e,it,qn,!1)),Qn(e,a),((yt&2)===0||e!==At)&&(e===At&&((yt&2)===0&&(ua|=a),Ut===4&&jr(e,it,qn,!1)),kl(e))}function Zx(e,n,a){if((yt&6)!==0)throw Error(i(327));var s=!a&&(n&127)===0&&(n&e.expiredLanes)===0||Yr(e,n),h=s?X2(e,n):yf(e,n,!0),x=s;do{if(h===0){Xa&&!s&&jr(e,n,0,!1);break}else{if(a=e.current.alternate,x&&!Y2(a)){h=yf(e,n,!1),x=!1;continue}if(h===2){if(x=n,e.errorRecoveryDisabledLanes&x)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=Qi;var H=N.current.memoizedState.isDehydrated;if(H&&(Ka(N,w).flags|=256),w=yf(N,w,!1),w!==2){if(uf&&!H){N.errorRecoveryDisabledLanes|=x,ua|=x,h=4;break e}x=zn,zn=h,x!==null&&(zn===null?zn=x:zn.push.apply(zn,x))}h=w}if(x=!1,h!==2)continue}}if(h===1){Ka(e,0),jr(e,n,0,!0);break}e:{switch(s=e,x=h,x){case 0:case 1:throw Error(i(345));case 4:if((n&4194048)!==n)break;case 6:jr(s,n,qn,!vr);break e;case 2:zn=null;break;case 3:case 5:break;default:throw Error(i(329))}if((n&62914560)===n&&(h=No+300-vt(),10<h)){if(jr(s,n,qn,!vr),ir(s,0,!0)!==0)break e;Jl=n,s.timeoutHandle=Ap(Jx.bind(null,s,a,zn,Do,df,n,qn,ua,Va,vr,x,"Throttled",-0,0),h);break e}Jx(s,a,zn,Do,df,n,qn,ua,Va,vr,x,null,-0,0)}}break}while(!0);kl(e)}function Jx(e,n,a,s,h,x,w,N,H,Z,ie,he,P,le){if(e.timeoutHandle=-1,he=n.subtreeFlags,he&8192||(he&16785408)===16785408){he={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:gn},qx(n,x,he);var De=(x&62914560)===x?No-vt():(x&4194048)===x?Kx-vt():0;if(De=Nb(he,De),De!==null){Jl=x,e.cancelPendingCommit=De(ip.bind(null,e,n,x,a,s,h,w,N,H,ie,he,null,P,le)),jr(e,x,w,!Z);return}}ip(e,n,x,a,s,h,w,N,H)}function Y2(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 s=0;s<a.length;s++){var h=a[s],x=h.getSnapshot;h=h.value;try{if(!$n(x(),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 jr(e,n,a,s){n&=~ff,n&=~ua,e.suspendedLanes|=n,e.pingedLanes&=~n,s&&(e.warmLanes|=n),s=e.expirationTimes;for(var h=n;0<h;){var x=31-dt(h),w=1<<x;s[x]=-1,h&=~w}a!==0&&Ml(e,a,n)}function To(){return(yt&6)===0?(Zi(0),!1):!0}function pf(){if(tt!==null){if(wt===0)var e=tt.return;else e=tt,Ul=ta=null,zu(e),La=null,Ri=0,e=tt;for(;e!==null;)Dx(e.alternate,e),e=e.return;tt=null}}function Ka(e,n){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,cb(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),Jl=0,pf(),At=e,tt=a=$l(e.current,null),it=n,wt=0,Yn=null,vr=!1,Xa=Yr(e,n),uf=!1,Va=qn=ff=ua=wr=Ut=0,zn=Qi=null,df=!1,(n&8)!==0&&(n|=n&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=n;0<s;){var h=31-dt(s),x=1<<h;n|=e[h],s&=~x}return Zl=n,Ws(),a}function Px(e,n){Ke=null,Y.H=Ui,n===Ba||n===ro?(n=xm(),wt=3):n===bu?(n=xm(),wt=4):wt=n===Gu?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,Yn=n,tt===null&&(Ut=1,bo(e,el(n,e.current)))}function ep(){var e=Un.current;return e===null?!0:(it&4194048)===it?rl===null:(it&62914560)===it||(it&536870912)!==0?e===rl:!1}function tp(){var e=Y.H;return Y.H=Ui,e===null?Ui:e}function np(){var e=Y.A;return Y.A=U2,e}function zo(){Ut=4,vr||(it&4194048)!==it&&Un.current!==null||(Xa=!0),(wr&134217727)===0&&(ua&134217727)===0||At===null||jr(At,it,qn,!1)}function yf(e,n,a){var s=yt;yt|=2;var h=tp(),x=np();(At!==e||it!==n)&&(Do=null,Ka(e,n)),n=!1;var w=Ut;e:do try{if(wt!==0&&tt!==null){var N=tt,H=Yn;switch(wt){case 8:pf(),w=6;break e;case 3:case 2:case 9:case 6:Un.current===null&&(n=!0);var Z=wt;if(wt=0,Yn=null,Qa(e,N,H,Z),a&&Xa){w=0;break e}break;default:Z=wt,wt=0,Yn=null,Qa(e,N,H,Z)}}q2(),w=Ut;break}catch(ie){Px(e,ie)}while(!0);return n&&e.shellSuspendCounter++,Ul=ta=null,yt=s,Y.H=h,Y.A=x,tt===null&&(At=null,it=0,Ws()),w}function q2(){for(;tt!==null;)lp(tt)}function X2(e,n){var a=yt;yt|=2;var s=tp(),h=np();At!==e||it!==n?(Do=null,Ao=vt()+500,Ka(e,n)):Xa=Yr(e,n);e:do try{if(wt!==0&&tt!==null){n=tt;var x=Yn;t:switch(wt){case 1:wt=0,Yn=null,Qa(e,n,x,1);break;case 2:case 9:if(hm(x)){wt=0,Yn=null,rp(n);break}n=function(){wt!==2&&wt!==9||At!==e||(wt=7),kl(e)},x.then(n,n);break e;case 3:wt=7;break e;case 4:wt=5;break e;case 7:hm(x)?(wt=0,Yn=null,rp(n)):(wt=0,Yn=null,Qa(e,n,x,7));break;case 5:var w=null;switch(tt.tag){case 26:w=tt.memoizedState;case 5:case 27:var N=tt;if(w?Yp(w):N.stateNode.complete){wt=0,Yn=null;var H=N.sibling;if(H!==null)tt=H;else{var Z=N.return;Z!==null?(tt=Z,Mo(Z)):tt=null}break t}}wt=0,Yn=null,Qa(e,n,x,5);break;case 6:wt=0,Yn=null,Qa(e,n,x,6);break;case 8:pf(),Ut=6;break e;default:throw Error(i(462))}}V2();break}catch(ie){Px(e,ie)}while(!0);return Ul=ta=null,Y.H=s,Y.A=h,yt=a,tt!==null?0:(At=null,it=0,Ws(),Ut)}function V2(){for(;tt!==null&&!Bt();)lp(tt)}function lp(e){var n=Nx(e.alternate,e,Zl);e.memoizedProps=e.pendingProps,n===null?Mo(e):tt=n}function rp(e){var n=e,a=n.alternate;switch(n.tag){case 15:case 0:n=wx(a,n,n.pendingProps,n.type,void 0,it);break;case 11:n=wx(a,n,n.pendingProps,n.type.render,n.ref,it);break;case 5:zu(n);default:Dx(a,n),n=tt=nm(n,Zl),n=Nx(a,n,Zl)}e.memoizedProps=e.pendingProps,n===null?Mo(e):tt=n}function Qa(e,n,a,s){Ul=ta=null,zu(n),La=null,Ri=0;var h=n.return;try{if(F2(e,h,n,a,it)){Ut=1,bo(e,el(a,e.current)),tt=null;return}}catch(x){if(h!==null)throw tt=h,x;Ut=1,bo(e,el(a,e.current)),tt=null;return}n.flags&32768?(ct||s===1?e=!0:Xa||(it&536870912)!==0?e=!1:(vr=e=!0,(s===2||s===9||s===3||s===6)&&(s=Un.current,s!==null&&s.tag===13&&(s.flags|=16384))),ap(n,e)):Mo(n)}function Mo(e){var n=e;do{if((n.flags&32768)!==0){ap(n,vr);return}e=n.return;var a=B2(n.alternate,n,Zl);if(a!==null){tt=a;return}if(n=n.sibling,n!==null){tt=n;return}tt=n=e}while(n!==null);Ut===0&&(Ut=5)}function ap(e,n){do{var a=L2(e.alternate,e);if(a!==null){a.flags&=32767,tt=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(e=e.sibling,e!==null)){tt=e;return}tt=e=a}while(e!==null);Ut=6,tt=null}function ip(e,n,a,s,h,x,w,N,H){e.cancelPendingCommit=null;do Ro();while(tn!==0);if((yt&6)!==0)throw Error(i(327));if(n!==null){if(n===e.current)throw Error(i(177));if(x=n.lanes|n.childLanes,x|=ru,mi(e,a,x,w,N,H),e===At&&(tt=At=null,it=0),Ga=n,Sr=e,Jl=a,hf=x,mf=h,Qx=s,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,W2(Re,function(){return fp(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||s){s=Y.T,Y.T=null,h=Q.p,Q.p=2,w=yt,yt|=4;try{$2(e,n,a)}finally{yt=w,Q.p=h,Y.T=s}}tn=1,sp(),op(),cp()}}function sp(){if(tn===1){tn=0;var e=Sr,n=Ga,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=Y.T,Y.T=null;var s=Q.p;Q.p=2;var h=yt;yt|=4;try{Ux(n,e);var x=Df,w=Gh(e.containerInfo),N=x.focusedElem,H=x.selectionRange;if(w!==N&&N&&N.ownerDocument&&Vh(N.ownerDocument.documentElement,N)){if(H!==null&&Pc(N)){var Z=H.start,ie=H.end;if(ie===void 0&&(ie=Z),"selectionStart"in N)N.selectionStart=Z,N.selectionEnd=Math.min(ie,N.value.length);else{var he=N.ownerDocument||document,P=he&&he.defaultView||window;if(P.getSelection){var le=P.getSelection(),De=N.textContent.length,Ie=Math.min(H.start,De),Et=H.end===void 0?Ie:Math.min(H.end,De);!le.extend&&Ie>Et&&(w=Et,Et=Ie,Ie=w);var G=Xh(N,Ie),q=Xh(N,Et);if(G&&q&&(le.rangeCount!==1||le.anchorNode!==G.node||le.anchorOffset!==G.offset||le.focusNode!==q.node||le.focusOffset!==q.offset)){var W=he.createRange();W.setStart(G.node,G.offset),le.removeAllRanges(),Ie>Et?(le.addRange(W),le.extend(q.node,q.offset)):(W.setEnd(q.node,q.offset),le.addRange(W))}}}}for(he=[],le=N;le=le.parentNode;)le.nodeType===1&&he.push({element:le,left:le.scrollLeft,top:le.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<he.length;N++){var ce=he[N];ce.element.scrollLeft=ce.left,ce.element.scrollTop=ce.top}}Xo=!!Af,Df=Af=null}finally{yt=h,Q.p=s,Y.T=a}}e.current=n,tn=2}}function op(){if(tn===2){tn=0;var e=Sr,n=Ga,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=Y.T,Y.T=null;var s=Q.p;Q.p=2;var h=yt;yt|=4;try{Ox(e,n.alternate,n)}finally{yt=h,Q.p=s,Y.T=a}}tn=3}}function cp(){if(tn===4||tn===3){tn=0,Kt();var e=Sr,n=Ga,a=Jl,s=Qx;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?tn=5:(tn=0,Ga=Sr=null,up(e,e.pendingLanes));var h=e.pendingLanes;if(h===0&&(kr=null),yl(a),n=n.stateNode,de&&typeof de.onCommitFiberRoot=="function")try{de.onCommitFiberRoot(rt,n,void 0,(n.current.flags&128)===128)}catch{}if(s!==null){n=Y.T,h=Q.p,Q.p=2,Y.T=null;try{for(var x=e.onRecoverableError,w=0;w<s.length;w++){var N=s[w];x(N.value,{componentStack:N.stack})}}finally{Y.T=n,Q.p=h}}(Jl&3)!==0&&Ro(),kl(e),h=e.pendingLanes,(a&261930)!==0&&(h&42)!==0?e===xf?Wi++:(Wi=0,xf=e):Wi=0,Zi(0)}}function up(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,zi(n)))}function Ro(){return sp(),op(),cp(),fp()}function fp(){if(tn!==5)return!1;var e=Sr,n=hf;hf=0;var a=yl(Jl),s=Y.T,h=Q.p;try{Q.p=32>a?32:a,Y.T=null,a=mf,mf=null;var x=Sr,w=Jl;if(tn=0,Ga=Sr=null,Jl=0,(yt&6)!==0)throw Error(i(331));var N=yt;if(yt|=4,Vx(x.current),Yx(x,x.current,w,a),yt=N,Zi(0,!1),de&&typeof de.onPostCommitFiberRoot=="function")try{de.onPostCommitFiberRoot(rt,x)}catch{}return!0}finally{Q.p=h,Y.T=s,up(e,n)}}function dp(e,n,a){n=el(a,n),n=Vu(e.stateNode,n,2),e=pr(e,n,2),e!==null&&(Qn(e,2),kl(e))}function kt(e,n,a){if(e.tag===3)dp(e,e,a);else for(;n!==null;){if(n.tag===3){dp(n,e,a);break}else if(n.tag===1){var s=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(kr===null||!kr.has(s))){e=el(a,e),a=hx(2),s=pr(n,a,2),s!==null&&(mx(a,s,n,e),Qn(s,2),kl(s));break}}n=n.return}}function gf(e,n,a){var s=e.pingCache;if(s===null){s=e.pingCache=new I2;var h=new Set;s.set(n,h)}else h=s.get(n),h===void 0&&(h=new Set,s.set(n,h));h.has(a)||(uf=!0,h.add(a),e=G2.bind(null,e,n,a),n.then(e,e))}function G2(e,n,a){var s=e.pingCache;s!==null&&s.delete(n),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,At===e&&(it&a)===a&&(Ut===4||Ut===3&&(it&62914560)===it&&300>vt()-No?(yt&2)===0&&Ka(e,0):ff|=a,Va===it&&(Va=0)),kl(e)}function hp(e,n){n===0&&(n=yn()),e=Jr(e,n),e!==null&&(Qn(e,n),kl(e))}function K2(e){var n=e.memoizedState,a=0;n!==null&&(a=n.retryLane),hp(e,a)}function Q2(e,n){var a=0;switch(e.tag){case 31:case 13:var s=e.stateNode,h=e.memoizedState;h!==null&&(a=h.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(i(314))}s!==null&&s.delete(n),hp(e,a)}function W2(e,n){return pt(e,n)}var Fo=null,Wa=null,bf=!1,_o=!1,vf=!1,Cr=0;function kl(e){e!==Wa&&e.next===null&&(Wa===null?Fo=Wa=e:Wa=Wa.next=e),_o=!0,bf||(bf=!0,J2())}function Zi(e,n){if(!vf&&_o){vf=!0;do for(var a=!1,s=Fo;s!==null;){if(e!==0){var h=s.pendingLanes;if(h===0)var x=0;else{var w=s.suspendedLanes,N=s.pingedLanes;x=(1<<31-dt(42|e)+1)-1,x&=h&~(w&~N),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(a=!0,yp(s,x))}else x=it,x=ir(s,s===At?x:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(x&3)===0||Yr(s,x)||(a=!0,yp(s,x));s=s.next}while(a);vf=!1}}function Z2(){mp()}function mp(){_o=bf=!1;var e=0;Cr!==0&&ob()&&(e=Cr);for(var n=vt(),a=null,s=Fo;s!==null;){var h=s.next,x=xp(s,n);x===0?(s.next=null,a===null?Fo=h:a.next=h,h===null&&(Wa=a)):(a=s,(e!==0||(x&3)!==0)&&(_o=!0)),s=h}tn!==0&&tn!==5||Zi(e),Cr!==0&&(Cr=0)}function xp(e,n){for(var a=e.suspendedLanes,s=e.pingedLanes,h=e.expirationTimes,x=e.pendingLanes&-62914561;0<x;){var w=31-dt(x),N=1<<w,H=h[w];H===-1?((N&a)===0||(N&s)!==0)&&(h[w]=di(N,n)):H<=n&&(e.expiredLanes|=N),x&=~N}if(n=At,a=it,a=ir(e,e===n?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,a===0||e===n&&(wt===2||wt===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&St(s),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||Yr(e,a)){if(n=a&-a,n===e.callbackPriority)return n;switch(s!==null&&St(s),yl(a)){case 2:case 8:a=ye;break;case 32:a=Re;break;case 268435456:a=we;break;default:a=Re}return s=pp.bind(null,e),a=pt(a,s),e.callbackPriority=n,e.callbackNode=a,n}return s!==null&&s!==null&&St(s),e.callbackPriority=2,e.callbackNode=null,2}function pp(e,n){if(tn!==0&&tn!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Ro()&&e.callbackNode!==a)return null;var s=it;return s=ir(e,e===At?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(Zx(e,s,n),xp(e,vt()),e.callbackNode!=null&&e.callbackNode===a?pp.bind(null,e):null)}function yp(e,n){if(Ro())return null;Zx(e,n,!0)}function J2(){ub(function(){(yt&6)!==0?pt(ae,Z2):mp()})}function wf(){if(Cr===0){var e=_a;e===0&&(e=rr,rr<<=1,(rr&261888)===0&&(rr=256)),Cr=e}return Cr}function gp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Xt(""+e)}function bp(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 P2(e,n,a,s,h){if(n==="submit"&&a&&a.stateNode===h){var x=gp((h[sn]||null).action),w=s.submitter;w&&(n=(n=w[sn]||null)?gp(n.formAction):w.getAttribute("formAction"),n!==null&&(x=n,w=null));var N=new Vs("action","action",null,s,h);e.push({event:N,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(Cr!==0){var H=w?bp(h,w):new FormData(h);Hu(a,{pending:!0,data:H,method:h.method,action:x},null,H)}}else typeof x=="function"&&(N.preventDefault(),H=w?bp(h,w):new FormData(h),Hu(a,{pending:!0,data:H,method:h.method,action:x},x,H))},currentTarget:h}]})}}for(var kf=0;kf<lu.length;kf++){var Sf=lu[kf],eb=Sf.toLowerCase(),tb=Sf[0].toUpperCase()+Sf.slice(1);fl(eb,"on"+tb)}fl(Wh,"onAnimationEnd"),fl(Zh,"onAnimationIteration"),fl(Jh,"onAnimationStart"),fl("dblclick","onDoubleClick"),fl("focusin","onFocus"),fl("focusout","onBlur"),fl(y2,"onTransitionRun"),fl(g2,"onTransitionStart"),fl(b2,"onTransitionCancel"),fl(Ph,"onTransitionEnd"),gl("onMouseEnter",["mouseout","mouseover"]),gl("onMouseLeave",["mouseout","mouseover"]),gl("onPointerEnter",["pointerout","pointerover"]),gl("onPointerLeave",["pointerout","pointerover"]),Ln("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ln("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ln("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ln("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ln("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ln("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ji="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(" "),nb=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ji));function vp(e,n){n=(n&4)!==0;for(var a=0;a<e.length;a++){var s=e[a],h=s.event;s=s.listeners;e:{var x=void 0;if(n)for(var w=s.length-1;0<=w;w--){var N=s[w],H=N.instance,Z=N.currentTarget;if(N=N.listener,H!==x&&h.isPropagationStopped())break e;x=N,h.currentTarget=Z;try{x(h)}catch(ie){Qs(ie)}h.currentTarget=null,x=H}else for(w=0;w<s.length;w++){if(N=s[w],H=N.instance,Z=N.currentTarget,N=N.listener,H!==x&&h.isPropagationStopped())break e;x=N,h.currentTarget=Z;try{x(h)}catch(ie){Qs(ie)}h.currentTarget=null,x=H}}}}function nt(e,n){var a=n[qr];a===void 0&&(a=n[qr]=new Set);var s=e+"__bubble";a.has(s)||(wp(n,e,2,!1),a.add(s))}function jf(e,n,a){var s=0;n&&(s|=4),wp(a,e,s,n)}var Oo="_reactListening"+Math.random().toString(36).slice(2);function Cf(e){if(!e[Oo]){e[Oo]=!0,Vr.forEach(function(a){a!=="selectionchange"&&(nb.has(a)||jf(a,!1,e),jf(a,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[Oo]||(n[Oo]=!0,jf("selectionchange",!1,n))}}function wp(e,n,a,s){switch(Wp(n)){case 2:var h=Tb;break;case 8:h=zb;break;default:h=Hf}a=h.bind(null,n,a,e),h=void 0,!ze||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(h=!0),s?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 Ef(e,n,a,s,h){var x=s;if((n&1)===0&&(n&2)===0&&s!==null)e:for(;;){if(s===null)return;var w=s.tag;if(w===3||w===4){var N=s.stateNode.containerInfo;if(N===h)break;if(w===4)for(w=s.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=On(N),w===null)return;if(H=w.tag,H===5||H===6||H===26||H===27){s=x=w;continue e}N=N.parentNode}}s=s.return}me(function(){var Z=x,ie=Ca(a),he=[];e:{var P=em.get(e);if(P!==void 0){var le=Vs,De=e;switch(e){case"keypress":if(qs(a)===0)break e;case"keydown":case"keyup":le=Qg;break;case"focusin":De="focus",le=Kc;break;case"focusout":De="blur",le=Kc;break;case"beforeblur":case"afterblur":le=Kc;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":le=Dh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":le=Bg;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":le=Jg;break;case Wh:case Zh:case Jh:le=Hg;break;case Ph:le=e2;break;case"scroll":case"scrollend":le=_g;break;case"wheel":le=n2;break;case"copy":case"cut":case"paste":le=Ig;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":le=zh;break;case"toggle":case"beforetoggle":le=r2}var Ie=(n&4)!==0,Et=!Ie&&(e==="scroll"||e==="scrollend"),G=Ie?P!==null?P+"Capture":null:P;Ie=[];for(var q=Z,W;q!==null;){var ce=q;if(W=ce.stateNode,ce=ce.tag,ce!==5&&ce!==26&&ce!==27||W===null||G===null||(ce=xe(q,G),ce!=null&&Ie.push(Pi(q,ce,W))),Et)break;q=q.return}0<Ie.length&&(P=new le(P,De,null,a,ie),he.push({event:P,listeners:Ie}))}}if((n&7)===0){e:{if(P=e==="mouseover"||e==="pointerover",le=e==="mouseout"||e==="pointerout",P&&a!==ja&&(De=a.relatedTarget||a.fromElement)&&(On(De)||De[Sn]))break e;if((le||P)&&(P=ie.window===ie?ie:(P=ie.ownerDocument)?P.defaultView||P.parentWindow:window,le?(De=a.relatedTarget||a.toElement,le=Z,De=De?On(De):null,De!==null&&(Et=u(De),Ie=De.tag,De!==Et||Ie!==5&&Ie!==27&&Ie!==6)&&(De=null)):(le=null,De=Z),le!==De)){if(Ie=Dh,ce="onMouseLeave",G="onMouseEnter",q="mouse",(e==="pointerout"||e==="pointerover")&&(Ie=zh,ce="onPointerLeave",G="onPointerEnter",q="pointer"),Et=le==null?P:Xr(le),W=De==null?P:Xr(De),P=new Ie(ce,q+"leave",le,a,ie),P.target=Et,P.relatedTarget=W,ce=null,On(ie)===Z&&(Ie=new Ie(G,q+"enter",De,a,ie),Ie.target=W,Ie.relatedTarget=Et,ce=Ie),Et=ce,le&&De)t:{for(Ie=lb,G=le,q=De,W=0,ce=G;ce;ce=Ie(ce))W++;ce=0;for(var Be=q;Be;Be=Ie(Be))ce++;for(;0<W-ce;)G=Ie(G),W--;for(;0<ce-W;)q=Ie(q),ce--;for(;W--;){if(G===q||q!==null&&G===q.alternate){Ie=G;break t}G=Ie(G),q=Ie(q)}Ie=null}else Ie=null;le!==null&&kp(he,P,le,Ie,!1),De!==null&&Et!==null&&kp(he,Et,De,Ie,!0)}}e:{if(P=Z?Xr(Z):window,le=P.nodeName&&P.nodeName.toLowerCase(),le==="select"||le==="input"&&P.type==="file")var ht=$h;else if(Bh(P))if(Hh)ht=m2;else{ht=d2;var Me=f2}else le=P.nodeName,!le||le.toLowerCase()!=="input"||P.type!=="checkbox"&&P.type!=="radio"?Z&&Sa(Z.elementType)&&(ht=$h):ht=h2;if(ht&&(ht=ht(e,Z))){Lh(he,ht,a,ie);break e}Me&&Me(e,P,Z),e==="focusout"&&Z&&P.type==="number"&&Z.memoizedProps.value!=null&&wi(P,"number",P.value)}switch(Me=Z?Xr(Z):window,e){case"focusin":(Bh(Me)||Me.contentEditable==="true")&&(Na=Me,eu=Z,Ai=null);break;case"focusout":Ai=eu=Na=null;break;case"mousedown":tu=!0;break;case"contextmenu":case"mouseup":case"dragend":tu=!1,Kh(he,a,ie);break;case"selectionchange":if(p2)break;case"keydown":case"keyup":Kh(he,a,ie)}var Qe;if(Wc)e:{switch(e){case"compositionstart":var st="onCompositionStart";break e;case"compositionend":st="onCompositionEnd";break e;case"compositionupdate":st="onCompositionUpdate";break e}st=void 0}else Ea?_h(e,a)&&(st="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(st="onCompositionStart");st&&(Mh&&a.locale!=="ko"&&(Ea||st!=="onCompositionStart"?st==="onCompositionEnd"&&Ea&&(Qe=Lt()):(Xe=ie,at="value"in Xe?Xe.value:Xe.textContent,Ea=!0)),Me=Bo(Z,st),0<Me.length&&(st=new Th(st,e,null,a,ie),he.push({event:st,listeners:Me}),Qe?st.data=Qe:(Qe=Oh(a),Qe!==null&&(st.data=Qe)))),(Qe=i2?s2(e,a):o2(e,a))&&(st=Bo(Z,"onBeforeInput"),0<st.length&&(Me=new Th("onBeforeInput","beforeinput",null,a,ie),he.push({event:Me,listeners:st}),Me.data=Qe)),P2(he,e,Z,a,ie)}vp(he,n)})}function Pi(e,n,a){return{instance:e,listener:n,currentTarget:a}}function Bo(e,n){for(var a=n+"Capture",s=[];e!==null;){var h=e,x=h.stateNode;if(h=h.tag,h!==5&&h!==26&&h!==27||x===null||(h=xe(e,a),h!=null&&s.unshift(Pi(e,h,x)),h=xe(e,n),h!=null&&s.push(Pi(e,h,x))),e.tag===3)return s;e=e.return}return[]}function lb(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function kp(e,n,a,s,h){for(var x=n._reactName,w=[];a!==null&&a!==s;){var N=a,H=N.alternate,Z=N.stateNode;if(N=N.tag,H!==null&&H===s)break;N!==5&&N!==26&&N!==27||Z===null||(H=Z,h?(Z=xe(a,x),Z!=null&&w.unshift(Pi(a,Z,H))):h||(Z=xe(a,x),Z!=null&&w.push(Pi(a,Z,H)))),a=a.return}w.length!==0&&e.push({event:n,listeners:w})}var rb=/\r\n?/g,ab=/\u0000|\uFFFD/g;function Sp(e){return(typeof e=="string"?e:""+e).replace(rb,`
49
- `).replace(ab,"")}function jp(e,n){return n=Sp(n),Sp(e)===n}function Ct(e,n,a,s,h,x){switch(a){case"children":typeof s=="string"?n==="body"||n==="textarea"&&s===""||Ol(e,s):(typeof s=="number"||typeof s=="bigint")&&n!=="body"&&Ol(e,""+s);break;case"className":Gr(e,"class",s);break;case"tabIndex":Gr(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":Gr(e,a,s);break;case"style":ul(e,s,x);break;case"data":if(n!=="object"){Gr(e,"data",s);break}case"src":case"href":if(s===""&&(n!=="a"||a!=="href")){e.removeAttribute(a);break}if(s==null||typeof s=="function"||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(a);break}s=Xt(""+s),e.setAttribute(a,s);break;case"action":case"formAction":if(typeof s=="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 x=="function"&&(a==="formAction"?(n!=="input"&&Ct(e,n,"name",h.name,h,null),Ct(e,n,"formEncType",h.formEncType,h,null),Ct(e,n,"formMethod",h.formMethod,h,null),Ct(e,n,"formTarget",h.formTarget,h,null)):(Ct(e,n,"encType",h.encType,h,null),Ct(e,n,"method",h.method,h,null),Ct(e,n,"target",h.target,h,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(a);break}s=Xt(""+s),e.setAttribute(a,s);break;case"onClick":s!=null&&(e.onclick=gn);break;case"onScroll":s!=null&&nt("scroll",e);break;case"onScrollEnd":s!=null&&nt("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(i(61));if(a=s.__html,a!=null){if(h.children!=null)throw Error(i(60));e.innerHTML=a}}break;case"multiple":e.multiple=s&&typeof s!="function"&&typeof s!="symbol";break;case"muted":e.muted=s&&typeof s!="function"&&typeof s!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(s==null||typeof s=="function"||typeof s=="boolean"||typeof s=="symbol"){e.removeAttribute("xlink:href");break}a=Xt(""+s),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":s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(a,""+s):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":s&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":s===!0?e.setAttribute(a,""):s!==!1&&s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(a,s):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":s!=null&&typeof s!="function"&&typeof s!="symbol"&&!isNaN(s)&&1<=s?e.setAttribute(a,s):e.removeAttribute(a);break;case"rowSpan":case"start":s==null||typeof s=="function"||typeof s=="symbol"||isNaN(s)?e.removeAttribute(a):e.setAttribute(a,s);break;case"popover":nt("beforetoggle",e),nt("toggle",e),_t(e,"popover",s);break;case"xlinkActuate":ol(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":ol(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":ol(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":ol(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":ol(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":ol(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":ol(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":ol(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":ol(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":_t(e,"is",s);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=qc.get(a)||a,_t(e,a,s))}}function Nf(e,n,a,s,h,x){switch(a){case"style":ul(e,s,x);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(i(61));if(a=s.__html,a!=null){if(h.children!=null)throw Error(i(60));e.innerHTML=a}}break;case"children":typeof s=="string"?Ol(e,s):(typeof s=="number"||typeof s=="bigint")&&Ol(e,""+s);break;case"onScroll":s!=null&&nt("scroll",e);break;case"onScrollEnd":s!=null&&nt("scrollend",e);break;case"onClick":s!=null&&(e.onclick=gn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Jn.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(h=a.endsWith("Capture"),n=a.slice(2,h?a.length-7:void 0),x=e[sn]||null,x=x!=null?x[a]:null,typeof x=="function"&&e.removeEventListener(n,x,h),typeof s=="function")){typeof x!="function"&&x!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(n,s,h);break e}a in e?e[a]=s:s===!0?e.setAttribute(a,""):_t(e,a,s)}}}function fn(e,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":nt("error",e),nt("load",e);var s=!1,h=!1,x;for(x in a)if(a.hasOwnProperty(x)){var w=a[x];if(w!=null)switch(x){case"src":s=!0;break;case"srcSet":h=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:Ct(e,n,x,w,a,null)}}h&&Ct(e,n,"srcSet",a.srcSet,a,null),s&&Ct(e,n,"src",a.src,a,null);return;case"input":nt("invalid",e);var N=x=w=h=null,H=null,Z=null;for(s in a)if(a.hasOwnProperty(s)){var ie=a[s];if(ie!=null)switch(s){case"name":h=ie;break;case"type":w=ie;break;case"checked":H=ie;break;case"defaultChecked":Z=ie;break;case"value":x=ie;break;case"defaultValue":N=ie;break;case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(i(137,n));break;default:Ct(e,n,s,ie,a,null)}}Us(e,x,N,H,Z,w,h,!1);return;case"select":nt("invalid",e),s=w=x=null;for(h in a)if(a.hasOwnProperty(h)&&(N=a[h],N!=null))switch(h){case"value":x=N;break;case"defaultValue":w=N;break;case"multiple":s=N;default:Ct(e,n,h,N,a,null)}n=x,a=w,e.multiple=!!s,n!=null?cr(e,!!s,n,!1):a!=null&&cr(e,!!s,a,!0);return;case"textarea":nt("invalid",e),x=h=s=null;for(w in a)if(a.hasOwnProperty(w)&&(N=a[w],N!=null))switch(w){case"value":s=N;break;case"defaultValue":h=N;break;case"children":x=N;break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(i(91));break;default:Ct(e,n,w,N,a,null)}cl(e,s,h,x);return;case"option":for(H in a)if(a.hasOwnProperty(H)&&(s=a[H],s!=null))switch(H){case"selected":e.selected=s&&typeof s!="function"&&typeof s!="symbol";break;default:Ct(e,n,H,s,a,null)}return;case"dialog":nt("beforetoggle",e),nt("toggle",e),nt("cancel",e),nt("close",e);break;case"iframe":case"object":nt("load",e);break;case"video":case"audio":for(s=0;s<Ji.length;s++)nt(Ji[s],e);break;case"image":nt("error",e),nt("load",e);break;case"details":nt("toggle",e);break;case"embed":case"source":case"link":nt("error",e),nt("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(Z in a)if(a.hasOwnProperty(Z)&&(s=a[Z],s!=null))switch(Z){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:Ct(e,n,Z,s,a,null)}return;default:if(Sa(n)){for(ie in a)a.hasOwnProperty(ie)&&(s=a[ie],s!==void 0&&Nf(e,n,ie,s,a,void 0));return}}for(N in a)a.hasOwnProperty(N)&&(s=a[N],s!=null&&Ct(e,n,N,s,a,null))}function ib(e,n,a,s){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var h=null,x=null,w=null,N=null,H=null,Z=null,ie=null;for(le in a){var he=a[le];if(a.hasOwnProperty(le)&&he!=null)switch(le){case"checked":break;case"value":break;case"defaultValue":H=he;default:s.hasOwnProperty(le)||Ct(e,n,le,null,s,he)}}for(var P in s){var le=s[P];if(he=a[P],s.hasOwnProperty(P)&&(le!=null||he!=null))switch(P){case"type":x=le;break;case"name":h=le;break;case"checked":Z=le;break;case"defaultChecked":ie=le;break;case"value":w=le;break;case"defaultValue":N=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(i(137,n));break;default:le!==he&&Ct(e,n,P,le,s,he)}}vi(e,w,N,H,Z,ie,x,h);return;case"select":le=w=N=P=null;for(x in a)if(H=a[x],a.hasOwnProperty(x)&&H!=null)switch(x){case"value":break;case"multiple":le=H;default:s.hasOwnProperty(x)||Ct(e,n,x,null,s,H)}for(h in s)if(x=s[h],H=a[h],s.hasOwnProperty(h)&&(x!=null||H!=null))switch(h){case"value":P=x;break;case"defaultValue":N=x;break;case"multiple":w=x;default:x!==H&&Ct(e,n,h,x,s,H)}n=N,a=w,s=le,P!=null?cr(e,!!a,P,!1):!!s!=!!a&&(n!=null?cr(e,!!a,n,!0):cr(e,!!a,a?[]:"",!1));return;case"textarea":le=P=null;for(N in a)if(h=a[N],a.hasOwnProperty(N)&&h!=null&&!s.hasOwnProperty(N))switch(N){case"value":break;case"children":break;default:Ct(e,n,N,null,s,h)}for(w in s)if(h=s[w],x=a[w],s.hasOwnProperty(w)&&(h!=null||x!=null))switch(w){case"value":P=h;break;case"defaultValue":le=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(i(91));break;default:h!==x&&Ct(e,n,w,h,s,x)}Is(e,P,le);return;case"option":for(var De in a)if(P=a[De],a.hasOwnProperty(De)&&P!=null&&!s.hasOwnProperty(De))switch(De){case"selected":e.selected=!1;break;default:Ct(e,n,De,null,s,P)}for(H in s)if(P=s[H],le=a[H],s.hasOwnProperty(H)&&P!==le&&(P!=null||le!=null))switch(H){case"selected":e.selected=P&&typeof P!="function"&&typeof P!="symbol";break;default:Ct(e,n,H,P,s,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 Ie in a)P=a[Ie],a.hasOwnProperty(Ie)&&P!=null&&!s.hasOwnProperty(Ie)&&Ct(e,n,Ie,null,s,P);for(Z in s)if(P=s[Z],le=a[Z],s.hasOwnProperty(Z)&&P!==le&&(P!=null||le!=null))switch(Z){case"children":case"dangerouslySetInnerHTML":if(P!=null)throw Error(i(137,n));break;default:Ct(e,n,Z,P,s,le)}return;default:if(Sa(n)){for(var Et in a)P=a[Et],a.hasOwnProperty(Et)&&P!==void 0&&!s.hasOwnProperty(Et)&&Nf(e,n,Et,void 0,s,P);for(ie in s)P=s[ie],le=a[ie],!s.hasOwnProperty(ie)||P===le||P===void 0&&le===void 0||Nf(e,n,ie,P,s,le);return}}for(var G in a)P=a[G],a.hasOwnProperty(G)&&P!=null&&!s.hasOwnProperty(G)&&Ct(e,n,G,null,s,P);for(he in s)P=s[he],le=a[he],!s.hasOwnProperty(he)||P===le||P==null&&le==null||Ct(e,n,he,P,s,le)}function Cp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function sb(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,a=performance.getEntriesByType("resource"),s=0;s<a.length;s++){var h=a[s],x=h.transferSize,w=h.initiatorType,N=h.duration;if(x&&N&&Cp(w)){for(w=0,N=h.responseEnd,s+=1;s<a.length;s++){var H=a[s],Z=H.startTime;if(Z>N)break;var ie=H.transferSize,he=H.initiatorType;ie&&Cp(he)&&(H=H.responseEnd,w+=ie*(H<N?1:(N-Z)/(H-Z)))}if(--s,n+=8*(x+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 Af=null,Df=null;function Lo(e){return e.nodeType===9?e:e.ownerDocument}function Ep(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 Np(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 Tf(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 zf=null;function ob(){var e=window.event;return e&&e.type==="popstate"?e===zf?!1:(zf=e,!0):(zf=null,!1)}var Ap=typeof setTimeout=="function"?setTimeout:void 0,cb=typeof clearTimeout=="function"?clearTimeout:void 0,Dp=typeof Promise=="function"?Promise:void 0,ub=typeof queueMicrotask=="function"?queueMicrotask:typeof Dp<"u"?function(e){return Dp.resolve(null).then(e).catch(fb)}:Ap;function fb(e){setTimeout(function(){throw e})}function Er(e){return e==="head"}function Tp(e,n){var a=n,s=0;do{var h=a.nextSibling;if(e.removeChild(a),h&&h.nodeType===8)if(a=h.data,a==="/$"||a==="/&"){if(s===0){e.removeChild(h),ei(n);return}s--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")s++;else if(a==="html")es(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,es(a);for(var x=a.firstChild;x;){var w=x.nextSibling,N=x.nodeName;x[_l]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&x.rel.toLowerCase()==="stylesheet"||a.removeChild(x),x=w}}else a==="body"&&es(e.ownerDocument.body);a=h}while(a);ei(n)}function zp(e,n){var a=e;e=0;do{var s=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||""),s&&s.nodeType===8)if(a=s.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=s}while(a)}function Mf(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":Mf(a),jn(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function db(e,n,a,s){for(;e.nodeType===1;){var h=a;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!s&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(s){if(!e[_l])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(x=e.getAttribute("rel"),x==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(x!==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(x=e.getAttribute("src"),(x!==(h.src==null?null:h.src)||e.getAttribute("type")!==(h.type==null?null:h.type)||e.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin))&&x&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var x=h.name==null?null:""+h.name;if(h.type==="hidden"&&e.getAttribute("name")===x)return e}else return e;if(e=al(e.nextSibling),e===null)break}return null}function hb(e,n,a){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=al(e.nextSibling),e===null))return null;return e}function Mp(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=al(e.nextSibling),e===null))return null;return e}function Rf(e){return e.data==="$?"||e.data==="$~"}function Ff(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function mb(e,n){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||a.readyState!=="loading")n();else{var s=function(){n(),a.removeEventListener("DOMContentLoaded",s)};a.addEventListener("DOMContentLoaded",s),e._reactRetry=s}}function al(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return e}var _f=null;function Rp(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(n===0)return al(e.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}e=e.nextSibling}return null}function Fp(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 _p(e,n,a){switch(n=Lo(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 es(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);jn(e)}var il=new Map,Op=new Set;function $o(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Pl=Q.d;Q.d={f:xb,r:pb,D:yb,C:gb,L:bb,m:vb,X:kb,S:wb,M:Sb};function xb(){var e=Pl.f(),n=To();return e||n}function pb(e){var n=Zn(e);n!==null&&n.tag===5&&n.type==="form"?Pm(n):Pl.r(e)}var Za=typeof document>"u"?null:document;function Bp(e,n,a){var s=Za;if(s&&typeof n=="string"&&n){var h=En(n);h='link[rel="'+e+'"][href="'+h+'"]',typeof a=="string"&&(h+='[crossorigin="'+a+'"]'),Op.has(h)||(Op.add(h),e={rel:e,crossOrigin:a,href:n},s.querySelector(h)===null&&(n=s.createElement("link"),fn(n,"link",e),ft(n),s.head.appendChild(n)))}}function yb(e){Pl.D(e),Bp("dns-prefetch",e,null)}function gb(e,n){Pl.C(e,n),Bp("preconnect",e,n)}function bb(e,n,a){Pl.L(e,n,a);var s=Za;if(s&&e&&n){var h='link[rel="preload"][as="'+En(n)+'"]';n==="image"&&a&&a.imageSrcSet?(h+='[imagesrcset="'+En(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(h+='[imagesizes="'+En(a.imageSizes)+'"]')):h+='[href="'+En(e)+'"]';var x=h;switch(n){case"style":x=Ja(e);break;case"script":x=Pa(e)}il.has(x)||(e=y({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:e,as:n},a),il.set(x,e),s.querySelector(h)!==null||n==="style"&&s.querySelector(ts(x))||n==="script"&&s.querySelector(ns(x))||(n=s.createElement("link"),fn(n,"link",e),ft(n),s.head.appendChild(n)))}}function vb(e,n){Pl.m(e,n);var a=Za;if(a&&e){var s=n&&typeof n.as=="string"?n.as:"script",h='link[rel="modulepreload"][as="'+En(s)+'"][href="'+En(e)+'"]',x=h;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=Pa(e)}if(!il.has(x)&&(e=y({rel:"modulepreload",href:e},n),il.set(x,e),a.querySelector(h)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(ns(x)))return}s=a.createElement("link"),fn(s,"link",e),ft(s),a.head.appendChild(s)}}}function wb(e,n,a){Pl.S(e,n,a);var s=Za;if(s&&e){var h=Bn(s).hoistableStyles,x=Ja(e);n=n||"default";var w=h.get(x);if(!w){var N={loading:0,preload:null};if(w=s.querySelector(ts(x)))N.loading=5;else{e=y({rel:"stylesheet",href:e,"data-precedence":n},a),(a=il.get(x))&&Of(e,a);var H=w=s.createElement("link");ft(H),fn(H,"link",e),H._p=new Promise(function(Z,ie){H.onload=Z,H.onerror=ie}),H.addEventListener("load",function(){N.loading|=1}),H.addEventListener("error",function(){N.loading|=2}),N.loading|=4,Ho(w,n,s)}w={type:"stylesheet",instance:w,count:1,state:N},h.set(x,w)}}}function kb(e,n){Pl.X(e,n);var a=Za;if(a&&e){var s=Bn(a).hoistableScripts,h=Pa(e),x=s.get(h);x||(x=a.querySelector(ns(h)),x||(e=y({src:e,async:!0},n),(n=il.get(h))&&Bf(e,n),x=a.createElement("script"),ft(x),fn(x,"link",e),a.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},s.set(h,x))}}function Sb(e,n){Pl.M(e,n);var a=Za;if(a&&e){var s=Bn(a).hoistableScripts,h=Pa(e),x=s.get(h);x||(x=a.querySelector(ns(h)),x||(e=y({src:e,async:!0,type:"module"},n),(n=il.get(h))&&Bf(e,n),x=a.createElement("script"),ft(x),fn(x,"link",e),a.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},s.set(h,x))}}function Lp(e,n,a,s){var h=(h=Ne.current)?$o(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=Ja(a.href),a=Bn(h).hoistableStyles,s=a.get(n),s||(s={type:"style",instance:null,count:0,state:null},a.set(n,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=Ja(a.href);var x=Bn(h).hoistableStyles,w=x.get(e);if(w||(h=h.ownerDocument||h,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(e,w),(x=h.querySelector(ts(e)))&&!x._p&&(w.instance=x,w.state.loading=5),il.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},il.set(e,a),x||jb(h,e,a,w.state))),n&&s===null)throw Error(i(528,""));return w}if(n&&s!==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=Pa(a),a=Bn(h).hoistableScripts,s=a.get(n),s||(s={type:"script",instance:null,count:0,state:null},a.set(n,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Ja(e){return'href="'+En(e)+'"'}function ts(e){return'link[rel="stylesheet"]['+e+"]"}function $p(e){return y({},e,{"data-precedence":e.precedence,precedence:null})}function jb(e,n,a,s){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?s.loading=1:(n=e.createElement("link"),s.preload=n,n.addEventListener("load",function(){return s.loading|=1}),n.addEventListener("error",function(){return s.loading|=2}),fn(n,"link",a),ft(n),e.head.appendChild(n))}function Pa(e){return'[src="'+En(e)+'"]'}function ns(e){return"script[async]"+e}function Hp(e,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var s=e.querySelector('style[data-href~="'+En(a.href)+'"]');if(s)return n.instance=s,ft(s),s;var h=y({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),ft(s),fn(s,"style",h),Ho(s,a.precedence,e),n.instance=s;case"stylesheet":h=Ja(a.href);var x=e.querySelector(ts(h));if(x)return n.state.loading|=4,n.instance=x,ft(x),x;s=$p(a),(h=il.get(h))&&Of(s,h),x=(e.ownerDocument||e).createElement("link"),ft(x);var w=x;return w._p=new Promise(function(N,H){w.onload=N,w.onerror=H}),fn(x,"link",s),n.state.loading|=4,Ho(x,a.precedence,e),n.instance=x;case"script":return x=Pa(a.src),(h=e.querySelector(ns(x)))?(n.instance=h,ft(h),h):(s=a,(h=il.get(x))&&(s=y({},a),Bf(s,h)),e=e.ownerDocument||e,h=e.createElement("script"),ft(h),fn(h,"link",s),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&&(s=n.instance,n.state.loading|=4,Ho(s,a.precedence,e));return n.instance}function Ho(e,n,a){for(var s=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),h=s.length?s[s.length-1]:null,x=h,w=0;w<s.length;w++){var N=s[w];if(N.dataset.precedence===n)x=N;else if(x!==h)break}x?x.parentNode.insertBefore(e,x.nextSibling):(n=a.nodeType===9?a.head:a,n.insertBefore(e,n.firstChild))}function Of(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function Bf(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var Uo=null;function Up(e,n,a){if(Uo===null){var s=new Map,h=Uo=new Map;h.set(a,s)}else h=Uo,s=h.get(a),s||(s=new Map,h.set(a,s));if(s.has(e))return s;for(s.set(e,null),a=a.getElementsByTagName(e),h=0;h<a.length;h++){var x=a[h];if(!(x[_l]||x[Qt]||e==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var w=x.getAttribute(n)||"";w=e+w;var N=s.get(w);N?N.push(x):s.set(w,[x])}}return s}function Ip(e,n,a){e=e.ownerDocument||e,e.head.insertBefore(a,n==="title"?e.querySelector("head > title"):null)}function Cb(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 Yp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Eb(e,n,a,s){if(a.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var h=Ja(s.href),x=n.querySelector(ts(h));if(x){n=x._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=Io.bind(e),n.then(e,e)),a.state.loading|=4,a.instance=x,ft(x);return}x=n.ownerDocument||n,s=$p(s),(h=il.get(h))&&Of(s,h),x=x.createElement("link"),ft(x);var w=x;w._p=new Promise(function(N,H){w.onload=N,w.onerror=H}),fn(x,"link",s),a.instance=x}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=Io.bind(e),n.addEventListener("load",a),n.addEventListener("error",a))}}var Lf=0;function Nb(e,n){return e.stylesheets&&e.count===0&&qo(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var s=setTimeout(function(){if(e.stylesheets&&qo(e,e.stylesheets),e.unsuspend){var x=e.unsuspend;e.unsuspend=null,x()}},6e4+n);0<e.imgBytes&&Lf===0&&(Lf=62500*sb());var h=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&qo(e,e.stylesheets),e.unsuspend)){var x=e.unsuspend;e.unsuspend=null,x()}},(e.imgBytes>Lf?50:800)+n);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(h)}}:null}function Io(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)qo(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yo=null;function qo(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yo=new Map,n.forEach(Ab,e),Yo=null,Io.call(e))}function Ab(e,n){if(!(n.state.loading&4)){var a=Yo.get(e);if(a)var s=a.get(null);else{a=new Map,Yo.set(e,a);for(var h=e.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<h.length;x++){var w=h[x];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(a.set(w.dataset.precedence,w),s=w)}s&&a.set(null,s)}h=n.instance,w=h.getAttribute("data-precedence"),x=a.get(w)||s,x===s&&a.set(null,h),a.set(w,h),this.count++,s=Io.bind(this),h.addEventListener("load",s),h.addEventListener("error",s),x?x.parentNode.insertBefore(h,x.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(h,e.firstChild)),n.state.loading|=4}}var ls={$$typeof:R,Provider:null,Consumer:null,_currentValue:se,_currentValue2:se,_threadCount:0};function Db(e,n,a,s,h,x,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=hi(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=hi(0),this.hiddenUpdates=hi(null),this.identifierPrefix=s,this.onUncaughtError=h,this.onCaughtError=x,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function qp(e,n,a,s,h,x,w,N,H,Z,ie,he){return e=new Db(e,n,a,w,H,Z,ie,he,N),n=1,x===!0&&(n|=24),x=Hn(3,null,null,n),e.current=x,x.stateNode=e,n=pu(),n.refCount++,e.pooledCache=n,n.refCount++,x.memoizedState={element:s,isDehydrated:a,cache:n},vu(x),e}function Xp(e){return e?(e=Ta,e):Ta}function Vp(e,n,a,s,h,x){h=Xp(h),s.context===null?s.context=h:s.pendingContext=h,s=xr(n),s.payload={element:a},x=x===void 0?null:x,x!==null&&(s.callback=x),a=pr(e,s,n),a!==null&&(Mn(a,e,n),_i(a,e,n))}function Gp(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<n?a:n}}function $f(e,n){Gp(e,n),(e=e.alternate)&&Gp(e,n)}function Kp(e){if(e.tag===13||e.tag===31){var n=Jr(e,67108864);n!==null&&Mn(n,e,67108864),$f(e,67108864)}}function Qp(e){if(e.tag===13||e.tag===31){var n=Xn();n=ka(n);var a=Jr(e,n);a!==null&&Mn(a,e,n),$f(e,n)}}var Xo=!0;function Tb(e,n,a,s){var h=Y.T;Y.T=null;var x=Q.p;try{Q.p=2,Hf(e,n,a,s)}finally{Q.p=x,Y.T=h}}function zb(e,n,a,s){var h=Y.T;Y.T=null;var x=Q.p;try{Q.p=8,Hf(e,n,a,s)}finally{Q.p=x,Y.T=h}}function Hf(e,n,a,s){if(Xo){var h=Uf(s);if(h===null)Ef(e,n,s,Vo,a),Zp(e,s);else if(Rb(h,e,n,a,s))s.stopPropagation();else if(Zp(e,s),n&4&&-1<Mb.indexOf(e)){for(;h!==null;){var x=Zn(h);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var w=zl(x.pendingLanes);if(w!==0){var N=x;for(N.pendingLanes|=2,N.entangledLanes|=2;w;){var H=1<<31-dt(w);N.entanglements[1]|=H,w&=~H}kl(x),(yt&6)===0&&(Ao=vt()+500,Zi(0))}}break;case 31:case 13:N=Jr(x,2),N!==null&&Mn(N,x,2),To(),$f(x,2)}if(x=Uf(s),x===null&&Ef(e,n,s,Vo,a),x===h)break;h=x}h!==null&&s.stopPropagation()}else Ef(e,n,s,null,a)}}function Uf(e){return e=Ca(e),If(e)}var Vo=null;function If(e){if(Vo=null,e=On(e),e!==null){var n=u(e);if(n===null)e=null;else{var a=n.tag;if(a===13){if(e=f(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 Vo=e,null}function Wp(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(qt()){case ae:return 2;case ye:return 8;case Re:case qe:return 32;case we:return 268435456;default:return 32}default:return 32}}var Yf=!1,Nr=null,Ar=null,Dr=null,rs=new Map,as=new Map,Tr=[],Mb="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 Zp(e,n){switch(e){case"focusin":case"focusout":Nr=null;break;case"dragenter":case"dragleave":Ar=null;break;case"mouseover":case"mouseout":Dr=null;break;case"pointerover":case"pointerout":rs.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":as.delete(n.pointerId)}}function is(e,n,a,s,h,x){return e===null||e.nativeEvent!==x?(e={blockedOn:n,domEventName:a,eventSystemFlags:s,nativeEvent:x,targetContainers:[h]},n!==null&&(n=Zn(n),n!==null&&Kp(n)),e):(e.eventSystemFlags|=s,n=e.targetContainers,h!==null&&n.indexOf(h)===-1&&n.push(h),e)}function Rb(e,n,a,s,h){switch(n){case"focusin":return Nr=is(Nr,e,n,a,s,h),!0;case"dragenter":return Ar=is(Ar,e,n,a,s,h),!0;case"mouseover":return Dr=is(Dr,e,n,a,s,h),!0;case"pointerover":var x=h.pointerId;return rs.set(x,is(rs.get(x)||null,e,n,a,s,h)),!0;case"gotpointercapture":return x=h.pointerId,as.set(x,is(as.get(x)||null,e,n,a,s,h)),!0}return!1}function Jp(e){var n=On(e.target);if(n!==null){var a=u(n);if(a!==null){if(n=a.tag,n===13){if(n=f(a),n!==null){e.blockedOn=n,pi(e.priority,function(){Qp(a)});return}}else if(n===31){if(n=m(a),n!==null){e.blockedOn=n,pi(e.priority,function(){Qp(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 Go(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var a=Uf(e.nativeEvent);if(a===null){a=e.nativeEvent;var s=new a.constructor(a.type,a);ja=s,a.target.dispatchEvent(s),ja=null}else return n=Zn(a),n!==null&&Kp(n),e.blockedOn=a,!1;n.shift()}return!0}function Pp(e,n,a){Go(e)&&a.delete(n)}function Fb(){Yf=!1,Nr!==null&&Go(Nr)&&(Nr=null),Ar!==null&&Go(Ar)&&(Ar=null),Dr!==null&&Go(Dr)&&(Dr=null),rs.forEach(Pp),as.forEach(Pp)}function Ko(e,n){e.blockedOn===n&&(e.blockedOn=null,Yf||(Yf=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Fb)))}var Qo=null;function e1(e){Qo!==e&&(Qo=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Qo===e&&(Qo=null);for(var n=0;n<e.length;n+=3){var a=e[n],s=e[n+1],h=e[n+2];if(typeof s!="function"){if(If(s||a)===null)continue;break}var x=Zn(a);x!==null&&(e.splice(n,3),n-=3,Hu(x,{pending:!0,data:h,method:a.method,action:s},s,h))}}))}function ei(e){function n(H){return Ko(H,e)}Nr!==null&&Ko(Nr,e),Ar!==null&&Ko(Ar,e),Dr!==null&&Ko(Dr,e),rs.forEach(n),as.forEach(n);for(var a=0;a<Tr.length;a++){var s=Tr[a];s.blockedOn===e&&(s.blockedOn=null)}for(;0<Tr.length&&(a=Tr[0],a.blockedOn===null);)Jp(a),a.blockedOn===null&&Tr.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(s=0;s<a.length;s+=3){var h=a[s],x=a[s+1],w=h[sn]||null;if(typeof x=="function")w||e1(a);else if(w){var N=null;if(x&&x.hasAttribute("formAction")){if(h=x,w=x[sn]||null)N=w.formAction;else if(If(h)!==null)continue}else N=w.action;typeof N=="function"?a[s+1]=N:(a.splice(s,3),s-=3),e1(a)}}}function t1(){function e(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(w){return h=w})},focusReset:"manual",scroll:"manual"})}function n(){h!==null&&(h(),h=null),s||setTimeout(a,20)}function a(){if(!s&&!navigation.transition){var x=navigation.currentEntry;x&&x.url!=null&&navigation.navigate(x.url,{state:x.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var s=!1,h=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){s=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),h!==null&&(h(),h=null)}}}function qf(e){this._internalRoot=e}Wo.prototype.render=qf.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(i(409));var a=n.current,s=Xn();Vp(a,s,e,n,null,null)},Wo.prototype.unmount=qf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;Vp(e.current,2,null,e,null,null),To(),n[Sn]=null}};function Wo(e){this._internalRoot=e}Wo.prototype.unstable_scheduleHydration=function(e){if(e){var n=xi();e={blockedOn:null,target:e,priority:n};for(var a=0;a<Tr.length&&n!==0&&n<Tr[a].priority;a++);Tr.splice(a,0,e),a===0&&Jp(e)}};var n1=l.version;if(n1!=="19.2.4")throw Error(i(527,n1,"19.2.4"));Q.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=d(n),e=e!==null?g(e):null,e=e===null?null:e.stateNode,e};var _b={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:Y,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Zo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Zo.isDisabled&&Zo.supportsFiber)try{rt=Zo.inject(_b),de=Zo}catch{}}return os.createRoot=function(e,n){if(!c(e))throw Error(i(299));var a=!1,s="",h=cx,x=ux,w=fx;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onUncaughtError!==void 0&&(h=n.onUncaughtError),n.onCaughtError!==void 0&&(x=n.onCaughtError),n.onRecoverableError!==void 0&&(w=n.onRecoverableError)),n=qp(e,1,!1,null,null,a,s,null,h,x,w,t1),e[Sn]=n.current,Cf(e),new qf(n)},os.hydrateRoot=function(e,n,a){if(!c(e))throw Error(i(299));var s=!1,h="",x=cx,w=ux,N=fx,H=null;return a!=null&&(a.unstable_strictMode===!0&&(s=!0),a.identifierPrefix!==void 0&&(h=a.identifierPrefix),a.onUncaughtError!==void 0&&(x=a.onUncaughtError),a.onCaughtError!==void 0&&(w=a.onCaughtError),a.onRecoverableError!==void 0&&(N=a.onRecoverableError),a.formState!==void 0&&(H=a.formState)),n=qp(e,1,!0,n,a??null,s,h,H,x,w,N,t1),n.context=Xp(null),a=n.current,s=Xn(),s=ka(s),h=xr(s),h.callback=null,pr(a,h,s),a=s,n.current.lanes=a,Qn(n,a),kl(n),e[Sn]=n.current,Cf(e),new Wo(n)},os.version="19.2.4",os}var h1;function Gb(){if(h1)return Gf.exports;h1=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(),Gf.exports=Vb(),Gf.exports}var Kb=Gb();const Qb="modulepreload",Wb=function(t){return"/"+t},m1={},Zb=function(l,r,i){let c=Promise.resolve();if(r&&r.length>0){let f=function(d){return Promise.all(d.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]"),p=(m==null?void 0:m.nonce)||(m==null?void 0:m.getAttribute("nonce"));c=f(r.map(d=>{if(d=Wb(d),d in m1)return;m1[d]=!0;const g=d.endsWith(".css"),y=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${y}`))return;const b=document.createElement("link");if(b.rel=g?"stylesheet":Qb,g||(b.as="script"),b.crossOrigin="",b.href=d,p&&b.setAttribute("nonce",p),document.head.appendChild(b),g)return new Promise((v,j)=>{b.addEventListener("load",v),b.addEventListener("error",()=>j(new Error(`Unable to preload CSS for ${d}`)))})}))}function u(f){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=f,window.dispatchEvent(m),!m.defaultPrevented)throw f}return c.then(f=>{for(const m of f||[])m.status==="rejected"&&u(m.reason);return l().catch(u)})};class Jb extends k.Component{constructor(){super(...arguments);l1(this,"state",{hasError:!1,error:null})}static getDerivedStateFromError(r){return{hasError:!0,error:r}}render(){var r;return this.state.hasError?o.jsx("div",{className:"h-screen flex items-center justify-center bg-[var(--floor-light)]",children:o.jsxs("div",{className:"text-center max-w-md",children:[o.jsx("div",{className:"text-4xl mb-3",children:"🚨"}),o.jsx("div",{className:"text-gray-800 font-semibold mb-2",children:"Something went wrong"}),o.jsx("div",{className:"text-gray-500 text-sm mb-4",children:((r=this.state.error)==null?void 0:r.message)??"An unexpected error occurred."}),o.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 Ms="/api";async function Rt(t){const l=await fetch(`${Ms}${t}`);if(!l.ok)throw new Error(`API error: ${l.status}`);return l.json()}async function Rn(t,l){const r=await fetch(`${Ms}${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 Zf(t,l){const r=await fetch(`${Ms}${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 Mr(t,l){const r={method:"DELETE"};l!==void 0&&(r.headers={"Content-Type":"application/json"},r.body=JSON.stringify(l));const i=await fetch(`${Ms}${t}`,r);if(!i.ok)throw new Error(`API error: ${i.status}`);return i.json()}const Ee={getCompany:()=>Rt("/company"),getRoles:()=>Rt("/roles"),getRole:t=>Rt(`/roles/${t}`),getProjects:()=>Rt("/projects"),getProject:t=>Rt(`/projects/${t}`),getStandups:()=>Rt("/operations/standups"),getWaves:()=>Rt("/operations/waves"),getDecisions:()=>Rt("/operations/decisions"),getOrgTree:()=>Rt("/engine/org"),getSkills:()=>Rt("/skills"),createRole:t=>Rn("/engine/roles",t),updateRole:(t,l)=>Zf(`/engine/roles/${t}`,l),deleteRole:t=>Mr(`/engine/roles/${t}`),getSessions:()=>Rt("/sessions"),getSession:t=>Rt(`/sessions/${t}`),createSession:(t,l="talk")=>Rn("/sessions",{roleId:t,mode:l}),deleteSession:t=>Mr(`/sessions/${t}`),deleteSessions:t=>Mr("/sessions",{ids:t}),deleteEmptySessions:()=>Mr("/sessions?empty=true"),updateSession:(t,l)=>Zf(`/sessions/${t}`,l),startJob:t=>Rn("/jobs",t),getJob:t=>Rt(`/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 Rt(`/jobs${r?"?"+r:""}`)},abortJob:t=>Mr(`/jobs/${t}`),getStatus:()=>Rt("/status"),detectEngine:()=>Rn("/setup/detect-engine",{}),validatePath:t=>Rn("/setup/validate-path",{path:t}),scaffold:t=>Rn("/setup/scaffold",t),getTeams:()=>Rt("/setup/teams"),browse:t=>Rn("/setup/browse",{path:t}),connectAkb:t=>Rn("/setup/connect-akb",{path:t}),getKnowledge:()=>Rt("/knowledge"),getKnowledgeDoc:t=>Rt(`/knowledge/${t}`),createKnowledgeDoc:t=>Rn("/knowledge",t),updateKnowledgeDoc:(t,l)=>fetch(`${Ms}/knowledge/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:l})}).then(r=>{if(!r.ok)throw new Error(`API error: ${r.status}`);return r.json()}),deleteKnowledgeDoc:t=>Mr(`/knowledge/${t}`),getPreferences:()=>Rt("/preferences"),updatePreferences:t=>Zf("/preferences",t),chatInChannel:t=>Rn("/speech/chat",t),getSaveStatus:()=>Rt("/save/status"),save:t=>Rn("/save",{message:t}),getSaveHistory:(t=20)=>Rt(`/save/history?limit=${t}`),restoreSave:(t,l)=>Rn("/save/restore",{sha:t,paths:l}),initGit:()=>Rn("/save/init",{}),getCostSummary:()=>Rt("/cost/summary"),getSyncRoles:()=>Rt("/sync/roles"),applySyncUpdate:t=>Rn("/sync/apply",t),getCompanyStats:()=>Rt("/sync/stats"),getGitStatus:()=>Rt("/git/status"),deleteWorktree:t=>Mr(`/git/worktrees/${encodeURIComponent(t)}`),deleteBranch:t=>Mr(`/git/branches/${encodeURIComponent(t)}`)};function X0(t){const[l,r]=k.useState([]),[i,c]=k.useState("idle"),[u,f]=k.useState(""),[m,p]=k.useState([]),d=k.useRef(-1),g=k.useRef(null),y=k.useRef(0),b=k.useCallback(()=>{var E;if(!t)return;(E=g.current)==null||E.abort();const j=new AbortController;g.current=j,c("connecting");const S=d.current+1,C=`/api/jobs/${t}/stream?from=${S}`;fetch(C,{signal:j.signal}).then(async A=>{if(!A.ok||!A.body){c("error");return}c("streaming");const R=A.body.getReader(),O=new TextDecoder;let B="";for(;;){const{done:T,value:I}=await R.read();if(T)break;B+=O.decode(I,{stream:!0});const X=B.split(`
50
- `);B=X.pop()??"";let ee="";for(const z of X)if(z.startsWith("event: "))ee=z.slice(7).trim();else if(z.startsWith("data: ")){try{const $=JSON.parse(z.slice(6));if(ee==="activity"){const U=$;U.seq>d.current&&(d.current=U.seq),r(ne=>ne.some(re=>re.seq===U.seq)?ne:[...ne,U]),U.type==="text"&&f(ne=>ne+(U.data.text??"")),U.type==="dispatch:start"&&U.data.childJobId&&p(ne=>[...ne,U.data.childJobId]),U.type==="job:done"?c("done"):U.type==="job:error"&&c("error")}else if(ee==="stream:end"){const U=$.reason;c(U==="done"?"done":U==="error"?"error":"done")}}catch{}ee=""}}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"),f(""),p([]),d.current=-1;return}return r([]),f(""),p([]),d.current=-1,y.current=0,b(),()=>{var j;(j=g.current)==null||j.abort()}},[t,b]),{events:l,status:i,textOutput:u,childJobIds:m,reconnect:v}}function Pb(t,l){const r={};return(t[t.length-1]===""?[...t,""]:t).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const ev=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,tv=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,nv={};function x1(t,l){return(nv.jsx?tv:ev).test(t)}const lv=/[ \t\n\f\r]/g;function rv(t){return typeof t=="object"?t.type==="text"?p1(t.value):!1:p1(t)}function p1(t){return t.replace(lv,"")===""}class Rs{constructor(l,r,i){this.normal=r,this.property=l,i&&(this.space=i)}}Rs.prototype.normal={};Rs.prototype.property={};Rs.prototype.space=void 0;function V0(t,l){const r={},i={};for(const c of t)Object.assign(r,c.property),Object.assign(i,c.normal);return new Rs(r,i,l)}function Od(t){return t.toLowerCase()}class _n{constructor(l,r){this.attribute=r,this.property=l}}_n.prototype.attribute="";_n.prototype.booleanish=!1;_n.prototype.boolean=!1;_n.prototype.commaOrSpaceSeparated=!1;_n.prototype.commaSeparated=!1;_n.prototype.defined=!1;_n.prototype.mustUseProperty=!1;_n.prototype.number=!1;_n.prototype.overloadedBoolean=!1;_n.prototype.property="";_n.prototype.spaceSeparated=!1;_n.prototype.space=void 0;let av=0;const We=va(),en=va(),Bd=va(),be=va(),Tt=va(),ai=va(),Vn=va();function va(){return 2**++av}const Ld=Object.freeze(Object.defineProperty({__proto__:null,boolean:We,booleanish:en,commaOrSpaceSeparated:Vn,commaSeparated:ai,number:be,overloadedBoolean:Bd,spaceSeparated:Tt},Symbol.toStringTag,{value:"Module"})),Jf=Object.keys(Ld);class th extends _n{constructor(l,r,i,c){let u=-1;if(super(l,r),y1(this,"space",c),typeof i=="number")for(;++u<Jf.length;){const f=Jf[u];y1(this,Jf[u],(i&Ld[f])===Ld[f])}}}th.prototype.defined=!0;function y1(t,l,r){r&&(t[l]=r)}function ci(t){const l={},r={};for(const[i,c]of Object.entries(t.properties)){const u=new th(i,t.transform(t.attributes||{},i),c,t.space);t.mustUseProperty&&t.mustUseProperty.includes(i)&&(u.mustUseProperty=!0),l[i]=u,r[Od(i)]=i,r[Od(u.attribute)]=i}return new Rs(l,r,t.space)}const G0=ci({properties:{ariaActiveDescendant:null,ariaAtomic:en,ariaAutoComplete:null,ariaBusy:en,ariaChecked:en,ariaColCount:be,ariaColIndex:be,ariaColSpan:be,ariaControls:Tt,ariaCurrent:null,ariaDescribedBy:Tt,ariaDetails:null,ariaDisabled:en,ariaDropEffect:Tt,ariaErrorMessage:null,ariaExpanded:en,ariaFlowTo:Tt,ariaGrabbed:en,ariaHasPopup:null,ariaHidden:en,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Tt,ariaLevel:be,ariaLive:null,ariaModal:en,ariaMultiLine:en,ariaMultiSelectable:en,ariaOrientation:null,ariaOwns:Tt,ariaPlaceholder:null,ariaPosInSet:be,ariaPressed:en,ariaReadOnly:en,ariaRelevant:null,ariaRequired:en,ariaRoleDescription:Tt,ariaRowCount:be,ariaRowIndex:be,ariaRowSpan:be,ariaSelected:en,ariaSetSize:be,ariaSort:null,ariaValueMax:be,ariaValueMin:be,ariaValueNow:be,ariaValueText:null,role:null},transform(t,l){return l==="role"?l:"aria-"+l.slice(4).toLowerCase()}});function K0(t,l){return l in t?t[l]:l}function Q0(t,l){return K0(t,l.toLowerCase())}const iv=ci({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ai,acceptCharset:Tt,accessKey:Tt,action:null,allow:null,allowFullScreen:We,allowPaymentRequest:We,allowUserMedia:We,alt:null,as:null,async:We,autoCapitalize:null,autoComplete:Tt,autoFocus:We,autoPlay:We,blocking:Tt,capture:null,charSet:null,checked:We,cite:null,className:Tt,cols:be,colSpan:null,content:null,contentEditable:en,controls:We,controlsList:Tt,coords:be|ai,crossOrigin:null,data:null,dateTime:null,decoding:null,default:We,defer:We,dir:null,dirName:null,disabled:We,download:Bd,draggable:en,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:We,formTarget:null,headers:Tt,height:be,hidden:Bd,high:be,href:null,hrefLang:null,htmlFor:Tt,httpEquiv:Tt,id:null,imageSizes:null,imageSrcSet:null,inert:We,inputMode:null,integrity:null,is:null,isMap:We,itemId:null,itemProp:Tt,itemRef:Tt,itemScope:We,itemType:Tt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:We,low:be,manifest:null,max:null,maxLength:be,media:null,method:null,min:null,minLength:be,multiple:We,muted:We,name:null,nonce:null,noModule:We,noValidate:We,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:We,optimum:be,pattern:null,ping:Tt,placeholder:null,playsInline:We,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:We,referrerPolicy:null,rel:Tt,required:We,reversed:We,rows:be,rowSpan:be,sandbox:Tt,scope:null,scoped:We,seamless:We,selected:We,shadowRootClonable:We,shadowRootDelegatesFocus:We,shadowRootMode:null,shape:null,size:be,sizes:null,slot:null,span:be,spellCheck:en,src:null,srcDoc:null,srcLang:null,srcSet:null,start:be,step:null,style:null,tabIndex:be,target:null,title:null,translate:null,type:null,typeMustMatch:We,useMap:null,value:en,width:be,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Tt,axis:null,background:null,bgColor:null,border:be,borderColor:null,bottomMargin:be,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:We,declare:We,event:null,face:null,frame:null,frameBorder:null,hSpace:be,leftMargin:be,link:null,longDesc:null,lowSrc:null,marginHeight:be,marginWidth:be,noResize:We,noHref:We,noShade:We,noWrap:We,object:null,profile:null,prompt:null,rev:null,rightMargin:be,rules:null,scheme:null,scrolling:en,standby:null,summary:null,text:null,topMargin:be,valueType:null,version:null,vAlign:null,vLink:null,vSpace:be,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:We,disableRemotePlayback:We,prefix:null,property:null,results:be,security:null,unselectable:null},space:"html",transform:Q0}),sv=ci({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:Vn,accentHeight:be,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:be,amplitude:be,arabicForm:null,ascent:be,attributeName:null,attributeType:null,azimuth:be,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:be,by:null,calcMode:null,capHeight:be,className:Tt,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:be,diffuseConstant:be,direction:null,display:null,dur:null,divisor:be,dominantBaseline:null,download:We,dx:null,dy:null,edgeMode:null,editable:null,elevation:be,enableBackground:null,end:null,event:null,exponent:be,externalResourcesRequired:null,fill:null,fillOpacity:be,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:ai,g2:ai,glyphName:ai,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:be,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:be,horizOriginX:be,horizOriginY:be,id:null,ideographic:be,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:be,k:be,k1:be,k2:be,k3:be,k4:be,kernelMatrix:Vn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:be,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:be,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:be,overlineThickness:be,paintOrder:null,panose1:null,path:null,pathLength:be,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Tt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:be,pointsAtY:be,pointsAtZ:be,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Vn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Vn,rev:Vn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Vn,requiredFeatures:Vn,requiredFonts:Vn,requiredFormats:Vn,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:be,specularExponent:be,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:be,strikethroughThickness:be,string:null,stroke:null,strokeDashArray:Vn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:be,strokeOpacity:be,strokeWidth:null,style:null,surfaceScale:be,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Vn,tabIndex:be,tableValues:null,target:null,targetX:be,targetY:be,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Vn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:be,underlineThickness:be,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:be,values:null,vAlphabetic:be,vMathematical:be,vectorEffect:null,vHanging:be,vIdeographic:be,version:null,vertAdvY:be,vertOriginX:be,vertOriginY:be,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:be,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:K0}),W0=ci({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()}}),Z0=ci({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Q0}),J0=ci({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,l){return"xml:"+l.slice(3).toLowerCase()}}),ov={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"},cv=/[A-Z]/g,g1=/-[a-z]/g,uv=/^data[-\w.:]+$/i;function fv(t,l){const r=Od(l);let i=l,c=_n;if(r in t.normal)return t.property[t.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&uv.test(l)){if(l.charAt(4)==="-"){const u=l.slice(5).replace(g1,hv);i="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=l.slice(4);if(!g1.test(u)){let f=u.replace(cv,dv);f.charAt(0)!=="-"&&(f="-"+f),l="data"+f}}c=th}return new c(i,l)}function dv(t){return"-"+t.toLowerCase()}function hv(t){return t.charAt(1).toUpperCase()}const mv=V0([G0,iv,W0,Z0,J0],"html"),nh=V0([G0,sv,W0,Z0,J0],"svg");function xv(t){return t.join(" ").trim()}var ti={},Pf,b1;function pv(){if(b1)return Pf;b1=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,l=/\n/g,r=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,c=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,f=/^[;\s]*/,m=/^\s+|\s+$/g,p=`
51
- `,d="/",g="*",y="",b="comment",v="declaration";function j(C,E){if(typeof C!="string")throw new TypeError("First argument must be a string");if(!C)return[];E=E||{};var A=1,R=1;function O(re){var V=re.match(l);V&&(A+=V.length);var Y=re.lastIndexOf(p);R=~Y?re.length-Y:R+re.length}function B(){var re={line:A,column:R};return function(V){return V.position=new T(re),ee(),V}}function T(re){this.start=re,this.end={line:A,column:R},this.source=E.source}T.prototype.content=C;function I(re){var V=new Error(E.source+":"+A+":"+R+": "+re);if(V.reason=re,V.filename=E.source,V.line=A,V.column=R,V.source=C,!E.silent)throw V}function X(re){var V=re.exec(C);if(V){var Y=V[0];return O(Y),C=C.slice(Y.length),V}}function ee(){X(r)}function z(re){var V;for(re=re||[];V=$();)V!==!1&&re.push(V);return re}function $(){var re=B();if(!(d!=C.charAt(0)||g!=C.charAt(1))){for(var V=2;y!=C.charAt(V)&&(g!=C.charAt(V)||d!=C.charAt(V+1));)++V;if(V+=2,y===C.charAt(V-1))return I("End of comment missing");var Y=C.slice(2,V-2);return R+=2,O(Y),C=C.slice(V),R+=2,re({type:b,comment:Y})}}function U(){var re=B(),V=X(i);if(V){if($(),!X(c))return I("property missing ':'");var Y=X(u),Q=re({type:v,property:S(V[0].replace(t,y)),value:Y?S(Y[0].replace(t,y)):y});return X(f),Q}}function ne(){var re=[];z(re);for(var V;V=U();)V!==!1&&(re.push(V),z(re));return re}return ee(),ne()}function S(C){return C?C.replace(m,y):y}return Pf=j,Pf}var v1;function yv(){if(v1)return ti;v1=1;var t=ti&&ti.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(ti,"__esModule",{value:!0}),ti.default=r;const l=t(pv());function r(i,c){let u=null;if(!i||typeof i!="string")return u;const f=(0,l.default)(i),m=typeof c=="function";return f.forEach(p=>{if(p.type!=="declaration")return;const{property:d,value:g}=p;m?c(d,g,p):g&&(u=u||{},u[d]=g)}),u}return ti}var cs={},w1;function gv(){if(w1)return cs;w1=1,Object.defineProperty(cs,"__esModule",{value:!0}),cs.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,l=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,c=/^-(ms)-/,u=function(d){return!d||r.test(d)||t.test(d)},f=function(d,g){return g.toUpperCase()},m=function(d,g){return"".concat(g,"-")},p=function(d,g){return g===void 0&&(g={}),u(d)?d:(d=d.toLowerCase(),g.reactCompat?d=d.replace(c,m):d=d.replace(i,m),d.replace(l,f))};return cs.camelCase=p,cs}var us,k1;function bv(){if(k1)return us;k1=1;var t=us&&us.__importDefault||function(c){return c&&c.__esModule?c:{default:c}},l=t(yv()),r=gv();function i(c,u){var f={};return!c||typeof c!="string"||(0,l.default)(c,function(m,p){m&&p&&(f[(0,r.camelCase)(m,u)]=p)}),f}return i.default=i,us=i,us}var vv=bv();const wv=q0(vv),P0=ey("end"),lh=ey("start");function ey(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 kv(t){const l=lh(t),r=P0(t);if(l&&r)return{start:l,end:r}}function ks(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?S1(t.position):"start"in t||"end"in t?S1(t):"line"in t||"column"in t?$d(t):""}function $d(t){return j1(t&&t.line)+":"+j1(t&&t.column)}function S1(t){return $d(t&&t.start)+"-"+$d(t&&t.end)}function j1(t){return t&&typeof t=="number"?t:1}class pn extends Error{constructor(l,r,i){super(),typeof r=="string"&&(i=r,r=void 0);let c="",u={},f=!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&&(f=!0,c=l.message,u.cause=l),!u.ruleId&&!u.source&&typeof i=="string"){const p=i.indexOf(":");p===-1?u.ruleId=i:(u.source=i.slice(0,p),u.ruleId=i.slice(p+1))}if(!u.place&&u.ancestors&&u.ancestors){const p=u.ancestors[u.ancestors.length-1];p&&(u.place=p.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=ks(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=f&&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}}pn.prototype.file="";pn.prototype.name="";pn.prototype.reason="";pn.prototype.message="";pn.prototype.stack="";pn.prototype.column=void 0;pn.prototype.line=void 0;pn.prototype.ancestors=void 0;pn.prototype.cause=void 0;pn.prototype.fatal=void 0;pn.prototype.place=void 0;pn.prototype.ruleId=void 0;pn.prototype.source=void 0;const rh={}.hasOwnProperty,Sv=new Map,jv=/[A-Z]/g,Cv=new Set(["table","tbody","thead","tfoot","tr"]),Ev=new Set(["td","th"]),ty="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Nv(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=_v(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=Fv(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"?nh:mv,stylePropertyNameCase:l.stylePropertyNameCase||"dom",tableCellAlignToStyle:l.tableCellAlignToStyle!==!1},u=ny(c,t,void 0);return u&&typeof u!="string"?u:c.create(t,c.Fragment,{children:u||void 0},void 0)}function ny(t,l,r){if(l.type==="element")return Av(t,l,r);if(l.type==="mdxFlowExpression"||l.type==="mdxTextExpression")return Dv(t,l);if(l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement")return zv(t,l,r);if(l.type==="mdxjsEsm")return Tv(t,l);if(l.type==="root")return Mv(t,l,r);if(l.type==="text")return Rv(t,l)}function Av(t,l,r){const i=t.schema;let c=i;l.tagName.toLowerCase()==="svg"&&i.space==="html"&&(c=nh,t.schema=c),t.ancestors.push(l);const u=ry(t,l.tagName,!1),f=Ov(t,l);let m=ih(t,l);return Cv.has(l.tagName)&&(m=m.filter(function(p){return typeof p=="string"?!rv(p):!0})),ly(t,f,u,l),ah(f,m),t.ancestors.pop(),t.schema=i,t.create(l,u,f,r)}function Dv(t,l){if(l.data&&l.data.estree&&t.evaluater){const i=l.data.estree.body[0];return i.type,t.evaluater.evaluateExpression(i.expression)}Ns(t,l.position)}function Tv(t,l){if(l.data&&l.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(l.data.estree);Ns(t,l.position)}function zv(t,l,r){const i=t.schema;let c=i;l.name==="svg"&&i.space==="html"&&(c=nh,t.schema=c),t.ancestors.push(l);const u=l.name===null?t.Fragment:ry(t,l.name,!0),f=Bv(t,l),m=ih(t,l);return ly(t,f,u,l),ah(f,m),t.ancestors.pop(),t.schema=i,t.create(l,u,f,r)}function Mv(t,l,r){const i={};return ah(i,ih(t,l)),t.create(l,t.Fragment,i,r)}function Rv(t,l){return l.value}function ly(t,l,r,i){typeof r!="string"&&r!==t.Fragment&&t.passNode&&(l.node=i)}function ah(t,l){if(l.length>0){const r=l.length>1?l:l[0];r&&(t.children=r)}}function Fv(t,l,r){return i;function i(c,u,f,m){const d=Array.isArray(f.children)?r:l;return m?d(u,f,m):d(u,f)}}function _v(t,l){return r;function r(i,c,u,f){const m=Array.isArray(u.children),p=lh(i);return l(c,u,f,m,{columnNumber:p?p.column-1:void 0,fileName:t,lineNumber:p?p.line:void 0},void 0)}}function Ov(t,l){const r={};let i,c;for(c in l.properties)if(c!=="children"&&rh.call(l.properties,c)){const u=Lv(t,c,l.properties[c]);if(u){const[f,m]=u;t.tableCellAlignToStyle&&f==="align"&&typeof m=="string"&&Ev.has(l.tagName)?i=m:r[f]=m}}if(i){const u=r.style||(r.style={});u[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return r}function Bv(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 f=u.expression;f.type;const m=f.properties[0];m.type,Object.assign(r,t.evaluater.evaluateExpression(m.argument))}else Ns(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 Ns(t,l.position);else u=i.value===null?!0:i.value;r[c]=u}return r}function ih(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 f;if(t.passKeys){const p=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(p){const d=c.get(p)||0;f=p+"-"+d,c.set(p,d+1)}}const m=ny(t,u,f);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?Pb(r):xv(r)),i.property==="style"){let c=typeof r=="object"?r:$v(t,String(r));return t.stylePropertyNameCase==="css"&&(c=Hv(c)),["style",c]}return[t.elementAttributeNameCase==="react"&&i.space?ov[i.property]||i.property:i.attribute,r]}}function $v(t,l){try{return wv(l,{reactCompat:!0})}catch(r){if(t.ignoreInvalidStyle)return{};const i=r,c=new pn("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=ty+"#cannot-parse-style-attribute",c}}function ry(t,l,r){let i;if(!r)i={type:"Literal",value:l};else if(l.includes(".")){const c=l.split(".");let u=-1,f;for(;++u<c.length;){const m=x1(c[u])?{type:"Identifier",name:c[u]}:{type:"Literal",value:c[u]};f=f?{type:"MemberExpression",object:f,property:m,computed:!!(u&&m.type==="Literal"),optional:!1}:m}i=f}else i=x1(l)&&!/^[a-z]/.test(l)?{type:"Identifier",name:l}:{type:"Literal",value:l};if(i.type==="Literal"){const c=i.value;return rh.call(t.components,c)?t.components[c]:c}if(t.evaluater)return t.evaluater.evaluateExpression(i);Ns(t)}function Ns(t,l){const r=new pn("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=ty+"#cannot-handle-mdx-estrees-without-createevaluater",r}function Hv(t){const l={};let r;for(r in t)rh.call(t,r)&&(l[Uv(r)]=t[r]);return l}function Uv(t){let l=t.replace(jv,Iv);return l.slice(0,3)==="ms-"&&(l="-"+l),l}function Iv(t){return"-"+t.toLowerCase()}const ed={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"]},Yv={};function sh(t,l){const r=Yv,i=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,c=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return ay(t,i,c)}function ay(t,l,r){if(qv(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 C1(t.children,l,r)}return Array.isArray(t)?C1(t,l,r):""}function C1(t,l,r){const i=[];let c=-1;for(;++c<t.length;)i[c]=ay(t[c],l,r);return i.join("")}function qv(t){return!!(t&&typeof t=="object")}const E1=document.createElement("i");function oh(t){const l="&"+t+";";E1.innerHTML=l;const r=E1.textContent;return r.charCodeAt(r.length-1)===59&&t!=="semi"||r===l?!1:r}function Kn(t,l,r,i){const c=t.length;let u=0,f;if(l<0?l=-l>c?0:c+l:l=l>c?c:l,r=r>0?r:0,i.length<1e4)f=Array.from(i),f.unshift(l,r),t.splice(...f);else for(r&&t.splice(l,r);u<i.length;)f=i.slice(u,u+1e4),f.unshift(l,0),t.splice(...f),u+=1e4,l+=1e4}function sl(t,l){return t.length>0?(Kn(t,t.length,0,l),t):l}const N1={}.hasOwnProperty;function iy(t){const l={};let r=-1;for(;++r<t.length;)Xv(l,t[r]);return l}function Xv(t,l){let r;for(r in l){const c=(N1.call(t,r)?t[r]:void 0)||(t[r]={}),u=l[r];let f;if(u)for(f in u){N1.call(c,f)||(c[f]=[]);const m=u[f];Vv(c[f],Array.isArray(m)?m:m?[m]:[])}}}function Vv(t,l){let r=-1;const i=[];for(;++r<l.length;)(l[r].add==="after"?t:i).push(l[r]);Kn(t,0,0,i)}function sy(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 pl(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const vn=Hr(/[A-Za-z]/),xn=Hr(/[\dA-Za-z]/),Gv=Hr(/[#-'*+\--9=?A-Z^-~]/);function vc(t){return t!==null&&(t<32||t===127)}const Hd=Hr(/\d/),Kv=Hr(/[\dA-Fa-f]/),Qv=Hr(/[!-/:-@[-`{-~]/);function Ue(t){return t!==null&&t<-2}function Dt(t){return t!==null&&(t<0||t===32)}function lt(t){return t===-2||t===-1||t===32}const zc=Hr(new RegExp("\\p{P}|\\p{S}","u")),ga=Hr(/\s/);function Hr(t){return l;function l(r){return r!==null&&r>-1&&t.test(String.fromCharCode(r))}}function ui(t){const l=[];let r=-1,i=0,c=0;for(;++r<t.length;){const u=t.charCodeAt(r);let f="";if(u===37&&xn(t.charCodeAt(r+1))&&xn(t.charCodeAt(r+2)))c=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(f=String.fromCharCode(u));else if(u>55295&&u<57344){const m=t.charCodeAt(r+1);u<56320&&m>56319&&m<57344?(f=String.fromCharCode(u,m),c=1):f="�"}else f=String.fromCharCode(u);f&&(l.push(t.slice(i,r),encodeURIComponent(f)),i=r+c+1,f=""),c&&(r+=c,c=0)}return l.join("")+t.slice(i)}function ut(t,l,r,i){const c=i?i-1:Number.POSITIVE_INFINITY;let u=0;return f;function f(p){return lt(p)?(t.enter(r),m(p)):l(p)}function m(p){return lt(p)&&u++<c?(t.consume(p),m):(t.exit(r),l(p))}}const Wv={tokenize:Zv};function Zv(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"),ut(t,l,"linePrefix")}function c(m){return t.enter("paragraph"),u(m)}function u(m){const p=t.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=p),r=p,f(m)}function f(m){if(m===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(m);return}return Ue(m)?(t.consume(m),t.exit("chunkText"),u):(t.consume(m),f)}}const Jv={tokenize:Pv},A1={tokenize:ew};function Pv(t){const l=this,r=[];let i=0,c,u,f;return m;function m(R){if(i<r.length){const O=r[i];return l.containerState=O[1],t.attempt(O[0].continuation,p,d)(R)}return d(R)}function p(R){if(i++,l.containerState._closeFlow){l.containerState._closeFlow=void 0,c&&A();const O=l.events.length;let B=O,T;for(;B--;)if(l.events[B][0]==="exit"&&l.events[B][1].type==="chunkFlow"){T=l.events[B][1].end;break}E(i);let I=O;for(;I<l.events.length;)l.events[I][1].end={...T},I++;return Kn(l.events,B+1,0,l.events.slice(O)),l.events.length=I,d(R)}return m(R)}function d(R){if(i===r.length){if(!c)return b(R);if(c.currentConstruct&&c.currentConstruct.concrete)return j(R);l.interrupt=!!(c.currentConstruct&&!c._gfmTableDynamicInterruptHack)}return l.containerState={},t.check(A1,g,y)(R)}function g(R){return c&&A(),E(i),b(R)}function y(R){return l.parser.lazy[l.now().line]=i!==r.length,f=l.now().offset,j(R)}function b(R){return l.containerState={},t.attempt(A1,v,j)(R)}function v(R){return i++,r.push([l.currentConstruct,l.containerState]),b(R)}function j(R){if(R===null){c&&A(),E(0),t.consume(R);return}return c=c||l.parser.flow(l.now()),t.enter("chunkFlow",{_tokenizer:c,contentType:"flow",previous:u}),S(R)}function S(R){if(R===null){C(t.exit("chunkFlow"),!0),E(0),t.consume(R);return}return Ue(R)?(t.consume(R),C(t.exit("chunkFlow")),i=0,l.interrupt=void 0,m):(t.consume(R),S)}function C(R,O){const B=l.sliceStream(R);if(O&&B.push(null),R.previous=u,u&&(u.next=R),u=R,c.defineSkip(R.start),c.write(B),l.parser.lazy[R.start.line]){let T=c.events.length;for(;T--;)if(c.events[T][1].start.offset<f&&(!c.events[T][1].end||c.events[T][1].end.offset>f))return;const I=l.events.length;let X=I,ee,z;for(;X--;)if(l.events[X][0]==="exit"&&l.events[X][1].type==="chunkFlow"){if(ee){z=l.events[X][1].end;break}ee=!0}for(E(i),T=I;T<l.events.length;)l.events[T][1].end={...z},T++;Kn(l.events,X+1,0,l.events.slice(I)),l.events.length=T}}function E(R){let O=r.length;for(;O-- >R;){const B=r[O];l.containerState=B[1],B[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 ew(t,l,r){return ut(t,t.attempt(this.parser.constructs.document,l,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ii(t){if(t===null||Dt(t)||ga(t))return 1;if(zc(t))return 2}function Mc(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 Ud={name:"attention",resolveAll:tw,tokenize:nw};function tw(t,l){let r=-1,i,c,u,f,m,p,d,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;p=t[i][1].end.offset-t[i][1].start.offset>1&&t[r][1].end.offset-t[r][1].start.offset>1?2:1;const y={...t[i][1].end},b={...t[r][1].start};D1(y,-p),D1(b,p),f={type:p>1?"strongSequence":"emphasisSequence",start:y,end:{...t[i][1].end}},m={type:p>1?"strongSequence":"emphasisSequence",start:{...t[r][1].start},end:b},u={type:p>1?"strongText":"emphasisText",start:{...t[i][1].end},end:{...t[r][1].start}},c={type:p>1?"strong":"emphasis",start:{...f.start},end:{...m.end}},t[i][1].end={...f.start},t[r][1].start={...m.end},d=[],t[i][1].end.offset-t[i][1].start.offset&&(d=sl(d,[["enter",t[i][1],l],["exit",t[i][1],l]])),d=sl(d,[["enter",c,l],["enter",f,l],["exit",f,l],["enter",u,l]]),d=sl(d,Mc(l.parser.constructs.insideSpan.null,t.slice(i+1,r),l)),d=sl(d,[["exit",u,l],["enter",m,l],["exit",m,l],["exit",c,l]]),t[r][1].end.offset-t[r][1].start.offset?(g=2,d=sl(d,[["enter",t[r][1],l],["exit",t[r][1],l]])):g=0,Kn(t,i-1,r-i+3,d),r=i+d.length-g-2;break}}for(r=-1;++r<t.length;)t[r][1].type==="attentionSequence"&&(t[r][1].type="data");return t}function nw(t,l){const r=this.parser.constructs.attentionMarkers.null,i=this.previous,c=ii(i);let u;return f;function f(p){return u=p,t.enter("attentionSequence"),m(p)}function m(p){if(p===u)return t.consume(p),m;const d=t.exit("attentionSequence"),g=ii(p),y=!g||g===2&&c||r.includes(p),b=!c||c===2&&g||r.includes(i);return d._open=!!(u===42?y:y&&(c||!b)),d._close=!!(u===42?b:b&&(g||!y)),l(p)}}function D1(t,l){t.column+=l,t.offset+=l,t._bufferIndex+=l}const lw={name:"autolink",tokenize:rw};function rw(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 vn(v)?(t.consume(v),f):v===64?r(v):d(v)}function f(v){return v===43||v===45||v===46||xn(v)?(i=1,m(v)):d(v)}function m(v){return v===58?(t.consume(v),i=0,p):(v===43||v===45||v===46||xn(v))&&i++<32?(t.consume(v),m):(i=0,d(v))}function p(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||vc(v)?r(v):(t.consume(v),p)}function d(v){return v===64?(t.consume(v),g):Gv(v)?(t.consume(v),d):r(v)}function g(v){return xn(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||xn(v))&&i++<63){const j=v===45?b:y;return t.consume(v),j}return r(v)}}const Fs={partial:!0,tokenize:aw};function aw(t,l,r){return i;function i(u){return lt(u)?ut(t,c,"linePrefix")(u):c(u)}function c(u){return u===null||Ue(u)?l(u):r(u)}}const oy={continuation:{tokenize:sw},exit:ow,name:"blockQuote",tokenize:iw};function iw(t,l,r){const i=this;return c;function c(f){if(f===62){const m=i.containerState;return m.open||(t.enter("blockQuote",{_container:!0}),m.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(f),t.exit("blockQuoteMarker"),u}return r(f)}function u(f){return lt(f)?(t.enter("blockQuotePrefixWhitespace"),t.consume(f),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),l):(t.exit("blockQuotePrefix"),l(f))}}function sw(t,l,r){const i=this;return c;function c(f){return lt(f)?ut(t,u,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f):u(f)}function u(f){return t.attempt(oy,l,r)(f)}}function ow(t){t.exit("blockQuote")}const cy={name:"characterEscape",tokenize:cw};function cw(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 uy={name:"characterReference",tokenize:uw};function uw(t,l,r){const i=this;let c=0,u,f;return m;function m(y){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(y),t.exit("characterReferenceMarker"),p}function p(y){return y===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(y),t.exit("characterReferenceMarkerNumeric"),d):(t.enter("characterReferenceValue"),u=31,f=xn,g(y))}function d(y){return y===88||y===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(y),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),u=6,f=Kv,g):(t.enter("characterReferenceValue"),u=7,f=Hd,g(y))}function g(y){if(y===59&&c){const b=t.exit("characterReferenceValue");return f===xn&&!oh(i.sliceSerialize(b))?r(y):(t.enter("characterReferenceMarker"),t.consume(y),t.exit("characterReferenceMarker"),t.exit("characterReference"),l)}return f(y)&&c++<u?(t.consume(y),g):r(y)}}const T1={partial:!0,tokenize:dw},z1={concrete:!0,name:"codeFenced",tokenize:fw};function fw(t,l,r){const i=this,c={partial:!0,tokenize:B};let u=0,f=0,m;return p;function p(T){return d(T)}function d(T){const I=i.events[i.events.length-1];return u=I&&I[1].type==="linePrefix"?I[2].sliceSerialize(I[1],!0).length:0,m=T,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),g(T)}function g(T){return T===m?(f++,t.consume(T),g):f<3?r(T):(t.exit("codeFencedFenceSequence"),lt(T)?ut(t,y,"whitespace")(T):y(T))}function y(T){return T===null||Ue(T)?(t.exit("codeFencedFence"),i.interrupt?l(T):t.check(T1,S,O)(T)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),b(T))}function b(T){return T===null||Ue(T)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),y(T)):lt(T)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),ut(t,v,"whitespace")(T)):T===96&&T===m?r(T):(t.consume(T),b)}function v(T){return T===null||Ue(T)?y(T):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),j(T))}function j(T){return T===null||Ue(T)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),y(T)):T===96&&T===m?r(T):(t.consume(T),j)}function S(T){return t.attempt(c,O,C)(T)}function C(T){return t.enter("lineEnding"),t.consume(T),t.exit("lineEnding"),E}function E(T){return u>0&&lt(T)?ut(t,A,"linePrefix",u+1)(T):A(T)}function A(T){return T===null||Ue(T)?t.check(T1,S,O)(T):(t.enter("codeFlowValue"),R(T))}function R(T){return T===null||Ue(T)?(t.exit("codeFlowValue"),A(T)):(t.consume(T),R)}function O(T){return t.exit("codeFenced"),l(T)}function B(T,I,X){let ee=0;return z;function z(V){return T.enter("lineEnding"),T.consume(V),T.exit("lineEnding"),$}function $(V){return T.enter("codeFencedFence"),lt(V)?ut(T,U,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(V):U(V)}function U(V){return V===m?(T.enter("codeFencedFenceSequence"),ne(V)):X(V)}function ne(V){return V===m?(ee++,T.consume(V),ne):ee>=f?(T.exit("codeFencedFenceSequence"),lt(V)?ut(T,re,"whitespace")(V):re(V)):X(V)}function re(V){return V===null||Ue(V)?(T.exit("codeFencedFence"),I(V)):X(V)}}}function dw(t,l,r){const i=this;return c;function c(f){return f===null?r(f):(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),u)}function u(f){return i.parser.lazy[i.now().line]?r(f):l(f)}}const td={name:"codeIndented",tokenize:mw},hw={partial:!0,tokenize:xw};function mw(t,l,r){const i=this;return c;function c(d){return t.enter("codeIndented"),ut(t,u,"linePrefix",5)(d)}function u(d){const g=i.events[i.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?f(d):r(d)}function f(d){return d===null?p(d):Ue(d)?t.attempt(hw,f,p)(d):(t.enter("codeFlowValue"),m(d))}function m(d){return d===null||Ue(d)?(t.exit("codeFlowValue"),f(d)):(t.consume(d),m)}function p(d){return t.exit("codeIndented"),l(d)}}function xw(t,l,r){const i=this;return c;function c(f){return i.parser.lazy[i.now().line]?r(f):Ue(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),c):ut(t,u,"linePrefix",5)(f)}function u(f){const m=i.events[i.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?l(f):Ue(f)?c(f):r(f)}}const pw={name:"codeText",previous:gw,resolve:yw,tokenize:bw};function yw(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 gw(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function bw(t,l,r){let i=0,c,u;return f;function f(y){return t.enter("codeText"),t.enter("codeTextSequence"),m(y)}function m(y){return y===96?(t.consume(y),i++,m):(t.exit("codeTextSequence"),p(y))}function p(y){return y===null?r(y):y===32?(t.enter("space"),t.consume(y),t.exit("space"),p):y===96?(u=t.enter("codeTextSequence"),c=0,g(y)):Ue(y)?(t.enter("lineEnding"),t.consume(y),t.exit("lineEnding"),p):(t.enter("codeTextData"),d(y))}function d(y){return y===null||y===32||y===96||Ue(y)?(t.exit("codeTextData"),p(y)):(t.consume(y),d)}function g(y){return y===96?(t.consume(y),c++,g):c===i?(t.exit("codeTextSequence"),t.exit("codeText"),l(y)):(u.type="codeTextData",d(y))}}class vw{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&&fs(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),fs(this.left,l)}unshift(l){this.setCursor(0),this.right.push(l)}unshiftMany(l){this.setCursor(0),fs(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);fs(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-l,Number.POSITIVE_INFINITY);fs(this.left,r.reverse())}}}function fs(t,l){let r=0;if(l.length<1e4)t.push(...l);else for(;r<l.length;)t.push(...l.slice(r,r+1e4)),r+=1e4}function fy(t){const l={};let r=-1,i,c,u,f,m,p,d;const g=new vw(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"&&(p=i[1]._tokenizer.events,u=0,u<p.length&&p[u][1].type==="lineEndingBlank"&&(u+=2),u<p.length&&p[u][1].type==="content"))for(;++u<p.length&&p[u][1].type!=="content";)p[u][1].type==="chunkText"&&(p[u][1]._isInFirstContentOfListItem=!0,u++);if(i[0]==="enter")i[1].contentType&&(Object.assign(l,ww(g,r)),r=l[r],d=!0);else if(i[1]._container){for(u=r,c=void 0;u--;)if(f=g.get(u),f[1].type==="lineEnding"||f[1].type==="lineEndingBlank")f[0]==="enter"&&(c&&(g.get(c)[1].type="lineEndingBlank"),f[1].type="lineEnding",c=u);else if(!(f[1].type==="linePrefix"||f[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 Kn(t,0,Number.POSITIVE_INFINITY,g.slice(0)),!d}function ww(t,l){const r=t.get(l)[1],i=t.get(l)[2];let c=l-1;const u=[];let f=r._tokenizer;f||(f=i.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(f._contentTypeTextTrailing=!0));const m=f.events,p=[],d={};let g,y,b=-1,v=r,j=0,S=0;const C=[S];for(;v;){for(;t.get(++c)[1]!==v;);u.push(c),v._tokenizer||(g=i.sliceStream(v),v.next||g.push(null),y&&f.defineSkip(v.start),v._isInFirstContentOfListItem&&(f._gfmTasklistFirstContentOfListItem=!0),f.write(g),v._isInFirstContentOfListItem&&(f._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&&(S=b+1,C.push(S),v._tokenizer=void 0,v.previous=void 0,v=v.next);for(f.events=[],v?(v._tokenizer=void 0,v.previous=void 0):C.pop(),b=C.length;b--;){const E=m.slice(C[b],C[b+1]),A=u.pop();p.push([A,A+E.length-1]),t.splice(A,2,E)}for(p.reverse(),b=-1;++b<p.length;)d[j+p[b][0]]=j+p[b][1],j+=p[b][1]-p[b][0]-1;return d}const kw={resolve:jw,tokenize:Cw},Sw={partial:!0,tokenize:Ew};function jw(t){return fy(t),t}function Cw(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):Ue(m)?t.check(Sw,f,u)(m):(t.consume(m),c)}function u(m){return t.exit("chunkContent"),t.exit("content"),l(m)}function f(m){return t.consume(m),t.exit("chunkContent"),r.next=t.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,c}}function Ew(t,l,r){const i=this;return c;function c(f){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),ut(t,u,"linePrefix")}function u(f){if(f===null||Ue(f))return r(f);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(f):t.interrupt(i.parser.constructs.flow,r,l)(f)}}function dy(t,l,r,i,c,u,f,m,p){const d=p||Number.POSITIVE_INFINITY;let g=0;return y;function y(E){return E===60?(t.enter(i),t.enter(c),t.enter(u),t.consume(E),t.exit(u),b):E===null||E===32||E===41||vc(E)?r(E):(t.enter(i),t.enter(f),t.enter(m),t.enter("chunkString",{contentType:"string"}),S(E))}function b(E){return E===62?(t.enter(u),t.consume(E),t.exit(u),t.exit(c),t.exit(i),l):(t.enter(m),t.enter("chunkString",{contentType:"string"}),v(E))}function v(E){return E===62?(t.exit("chunkString"),t.exit(m),b(E)):E===null||E===60||Ue(E)?r(E):(t.consume(E),E===92?j:v)}function j(E){return E===60||E===62||E===92?(t.consume(E),v):v(E)}function S(E){return!g&&(E===null||E===41||Dt(E))?(t.exit("chunkString"),t.exit(m),t.exit(f),t.exit(i),l(E)):g<d&&E===40?(t.consume(E),g++,S):E===41?(t.consume(E),g--,S):E===null||E===32||E===40||vc(E)?r(E):(t.consume(E),E===92?C:S)}function C(E){return E===40||E===41||E===92?(t.consume(E),S):S(E)}}function hy(t,l,r,i,c,u){const f=this;let m=0,p;return d;function d(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&&!p||v===94&&!m&&"_hiddenFootnoteSupport"in f.parser.constructs?r(v):v===93?(t.exit(u),t.enter(c),t.consume(v),t.exit(c),t.exit(i),l):Ue(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||Ue(v)||m++>999?(t.exit("chunkString"),g(v)):(t.consume(v),p||(p=!lt(v)),v===92?b:y)}function b(v){return v===91||v===92||v===93?(t.consume(v),m++,y):y(v)}}function my(t,l,r,i,c,u){let f;return m;function m(b){return b===34||b===39||b===40?(t.enter(i),t.enter(c),t.consume(b),t.exit(c),f=b===40?41:b,p):r(b)}function p(b){return b===f?(t.enter(c),t.consume(b),t.exit(c),t.exit(i),l):(t.enter(u),d(b))}function d(b){return b===f?(t.exit(u),p(f)):b===null?r(b):Ue(b)?(t.enter("lineEnding"),t.consume(b),t.exit("lineEnding"),ut(t,d,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===f||b===null||Ue(b)?(t.exit("chunkString"),d(b)):(t.consume(b),b===92?y:g)}function y(b){return b===f||b===92?(t.consume(b),g):g(b)}}function Ss(t,l){let r;return i;function i(c){return Ue(c)?(t.enter("lineEnding"),t.consume(c),t.exit("lineEnding"),r=!0,i):lt(c)?ut(t,i,r?"linePrefix":"lineSuffix")(c):l(c)}}const Nw={name:"definition",tokenize:Dw},Aw={partial:!0,tokenize:Tw};function Dw(t,l,r){const i=this;let c;return u;function u(v){return t.enter("definition"),f(v)}function f(v){return hy.call(i,t,m,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function m(v){return c=pl(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),v===58?(t.enter("definitionMarker"),t.consume(v),t.exit("definitionMarker"),p):r(v)}function p(v){return Dt(v)?Ss(t,d)(v):d(v)}function d(v){return dy(t,g,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function g(v){return t.attempt(Aw,y,y)(v)}function y(v){return lt(v)?ut(t,b,"whitespace")(v):b(v)}function b(v){return v===null||Ue(v)?(t.exit("definition"),i.parser.defined.push(c),l(v)):r(v)}}function Tw(t,l,r){return i;function i(m){return Dt(m)?Ss(t,c)(m):r(m)}function c(m){return my(t,u,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(m)}function u(m){return lt(m)?ut(t,f,"whitespace")(m):f(m)}function f(m){return m===null||Ue(m)?l(m):r(m)}}const zw={name:"hardBreakEscape",tokenize:Mw};function Mw(t,l,r){return i;function i(u){return t.enter("hardBreakEscape"),t.consume(u),c}function c(u){return Ue(u)?(t.exit("hardBreakEscape"),l(u)):r(u)}}const Rw={name:"headingAtx",resolve:Fw,tokenize:_w};function Fw(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"},Kn(t,i,r-i+1,[["enter",c,l],["enter",u,l],["exit",u,l],["exit",c,l]])),t}function _w(t,l,r){let i=0;return c;function c(g){return t.enter("atxHeading"),u(g)}function u(g){return t.enter("atxHeadingSequence"),f(g)}function f(g){return g===35&&i++<6?(t.consume(g),f):g===null||Dt(g)?(t.exit("atxHeadingSequence"),m(g)):r(g)}function m(g){return g===35?(t.enter("atxHeadingSequence"),p(g)):g===null||Ue(g)?(t.exit("atxHeading"),l(g)):lt(g)?ut(t,m,"whitespace")(g):(t.enter("atxHeadingText"),d(g))}function p(g){return g===35?(t.consume(g),p):(t.exit("atxHeadingSequence"),m(g))}function d(g){return g===null||g===35||Dt(g)?(t.exit("atxHeadingText"),m(g)):(t.consume(g),d)}}const Ow=["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"],M1=["pre","script","style","textarea"],Bw={concrete:!0,name:"htmlFlow",resolveTo:Hw,tokenize:Uw},Lw={partial:!0,tokenize:Yw},$w={partial:!0,tokenize:Iw};function Hw(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 Uw(t,l,r){const i=this;let c,u,f,m,p;return d;function d(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,S):D===63?(t.consume(D),c=3,i.interrupt?l:M):vn(D)?(t.consume(D),f=String.fromCharCode(D),C):r(D)}function b(D){return D===45?(t.consume(D),c=2,v):D===91?(t.consume(D),c=5,m=0,j):vn(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 j(D){const pe="CDATA[";return D===pe.charCodeAt(m++)?(t.consume(D),m===pe.length?i.interrupt?l:U:j):r(D)}function S(D){return vn(D)?(t.consume(D),f=String.fromCharCode(D),C):r(D)}function C(D){if(D===null||D===47||D===62||Dt(D)){const pe=D===47,Ce=f.toLowerCase();return!pe&&!u&&M1.includes(Ce)?(c=1,i.interrupt?l(D):U(D)):Ow.includes(f.toLowerCase())?(c=6,pe?(t.consume(D),E):i.interrupt?l(D):U(D)):(c=7,i.interrupt&&!i.parser.lazy[i.now().line]?r(D):u?A(D):R(D))}return D===45||xn(D)?(t.consume(D),f+=String.fromCharCode(D),C):r(D)}function E(D){return D===62?(t.consume(D),i.interrupt?l:U):r(D)}function A(D){return lt(D)?(t.consume(D),A):z(D)}function R(D){return D===47?(t.consume(D),z):D===58||D===95||vn(D)?(t.consume(D),O):lt(D)?(t.consume(D),R):z(D)}function O(D){return D===45||D===46||D===58||D===95||xn(D)?(t.consume(D),O):B(D)}function B(D){return D===61?(t.consume(D),T):lt(D)?(t.consume(D),B):R(D)}function T(D){return D===null||D===60||D===61||D===62||D===96?r(D):D===34||D===39?(t.consume(D),p=D,I):lt(D)?(t.consume(D),T):X(D)}function I(D){return D===p?(t.consume(D),p=null,ee):D===null||Ue(D)?r(D):(t.consume(D),I)}function X(D){return D===null||D===34||D===39||D===47||D===60||D===61||D===62||D===96||Dt(D)?B(D):(t.consume(D),X)}function ee(D){return D===47||D===62||lt(D)?R(D):r(D)}function z(D){return D===62?(t.consume(D),$):r(D)}function $(D){return D===null||Ue(D)?U(D):lt(D)?(t.consume(D),$):r(D)}function U(D){return D===45&&c===2?(t.consume(D),Y):D===60&&c===1?(t.consume(D),Q):D===62&&c===4?(t.consume(D),_):D===63&&c===3?(t.consume(D),M):D===93&&c===5?(t.consume(D),ve):Ue(D)&&(c===6||c===7)?(t.exit("htmlFlowData"),t.check(Lw,J,ne)(D)):D===null||Ue(D)?(t.exit("htmlFlowData"),ne(D)):(t.consume(D),U)}function ne(D){return t.check($w,re,J)(D)}function re(D){return t.enter("lineEnding"),t.consume(D),t.exit("lineEnding"),V}function V(D){return D===null||Ue(D)?ne(D):(t.enter("htmlFlowData"),U(D))}function Y(D){return D===45?(t.consume(D),M):U(D)}function Q(D){return D===47?(t.consume(D),f="",se):U(D)}function se(D){if(D===62){const pe=f.toLowerCase();return M1.includes(pe)?(t.consume(D),_):U(D)}return vn(D)&&f.length<8?(t.consume(D),f+=String.fromCharCode(D),se):U(D)}function ve(D){return D===93?(t.consume(D),M):U(D)}function M(D){return D===62?(t.consume(D),_):D===45&&c===2?(t.consume(D),M):U(D)}function _(D){return D===null||Ue(D)?(t.exit("htmlFlowData"),J(D)):(t.consume(D),_)}function J(D){return t.exit("htmlFlow"),l(D)}}function Iw(t,l,r){const i=this;return c;function c(f){return Ue(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),u):r(f)}function u(f){return i.parser.lazy[i.now().line]?r(f):l(f)}}function Yw(t,l,r){return i;function i(c){return t.enter("lineEnding"),t.consume(c),t.exit("lineEnding"),t.attempt(Fs,l,r)}}const qw={name:"htmlText",tokenize:Xw};function Xw(t,l,r){const i=this;let c,u,f;return m;function m(M){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(M),p}function p(M){return M===33?(t.consume(M),d):M===47?(t.consume(M),B):M===63?(t.consume(M),R):vn(M)?(t.consume(M),X):r(M)}function d(M){return M===45?(t.consume(M),g):M===91?(t.consume(M),u=0,j):vn(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):Ue(M)?(f=y,Q(M)):(t.consume(M),y)}function b(M){return M===45?(t.consume(M),v):y(M)}function v(M){return M===62?Y(M):M===45?b(M):y(M)}function j(M){const _="CDATA[";return M===_.charCodeAt(u++)?(t.consume(M),u===_.length?S:j):r(M)}function S(M){return M===null?r(M):M===93?(t.consume(M),C):Ue(M)?(f=S,Q(M)):(t.consume(M),S)}function C(M){return M===93?(t.consume(M),E):S(M)}function E(M){return M===62?Y(M):M===93?(t.consume(M),E):S(M)}function A(M){return M===null||M===62?Y(M):Ue(M)?(f=A,Q(M)):(t.consume(M),A)}function R(M){return M===null?r(M):M===63?(t.consume(M),O):Ue(M)?(f=R,Q(M)):(t.consume(M),R)}function O(M){return M===62?Y(M):R(M)}function B(M){return vn(M)?(t.consume(M),T):r(M)}function T(M){return M===45||xn(M)?(t.consume(M),T):I(M)}function I(M){return Ue(M)?(f=I,Q(M)):lt(M)?(t.consume(M),I):Y(M)}function X(M){return M===45||xn(M)?(t.consume(M),X):M===47||M===62||Dt(M)?ee(M):r(M)}function ee(M){return M===47?(t.consume(M),Y):M===58||M===95||vn(M)?(t.consume(M),z):Ue(M)?(f=ee,Q(M)):lt(M)?(t.consume(M),ee):Y(M)}function z(M){return M===45||M===46||M===58||M===95||xn(M)?(t.consume(M),z):$(M)}function $(M){return M===61?(t.consume(M),U):Ue(M)?(f=$,Q(M)):lt(M)?(t.consume(M),$):ee(M)}function U(M){return M===null||M===60||M===61||M===62||M===96?r(M):M===34||M===39?(t.consume(M),c=M,ne):Ue(M)?(f=U,Q(M)):lt(M)?(t.consume(M),U):(t.consume(M),re)}function ne(M){return M===c?(t.consume(M),c=void 0,V):M===null?r(M):Ue(M)?(f=ne,Q(M)):(t.consume(M),ne)}function re(M){return M===null||M===34||M===39||M===60||M===61||M===96?r(M):M===47||M===62||Dt(M)?ee(M):(t.consume(M),re)}function V(M){return M===47||M===62||Dt(M)?ee(M):r(M)}function Y(M){return M===62?(t.consume(M),t.exit("htmlTextData"),t.exit("htmlText"),l):r(M)}function Q(M){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(M),t.exit("lineEnding"),se}function se(M){return lt(M)?ut(t,ve,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):ve(M)}function ve(M){return t.enter("htmlTextData"),f(M)}}const ch={name:"labelEnd",resolveAll:Qw,resolveTo:Ww,tokenize:Zw},Vw={tokenize:Jw},Gw={tokenize:Pw},Kw={tokenize:e5};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&&Kn(t,0,t.length,r),t}function Ww(t,l){let r=t.length,i=0,c,u,f,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(f){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"&&(f=r);const p={type:t[u][1].type==="labelLink"?"link":"image",start:{...t[u][1].start},end:{...t[t.length-1][1].end}},d={type:"label",start:{...t[u][1].start},end:{...t[f][1].end}},g={type:"labelText",start:{...t[u+i+2][1].end},end:{...t[f-2][1].start}};return m=[["enter",p,l],["enter",d,l]],m=sl(m,t.slice(u+1,u+i+3)),m=sl(m,[["enter",g,l]]),m=sl(m,Mc(l.parser.constructs.insideSpan.null,t.slice(u+i+4,f-3),l)),m=sl(m,[["exit",g,l],t[f-2],t[f-1],["exit",d,l]]),m=sl(m,t.slice(f+1)),m=sl(m,[["exit",p,l]]),Kn(t,u,t.length,m),t}function Zw(t,l,r){const i=this;let c=i.events.length,u,f;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):(f=i.parser.defined.includes(pl(i.sliceSerialize({start:u.end,end:i.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(b),t.exit("labelMarker"),t.exit("labelEnd"),p):r(b)}function p(b){return b===40?t.attempt(Vw,g,f?g:y)(b):b===91?t.attempt(Gw,g,f?d:y)(b):f?g(b):y(b)}function d(b){return t.attempt(Kw,g,y)(b)}function g(b){return l(b)}function y(b){return u._balanced=!0,r(b)}}function Jw(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 Dt(y)?Ss(t,u)(y):u(y)}function u(y){return y===41?g(y):dy(t,f,m,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(y)}function f(y){return Dt(y)?Ss(t,p)(y):g(y)}function m(y){return r(y)}function p(y){return y===34||y===39||y===40?my(t,d,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(y):g(y)}function d(y){return Dt(y)?Ss(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 Pw(t,l,r){const i=this;return c;function c(m){return hy.call(i,t,u,f,"reference","referenceMarker","referenceString")(m)}function u(m){return i.parser.defined.includes(pl(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?l(m):r(m)}function f(m){return r(m)}}function e5(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 t5={name:"labelStartImage",resolveAll:ch.resolveAll,tokenize:n5};function n5(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"),f):r(m)}function f(m){return m===94&&"_hiddenFootnoteSupport"in i.parser.constructs?r(m):l(m)}}const l5={name:"labelStartLink",resolveAll:ch.resolveAll,tokenize:r5};function r5(t,l,r){const i=this;return c;function c(f){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(f),t.exit("labelMarker"),t.exit("labelLink"),u}function u(f){return f===94&&"_hiddenFootnoteSupport"in i.parser.constructs?r(f):l(f)}}const nd={name:"lineEnding",tokenize:a5};function a5(t,l){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),ut(t,l,"linePrefix")}}const mc={name:"thematicBreak",tokenize:i5};function i5(t,l,r){let i=0,c;return u;function u(d){return t.enter("thematicBreak"),f(d)}function f(d){return c=d,m(d)}function m(d){return d===c?(t.enter("thematicBreakSequence"),p(d)):i>=3&&(d===null||Ue(d))?(t.exit("thematicBreak"),l(d)):r(d)}function p(d){return d===c?(t.consume(d),i++,p):(t.exit("thematicBreakSequence"),lt(d)?ut(t,m,"whitespace")(d):m(d))}}const Fn={continuation:{tokenize:u5},exit:d5,name:"list",tokenize:c5},s5={partial:!0,tokenize:h5},o5={partial:!0,tokenize:f5};function c5(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,f=0;return m;function m(v){const j=i.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(j==="listUnordered"?!i.containerState.marker||v===i.containerState.marker:Hd(v)){if(i.containerState.type||(i.containerState.type=j,t.enter(j,{_container:!0})),j==="listUnordered")return t.enter("listItemPrefix"),v===42||v===45?t.check(mc,r,d)(v):d(v);if(!i.interrupt||v===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),p(v)}return r(v)}function p(v){return Hd(v)&&++f<10?(t.consume(v),p):(!i.interrupt||f<2)&&(i.containerState.marker?v===i.containerState.marker:v===41||v===46)?(t.exit("listItemValue"),d(v)):r(v)}function d(v){return t.enter("listItemMarker"),t.consume(v),t.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||v,t.check(Fs,i.interrupt?r:g,t.attempt(s5,b,y))}function g(v){return i.containerState.initialBlankLine=!0,u++,b(v)}function y(v){return lt(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 u5(t,l,r){const i=this;return i.containerState._closeFlow=void 0,t.check(Fs,c,u);function c(m){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,ut(t,l,"listItemIndent",i.containerState.size+1)(m)}function u(m){return i.containerState.furtherBlankLines||!lt(m)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,f(m)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,t.attempt(o5,l,f)(m))}function f(m){return i.containerState._closeFlow=!0,i.interrupt=void 0,ut(t,t.attempt(Fn,l,r),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(m)}}function f5(t,l,r){const i=this;return ut(t,c,"listItemIndent",i.containerState.size+1);function c(u){const f=i.events[i.events.length-1];return f&&f[1].type==="listItemIndent"&&f[2].sliceSerialize(f[1],!0).length===i.containerState.size?l(u):r(u)}}function d5(t){t.exit(this.containerState.type)}function h5(t,l,r){const i=this;return ut(t,c,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function c(u){const f=i.events[i.events.length-1];return!lt(u)&&f&&f[1].type==="listItemPrefixWhitespace"?l(u):r(u)}}const R1={name:"setextUnderline",resolveTo:m5,tokenize:x5};function m5(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 f={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",f,l]),t.splice(u+1,0,["exit",t[i][1],l]),t[i][1].end={...t[u][1].end}):t[i][1]=f,t.push(["exit",f,l]),t}function x5(t,l,r){const i=this;let c;return u;function u(d){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=d,f(d)):r(d)}function f(d){return t.enter("setextHeadingLineSequence"),m(d)}function m(d){return d===c?(t.consume(d),m):(t.exit("setextHeadingLineSequence"),lt(d)?ut(t,p,"lineSuffix")(d):p(d))}function p(d){return d===null||Ue(d)?(t.exit("setextHeadingLine"),l(d)):r(d)}}const p5={tokenize:y5};function y5(t){const l=this,r=t.attempt(Fs,i,t.attempt(this.parser.constructs.flowInitial,c,ut(t,t.attempt(this.parser.constructs.flow,c,t.attempt(kw,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 g5={resolveAll:py()},b5=xy("string"),v5=xy("text");function xy(t){return{resolveAll:py(t==="text"?w5:void 0),tokenize:l};function l(r){const i=this,c=this.parser.constructs[t],u=r.attempt(c,f,m);return f;function f(g){return d(g)?u(g):m(g)}function m(g){if(g===null){r.consume(g);return}return r.enter("data"),r.consume(g),p}function p(g){return d(g)?(r.exit("data"),u(g)):(r.consume(g),p)}function d(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 py(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 w5(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,f=-1,m=0,p;for(;u--;){const d=c[u];if(typeof d=="string"){for(f=d.length;d.charCodeAt(f-1)===32;)m++,f--;if(f)break;f=-1}else if(d===-2)p=!0,m++;else if(d!==-1){u++;break}}if(l._contentTypeTextTrailing&&r===t.length&&(m=0),m){const d={type:r===t.length||p||m<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?f:i.start._bufferIndex+f,_index:i.start._index+u,line:i.end.line,column:i.end.column-m,offset:i.end.offset-m},end:{...i.end}};i.end={...d.start},i.start.offset===i.end.offset?Object.assign(i,d):(t.splice(r,0,["enter",d,l],["exit",d,l]),r+=2)}r++}return t}const k5={42:Fn,43:Fn,45:Fn,48:Fn,49:Fn,50:Fn,51:Fn,52:Fn,53:Fn,54:Fn,55:Fn,56:Fn,57:Fn,62:oy},S5={91:Nw},j5={[-2]:td,[-1]:td,32:td},C5={35:Rw,42:mc,45:[R1,mc],60:Bw,61:R1,95:mc,96:z1,126:z1},E5={38:uy,92:cy},N5={[-5]:nd,[-4]:nd,[-3]:nd,33:t5,38:uy,42:Ud,60:[lw,qw],91:l5,92:[zw,cy],93:ch,95:Ud,96:pw},A5={null:[Ud,g5]},D5={null:[42,95]},T5={null:[]},z5=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:D5,contentInitial:S5,disable:T5,document:k5,flow:C5,flowInitial:j5,insideSpan:A5,string:E5,text:N5},Symbol.toStringTag,{value:"Module"}));function M5(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 f=[],m=[];const p={attempt:I(B),check:I(T),consume:A,enter:R,exit:O,interrupt:I(T,{interrupt:!0})},d={code:null,containerState:{},defineSkip:S,events:[],now:j,parser:t,previous:null,sliceSerialize:b,sliceStream:v,write:y};let g=l.tokenize.call(d,p);return l.resolveAll&&u.push(l),d;function y($){return f=sl(f,$),C(),f[f.length-1]!==null?[]:(X(l,0),d.events=Mc(u,d.events,d),d.events)}function b($,U){return F5(v($),U)}function v($){return R5(f,$)}function j(){const{_bufferIndex:$,_index:U,line:ne,column:re,offset:V}=i;return{_bufferIndex:$,_index:U,line:ne,column:re,offset:V}}function S($){c[$.line]=$.column,z()}function C(){let $;for(;i._index<f.length;){const U=f[i._index];if(typeof U=="string")for($=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===$&&i._bufferIndex<U.length;)E(U.charCodeAt(i._bufferIndex));else E(U)}}function E($){g=g($)}function A($){Ue($)?(i.line++,i.column=1,i.offset+=$===-3?2:1,z()):$!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===f[i._index].length&&(i._bufferIndex=-1,i._index++)),d.previous=$}function R($,U){const ne=U||{};return ne.type=$,ne.start=j(),d.events.push(["enter",ne,d]),m.push(ne),ne}function O($){const U=m.pop();return U.end=j(),d.events.push(["exit",U,d]),U}function B($,U){X($,U.from)}function T($,U){U.restore()}function I($,U){return ne;function ne(re,V,Y){let Q,se,ve,M;return Array.isArray(re)?J(re):"tokenize"in re?J([re]):_(re);function _(Ne){return He;function He(_e){const oe=_e!==null&&Ne[_e],K=_e!==null&&Ne.null,fe=[...Array.isArray(oe)?oe:oe?[oe]:[],...Array.isArray(K)?K:K?[K]:[]];return J(fe)(_e)}}function J(Ne){return Q=Ne,se=0,Ne.length===0?Y:D(Ne[se])}function D(Ne){return He;function He(_e){return M=ee(),ve=Ne,Ne.partial||(d.currentConstruct=Ne),Ne.name&&d.parser.constructs.disable.null.includes(Ne.name)?Ce():Ne.tokenize.call(U?Object.assign(Object.create(d),U):d,p,pe,Ce)(_e)}}function pe(Ne){return $(ve,M),V}function Ce(Ne){return M.restore(),++se<Q.length?D(Q[se]):Y}}}function X($,U){$.resolveAll&&!u.includes($)&&u.push($),$.resolve&&Kn(d.events,U,d.events.length-U,$.resolve(d.events.slice(U),d)),$.resolveTo&&(d.events=$.resolveTo(d.events,d))}function ee(){const $=j(),U=d.previous,ne=d.currentConstruct,re=d.events.length,V=Array.from(m);return{from:re,restore:Y};function Y(){i=$,d.previous=U,d.currentConstruct=ne,d.events.length=re,m=V,z()}}function z(){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 f;if(r===c)f=[t[r].slice(i,u)];else{if(f=t.slice(r,c),i>-1){const m=f[0];typeof m=="string"?f[0]=m.slice(i):f.shift()}u>0&&f.push(t[c].slice(0,u))}return f}function F5(t,l){let r=-1;const i=[];let c;for(;++r<t.length;){const u=t[r];let f;if(typeof u=="string")f=u;else switch(u){case-5:{f="\r";break}case-4:{f=`
52
- `;break}case-3:{f=`\r
53
- `;break}case-2:{f=l?" ":" ";break}case-1:{if(!l&&c)continue;f=" ";break}default:f=String.fromCharCode(u)}c=u===-2,i.push(f)}return i.join("")}function _5(t){const i={constructs:iy([z5,...(t||{}).extensions||[]]),content:c(Wv),defined:[],document:c(Jv),flow:c(p5),lazy:{},string:c(b5),text:c(v5)};return i;function c(u){return f;function f(m){return M5(i,u,m)}}}function O5(t){for(;!fy(t););return t}const F1=/[\0\t\n\r]/g;function B5(){let t=1,l="",r=!0,i;return c;function c(u,f,m){const p=[];let d,g,y,b,v;for(u=l+(typeof u=="string"?u.toString():new TextDecoder(f||void 0).decode(u)),y=0,l="",r&&(u.charCodeAt(0)===65279&&y++,r=void 0);y<u.length;){if(F1.lastIndex=y,d=F1.exec(u),b=d&&d.index!==void 0?d.index:u.length,v=u.charCodeAt(b),!d){l=u.slice(y);break}if(v===10&&y===b&&i)p.push(-3),i=void 0;else switch(i&&(p.push(-5),i=void 0),y<b&&(p.push(u.slice(y,b)),t+=b-y),v){case 0:{p.push(65533),t++;break}case 9:{for(g=Math.ceil(t/4)*4,p.push(-2);t++<g;)p.push(-1);break}case 10:{p.push(-4),t=1;break}default:i=!0,t=1}y=b+1}return m&&(i&&p.push(-5),l&&p.push(l),p.push(null)),p}}const L5=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function $5(t){return t.replace(L5,H5)}function H5(t,l,r){if(l)return l;if(r.charCodeAt(0)===35){const c=r.charCodeAt(1),u=c===120||c===88;return sy(r.slice(u?2:1),u?16:10)}return oh(r)||t}const yy={}.hasOwnProperty;function U5(t,l,r){return l&&typeof l=="object"&&(r=l,l=void 0),I5(r)(O5(_5(r).document().write(B5()(t,l,!0))))}function I5(t){const l={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(Yt),autolinkProtocol:ee,autolinkEmail:ee,atxHeading:u(je),blockQuote:u(K),characterEscape:ee,characterReference:ee,codeFenced:u(fe),codeFencedFenceInfo:f,codeFencedFenceMeta:f,codeIndented:u(fe,f),codeText:u(Se,f),codeTextData:ee,data:ee,codeFlowValue:ee,definition:u(te),definitionDestinationString:f,definitionLabelString:f,definitionTitleString:f,emphasis:u(ke),hardBreakEscape:u(Te),hardBreakTrailing:u(Te),htmlFlow:u(Le,f),htmlFlowData:ee,htmlText:u(Le,f),htmlTextData:ee,image:u($e),label:f,link:u(Yt),listItem:u(St),listItemValue:b,listOrdered:u(pt,y),listUnordered:u(pt),paragraph:u(Bt),reference:D,referenceString:f,resourceDestinationString:f,resourceTitleString:f,setextHeading:u(je),strong:u(Kt),thematicBreak:u(qt)},exit:{atxHeading:p(),atxHeadingSequence:B,autolink:p(),autolinkEmail:oe,autolinkProtocol:_e,blockQuote:p(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:Ce,characterReferenceMarkerNumeric:Ce,characterReferenceValue:Ne,characterReference:He,codeFenced:p(C),codeFencedFence:S,codeFencedFenceInfo:v,codeFencedFenceMeta:j,codeFlowValue:z,codeIndented:p(E),codeText:p(V),codeTextData:z,data:z,definition:p(),definitionDestinationString:O,definitionLabelString:A,definitionTitleString:R,emphasis:p(),hardBreakEscape:p(U),hardBreakTrailing:p(U),htmlFlow:p(ne),htmlFlowData:z,htmlText:p(re),htmlTextData:z,image:p(Q),label:ve,labelText:se,lineEnding:$,link:p(Y),listItem:p(),listOrdered:p(),listUnordered:p(),paragraph:p(),referenceString:pe,resourceDestinationString:M,resourceTitleString:_,resource:J,setextHeading:p(X),setextHeadingLineSequence:I,setextHeadingText:T,strong:p(),thematicBreak:p()}};gy(l,(t||{}).mdastExtensions||[]);const r={};return i;function i(ae){let ye={type:"root",children:[]};const Re={stack:[ye],tokenStack:[],config:l,enter:m,exit:d,buffer:f,resume:g,data:r},qe=[];let we=-1;for(;++we<ae.length;)if(ae[we][1].type==="listOrdered"||ae[we][1].type==="listUnordered")if(ae[we][0]==="enter")qe.push(we);else{const Ae=qe.pop();we=c(ae,Ae,we)}for(we=-1;++we<ae.length;){const Ae=l[ae[we][0]];yy.call(Ae,ae[we][1].type)&&Ae[ae[we][1].type].call(Object.assign({sliceSerialize:ae[we][2].sliceSerialize},Re),ae[we][1])}if(Re.tokenStack.length>0){const Ae=Re.tokenStack[Re.tokenStack.length-1];(Ae[1]||_1).call(Re,void 0,Ae[0])}for(ye.position={start:Rr(ae.length>0?ae[0][1].start:{line:1,column:1,offset:0}),end:Rr(ae.length>0?ae[ae.length-2][1].end:{line:1,column:1,offset:0})},we=-1;++we<l.transforms.length;)ye=l.transforms[we](ye)||ye;return ye}function c(ae,ye,Re){let qe=ye-1,we=-1,Ae=!1,bt,rt,de,Pe;for(;++qe<=Re;){const dt=ae[qe];switch(dt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{dt[0]==="enter"?we++:we--,Pe=void 0;break}case"lineEndingBlank":{dt[0]==="enter"&&(bt&&!Pe&&!we&&!de&&(de=qe),Pe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Pe=void 0}if(!we&&dt[0]==="enter"&&dt[1].type==="listItemPrefix"||we===-1&&dt[0]==="exit"&&(dt[1].type==="listUnordered"||dt[1].type==="listOrdered")){if(bt){let dn=qe;for(rt=void 0;dn--;){const et=ae[dn];if(et[1].type==="lineEnding"||et[1].type==="lineEndingBlank"){if(et[0]==="exit")continue;rt&&(ae[rt][1].type="lineEndingBlank",Ae=!0),et[1].type="lineEnding",rt=dn}else if(!(et[1].type==="linePrefix"||et[1].type==="blockQuotePrefix"||et[1].type==="blockQuotePrefixWhitespace"||et[1].type==="blockQuoteMarker"||et[1].type==="listItemIndent"))break}de&&(!rt||de<rt)&&(bt._spread=!0),bt.end=Object.assign({},rt?ae[rt][1].start:dt[1].end),ae.splice(rt||qe,0,["exit",bt,dt[2]]),qe++,Re++}if(dt[1].type==="listItemPrefix"){const dn={type:"listItem",_spread:!1,start:Object.assign({},dt[1].start),end:void 0};bt=dn,ae.splice(qe,0,["enter",dn,dt[2]]),qe++,Re++,de=void 0,Pe=!0}}}return ae[ye][1]._spread=Ae,Re}function u(ae,ye){return Re;function Re(qe){m.call(this,ae(qe),qe),ye&&ye.call(this,qe)}}function f(){this.stack.push({type:"fragment",children:[]})}function m(ae,ye,Re){this.stack[this.stack.length-1].children.push(ae),this.stack.push(ae),this.tokenStack.push([ye,Re||void 0]),ae.position={start:Rr(ye.start),end:void 0}}function p(ae){return ye;function ye(Re){ae&&ae.call(this,Re),d.call(this,Re)}}function d(ae,ye){const Re=this.stack.pop(),qe=this.tokenStack.pop();if(qe)qe[0].type!==ae.type&&(ye?ye.call(this,ae,qe[0]):(qe[1]||_1).call(this,ae,qe[0]));else throw new Error("Cannot close `"+ae.type+"` ("+ks({start:ae.start,end:ae.end})+"): it’s not open");Re.position.end=Rr(ae.end)}function g(){return sh(this.stack.pop())}function y(){this.data.expectingFirstListItemValue=!0}function b(ae){if(this.data.expectingFirstListItemValue){const ye=this.stack[this.stack.length-2];ye.start=Number.parseInt(this.sliceSerialize(ae),10),this.data.expectingFirstListItemValue=void 0}}function v(){const ae=this.resume(),ye=this.stack[this.stack.length-1];ye.lang=ae}function j(){const ae=this.resume(),ye=this.stack[this.stack.length-1];ye.meta=ae}function S(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const ae=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ae.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function E(){const ae=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ae.replace(/(\r?\n|\r)$/g,"")}function A(ae){const ye=this.resume(),Re=this.stack[this.stack.length-1];Re.label=ye,Re.identifier=pl(this.sliceSerialize(ae)).toLowerCase()}function R(){const ae=this.resume(),ye=this.stack[this.stack.length-1];ye.title=ae}function O(){const ae=this.resume(),ye=this.stack[this.stack.length-1];ye.url=ae}function B(ae){const ye=this.stack[this.stack.length-1];if(!ye.depth){const Re=this.sliceSerialize(ae).length;ye.depth=Re}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function I(ae){const ye=this.stack[this.stack.length-1];ye.depth=this.sliceSerialize(ae).codePointAt(0)===61?1:2}function X(){this.data.setextHeadingSlurpLineEnding=void 0}function ee(ae){const Re=this.stack[this.stack.length-1].children;let qe=Re[Re.length-1];(!qe||qe.type!=="text")&&(qe=vt(),qe.position={start:Rr(ae.start),end:void 0},Re.push(qe)),this.stack.push(qe)}function z(ae){const ye=this.stack.pop();ye.value+=this.sliceSerialize(ae),ye.position.end=Rr(ae.end)}function $(ae){const ye=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Re=ye.children[ye.children.length-1];Re.position.end=Rr(ae.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&l.canContainEols.includes(ye.type)&&(ee.call(this,ae),z.call(this,ae))}function U(){this.data.atHardBreak=!0}function ne(){const ae=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ae}function re(){const ae=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ae}function V(){const ae=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ae}function Y(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=ye,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function Q(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=ye,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function se(ae){const ye=this.sliceSerialize(ae),Re=this.stack[this.stack.length-2];Re.label=$5(ye),Re.identifier=pl(ye).toLowerCase()}function ve(){const ae=this.stack[this.stack.length-1],ye=this.resume(),Re=this.stack[this.stack.length-1];if(this.data.inReference=!0,Re.type==="link"){const qe=ae.children;Re.children=qe}else Re.alt=ye}function M(){const ae=this.resume(),ye=this.stack[this.stack.length-1];ye.url=ae}function _(){const ae=this.resume(),ye=this.stack[this.stack.length-1];ye.title=ae}function J(){this.data.inReference=void 0}function D(){this.data.referenceType="collapsed"}function pe(ae){const ye=this.resume(),Re=this.stack[this.stack.length-1];Re.label=ye,Re.identifier=pl(this.sliceSerialize(ae)).toLowerCase(),this.data.referenceType="full"}function Ce(ae){this.data.characterReferenceType=ae.type}function Ne(ae){const ye=this.sliceSerialize(ae),Re=this.data.characterReferenceType;let qe;Re?(qe=sy(ye,Re==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):qe=oh(ye);const we=this.stack[this.stack.length-1];we.value+=qe}function He(ae){const ye=this.stack.pop();ye.position.end=Rr(ae.end)}function _e(ae){z.call(this,ae);const ye=this.stack[this.stack.length-1];ye.url=this.sliceSerialize(ae)}function oe(ae){z.call(this,ae);const ye=this.stack[this.stack.length-1];ye.url="mailto:"+this.sliceSerialize(ae)}function K(){return{type:"blockquote",children:[]}}function fe(){return{type:"code",lang:null,meta:null,value:""}}function Se(){return{type:"inlineCode",value:""}}function te(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ke(){return{type:"emphasis",children:[]}}function je(){return{type:"heading",depth:0,children:[]}}function Te(){return{type:"break"}}function Le(){return{type:"html",value:""}}function $e(){return{type:"image",title:null,url:"",alt:null}}function Yt(){return{type:"link",title:null,url:"",children:[]}}function pt(ae){return{type:"list",ordered:ae.type==="listOrdered",start:null,spread:ae._spread,children:[]}}function St(ae){return{type:"listItem",spread:ae._spread,checked:null,children:[]}}function Bt(){return{type:"paragraph",children:[]}}function Kt(){return{type:"strong",children:[]}}function vt(){return{type:"text",value:""}}function qt(){return{type:"thematicBreak"}}}function Rr(t){return{line:t.line,column:t.column,offset:t.offset}}function gy(t,l){let r=-1;for(;++r<l.length;){const i=l[r];Array.isArray(i)?gy(t,i):Y5(t,i)}}function Y5(t,l){let r;for(r in l)if(yy.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 _1(t,l){throw t?new Error("Cannot close `"+t.type+"` ("+ks({start:t.start,end:t.end})+"): a different token (`"+l.type+"`, "+ks({start:l.start,end:l.end})+") is open"):new Error("Cannot close document, a token (`"+l.type+"`, "+ks({start:l.start,end:l.end})+") is still open")}function q5(t){const l=this;l.parser=r;function r(i){return U5(i,{...l.data("settings"),...t,extensions:l.data("micromarkExtensions")||[],mdastExtensions:l.data("fromMarkdownExtensions")||[]})}}function X5(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 V5(t,l){const r={type:"element",tagName:"br",properties:{},children:[]};return t.patch(l,r),[t.applyData(l,r),{type:"text",value:`
54
- `}]}function G5(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 K5(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 W5(t,l){const r=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",i=String(l.identifier).toUpperCase(),c=ui(i.toLowerCase()),u=t.footnoteOrder.indexOf(i);let f,m=t.footnoteCounts.get(i);m===void 0?(m=0,t.footnoteOrder.push(i),f=t.footnoteOrder.length):f=u+1,m+=1,t.footnoteCounts.set(i,m);const p={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(f)}]};t.patch(l,p);const d={type:"element",tagName:"sup",properties:{},children:[p]};return t.patch(l,d),t.applyData(l,d)}function Z5(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 J5(t,l){if(t.options.allowDangerousHtml){const r={type:"raw",value:l.value};return t.patch(l,r),t.applyData(l,r)}}function by(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 f=c[c.length-1];return f&&f.type==="text"?f.value+=i:c.push({type:"text",value:i}),c}function P5(t,l){const r=String(l.identifier).toUpperCase(),i=t.definitionById.get(r);if(!i)return by(t,l);const c={src:ui(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 e3(t,l){const r={src:ui(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 t3(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 n3(t,l){const r=String(l.identifier).toUpperCase(),i=t.definitionById.get(r);if(!i)return by(t,l);const c={href:ui(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 l3(t,l){const r={href:ui(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 r3(t,l,r){const i=t.all(l),c=r?a3(r):vy(l),u={},f=[];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")&&f.push({type:"text",value:`
56
- `}),g.type==="element"&&g.tagName==="p"&&!c?f.push(...g.children):f.push(g)}const p=i[i.length-1];p&&(c||p.type!=="element"||p.tagName!=="p")&&f.push({type:"text",value:`
57
- `});const d={type:"element",tagName:"li",properties:u,children:f};return t.patch(l,d),t.applyData(l,d)}function a3(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=vy(r[i])}return l}function vy(t){const l=t.spread;return l??t.children.length>1}function i3(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 f=i[c];if(f.type==="element"&&f.tagName==="li"&&f.properties&&Array.isArray(f.properties.className)&&f.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 s3(t,l){const r={type:"element",tagName:"p",properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}function o3(t,l){const r={type:"root",children:t.wrap(t.all(l))};return t.patch(l,r),t.applyData(l,r)}function c3(t,l){const r={type:"element",tagName:"strong",properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}function u3(t,l){const r=t.all(l),i=r.shift(),c=[];if(i){const f={type:"element",tagName:"thead",properties:{},children:t.wrap([i],!0)};t.patch(l.children[0],f),c.push(f)}if(r.length>0){const f={type:"element",tagName:"tbody",properties:{},children:t.wrap(r,!0)},m=lh(l.children[1]),p=P0(l.children[l.children.length-1]);m&&p&&(f.position={start:m,end:p}),c.push(f)}const u={type:"element",tagName:"table",properties:{},children:t.wrap(c,!0)};return t.patch(l,u),t.applyData(l,u)}function f3(t,l,r){const i=r?r.children:void 0,u=(i?i.indexOf(l):1)===0?"th":"td",f=r&&r.type==="table"?r.align:void 0,m=f?f.length:l.children.length;let p=-1;const d=[];for(;++p<m;){const y=l.children[p],b={},v=f?f[p]:void 0;v&&(b.align=v);let j={type:"element",tagName:u,properties:b,children:[]};y&&(j.children=t.all(y),t.patch(y,j),j=t.applyData(y,j)),d.push(j)}const g={type:"element",tagName:"tr",properties:{},children:t.wrap(d,!0)};return t.patch(l,g),t.applyData(l,g)}function d3(t,l){const r={type:"element",tagName:"td",properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}const O1=9,B1=32;function h3(t){const l=String(t),r=/\r?\n|\r/g;let i=r.exec(l),c=0;const u=[];for(;i;)u.push(L1(l.slice(c,i.index),c>0,!0),i[0]),c=i.index+i[0].length,i=r.exec(l);return u.push(L1(l.slice(c),c>0,!1)),u.join("")}function L1(t,l,r){let i=0,c=t.length;if(l){let u=t.codePointAt(i);for(;u===O1||u===B1;)i++,u=t.codePointAt(i)}if(r){let u=t.codePointAt(c-1);for(;u===O1||u===B1;)c--,u=t.codePointAt(c-1)}return c>i?t.slice(i,c):""}function m3(t,l){const r={type:"text",value:h3(String(l.value))};return t.patch(l,r),t.applyData(l,r)}function x3(t,l){const r={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(l,r),t.applyData(l,r)}const p3={blockquote:X5,break:V5,code:G5,delete:K5,emphasis:Q5,footnoteReference:W5,heading:Z5,html:J5,imageReference:P5,image:e3,inlineCode:t3,linkReference:n3,link:l3,listItem:r3,list:i3,paragraph:s3,root:o3,strong:c3,table:u3,tableCell:d3,tableRow:f3,text:m3,thematicBreak:x3,toml:Jo,yaml:Jo,definition:Jo,footnoteDefinition:Jo};function Jo(){}const wy=-1,Rc=0,js=1,wc=2,uh=3,fh=4,dh=5,hh=6,ky=7,Sy=8,$1=typeof self=="object"?self:globalThis,y3=(t,l)=>{const r=(c,u)=>(t.set(u,c),c),i=c=>{if(t.has(c))return t.get(c);const[u,f]=l[c];switch(u){case Rc:case wy:return r(f,c);case js:{const m=r([],c);for(const p of f)m.push(i(p));return m}case wc:{const m=r({},c);for(const[p,d]of f)m[i(p)]=i(d);return m}case uh:return r(new Date(f),c);case fh:{const{source:m,flags:p}=f;return r(new RegExp(m,p),c)}case dh:{const m=r(new Map,c);for(const[p,d]of f)m.set(i(p),i(d));return m}case hh:{const m=r(new Set,c);for(const p of f)m.add(i(p));return m}case ky:{const{name:m,message:p}=f;return r(new $1[m](p),c)}case Sy:return r(BigInt(f),c);case"BigInt":return r(Object(BigInt(f)),c);case"ArrayBuffer":return r(new Uint8Array(f).buffer,f);case"DataView":{const{buffer:m}=new Uint8Array(f);return r(new DataView(m),f)}}return r(new $1[u](f),c)};return i},H1=t=>y3(new Map,t)(0),ni="",{toString:g3}={},{keys:b3}=Object,ds=t=>{const l=typeof t;if(l!=="object"||!t)return[Rc,l];const r=g3.call(t).slice(8,-1);switch(r){case"Array":return[js,ni];case"Object":return[wc,ni];case"Date":return[uh,ni];case"RegExp":return[fh,ni];case"Map":return[dh,ni];case"Set":return[hh,ni];case"DataView":return[js,r]}return r.includes("Array")?[js,r]:r.includes("Error")?[ky,r]:[wc,r]},Po=([t,l])=>t===Rc&&(l==="function"||l==="symbol"),v3=(t,l,r,i)=>{const c=(f,m)=>{const p=i.push(f)-1;return r.set(m,p),p},u=f=>{if(r.has(f))return r.get(f);let[m,p]=ds(f);switch(m){case Rc:{let g=f;switch(p){case"bigint":m=Sy,g=f.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+p);g=null;break;case"undefined":return c([wy],f)}return c([m,g],f)}case js:{if(p){let b=f;return p==="DataView"?b=new Uint8Array(f.buffer):p==="ArrayBuffer"&&(b=new Uint8Array(f)),c([p,[...b]],f)}const g=[],y=c([m,g],f);for(const b of f)g.push(u(b));return y}case wc:{if(p)switch(p){case"BigInt":return c([p,f.toString()],f);case"Boolean":case"Number":case"String":return c([p,f.valueOf()],f)}if(l&&"toJSON"in f)return u(f.toJSON());const g=[],y=c([m,g],f);for(const b of b3(f))(t||!Po(ds(f[b])))&&g.push([u(b),u(f[b])]);return y}case uh:return c([m,f.toISOString()],f);case fh:{const{source:g,flags:y}=f;return c([m,{source:g,flags:y}],f)}case dh:{const g=[],y=c([m,g],f);for(const[b,v]of f)(t||!(Po(ds(b))||Po(ds(v))))&&g.push([u(b),u(v)]);return y}case hh:{const g=[],y=c([m,g],f);for(const b of f)(t||!Po(ds(b)))&&g.push(u(b));return y}}const{message:d}=f;return c([m,{name:p,message:d}],f)};return u},U1=(t,{json:l,lossy:r}={})=>{const i=[];return v3(!(l||r),!!l,new Map,i)(t),i},kc=typeof structuredClone=="function"?(t,l)=>l&&("json"in l||"lossy"in l)?H1(U1(t,l)):structuredClone(t):(t,l)=>H1(U1(t,l));function w3(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 k3(t,l){return"Back to reference "+(t+1)+(l>1?"-"+l:"")}function S3(t){const l=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=t.options.footnoteBackContent||w3,i=t.options.footnoteBackLabel||k3,c=t.options.footnoteLabel||"Footnotes",u=t.options.footnoteLabelTagName||"h2",f=t.options.footnoteLabelProperties||{className:["sr-only"]},m=[];let p=-1;for(;++p<t.footnoteOrder.length;){const d=t.footnoteById.get(t.footnoteOrder[p]);if(!d)continue;const g=t.all(d),y=String(d.identifier).toUpperCase(),b=ui(y.toLowerCase());let v=0;const j=[],S=t.footnoteCounts.get(y);for(;S!==void 0&&++v<=S;){j.length>0&&j.push({type:"text",value:" "});let A=typeof r=="string"?r:r(p,v);typeof A=="string"&&(A={type:"text",value:A}),j.push({type:"element",tagName:"a",properties:{href:"#"+l+"fnref-"+b+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(p,v),className:["data-footnote-backref"]},children:Array.isArray(A)?A:[A]})}const C=g[g.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const A=C.children[C.children.length-1];A&&A.type==="text"?A.value+=" ":C.children.push({type:"text",value:" "}),C.children.push(...j)}else g.push(...j);const E={type:"element",tagName:"li",properties:{id:l+"fn-"+b},children:t.wrap(g,!0)};t.patch(d,E),m.push(E)}if(m.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...kc(f),id:"footnote-label"},children:[{type:"text",value:c}]},{type:"text",value:`
58
- `},{type:"element",tagName:"ol",properties:{},children:t.wrap(m,!0)},{type:"text",value:`
59
- `}]}}const Fc=(function(t){if(t==null)return N3;if(typeof t=="function")return _c(t);if(typeof t=="object")return Array.isArray(t)?j3(t):C3(t);if(typeof t=="string")return E3(t);throw new Error("Expected function, string, or object as test")});function j3(t){const l=[];let r=-1;for(;++r<t.length;)l[r]=Fc(t[r]);return _c(i);function i(...c){let u=-1;for(;++u<l.length;)if(l[u].apply(this,c))return!0;return!1}}function C3(t){const l=t;return _c(r);function r(i){const c=i;let u;for(u in t)if(c[u]!==l[u])return!1;return!0}}function E3(t){return _c(l);function l(r){return r&&r.type===t}}function _c(t){return l;function l(r,i,c){return!!(A3(r)&&t.call(this,r,typeof i=="number"?i:void 0,c||void 0))}}function N3(){return!0}function A3(t){return t!==null&&typeof t=="object"&&"type"in t}const jy=[],D3=!0,Id=!1,T3="skip";function Cy(t,l,r,i){let c;typeof l=="function"&&typeof r!="function"?(i=r,r=l):c=l;const u=Fc(c),f=i?-1:1;m(t,void 0,[])();function m(p,d,g){const y=p&&typeof p=="object"?p:{};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 ("+(p.type+(v?"<"+v+">":""))+")"})}return b;function b(){let v=jy,j,S,C;if((!l||u(p,d,g[g.length-1]||void 0))&&(v=z3(r(p,g)),v[0]===Id))return v;if("children"in p&&p.children){const E=p;if(E.children&&v[0]!==T3)for(S=(i?E.children.length:-1)+f,C=g.concat(E);S>-1&&S<E.children.length;){const A=E.children[S];if(j=m(A,S,C)(),j[0]===Id)return j;S=typeof j[1]=="number"?j[1]:S+f}}return v}}}function z3(t){return Array.isArray(t)?t:typeof t=="number"?[D3,t]:t==null?jy:[t]}function mh(t,l,r,i){let c,u,f;typeof l=="function"&&typeof r!="function"?(u=void 0,f=l,c=r):(u=l,f=r,c=i),Cy(t,u,m,c);function m(p,d){const g=d[d.length-1],y=g?g.children.indexOf(p):void 0;return f(p,y,g)}}const Yd={}.hasOwnProperty,M3={};function R3(t,l){const r=l||M3,i=new Map,c=new Map,u=new Map,f={...p3,...r.handlers},m={all:d,applyData:_3,definitionById:i,footnoteById:c,footnoteCounts:u,footnoteOrder:[],handlers:f,one:p,options:r,patch:F3,wrap:B3};return mh(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 p(g,y){const b=g.type,v=m.handlers[b];if(Yd.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:S,...C}=g,E=kc(C);return E.children=m.all(g),E}return kc(g)}return(m.options.unknownHandler||O3)(m,g,y)}function d(g){const y=[];if("children"in g){const b=g.children;let v=-1;for(;++v<b.length;){const j=m.one(b[v],g);if(j){if(v&&b[v-1].type==="break"&&(!Array.isArray(j)&&j.type==="text"&&(j.value=I1(j.value)),!Array.isArray(j)&&j.type==="element")){const S=j.children[0];S&&S.type==="text"&&(S.value=I1(S.value))}Array.isArray(j)?y.push(...j):y.push(j)}}}return y}}function F3(t,l){t.position&&(l.position=kv(t))}function _3(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 f="children"in r?r.children:[r];r={type:"element",tagName:i,properties:{},children:f}}r.type==="element"&&u&&Object.assign(r.properties,kc(u)),"children"in r&&r.children&&c!==null&&c!==void 0&&(r.children=c)}return r}function O3(t,l){const r=l.data||{},i="value"in l&&!(Yd.call(r,"hProperties")||Yd.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 B3(t,l){const r=[];let i=-1;for(l&&r.push({type:"text",value:`
60
- `});++i<t.length;)i&&r.push({type:"text",value:`
61
- `}),r.push(t[i]);return l&&t.length>0&&r.push({type:"text",value:`
62
- `}),r}function I1(t){let l=0,r=t.charCodeAt(l);for(;r===9||r===32;)l++,r=t.charCodeAt(l);return t.slice(l)}function Y1(t,l){const r=R3(t,l),i=r.one(t,void 0),c=S3(r),u=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return c&&u.children.push({type:"text",value:`
63
- `},c),u}function L3(t,l){return t&&"run"in t?async function(r,i){const c=Y1(r,{file:i,...l});await t.run(c,i)}:function(r,i){return Y1(r,{file:i,...t||l})}}function q1(t){if(t)throw t}var ld,X1;function $3(){if(X1)return ld;X1=1;var t=Object.prototype.hasOwnProperty,l=Object.prototype.toString,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,c=function(d){return typeof Array.isArray=="function"?Array.isArray(d):l.call(d)==="[object Array]"},u=function(d){if(!d||l.call(d)!=="[object Object]")return!1;var g=t.call(d,"constructor"),y=d.constructor&&d.constructor.prototype&&t.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!g&&!y)return!1;var b;for(b in d);return typeof b>"u"||t.call(d,b)},f=function(d,g){r&&g.name==="__proto__"?r(d,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):d[g.name]=g.newValue},m=function(d,g){if(g==="__proto__")if(t.call(d,g)){if(i)return i(d,g).value}else return;return d[g]};return ld=function p(){var d,g,y,b,v,j,S=arguments[0],C=1,E=arguments.length,A=!1;for(typeof S=="boolean"&&(A=S,S=arguments[1]||{},C=2),(S==null||typeof S!="object"&&typeof S!="function")&&(S={});C<E;++C)if(d=arguments[C],d!=null)for(g in d)y=m(S,g),b=m(d,g),S!==b&&(A&&b&&(u(b)||(v=c(b)))?(v?(v=!1,j=y&&c(y)?y:[]):j=y&&u(y)?y:{},f(S,{name:g,newValue:p(A,j,b)})):typeof b<"u"&&f(S,{name:g,newValue:b}));return S},ld}var H3=$3();const rd=q0(H3);function qd(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 U3(){const t=[],l={run:r,use:i};return l;function r(...c){let u=-1;const f=c.pop();if(typeof f!="function")throw new TypeError("Expected function as last argument, not "+f);m(null,...c);function m(p,...d){const g=t[++u];let y=-1;if(p){f(p);return}for(;++y<c.length;)(d[y]===null||d[y]===void 0)&&(d[y]=c[y]);c=d,g?I3(g,m)(...d):f(null,...d)}}function i(c){if(typeof c!="function")throw new TypeError("Expected `middelware` to be a function, not "+c);return t.push(c),l}}function I3(t,l){let r;return i;function i(...f){const m=t.length>f.length;let p;m&&f.push(c);try{p=t.apply(this,f)}catch(d){const g=d;if(m&&r)throw g;return c(g)}m||(p&&p.then&&typeof p.then=="function"?p.then(u,c):p instanceof Error?c(p):u(p))}function c(f,...m){r||(r=!0,l(f,...m))}function u(f){c(null,f)}}const Cl={basename:Y3,dirname:q3,extname:X3,join:V3,sep:"/"};function Y3(t,l){if(l!==void 0&&typeof l!="string")throw new TypeError('"ext" argument must be a string');_s(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 f=-1,m=l.length-1;for(;c--;)if(t.codePointAt(c)===47){if(u){r=c+1;break}}else f<0&&(u=!0,f=c+1),m>-1&&(t.codePointAt(c)===l.codePointAt(m--)?m<0&&(i=c):(m=-1,i=f));return r===i?i=f:i<0&&(i=t.length),t.slice(r,i)}function q3(t){if(_s(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 X3(t){_s(t);let l=t.length,r=-1,i=0,c=-1,u=0,f;for(;l--;){const m=t.codePointAt(l);if(m===47){if(f){i=l+1;break}continue}r<0&&(f=!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 V3(...t){let l=-1,r;for(;++l<t.length;)_s(t[l]),t[l]&&(r=r===void 0?t[l]:r+"/"+t[l]);return r===void 0?".":G3(r)}function G3(t){_s(t);const l=t.codePointAt(0)===47;let r=K3(t,!l);return r.length===0&&!l&&(r="."),r.length>0&&t.codePointAt(t.length-1)===47&&(r+="/"),l?"/"+r:r}function K3(t,l){let r="",i=0,c=-1,u=0,f=-1,m,p;for(;++f<=t.length;){if(f<t.length)m=t.codePointAt(f);else{if(m===47)break;m=47}if(m===47){if(!(c===f-1||u===1))if(c!==f-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(p=r.lastIndexOf("/"),p!==r.length-1){p<0?(r="",i=0):(r=r.slice(0,p),i=r.length-1-r.lastIndexOf("/")),c=f,u=0;continue}}else if(r.length>0){r="",i=0,c=f,u=0;continue}}l&&(r=r.length>0?r+"/..":"..",i=2)}else r.length>0?r+="/"+t.slice(c+1,f):r=t.slice(c+1,f),i=f-c-1;c=f,u=0}else m===46&&u>-1?u++:u=-1}return r}function _s(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const Q3={cwd:W3};function W3(){return"/"}function Xd(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function Z3(t){if(typeof t=="string")t=new URL(t);else if(!Xd(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 J3(t)}function J3(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 ad=["history","path","basename","stem","extname","dirname"];class Ey{constructor(l){let r;l?Xd(l)?r={path:l}:typeof l=="string"||P3(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<ad.length;){const u=ad[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)ad.includes(c)||(this[c]=r[c])}get basename(){return typeof this.path=="string"?Cl.basename(this.path):void 0}set basename(l){sd(l,"basename"),id(l,"basename"),this.path=Cl.join(this.dirname||"",l)}get dirname(){return typeof this.path=="string"?Cl.dirname(this.path):void 0}set dirname(l){V1(this.basename,"dirname"),this.path=Cl.join(l||"",this.basename)}get extname(){return typeof this.path=="string"?Cl.extname(this.path):void 0}set extname(l){if(id(l,"extname"),V1(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=Cl.join(this.dirname,this.stem+(l||""))}get path(){return this.history[this.history.length-1]}set path(l){Xd(l)&&(l=Z3(l)),sd(l,"path"),this.path!==l&&this.history.push(l)}get stem(){return typeof this.path=="string"?Cl.basename(this.path,this.extname):void 0}set stem(l){sd(l,"stem"),id(l,"stem"),this.path=Cl.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 pn(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 id(t,l){if(t&&t.includes(Cl.sep))throw new Error("`"+l+"` cannot be a path: did not expect `"+Cl.sep+"`")}function sd(t,l){if(!t)throw new Error("`"+l+"` cannot be empty")}function V1(t,l){if(!t)throw new Error("Setting `"+l+"` requires `path` to be set too")}function P3(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const ek=(function(t){const i=this.constructor.prototype,c=i[t],u=function(){return c.apply(u,arguments)};return Object.setPrototypeOf(u,i),u}),tk={}.hasOwnProperty;class xh extends ek{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=U3()}copy(){const l=new xh;let r=-1;for(;++r<this.attachers.length;){const i=this.attachers[r];l.use(...i)}return l.data(rd(!0,{},this.namespace)),l}data(l,r){return typeof l=="string"?arguments.length===2?(ud("data",this.frozen),this.namespace[l]=r,this):tk.call(this.namespace,l)&&this.namespace[l]||void 0:l?(ud("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=ec(l),i=this.parser||this.Parser;return od("parse",i),i(String(r),r)}process(l,r){const i=this;return this.freeze(),od("process",this.parser||this.Parser),cd("process",this.compiler||this.Compiler),r?c(void 0,r):new Promise(c);function c(u,f){const m=ec(l),p=i.parse(m);i.run(p,m,function(g,y,b){if(g||!y||!b)return d(g);const v=y,j=i.stringify(v,b);rk(j)?b.value=j:b.result=j,d(g,b)});function d(g,y){g||!y?f(g):u?u(y):r(void 0,y)}}}processSync(l){let r=!1,i;return this.freeze(),od("processSync",this.parser||this.Parser),cd("processSync",this.compiler||this.Compiler),this.process(l,c),K1("processSync","process",r),i;function c(u,f){r=!0,q1(u),i=f}}run(l,r,i){G1(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(f,m){const p=ec(r);c.run(l,p,d);function d(g,y,b){const v=y||l;g?m(g):f?f(v):i(void 0,v,b)}}}runSync(l,r){let i=!1,c;return this.run(l,r,u),K1("runSync","run",i),c;function u(f,m){q1(f),c=m,i=!0}}stringify(l,r){this.freeze();const i=ec(r),c=this.compiler||this.Compiler;return cd("stringify",c),G1(l),c(l,i)}use(l,...r){const i=this.attachers,c=this.namespace;if(ud("use",this.frozen),l!=null)if(typeof l=="function")p(l,r);else if(typeof l=="object")Array.isArray(l)?m(l):f(l);else throw new TypeError("Expected usable value, not `"+l+"`");return this;function u(d){if(typeof d=="function")p(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[g,...y]=d;p(g,y)}else f(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function f(d){if(!("plugins"in d)&&!("settings"in d))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(d.plugins),d.settings&&(c.settings=rd(!0,c.settings,d.settings))}function m(d){let g=-1;if(d!=null)if(Array.isArray(d))for(;++g<d.length;){const y=d[g];u(y)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function p(d,g){let y=-1,b=-1;for(;++y<i.length;)if(i[y][0]===d){b=y;break}if(b===-1)i.push([d,...g]);else if(g.length>0){let[v,...j]=g;const S=i[b][1];qd(S)&&qd(v)&&(v=rd(!0,S,v)),i[b]=[d,v,...j]}}}}const nk=new xh().freeze();function od(t,l){if(typeof l!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function cd(t,l){if(typeof l!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function ud(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 G1(t){if(!qd(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function K1(t,l,r){if(!r)throw new Error("`"+t+"` finished async. Use `"+l+"` instead")}function ec(t){return lk(t)?t:new Ey(t)}function lk(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function rk(t){return typeof t=="string"||ak(t)}function ak(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const ik="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Q1=[],W1={allowDangerousHtml:!0},sk=/^(https?|ircs?|mailto|xmpp)$/i,ok=[{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 Ny(t){const l=ck(t),r=uk(t);return fk(l.runSync(l.parse(r),r),t)}function ck(t){const l=t.rehypePlugins||Q1,r=t.remarkPlugins||Q1,i=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...W1}:W1;return nk().use(q5).use(r).use(L3,i).use(l)}function uk(t){const l=t.children||"",r=new Ey;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,f=l.skipHtml,m=l.unwrapDisallowed,p=l.urlTransform||dk;for(const g of ok)Object.hasOwn(l,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+ik+g.id,void 0);return mh(t,d),Nv(t,{Fragment:o.Fragment,components:c,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function d(g,y,b){if(g.type==="raw"&&b&&typeof y=="number")return f?b.children.splice(y,1):b.children[y]={type:"text",value:g.value},y;if(g.type==="element"){let v;for(v in ed)if(Object.hasOwn(ed,v)&&Object.hasOwn(g.properties,v)){const j=g.properties[v],S=ed[v];(S===null||S.includes(g.tagName))&&(g.properties[v]=p(String(j||""),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 dk(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||sk.test(t.slice(0,l))?t:""}function Z1(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 hk(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function mk(t,l,r){const c=Fc((r||{}).ignore||[]),u=xk(l);let f=-1;for(;++f<u.length;)Cy(t,"text",m);function m(d,g){let y=-1,b;for(;++y<g.length;){const v=g[y],j=b?b.children:void 0;if(c(v,j?j.indexOf(v):void 0,b))return;b=v}if(b)return p(d,g)}function p(d,g){const y=g[g.length-1],b=u[f][0],v=u[f][1];let j=0;const C=y.children.indexOf(d);let E=!1,A=[];b.lastIndex=0;let R=b.exec(d.value);for(;R;){const O=R.index,B={index:R.index,input:R.input,stack:[...g,d]};let T=v(...R,B);if(typeof T=="string"&&(T=T.length>0?{type:"text",value:T}:void 0),T===!1?b.lastIndex=O+1:(j!==O&&A.push({type:"text",value:d.value.slice(j,O)}),Array.isArray(T)?A.push(...T):T&&A.push(T),j=O+R[0].length,E=!0),!b.global)break;R=b.exec(d.value)}return E?(j<d.value.length&&A.push({type:"text",value:d.value.slice(j)}),y.children.splice(C,1,...A)):A=[d],C+A.length}}function xk(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([pk(c[0]),yk(c[1])])}return l}function pk(t){return typeof t=="string"?new RegExp(hk(t),"g"):t}function yk(t){return typeof t=="function"?t:function(){return t}}const fd="phrasing",dd=["autolink","link","image","label"];function gk(){return{transforms:[Ck],enter:{literalAutolink:vk,literalAutolinkEmail:hd,literalAutolinkHttp:hd,literalAutolinkWww:hd},exit:{literalAutolink:jk,literalAutolinkEmail:Sk,literalAutolinkHttp:wk,literalAutolinkWww:kk}}}function bk(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:fd,notInConstruct:dd},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:fd,notInConstruct:dd},{character:":",before:"[ps]",after:"\\/",inConstruct:fd,notInConstruct:dd}]}}function vk(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function hd(t){this.config.enter.autolinkProtocol.call(this,t)}function wk(t){this.config.exit.autolinkProtocol.call(this,t)}function kk(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 jk(t){this.exit(t)}function Ck(t){mk(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Ek],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Nk]],{ignore:["link","linkReference"]})}function Ek(t,l,r,i,c){let u="";if(!Ay(c)||(/^w/i.test(l)&&(r=l+r,l="",u="http://"),!Ak(r)))return!1;const f=Dk(r+i);if(!f[0])return!1;const m={type:"link",title:null,url:u+l+f[0],children:[{type:"text",value:l+f[0]}]};return f[1]?[m,{type:"text",value:f[1]}]:m}function Nk(t,l,r,i){return!Ay(i,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+l+"@"+r,children:[{type:"text",value:l+"@"+r}]}}function Ak(t){const l=t.split(".");return!(l.length<2||l[l.length-1]&&(/_/.test(l[l.length-1])||!/[a-zA-Z\d]/.test(l[l.length-1]))||l[l.length-2]&&(/_/.test(l[l.length-2])||!/[a-zA-Z\d]/.test(l[l.length-2])))}function Dk(t){const l=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!l)return[t,void 0];t=t.slice(0,l.index);let r=l[0],i=r.indexOf(")");const c=Z1(t,"(");let u=Z1(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 Ay(t,l){const r=t.input.charCodeAt(t.index-1);return(t.index===0||ga(r)||zc(r))&&(!l||r!==47)}Dy.peek=Lk;function Tk(){this.buffer()}function zk(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function Mk(){this.buffer()}function Rk(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function Fk(t){const l=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=pl(this.sliceSerialize(t)).toLowerCase(),r.label=l}function _k(t){this.exit(t)}function Ok(t){const l=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=pl(this.sliceSerialize(t)).toLowerCase(),r.label=l}function Bk(t){this.exit(t)}function Lk(){return"["}function Dy(t,l,r,i){const c=r.createTracker(i);let u=c.move("[^");const f=r.enter("footnoteReference"),m=r.enter("reference");return u+=c.move(r.safe(r.associationId(t),{after:"]",before:u})),m(),f(),u+=c.move("]"),u}function $k(){return{enter:{gfmFootnoteCallString:Tk,gfmFootnoteCall:zk,gfmFootnoteDefinitionLabelString:Mk,gfmFootnoteDefinition:Rk},exit:{gfmFootnoteCallString:Fk,gfmFootnoteCall:_k,gfmFootnoteDefinitionLabelString:Ok,gfmFootnoteDefinition:Bk}}}function Hk(t){let l=!1;return t&&t.firstLineBlank&&(l=!0),{handlers:{footnoteDefinition:r,footnoteReference:Dy},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(i,c,u,f){const m=u.createTracker(f);let p=m.move("[^");const d=u.enter("footnoteDefinition"),g=u.enter("label");return p+=m.move(u.safe(u.associationId(i),{before:p,after:"]"})),g(),p+=m.move("]:"),i.children&&i.children.length>0&&(m.shift(4),p+=m.move((l?`
64
- `:" ")+u.indentLines(u.containerFlow(i,m.current()),l?Ty:Uk))),d(),p}}function Uk(t,l,r){return l===0?t:Ty(t,l,r)}function Ty(t,l,r){return(r?"":" ")+t}const Ik=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];zy.peek=Gk;function Yk(){return{canContainEols:["delete"],enter:{strikethrough:Xk},exit:{strikethrough:Vk}}}function qk(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Ik}],handlers:{delete:zy}}}function Xk(t){this.enter({type:"delete",children:[]},t)}function Vk(t){this.exit(t)}function zy(t,l,r,i){const c=r.createTracker(i),u=r.enter("strikethrough");let f=c.move("~~");return f+=r.containerPhrasing(t,{...c.current(),before:f,after:"~"}),f+=c.move("~~"),u(),f}function Gk(){return"~"}function Kk(t){return t.length}function Qk(t,l){const r=l||{},i=(r.align||[]).concat(),c=r.stringLength||Kk,u=[],f=[],m=[],p=[];let d=0,g=-1;for(;++g<t.length;){const S=[],C=[];let E=-1;for(t[g].length>d&&(d=t[g].length);++E<t[g].length;){const A=Wk(t[g][E]);if(r.alignDelimiters!==!1){const R=c(A);C[E]=R,(p[E]===void 0||R>p[E])&&(p[E]=R)}S.push(A)}f[g]=S,m[g]=C}let y=-1;if(typeof i=="object"&&"length"in i)for(;++y<d;)u[y]=J1(i[y]);else{const S=J1(i);for(;++y<d;)u[y]=S}y=-1;const b=[],v=[];for(;++y<d;){const S=u[y];let C="",E="";S===99?(C=":",E=":"):S===108?C=":":S===114&&(E=":");let A=r.alignDelimiters===!1?1:Math.max(1,p[y]-C.length-E.length);const R=C+"-".repeat(A)+E;r.alignDelimiters!==!1&&(A=C.length+A+E.length,A>p[y]&&(p[y]=A),v[y]=A),b[y]=R}f.splice(1,0,b),m.splice(1,0,v),g=-1;const j=[];for(;++g<f.length;){const S=f[g],C=m[g];y=-1;const E=[];for(;++y<d;){const A=S[y]||"";let R="",O="";if(r.alignDelimiters!==!1){const B=p[y]-(C[y]||0),T=u[y];T===114?R=" ".repeat(B):T===99?B%2?(R=" ".repeat(B/2+.5),O=" ".repeat(B/2-.5)):(R=" ".repeat(B/2),O=R):O=" ".repeat(B)}r.delimiterStart!==!1&&!y&&E.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&A==="")&&(r.delimiterStart!==!1||y)&&E.push(" "),r.alignDelimiters!==!1&&E.push(R),E.push(A),r.alignDelimiters!==!1&&E.push(O),r.padding!==!1&&E.push(" "),(r.delimiterEnd!==!1||y!==d-1)&&E.push("|")}j.push(r.delimiterEnd===!1?E.join("").replace(/ +$/,""):E.join(""))}return j.join(`
65
- `)}function Wk(t){return t==null?"":String(t)}function J1(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 Zk(t,l,r,i){const c=r.enter("blockquote"),u=r.createTracker(i);u.move("> "),u.shift(2);const f=r.indentLines(r.containerFlow(t,u.current()),Jk);return c(),f}function Jk(t,l,r){return">"+(r?"":" ")+t}function Pk(t,l){return P1(t,l.inConstruct,!0)&&!P1(t,l.notInConstruct,!1)}function P1(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 e0(t,l,r,i){let c=-1;for(;++c<r.unsafe.length;)if(r.unsafe[c].character===`
66
- `&&Pk(r.stack,r.unsafe[c]))return/[ \t]/.test(i.before)?"":" ";return`\\
67
- `}function e4(t,l){const r=String(t);let i=r.indexOf(l),c=i,u=0,f=0;if(typeof l!="string")throw new TypeError("Expected substring");for(;i!==-1;)i===c?++u>f&&(f=u):u=1,c=i+l.length,i=r.indexOf(l,c);return f}function t4(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 n4(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 l4(t,l,r,i){const c=n4(r),u=t.value||"",f=c==="`"?"GraveAccent":"Tilde";if(t4(t,r)){const y=r.enter("codeIndented"),b=r.indentLines(u,r4);return y(),b}const m=r.createTracker(i),p=c.repeat(Math.max(e4(u,c)+1,3)),d=r.enter("codeFenced");let g=m.move(p);if(t.lang){const y=r.enter(`codeFencedLang${f}`);g+=m.move(r.safe(t.lang,{before:g,after:" ",encode:["`"],...m.current()})),y()}if(t.lang&&t.meta){const y=r.enter(`codeFencedMeta${f}`);g+=m.move(" "),g+=m.move(r.safe(t.meta,{before:g,after:`
68
- `,encode:["`"],...m.current()})),y()}return g+=m.move(`
69
- `),u&&(g+=m.move(u+`
70
- `)),g+=m.move(p),d(),g}function r4(t,l,r){return(r?"":" ")+t}function ph(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 a4(t,l,r,i){const c=ph(r),u=c==='"'?"Quote":"Apostrophe",f=r.enter("definition");let m=r.enter("label");const p=r.createTracker(i);let d=p.move("[");return d+=p.move(r.safe(r.associationId(t),{before:d,after:"]",...p.current()})),d+=p.move("]: "),m(),!t.url||/[\0- \u007F]/.test(t.url)?(m=r.enter("destinationLiteral"),d+=p.move("<"),d+=p.move(r.safe(t.url,{before:d,after:">",...p.current()})),d+=p.move(">")):(m=r.enter("destinationRaw"),d+=p.move(r.safe(t.url,{before:d,after:t.title?" ":`
71
- `,...p.current()}))),m(),t.title&&(m=r.enter(`title${u}`),d+=p.move(" "+c),d+=p.move(r.safe(t.title,{before:d,after:c,...p.current()})),d+=p.move(c),m()),f(),d}function i4(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 As(t){return"&#x"+t.toString(16).toUpperCase()+";"}function Sc(t,l,r){const i=ii(t),c=ii(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}}My.peek=s4;function My(t,l,r,i){const c=i4(r),u=r.enter("emphasis"),f=r.createTracker(i),m=f.move(c);let p=f.move(r.containerPhrasing(t,{after:c,before:m,...f.current()}));const d=p.charCodeAt(0),g=Sc(i.before.charCodeAt(i.before.length-1),d,c);g.inside&&(p=As(d)+p.slice(1));const y=p.charCodeAt(p.length-1),b=Sc(i.after.charCodeAt(0),y,c);b.inside&&(p=p.slice(0,-1)+As(y));const v=f.move(c);return u(),r.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},m+p+v}function s4(t,l,r){return r.options.emphasis||"*"}function o4(t,l){let r=!1;return mh(t,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return r=!0,Id}),!!((!t.depth||t.depth<3)&&sh(t)&&(l.options.setext||r))}function c4(t,l,r,i){const c=Math.max(Math.min(6,t.depth||1),1),u=r.createTracker(i);if(o4(t,r)){const g=r.enter("headingSetext"),y=r.enter("phrasing"),b=r.containerPhrasing(t,{...u.current(),before:`
72
- `,after:`
73
- `});return y(),g(),b+`
74
- `+(c===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(`
75
- `))+1))}const f="#".repeat(c),m=r.enter("headingAtx"),p=r.enter("phrasing");u.move(f+" ");let d=r.containerPhrasing(t,{before:"# ",after:`
76
- `,...u.current()});return/^[\t ]/.test(d)&&(d=As(d.charCodeAt(0))+d.slice(1)),d=d?f+" "+d:f,r.options.closeAtx&&(d+=" "+f),p(),m(),d}Ry.peek=u4;function Ry(t){return t.value||""}function u4(){return"<"}Fy.peek=f4;function Fy(t,l,r,i){const c=ph(r),u=c==='"'?"Quote":"Apostrophe",f=r.enter("image");let m=r.enter("label");const p=r.createTracker(i);let d=p.move("![");return d+=p.move(r.safe(t.alt,{before:d,after:"]",...p.current()})),d+=p.move("]("),m(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(m=r.enter("destinationLiteral"),d+=p.move("<"),d+=p.move(r.safe(t.url,{before:d,after:">",...p.current()})),d+=p.move(">")):(m=r.enter("destinationRaw"),d+=p.move(r.safe(t.url,{before:d,after:t.title?" ":")",...p.current()}))),m(),t.title&&(m=r.enter(`title${u}`),d+=p.move(" "+c),d+=p.move(r.safe(t.title,{before:d,after:c,...p.current()})),d+=p.move(c),m()),d+=p.move(")"),f(),d}function f4(){return"!"}_y.peek=d4;function _y(t,l,r,i){const c=t.referenceType,u=r.enter("imageReference");let f=r.enter("label");const m=r.createTracker(i);let p=m.move("![");const d=r.safe(t.alt,{before:p,after:"]",...m.current()});p+=m.move(d+"]["),f();const g=r.stack;r.stack=[],f=r.enter("reference");const y=r.safe(r.associationId(t),{before:p,after:"]",...m.current()});return f(),r.stack=g,u(),c==="full"||!d||d!==y?p+=m.move(y+"]"):c==="shortcut"?p=p.slice(0,-1):p+=m.move("]"),p}function d4(){return"!"}Oy.peek=h4;function Oy(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 f=r.unsafe[u],m=r.compilePattern(f);let p;if(f.atBreak)for(;p=m.exec(i);){let d=p.index;i.charCodeAt(d)===10&&i.charCodeAt(d-1)===13&&d--,i=i.slice(0,d)+" "+i.slice(p.index+1)}}return c+i+c}function h4(){return"`"}function By(t,l){const r=sh(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))}Ly.peek=m4;function Ly(t,l,r,i){const c=ph(r),u=c==='"'?"Quote":"Apostrophe",f=r.createTracker(i);let m,p;if(By(t,r)){const g=r.stack;r.stack=[],m=r.enter("autolink");let y=f.move("<");return y+=f.move(r.containerPhrasing(t,{before:y,after:">",...f.current()})),y+=f.move(">"),m(),r.stack=g,y}m=r.enter("link"),p=r.enter("label");let d=f.move("[");return d+=f.move(r.containerPhrasing(t,{before:d,after:"](",...f.current()})),d+=f.move("]("),p(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(p=r.enter("destinationLiteral"),d+=f.move("<"),d+=f.move(r.safe(t.url,{before:d,after:">",...f.current()})),d+=f.move(">")):(p=r.enter("destinationRaw"),d+=f.move(r.safe(t.url,{before:d,after:t.title?" ":")",...f.current()}))),p(),t.title&&(p=r.enter(`title${u}`),d+=f.move(" "+c),d+=f.move(r.safe(t.title,{before:d,after:c,...f.current()})),d+=f.move(c),p()),d+=f.move(")"),m(),d}function m4(t,l,r){return By(t,r)?"<":"["}$y.peek=x4;function $y(t,l,r,i){const c=t.referenceType,u=r.enter("linkReference");let f=r.enter("label");const m=r.createTracker(i);let p=m.move("[");const d=r.containerPhrasing(t,{before:p,after:"]",...m.current()});p+=m.move(d+"]["),f();const g=r.stack;r.stack=[],f=r.enter("reference");const y=r.safe(r.associationId(t),{before:p,after:"]",...m.current()});return f(),r.stack=g,u(),c==="full"||!d||d!==y?p+=m.move(y+"]"):c==="shortcut"?p=p.slice(0,-1):p+=m.move("]"),p}function x4(){return"["}function yh(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 p4(t){const l=yh(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 y4(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 Hy(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 g4(t,l,r,i){const c=r.enter("list"),u=r.bulletCurrent;let f=t.ordered?y4(r):yh(r);const m=t.ordered?f==="."?")":".":p4(r);let p=l&&r.bulletLastUsed?f===r.bulletLastUsed:!1;if(!t.ordered){const g=t.children?t.children[0]:void 0;if((f==="*"||f==="-")&&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&&(p=!0),Hy(r)===f&&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"){p=!0;break}}}}p&&(f=m),r.bulletCurrent=f;const d=r.containerFlow(t,i);return r.bulletLastUsed=f,r.bulletCurrent=u,c(),d}function b4(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 v4(t,l,r,i){const c=b4(r);let u=r.bulletCurrent||yh(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 f=u.length+1;(c==="tab"||c==="mixed"&&(l&&l.type==="list"&&l.spread||t.spread))&&(f=Math.ceil(f/4)*4);const m=r.createTracker(i);m.move(u+" ".repeat(f-u.length)),m.shift(f);const p=r.enter("listItem"),d=r.indentLines(r.containerFlow(t,m.current()),g);return p(),d;function g(y,b,v){return b?(v?"":" ".repeat(f))+y:(v?u:u+" ".repeat(f-u.length))+y}}function w4(t,l,r,i){const c=r.enter("paragraph"),u=r.enter("phrasing"),f=r.containerPhrasing(t,i);return u(),c(),f}const k4=Fc(["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(f){return k4(f)})?r.containerPhrasing:r.containerFlow).call(r,t,i)}function j4(t){const l=t.options.strong||"*";if(l!=="*"&&l!=="_")throw new Error("Cannot serialize strong with `"+l+"` for `options.strong`, expected `*`, or `_`");return l}Uy.peek=C4;function Uy(t,l,r,i){const c=j4(r),u=r.enter("strong"),f=r.createTracker(i),m=f.move(c+c);let p=f.move(r.containerPhrasing(t,{after:c,before:m,...f.current()}));const d=p.charCodeAt(0),g=Sc(i.before.charCodeAt(i.before.length-1),d,c);g.inside&&(p=As(d)+p.slice(1));const y=p.charCodeAt(p.length-1),b=Sc(i.after.charCodeAt(0),y,c);b.inside&&(p=p.slice(0,-1)+As(y));const v=f.move(c+c);return u(),r.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},m+p+v}function C4(t,l,r){return r.options.strong||"*"}function E4(t,l,r,i){return r.safe(t.value,i)}function N4(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 A4(t,l,r){const i=(Hy(r)+(r.options.ruleSpaces?" ":"")).repeat(N4(r));return r.options.ruleSpaces?i.slice(0,-1):i}const Iy={blockquote:Zk,break:e0,code:l4,definition:a4,emphasis:My,hardBreak:e0,heading:c4,html:Ry,image:Fy,imageReference:_y,inlineCode:Oy,link:Ly,linkReference:$y,list:g4,listItem:v4,paragraph:w4,root:S4,strong:Uy,text:E4,thematicBreak:A4};function D4(){return{enter:{table:T4,tableData:t0,tableHeader:t0,tableRow:M4},exit:{codeText:R4,table:z4,tableData:md,tableHeader:md,tableRow:md}}}function T4(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 z4(t){this.exit(t),this.data.inTable=void 0}function M4(t){this.enter({type:"tableRow",children:[]},t)}function md(t){this.exit(t)}function t0(t){this.enter({type:"tableCell",children:[]},t)}function R4(t){let l=this.resume();this.data.inTable&&(l=l.replace(/\\([\\|])/g,F4));const r=this.stack[this.stack.length-1];r.type,r.value=l,this.exit(t)}function F4(t,l){return l==="|"?l:t}function _4(t){const l=t||{},r=l.tableCellPadding,i=l.tablePipeAlign,c=l.stringLength,u=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
77
- `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:f,tableCell:p,tableRow:m}};function f(v,j,S,C){return d(g(v,S,C),v.align)}function m(v,j,S,C){const E=y(v,S,C),A=d([E]);return A.slice(0,A.indexOf(`
78
- `))}function p(v,j,S,C){const E=S.enter("tableCell"),A=S.enter("phrasing"),R=S.containerPhrasing(v,{...C,before:u,after:u});return A(),E(),R}function d(v,j){return Qk(v,{align:j,alignDelimiters:i,padding:r,stringLength:c})}function g(v,j,S){const C=v.children;let E=-1;const A=[],R=j.enter("table");for(;++E<C.length;)A[E]=y(C[E],j,S);return R(),A}function y(v,j,S){const C=v.children;let E=-1;const A=[],R=j.enter("tableRow");for(;++E<C.length;)A[E]=p(C[E],v,j,S);return R(),A}function b(v,j,S){let C=Iy.inlineCode(v,j,S);return S.stack.includes("tableCell")&&(C=C.replace(/\|/g,"\\$&")),C}}function O4(){return{exit:{taskListCheckValueChecked:n0,taskListCheckValueUnchecked:n0,paragraph:L4}}}function B4(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:$4}}}function n0(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,f;for(;++u<c.length;){const m=c[u];if(m.type==="paragraph"){f=m;break}}f===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 $4(t,l,r,i){const c=t.children[0],u=typeof t.checked=="boolean"&&c&&c.type==="paragraph",f="["+(t.checked?"x":" ")+"] ",m=r.createTracker(i);u&&m.move(f);let p=Iy.listItem(t,l,r,{...i,...m.current()});return u&&(p=p.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),p;function d(g){return g+f}}function H4(){return[gk(),$k(),Yk(),D4(),O4()]}function U4(t){return{extensions:[bk(),Hk(t),qk(),_4(t),B4()]}}const I4={tokenize:K4,partial:!0},Yy={tokenize:Q4,partial:!0},qy={tokenize:W4,partial:!0},Xy={tokenize:Z4,partial:!0},Y4={tokenize:J4,partial:!0},Vy={name:"wwwAutolink",tokenize:V4,previous:Ky},Gy={name:"protocolAutolink",tokenize:G4,previous:Qy},lr={name:"emailAutolink",tokenize:X4,previous:Wy},Dl={};function q4(){return{text:Dl}}let fa=48;for(;fa<123;)Dl[fa]=lr,fa++,fa===58?fa=65:fa===91&&(fa=97);Dl[43]=lr;Dl[45]=lr;Dl[46]=lr;Dl[95]=lr;Dl[72]=[lr,Gy];Dl[104]=[lr,Gy];Dl[87]=[lr,Vy];Dl[119]=[lr,Vy];function X4(t,l,r){const i=this;let c,u;return f;function f(y){return!Vd(y)||!Wy.call(i,i.previous)||gh(i.events)?r(y):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),m(y))}function m(y){return Vd(y)?(t.consume(y),m):y===64?(t.consume(y),p):r(y)}function p(y){return y===46?t.check(Y4,g,d)(y):y===45||y===95||xn(y)?(u=!0,t.consume(y),p):g(y)}function d(y){return t.consume(y),c=!0,p}function g(y){return u&&c&&vn(i.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),l(y)):r(y)}}function V4(t,l,r){const i=this;return c;function c(f){return f!==87&&f!==119||!Ky.call(i,i.previous)||gh(i.events)?r(f):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(I4,t.attempt(Yy,t.attempt(qy,u),r),r)(f))}function u(f){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),l(f)}}function G4(t,l,r){const i=this;let c="",u=!1;return f;function f(y){return(y===72||y===104)&&Qy.call(i,i.previous)&&!gh(i.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),c+=String.fromCodePoint(y),t.consume(y),m):r(y)}function m(y){if(vn(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),p}return r(y)}function p(y){return y===47?(t.consume(y),u?d:(u=!0,p)):r(y)}function d(y){return y===null||vc(y)||Dt(y)||ga(y)||zc(y)?r(y):t.attempt(Yy,t.attempt(qy,g),r)(y)}function g(y){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),l(y)}}function K4(t,l,r){let i=0;return c;function c(f){return(f===87||f===119)&&i<3?(i++,t.consume(f),c):f===46&&i===3?(t.consume(f),u):r(f)}function u(f){return f===null?r(f):l(f)}}function Q4(t,l,r){let i,c,u;return f;function f(d){return d===46||d===95?t.check(Xy,p,m)(d):d===null||Dt(d)||ga(d)||d!==45&&zc(d)?p(d):(u=!0,t.consume(d),f)}function m(d){return d===95?i=!0:(c=i,i=void 0),t.consume(d),f}function p(d){return c||i||!u?r(d):l(d)}}function W4(t,l){let r=0,i=0;return c;function c(f){return f===40?(r++,t.consume(f),c):f===41&&i<r?u(f):f===33||f===34||f===38||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===60||f===63||f===93||f===95||f===126?t.check(Xy,l,u)(f):f===null||Dt(f)||ga(f)?l(f):(t.consume(f),c)}function u(f){return f===41&&i++,t.consume(f),c}}function Z4(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||Dt(m)||ga(m)?l(m):r(m)}function c(m){return m===null||m===40||m===91||Dt(m)||ga(m)?l(m):i(m)}function u(m){return vn(m)?f(m):r(m)}function f(m){return m===59?(t.consume(m),i):vn(m)?(t.consume(m),f):r(m)}}function J4(t,l,r){return i;function i(u){return t.consume(u),c}function c(u){return xn(u)?r(u):l(u)}}function Ky(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||Dt(t)}function Qy(t){return!vn(t)}function Wy(t){return!(t===47||Vd(t))}function Vd(t){return t===43||t===45||t===46||t===95||xn(t)}function gh(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 P4={tokenize:sS,partial:!0};function eS(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:rS,continuation:{tokenize:aS},exit:iS}},text:{91:{name:"gfmFootnoteCall",tokenize:lS},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:tS,resolveTo:nS}}}}function tS(t,l,r){const i=this;let c=i.events.length;const u=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let f;for(;c--;){const p=i.events[c][1];if(p.type==="labelImage"){f=p;break}if(p.type==="gfmFootnoteCall"||p.type==="labelLink"||p.type==="label"||p.type==="image"||p.type==="link")break}return m;function m(p){if(!f||!f._balanced)return r(p);const d=pl(i.sliceSerialize({start:f.end,end:i.now()}));return d.codePointAt(0)!==94||!u.includes(d.slice(1))?r(p):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(p),t.exit("gfmFootnoteCallLabelMarker"),l(p))}}function nS(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)},f={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",f,l],["exit",f,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 lS(t,l,r){const i=this,c=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u=0,f;return m;function m(y){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(y),t.exit("gfmFootnoteCallLabelMarker"),p}function p(y){return y!==94?r(y):(t.enter("gfmFootnoteCallMarker"),t.consume(y),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",d)}function d(y){if(u>999||y===93&&!f||y===null||y===91||Dt(y))return r(y);if(y===93){t.exit("chunkString");const b=t.exit("gfmFootnoteCallString");return c.includes(pl(i.sliceSerialize(b)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(y),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),l):r(y)}return Dt(y)||(f=!0),u++,t.consume(y),y===92?g:d}function g(y){return y===91||y===92||y===93?(t.consume(y),u++,d):d(y)}}function rS(t,l,r){const i=this,c=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u,f=0,m;return p;function p(j){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(j),t.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(j){return j===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(j),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",g):r(j)}function g(j){if(f>999||j===93&&!m||j===null||j===91||Dt(j))return r(j);if(j===93){t.exit("chunkString");const S=t.exit("gfmFootnoteDefinitionLabelString");return u=pl(i.sliceSerialize(S)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(j),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),b}return Dt(j)||(m=!0),f++,t.consume(j),j===92?y:g}function y(j){return j===91||j===92||j===93?(t.consume(j),f++,g):g(j)}function b(j){return j===58?(t.enter("definitionMarker"),t.consume(j),t.exit("definitionMarker"),c.includes(u)||c.push(u),ut(t,v,"gfmFootnoteDefinitionWhitespace")):r(j)}function v(j){return l(j)}}function aS(t,l,r){return t.check(Fs,l,t.attempt(P4,l,r))}function iS(t){t.exit("gfmFootnoteDefinition")}function sS(t,l,r){const i=this;return ut(t,c,"gfmFootnoteDefinitionIndent",5);function c(u){const f=i.events[i.events.length-1];return f&&f[1].type==="gfmFootnoteDefinitionIndent"&&f[2].sliceSerialize(f[1],!0).length===4?l(u):r(u)}}function oS(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(f,m){let p=-1;for(;++p<f.length;)if(f[p][0]==="enter"&&f[p][1].type==="strikethroughSequenceTemporary"&&f[p][1]._close){let d=p;for(;d--;)if(f[d][0]==="exit"&&f[d][1].type==="strikethroughSequenceTemporary"&&f[d][1]._open&&f[p][1].end.offset-f[p][1].start.offset===f[d][1].end.offset-f[d][1].start.offset){f[p][1].type="strikethroughSequence",f[d][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},f[d][1].start),end:Object.assign({},f[p][1].end)},y={type:"strikethroughText",start:Object.assign({},f[d][1].end),end:Object.assign({},f[p][1].start)},b=[["enter",g,m],["enter",f[d][1],m],["exit",f[d][1],m],["enter",y,m]],v=m.parser.constructs.insideSpan.null;v&&Kn(b,b.length,0,Mc(v,f.slice(d+1,p),m)),Kn(b,b.length,0,[["exit",y,m],["enter",f[p][1],m],["exit",f[p][1],m],["exit",g,m]]),Kn(f,d-1,p-d+3,b),p=d+b.length-2;break}}for(p=-1;++p<f.length;)f[p][1].type==="strikethroughSequenceTemporary"&&(f[p][1].type="data");return f}function u(f,m,p){const d=this.previous,g=this.events;let y=0;return b;function b(j){return d===126&&g[g.length-1][1].type!=="characterEscape"?p(j):(f.enter("strikethroughSequenceTemporary"),v(j))}function v(j){const S=ii(d);if(j===126)return y>1?p(j):(f.consume(j),y++,v);if(y<2&&!r)return p(j);const C=f.exit("strikethroughSequenceTemporary"),E=ii(j);return C._open=!E||E===2&&!!S,C._close=!S||S===2&&!!E,m(j)}}}class cS{constructor(){this.map=[]}add(l,r,i){uS(this,l,r,i)}consume(l){if(this.map.sort(function(u,f){return u[0]-f[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 uS(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 fS(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 dS(){return{flow:{null:{name:"table",tokenize:hS,resolveAll:mS}}}}function hS(t,l,r){const i=this;let c=0,u=0,f;return m;function m(z){let $=i.events.length-1;for(;$>-1;){const re=i.events[$][1].type;if(re==="lineEnding"||re==="linePrefix")$--;else break}const U=$>-1?i.events[$][1].type:null,ne=U==="tableHead"||U==="tableRow"?T:p;return ne===T&&i.parser.lazy[i.now().line]?r(z):ne(z)}function p(z){return t.enter("tableHead"),t.enter("tableRow"),d(z)}function d(z){return z===124||(f=!0,u+=1),g(z)}function g(z){return z===null?r(z):Ue(z)?u>1?(u=0,i.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(z),t.exit("lineEnding"),v):r(z):lt(z)?ut(t,g,"whitespace")(z):(u+=1,f&&(f=!1,c+=1),z===124?(t.enter("tableCellDivider"),t.consume(z),t.exit("tableCellDivider"),f=!0,g):(t.enter("data"),y(z)))}function y(z){return z===null||z===124||Dt(z)?(t.exit("data"),g(z)):(t.consume(z),z===92?b:y)}function b(z){return z===92||z===124?(t.consume(z),y):y(z)}function v(z){return i.interrupt=!1,i.parser.lazy[i.now().line]?r(z):(t.enter("tableDelimiterRow"),f=!1,lt(z)?ut(t,j,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):j(z))}function j(z){return z===45||z===58?C(z):z===124?(f=!0,t.enter("tableCellDivider"),t.consume(z),t.exit("tableCellDivider"),S):B(z)}function S(z){return lt(z)?ut(t,C,"whitespace")(z):C(z)}function C(z){return z===58?(u+=1,f=!0,t.enter("tableDelimiterMarker"),t.consume(z),t.exit("tableDelimiterMarker"),E):z===45?(u+=1,E(z)):z===null||Ue(z)?O(z):B(z)}function E(z){return z===45?(t.enter("tableDelimiterFiller"),A(z)):B(z)}function A(z){return z===45?(t.consume(z),A):z===58?(f=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(z),t.exit("tableDelimiterMarker"),R):(t.exit("tableDelimiterFiller"),R(z))}function R(z){return lt(z)?ut(t,O,"whitespace")(z):O(z)}function O(z){return z===124?j(z):z===null||Ue(z)?!f||c!==u?B(z):(t.exit("tableDelimiterRow"),t.exit("tableHead"),l(z)):B(z)}function B(z){return r(z)}function T(z){return t.enter("tableRow"),I(z)}function I(z){return z===124?(t.enter("tableCellDivider"),t.consume(z),t.exit("tableCellDivider"),I):z===null||Ue(z)?(t.exit("tableRow"),l(z)):lt(z)?ut(t,I,"whitespace")(z):(t.enter("data"),X(z))}function X(z){return z===null||z===124||Dt(z)?(t.exit("data"),I(z)):(t.consume(z),z===92?ee:X)}function ee(z){return z===92||z===124?(t.consume(z),X):X(z)}}function mS(t,l){let r=-1,i=!0,c=0,u=[0,0,0,0],f=[0,0,0,0],m=!1,p=0,d,g,y;const b=new cS;for(;++r<t.length;){const v=t[r],j=v[1];v[0]==="enter"?j.type==="tableHead"?(m=!1,p!==0&&(l0(b,l,p,d,g),g=void 0,p=0),d={type:"table",start:Object.assign({},j.start),end:Object.assign({},j.end)},b.add(r,0,[["enter",d,l]])):j.type==="tableRow"||j.type==="tableDelimiterRow"?(i=!0,y=void 0,u=[0,0,0,0],f=[0,r+1,0,0],m&&(m=!1,g={type:"tableBody",start:Object.assign({},j.start),end:Object.assign({},j.end)},b.add(r,0,[["enter",g,l]])),c=j.type==="tableDelimiterRow"?2:g?3:1):c&&(j.type==="data"||j.type==="tableDelimiterMarker"||j.type==="tableDelimiterFiller")?(i=!1,f[2]===0&&(u[1]!==0&&(f[0]=f[1],y=tc(b,l,u,c,void 0,y),u=[0,0,0,0]),f[2]=r)):j.type==="tableCellDivider"&&(i?i=!1:(u[1]!==0&&(f[0]=f[1],y=tc(b,l,u,c,void 0,y)),u=f,f=[u[1],r,0,0])):j.type==="tableHead"?(m=!0,p=r):j.type==="tableRow"||j.type==="tableDelimiterRow"?(p=r,u[1]!==0?(f[0]=f[1],y=tc(b,l,u,c,r,y)):f[1]!==0&&(y=tc(b,l,f,c,r,y)),c=0):c&&(j.type==="data"||j.type==="tableDelimiterMarker"||j.type==="tableDelimiterFiller")&&(f[3]=r)}for(p!==0&&l0(b,l,p,d,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=fS(l.events,r))}return t}function tc(t,l,r,i,c,u){const f=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",m="tableContent";r[0]!==0&&(u.end=Object.assign({},ri(l.events,r[0])),t.add(r[0],0,[["exit",u,l]]));const p=ri(l.events,r[1]);if(u={type:f,start:Object.assign({},p),end:Object.assign({},p)},t.add(r[1],0,[["enter",u,l]]),r[2]!==0){const d=ri(l.events,r[2]),g=ri(l.events,r[3]),y={type:m,start:Object.assign({},d),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 j=r[2]+1,S=r[3]-r[2]-1;t.add(j,S,[])}}t.add(r[3]+1,0,[["exit",y,l]])}return c!==void 0&&(u.end=Object.assign({},ri(l.events,c)),t.add(c,0,[["exit",u,l]]),u=void 0),u}function l0(t,l,r,i,c){const u=[],f=ri(l.events,r);c&&(c.end=Object.assign({},f),u.push(["exit",c,l])),i.end=Object.assign({},f),u.push(["exit",i,l]),t.add(r+1,0,u)}function ri(t,l){const r=t[l],i=r[0]==="enter"?"start":"end";return r[1][i]}const xS={name:"tasklistCheck",tokenize:yS};function pS(){return{text:{91:xS}}}function yS(t,l,r){const i=this;return c;function c(p){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?r(p):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(p),t.exit("taskListCheckMarker"),u)}function u(p){return Dt(p)?(t.enter("taskListCheckValueUnchecked"),t.consume(p),t.exit("taskListCheckValueUnchecked"),f):p===88||p===120?(t.enter("taskListCheckValueChecked"),t.consume(p),t.exit("taskListCheckValueChecked"),f):r(p)}function f(p){return p===93?(t.enter("taskListCheckMarker"),t.consume(p),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),m):r(p)}function m(p){return Ue(p)?l(p):lt(p)?t.check({tokenize:gS},l,r)(p):r(p)}}function gS(t,l,r){return ut(t,i,"whitespace");function i(c){return c===null?r(c):l(c)}}function bS(t){return iy([q4(),eS(),oS(t),dS(),pS()])}const vS={};function Zy(t){const l=this,r=t||vS,i=l.data(),c=i.micromarkExtensions||(i.micromarkExtensions=[]),u=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),f=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);c.push(bS(r)),u.push(H4()),f.push(U4(r))}function Os({content:t,className:l=""}){return o.jsx("div",{className:`office-markdown ${l}`,children:o.jsx(Ny,{remarkPlugins:[Zy],components:{code:wS,table:({children:r})=>o.jsx("div",{className:"overflow-x-auto my-2",children:o.jsx("table",{className:"office-table",children:r})})},children:t})})}function wS({className:t,children:l,...r}){const i=/language-(\w+)/.exec(t??"");return i||typeof l=="string"&&l.includes(`
79
- `)?o.jsx(kS,{language:i==null?void 0:i[1],children:l}):o.jsx("code",{className:"bg-gray-100 text-gray-700 px-1 py-0.5 rounded text-[0.9em] font-mono",...r,children:l})}function kS({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 o.jsxs("div",{className:"office-code-block group relative my-2",children:[l&&o.jsx("div",{className:"text-[10px] text-gray-400 px-3 pt-1.5",children:l}),o.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"}),o.jsx("pre",{className:"overflow-x-auto p-3 text-xs leading-relaxed",children:o.jsx("code",{children:c})})]})}const r0={$skin:"skinColor",$hair:"hairColor",$shirt:"shirtColor",$pants:"pantsColor",$shoes:"shoeColor"},SS=/^(darken|lighten)\((\$\w+),\s*(\d+)\)$/;function jS(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 CS(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 Jy(t,l){const r=r0[t];if(r&&l)return l[r];const i=SS.exec(t);if(i){const[,c,u,f]=i,m=r0[u],p=m&&l?l[m]:u,d=parseInt(f,10);return c==="darken"?jS(p,d):CS(p,d)}return t}function a0(t,l=12){return t.map(r=>({...r,x:l-r.x-r.w}))}function ES(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:a0(t.left.pixels)}:l==="left"&&t.right?{name:t.right.name,pixels:a0(t.right.pixels)}:t.down}function NS(t,l){return Gd(t,"hair",l,1)}function Gd(t,l,r,i){const c=t.layers.findIndex(f=>f.name===l),u=[...t.layers];if(c>=0)u[c]={...r,name:l};else{const f=i??u.length;u.splice(f,0,{...r,name:l})}return{...t,layers:u}}const bh=new Map,vh=new Map;function Py(t,l){bh.set(t,l)}function Oc(t,l){vh.set(t,l)}function Kd(t){return bh.get(t)}function AS(t){return vh.get(t)}function yN(){return Array.from(bh.keys())}function gN(){return Array.from(vh.keys())}function DS(t,l,r,i,c=2){t.clearRect(0,0,l.width*c,l.height*c);for(const u of l.layers)eg(t,u.pixels,c,r,i)}function Qd(t,l,r,i,c){for(const u of l){const f=Jy(u.c,c);u.a!==void 0&&u.a!==1&&(t.globalAlpha=u.a),t.fillStyle=f,t.fillRect(r+u.x,i+u.y,u.w,u.h),u.a!==void 0&&u.a!==1&&(t.globalAlpha=1)}}function TS(t,l){const r=l.scale;t.clearRect(0,0,l.canvasWidth,l.canvasHeight),eg(t,l.pixels,r,0)}function eg(t,l,r,i,c){for(const u of l){const f=Jy(u.c,c);u.a!==void 0&&u.a!==1&&(t.globalAlpha=u.a),t.fillStyle=f,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 jc=new Map;function Ur(t,l,r){if("down"in r&&!("pixels"in r)){const c=r;jc.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;jc.set(t,{id:t,name:l,layer:{...c,name:"hair"}})}}function zS(t){return jc.get(t)}function tg(){return Array.from(jc.values())}Ur("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}]}});Ur("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}]}});Ur("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}]}});Ur("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}]}});Ur("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"}]}});Ur("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}]}});Ur("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}]}});Ur("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 Cc=new Map;function Tl(t,l,r){if("down"in r&&!("pixels"in r)){const c=r;Cc.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;Cc.set(t,{id:t,name:l,layer:{...c,name:"torso"}})}}function MS(t){return Cc.get(t)}function ng(){return Array.from(Cc.values())}Tl("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"}]}});Tl("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"}]}});Tl("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"}]}});Tl("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)"}]}});Tl("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)"}]}});Tl("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"}]}});Tl("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"}]}});Tl("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"}]}});Tl("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"}]}});Tl("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 Ds=new Map;function gt(t,l,r){if("down"in r&&!("pixels"in r)){const c=r;Ds.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;Ds.set(t,{id:t,name:l,layer:{...c,name:"accessory"}})}}function RS(t){return Ds.get(t)}function FS(t,l){const r=Ds.get(t);if(!r)return;if(r.directions)return ES(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 lg(){return Array.from(Ds.values())}gt("none","None",{name:"accessory",pixels:[]});gt("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}]}});gt("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}]}});gt("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}]}});gt("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}]}});gt("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}]}});gt("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}]}});gt("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}]}});gt("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}]}});gt("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}]}});gt("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}]}});gt("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}]}});gt("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"}]}});gt("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}]}});gt("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}]}});gt("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"}]}});gt("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}]}});gt("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}]}});gt("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}]}});gt("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}]}});gt("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"}]}});gt("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}]}});gt("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}]}});gt("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}]}});gt("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}]}});gt("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"}]}});gt("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"}]}});gt("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}]}});gt("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}]}});gt("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 _S={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 rg(t){return _S[t]??1}function ag(t,l){return l>=rg(t)}gt("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 hs({r:t,g:l,b:r}){return`#${(t<<16|l<<8|r).toString(16).padStart(6,"0")}`}function xc(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 OS(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 p=1/0;for(const d of r)p=Math.min(p,xc(m,d));return p}),u=c.reduce((m,p)=>m+p,0);let f=Math.random()*u;for(let m=0;m<t.length;m++)if(f-=c[m],f<=0){r.push(t[m]);break}r.length<=i&&r.push(t[Math.floor(Math.random()*t.length)])}return r}function BS(t,l,r=20){if(t.length===0)return[];const i=OS(t,l);for(let u=0;u<r;u++){const f=Array.from({length:l},()=>[]);for(const p of t){let d=1/0,g=0;for(let y=0;y<l;y++){const b=xc(p,i[y]);b<d&&(d=b,g=y)}f[g].push(p)}let m=!0;for(let p=0;p<l;p++){if(f[p].length===0)continue;const d={r:0,g:0,b:0};for(const b of f[p])d.r+=b.r,d.g+=b.g,d.b+=b.b;const g=f[p].length,y={r:Math.round(d.r/g),g:Math.round(d.g/g),b:Math.round(d.b/g)};xc(y,i[p])>1&&(m=!1),i[p]=y}if(m)break}const c=new Array(l).fill(0);for(const u of t){let f=1/0,m=0;for(let p=0;p<l;p++){const d=xc(u,i[p]);d<f&&(f=d,m=p)}c[m]++}return i.map((u,f)=>({c:u,count:c[f]})).sort((u,f)=>f.count-u.count).map(u=>u.c)}function LS(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 f=u.getImageData(0,0,i,c).data,m=i*c,p=Math.max(1,Math.floor(m/l)),d=[];for(let g=0;g<m;g+=p){const y=g*4;f[y+3]<128||d.push({r:f[y],g:f[y+1],b:f[y+2]})}return d}function i0(t){return .299*t.r+.587*t.g+.114*t.b}function s0(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 $S(t,l=8){const r=LS(t),i=BS(r,l);if(i.length<5)return{skinColor:"#F5CBA7",hairColor:"#2C1810",shirtColor:"#1565C0",pantsColor:"#37474F",shoeColor:"#212121"};const c=[...i].sort((y,b)=>i0(b)-i0(y)),u=[...i].sort((y,b)=>s0(b)-s0(y)),f=c[0],m=c[c.length-1],p=u[0],d=c[c.length-2],g=c[c.length-1];return{skinColor:hs(f),hairColor:hs(m),shirtColor:hs(p),pantsColor:hs(d),shoeColor:hs(g)}}const HS=[{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}],US=[{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"}],IS=[{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"}],YS=[{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 qS(){return{width:12,height:22,layers:[{name:"lower",pixels:HS},{name:"torso",pixels:US},{name:"head",pixels:IS},{name:"hair",pixels:YS},{name:"accessory",pixels:[]}]}}const XS=["cto","cbo","pm","engineer","designer","qa","data-analyst","default"];for(const t of XS)Py(`mini:${t}`,qS());const VS=[{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"}],GS=[{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"}],KS=[{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 QS(){return{width:12,height:22,layers:[{name:"torso",pixels:VS},{name:"head",pixels:GS},{name:"hair",pixels:KS},{name:"accessory",pixels:[]}]}}Py("mini-seated:default",QS());const WS={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"}]},ZS={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"}]},JS={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"}]},PS={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"}]};Oc("meeting",WS);Oc("bulletin",ZS);Oc("decision",PS);Oc("knowledge",JS);const xd=16,pd=24,ej=60,tj={cbo:0,cto:8,pm:15,engineer:22,designer:5,qa:12};function ig(t,l){if(!t)return t;let r=t;if(l!=null&&l.hairStyle){const i=zS(l.hairStyle);i&&(r=NS(r,i.layer))}if(l!=null&&l.outfitStyle){const i=MS(l.outfitStyle);i&&(r=Gd(r,"torso",i.layer,1))}if(l!=null&&l.accessory&&l.accessory!=="none"){const i=RS(l.accessory);i&&(r=Gd(r,"accessory",i.layer))}return r}function Bc({roleId:t,className:l,appearance:r,scale:i}){const c=k.useRef(null),u=k.useRef(0),f=k.useRef(0),m=k.useRef(r);m.current=r;const p=i??4,d=xd*p,g=pd*p,y=k.useMemo(()=>{const b=Kd(`mini:${t}`)??Kd("mini:default");return ig(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 j=tj[t]??0,S=()=>{f.current++;const C=m.current;if(!C||!y){u.current=requestAnimationFrame(S);return}const A=(f.current+j)%ej<30?1:0;v.clearRect(0,0,xd,pd),v.save(),v.translate(2,1),DS(v,y,A,C,1),v.restore(),u.current=requestAnimationFrame(S)};return u.current=requestAnimationFrame(S),()=>cancelAnimationFrame(u.current)},[t,y]),o.jsx("canvas",{ref:c,width:xd,height:pd,className:l,style:{imageRendering:"pixelated",display:"block",width:d,height:g}})}const nj="https://api.tycono.ai",wh=nj;async function nc(t){const l=await fetch(`${wh}${t}`);if(!l.ok)throw new Error(`Cloud API error: ${l.status}`);return l.json()}async function lc(t,l){const r=await fetch(`${wh}${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 Cs={health:()=>nc("/api/health"),getCharacters:()=>nc("/api/store/characters"),getCharacter:t=>nc(`/api/store/characters/${t}`),getCharacterVersion:t=>nc(`/api/store/characters/${t}/version`),syncCheck:t=>lc("/api/sync/check",{roles:t}),syncPull:t=>lc("/api/sync/pull",{sourceId:t}),publishCharacter:t=>lc("/api/store/publish",t),deleteCharacter:t=>fetch(`${wh}/api/store/characters/${t}`,{method:"DELETE"}).then(l=>l.json()),uploadTelemetry:t=>lc("/api/telemetry",t)},lj={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"},yd={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"},rj={cto:"Chief Technology Officer",cbo:"Chief Business Officer",pm:"Product Manager",engineer:"Software Engineer",designer:"UI/UX Designer",qa:"QA Engineer"},aj=500,o0=360,c0=700,ij=t=>`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`;function sj({role:t,allRoles:l,recentActivity:r,onClose:i,onFireRole:c,terminalWidth:u=0,activeJobId:f,activeTask:m,isWorking:p,jobStartedAt:d,onStopJob:g,sessions:y,streamingSessionId:b,onCreateSessionSilent:v,onSendMessage:j,onFocusTerminal:S,onCustomize:C,onUpdateRole:E,appearance:A,relationships:R,roleLevel:O}){var Re,qe;const[B,T]=k.useState(aj),[I,X]=k.useState(!1),ee=k.useRef(0),z=k.useRef(0),[$,U]=k.useState(!1),[ne,re]=k.useState(!1),[V,Y]=k.useState(!1),[Q,se]=k.useState(!1),[ve,M]=k.useState("talk"),[_,J]=k.useState(!1),[D,pe]=k.useState(""),[Ce,Ne]=k.useState(!1),He=k.useRef(null),{events:_e,status:oe}=X0(f??null),[K,fe]=k.useState(0);k.useEffect(()=>{if(!p||!d){fe(0);return}const we=new Date(d).getTime(),Ae=()=>fe(Math.floor((Date.now()-we)/1e3));Ae();const bt=setInterval(Ae,1e3);return()=>clearInterval(bt)},[p,d]);const Se=u>0,te=Se?u:0,ke=Se?Math.max(o0,window.innerWidth-u-100):c0,je=Math.min(B,ke),Te=k.useCallback(we=>{we.preventDefault(),ee.current=we.clientX,z.current=je,X(!0);const Ae=rt=>{const de=ee.current-rt.clientX,Pe=Math.min(c0,Math.max(o0,z.current+de));T(Pe)},bt=()=>{X(!1),document.removeEventListener("mousemove",Ae),document.removeEventListener("mouseup",bt)};document.addEventListener("mousemove",Ae),document.addEventListener("mouseup",bt)},[je]),Le=k.useRef(null),$e=t?y.find(we=>we.roleId===t.id):null,Yt=we=>{if(!t)return;const Ae=p?"talk":ve;$e?(j($e.id,we,Ae),S(t.id)):(Le.current={content:we,mode:Ae},v(t.id))};k.useEffect(()=>{if($e&&Le.current){const{content:we,mode:Ae}=Le.current;Le.current=null,j($e.id,we,Ae),t&&S(t.id)}},[$e==null?void 0:$e.id]);const pt=(()=>{if(!_e.length)return null;const we=[];let Ae=0,bt=0,rt=0;for(const de of _e)if(de.type==="thinking")Ae++;else if(de.type==="text")bt++;else if(de.type==="tool:start"){const Pe=String(de.data.name??"");we.includes(Pe)||we.push(Pe)}else de.type==="dispatch:start"&&rt++;return{tools:we,thinkCount:Ae,textCount:bt,dispatchCount:rt,total:_e.length}})(),St=m||(()=>{if(!$e)return null;const we=$e.messages;for(let Ae=we.length-1;Ae>=0;Ae--)if(we[Ae].from==="ceo")return we[Ae].content;return null})(),Bt=(()=>{if(!$e)return null;const we=$e.messages;for(let Ae=we.length-1;Ae>=0;Ae--)if(we[Ae].from==="role"&&we[Ae].content)return we[Ae].content;return null})();if(!t)return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:te},onClick:i}),o.jsx("div",{className:"side-panel open fixed top-0 h-full z-50 flex items-center justify-center border-l-[3px]",style:{right:te,width:je,background:"var(--terminal-bg)",borderLeftColor:"var(--pixel-border)"},children:o.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-muted)"},children:"Loading role..."})})]});const Kt=yd[t.id]??"#666",vt=lj[t.id]??"👤",qt=l.filter(we=>we.reportsTo===t.id),ae=$e&&b===$e.id,ye=t.name||rj[t.id]||t.id;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:te},onClick:i}),o.jsxs("div",{className:`side-panel open fixed top-0 h-full z-50 flex flex-col border-l-[3px] shadow-[-4px_0_20px_rgba(0,0,0,0.4)] ${I?"resizing":""}`,style:{borderLeftColor:Kt,right:te,width:je,background:"var(--terminal-bg)"},children:[o.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${I?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:Te}),o.jsxs("div",{className:"relative shrink-0 overflow-hidden",style:{background:`linear-gradient(135deg, ${Kt}ee, ${Kt}99)`},children:[o.jsx("div",{className:"absolute inset-0 opacity-[0.06]",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 8px, white 8px, white 9px)"}}),o.jsxs("div",{className:"absolute top-3 right-3 flex items-center gap-1.5 z-10",children:[C&&o.jsx("button",{onClick:()=>C(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:"🎨"}),o.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:"×"})]}),o.jsxs("div",{className:"relative flex items-end gap-4 px-4 pt-4 pb-3",children:[o.jsx("div",{className:"shrink-0 relative",style:{marginBottom:-2},children:o.jsx("div",{className:"rounded-lg p-1",style:{background:"rgba(0,0,0,0.2)"},children:o.jsx(Bc,{roleId:t.id,appearance:A,scale:8})})}),o.jsxs("div",{className:"flex-1 min-w-0 text-white pb-1",children:[o.jsxs("div",{className:"text-lg font-bold flex items-center gap-2",style:{fontFamily:"var(--pixel-font)"},children:[vt," ",t.id.toUpperCase(),p&&o.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"})]}),_?o.jsxs("form",{className:"flex items-center gap-1.5 mt-0.5",onSubmit:async we=>{we.preventDefault();const Ae=D.trim();if(!Ae||Ae===ye||!E){J(!1);return}Ne(!0);try{await E(t.id,{name:Ae})}catch{}Ne(!1),J(!1)},children:[o.jsx("input",{ref:He,value:D,onChange:we=>pe(we.target.value),onKeyDown:we=>{we.key==="Escape"&&J(!1)},disabled:Ce,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"}}),o.jsx("button",{type:"submit",disabled:Ce,className:"text-white/80 hover:text-white text-[10px] cursor-pointer shrink-0",children:"✓"}),o.jsx("button",{type:"button",onClick:()=>J(!1),className:"text-white/60 hover:text-white text-[10px] cursor-pointer shrink-0",children:"✕"})]}):o.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:()=>{E&&(pe(ye),J(!0))},title:E?"Click to edit name":void 0,children:[ye,E&&o.jsx("span",{className:"opacity-0 group-hover/name:opacity-60 text-[10px]",children:"✎"})]})]})]}),o.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:[o.jsxs("span",{children:["Lv.",O??1]}),o.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),o.jsxs("span",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:p?"var(--idle-amber)":"var(--active-green)"}}),p?"Working":"Idle"]}),o.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),o.jsx("span",{children:t.level}),t.reportsTo&&o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),o.jsxs("span",{className:"opacity-60",children:["→"," ",t.reportsTo]})]})]})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto flex flex-col min-h-0",children:[p&&o.jsxs("div",{className:"px-4 py-3 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)",background:"var(--hud-bg-alt)"},children:[o.jsxs("div",{className:"flex items-center justify-between mb-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-2 h-2 rounded-full animate-pulse",style:{background:"var(--idle-amber)"}}),o.jsxs("span",{className:"text-xs font-semibold",style:{color:"var(--idle-amber)"},children:["Working",K>0?` · ${ij(K)}`:""]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{onClick:()=>S(t.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"Open chat ↗"}),f&&g&&o.jsx("button",{onClick:()=>g(f),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"})]})]}),St&&o.jsx("div",{className:"text-xs truncate",style:{color:"var(--terminal-text-secondary)"},children:St})]}),p&&f&&pt&&o.jsxs("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[o.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[o.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)"},children:"Activity"}),o.jsx("button",{onClick:()=>S(t.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"View details ↗"})]}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[pt.thinkCount>0&&o.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:[o.jsx("span",{className:"w-1.5 h-1.5 rounded-full",style:{background:"#a855f7"}}),"thinking ×",pt.thinkCount]}),pt.tools.map(we=>o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(59,130,246,0.15)",color:"#60a5fa"},children:we},we)),pt.dispatchCount>0&&o.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(249,115,22,0.15)",color:"#fb923c"},children:["dispatch ×",pt.dispatchCount]}),pt.textCount>0&&o.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(34,197,94,0.15)",color:"#4ade80"},children:["output ×",pt.textCount]}),(oe==="streaming"||oe==="connecting")&&o.jsx("span",{className:"inline-block w-1.5 h-3 animate-pulse rounded-sm",style:{background:"var(--active-green)"}})]}),o.jsxs("div",{className:"text-[10px] mt-1",style:{color:"var(--terminal-text-muted)"},children:[pt.total," events"]})]}),p&&Bt&&o.jsxs("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[o.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[o.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)"},children:"Last Message"}),o.jsx("button",{onClick:()=>S(t.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"Open chat ↗"})]}),o.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:[Bt.slice(0,200),Bt.length>200&&"..."]})]}),p&&o.jsx("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:o.jsx(u0,{onSend:Yt,disabled:!!ae,placeholder:"Ask something...",color:Kt})}),!p&&o.jsxs("div",{className:"px-4 pt-4 pb-2",children:[o.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-secondary)"},children:"Latest"}),o.jsx(cj,{icon:vt,roleId:t.id,roleName:ye,color:Kt,text:r})]}),!p&&o.jsx("div",{className:"px-4 py-3",style:{borderBottom:"1px solid var(--terminal-border)"},children:o.jsxs("div",{className:"rounded-xl overflow-hidden",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[Bt&&o.jsxs("div",{className:"px-3 pt-2.5 pb-2 cursor-pointer transition-colors",style:{borderBottom:"1px solid var(--terminal-border)"},onClick:()=>S(t.id),children:[o.jsxs("div",{className:"flex items-center justify-between mb-1",children:[o.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--terminal-text-muted)"},children:"Last response"}),o.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:"View ↗"})]}),o.jsxs("div",{className:"text-xs leading-relaxed line-clamp-2 overflow-hidden",style:{color:"var(--terminal-text-secondary)"},children:[Bt.slice(0,150),Bt.length>150&&"..."]})]}),o.jsx("div",{className:"p-2",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("div",{className:"flex rounded-lg overflow-hidden shrink-0",style:{border:"1px solid var(--pixel-border)"},children:[o.jsx("button",{onClick:()=>M("talk"),className:"px-2 py-1 text-[10px] font-semibold cursor-pointer transition-colors",style:{background:ve==="talk"?"var(--accent)":"transparent",color:ve==="talk"?"#fff":"var(--terminal-text-secondary)"},children:"Talk"}),o.jsx("button",{onClick:()=>M("do"),className:"px-2 py-1 text-[10px] font-semibold cursor-pointer transition-colors",style:{background:ve==="do"?"var(--idle-amber)":"transparent",color:ve==="do"?"#fff":"var(--terminal-text-secondary)"},children:"Do"})]}),o.jsx(u0,{onSend:Yt,disabled:!!ae,placeholder:ve==="talk"?"Ask something...":"Give a directive...",color:Kt})]})})]})}),o.jsxs("div",{className:"px-4 py-2 space-y-1",children:[o.jsxs(rc,{title:`Profile${t.persona?"":" (empty)"}`,open:$,onToggle:()=>U(we=>!we),children:[t.persona&&o.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}),o.jsxs("div",{className:"space-y-0 mt-2",children:[o.jsx(gd,{label:"Level",value:t.level}),o.jsx(gd,{label:"Reports to",value:t.reportsTo}),o.jsx(gd,{label:"Status",value:t.status})]}),qt.length>0&&o.jsxs("div",{className:"mt-3",children:[o.jsx("div",{className:"text-[11px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"Direct Reports"}),o.jsx("div",{className:"space-y-1",children:qt.map(we=>o.jsxs("div",{className:"flex items-center gap-2 p-1.5 rounded-lg",style:{background:"var(--hud-bg-alt)"},children:[o.jsx("div",{className:"w-6 h-6 rounded flex items-center justify-center text-white text-[10px] font-bold",style:{background:yd[we.id]??"#666"},children:we.id.slice(0,2).toUpperCase()}),o.jsx("div",{className:"text-xs",style:{color:"var(--terminal-text)"},children:we.name})]},we.id))})]})]}),t.authority&&o.jsxs(rc,{title:"Authority",open:ne,onToggle:()=>re(we=>!we),children:[((Re=t.authority.autonomous)==null?void 0:Re.length)>0&&o.jsxs("div",{className:"mb-2",children:[o.jsx("div",{className:"text-xs font-semibold mb-1",style:{color:"var(--active-green)"},children:"Autonomous"}),t.authority.autonomous.map((we,Ae)=>o.jsxs("div",{className:"text-xs pl-3 py-0.5",style:{color:"var(--terminal-text-secondary)"},children:["- ",we]},Ae))]}),((qe=t.authority.needsApproval)==null?void 0:qe.length)>0&&o.jsxs("div",{children:[o.jsx("div",{className:"text-xs font-semibold mb-1",style:{color:"var(--idle-amber)"},children:"Needs Approval"}),t.authority.needsApproval.map((we,Ae)=>o.jsxs("div",{className:"text-xs pl-3 py-0.5",style:{color:"var(--terminal-text-secondary)"},children:["- ",we]},Ae))]})]}),t&&R&&(()=>{const we=R.filter(Ae=>Ae.roleA===t.id||Ae.roleB===t.id).filter(Ae=>Ae.familiarity>0).sort((Ae,bt)=>bt.familiarity-Ae.familiarity);return we.length===0?null:o.jsx(rc,{title:`Relationships (${we.length})`,open:V,onToggle:()=>Y(Ae=>!Ae),children:o.jsx("div",{className:"space-y-1.5",children:we.map((Ae,bt)=>{const rt=Ae.roleA===t.id?Ae.roleB:Ae.roleA,de=l.find(dn=>dn.id===rt),Pe=Ae.familiarity>=80?"Best Partner":Ae.familiarity>=50?"Friend":Ae.familiarity>=20?"Colleague":"Acquaintance",dt=Ae.familiarity>=80?"#4CAF50":Ae.familiarity>=50?"#2196F3":Ae.familiarity>=20?"#FF9800":"#9E9E9E";return o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-xs w-20 truncate",style:{color:yd[rt]??"var(--terminal-text-secondary)"},children:(de==null?void 0:de.name)??rt}),o.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-white/10",children:o.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Ae.familiarity}%`,background:dt}})}),o.jsx("span",{className:"text-[10px] w-16 text-right",style:{color:"var(--terminal-text-muted)"},children:Pe})]},bt)})})})})(),t.journal&&o.jsx(rc,{title:`Journal (${(t.journal.match(/### /g)??[]).length})`,open:Q,onToggle:()=>se(we=>!we),children:o.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:[o.jsx(Os,{content:t.journal.slice(0,3e3)}),t.journal.length>3e3&&o.jsx("div",{className:"italic mt-2",style:{color:"var(--terminal-text-muted)"},children:"... (truncated)"})]})})]}),o.jsx(oj,{role:t,appearance:A}),c&&o.jsx("div",{className:"px-4 pb-4 mt-auto shrink-0",children:o.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 oj({role:t,appearance:l}){const[r,i]=k.useState("idle"),[c,u]=k.useState(""),[f,m]=k.useState(!1),p=async()=>{var d,g;if(!f){m(!0);return}i("publishing");try{const y=(t.skills??[]).map(j=>({id:j.toLowerCase().replace(/\s+/g,"-"),name:j,category:"general"})),b={roleId:t.id,persona:t.persona??"",authority:t.authority??{autonomous:[],needsApproval:[]},level:t.level,tagline:((d=(t.persona??"").split(/[.\n]/)[0])==null?void 0:d.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 j=await Cs.getCharacterVersion(t.id);if(j!=null&&j.version){const S=j.version.split(".").map(Number);S[2]=(S[2]??0)+1,v=S.join(".")}}catch{}await Cs.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 o.jsx("div",{className:"px-4 pb-2 shrink-0",children:o.jsx("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--terminal-border)"},children:o.jsxs("div",{className:"px-3 py-2.5 flex items-center justify-between",style:{background:"var(--hud-bg-alt)"},children:[o.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"?o.jsx("span",{className:"text-[10px] font-semibold",style:{color:"var(--active-green)"},children:c}):r==="error"?o.jsx("span",{className:"text-[10px] font-semibold",style:{color:"#ef4444"},children:c}):o.jsx("button",{onClick:p,disabled:r==="publishing",className:"text-[10px] px-2.5 py-1 rounded font-semibold cursor-pointer transition-colors disabled:opacity-50",style:{background:f?"rgba(59,130,246,0.3)":"rgba(59,130,246,0.15)",color:"#60a5fa",border:f?"1px solid rgba(59,130,246,0.5)":"1px solid transparent"},children:r==="publishing"?"Publishing...":f?"Confirm Publish?":"Publish to Store"})]})})})}function cj({icon:t,roleId:l,roleName:r,color:i,text:c}){const u=!!c;return o.jsx("div",{className:"relative",children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsxs("div",{className:"shrink-0",children:[o.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}),o.jsx("div",{className:"text-[9px] font-bold text-center mt-0.5 uppercase tracking-wide",style:{color:i},children:l})]}),o.jsx("div",{className:"flex-1 min-w-0",children:o.jsxs("div",{className:"relative",children:[o.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`}}),o.jsxs("div",{className:"rounded-xl rounded-tl-sm p-4 border",style:{background:`${i}08`,borderColor:`${i}22`},children:[o.jsx("div",{className:"text-[10px] font-semibold mb-1.5 uppercase tracking-wider",style:{color:i},children:r}),u?o.jsx("div",{className:"text-sm leading-relaxed",style:{color:"var(--terminal-text)"},children:o.jsx(Os,{content:c})}):o.jsx("div",{className:"text-sm italic",style:{color:"var(--terminal-text-muted)"},children:"No recent activity."})]})]})})]})})}function rc({title:t,open:l,onToggle:r,children:i}){return o.jsxs("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--terminal-border)"},children:[o.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:[o.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},children:t}),o.jsx("span",{className:"text-[10px] transition-transform",style:{color:"var(--terminal-text-muted)",transform:l?"rotate(0deg)":"rotate(-90deg)"},children:"▼"})]}),l&&o.jsx("div",{className:"px-3 pb-3 pt-2",style:{borderTop:"1px solid var(--terminal-border)"},children:i})]})}function u0({onSend:t,disabled:l,placeholder:r,color:i}){const[c,u]=k.useState(""),f=()=>{const m=c.trim();!m||l||(t(m),u(""))};return o.jsxs("div",{className:"flex items-center gap-1.5 flex-1",children:[o.jsx("input",{type:"text",value:c,onChange:m=>u(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),f())},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)"}}),o.jsx("button",{onClick:f,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:o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M22 2L11 13"}),o.jsx("path",{d:"M22 2L15 22L11 13L2 9L22 2Z"})]})})]})}function gd({label:t,value:l}){return o.jsxs("div",{className:"flex justify-between py-1.5 text-xs",style:{borderBottom:"1px solid var(--terminal-border)"},children:[o.jsx("span",{style:{color:"var(--terminal-text-muted)"},children:t}),o.jsx("span",{className:"font-semibold",style:{color:"var(--terminal-text)"},children:l})]})}function uj(t,l){var r,i=1;t==null&&(t=0),l==null&&(l=0);function c(){var u,f=r.length,m,p=0,d=0;for(u=0;u<f;++u)m=r[u],p+=m.x,d+=m.y;for(p=(p/f-t)*i,d=(d/f-l)*i,u=0;u<f;++u)m=r[u],m.x-=p,m.y-=d}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 fj(t){const l=+this._x.call(null,t),r=+this._y.call(null,t);return sg(this.cover(l,r),l,r,t)}function sg(t,l,r,i){if(isNaN(l)||isNaN(r))return t;var c,u=t._root,f={data:i},m=t._x0,p=t._y0,d=t._x1,g=t._y1,y,b,v,j,S,C,E,A;if(!u)return t._root=f,t;for(;u.length;)if((S=l>=(y=(m+d)/2))?m=y:d=y,(C=r>=(b=(p+g)/2))?p=b:g=b,c=u,!(u=u[E=C<<1|S]))return c[E]=f,t;if(v=+t._x.call(null,u.data),j=+t._y.call(null,u.data),l===v&&r===j)return f.next=u,c?c[E]=f:t._root=f,t;do c=c?c[E]=new Array(4):t._root=new Array(4),(S=l>=(y=(m+d)/2))?m=y:d=y,(C=r>=(b=(p+g)/2))?p=b:g=b;while((E=C<<1|S)===(A=(j>=b)<<1|v>=y));return c[A]=u,c[E]=f,t}function dj(t){var l,r,i=t.length,c,u,f=new Array(i),m=new Array(i),p=1/0,d=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))||(f[r]=c,m[r]=u,c<p&&(p=c),c>g&&(g=c),u<d&&(d=u),u>y&&(y=u));if(p>g||d>y)return this;for(this.cover(p,d).cover(g,y),r=0;r<i;++r)sg(this,f[r],m[r],t[r]);return this}function hj(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 f=c-r||1,m=this._root,p,d;r>t||t>=c||i>l||l>=u;)switch(d=(l<i)<<1|t<r,p=new Array(4),p[d]=m,m=p,f*=2,d){case 0:c=r+f,u=i+f;break;case 1:r=c-f,u=i+f;break;case 2:c=r+f,i=u-f;break;case 3:r=c-f,i=u-f;break}this._root&&this._root.length&&(this._root=m)}return this._x0=r,this._y0=i,this._x1=c,this._y1=u,this}function mj(){var t=[];return this.visit(function(l){if(!l.length)do t.push(l.data);while(l=l.next)}),t}function xj(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 wn(t,l,r,i,c){this.node=t,this.x0=l,this.y0=r,this.x1=i,this.y1=c}function pj(t,l,r){var i,c=this._x0,u=this._y0,f,m,p,d,g=this._x1,y=this._y1,b=[],v=this._root,j,S;for(v&&b.push(new wn(v,c,u,g,y)),r==null?r=1/0:(c=t-r,u=l-r,g=t+r,y=l+r,r*=r);j=b.pop();)if(!(!(v=j.node)||(f=j.x0)>g||(m=j.y0)>y||(p=j.x1)<c||(d=j.y1)<u))if(v.length){var C=(f+p)/2,E=(m+d)/2;b.push(new wn(v[3],C,E,p,d),new wn(v[2],f,E,C,d),new wn(v[1],C,m,p,E),new wn(v[0],f,m,C,E)),(S=(l>=E)<<1|t>=C)&&(j=b[b.length-1],b[b.length-1]=b[b.length-1-S],b[b.length-1-S]=j)}else{var A=t-+this._x.call(null,v.data),R=l-+this._y.call(null,v.data),O=A*A+R*R;if(O<r){var B=Math.sqrt(r=O);c=t-B,u=l-B,g=t+B,y=l+B,i=v.data}}return i}function yj(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,f=this._x0,m=this._y0,p=this._x1,d=this._y1,g,y,b,v,j,S,C,E;if(!r)return this;if(r.length)for(;;){if((j=g>=(b=(f+p)/2))?f=b:p=b,(S=y>=(v=(m+d)/2))?m=v:d=v,l=r,!(r=r[C=S<<1|j]))return this;if(!r.length)break;(l[C+1&3]||l[C+2&3]||l[C+3&3])&&(i=l,E=C)}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[C]=u:delete l[C],(r=l[0]||l[1]||l[2]||l[3])&&r===(l[3]||l[2]||l[1]||l[0])&&!r.length&&(i?i[E]=r:this._root=r),this):(this._root=u,this)}function gj(t){for(var l=0,r=t.length;l<r;++l)this.remove(t[l]);return this}function bj(){return this._root}function vj(){var t=0;return this.visit(function(l){if(!l.length)do++t;while(l=l.next)}),t}function wj(t){var l=[],r,i=this._root,c,u,f,m,p;for(i&&l.push(new wn(i,this._x0,this._y0,this._x1,this._y1));r=l.pop();)if(!t(i=r.node,u=r.x0,f=r.y0,m=r.x1,p=r.y1)&&i.length){var d=(u+m)/2,g=(f+p)/2;(c=i[3])&&l.push(new wn(c,d,g,m,p)),(c=i[2])&&l.push(new wn(c,u,g,d,p)),(c=i[1])&&l.push(new wn(c,d,f,m,g)),(c=i[0])&&l.push(new wn(c,u,f,d,g))}return this}function kj(t){var l=[],r=[],i;for(this._root&&l.push(new wn(this._root,this._x0,this._y0,this._x1,this._y1));i=l.pop();){var c=i.node;if(c.length){var u,f=i.x0,m=i.y0,p=i.x1,d=i.y1,g=(f+p)/2,y=(m+d)/2;(u=c[0])&&l.push(new wn(u,f,m,g,y)),(u=c[1])&&l.push(new wn(u,g,m,p,y)),(u=c[2])&&l.push(new wn(u,f,y,g,d)),(u=c[3])&&l.push(new wn(u,g,y,p,d))}r.push(i)}for(;i=r.pop();)t(i.node,i.x0,i.y0,i.x1,i.y1);return this}function Sj(t){return t[0]}function jj(t){return arguments.length?(this._x=t,this):this._x}function Cj(t){return t[1]}function Ej(t){return arguments.length?(this._y=t,this):this._y}function kh(t,l,r){var i=new Sh(l??Sj,r??Cj,NaN,NaN,NaN,NaN);return t==null?i:i.addAll(t)}function Sh(t,l,r,i,c,u){this._x=t,this._y=l,this._x0=r,this._y0=i,this._x1=c,this._y1=u,this._root=void 0}function f0(t){for(var l={data:t.data},r=l;t=t.next;)r=r.next={data:t.data};return l}var kn=kh.prototype=Sh.prototype;kn.copy=function(){var t=new Sh(this._x,this._y,this._x0,this._y0,this._x1,this._y1),l=this._root,r,i;if(!l)return t;if(!l.length)return t._root=f0(l),t;for(r=[{source:l,target:t._root=new Array(4)}];l=r.pop();)for(var c=0;c<4;++c)(i=l.source[c])&&(i.length?r.push({source:i,target:l.target[c]=new Array(4)}):l.target[c]=f0(i));return t};kn.add=fj;kn.addAll=dj;kn.cover=hj;kn.data=mj;kn.extent=xj;kn.find=pj;kn.remove=yj;kn.removeAll=gj;kn.root=bj;kn.size=vj;kn.visit=wj;kn.visitAfter=kj;kn.x=jj;kn.y=Ej;function ya(t){return function(){return t}}function Lr(t){return(t()-.5)*1e-6}function Nj(t){return t.x+t.vx}function Aj(t){return t.y+t.vy}function Dj(t){var l,r,i,c=1,u=1;typeof t!="function"&&(t=ya(t==null?1:+t));function f(){for(var d,g=l.length,y,b,v,j,S,C,E=0;E<u;++E)for(y=kh(l,Nj,Aj).visitAfter(m),d=0;d<g;++d)b=l[d],S=r[b.index],C=S*S,v=b.x+b.vx,j=b.y+b.vy,y.visit(A);function A(R,O,B,T,I){var X=R.data,ee=R.r,z=S+ee;if(X){if(X.index>b.index){var $=v-X.x-X.vx,U=j-X.y-X.vy,ne=$*$+U*U;ne<z*z&&($===0&&($=Lr(i),ne+=$*$),U===0&&(U=Lr(i),ne+=U*U),ne=(z-(ne=Math.sqrt(ne)))/ne*c,b.vx+=($*=ne)*(z=(ee*=ee)/(C+ee)),b.vy+=(U*=ne)*z,X.vx-=$*(z=1-z),X.vy-=U*z)}return}return O>v+z||T<v-z||B>j+z||I<j-z}}function m(d){if(d.data)return d.r=r[d.data.index];for(var g=d.r=0;g<4;++g)d[g]&&d[g].r>d.r&&(d.r=d[g].r)}function p(){if(l){var d,g=l.length,y;for(r=new Array(g),d=0;d<g;++d)y=l[d],r[y.index]=+t(y,d,l)}}return f.initialize=function(d,g){l=d,i=g,p()},f.iterations=function(d){return arguments.length?(u=+d,f):u},f.strength=function(d){return arguments.length?(c=+d,f):c},f.radius=function(d){return arguments.length?(t=typeof d=="function"?d:ya(+d),p(),f):t},f}function Tj(t){return t.index}function d0(t,l){var r=t.get(l);if(!r)throw new Error("node not found: "+l);return r}function zj(t){var l=Tj,r=y,i,c=ya(30),u,f,m,p,d,g=1;t==null&&(t=[]);function y(C){return 1/Math.min(m[C.source.index],m[C.target.index])}function b(C){for(var E=0,A=t.length;E<g;++E)for(var R=0,O,B,T,I,X,ee,z;R<A;++R)O=t[R],B=O.source,T=O.target,I=T.x+T.vx-B.x-B.vx||Lr(d),X=T.y+T.vy-B.y-B.vy||Lr(d),ee=Math.sqrt(I*I+X*X),ee=(ee-u[R])/ee*C*i[R],I*=ee,X*=ee,T.vx-=I*(z=p[R]),T.vy-=X*z,B.vx+=I*(z=1-z),B.vy+=X*z}function v(){if(f){var C,E=f.length,A=t.length,R=new Map(f.map((B,T)=>[l(B,T,f),B])),O;for(C=0,m=new Array(E);C<A;++C)O=t[C],O.index=C,typeof O.source!="object"&&(O.source=d0(R,O.source)),typeof O.target!="object"&&(O.target=d0(R,O.target)),m[O.source.index]=(m[O.source.index]||0)+1,m[O.target.index]=(m[O.target.index]||0)+1;for(C=0,p=new Array(A);C<A;++C)O=t[C],p[C]=m[O.source.index]/(m[O.source.index]+m[O.target.index]);i=new Array(A),j(),u=new Array(A),S()}}function j(){if(f)for(var C=0,E=t.length;C<E;++C)i[C]=+r(t[C],C,t)}function S(){if(f)for(var C=0,E=t.length;C<E;++C)u[C]=+c(t[C],C,t)}return b.initialize=function(C,E){f=C,d=E,v()},b.links=function(C){return arguments.length?(t=C,v(),b):t},b.id=function(C){return arguments.length?(l=C,b):l},b.iterations=function(C){return arguments.length?(g=+C,b):g},b.strength=function(C){return arguments.length?(r=typeof C=="function"?C:ya(+C),j(),b):r},b.distance=function(C){return arguments.length?(c=typeof C=="function"?C:ya(+C),S(),b):c},b}var Mj={value:()=>{}};function og(){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 pc(r)}function pc(t){this._=t}function Rj(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}})}pc.prototype=og.prototype={constructor:pc,on:function(t,l){var r=this._,i=Rj(t+"",r),c,u=-1,f=i.length;if(arguments.length<2){for(;++u<f;)if((c=(t=i[u]).type)&&(c=Fj(r[c],t.name)))return c;return}if(l!=null&&typeof l!="function")throw new Error("invalid callback: "+l);for(;++u<f;)if(c=(t=i[u]).type)r[c]=h0(r[c],t.name,l);else if(l==null)for(c in r)r[c]=h0(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 pc(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 Fj(t,l){for(var r=0,i=t.length,c;r<i;++r)if((c=t[r]).name===l)return c.value}function h0(t,l,r){for(var i=0,c=t.length;i<c;++i)if(t[i].name===l){t[i]=Mj,t=t.slice(0,i).concat(t.slice(i+1));break}return r!=null&&t.push({name:l,value:r}),t}var si=0,gs=0,ms=0,cg=1e3,Ec,bs,Nc=0,ba=0,Lc=0,Ts=typeof performance=="object"&&performance.now?performance:Date,ug=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function fg(){return ba||(ug(_j),ba=Ts.now()+Lc)}function _j(){ba=0}function Wd(){this._call=this._time=this._next=null}Wd.prototype=dg.prototype={constructor:Wd,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&&bs!==this&&(bs?bs._next=this:Ec=this,bs=this),this._call=t,this._time=r,Zd()},stop:function(){this._call&&(this._call=null,this._time=1/0,Zd())}};function dg(t,l,r){var i=new Wd;return i.restart(t,l,r),i}function Oj(){fg(),++si;for(var t=Ec,l;t;)(l=ba-t._time)>=0&&t._call.call(void 0,l),t=t._next;--si}function m0(){ba=(Nc=Ts.now())+Lc,si=gs=0;try{Oj()}finally{si=0,Lj(),ba=0}}function Bj(){var t=Ts.now(),l=t-Nc;l>cg&&(Lc-=l,Nc=t)}function Lj(){for(var t,l=Ec,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:Ec=r);bs=t,Zd(i)}function Zd(t){if(!si){gs&&(gs=clearTimeout(gs));var l=t-ba;l>24?(t<1/0&&(gs=setTimeout(m0,t-Ts.now()-Lc)),ms&&(ms=clearInterval(ms))):(ms||(Nc=Ts.now(),ms=setInterval(Bj,cg)),si=1,ug(m0))}}const $j=1664525,Hj=1013904223,x0=4294967296;function Uj(){let t=1;return()=>(t=($j*t+Hj)%x0)/x0}function Ij(t){return t.x}function Yj(t){return t.y}var qj=10,Xj=Math.PI*(3-Math.sqrt(5));function Vj(t){var l,r=1,i=.001,c=1-Math.pow(i,1/300),u=0,f=.6,m=new Map,p=dg(y),d=og("tick","end"),g=Uj();t==null&&(t=[]);function y(){b(),d.call("tick",l),r<i&&(p.stop(),d.call("end",l))}function b(S){var C,E=t.length,A;S===void 0&&(S=1);for(var R=0;R<S;++R)for(r+=(u-r)*c,m.forEach(function(O){O(r)}),C=0;C<E;++C)A=t[C],A.fx==null?A.x+=A.vx*=f:(A.x=A.fx,A.vx=0),A.fy==null?A.y+=A.vy*=f:(A.y=A.fy,A.vy=0);return l}function v(){for(var S=0,C=t.length,E;S<C;++S){if(E=t[S],E.index=S,E.fx!=null&&(E.x=E.fx),E.fy!=null&&(E.y=E.fy),isNaN(E.x)||isNaN(E.y)){var A=qj*Math.sqrt(.5+S),R=S*Xj;E.x=A*Math.cos(R),E.y=A*Math.sin(R)}(isNaN(E.vx)||isNaN(E.vy))&&(E.vx=E.vy=0)}}function j(S){return S.initialize&&S.initialize(t,g),S}return v(),l={tick:b,restart:function(){return p.restart(y),l},stop:function(){return p.stop(),l},nodes:function(S){return arguments.length?(t=S,v(),m.forEach(j),l):t},alpha:function(S){return arguments.length?(r=+S,l):r},alphaMin:function(S){return arguments.length?(i=+S,l):i},alphaDecay:function(S){return arguments.length?(c=+S,l):+c},alphaTarget:function(S){return arguments.length?(u=+S,l):u},velocityDecay:function(S){return arguments.length?(f=1-S,l):1-f},randomSource:function(S){return arguments.length?(g=S,m.forEach(j),l):g},force:function(S,C){return arguments.length>1?(C==null?m.delete(S):m.set(S,j(C)),l):m.get(S)},find:function(S,C,E){var A=0,R=t.length,O,B,T,I,X;for(E==null?E=1/0:E*=E,A=0;A<R;++A)I=t[A],O=S-I.x,B=C-I.y,T=O*O+B*B,T<E&&(X=I,E=T);return X},on:function(S,C){return arguments.length>1?(d.on(S,C),l):d.on(S)}}}function Gj(){var t,l,r,i,c=ya(-30),u,f=1,m=1/0,p=.81;function d(v){var j,S=t.length,C=kh(t,Ij,Yj).visitAfter(y);for(i=v,j=0;j<S;++j)l=t[j],C.visit(b)}function g(){if(t){var v,j=t.length,S;for(u=new Array(j),v=0;v<j;++v)S=t[v],u[S.index]=+c(S,v,t)}}function y(v){var j=0,S,C,E=0,A,R,O;if(v.length){for(A=R=O=0;O<4;++O)(S=v[O])&&(C=Math.abs(S.value))&&(j+=S.value,E+=C,A+=C*S.x,R+=C*S.y);v.x=A/E,v.y=R/E}else{S=v,S.x=S.data.x,S.y=S.data.y;do j+=u[S.data.index];while(S=S.next)}v.value=j}function b(v,j,S,C){if(!v.value)return!0;var E=v.x-l.x,A=v.y-l.y,R=C-j,O=E*E+A*A;if(R*R/p<O)return O<m&&(E===0&&(E=Lr(r),O+=E*E),A===0&&(A=Lr(r),O+=A*A),O<f&&(O=Math.sqrt(f*O)),l.vx+=E*v.value*i/O,l.vy+=A*v.value*i/O),!0;if(v.length||O>=m)return;(v.data!==l||v.next)&&(E===0&&(E=Lr(r),O+=E*E),A===0&&(A=Lr(r),O+=A*A),O<f&&(O=Math.sqrt(f*O)));do v.data!==l&&(R=u[v.data.index]*i/O,l.vx+=E*R,l.vy+=A*R);while(v=v.next)}return d.initialize=function(v,j){t=v,r=j,g()},d.strength=function(v){return arguments.length?(c=typeof v=="function"?v:ya(+v),g(),d):c},d.distanceMin=function(v){return arguments.length?(f=v*v,d):Math.sqrt(f)},d.distanceMax=function(v){return arguments.length?(m=v*v,d):Math.sqrt(m)},d.theta=function(v){return arguments.length?(p=v*v,d):Math.sqrt(p)},d}const zs={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 Kj(t){return zs[t]??zs.general}function Qj({docs:t,onNodeClick:l,selectedDocId:r}){var $;const i=k.useRef(null),c=k.useRef(null),[u,f]=k.useState({width:600,height:400}),[m,p]=k.useState({nodes:[],links:[]}),[d,g]=k.useState(null),[y,b]=k.useState(null),[v,j]=k.useState({x:0,y:0}),[S,C]=k.useState({x:0,y:0,w:600,h:400}),E=k.useRef(!1),A=k.useRef({x:0,y:0,vx:0,vy:0}),R=k.useRef(null),O=k.useRef(null);k.useEffect(()=>{const U=i.current;if(!U)return;const ne=new ResizeObserver(re=>{const{width:V,height:Y}=re[0].contentRect;V>0&&Y>0&&(f({width:V,height:Y}),C(Q=>({...Q,w:V,h:Y})))});return ne.observe(U),()=>ne.disconnect()},[]),k.useEffect(()=>{if(t.length===0)return;const U=new Set(t.map(se=>se.id)),ne=t.map(se=>({id:se.id,title:se.title,category:se.category,akb_type:se.akb_type})),re=[];for(const se of t)for(const ve of se.links){const M=ve.href.replace(/^.*knowledge\//,"").replace(/^\.\.\/.*$/,"").replace(/^\.\//,"");U.has(M)&&M!==se.id&&(re.some(_=>_.source===se.id&&_.target===M||_.source===M&&_.target===se.id)||re.push({source:se.id,target:M,label:ve.text}))}const{width:V,height:Y}=u,Q=Vj(ne).force("link",zj(re).id(se=>se.id).distance(140)).force("charge",Gj().strength(-400)).force("center",uj(V/2,Y/2)).force("collide",Dj(50));O.current=Q,Q.on("tick",()=>{for(const se of ne)se.x=Math.max(60,Math.min(V-60,se.x??V/2)),se.y=Math.max(60,Math.min(Y-60,se.y??Y/2));p({nodes:[...ne],links:[...re]})}),Q.alpha(1).restart();for(let se=0;se<150;se++)Q.tick();return Q.stop(),p({nodes:[...ne],links:[...re]}),()=>{Q.stop()}},[t,u]);const B=U=>{if(typeof U=="string"){const ne=m.nodes.find(re=>re.id===U);return{x:(ne==null?void 0:ne.x)??0,y:(ne==null?void 0:ne.y)??0}}return{x:U.x??0,y:U.y??0}},T=k.useCallback(U=>{U.preventDefault();const ne=U.deltaY>0?1.1:.9;C(re=>{const V=Math.max(200,Math.min(u.width*3,re.w*ne)),Y=Math.max(150,Math.min(u.height*3,re.h*ne)),Q=(V-re.w)/2,se=(Y-re.h)/2;return{x:re.x-Q,y:re.y-se,w:V,h:Y}})},[u]),I=k.useCallback(U=>{U.button===0&&(E.current=!0,A.current={x:U.clientX,y:U.clientY,vx:S.x,vy:S.y})},[S]),X=k.useCallback(U=>{var ne;if(R.current){const re=c.current;if(!re)return;const V=re.getBoundingClientRect(),Y=S.w/V.width,Q=S.h/V.height,se=S.x+(U.clientX-V.left)*Y,ve=S.y+(U.clientY-V.top)*Q;R.current.fx=se,R.current.fy=ve,(ne=O.current)==null||ne.alpha(.3).restart();return}if(E.current){const re=(U.clientX-A.current.x)*(S.w/u.width),V=(U.clientY-A.current.y)*(S.h/u.height);C(Y=>({...Y,x:A.current.vx-re,y:A.current.vy-V}))}},[S,u]),ee=k.useCallback(()=>{E.current=!1,R.current&&(R.current.fx=null,R.current.fy=null,R.current=null)},[]),z=k.useCallback((U,ne)=>{var re;U.stopPropagation(),R.current=ne,(re=O.current)==null||re.alpha(.3).restart()},[]);return o.jsxs("div",{ref:i,className:"relative flex-1 overflow-hidden",style:{background:"#1e1e2e"},children:[o.jsxs("svg",{ref:c,width:u.width,height:u.height,viewBox:`${S.x} ${S.y} ${S.w} ${S.h}`,style:{display:"block",cursor:E.current?"grabbing":"grab"},onWheel:T,onMouseDown:I,onMouseMove:X,onMouseUp:ee,onMouseLeave:ee,children:[o.jsx("defs",{children:o.jsx("pattern",{id:"grid",width:"20",height:"20",patternUnits:"userSpaceOnUse",children:o.jsx("circle",{cx:"0",cy:"0",r:"0.5",fill:"rgba(255,255,255,0.06)"})})}),o.jsx("rect",{x:S.x-100,y:S.y-100,width:S.w+200,height:S.h+200,fill:"url(#grid)",pointerEvents:"none"}),m.links.map((U,ne)=>{const re=B(U.source),V=B(U.target),Y=y===ne,Q=(re.x+V.x)/2,se=(re.y+V.y)/2;return o.jsxs("g",{children:[o.jsx("line",{x1:re.x,y1:re.y,x2:V.x,y2:V.y,stroke:"transparent",strokeWidth:12,style:{cursor:"default"},onMouseEnter:()=>b(ne),onMouseLeave:()=>b(null)}),o.jsx("line",{x1:re.x,y1:re.y,x2:V.x,y2:V.y,stroke:Y?"rgba(148,163,184,0.7)":"rgba(148,163,184,0.3)",strokeWidth:Y?2:1.5,strokeDasharray:"4 3",pointerEvents:"none"}),Y&&U.label&&o.jsx("text",{x:Q,y:se-6,textAnchor:"middle",fill:"#e2e8f0",fontSize:9,fontFamily:"monospace",style:{pointerEvents:"none"},children:o.jsx("tspan",{style:{filter:"drop-shadow(0 0 2px rgba(0,0,0,0.8))"},children:U.label.length>30?U.label.slice(0,28)+"..":U.label})})]},ne)}),m.nodes.map(U=>{const ne=zs[U.category]??zs.general,re=U.akb_type==="hub",V=re?24:16,Y=(d==null?void 0:d.id)===U.id,Q=r===U.id,se=Y?1.2:Q?1.15:1;return o.jsxs("g",{transform:`translate(${U.x??0}, ${U.y??0}) scale(${se})`,style:{cursor:"pointer",transition:"transform 0.15s ease"},onClick:ve=>{ve.stopPropagation();const M=t.find(_=>_.id===U.id);M&&l(M)},onMouseDown:ve=>z(ve,U),onMouseEnter:ve=>{var _;g(U);const M=(_=i.current)==null?void 0:_.getBoundingClientRect();M&&j({x:ve.clientX-M.left,y:ve.clientY-M.top})},onMouseLeave:()=>g(null),children:[Q&&o.jsx("rect",{x:-V/2-4,y:-V/2-4,width:V+8,height:V+8,fill:"none",stroke:"#22c55e",strokeWidth:2,rx:re?5:2,opacity:.6}),o.jsx("rect",{x:-V/2,y:-V/2,width:V,height:V,fill:ne.border,rx:re?4:2,opacity:Y?1:.9}),o.jsx("rect",{x:-V/2+3,y:-V/2+3,width:Math.max(0,V-6),height:Math.max(0,V-6),fill:ne.bg,rx:re?3:1}),o.jsx("text",{y:V/2+14,textAnchor:"middle",fill:Q?"#e2e8f0":"#94a3b8",fontSize:11,fontFamily:"monospace",fontWeight:Q?"bold":"normal",style:{pointerEvents:"none"},children:U.title.length>24?U.title.slice(0,22)+"..":U.title})]},U.id)})]}),d&&!R.current&&o.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:[o.jsx("div",{className:"font-bold mb-1",children:d.title}),o.jsxs("div",{className:"text-[10px] opacity-60 mb-1",children:[d.akb_type.toUpperCase()," / ",d.category]}),(($=t.find(U=>U.id===d.id))==null?void 0:$.tldr)&&o.jsx("div",{className:"text-[10px] opacity-80 mb-1",children:t.find(U=>U.id===d.id).tldr}),o.jsx("div",{className:"text-[10px] text-green-400",children:"Click to open | Drag to move"})]}),t.length===0&&o.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 Wj({doc:t,allDocs:l,onOpen:r,onNavigateDoc:i}){const[c,u]=k.useState(!1),f=Kj(t.category),m=t.akb_type==="hub",p=new Set(l.map(d=>d.id));return o.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:[o.jsxs("div",{className:"p-3 cursor-pointer hover:bg-white/5",onClick:()=>u(!c),children:[o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx("span",{className:"shrink-0 text-sm",children:m?"🗂":t.format==="html"?"🌐":"📄"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[o.jsx("span",{className:"font-semibold text-xs truncate",style:{color:"var(--terminal-text)"},children:t.title}),o.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})]}),o.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:t.tags.slice(0,4).map(d=>o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-medium",style:{background:f.bg,color:f.text,border:`1px solid ${f.border}`},children:d},d))})]}),o.jsx("span",{className:"text-xs shrink-0",style:{color:"var(--terminal-text-muted)"},children:c?"▲":"▼"})]}),!c&&t.tldr&&o.jsx("div",{className:"mt-1.5 text-[10px] line-clamp-2 ml-6",style:{color:"var(--terminal-text-secondary)"},children:t.tldr})]}),c&&o.jsxs("div",{className:"px-3 pb-3",style:{borderTop:"1px solid var(--terminal-border)"},children:[t.tldr&&o.jsx("div",{className:"mt-2 text-[11px] leading-relaxed italic",style:{color:"var(--terminal-text-secondary)"},children:t.tldr}),t.links.length>0&&o.jsxs("div",{className:"mt-2",children:[o.jsx("div",{className:"text-[9px] font-bold uppercase mb-1",style:{color:"var(--terminal-text-muted)"},children:"Cross-links"}),o.jsx("div",{className:"flex flex-wrap gap-1",children:t.links.slice(0,5).map((d,g)=>{const y=d.href.replace(/^.*knowledge\//,"").replace(/^\.\.\/.*$/,"").replace(/^\.\//,""),b=p.has(y);return o.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:["🔗"," ",d.text]},g)})})]}),o.jsxs("button",{className:"mt-2 text-[10px] font-semibold cursor-pointer hover:opacity-70",style:{color:"var(--active-green)"},onClick:d=>{d.stopPropagation(),r(t)},children:["Open full ","→"]})]})]})}function Zj({docId:t,onBack:l,onDocUpdated:r,onDelete:i,onNavigateDoc:c,allDocs:u}){const[f,m]=k.useState(null),[p,d]=k.useState(!0),[g,y]=k.useState(!1),[b,v]=k.useState(""),[j,S]=k.useState(!1),C=new Set(u.map(B=>B.id)),E=k.useCallback(B=>{const T=B.split("#")[0];if(!T.match(/\.(md|html)$/))return null;const I=t.includes("/")?t.replace(/\/[^/]+$/,""):"";let X;if(T.startsWith("./"))X=I?`${I}/${T.slice(2)}`:T.slice(2);else if(T.startsWith("../")){const $=I.split("/").filter(Boolean);let U=T;for(;U.startsWith("../");)$.length>0&&$.pop(),U=U.slice(3);X=$.length>0?`${$.join("/")}/${U}`:U}else X=T;if(C.has(X))return X;const ee=X.split("/").pop()??"",z=u.find($=>$.id===ee||$.id.endsWith("/"+ee));return z?z.id:null},[t,C,u]),A=k.useCallback(B=>{const I=B.target.closest("a");if(!I)return;const X=I.getAttribute("href");if(!X||X.startsWith("http://")||X.startsWith("https://")||!X.match(/\.(md|html)(#.*)?$/))return;B.preventDefault(),B.stopPropagation();const ee=E(X);ee&&c(ee)},[E,c]);k.useEffect(()=>{d(!0),Ee.getKnowledgeDoc(t).then(B=>{m(B),v(B.content)}).catch(console.error).finally(()=>d(!1))},[t]);const R=async()=>{if(f){S(!0);try{await Ee.updateKnowledgeDoc(t,b),m({...f,content:b}),y(!1),r()}catch(B){console.error("Save failed:",B)}finally{S(!1)}}},O=async()=>{if(confirm(`Delete "${f==null?void 0:f.title}"?`))try{await Ee.deleteKnowledgeDoc(t),i(t)}catch(B){console.error("Delete failed:",B)}};return p?o.jsx("div",{className:"flex-1 flex items-center justify-center text-xs",style:{color:"var(--terminal-text-muted)"},children:"Loading..."}):f?o.jsxs("div",{className:"flex-1 overflow-y-auto flex flex-col",children:[o.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[o.jsxs("button",{onClick:l,className:"text-xs font-semibold cursor-pointer hover:opacity-70",style:{color:"var(--active-green)"},children:["←"," Back"]}),o.jsx("div",{className:"flex-1"}),g?o.jsxs(o.Fragment,{children:[o.jsx("button",{onClick:()=>{y(!1),v(f.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"}),o.jsx("button",{onClick:R,disabled:j,className:"px-2.5 py-1 text-[10px] rounded cursor-pointer font-semibold text-white",style:{background:j?"#86efac":"#16a34a"},children:j?"Saving...":"Save"})]}):o.jsxs(o.Fragment,{children:[o.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"}),o.jsx("button",{onClick:O,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"})]})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[o.jsx("h2",{className:"text-sm font-bold mb-1",style:{color:"var(--terminal-text)"},children:f.title}),f.tldr&&!g&&o.jsx("div",{className:"mb-3 text-xs italic",style:{color:"var(--terminal-text-secondary)"},children:f.tldr}),f.format==="html"?g?o.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:B=>v(B.target.value),spellCheck:!1}):o.jsx("iframe",{srcDoc:f.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:f.title}):g?o.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:B=>v(B.target.value),spellCheck:!1}):o.jsx("div",{className:"text-xs leading-relaxed",style:{color:"var(--terminal-text-secondary)"},onClick:A,children:o.jsx(Os,{content:f.content})})]})]}):o.jsx("div",{className:"flex-1 flex items-center justify-center text-xs",style:{color:"var(--terminal-text-muted)"},children:"Failed to load document"})}function Jj({onCreated:t,onCancel:l}){const[r,i]=k.useState(""),[c,u]=k.useState(""),[f,m]=k.useState(""),[p,d]=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}d(!0),y("");try{const v=await Ee.createKnowledgeDoc({filename:c,title:r,category:f||void 0});t(v.id)}catch(v){y(v instanceof Error?v.message:"Failed to create")}finally{d(!1)}};return o.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[o.jsxs("button",{onClick:l,className:"text-xs font-semibold cursor-pointer hover:opacity-70",style:{color:"var(--active-green)"},children:["←"," Cancel"]}),o.jsx("h2",{className:"text-sm font-bold",style:{color:"var(--terminal-text)"},children:"New Document"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-[10px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"TITLE"}),o.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)"}})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-[10px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"FILENAME"}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.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)"}}),o.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:".md"})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-[10px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"CATEGORY (optional)"}),o.jsx("input",{type:"text",value:f,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&&o.jsx("div",{className:"text-[10px] px-3 py-1.5 rounded",style:{background:"rgba(239,68,68,0.15)",color:"#f87171"},children:g}),o.jsx("button",{onClick:b,disabled:p||!r.trim(),className:"w-full py-2 text-xs font-semibold rounded cursor-pointer text-white",style:{background:p?"#86efac":"#16a34a"},children:p?"Creating...":"Create Document"})]})]})}const Pj=500,p0=360,y0=700;function jh(t){const[l,r]=k.useState(Pj),[i,c]=k.useState(!1),u=k.useRef(0),f=k.useRef(0),m=t>0,p=m?t:0,d=m?Math.max(p0,window.innerWidth-t-100):y0,g=Math.min(l,d),y=k.useCallback(b=>{b.preventDefault(),u.current=b.clientX,f.current=g,c(!0);const v=S=>{const C=u.current-S.clientX,E=Math.min(y0,Math.max(p0,f.current+C));r(E)},j=()=>{c(!1),document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",j)};document.addEventListener("mousemove",v),document.addEventListener("mouseup",j)},[g]);return{panelRight:p,panelWidth:g,isResizing:i,handleResizeStart:y}}function eC({docs:t,onClose:l,onRefresh:r,terminalWidth:i=0,initialDocId:c}){const[u,f]=k.useState("list"),[m,p]=k.useState("all"),[d,g]=k.useState(c??null),[y,b]=k.useState(""),[v,j]=k.useState(!1),[S,C]=k.useState(null),{panelRight:E,panelWidth:A,isResizing:R,handleResizeStart:O}=jh(i),B=["all",...Array.from(new Set(t.map($=>$.category))).sort()],T=t.filter($=>{if(m!=="all"&&$.category!==m)return!1;if(y){const U=y.toLowerCase();return $.title.toLowerCase().includes(U)||($.tldr??"").toLowerCase().includes(U)||$.tags.some(ne=>ne.toLowerCase().includes(U))}return!0}),I=$=>{j(!1),r(),g($)},X=$=>{g(null),r()},ee=$=>{C($.id)},z=S?t.find($=>$.id===S):null;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:E},onClick:l}),o.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:E,width:A,background:"var(--terminal-bg)",borderLeftColor:"#16a34a"},children:[o.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:O}),o.jsxs("div",{className:"p-5 text-white relative",style:{background:"#16a34a"},children:[o.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:"×"}),o.jsxs("div",{className:"text-lg font-bold",children:["📚"," Knowledge Base"]}),o.jsxs("div",{className:"text-xs opacity-80 mt-0.5",children:[t.length," documents"]})]}),o.jsxs("div",{className:"flex",style:{borderBottom:"1px solid var(--terminal-border)"},children:[o.jsx(g0,{label:"List",active:u==="list",onClick:()=>{f("list"),C(null)}}),o.jsx(g0,{label:"Graph",active:u==="graph",onClick:()=>f("graph")})]}),u==="list"&&!d&&!v&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[o.jsx("input",{type:"text",value:y,onChange:$=>b($.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)"}}),o.jsx("button",{onClick:()=>j(!0),className:"px-2.5 py-1.5 text-[10px] font-semibold rounded cursor-pointer text-white shrink-0",style:{background:"#16a34a"},children:"+ New"})]}),o.jsx("div",{className:"flex overflow-x-auto shrink-0",style:{borderBottom:"1px solid var(--terminal-border)",scrollbarWidth:"none"},children:B.map($=>o.jsx("button",{onClick:()=>p($),className:"px-3 py-1.5 text-[10px] font-medium cursor-pointer whitespace-nowrap",style:{color:m===$?"#4ade80":"var(--terminal-text-muted)",borderBottom:m===$?"2px solid #4ade80":"2px solid transparent"},children:$==="all"?`All (${t.length})`:`${$} (${t.filter(U=>U.category===$).length})`},$))}),o.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:T.length===0?o.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"}):T.map($=>o.jsx(Wj,{doc:$,allDocs:t,onOpen:U=>g(U.id),onNavigateDoc:U=>g(U)},$.id))})]}),u==="list"&&d&&!v&&o.jsx(Zj,{docId:d,onBack:()=>g(null),onDocUpdated:r,onDelete:X,onNavigateDoc:$=>g($),allDocs:t}),u==="list"&&v&&o.jsx(Jj,{onCreated:I,onCancel:()=>j(!1)}),u==="graph"&&o.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[o.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[o.jsx(Qj,{docs:t,onNodeClick:ee,selectedDocId:S}),z&&o.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:[o.jsx("div",{className:"text-[10px] font-bold uppercase mb-1",style:{color:"var(--terminal-text-muted)"},children:"Selected"}),o.jsx("div",{className:"text-xs font-bold mb-1",style:{color:"var(--terminal-text)"},children:z.title}),o.jsx("div",{className:"w-2 h-2 rounded-full mb-2",style:{background:z.status==="active"?"#16a34a":z.status==="draft"?"#f59e0b":"#94a3b8"}}),z.tldr&&o.jsx("div",{className:"text-[10px] mb-2 leading-relaxed",style:{color:"var(--terminal-text-secondary)"},children:z.tldr}),z.links.length>0&&o.jsxs("div",{className:"mb-2",children:[o.jsx("div",{className:"text-[9px] font-bold mb-1",style:{color:"var(--terminal-text-muted)"},children:"Links"}),z.links.slice(0,5).map(($,U)=>o.jsxs("div",{className:"text-[9px] mb-0.5 truncate",style:{color:"var(--terminal-text-secondary)"},children:["🔗"," ",$.text]},U))]}),o.jsx("button",{className:"w-full py-1.5 text-[10px] font-semibold rounded cursor-pointer text-white",style:{background:"#16a34a"},onClick:()=>{f("list"),g(z.id),C(null)},children:"Open Document"})]})]}),o.jsx("div",{className:"shrink-0 p-2",style:{borderTop:"1px solid var(--terminal-border)"},children:o.jsx("div",{className:"flex flex-wrap gap-2",children:Object.entries(zs).map(([$,U])=>o.jsxs("div",{className:"flex items-center gap-1 text-[9px]",children:[o.jsx("div",{className:"w-2 h-2",style:{background:U.border}}),o.jsx("span",{style:{color:"var(--terminal-text-muted)"},children:$})]},$))})})]})]})]})}function g0({label:t,active:l,onClick:r}){return o.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 tC({standups:t,waves:l,decisions:r,mode:i,onClose:c,terminalWidth:u=0}){const[f,m]=k.useState(i==="decisions"?"decisions":"standups"),{panelRight:p,panelWidth:d,isResizing:g,handleResizeStart:y}=jh(u);return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:p},onClick:c}),o.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:p,width:d,background:"var(--terminal-bg)",borderLeftColor:"var(--desk-wood)"},children:[o.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}),o.jsxs("div",{className:"p-5 bg-[var(--desk-wood)] text-white relative",children:[o.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:"×"}),o.jsx("div",{className:"text-lg font-bold",children:i==="bulletin"?"📌 Bulletin Board":"📜 Decision Log"})]}),o.jsx("div",{className:"flex",style:{borderBottom:"1px solid var(--terminal-border)"},children:i==="bulletin"?o.jsxs(o.Fragment,{children:[o.jsx(bd,{label:`Standups (${t.length})`,active:f==="standups",onClick:()=>m("standups")}),o.jsx(bd,{label:`Waves (${l.length})`,active:f==="waves",onClick:()=>m("waves")})]}):o.jsx(bd,{label:`Decisions (${r.length})`,active:f==="decisions",onClick:()=>m("decisions")})}),o.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[f==="standups"&&t.map((b,v)=>o.jsx(vd,{title:`Standup ${b.date}`,content:b.content},v)),f==="waves"&&l.map((b,v)=>o.jsx(vd,{title:`Wave ${b.id}`,subtitle:b.timestamp,content:b.content},v)),f==="decisions"&&r.map((b,v)=>o.jsx(vd,{title:`#${b.id} ${b.title}`,subtitle:b.date,content:b.content},v))]})]})]})}function bd({label:t,active:l,onClick:r}){return o.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 nC(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 vd({title:t,subtitle:l,content:r}){const[i,c]=k.useState(!1),u=r.length>100,f=nC(r).slice(0,160);return o.jsxs("div",{className:"mb-3 rounded-lg overflow-hidden",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[o.jsxs("div",{className:"p-3 cursor-pointer hover:bg-white/5",onClick:()=>c(!i),children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("div",{className:"font-medium text-sm",style:{color:"var(--terminal-text)"},children:t}),o.jsx("span",{className:"text-xs shrink-0 ml-2",style:{color:"var(--terminal-text-muted)"},children:i?"▲":"▼"})]}),l&&o.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--terminal-text-muted)"},children:l})]}),i&&o.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:o.jsx(Os,{content:r})}),!i&&u&&o.jsx("div",{className:"px-3 pb-2 text-xs line-clamp-2 leading-relaxed",style:{color:"var(--terminal-text-muted)"},children:f})]})}function lC({projectId:t,onClose:l,terminalWidth:r=0}){const[i,c]=k.useState(null),{panelRight:u,panelWidth:f,isResizing:m,handleResizeStart:p}=jh(r);if(k.useEffect(()=>{Ee.getProject(t).then(c).catch(console.error)},[t]),!i)return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:u},onClick:l}),o.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:f,background:"var(--terminal-bg)"},children:o.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-muted)"},children:"Loading project..."})})]});const d=i.tasks.filter(b=>b.status==="done").length,g=i.tasks.length,y=g>0?Math.round(d/g*100):0;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:u},onClick:l}),o.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:f,background:"var(--terminal-bg)"},children:[o.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:p}),o.jsxs("div",{className:"p-5 bg-[var(--meeting-blue)] text-white relative",children:[o.jsx("div",{className:"text-sm opacity-70",children:"Meeting Room"}),o.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:"×"}),o.jsx("div",{className:"text-xl font-bold mt-1",children:i.name}),o.jsxs("div",{className:"flex items-center gap-3 mt-3 text-sm",children:[o.jsxs("span",{children:["Tasks: ",g]}),o.jsxs("span",{children:["Done: ",d]}),o.jsxs("span",{children:["Progress: ",y,"%"]})]}),o.jsx("div",{className:"mt-2 h-1.5 bg-white/20 rounded-full overflow-hidden",children:o.jsx("div",{className:"h-full bg-white rounded-full transition-all",style:{width:`${y}%`}})})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[i.prd&&o.jsxs("div",{className:"mb-5",children:[o.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:"PRD"}),o.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:o.jsx(Os,{content:i.prd})})]}),o.jsxs("div",{children:[o.jsxs("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:["Tasks (",g,")"]}),o.jsx("div",{className:"space-y-2",children:i.tasks.map(b=>o.jsxs("div",{className:"rounded-lg p-3",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-sm font-medium",style:{color:"var(--terminal-text)"},children:b.title}),o.jsx(rC,{status:b.status})]}),o.jsx("div",{className:"text-xs mt-1",style:{color:"var(--terminal-text-muted)"},children:b.role}),b.description&&o.jsx("div",{className:"text-xs mt-1.5 line-clamp-2",style:{color:"var(--terminal-text-secondary)"},children:b.description})]},b.id))})]})]})]})]})}function rC({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 o.jsx("span",{className:"text-[10px] font-semibold px-2 py-0.5 rounded-full",style:{background:r.bg,color:r.color},children:t})}const aC={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"};function iC({roleId:t,roleName:l,mode:r="assign",onClose:i,onExecutionStart:c}){const[u,f]=k.useState(""),m=k.useRef(null);k.useEffect(()=>{var y;(y=m.current)==null||y.focus()},[]);const p=()=>{u.trim()&&(c(t,u.trim()),i())},d=y=>{y.key==="Enter"&&(y.metaKey||y.ctrlKey)&&p(),y.key==="Escape"&&i()},g=aC[t]??"#666";return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:i}),o.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:[o.jsxs("div",{className:"p-5 text-white",style:{background:`linear-gradient(135deg, ${g}, ${g}cc)`},children:[o.jsx("div",{className:"text-lg font-bold",children:r==="ask"?"Ask":"Assign Task"}),o.jsx("div",{className:"text-sm opacity-80 mt-0.5",children:r==="ask"?`to ${l}`:`to ${l} (${t})`})]}),o.jsxs("div",{className:"p-5",children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Task Description"}),o.jsx("textarea",{ref:m,value:u,onChange:y=>f(y.target.value),onKeyDown:d,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"}),o.jsx("div",{className:"text-[10px] text-white/30 mt-1",children:"Cmd+Enter to submit"})]}),o.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[o.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"}),o.jsx("button",{onClick:p,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 b0={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"};function hg({event:t,isThinkingCollapsed:l,onToggleThinking:r,onNavigateToJob:i,onOpenKnowledgeDoc:c,compact:u}){var m;const f=b0[t.roleId]??"#888";switch(t.type){case"text":return o.jsx("div",{className:"text-green-300/90 whitespace-pre-wrap leading-relaxed",children:u?(t.data.text??"").slice(0,300):t.data.text});case"thinking":{const p=t.data.text??"";return o.jsxs("div",{className:"group",children:[o.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:[o.jsx("span",{children:l?"▶":"▼"}),o.jsx("span",{className:"italic",children:"thinking..."})]}),!l&&o.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:[p.slice(0,u?200:500),p.length>(u?200:500)?"...":""]})]})}case"tool:start":{const p=String(t.data.name??""),d=t.data.input,g=typeof(d==null?void 0:d.command)=="string"?d.command.slice(0,80):"",y=typeof(d==null?void 0:d.file_path)=="string"?String(d.file_path):typeof(d==null?void 0:d.path)=="string"?String(d.path):"",b=y?y.split("/").pop()??"":"",v=/^(write_file|Write|edit_file|Edit)$/i.test(p),j=(m=y.match(/(?:^|\/)knowledge\/(.+\.md)$/))==null?void 0:m[1],S=v&&j&&c;return o.jsxs("div",{className:"flex items-center gap-2 py-0.5",children:[o.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] ${S?"text-green-400/80 bg-green-400/10":"text-blue-400/80 bg-blue-400/10"}`,children:S?v&&p.toLowerCase().includes("edit")?"Edit":"Write":p}),S?o.jsx("button",{onClick:()=>c(j),className:"text-[10px] text-green-400 hover:text-green-300 underline underline-offset-2 cursor-pointer truncate",style:{maxWidth:u?200:400},children:b}):o.jsxs(o.Fragment,{children:[g&&o.jsx("span",{className:`text-[var(--terminal-text-muted)] text-[10px] truncate ${u?"max-w-[200px]":"max-w-[400px]"}`,children:g}),b&&o.jsx("span",{className:`text-[var(--terminal-text-muted)] text-[10px] truncate ${u?"max-w-[200px]":"max-w-[400px]"}`,children:b})]})]})}case"dispatch:start":{const p=t.data.targetRoleId??t.data.roleId??"",d=t.data.task??"",g=t.data.childJobId,y=b0[p]??"#888";return o.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:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("span",{style:{color:y},className:"font-bold text-[11px]",children:["→"," ",p.toUpperCase()]}),o.jsx("span",{className:"text-[var(--terminal-text-secondary)] text-[10px] truncate flex-1",children:d.slice(0,u?60:100)}),g&&i&&o.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 o.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 o.jsx("div",{className:"border-t border-[var(--terminal-border)] my-2 relative",children:o.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 o.jsxs("div",{className:"text-red-400/80 text-[11px]",children:["⚠"," ",t.data.message]});case"job:start":return o.jsxs("div",{className:"text-[var(--terminal-text-muted)] text-[10px] pb-1",children:[o.jsx("span",{style:{color:f},className:"font-bold",children:t.roleId.toUpperCase()})," ","started: ",(t.data.task??"").slice(0,u?50:80)]});case"job:done":{const p=t.data.turns??0,d=t.data.toolCalls??0;return o.jsx("div",{className:"mt-2 p-2 rounded-lg bg-green-900/20 border border-green-800/30",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"w-2 h-2 rounded-full bg-green-400"}),o.jsx("span",{className:"text-green-300 font-bold text-[11px]",children:"Complete"}),o.jsxs("span",{className:"text-[var(--terminal-text-muted)] text-[10px]",children:[p," turns · ",d," tools"]})]})})}case"job:error":return o.jsx("div",{className:"mt-2 p-2 rounded-lg bg-red-900/20 border border-red-800/30",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"w-2 h-2 rounded-full bg-red-400"}),o.jsx("span",{className:"text-red-300 font-bold text-[11px]",children:"Error"}),o.jsx("span",{className:"text-red-200/70 text-[10px]",children:t.data.message})]})});case"import:scan":case"import:process":case"import:created":return o.jsxs("div",{className:"text-cyan-300/70 text-[11px]",children:["[",t.type,"] ",JSON.stringify(t.data)]});default:return null}}function sC({jobId:t,title:l,color:r,variant:i,style:c,onClose:u,onMinimize:f,onDone:m,onNavigateToJob:p,onOpenKnowledgeDoc:d}){const{events:g,status:y,textOutput:b,childJobIds:v}=X0(t),[j,S]=k.useState(0),[C,E]=k.useState(new Set),A=k.useRef(null),R=k.useRef(Date.now()),O=k.useRef(!1);k.useEffect(()=>{const $=setInterval(()=>{S(Math.floor((Date.now()-R.current)/1e3))},1e3);return()=>clearInterval($)},[]),k.useEffect(()=>{A.current&&(A.current.scrollTop=A.current.scrollHeight)},[g]),k.useEffect(()=>{(y==="done"||y==="error")&&!O.current&&(O.current=!0,m==null||m())},[y,m]);const B=$=>{E(U=>{const ne=new Set(U);return ne.has($)?ne.delete($):ne.add($),ne})},T={idle:"Waiting",connecting:"Connecting...",streaming:"Working",done:"Complete",error:"Error"}[y],I={idle:"#888",connecting:"#888",streaming:r,done:"#2E7D32",error:"#C62828"}[y],X=$=>`${Math.floor($/60)}:${String($%60).padStart(2,"0")}`,ee=y==="done"||y==="error",z=o.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:[o.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-[var(--terminal-border)] shrink-0",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"w-3 h-3 rounded-full animate-pulse",style:{background:I}}),o.jsx("div",{children:o.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-sm",children:l})})]}),o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs font-mono",children:X(j)}),o.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full font-semibold",style:{background:`${I}22`,color:I},children:T}),f&&i==="modal"&&o.jsx("button",{onClick:f,title:"Minimize",className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-sm cursor-pointer px-1",children:"–"}),ee&&o.jsx("button",{onClick:u,className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-lg cursor-pointer",children:"×"})]})]}),o.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"&&o.jsx("div",{className:"text-[var(--terminal-text-muted)]",children:"Connecting to activity stream..."}),g.map($=>o.jsx(hg,{event:$,isThinkingCollapsed:C.has($.seq),onToggleThinking:()=>B($.seq),onNavigateToJob:p,onOpenKnowledgeDoc:d},$.seq)),y==="streaming"&&o.jsx("span",{className:"inline-block w-2 h-4 bg-green-400 animate-pulse ml-0.5"})]}),o.jsxs("div",{className:"px-5 py-3 border-t border-[var(--terminal-border)] flex items-center justify-between shrink-0",children:[o.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`]}),ee&&o.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"?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:ee?u:void 0}),z]}):z}const wd={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};function oC({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 p of m.children){const d=t[p];d&&u.push({node:d,parentId:m.id})}const f=c.length+u.length;return o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Propagation Preview"}),o.jsxs("div",{className:"bg-white/5 border border-white/10 rounded-lg p-4",children:[o.jsx("div",{className:"flex justify-center mb-2",children:o.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&&o.jsx("div",{className:"flex justify-center mb-1",children:o.jsx("div",{className:"w-px h-3 bg-white/15"})}),c.length>1&&o.jsx("div",{className:"flex justify-center mb-1",children:o.jsx("div",{className:"h-px bg-white/15",style:{width:`${Math.min(c.length*80,320)}px`}})}),o.jsx("div",{className:"flex justify-center gap-3 mb-2 flex-wrap",children:c.map(m=>o.jsxs("div",{className:"flex flex-col items-center",children:[o.jsx("span",{className:"px-2.5 py-1 text-[10px] font-bold rounded border-2 uppercase",style:{borderColor:wd[m.id]??"#888",color:wd[m.id]??"#888",background:`${wd[m.id]??"#888"}22`},children:m.id}),o.jsx("span",{className:"text-[8px] text-white/30 mt-0.5",children:"direct"})]},m.id))}),u.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"flex justify-center mb-1",children:o.jsx("div",{className:"w-px h-2 bg-white/10"})}),o.jsx("div",{className:"flex justify-center gap-2 flex-wrap",children:u.map(({node:m})=>o.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))}),o.jsx("div",{className:"text-center text-[8px] text-white/30 mt-1",children:"via re-dispatch"})]})]}),o.jsxs("div",{className:"text-[10px] text-gray-400 mt-1.5",children:[f," role",f!==1?"s":""," will receive this wave"]})]})}function cC({cLevelRoles:t,orgNodes:l,rootId:r,onClose:i,onDispatch:c}){const[u,f]=k.useState(""),m=k.useRef(null);k.useEffect(()=>{var y;(y=m.current)==null||y.focus()},[]);const p=()=>{!u.trim()||t.length===0||(c(u.trim()),i())},d=y=>{y.key==="Enter"&&(y.metaKey||y.ctrlKey)&&p(),y.key==="Escape"&&i()},g=r&&Object.keys(l).length>0;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:i}),o.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:[o.jsxs("div",{className:"p-5 text-white",style:{background:"linear-gradient(135deg, #B71C1C, #D32F2F)"},children:[o.jsx("div",{className:"text-lg font-bold",children:"CEO Wave"}),o.jsx("div",{className:"text-sm opacity-80 mt-0.5",children:"Broadcast a directive to all C-Level reports"})]}),o.jsxs("div",{className:"p-5 space-y-4",children:[g&&o.jsx(oC,{orgNodes:l,rootId:r}),!g&&o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Dispatching to"}),o.jsx("div",{className:"flex gap-2 flex-wrap",children:t.length>0?t.map(y=>o.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)):o.jsx("span",{className:"text-xs text-gray-400 italic",children:"No C-Level roles found"})}),o.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"Each C-Level receives the directive and delegates to their reports"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Directive"}),o.jsx("textarea",{ref:m,value:u,onChange:y=>f(y.target.value),onKeyDown:d,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"}),o.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"Cmd+Enter to dispatch"})]})]}),o.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[o.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"}),o.jsxs("button",{onClick:p,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 uC(t,l,r){const[i,c]=k.useState(new Map),[u,f]=k.useState(null),m=k.useRef(new Map),p=k.useRef(i);p.current=i,k.useEffect(()=>{if(!r||Object.keys(l).length===0)return;const b=new Map,v=S=>{const C=l[S];C&&(b.set(S,{jobId:null,roleId:S,roleName:C.name,children:C.children,status:"waiting",events:[],streamStatus:"idle"}),C.children.forEach(v))},j=l[r];j&&(b.set(r,{jobId:null,roleId:r,roleName:"CEO",children:j.children,status:"not-dispatched",events:[],streamStatus:"idle"}),j.children.forEach(v));for(const S of t){const C=b.get(S.roleId);C&&(C.jobId=S.jobId,C.status="running",C.streamStatus="connecting")}c(b),t.length>0&&f(t[0].roleId)},[t,l,r]);const d=k.useCallback((b,v)=>{const j=m.current.get(b);j&&j.controller.abort();const S=new AbortController,C={controller:S,lastSeq:-1};m.current.set(b,C);const A=`/api/jobs/${b}/stream?from=0`;fetch(A,{signal:S.signal}).then(async R=>{if(!R.ok||!R.body){c(I=>{const X=new Map(I),ee=X.get(v);return ee&&X.set(v,{...ee,streamStatus:"error"}),X});return}c(I=>{const X=new Map(I),ee=X.get(v);return ee&&X.set(v,{...ee,streamStatus:"streaming",status:"running"}),X});const O=R.body.getReader(),B=new TextDecoder;let T="";for(;;){const{done:I,value:X}=await O.read();if(I)break;T+=B.decode(X,{stream:!0});const ee=T.split(`
81
- `);T=ee.pop()??"";let z="";for(const $ of ee)if($.startsWith("event: "))z=$.slice(7).trim();else if($.startsWith("data: ")){try{const U=JSON.parse($.slice(6));if(z==="activity"){const ne=U;ne.seq>C.lastSeq&&(C.lastSeq=ne.seq),c(re=>{const V=new Map(re),Y=V.get(v);if(!Y||Y.events.some(se=>se.seq===ne.seq))return re;const Q={...Y,events:[...Y.events,ne]};if(ne.type==="dispatch:start"&&ne.data.childJobId){const se=ne.data.childJobId,ve=ne.data.targetRoleId??ne.data.roleId;if(ve){const M=V.get(ve);M&&(V.set(ve,{...M,jobId:se,status:"running",streamStatus:"connecting"}),setTimeout(()=>d(se,ve),0))}}return ne.type==="job:done"?(Q.status="done",Q.streamStatus="done"):ne.type==="job:error"&&(Q.status="error",Q.streamStatus="error"),V.set(v,Q),V})}else if(z==="stream:end"){const ne=U.reason;c(re=>{const V=new Map(re),Y=V.get(v);if(!Y)return re;const Q=ne==="error"?"error":"done";return V.set(v,{...Y,status:Y.status==="running"?Q:Y.status,streamStatus:Q==="error"?"error":"done"}),V})}}catch{}z=""}}}).catch(R=>{R.name!=="AbortError"&&c(O=>{const B=new Map(O),T=B.get(v);return T&&B.set(v,{...T,streamStatus:"error"}),B})})},[]);k.useEffect(()=>{if(t.length!==0){for(const b of t)d(b.jobId,b.roleId);return()=>{for(const[,b]of m.current)b.controller.abort();m.current.clear()}}},[t,d]);const g=(()=>{let b=0,v=0,j=0;for(const[S,C]of i)S!==r&&(j++,C.status==="done"?b++:C.status==="running"&&v++);return{done:b,total:j,running:v}})(),y=g.total>0&&g.running===0&&Array.from(i.values()).every(b=>b.status!=="running"&&b.streamStatus!=="streaming"&&b.streamStatus!=="connecting");return k.useEffect(()=>{y&&c(b=>{const v=new Map(b);let j=!1;for(const[S,C]of v)C.status==="waiting"&&(v.set(S,{...C,status:"not-dispatched"}),j=!0);return j?v:b})},[y]),{nodes:i,selectedRoleId:u,selectNode:f,progress:g,allDone:y}}const v0={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},xa=120,er=44,w0=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}],f=new Set;for(;u.length>0;){const{id:g,depth:y,parentId:b}=u.shift();if(f.has(g))continue;for(f.add(g);c.length<=y;)c.push([]);c[y].push(g),i.push({roleId:g,x:0,y:y*w0+20,parentId:b});const v=t.get(g);if(v)for(const j of v.children)t.has(j)&&!f.has(j)&&u.push({id:j,depth:y+1,parentId:g})}const m=Math.max(...c.map(g=>g.length))*(xa+16),p=Math.max(m,280);for(const g of c){const y=g.length*(xa+16)-16,b=(p-y)/2;g.forEach((v,j)=>{const S=i.find(C=>C.roleId===v);S&&(S.x=b+j*(xa+16))})}const d=c.length*w0+40;return{layout:i,width:p,height:d}}function dC({nodes:t,rootId:l,selectedRoleId:r,onSelectNode:i}){const{layout:c,width:u,height:f}=fC(t,l),m=d=>{const g=c.find(y=>y.roleId===d);return g?{cx:g.x+xa/2,cy:g.y+er/2}:{cx:0,cy:0}},p=d=>{switch(d.status){case"running":return v0[d.roleId]??"#FBBF24";case"done":return"#2E7D32";case"error":return"#C62828";case"not-dispatched":return"#666";default:return"#888"}};return o.jsxs("svg",{viewBox:`0 0 ${u} ${f}`,width:"100%",height:"100%",className:"block",children:[o.jsx("defs",{children:o.jsxs("filter",{id:"glow",children:[o.jsx("feGaussianBlur",{stdDeviation:"2",result:"blur"}),o.jsxs("feMerge",{children:[o.jsx("feMergeNode",{in:"blur"}),o.jsx("feMergeNode",{in:"SourceGraphic"})]})]})}),c.filter(d=>d.parentId).map(d=>{const g=m(d.parentId),y=m(d.roleId),b=t.get(d.roleId),v=t.get(d.parentId);let j="rgba(180,200,240,0.15)",S="4 4",C="";return(b==null?void 0:b.status)==="done"||(v==null?void 0:v.status)==="done"?(j="#2E7D3266",S=""):(b==null?void 0:b.status)==="running"&&(j=v0[d.roleId]??"#FBBF24",S="6 4",C="wave-edge-flow"),o.jsx("line",{x1:g.cx,y1:g.cy+er/2-4,x2:y.cx,y2:y.cy-er/2+4,stroke:j,strokeWidth:1.5,strokeDasharray:S,className:C},`${d.parentId}-${d.roleId}`)}),c.map(d=>{const g=t.get(d.roleId);if(!g)return null;const y=p(g),b=r===d.roleId,v=d.roleId===l,j=v?.4:g.status==="not-dispatched"?.35:1;return o.jsxs("g",{transform:`translate(${d.x}, ${d.y})`,style:{cursor:v?"default":"pointer",opacity:j},onClick:()=>!v&&i(d.roleId),children:[o.jsx("rect",{x:0,y:0,width:xa,height:er,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":""}),o.jsx("circle",{cx:14,cy:er/2,r:4,fill:y,filter:g.status==="running"?"url(#glow)":void 0,children:g.status==="running"&&o.jsx("animate",{attributeName:"opacity",values:"1;0.4;1",dur:"1.5s",repeatCount:"indefinite"})}),o.jsx("text",{x:26,y:er/2-4,fill:"var(--terminal-text, #fff)",fontSize:10,fontWeight:700,fontFamily:"var(--pixel-font)",children:g.roleId.toUpperCase()}),o.jsx("text",{x:26,y:er/2+10,fill:"var(--terminal-text-muted, #888)",fontSize:8,fontFamily:"var(--pixel-font)",children:g.status==="running"?"Working...":g.status==="done"?"Complete":g.status==="error"?"Error":g.status==="waiting"?"Waiting":""}),g.status==="done"&&o.jsx("text",{x:xa-18,y:er/2+4,fontSize:14,fill:"#2E7D32",children:"✓"}),g.status==="error"&&o.jsx("text",{x:xa-18,y:er/2+4,fontSize:14,fill:"#C62828",children:"✗"})]},d.roleId)})]})}const hC={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};function mC({directive:t,rootJobs:l,orgNodes:r,rootRoleId:i,onClose:c,onMinimize:u,onDone:f,onOpenKnowledgeDoc:m}){const{nodes:p,selectedRoleId:d,selectNode:g,progress:y,allDone:b}=uC(l,r,i),[v,j]=k.useState(0),[S,C]=k.useState(new Set),E=k.useRef(null),A=k.useRef(Date.now()),R=k.useRef(!1);k.useEffect(()=>{const X=setInterval(()=>{j(Math.floor((Date.now()-A.current)/1e3))},1e3);return()=>clearInterval(X)},[]),k.useEffect(()=>{E.current&&(E.current.scrollTop=E.current.scrollHeight)},[d,p]),k.useEffect(()=>{b&&!R.current&&(R.current=!0,f==null||f())},[b,f]);const O=X=>`${Math.floor(X/60)}:${String(X%60).padStart(2,"0")}`,B=d?p.get(d):null,T=d?hC[d]??"#888":"#888",I=X=>{C(ee=>{const z=new Set(ee);return z.has(X)?z.delete(X):z.add(X),z})};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:b?c:void 0}),o.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:[o.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-[var(--terminal-border)] shrink-0",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"w-3 h-3 rounded-full",style:{background:b?"#2E7D32":"#B71C1C",animation:b?void 0:"wave-pulse 2s ease-in-out infinite"}}),o.jsx("div",{children:o.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-sm",children:b?"WAVE COMPLETE":"WAVE COMMAND CENTER"})})]}),o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs font-mono",children:O(v)}),o.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full font-semibold",style:{background:b?"#2E7D3222":"#B71C1C22",color:b?"#2E7D32":"#B71C1C"},children:[y.done,"/",y.total," done"]}),o.jsx("button",{onClick:u,title:"Minimize",className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-sm cursor-pointer px-1",children:"–"}),b&&o.jsx("button",{onClick:c,className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-lg cursor-pointer",children:"×"})]})]}),o.jsx("div",{className:"px-5 py-2 border-b border-[var(--terminal-border)] shrink-0",children:o.jsxs("span",{className:"text-[var(--terminal-text-secondary)] text-xs italic",children:["“",t,"”"]})}),o.jsxs("div",{className:"flex flex-1 min-h-0",children:[o.jsxs("div",{className:"w-[280px] shrink-0 border-r border-[var(--terminal-border)] flex flex-col",children:[o.jsx("div",{className:"px-3 py-2 border-b border-[var(--terminal-border)]",children:o.jsx("span",{className:"text-[10px] font-bold text-[var(--terminal-text-secondary)] uppercase tracking-wider",children:"Org Propagation"})}),o.jsx("div",{className:"flex-1 overflow-auto p-3",children:o.jsx(dC,{nodes:p,rootId:i,selectedRoleId:d,onSelectNode:g})}),o.jsx("div",{className:"px-3 py-2 border-t border-[var(--terminal-border)] flex flex-wrap gap-x-3 gap-y-1",children:[{label:"running",color:"#FBBF24",dot:!0},{label:"done",color:"#2E7D32",dot:!1},{label:"waiting",color:"#888",dot:!1},{label:"error",color:"#C62828",dot:!1}].map(X=>o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("span",{className:"w-2 h-2 rounded-full inline-block",style:{background:X.color,animation:X.dot?"wave-pulse 1.5s ease-in-out infinite":void 0}}),o.jsx("span",{className:"text-[8px] text-[var(--terminal-text-muted)]",children:X.label})]},X.label))})]}),o.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[B&&o.jsxs("div",{className:"px-4 py-2 border-b border-[var(--terminal-border)] shrink-0 flex items-center gap-2",children:[o.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:T}}),o.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-xs",children:B.roleId.toUpperCase()}),o.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs",children:B.roleName}),o.jsx("span",{className:"ml-auto text-[10px] px-2 py-0.5 rounded-full font-semibold",style:{background:`${T}22`,color:T},children:B.status==="running"?"Working":B.status==="done"?"Complete":B.status==="error"?"Error":B.status==="waiting"?"Waiting":"Not dispatched"})]}),o.jsxs("div",{ref:E,className:"flex-1 overflow-y-auto p-4 space-y-1 text-xs font-mono",children:[B&&B.events.length===0&&o.jsx("div",{className:"text-[var(--terminal-text-muted)]",children:B.status==="waiting"?"Waiting for dispatch...":B.status==="running"?"Connecting to activity stream...":B.status==="not-dispatched"?"This role was not dispatched in this wave.":""}),B==null?void 0:B.events.map(X=>o.jsx(hg,{event:X,isThinkingCollapsed:S.has(X.seq),onToggleThinking:()=>I(X.seq),onNavigateToJob:ee=>{for(const[,z]of p)if(z.jobId===ee){g(z.roleId);return}},onOpenKnowledgeDoc:m},X.seq)),(B==null?void 0:B.status)==="running"&&o.jsx("span",{className:"inline-block w-2 h-4 bg-green-400 animate-pulse ml-0.5"})]}),!B&&o.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"}),o.jsxs("div",{className:"px-4 py-2 border-t border-[var(--terminal-border)] flex items-center justify-between shrink-0",children:[o.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:B&&B.events.length>0&&`${B.events.length} events`}),b&&o.jsx("button",{onClick:c,className:"px-4 py-1.5 text-xs text-white rounded-lg font-semibold cursor-pointer",style:{background:"#2E7D32"},children:"Close"})]})]})]})]})]})}const xC={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 Ch(t){return xC[t]??{skinColor:"#B0BEC5",hairColor:"#78909C",shirtColor:"#607D8B",pantsColor:"#455A64",shoeColor:"#37474F"}}const mg=["#FDEBD0","#F5CBA7","#D4A07A","#C68642","#8D5524","#5C3A1E","#F3D1C7","#E8BEAC","#B07D62","#704214"],xg=["#1A0A00","#2C1810","#4E342E","#6D4C41","#8D6E63","#D4A574","#F5E6CA","#FFD700","#B71C1C","#AD1457","#4A148C","#1A237E","#004D40","#1A1A1A","#78909C","#E0E0E0"],pg=["#1565C0","#E65100","#2E7D32","#4A148C","#AD1457","#00695C","#D32F2F","#F57F17","#1B5E20","#283593","#4E342E","#37474F","#880E4F","#00838F","#6A1B9A","#FF6F00"],yg=["#37474F","#1A237E","#3E2723","#263238","#1B5E20","#455A64","#212121","#4E342E","#0D47A1","#311B92"],gg=["#212121","#1A1A1A","#37474F","#4E342E","#7B1FA2","#D32F2F","#1565C0","#F57F17","#2E7D32","#FFFFFF"],$r={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 pC({color:t,selected:l,onClick:r}){return o.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 xs({label:t,presets:l,value:r,onChange:i}){return o.jsxs("div",{className:"customize-row",children:[o.jsxs("div",{className:"customize-row-header",children:[o.jsx("span",{className:"customize-row-label",children:t}),o.jsx("div",{className:"customize-row-current",style:{background:r}})]}),o.jsx("div",{className:"customize-swatches",children:l.map(c=>o.jsx(pC,{color:c,selected:c===r,onClick:()=>i(c)},c))})]})}function kd({label:t,items:l,value:r,onChange:i,lockInfo:c}){return o.jsxs("div",{className:"customize-row",children:[o.jsx("div",{className:"customize-row-header",children:o.jsx("span",{className:"customize-row-label",children:t})}),o.jsx("div",{className:"customize-swatches",style:{gap:4},children:l.map(u=>{const f=c?c.getLockLevel(u.id):1,m=u.id===r,p=c?f>c.roleLevel&&!m:!1,d=c?m&&f>c.roleLevel:!1;return o.jsxs("button",{onClick:()=>{p||i(u.id===r?void 0:u.id)},className:"customize-swatch",style:{width:"auto",height:"auto",padding:p?"2px 6px 10px 6px":"2px 6px",fontSize:9,fontFamily:"var(--font-pixel, monospace)",background:m?"rgba(255,255,255,0.15)":p?"rgba(255,255,255,0.02)":"rgba(255,255,255,0.04)",outline:m?d?"2px solid #F59E0B":"2px solid #fff":"2px solid transparent",color:p?"rgba(255,255,255,0.25)":m?"#fff":"rgba(255,255,255,0.5)",borderRadius:4,cursor:p?"not-allowed":"pointer",opacity:p?.35:1,position:"relative"},children:[u.name,p&&o.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.",f]}),d&&o.jsxs("span",{style:{position:"absolute",bottom:-8,left:"50%",transform:"translateX(-50%)",fontSize:7,color:"#F59E0B",whiteSpace:"nowrap"},children:["⚠"," Lv.",f]})]},u.id)})})]})}function Sd({label:t,active:l,onClick:r}){return o.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 Fr(t){return t[Math.floor(Math.random()*t.length)]}function vs(t){var c,u,f;const l=tg(),r=ng(),i=lg().filter(m=>!t||ag(m.id,t));return{skinColor:Fr(mg),hairColor:Fr(xg),shirtColor:Fr(pg),pantsColor:Fr(yg),shoeColor:Fr(gg),hairStyle:(c=Fr(l))==null?void 0:c.id,outfitStyle:(u=Fr(r))==null?void 0:u.id,accessory:(f=Fr(i))==null?void 0:f.id}}function bg({roleId:t,appearance:l,onChange:r,onRandomize:i,onReset:c,label:u,roleLevel:f}){const[m,p]=k.useState("look"),d=k.useCallback((C,E)=>{r({...l,[C]:E})},[l,r]),g=k.useRef(null),y=k.useCallback(C=>{var R;const E=(R=C.target.files)==null?void 0:R[0];if(!E)return;const A=new Image;A.onload=()=>{const O=$S(A);r({...O,hairStyle:l.hairStyle,outfitStyle:l.outfitStyle,accessory:l.accessory}),URL.revokeObjectURL(A.src)},A.src=URL.createObjectURL(E),C.target.value=""},[l.hairStyle,l.outfitStyle,l.accessory,r]),b=tg(),v=ng(),j=lg(),S=f!==void 0?j.filter(C=>ag(C.id,f)).length:j.length;return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"customize-preview",children:[o.jsx("div",{className:"customize-preview-bg",children:o.jsx(Bc,{roleId:t,appearance:l,scale:12})}),u&&o.jsx("div",{className:"customize-preview-name",children:u}),o.jsxs("div",{className:"customize-preview-actions",children:[o.jsx("button",{className:"customize-btn customize-btn--random",onClick:i,children:"RANDOM"}),o.jsx("button",{className:"customize-btn customize-btn--reset",onClick:c,children:"RESET"}),o.jsx("button",{className:"customize-btn",onClick:()=>{var C;return(C=g.current)==null?void 0:C.click()},style:{fontSize:9,opacity:.7},children:"PHOTO"}),o.jsx("input",{ref:g,type:"file",accept:"image/*",onChange:y,style:{display:"none"}})]})]}),o.jsxs("div",{className:"customize-colors",children:[o.jsxs("div",{style:{display:"flex",borderBottom:"1px solid rgba(255,255,255,0.06)",marginBottom:4},children:[o.jsx(Sd,{label:"LOOK",active:m==="look",onClick:()=>p("look")}),o.jsx(Sd,{label:"OUTFIT",active:m==="outfit",onClick:()=>p("outfit")}),o.jsx(Sd,{label:"ACCESSORY",active:m==="accessory",onClick:()=>p("accessory")})]}),m==="look"&&o.jsxs(o.Fragment,{children:[o.jsx(xs,{label:"SKIN",presets:mg,value:l.skinColor,onChange:C=>d("skinColor",C)}),o.jsx(xs,{label:"HAIR COLOR",presets:xg,value:l.hairColor,onChange:C=>d("hairColor",C)}),o.jsx(kd,{label:"HAIR STYLE",items:b,value:l.hairStyle,onChange:C=>d("hairStyle",C)})]}),m==="outfit"&&o.jsxs(o.Fragment,{children:[o.jsx(kd,{label:"STYLE",items:v,value:l.outfitStyle,onChange:C=>d("outfitStyle",C)}),o.jsx(xs,{label:"TOP",presets:pg,value:l.shirtColor,onChange:C=>d("shirtColor",C)}),o.jsx(xs,{label:"PANTS",presets:yg,value:l.pantsColor,onChange:C=>d("pantsColor",C)}),o.jsx(xs,{label:"SHOES",presets:gg,value:l.shoeColor,onChange:C=>d("shoeColor",C)})]}),m==="accessory"&&o.jsxs(o.Fragment,{children:[f!==void 0&&o.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:[o.jsxs("span",{children:["Lv.",f]}),o.jsxs("span",{children:[S,"/",j.length," unlocked"]})]}),o.jsx(kd,{label:"ACCESSORY",items:j,value:l.accessory,onChange:C=>d("accessory",C),lockInfo:f!==void 0?{roleLevel:f,getLockLevel:rg}:void 0}),o.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:f!==void 0&&f<10?"Level up to unlock more accessories":"More accessories coming soon"})]})]})]})}const yC=[{value:"c-level",label:"C-Level"},{value:"team-lead",label:"Team Lead"},{value:"member",label:"Member"}];function vg(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,24)}function k0(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 ps=4;function gC(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 f=vg(u),m=(c[1]||"member").toLowerCase(),p=m==="c-level"?"c-level":m==="team-lead"?"team-lead":"member",d=c[2]||"ceo";let g;return l.has(f)?g="ID already exists":r.has(f)&&(g="Duplicate ID in batch"),r.add(f),{name:u,id:f,level:p,reportsTo:d,error:g}}function bC({existingRoles:t,onClose:l,onHire:r}){const[i,c]=k.useState("single"),[u,f]=k.useState(1),[m,p]=k.useState(""),[d,g]=k.useState(""),[y,b]=k.useState(!1),[v,j]=k.useState("member"),[S,C]=k.useState("ceo"),[E,A]=k.useState(""),[R,O]=k.useState(vs),[B,T]=k.useState(!1),[I,X]=k.useState(""),[ee,z]=k.useState([]),[$,U]=k.useState(new Set),[ne,re]=k.useState(""),[V,Y]=k.useState("input"),[Q,se]=k.useState({done:0,total:0}),ve=k.useRef(null),M=k.useRef(null),_=k.useRef(null);k.useEffect(()=>{Ee.getSkills().then(te=>z(te.filter(ke=>ke.installed))).catch(()=>{})},[]),k.useEffect(()=>{var te,ke,je;i==="single"?(u===1&&((te=ve.current)==null||te.focus()),u===2&&((ke=M.current)==null||ke.focus())):V==="input"&&((je=_.current)==null||je.focus())},[u,i,V]);const J=k.useMemo(()=>new Set(t.map(te=>te.id)),[t]),D=k.useMemo(()=>{const te=ne.split(`
82
- `),ke=new Set;return te.map(je=>gC(je,J,ke)).filter(je=>je!==null)},[ne,J]),pe=D.length>0&&D.every(te=>!te.error),Ce=te=>{p(te),y||g(vg(te))},Ne=m.trim().length>0&&d.trim().length>0&&!t.some(te=>te.id===d),He=E.trim().length>0,_e=async()=>{T(!0),X("");const te=k0(v);try{await r({id:d,name:m.trim(),level:v,reportsTo:S,persona:E.trim(),...te,skills:$.size>0?[...$]:void 0},R),l()}catch(ke){X(ke instanceof Error?ke.message:"Failed to create role"),T(!1)}},oe=te=>te===1?Ne:te===2?He:!0,K=async()=>{T(!0),X(""),se({done:0,total:D.length});try{for(let te=0;te<D.length;te++){const ke=D[te],je=k0(ke.level),Te=vs(),Le=`${ke.name}. A ${ke.level} role reporting to ${ke.reportsTo}.`;await r({id:ke.id,name:ke.name,level:ke.level,reportsTo:ke.reportsTo,persona:Le,...je},Te),se({done:te+1,total:D.length})}l()}catch(te){X(te instanceof Error?te.message:"Failed to create roles"),T(!1)}},fe=te=>{te.key==="Escape"&&l(),te.key==="Enter"&&(te.metaKey||te.ctrlKey)&&(i==="single"?u<ps&&oe(u)?f(u+1):u===ps&&_e():V==="input"&&pe?Y("review"):V==="review"&&K())},Se=t.some(te=>te.id===d)&&d.length>0;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:l}),o.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:fe,children:[o.jsxs("div",{className:"p-5 text-white",style:{background:"linear-gradient(135deg, #2E7D32, #43A047)"},children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("div",{className:"text-lg font-bold",children:"Hire New Role"}),o.jsxs("div",{className:"flex bg-black/20 rounded-lg p-0.5",children:[o.jsx("button",{onClick:()=>{c("single"),X("")},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"}),o.jsx("button",{onClick:()=>{c("bulk"),X("")},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"})]})]}),o.jsx("div",{className:"text-sm opacity-80 mt-0.5",children:i==="single"?`Step ${u} of ${ps}`:V==="input"?"Enter roles, one per line":`Review ${D.length} roles`})]}),i==="single"&&o.jsx("div",{className:"flex gap-1 px-5 pt-4",children:Array.from({length:ps},(te,ke)=>ke+1).map(te=>o.jsx("div",{className:"flex-1 h-1 rounded-full transition-colors",style:{background:te<=u?"#2E7D32":"rgba(255,255,255,0.1)"}},te))}),o.jsx("div",{className:"p-5 min-h-[240px] overflow-y-auto flex-1",children:i==="single"?o.jsxs(o.Fragment,{children:[u===1&&o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Role Name"}),o.jsx("input",{ref:ve,value:m,onChange:te=>Ce(te.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"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Role ID (slug)"}),o.jsx("input",{value:d,onChange:te=>{g(te.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"")),b(!0)},className:`w-full p-2.5 rounded-lg border bg-white/5 text-sm text-white/90 font-mono focus:outline-none transition-colors ${Se?"border-red-400":"border-white/10 focus:border-white/25"}`}),Se&&o.jsx("div",{className:"text-xs text-red-500 mt-1",children:"ID already exists"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Level"}),o.jsx("div",{className:"flex gap-2",children:yC.map(te=>o.jsx("button",{onClick:()=>j(te.value),className:`flex-1 p-2 text-xs font-semibold rounded-lg border cursor-pointer transition-colors ${v===te.value?"border-green-600 bg-green-900/30 text-green-400":"border-white/10 text-white/50 hover:border-white/20"}`,children:te.label},te.value))})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Reports To"}),o.jsxs("select",{value:S,onChange:te=>C(te.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:[o.jsx("option",{value:"ceo",className:"bg-[var(--wall)] text-white",children:"CEO"}),t.map(te=>o.jsxs("option",{value:te.id,className:"bg-[var(--wall)] text-white",children:[te.name," (",te.id,")"]},te.id))]})]})]}),u===2&&o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Persona"}),o.jsx("textarea",{ref:M,value:E,onChange:te=>A(te.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"}),o.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&&o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Skills"}),o.jsx("div",{className:"space-y-1.5 max-h-[120px] overflow-y-auto",children:ee.map(te=>o.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:[o.jsx("input",{type:"checkbox",checked:$.has(te.id),onChange:()=>U(ke=>{const je=new Set(ke);return je.has(te.id)?je.delete(te.id):je.add(te.id),je}),className:"accent-green-600"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"text-xs font-semibold text-white/80",children:te.name}),o.jsx("div",{className:"text-[10px] text-white/40 truncate",children:te.description})]})]},te.id))})]})]}),u===3&&o.jsx("div",{className:"customize-body",style:{padding:0},children:o.jsx(bg,{roleId:"default",appearance:R,onChange:O,onRandomize:()=>O(vs()),onReset:()=>O(vs()),label:o.jsxs("span",{children:[d||"new-role"," — ",m||"New Role"]})})}),u===4&&o.jsxs("div",{className:"space-y-3",children:[o.jsx("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Review"}),o.jsxs("div",{className:"bg-white/5 rounded-xl p-4 border border-white/10",children:[o.jsxs("div",{className:"flex gap-4",children:[o.jsx("div",{className:"flex-shrink-0 rounded-lg overflow-hidden",style:{background:"#0d1117",padding:8},children:o.jsx(Bc,{roleId:"default",appearance:R,scale:4})}),o.jsxs("div",{className:"flex-1 space-y-2.5",children:[o.jsx(ys,{label:"Name",value:m}),o.jsx(ys,{label:"ID",value:d,mono:!0}),o.jsx(ys,{label:"Level",value:v}),o.jsx(ys,{label:"Reports To",value:S}),$.size>0&&o.jsx(ys,{label:"Skills",value:[...$].join(", ")})]})]}),o.jsxs("div",{className:"pt-3 mt-3 border-t border-white/10",children:[o.jsx("div",{className:"text-[10px] text-white/30 uppercase tracking-wider mb-1",children:"Persona"}),o.jsx("div",{className:"text-xs text-white/60 leading-relaxed",children:E})]})]}),I&&o.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 p-2 rounded-lg border border-red-800/30",children:I})]})]}):o.jsxs(o.Fragment,{children:[V==="input"&&o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Roles (one per line)"}),o.jsx("textarea",{ref:_,value:ne,onChange:te=>re(te.target.value),placeholder:`Name, Level, ReportsTo
83
- e.g.
84
- Data Analyst
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"}),o.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."})]}),D.length>0&&o.jsxs("div",{children:[o.jsxs("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:["Preview (",D.length," role",D.length!==1?"s":"",")"]}),o.jsx("div",{className:"bg-white/5 rounded-lg border border-white/10 overflow-hidden",children:o.jsxs("table",{className:"w-full text-xs",children:[o.jsx("thead",{children:o.jsxs("tr",{className:"border-b border-white/10",children:[o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Name"}),o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"ID"}),o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Level"}),o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Reports To"})]})}),o.jsx("tbody",{children:D.map((te,ke)=>o.jsxs("tr",{className:`border-b border-white/5 ${te.error?"bg-red-900/10":""}`,children:[o.jsx("td",{className:"p-2 text-white/80",children:te.name}),o.jsx("td",{className:"p-2 text-white/60 font-mono",children:te.id}),o.jsx("td",{className:"p-2 text-white/60",children:te.level}),o.jsx("td",{className:"p-2 text-white/60",children:te.reportsTo}),te.error&&o.jsx("td",{className:"p-2 text-red-400 text-[10px]",children:te.error})]},ke))})]})})]})]}),V==="review"&&o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:["Confirm Bulk Hire — ",D.length," roles"]}),o.jsx("div",{className:"bg-white/5 rounded-lg border border-white/10 overflow-hidden max-h-[300px] overflow-y-auto",children:o.jsxs("table",{className:"w-full text-xs",children:[o.jsx("thead",{className:"sticky top-0 bg-[var(--wall)]",children:o.jsxs("tr",{className:"border-b border-white/10",children:[o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"#"}),o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Name"}),o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"ID"}),o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Level"}),o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Reports To"})]})}),o.jsx("tbody",{children:D.map((te,ke)=>o.jsxs("tr",{className:"border-b border-white/5",children:[o.jsx("td",{className:"p-2 text-white/30",children:ke+1}),o.jsx("td",{className:"p-2 text-white/80",children:te.name}),o.jsx("td",{className:"p-2 text-white/60 font-mono",children:te.id}),o.jsx("td",{className:"p-2 text-white/60",children:te.level}),o.jsx("td",{className:"p-2 text-white/60",children:te.reportsTo})]},ke))})]})}),B&&Q.total>0&&o.jsxs("div",{children:[o.jsxs("div",{className:"flex justify-between text-[10px] text-white/40 mb-1",children:[o.jsx("span",{children:"Hiring..."}),o.jsxs("span",{children:[Q.done,"/",Q.total]})]}),o.jsx("div",{className:"h-1.5 bg-white/10 rounded-full overflow-hidden",children:o.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Q.done/Q.total*100}%`,background:"#2E7D32"}})})]}),o.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."}),I&&o.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 p-2 rounded-lg border border-red-800/30",children:I})]})]})}),o.jsxs("div",{className:"flex justify-between px-5 pb-5",children:[o.jsxs("div",{children:[i==="single"&&u>1&&o.jsx("button",{onClick:()=>f(u-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"&&V==="review"&&o.jsx("button",{onClick:()=>Y("input"),disabled:B,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"})]}),o.jsxs("div",{className:"flex gap-3",children:[o.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"?u<ps?o.jsx("button",{onClick:()=>f(u+1),disabled:!oe(u),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"}):o.jsx("button",{onClick:_e,disabled:B,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:B?"Hiring...":"HIRE"}):V==="input"?o.jsxs("button",{onClick:()=>Y("review"),disabled:!pe,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 (",D.length,")"]}):o.jsx("button",{onClick:K,disabled:B,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:B?`Hiring ${Q.done}/${Q.total}...`:`HIRE ALL (${D.length})`})]})]})]})]})}function ys({label:t,value:l,mono:r}){return o.jsxs("div",{className:"flex justify-between text-sm",children:[o.jsx("span",{className:"text-white/40",children:t}),o.jsx("span",{className:`font-semibold text-white/80 ${r?"font-mono":""}`,children:l})]})}function vC({roleId:t,roleName:l,onClose:r,onConfirm:i}){const[c,u]=k.useState(!1),f=async()=>{u(!0);try{await i(t)}finally{u(!1)}};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:r}),o.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:[o.jsxs("div",{className:"p-5 text-white",style:{background:"linear-gradient(135deg, #B71C1C, #D32F2F)"},children:[o.jsx("div",{className:"text-lg font-bold",children:"Fire Role"}),o.jsxs("div",{className:"text-sm opacity-80 mt-0.5",children:["Remove ",l," (",t,")"]})]}),o.jsxs("div",{className:"p-5",children:[o.jsxs("div",{className:"p-4 rounded-lg border-2 border-red-300 bg-red-50 mb-4",children:[o.jsx("div",{className:"text-sm font-bold text-red-800 mb-1",children:"Warning"}),o.jsxs("div",{className:"text-xs text-red-700 leading-relaxed",children:["This will permanently delete the role directory including",o.jsx("strong",{children:" role.yaml"}),", ",o.jsx("strong",{children:"profile.md"}),", ",o.jsx("strong",{children:"SKILL.md"}),", and all journal entries. This action cannot be undone."]})]}),o.jsxs("div",{className:"text-sm text-gray-600",children:["Are you sure you want to fire ",o.jsx("strong",{children:l}),"?"]})]}),o.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[o.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"}),o.jsx("button",{onClick:f,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 wC={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"};function kC({roleId:t,title:l,roleColor:r,active:i,onClick:c,onClose:u,"data-session-id":f}){return o.jsxs("button",{onClick:c,"data-session-id":f,className:`flex items-center gap-1.5 px-3 py-1.5 text-[11px] rounded-t-lg shrink-0 cursor-pointer transition-colors max-w-[180px] group ${i?"bg-[var(--terminal-bg)] text-[var(--terminal-text)]":"bg-[var(--terminal-inline-bg)] text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)] hover:bg-[var(--terminal-surface)]"}`,style:i?{borderTop:`2px solid ${r}`}:void 0,children:[o.jsx("span",{className:"text-xs",children:wC[t]??"👤"}),o.jsx("span",{className:"truncate",children:l}),o.jsx("span",{onClick:u,className:"ml-auto text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-sm leading-none",children:"×"})]})}function SC({content:t,streaming:l}){let r=t;return l&&(t.match(/```/g)??[]).length%2!==0&&(r+="\n```"),o.jsx("div",{className:"terminal-markdown",children:o.jsx(Ny,{remarkPlugins:[Zy],components:{code:jC,table:({children:i})=>o.jsx("div",{className:"overflow-x-auto my-2",children:o.jsx("table",{className:"terminal-table",children:i})})},children:r})})}function jC({className:t,children:l,...r}){const i=/language-(\w+)/.exec(t??"");return i||typeof l=="string"&&l.includes(`
87
- `)?o.jsx(CC,{language:i==null?void 0:i[1],children:l}):o.jsx("code",{className:"terminal-inline-code",...r,children:l})}function CC({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 o.jsxs("div",{className:"terminal-code-block group relative my-2",children:[l&&o.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] px-3 pt-1.5",children:l}),o.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"}),o.jsx("pre",{className:"overflow-x-auto p-3 text-xs leading-relaxed",children:o.jsx("code",{children:c})})]})}const EC={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"};function jd(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 NC(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:jd(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=jd(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?jd(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 AC({event:t,isStreaming:l}){var c,u,f;const[r,i]=k.useState(!1);switch(t.type){case"thinking":return o.jsxs("div",{className:"stream-event-thinking",children:[o.jsxs("div",{className:"stream-event-thinking-header",onClick:()=>i(!r),children:[o.jsx("span",{className:"stream-event-thinking-icon"}),o.jsxs("span",{className:"stream-event-thinking-label",children:["thinking",l?"...":""]}),t.text&&!l&&o.jsx("span",{className:"stream-event-thinking-toggle",children:r?"▾":"▸"})]}),(l||r)&&t.text&&o.jsx("div",{className:"stream-event-thinking-content",children:t.text.slice(-500)})]});case"tool":return o.jsxs("div",{className:"stream-event-tool",children:[o.jsx("span",{className:"stream-event-tool-badge",children:t.toolName}),t.toolSummary&&o.jsx("span",{className:"stream-event-tool-path",children:t.toolSummary}),t.toolInput&&o.jsx("span",{className:"stream-event-tool-toggle",onClick:()=>i(!r),children:r?"▾":"▸"}),r&&t.toolInput&&o.jsx("div",{className:"stream-event-tool-detail",children:JSON.stringify(t.toolInput,null,1).slice(0,300)})]});case"dispatch":return o.jsxs("div",{className:"stream-event-dispatch",children:[o.jsxs("span",{className:"stream-event-dispatch-badge",children:["→"," ",(c=t.roleId)==null?void 0:c.toUpperCase()]}),o.jsx("span",{className:"stream-event-dispatch-task",children:(u=t.task)==null?void 0:u.slice(0,80)})]});case"dispatch:progress":return o.jsxs("div",{className:"stream-event-dispatch-progress",children:[o.jsx("span",{className:"stream-event-dispatch-progress-role",children:(f=t.roleId)==null?void 0:f.toUpperCase()}),t.progressType==="thinking"&&o.jsxs("span",{className:"stream-event-dispatch-progress-status",children:["thinking",l?"...":""]}),t.progressType==="tool"&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"stream-event-tool-badge",children:t.toolName}),t.toolSummary&&o.jsx("span",{className:"stream-event-tool-path",children:t.toolSummary})]}),t.progressType==="text"&&t.text&&o.jsx("span",{className:"stream-event-dispatch-progress-status",children:"responding..."}),t.progressType==="done"&&o.jsx("span",{className:"stream-event-dispatch-progress-done",children:"done"}),t.progressType==="error"&&o.jsx("span",{className:"stream-event-dispatch-progress-error",children:"error"})]});default:return null}}function DC({events:t,isStreaming:l}){const[r,i]=k.useState(!1);if(t.length===0)return null;const c=NC(t);if(c.length===0)return null;const u=t.filter(b=>b.type==="thinking").length,f=t.filter(b=>b.type==="tool"),m=t.filter(b=>b.type==="dispatch"||b.type==="dispatch:progress"),p=t.filter(b=>b.type==="turn").reduce((b,v)=>Math.max(b,v.turn??0),0),d=[];if(u>0&&d.push("thinking"),f.length>0){const b=[...new Set(f.map(v=>v.toolName))];b.length<=3?d.push(b.join(", ")):d.push(`${f.length} tool calls`)}m.length>0&&d.push(`${m.length} dispatch`),p>1&&d.push(`${p} turns`);const g=d.join(" · "),y=!r;return o.jsxs("div",{className:"stream-activity-log",children:[o.jsxs("div",{className:"stream-activity-header",onClick:()=>i(!r),children:[l&&o.jsx("span",{className:"stream-activity-pulse"}),o.jsxs("span",{className:"stream-activity-summary",children:[r?"▸":"▾"," ",g,l?"...":""]})]}),y&&o.jsx("div",{className:"stream-activity-events",children:c.map((b,v)=>o.jsx(AC,{event:b,isStreaming:l&&v===c.length-1},v))})]})}function TC({message:t,roleId:l,roleColor:r}){var d;const i=t.from==="ceo",c=t.type==="system",u=t.status==="streaming";if(c)return o.jsx("div",{className:"flex justify-center my-2",children:o.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 o.jsx("div",{className:"flex justify-end mb-3",children:o.jsxs("div",{className:"max-w-[85%]",children:[o.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] text-right mb-1",children:"CEO"}),o.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"&&o.jsx("span",{className:"text-amber-400 text-[10px] font-bold mr-1.5",children:"DO"}),t.content]})]})});const f=(((d=t.streamEvents)==null?void 0:d.length)??0)>0,m=!!t.thinking,p=m&&!t.content&&u&&!f;return o.jsxs("div",{className:"flex gap-2.5 mb-3",children:[o.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:EC[l]??"👤"}),o.jsxs("div",{className:"max-w-[85%] min-w-0",children:[o.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] mb-1",children:l.toUpperCase()}),f&&o.jsx(DC,{events:t.streamEvents,isStreaming:u}),m&&!f&&o.jsxs("details",{open:p,className:"mb-1",children:[o.jsxs("summary",{className:"text-[10px] text-purple-400/70 cursor-pointer select-none flex items-center gap-1",children:[p&&o.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-purple-400 animate-pulse"}),"thinking",p?"...":` (${t.thinking.length} chars)`]}),o.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)})]}),o.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?o.jsx(SC,{content:t.content,streaming:u}):u&&!m?o.jsx("span",{className:"inline-block w-2 h-4 bg-[var(--terminal-text-secondary)] animate-pulse"}):u&&m?o.jsx("span",{className:"text-[11px] text-purple-400/50 italic",children:"analyzing..."}):null,u&&t.content&&o.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"&&o.jsx("div",{className:"text-[10px] text-red-400 mt-1",children:"Error occurred"})]})]})}function zC({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?o.jsxs("div",{className:"flex-1 flex items-center justify-center text-[var(--terminal-text-muted)] text-sm",children:["Start a conversation with ",l.toUpperCase()]}):o.jsxs("div",{className:"flex-1 overflow-y-auto p-4 terminal-scrollbar",children:[t.map(u=>o.jsx(TC,{message:u,roleId:l,roleColor:r},u.id)),o.jsx("div",{ref:i})]})}function MC({mode:t,onModeChange:l,onSend:r,disabled:i,disabledReason:c}){const[u,f]=k.useState(""),m=k.useRef(null);k.useEffect(()=>{const g=m.current;g&&(g.style.height="0",g.style.height=Math.min(g.scrollHeight,120)+"px")},[u]);const p=()=>{const g=u.trim();!g||i||(r(g),f(""))},d=g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),p())};return o.jsxs("div",{className:"border-t border-[var(--terminal-border)] p-3 shrink-0",children:[c&&o.jsx("div",{className:"text-[10px] text-amber-400/70 mb-2 text-center",children:c}),o.jsxs("div",{className:"flex items-end gap-2",children:[o.jsxs("div",{className:"flex rounded-lg overflow-hidden border border-[var(--terminal-border)] shrink-0",children:[o.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"}),o.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"})]}),o.jsx("textarea",{ref:m,value:u,onChange:g=>f(g.target.value),onKeyDown:d,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"}),o.jsx("button",{onClick:p,disabled:i||!u.trim(),className:"w-8 h-8 rounded-lg bg-[var(--terminal-surface-light)] text-[var(--terminal-text-secondary)] flex items-center justify-center shrink-0 cursor-pointer hover:bg-[var(--desk-wood)] hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M22 2L11 13"}),o.jsx("path",{d:"M22 2L15 22L11 13L2 9L22 2Z"})]})})]})]})}const RC={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},wg={cto:"CTO",cbo:"CBO",pm:"PM",engineer:"Engineer",designer:"Designer",qa:"QA","data-analyst":"Data Analyst"};function S0(t){return new Date(t).toLocaleTimeString("ko-KR",{hour:"2-digit",minute:"2-digit"})}function FC({msg:t}){const l=RC[t.roleId]??"#888",r=wg[t.roleId]??t.roleId;if(t.type==="dispatch"){const i=t.text.includes("WAVE"),c=t.text.includes("completed")||t.text.includes("완료"),u=i?"📡":c?"✓":"→",f=c?"text-green-400/70":"text-[var(--terminal-text-muted)]";return o.jsxs("div",{className:"flex items-start gap-2 px-3 py-1 hover:bg-white/[0.02]",children:[o.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)] shrink-0 w-10 text-right mt-0.5",children:S0(t.ts)}),o.jsx("span",{className:"text-[10px] shrink-0 mt-0.5",children:u}),o.jsx("span",{className:`text-[11px] ${f}`,children:t.text})]})}return o.jsxs("div",{className:"flex items-start gap-2 px-3 py-1.5 hover:bg-white/[0.02]",children:[o.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)] shrink-0 w-10 text-right mt-0.5",children:S0(t.ts)}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"text-[11px] font-semibold mr-1.5",style:{color:l},children:r}),o.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 j;const b=u.current;if(!b)return;b.scrollHeight-b.scrollTop-b.clientHeight<80&&((j=c.current)==null||j.scrollIntoView({behavior:"smooth"}))},[t.messages.length]);const[f,m]=k.useState(!1),[p,d]=k.useState(!1),[g,y]=k.useState("");return o.jsxs("div",{ref:u,className:"flex-1 overflow-y-auto terminal-scrollbar py-2",children:[o.jsxs("div",{className:"px-3 py-2 mb-2 border-b border-[var(--terminal-border)] flex items-center gap-2",children:[o.jsx("span",{className:"text-sm font-semibold text-[var(--terminal-text)]",children:t.name}),t.members.length>0&&o.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:t.members.map(b=>wg[b]??b).join(", ")}),t.members.length===0&&o.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:t.isDefault?"system logs":"no members"}),!t.isDefault&&l&&r&&o.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(!f),children:f?"Done":"Invite"})]}),!t.isDefault&&i&&o.jsx("div",{className:"px-3 pb-2 mb-1",children:p?o.jsx("input",{autoFocus:!0,value:g,onChange:b=>y(b.target.value),onKeyDown:b=>{b.key==="Enter"&&(i(t.id,g.trim()),d(!1)),b.key==="Escape"&&d(!1)},onBlur:()=>{i(t.id,g.trim()),d(!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"}):o.jsx("button",{onClick:()=>{y(t.topic??""),d(!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..."})}),f&&!t.isDefault&&l&&r&&o.jsx("div",{className:"px-3 pb-2 mb-2 border-b border-[var(--terminal-border)]",children:o.jsx("div",{className:"flex flex-wrap gap-1",children:l.map(b=>{const v=t.members.includes(b.id);return o.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 j=v?t.members.filter(S=>S!==b.id):[...t.members,b.id];r(t.id,j)},children:[v?"✓ ":"",b.name]},b.id)})})}),t.messages.length===0&&o.jsx("div",{className:"flex-1 flex flex-col items-center justify-center text-[var(--terminal-text-muted)] text-xs gap-1 py-8",children:o.jsx("span",{children:t.isDefault?"No dispatch events yet":"No messages yet — invite roles to start chatting"})}),t.messages.map(b=>o.jsx(FC,{msg:b},b.id)),o.jsx("div",{ref:c})]})}const Cd={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"},OC=400,BC=800;function LC({sessions:t,activeSessionId:l,roles:r,streamingSessionId:i,width:c,onWidthChange:u,onSwitchSession:f,onCloseSession:m,onCreateSession:p,onClearEmpty:d,onCloseAll:g,onSendMessage:y,onModeChange:b,onCloseTerminal:v,chatChannels:j,activeChatChannelId:S,onSwitchChatChannel:C,onCreateChatChannel:E,onDeleteChatChannel:A,onUpdateChatMembers:R,onUpdateChatTopic:O,unreadChannels:B}){const[T,I]=k.useState(!1),[X,ee]=k.useState(!1),[z,$]=k.useState(!1),[U,ne]=k.useState(""),re=S!=null,V=j==null?void 0:j.find(K=>K.id===S),[Y,Q]=k.useState(!1),[se,ve]=k.useState(!1),[M,_]=k.useState(!1),J=k.useRef(0),D=k.useRef(0),pe=k.useRef(null),Ce=t.find(K=>K.id===l),Ne=i===l,He=t.filter(K=>K.messages.length===0).length,_e=k.useCallback(()=>{const K=pe.current;K&&(ve(K.scrollLeft>0),_(K.scrollLeft+K.clientWidth<K.scrollWidth-1))},[]);k.useEffect(()=>{if(!l||!pe.current)return;const K=pe.current.querySelector(`[data-session-id="${l}"]`);K&&K.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"}),_e()},[l,t.length,_e]),k.useEffect(()=>{const K=pe.current;if(!K)return;_e(),K.addEventListener("scroll",_e);const fe=new ResizeObserver(_e);return fe.observe(K),()=>{K.removeEventListener("scroll",_e),fe.disconnect()}},[_e]);const oe=k.useCallback(K=>{K.preventDefault(),J.current=K.clientX,D.current=c,Q(!0);const fe=te=>{const ke=J.current-te.clientX,je=Math.min(BC,Math.max(OC,D.current+ke));u==null||u(je)},Se=()=>{Q(!1),document.removeEventListener("mousemove",fe),document.removeEventListener("mouseup",Se)};document.addEventListener("mousemove",fe),document.addEventListener("mouseup",Se)},[c,u]);return o.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&&o.jsx("div",{className:`terminal-resize-handle absolute top-0 left-0 w-1 h-full cursor-col-resize z-10 transition-colors ${Y?"bg-[var(--terminal-border-hover)]":"bg-transparent"}`,onMouseDown:oe}),o.jsxs("div",{className:"flex items-center bg-[var(--terminal-bg-deeper)] border-b border-[var(--terminal-border)] shrink-0",children:[o.jsxs("div",{className:"relative flex-1 min-w-0",children:[se&&o.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"}),o.jsxs("div",{ref:pe,className:"flex items-center overflow-x-auto terminal-tab-scroll gap-px px-1 py-1",children:[j==null?void 0:j.map(K=>o.jsxs("button",{onClick:()=>{C==null||C(K.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 ${S===K.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:S===K.id?{borderTop:"2px solid #4CAF50"}:void 0,children:[o.jsx("span",{className:"text-[10px]",children:"💬"}),o.jsx("span",{className:"truncate",children:K.name}),(B==null?void 0:B.has(K.id))&&S!==K.id&&o.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-400 shrink-0"}),!K.isDefault&&o.jsx("span",{onClick:fe=>{fe.stopPropagation(),A==null||A(K.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:"×"})]},K.id)),j&&j.length>0&&t.length>0&&o.jsx("div",{className:"w-px h-4 bg-[var(--terminal-border)] shrink-0 mx-1"}),t.map(K=>o.jsx(kC,{roleId:K.roleId,title:K.title,roleColor:Cd[K.roleId]??"#666",active:!re&&K.id===l,onClick:()=>{C==null||C(null),f(K.id)},onClose:fe=>{fe.stopPropagation(),m(K.id)},"data-session-id":K.id},K.id))]}),M&&o.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"})]}),o.jsxs("div",{className:"relative shrink-0",children:[o.jsx("button",{onClick:()=>{I(!T),ee(!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:"+"}),T&&o.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:[E&&o.jsxs(o.Fragment,{children:[z?o.jsxs("div",{className:"px-3 py-2 flex items-center gap-1",children:[o.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:"#"}),o.jsx("input",{autoFocus:!0,value:U,onChange:K=>ne(K.target.value),onKeyDown:K=>{K.key==="Enter"&&U.trim()&&(E(U.trim(),[]),ne(""),$(!1),I(!1)),K.key==="Escape"&&($(!1),ne(""))},placeholder:"channel name",className:"flex-1 bg-transparent text-xs text-[var(--terminal-text)] outline-none border-b border-[var(--terminal-border)]"})]}):o.jsxs("button",{onClick:()=>$(!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:[o.jsx("span",{className:"text-[10px]",children:"💬"}),"New Channel"]}),o.jsx("div",{className:"border-b border-[var(--terminal-border)] my-1"})]}),r.map(K=>o.jsxs("button",{onClick:()=>{p(K.id),C==null||C(null),I(!1)},className:"w-full text-left px-3 py-2 text-xs text-[var(--terminal-text-secondary)] hover:bg-[var(--terminal-surface-light)] cursor-pointer flex items-center gap-2",children:[o.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:Cd[K.id]??"#666"}}),K.id.toUpperCase()," — ",K.name]},K.id))]})]}),o.jsxs("div",{className:"relative shrink-0",children:[o.jsx("button",{onClick:()=>{ee(!X),I(!1)},className:"w-7 h-7 flex items-center justify-center text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-xs cursor-pointer tracking-tight",title:"Manage sessions",children:"···"}),X&&o.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:[o.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":""]}),He>0&&d&&o.jsxs("button",{onClick:()=>{d(),ee(!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 (",He,")"]}),t.length>0&&g&&o.jsx("button",{onClick:()=>{g(),ee(!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&&o.jsx("div",{className:"px-3 py-2 text-xs text-[var(--terminal-text-muted)]",children:"No sessions"})]})]}),o.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:"×"})]}),re&&V?o.jsx(_C,{channel:V,allRoles:r,onUpdateMembers:R,onUpdateTopic:O}):Ce?o.jsxs(o.Fragment,{children:[o.jsx(zC,{messages:Ce.messages,roleId:Ce.roleId,roleColor:Cd[Ce.roleId]??"#666"}),o.jsx(MC,{mode:Ce.mode,onModeChange:K=>b(Ce.id,K),onSend:K=>y(Ce.id,K,Ce.mode),disabled:Ne,disabledReason:Ne?`${Ce.roleId.toUpperCase()} is responding...`:void 0})]}):o.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 $C(){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,f)=>{l();const m=new AbortController;return t.current=m,fetch(`/api/exec/session/${i}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:c,mode:u}),signal:m.signal}).then(async p=>{var b,v,j,S,C;if(!p.ok||!p.body){f.onError("Failed to connect");return}const d=p.body.getReader(),g=new TextDecoder;let y="";for(;;){const{done:E,value:A}=await d.read();if(E)break;y+=g.decode(A,{stream:!0});const R=y.split(`
88
- `);y=R.pop()??"";let O="";for(let B=0;B<R.length;B++){const T=R[B];if(T.startsWith("event: ")){O=T.slice(7).trim();continue}if(T.startsWith("data: ")){let I;try{I=JSON.parse(T.slice(6))}catch{O="";continue}switch(O){case"thinking":I.text&&((b=f.onThinking)==null||b.call(f,I.text));break;case"output":I.text&&f.onText(I.text);break;case"tool":(v=f.onToolUse)==null||v.call(f,I.name,I.input);break;case"dispatch":(j=f.onDispatch)==null||j.call(f,I.roleId,I.task);break;case"dispatch:progress":(S=f.onDispatchProgress)==null||S.call(f,I.roleId,I.type,I);break;case"turn":(C=f.onTurn)==null||C.call(f,I.turn);break;case"done":f.onDone(I);break;case"error":f.onError(I.message??"Unknown error");break;default:I.text&&f.onText(I.text);break}O=""}}}}).catch(p=>{p.name!=="AbortError"&&f.onError(p.message)}),{abort:l}},[l]),abort:l}}const Eh="tycono-appearances",Ac="tycono-theme";(()=>{try{for(const[t,l]of[["the-company-appearances",Eh],["the-company-theme",Ac]]){const r=localStorage.getItem(t);r&&!localStorage.getItem(l)&&(localStorage.setItem(l,r),localStorage.removeItem(t))}}catch{}})();function j0(){try{const t=localStorage.getItem(Eh);return t?JSON.parse(t):{}}catch{return{}}}function Ed(t){localStorage.setItem(Eh,JSON.stringify(t))}function C0(){try{const t=localStorage.getItem(Ac);if(t&&t in $r)return t}catch{}return"default"}function HC(t){var i;const l=(i=$r[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 Nd={mode:"auto",intervalSec:18,dailyBudgetUsd:1},Jd="tycono-speech-settings",Ad="tycono-language";function UC(){try{const t=localStorage.getItem(Jd);return t?{...Nd,...JSON.parse(t)}:Nd}catch{return Nd}}function IC(){const[t,l]=k.useState(j0),[r,i]=k.useState(C0),[c,u]=k.useState(UC),[f,m]=k.useState(()=>{try{return localStorage.getItem(Ad)??"auto"}catch{return"auto"}}),p=k.useRef(!1);k.useEffect(()=>{p.current||(p.current=!0,Ee.getPreferences().then(S=>{const C=Object.keys(S.appearances??{}).length>0||S.theme!=="default";if(S.speech&&(u(E=>({...E,...S.speech})),localStorage.setItem(Jd,JSON.stringify(S.speech))),S.language&&(m(S.language),localStorage.setItem(Ad,S.language)),C){const E=S.appearances;l(E),Ed(E),S.theme&&S.theme in $r&&(i(S.theme),localStorage.setItem(Ac,S.theme))}else{const E=j0(),A=C0();(Object.keys(E).length>0||A!=="default")&&Ee.updatePreferences({appearances:E,theme:A}).catch(()=>{})}}).catch(()=>{}))},[]),k.useEffect(()=>{HC(r)},[r]);const d=k.useCallback(S=>t[S]??Ch(S),[t]),g=k.useCallback((S,C)=>{l(E=>{const A={...E,[S]:C};return Ed(A),Ee.updatePreferences({appearances:A}).catch(()=>{}),A})},[]),y=k.useCallback(S=>{l(C=>{const E={...C};return delete E[S],Ed(E),Ee.updatePreferences({appearances:E}).catch(()=>{}),E})},[]),b=k.useCallback(S=>{i(S),localStorage.setItem(Ac,S),Ee.updatePreferences({theme:S}).catch(()=>{})},[]),v=k.useCallback(S=>{u(C=>{const E={...C,...S};return localStorage.setItem(Jd,JSON.stringify(E)),Ee.updatePreferences({speech:E}).catch(()=>{}),E})},[]),j=k.useCallback(S=>{m(S),localStorage.setItem(Ad,S),Ee.updatePreferences({language:S}).catch(()=>{})},[]);return{appearances:t,getAppearance:d,setAppearance:g,resetAppearance:y,theme:r,setTheme:b,speechSettings:c,setSpeechSettings:v,language:f,setLanguage:j}}const YC=3e4;function qC(){var j;const[t,l]=k.useState(null),[r,i]=k.useState("synced"),[c,u]=k.useState([]),f=k.useRef(null),m=k.useCallback(async()=>{try{const S=await Ee.getSaveStatus();l(S),S.noGit?i("no-git"):i(C=>C==="saving"?C:S.dirty?"dirty":"synced")}catch{i("error")}},[]);k.useEffect(()=>(m(),f.current=setInterval(m,YC),()=>{f.current&&clearInterval(f.current)}),[m]);const p=k.useCallback(async S=>{i("saving");try{const C=await Ee.save(S);return await m(),C}catch(C){throw i("error"),C}},[m]),d=k.useCallback(async()=>{try{const S=await Ee.getSaveHistory(20);u(S)}catch{}},[]),g=k.useCallback(async S=>{i("saving");try{await Ee.restoreSave(S),await m()}catch(C){throw i("error"),C}},[m]),y=k.useCallback(async()=>{try{await Ee.initGit(),await m()}catch{i("error")}},[m]),b=t?t.modified.length+t.untracked.length:0,v=((j=t==null?void 0:t.lastCommit)==null?void 0:j.date)??null;return{state:r,dirtyCount:b,lastSaved:v,status:t,save:p,history:c,loadHistory:d,restore:g,refresh:m,initGit:y}}const E0={cto:["Need to reduce this architecture tech debt...","Don't over-engineer. Keep it minimal.","Performance profiling results are a bit concerning.","Should do a system design review.","If I just strip one abstraction layer, it should work.","Let me check the monitoring dashboard.","Need to go through the code review queue.","It's about time to clean up these module dependencies."],cbo:["Heard the competitor launched a new feature... need to analyze.","Should compile this month's revenue metrics.","It's time to update the market trend report.","Maybe I should benchmark the pricing strategy.","Need to recalculate the ROI.","Let me check the competitor's GitHub star trends.","Thinking about launch timing...","Should re-examine the positioning strategy."],pm:["Is this feature really what users want?","Need to clean up the backlog...","MVP scope keeps expanding.","Analyzing user feedback...","Might need to re-prioritize.","Watch out for scope creep.","Will the roadmap timeline hold...","Should double-check the task dependencies."],engineer:["I want to refactor this code...","Test coverage seems a bit low.","Working code first, perfect code later.","Waiting for PR review...","What could be causing this bug...","Is the build broken?","Need to fix that one type error.","Maybe I should run npm audit."],designer:["This UI flow feels a bit awkward...","Usability first, pretty later.","Need to organize the design system components.","Let me make two quick options and compare.","Should run through the accessibility checklist.","Maybe I should prototype this interaction.","Let me revisit the color palette...","The spacing feels a bit cramped."],qa:['"Works" and "correct" are two different things.',"Organizing edge case scenarios...","Should run the regression test suite.","This part could be converted to automated tests.","Need to go through the pre-release checklist.","Reproducible bug reports are key.","Should run cross-browser tests.","Need to check for performance regressions."],"data-analyst":["Checking the data pipeline status...","Interesting outlier detection pattern.","Need to update the dashboard metrics.","Correlation isn't causation though...","Seems like there is room for SQL query optimization.","It's time for a data quality check."]},N0={cto:["Should I assign more work to the team...","It's time to clean up the architecture debt.","Need to re-examine the tech roadmap.","It's quiet... am I missing something?"],cbo:["It's time to update the market analysis...","Should be preparing the revenue report, but no directives.","Let me check on competitor movements.","It's quiet on the business side..."],pm:["Backlog is pretty quiet... nothing to plan?","It's been a while since we scheduled a sprint.","User feedback must be piling up...","No PRD to write... that's unusual."],engineer:["Nothing to do today... maybe some code reviews.","Task queue is empty. Guess I'll refactor.","Am I missing something?","Should clean up the commit log."],designer:["No design requests coming in. Should I improve something on my own?","Maybe run a UI audit...","Should organize my portfolio.","Let me tidy up the component library."],qa:["No builds to test. Let me improve the automation scripts.","It's quiet... no bugs, or just haven't found them?","Let me review the existing test scenarios.","Should update the test coverage report."],"data-analyst":["No analysis requests coming in...","Maybe I should clean up the data warehouse.","Should verify the past reports."]},XC=[{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."}]}],VC=18e3,A0=6e3,GC=2500,KC=30*6e4,kg="tycono:relationships";function QC(){try{const t=localStorage.getItem(kg);return t?JSON.parse(t):[]}catch{return[]}}function WC(t){localStorage.setItem(kg,JSON.stringify(t))}function ac(t,l,r){const[i,c]=l<r?[l,r]:[r,l];let u=t.find(f=>f.roleA===i&&f.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 ic(t){return Math.min(100,t.dispatches*5+t.wavesTogether*10+t.conversations*2)}function sc(t){return t[Math.floor(Math.random()*t.length)]}function ZC(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",f=c.level==="c-level";return u&&f?"c-level":i.reportsTo===l||c.reportsTo===t?"superior-subordinate":(i.reportsTo===c.reportsTo,"peer")}function JC(t,l){return t.relation==="any"?!0:t.relation===l}function PC({roles:t,roleStatuses:l,activeExecs:r,getStandupSpeech:i}){const[c,u]=k.useState(new Map),[f,m]=k.useState(QC),p=k.useRef({}),d=k.useRef(null),g=k.useRef(t),y=k.useRef(l),b=k.useRef(r),v=k.useRef(i),j=k.useRef(f);g.current=t,y.current=l,b.current=r,v.current=i,j.current=f,k.useEffect(()=>{const O=Date.now();for(const[B,T]of Object.entries(l))T==="working"&&(p.current[B]=O)},[l]),k.useEffect(()=>{WC(f)},[f]);const S=k.useCallback(O=>{const B=y.current[O],T=b.current.find($=>$.roleId===O);if(B==="working"&&(T!=null&&T.task))return null;const I=v.current(O);if(I&&Math.random()<.3)return{text:I,type:"work",ts:Date.now()};const X=Date.now(),ee=p.current[O]??0;if(X-ee>KC&&Math.random()<.5){const $=N0[O]??N0.engineer;return{text:sc($),type:"guilt",ts:X}}const z=E0[O]??E0.engineer;return{text:sc(z),type:"personality",ts:X}},[]),C=k.useCallback(O=>{if(d.current)return!1;const B=O.filter(Q=>y.current[Q.id]!=="working");if(B.length<2)return!1;const T=[...B].sort(()=>Math.random()-.5),I=T[0],X=T[1],ee=ZC(I.id,X.id,O);if(!ee)return!1;const z=ac(j.current,I.id,X.id),$=ic(z),U=XC.filter(Q=>JC(Q,ee)&&$>=Q.minFamiliarity);if(U.length===0)return!1;const ne=sc(U);let re=I.id,V=X.id;ne.relation==="superior-subordinate"&&(X.reportsTo===I.id||I.level==="c-level"?(re=I.id,V=X.id):(re=X.id,V=I.id)),d.current={templateId:ne.id,roleA:re,roleB:V,turnIdx:0,timer:null};const Y=Q=>{if(!d.current||Q>=ne.turns.length){d.current=null,m(_=>{const J=[..._],D=ac(J,re,V);return D.conversations++,D.familiarity=ic(D),D.lastInteraction=new Date().toISOString(),J}),setTimeout(()=>{u(_=>{const J=new Map(_);return J.delete(re),J.delete(V),J})},A0);return}const se=ne.turns[Q],ve=se.speaker==="A"?re:V,M=se.speaker==="A"?V:re;u(_=>{const J=new Map(_);if(J.set(ve,{text:se.text,type:"social",partnerId:M,ts:Date.now()}),Q>0){const D=ne.turns[Q-1].speaker==="A"?re:V;D!==ve&&J.delete(D)}return J}),d.current.turnIdx=Q,d.current.timer=setTimeout(()=>Y(Q+1),GC)};return Y(0),!0},[]);k.useEffect(()=>{const O=setInterval(()=>{const B=g.current;if(B.length===0||d.current||Math.random()<.35&&C(B))return;const T=B.filter(ee=>y.current[ee.id]!=="working");if(T.length===0)return;const I=sc(T),X=S(I.id);X&&(u(ee=>{const z=new Map(ee);return z.set(I.id,X),z}),setTimeout(()=>{u(ee=>{const z=new Map(ee),$=z.get(I.id);return $&&$.ts===X.ts&&z.delete(I.id),z})},A0))},VC);return()=>{var B;clearInterval(O),(B=d.current)!=null&&B.timer&&clearTimeout(d.current.timer)}},[S,C]);const E=k.useCallback(O=>{const B=c.get(O);return(B==null?void 0:B.text)??""},[c]),A=k.useCallback((O,B)=>{m(T=>{const I=[...T],X=ac(I,O,B);return X.dispatches++,X.familiarity=ic(X),X.lastInteraction=new Date().toISOString(),I})},[]),R=k.useCallback(O=>{O.length<2||m(B=>{const T=[...B];for(let I=0;I<O.length;I++)for(let X=I+1;X<O.length;X++){const ee=ac(T,O[I],O[X]);ee.wavesTogether++,ee.familiarity=ic(ee),ee.lastInteraction=new Date().toISOString()}return T})},[]);return{speeches:c,getSpeech:E,relationships:f,notifyDispatch:A,notifyWave:R}}const Sg="tycono:office-chat";let eE=0;function tE(){return`chat-${Date.now()}-${++eE}`}function Dd(){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 nE(){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[...Dd(),...i]}const r=Dd();for(const i of r)l.find(c=>c.id===i.id)||l.unshift(i);return l}}catch{}return Dd()}function lE(t){const l=t.map(r=>({...r,messages:r.messages.slice(-200)}));localStorage.setItem(Sg,JSON.stringify(l))}function rE(){const[t,l]=k.useState(nE),[r,i]=k.useState(null),[c,u]=k.useState(new Set);k.useEffect(()=>{lE(t)},[t]);const f=k.useCallback(v=>{i(v),v&&u(j=>{const S=new Set(j);return S.delete(v),S})},[]),m=k.useCallback(v=>{const j={...v,id:tE()};l(S=>{const C=S.map(E=>E.id==="general"?v.type==="dispatch"?{...E,messages:[...E.messages,j].slice(-200)}:E:v.channelId?E.id===v.channelId?{...E,messages:[...E.messages,j].slice(-200)}:E:E.members.length>0&&E.members.includes(v.roleId)?{...E,messages:[...E.messages,j].slice(-200)}:E);return u(E=>{const A=new Set(E);for(const R of C){const O=S.find(B=>B.id===R.id);O&&R.messages.length>O.messages.length&&A.add(R.id)}return A}),C})},[]),p=k.useCallback((v,j,S)=>{const C=`ch-${Date.now()}`,E={id:C,name:v.startsWith("#")?v:`#${v}`,members:j,isDefault:!1,messages:[],topic:S};l(A=>[...A,E]),i(C)},[]),d=k.useCallback(v=>{l(j=>j.filter(S=>S.id!==v||S.isDefault)),i(j=>j===v?"general":j)},[]),g=k.useCallback((v,j)=>{l(S=>S.map(C=>C.id===v&&!C.isDefault?{...C,members:j}:C))},[]),y=k.useCallback((v,j)=>{l(S=>S.map(C=>C.id===v&&!C.isDefault?{...C,topic:j||void 0}:C))},[]),b=k.useCallback(v=>{l(j=>j.map(S=>{if(S.id==="watercooler"){const C=v.filter(E=>E.level!=="c-level").map(E=>E.id);if(S.members.length!==C.length||!C.every(E=>S.members.includes(E)))return{...S,members:C}}return S}))},[]);return{channels:t,activeChannelId:r,setActiveChannelId:f,pushMessage:m,createChannel:p,deleteChannel:d,updateMembers:g,updateTopic:y,unreadChannels:c,syncDefaultMembers:b}}const aE=45e3,iE=3e3,sE=3,oE=20;function cE({roles:t,roleStatuses:l,activeExecs:r,channels:i,relationships:c,pushMessage:u,speechSettings:f,engineType:m,hasApiKey:p}){const g=((f==null?void 0:f.mode)==="auto"?m==="claude-cli"||m==="local"?"llm":"template":(f==null?void 0:f.mode)??"template")==="llm"&&(p!==!1||m==="claude-cli"),y=((f==null?void 0:f.intervalSec)??aE/1e3)*1e3,b=k.useRef(t),v=k.useRef(l),j=k.useRef(r),S=k.useRef(i),C=k.useRef(c),E=k.useRef(u),A=k.useRef(0),R=k.useRef(!1);b.current=t,v.current=l,j.current=r,S.current=i,C.current=c,E.current=u;const O=k.useCallback(async(T,I)=>{if(R.current)return!1;R.current=!0;try{if(!b.current.find(V=>V.id===T))return!1;const ee=I.messages.slice(-oE).map(V=>({roleId:V.roleId,text:V.text,ts:V.ts})),z=b.current.filter(V=>I.members.includes(V.id)),$=C.current.filter(V=>V.roleA===T||V.roleB===T).map(V=>({partnerId:V.roleA===T?V.roleB:V.roleA,familiarity:V.familiarity})),U=j.current.find(V=>V.roleId===T),ne=U?{currentTask:U.task,taskProgress:null}:{currentTask:null,taskProgress:null},re=await Ee.chatInChannel({channelId:I.name.replace("#",""),channelTopic:I.topic,roleId:T,history:ee,members:z.map(V=>({id:V.id,name:V.name,level:V.level})),relationships:$,workContext:ne});return re.message?(E.current({ts:Date.now(),roleId:T,text:re.message,type:"chat",channelId:I.id}),!0):!1}catch{return!1}finally{R.current=!1}},[]),B=k.useCallback(async(T,I)=>{if(A.current>=sE){A.current=0;return}const X=T.members.filter(z=>z!==I&&v.current[z]!=="working");if(X.length===0){A.current=0;return}const ee=X[Math.floor(Math.random()*X.length)];if(Math.random()>.6){A.current=0;return}setTimeout(async()=>{A.current++;const z=S.current.find(U=>U.id===T.id);if(!z)return;await O(ee,z)?B(z,ee):A.current=0},iE+Math.random()*2e3)},[O]);k.useEffect(()=>{if(!g)return;const T=setInterval(async()=>{const I=b.current;if(I.length===0||R.current)return;const X=I.filter(ne=>v.current[ne.id]!=="working");if(X.length===0)return;const ee=X[Math.floor(Math.random()*X.length)],z=S.current.filter(ne=>ne.members.length===0?!0:ne.members.includes(ee.id));if(z.length===0)return;const $=z[Math.floor(Math.random()*z.length)];A.current=0,await O(ee.id,$)&&B($,ee.id)},y);return()=>clearInterval(T)},[g,y,O,B])}function oc({type:t,className:l}){const r=k.useRef(null),i=AS(t);return k.useEffect(()=>{const c=r.current;if(!c||!i)return;const u=c.getContext("2d");u&&TS(u,i)},[t,i]),i?o.jsx("canvas",{ref:r,width:i.canvasWidth,height:i.canvasHeight,className:l,style:{imageRendering:"pixelated",display:"block"}}):null}const jg=[[1,8],[3,5],[8,1],[5,3]],uE=[[1,4],[2,3],[4,1],[3,2]];function cc(t){const l=t===1||t===3?-1:0,r=jg[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 uc(t){const l=t===1||t===3?-1:0,r=jg[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=uE[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 D0={down:[cc(0),cc(1),cc(2),cc(3)],up:[uc(0),uc(1),uc(2),uc(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)]},Ye=4,Nt=28,rn=2,ot=4,Ze=4,nr=[{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 Nh(t,l,r){const u=t.fy+Math.max(10,Math.floor(t.fh*.18)),f=Math.min(l,r),m=Math.ceil(l/f),p=[],d=f*28,g=t.fx+Math.max(8,Math.floor((t.fw-d)/2));for(let y=0;y<m&&p.length<l;y++){const b=Math.min(f,l-y*f);for(let v=0;v<b;v++)p.push({dx:g+v*28,dy:u+y*28,room:t.id})}return p}function fE(t){const i=nr[0],c={id:"main",wx:Ye+Ze,wy:Ye,ww:160-2*(Ye+Ze),wh:Nt,fx:Ye+Ze,fy:Ye+Nt+rn,fw:160-2*(Ye+Ze),fh:120-Ye-Nt-rn-Ye,...i},u=Nh(c,Math.min(t,6),3),f=[{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*(Ye+Ze))/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:f,furniture:m}}function dE(t){const c={id:"exec",wx:Ye+Ze,wy:Ye,ww:144-Ye-Ze-ot/2,wh:Nt,fx:Ye+Ze,fy:Ye+Nt+rn,fw:144-Ye-Ze-ot/2,fh:66,...nr[0]},u={id:"work",wx:144+ot/2+Ze,wy:Ye,ww:144-ot/2-Ze-Ye,wh:Nt,fx:144+ot/2+Ze,fy:Ye+Nt+rn,fw:144-ot/2-Ze-Ye,fh:66,...nr[1]},f={id:"meet",wx:Ye+Ze,wy:Ye+Nt+rn+66+ot,ww:144-Ye-Ze-ot/2,wh:Nt,fx:Ye+Ze,fy:Ye+Nt+rn+66+ot+Nt+rn,fw:144-Ye-Ze-ot/2,fh:70,...nr[2]},m={id:"comm",wx:144+ot/2+Ze,wy:Ye+Nt+rn+66+ot,ww:144-ot/2-Ze-Ye,wh:Nt,fx:144+ot/2+Ze,fy:Ye+Nt+rn+66+ot+Nt+rn,fw:144-ot/2-Ze-Ye,fh:70,...nr[3]},p={exec:c,work:u,meet:f,comm:m},d=[];let g=t;const y=[[c,Math.min(3,g)],[u,0]];y[1][1]=Math.min(3,g-y[0][1]);const b=[[f,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[T,I]of[...y,...b])I>0&&d.push(...Nh(T,I,3));const j=Ye+Nt+rn+66,S=144-ot/2,C={exec_work:{id:"exec_work",type:"v",doorY:Ye+Nt+rn+20+12,xA:S-2,xB:u.fx+2},meet_comm:{id:"meet_comm",type:"v",doorY:Ye+Nt+rn+66+ot+Nt+rn+20+12,xA:S-2,xB:m.fx+2},exec_meet:{id:"exec_meet",type:"h",doorX:Ye+Ze+40+14,yA:j-2,yB:f.fy+2},work_comm:{id:"work_comm",type:"h",doorX:144+ot/2+Ze+40+14,yA:j-2,yB:m.fy+2}},E={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:f.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:f.fx+60,y:f.fy+56},{x:f.fx+30,y:f.fy+54},{x:f.fx+110,y:f.fy+50},{x:f.fx+80,y:f.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}]},O=[{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"},{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},{id:"exec-shelf",type:"shelf",room:"exec",zone:"wall",offsetX:78,offsetY:18},{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}],B=[{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:p,desks:d,doors:C,adjacency:E,corridorY:A,waypoints:R,wallDecorations:O,furniture:B}}function hE(t){const f={id:"exec",wx:Ye+Ze,wy:Ye,ww:180-Ye-Ze-ot/2,wh:Nt,fx:Ye+Ze,fy:Ye+Nt+rn,fw:180-Ye-Ze-ot/2,fh:82,...nr[0]},m={id:"work",wx:180+ot/2+Ze,wy:Ye,ww:180-ot/2-Ze-Ye,wh:Nt,fx:180+ot/2+Ze,fy:Ye+Nt+rn,fw:180-ot/2-Ze-Ye,fh:82,...nr[1]},p=Ye+Nt+rn+82,d={id:"meet",wx:Ye+Ze,wy:p+ot,ww:180-Ye-Ze-ot/2,wh:Nt,fx:Ye+Ze,fy:p+ot+Nt+rn,fw:180-Ye-Ze-ot/2,fh:86,...nr[2]},g={id:"comm",wx:180+ot/2+Ze,wy:p+ot,ww:180-ot/2-Ze-Ye,wh:Nt,fx:180+ot/2+Ze,fy:p+ot+Nt+rn,fw:180-ot/2-Ze-Ye,fh:86,...nr[3]},y={exec:f,work:m,meet:d,comm:g},b=[];let v=t;const j=[[f,Math.min(5,v)],[m,0]];j[1][1]=Math.min(5,v-j[0][1]);const S=[[d,0],[g,0]];let C=v-j[0][1]-j[1][1];C>0&&(S[0][1]=Math.min(3,C),C-=S[0][1]),C>0&&(S[1][1]=Math.min(3,C));for(const[X,ee]of[...j,...S])ee>0&&b.push(...Nh(X,ee,4));const E=180-ot/2,A={exec_work:{id:"exec_work",type:"v",doorY:f.fy+82/2,xA:E-2,xB:m.fx+2},meet_comm:{id:"meet_comm",type:"v",doorY:d.fy+86/2,xA:E-2,xB:g.fx+2},exec_meet:{id:"exec_meet",type:"h",doorX:f.fx+54,yA:p-2,yB:d.fy+2},work_comm:{id:"work_comm",type:"h",doorX:m.fx+54,yA:p-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"}]},O={exec:f.fy+82-12,work:m.fy+82-12,meet:d.fy+86-12,comm:g.fy+86-12},B={exec:[{x:f.fx+10,y:O.exec},{x:f.fx+f.fw/2,y:O.exec},{x:f.fx+f.fw-10,y:O.exec}],work:[{x:m.fx+10,y:O.work},{x:m.fx+m.fw/2,y:O.work},{x:m.fx+m.fw-10,y:O.work}],meet:[{x:d.fx+10,y:O.meet},{x:d.fx+d.fw/2,y:O.meet},{x:d.fx+d.fw-10,y:O.meet}],comm:[{x:g.fx+10,y:O.comm},{x:g.fx+g.fw/2,y:O.comm},{x:g.fx+g.fw-10,y:O.comm}]},T=[{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"},{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},{id:"exec-shelf",type:"shelf",room:"exec",zone:"wall",offsetX:78,offsetY:18},{id:"exec-window-2",type:"window",room:"exec",zone:"wall",offsetX:104,offsetY:6,windowW:16,windowH:14},{id:"work-whiteboard",type:"whiteboard",room:"work",zone:"wall",offsetX:6,offsetY:4},{id:"work-window-1",type:"window",room:"work",zone:"wall",offsetX:50,offsetY:6,windowW:16,windowH:14},{id:"work-window-2",type:"window",room:"work",zone:"wall",offsetX:92,offsetY:6,windowW:16,windowH:14},{id:"meet-bulletin",type:"bulletin-board",room:"meet",zone:"wall",offsetX:6,offsetY:4,facility:{id:"bulletin",label:"BULLETIN",icon:"📋",color:"#F59E0B",hitW:22,hitH:16}},{id:"meet-picture",type:"picture",room:"meet",zone:"wall",offsetX:28,offsetY:8,pictureColor:"#10B981"},{id:"meet-window",type:"window",room:"meet",zone:"wall",offsetX:80,offsetY:6,windowW:16,windowH:14},{id:"meet-shelf",type:"shelf",room:"meet",zone:"wall",offsetX:102,offsetY:18},{id:"comm-screen",type:"screen",room:"comm",zone:"wall",offsetX:6,offsetY:6,facility:{id:"decisions",label:"DECISIONS",icon:"📜",color:"#EF4444",hitW:16,hitH:12}},{id:"comm-picture",type:"picture",room:"comm",zone:"wall",offsetX:28,offsetY:8,pictureColor:"#d4956a"},{id:"comm-window",type:"window",room:"comm",zone:"wall",offsetX:76,offsetY:6,windowW:16,windowH:14},{id:"comm-clock",type:"clock",room:"comm",zone:"wall",offsetX:98,offsetY:10},{id:"comm-shelf",type:"shelf",room:"comm",zone:"wall",offsetX:108,offsetY:18}],I=[{id:"exec-bookshelf",type:"bookshelf",room:"exec",zone:"floor",offsetX:2,offsetY:4},{id:"exec-plant-r",type:"plant",room:"exec",zone:"floor",anchorX:"right",offsetX:-10,offsetY:4},{id:"exec-plant-c",type:"plant",room:"exec",zone:"floor",offsetX:Math.floor(f.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:O,waypoints:B,wallDecorations:T,furniture:I}}const mE=2;function Cg(t,l){return l?l==="L"&&t<=12-mE?"M":l==="M"&&t>12?"L":l:t<=12?"M":"L"}function Eg(t,l){switch(l??Cg(t)){case"S":return fE(t);case"M":return dE(t);case"L":return hE(t)}}function T0(t,l){if(!l||Object.keys(l).length===0)return t;const r=i=>i.map(c=>{const u=l[c.id];return u?{...c,offsetX:u.offsetX,offsetY:u.offsetY}:c});return{...t,wallDecorations:r(t.wallDecorations),furniture:r(t.furniture)}}function z0(t,l){if(l)for(const[r,i]of Object.entries(l))t[r]&&(t[r]={...t[r],dx:i.dx,dy:i.dy})}function Td(t,l){if(!l||l.length===0)return t;const r=new Set(l);return{...t,wallDecorations:t.wallDecorations.filter(i=>!r.has(i.id)),furniture:t.furniture.filter(i=>!r.has(i.id))}}function M0(t,l){if(!l||l.length===0)return t;const r=[],i=[];for(const c of l)c.zone==="wall"?r.push(c):i.push(c);return{...t,wallDecorations:[...t.wallDecorations,...r],furniture:[...t.furniture,...i]}}let ws;function xE(t){ws=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&&(ws.globalAlpha=u),ws.fillStyle=c,ws.fillRect(t,l,r,i),u!==void 0&&u!==1&&(ws.globalAlpha=1))}function Je(t,l,r,i){L(t,l,1,1,r,i)}let yc=1;function fi(t){yc=t}function Nl(){return yc=yc*16807%2147483647,(yc&65535)/65535}function Ng(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 f=0,m=0;const p=(c+u)/2;if(c!==u){const d=c-u;m=p>.5?d/(2-c-u):d/(c+u),c===l?f=((r-i)/d+(r<i?6:0))/6:c===r?f=((i-l)/d+2)/6:f=((l-r)/d+4)/6}return[f*360,m*100,p*100]}function Ag(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=f=>{const m=(f+t/30)%12;return r-i*Math.max(-1,Math.min(m-3,9-m,1))},u=f=>Math.round(f*255).toString(16).padStart(2,"0");return"#"+u(c(0))+u(c(8))+u(c(4))}function Al(t,l=1){const[r,i,c]=Ng(t);return Ag(r+15*l,Math.min(100,i+8),c-12*l)}function $t(t,l=1){const[r,i,c]=Ng(t);return Ag(r-10*l,i-3,c+10*l)}const ln={hi:"#D4AA5C",base:"#B08040",sh:"#7A5038",deep:"#4E3028"},El={hi:"#8A6848",base:"#604832",sh:"#3A2E24",deep:"#2A1E18"},Sl={hi:"#5A6A80",base:"#485868",sh:"#364858",deep:"#283848"},Ir="#100A06";function pE(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),Je(t+3,l+3,"#8AB8E8",.35),Je(t+c+2,l+3,"#8AB8E8",.25),L(t-1,l+i,r+2,2,"#5A4838"),L(t-1,l+i,r+2,1,$t("#5A4838",.5),.35)}function yE(t,l,r){L(t,l,10,8,"#3A2818"),L(t+1,l+1,8,6,r),L(t+2,l+2,4,3,$t(r,1.2),.3),Je(t+3,l+2,$t(r,2),.25)}function gE(t,l){L(t,l,7,7,"#3A2818"),L(t+1,l+1,5,5,"#F0EDE5"),Je(t+3,l+1,"#AAA"),Je(t+3,l+5,"#AAA"),Je(t+1,l+3,"#AAA"),Je(t+5,l+3,"#AAA"),Je(t+3,l+3,"#222"),L(t+3,l+1,1,2,"#333"),Je(t+4,l+3,"#D32F2F")}function bE(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 vE(t,l){L(t,l,22,16,"#6A5030"),L(t+1,l+1,20,14,"#C4A66A"),fi(88);for(let r=0;r<14;r++)for(let i=0;i<20;i++)Nl()>.5&&Je(t+1+i,l+1+r,Nl()>.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"),Je(t+4,l+2,"#E53935"),Je(t+10,l+2,"#1E88E5"),Je(t+16,l+3,"#FF9800")}function wE(t,l){L(t,l,20,3,"#5A4030"),L(t,l,20,1,$t("#5A4030",.5),.35),L(t,l+2,20,1,Al("#5A4030",.5),.3),L(t+2,l-4,3,4,"#E53935"),L(t+2,l-4,3,1,$t("#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"),Je(t+15,l-3,"#FFF176",.4)}function kE(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),Je(t+2,l+4,"#4CAF50"),L(t+4,l+4,7,1,"#8b949e",.4),Je(t+2,l+6,"#FF9800"),L(t+4,l+6,5,1,"#8b949e",.3),Je(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 SE(t,l,r){L(t+2,l+20,22,2,Ir,.15),L(t,l,22,20,El.deep),L(t+1,l+1,20,18,El.base),L(t,l,22,1,El.hi,.35),L(t,l,1,20,El.hi,.2);for(const u of[6,12])L(t+1,l+u,20,2,El.sh),L(t+1,l+u,20,1,El.hi,.2);const i=["#E53935","#1E88E5","#43A047","#8E24AA","#FB8C00","#00897B","#5C6BC0"];let c=t+2;for(let u=0;u<5;u++){const f=2+u%2;L(c,l+1,f,5,i[u]),L(c,l+1,f,1,$t(i[u],1),.35),c+=f+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,$t(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 jE(t,l){L(t+2,l+11,6,2,Ir,.1),L(t+2,l+8,6,4,"#8B5E3C"),L(t+1,l+7,8,2,Al("#A06E48",.3)),L(t+2,l+7,6,1,$t("#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"),Je(t+4,l,"#81C784"),Je(t+3,l+1,"#A5D6A7",.4)}function CE(t,l){ha(t+4,l-4,"down"),ha(t+16,l-4,"down"),ha(t+28,l-4,"down"),L(t+3,l+24,34,3,Ir,.15),L(t,l+2,36,18,ln.deep),L(t+1,l+3,34,16,ln.base),L(t+1,l+3,34,1,ln.hi,.35);for(let r=0;r<14;r+=3)L(t+1,l+4+r,34,1,Al(ln.base,.2),.08);L(t,l+20,36,4,ln.deep),L(t+1,l+21,34,2,ln.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"),Je(t+16,l+8,"#795548"),ha(t+4,l+24,"up"),ha(t+16,l+24,"up"),ha(t+28,l+24,"up")}function EE(t,l){L(t+2,l+16,36,3,Ir,.15),L(t,l,36,5,"#5D4037"),L(t+1,l+1,34,3,"#6D4C41"),L(t+1,l+1,34,1,$t("#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,$t("#6D4C41",.5),.35),L(t+19,l+6,15,6,"#6D4C41"),L(t+20,l+6,13,1,$t("#6D4C41",.5),.35),L(t+17,l+6,2,6,"#5D4037"),L(t,l+13,36,3,Al("#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,$t("#FF8A65",1),.35)}function NE(t,l){L(t+2,l+10,22,2,Ir,.12),L(t,l,22,8,El.deep),L(t+1,l+1,20,6,El.base),L(t+1,l+1,20,1,El.hi,.3),L(t,l+8,22,2,El.sh),L(t+3,l+2,6,4,"#F0F0F0"),L(t+13,l+3,3,3,"#ECEFF1"),Je(t+14,l+4,"#795548")}function AE(t,l){L(t+1,l+14,10,2,Ir,.12),L(t,l,10,14,"#546E7A"),L(t,l,10,1,$t("#546E7A",1),.35),L(t+1,l+1,8,3,"#78909C"),L(t+1,l+5,8,4,"#37474F"),Je(t+2,l+6,"#EF5350"),Je(t+4,l+6,"#66BB6A"),L(t+2,l+11,4,2,"#ECEFF1")}function DE(t,l){L(t+2,l+16,26,3,Ir,.18),L(t,l,26,10,ln.deep),L(t+1,l+1,24,8,ln.base),L(t+1,l+2,24,1,ln.hi,.2),L(t+1,l+4,24,1,Al(ln.base,.2),.1),L(t+1,l+6,24,1,ln.hi,.15),L(t+1,l+1,24,1,ln.hi,.4),L(t+1,l+1,1,8,ln.hi,.2),L(t,l+10,26,5,ln.deep),L(t+1,l+11,24,3,ln.sh),L(t+1,l+10,24,1,Al(ln.base,1.5),.4),L(t+1,l+14,24,1,ln.base,.15),L(t+2,l+12,10,1,ln.deep,.4),L(t+14,l+12,10,1,ln.deep,.4),Je(t+7,l+11,"#C8D0D8",.6),Je(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),Je(t+7,l-4,"#4A98D8",.25),Je(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++)Je(t+7+r*2,l+5,"#444",.6),Je(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"),Je(t+2,l+5,"#6D4C41")}function ha(t,l,r){L(t+1,l+9,10,2,Ir,.1),Je(t+5,l+9,"#1E1E22"),Je(t+1,l+10,"#1A1A1E"),Je(t+9,l+10,"#1A1A1E"),Je(t+3,l+11,"#1A1A1E"),Je(t+7,l+11,"#1A1A1E"),L(t+1,l+2,8,6,Sl.base),L(t+2,l+3,6,4,Sl.hi,.35),L(t+2,l+3,6,1,$t(Sl.hi,.5),.25),L(t+1,l+7,8,1,Sl.deep),r==="up"?(L(t,l+7,10,3,Sl.deep),L(t+1,l+8,8,1,Sl.sh)):(L(t,l-1,10,3,Sl.deep),L(t+1,l,8,1,Sl.sh)),L(t,l+3,1,4,Sl.sh),L(t+9,l+3,1,4,Sl.sh)}const Dg={bookshelf:(t,l,r)=>SE(t,l,r.accent),plant:(t,l)=>jE(t,l),"meeting-table":(t,l)=>CE(t,l),sofa:(t,l)=>EE(t,l),"coffee-table":(t,l)=>NE(t,l),"coffee-machine":(t,l)=>AE(t,l),window:(t,l,r)=>pE(t,l,r.windowW??16,r.windowH??14),picture:(t,l,r)=>yE(t,l,r.pictureColor??"#1565C0"),clock:(t,l)=>gE(t,l),whiteboard:(t,l)=>bE(t,l),"bulletin-board":(t,l)=>vE(t,l),shelf:(t,l)=>wE(t,l),screen:(t,l)=>kE(t,l)};function oi(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 TE(t){for(const l of t.wallDecorations){const r=t.rooms[l.room];if(!r)continue;const{x:i,y:c}=oi(l,r),u=Dg[l.type];u&&u(i,c,l)}}function zE(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:f}=oi(i,c),m=Dg[i.type];m&&l.push({y:f,draw:()=>m(u,f,i)})}}function Or(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:f}=oi(i,c);l.push({id:i.facility.id,label:i.facility.label,icon:i.facility.icon,color:i.facility.color,dx:u,dy:f,pw:i.facility.hitW,ph:i.facility.hitH})}return l}const ME={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 Pd(t){return ME[t]??{w:16,h:16}}function zd(t,l,r,i){for(let c=t.furniture.length-1;c>=0;c--){const u=t.furniture[c],f=t.rooms[u.room];if(!f||u.condition==="no-desks"&&i.has(u.room))continue;const{x:m,y:p}=oi(u,f),d=Pd(u.type);if(l>=m&&l<=m+d.w&&r>=p&&r<=p+d.h)return u.id}for(let c=t.wallDecorations.length-1;c>=0;c--){const u=t.wallDecorations[c],f=t.rooms[u.room];if(!f)continue;const{x:m,y:p}=oi(u,f),d=Pd(u.type);if(l>=m&&l<=m+d.w&&r>=p&&r<=p+d.h)return u.id}return null}function R0(t,l,r,i,c){const f=[...l.wallDecorations,...l.furniture].find(y=>y.id===r);if(!f||f.condition==="no-desks"&&c.has(f.room))return;const m=l.rooms[f.room];if(!m)return;const{x:p,y:d}=oi(f,m),g=Pd(f.type);t.save(),t.fillStyle=i,t.globalAlpha=.2,t.fillRect(p-1,d-1,g.w+2,g.h+2),t.globalAlpha=.9,t.strokeStyle=i,t.lineWidth=1,t.strokeRect(p-.5,d-.5,g.w+1,g.h+1),t.restore()}function F0(t,l,r,i){t.save(),t.fillStyle=i,t.globalAlpha=.2,t.fillRect(l-1,r-1,28,42),t.globalAlpha=.9,t.strokeStyle=i,t.lineWidth=1,t.strokeRect(l-.5,r-.5,27,41),t.restore()}function _0(t,l,r){for(const[i,c]of Object.entries(t))if(l>=c.dx&&l<=c.dx+26&&r>=c.dy&&r<=c.dy+40)return i;return null}const RE=[{type:"plant",zone:"floor",label:"Plant",icon:"🪴"},{type:"bookshelf",zone:"floor",label:"Bookshelf",icon:"📚"},{type:"sofa",zone:"floor",label:"Sofa",icon:"🛋️"},{type:"coffee-table",zone:"floor",label:"Coffee Table",icon:"☕"},{type:"coffee-machine",zone:"floor",label:"Coffee Machine",icon:"☕"},{type:"meeting-table",zone:"floor",label:"Meeting Table",icon:"🪑"},{type:"window",zone:"wall",label:"Window",icon:"🪟"},{type:"picture",zone:"wall",label:"Picture",icon:"🖼️"},{type:"clock",zone:"wall",label:"Clock",icon:"🕐"},{type:"whiteboard",zone:"wall",label:"Whiteboard",icon:"📋"},{type:"shelf",zone:"wall",label:"Shelf",icon:"📦"},{type:"screen",zone:"wall",label:"Screen",icon:"🖥️"}],fc=16,FE=4,da=4,gc=2,xt=4,Br=4;let Fe=Eg(7);const Dc={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};let ml=Or(Fe);function Tg(t){return{x:t.dx,y:t.dy,w:t.pw,h:t.ph}}function zg(t){return{cx:t.dx+t.pw/2,botY:t.dy+t.ph}}let It={};function _E(t){const l={};for(let r=0;r<t.length&&r<Fe.desks.length;r++)l[t[r]]=Fe.desks[r];return l}let Ft,pa=null,ma=null,tr=!1,xl=null,Gn=null,mn=null,nn=null,li=null,jl=null;function OE(t,l){const{wx:r,wy:i,ww:c,wh:u,wallColor:f,baseboardColor:m}=t,p=Al(f,.5),d=$t(f,.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,f);for(let b=0;b<u;b+=4)L(y.sx,i+b,y.sw,1,d,.08),L(y.sx,i+b+2,y.sw,1,p,.05);fi(Math.round(y.sx*7+i*13));for(let b=0;b<y.sw;b+=3)Nl()>.4&&L(y.sx+b,i,1,u,d,.04);L(y.sx,i,y.sw,2,d,.3),L(y.sx,i,y.sw,1,$t(f,1),.2),L(y.sx,i+u-2,y.sw,2,p,.3),L(y.sx,i+u,y.sw,gc,m),L(y.sx,i+u,y.sw,1,$t(m,.5),.4)}l&&(L(l.x-1,i,1,u+gc,"#4A3828"),L(l.x+l.w,i,1,u+gc,"#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 BE(t){const l="#504038",r=Al(l,.5),i=$t(l,.5),c=t.wx-Br,u=t.wy,f=t.wh+gc+t.fh;L(c,u,Br,f,l),L(c,u,1,f,i,.3),L(c+Br-1,u,1,f,r,.4);for(let p=0;p<f;p+=6)L(c+1,u+p,Br-2,1,i,.06);const m=t.wx+t.ww;L(m,u,Br,f,l),L(m,u,1,f,i,.2),L(m+Br-1,u,1,f,r,.3)}function Md(t){const{fx:l,fy:r,fw:i,fh:c}=t,u="#B08040",f="#C89848",m="#8A6030",p="#6A4820";L(l,r,i,c,u),fi(42);for(let d=0;d<c;d+=5){const g=Math.floor(d/5)%2*10;for(let y=-10;y<i+10;y+=20){const b=l+y+g,v=Math.max(l,b),j=Math.min(b+19,l+i)-v;if(j<=0)continue;const S=Nl()>.5?f:u;L(v,r+d,j,4,S,.25),L(v,r+d,j,1,f,.3),L(v,r+d+4,j,1,p,.35),b>=l&&b<l+i&&L(b,r+d,1,4,p,.2),L(v,r+d+2,j,1,m,.1)}}L(l,r,i,2,"#0A0808",.08),L(l,r,2,c,"#0A0808",.06)}function O0(t){const{fx:l,fy:r,fw:i,fh:c}=t,u="#1C2A38",f="#101820";fi(99),L(l,r,i,c,u);for(let m=0;m<c;m+=fc)for(let p=0;p<i;p+=fc){const d=Math.min(fc,i-p),g=Math.min(fc,c-m);Nl()>.5&&L(l+p,r+m,d,g,$t(u,.2),.15),L(l+p+2,r+m+2,d-4,g-4,$t(u,.3),.08),L(l+p,r+m,d,1,f,.5),L(l+p,r+m,1,g,f,.5),L(l+p+1,r+m+1,1,g-1,$t(u,.4),.1),Nl()>.85&&Je(l+p+4+Math.floor(Nl()*8),r+m+4+Math.floor(Nl()*8),"#3A6A9A",.08)}}function LE(t){const{fx:l,fy:r,fw:i,fh:c}=t,u="#387848",f="#4A9058",m="#285E38";L(l,r,i,c,u),fi(77);for(let d=0;d<c;d+=2)for(let g=0;g<i;g+=2)Nl()>.5&&Je(l+g,r+d,f,.1),Nl()>.8&&Je(l+g+1,r+d+1,m,.12);const p=5;L(l+p,r+p,i-p*2,1,f,.45),L(l+p,r+c-p-1,i-p*2,1,m,.45),L(l+p,r+p,1,c-p*2,f,.35),L(l+i-p-1,r+p,1,c-p*2,m,.35)}function $E(t){const{fx:l,fy:r,fw:i,fh:c}=t,u="#D8C490",f="#B09060",m="#907848";fi(55);for(let p=0;p<c;p+=8)for(let d=0;d<i;d+=8){const g=Math.min(8,i-d),y=Math.min(8,c-p),b=(d/8+p/8)%2===0?f:u;L(l+d,r+p,g,y,b),L(l+d+1,r+p+1,g-2,1,$t(b,.4),.2),L(l+d+1,r+p+1,1,y-2,$t(b,.4),.15),L(l+d+g-2,r+p+2,1,y-3,Al(b,.4),.15),L(l+d+2,r+p+y-2,g-3,1,Al(b,.4),.15),L(l+d,r+p,g,1,m,.3),L(l+d,r+p,1,y,m,.3)}}function HE(){const{canvasW:t,canvasH:l,rooms:r,doors:i}=Fe,c="#2A1E14",u="#3A2E24";if(L(0,0,t,da,c),L(0,l-da,t,da,c),L(0,0,da,l,c),L(t-da,0,da,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 f=r.exec,m=r.meet,p=t/2,d=p-xt/2,g=f.fy+f.fh,y=i.exec_work,b=i.meet_comm,v=i.exec_meet,j=i.work_comm,S=24,C=28,E=((y==null?void 0:y.doorY)??f.fy+20)-S/2,A=((v==null?void 0:v.doorX)??da+Br+54)-C/2,R=((j==null?void 0:j.doorX)??p+xt/2+Br+54)-C/2,O=((b==null?void 0:b.doorY)??m.fy+20)-S/2;L(0,g,A,xt,c),L(A+C,g,d-A-C,xt,c),L(d+xt,g,R-d-xt,xt,c),L(R+C,g,t-R-C,xt,c),L(0,g,A,1,u,.3),L(A+C,g,d-A-C,1,u,.3),L(d+xt,g,R-d-xt,1,u,.3),L(R+C,g,t-R-C,1,u,.3),L(d,0,xt,E,c),L(d,E+S,xt,g-E-S,c),L(d,g+xt,xt,O-g-xt,c),L(d,O+S,xt,l-O-S,c),L(d,0,1,E,u,.2),L(d,E+S,1,g-E-S,u,.2),L(d,g+xt,1,O-g-xt,u,.2),L(d,O+S,1,l-O-S,u,.2),L(d,E,xt,S,"#C4A070"),L(d+xt/2,E,xt/2,S,"#3A4858"),L(d,O,xt,S,"#7AA880"),L(d+xt/2,O,xt/2,S,"#C8B890");const B="#4A3828";L(d,E-1,xt,1,B),L(d,E+S,xt,1,B),L(A-1,g,1,xt,B),L(A+C,g,1,xt,B),L(R-1,g,1,xt,B),L(R+C,g,1,xt,B),L(d,O-1,xt,1,B),L(d,O+S,xt,1,B)}const B0=new Map;function UE(t){const l=`${t.hairStyle??""}|${t.outfitStyle??""}|${t.accessory??""}`;let r=B0.get(l);if(!r){const i=Kd("mini-seated:default"),c=ig(i,t);r=c?c.layers.flatMap(u=>u.pixels):[],B0.set(l,r)}return r}function IE(t,l,r){Qd(Ft,UE(r),t,l,r)}function YE(t,l,r,i,c){ha(t+8,l+20,"up"),c||IE(t+8,l+0+i,r),DE(t,l+14)}function qE(t,l,r,i,c){const u=i in D0?i:"down",f=c%4,m=D0[u][f];Qd(Ft,m,t,l,r);const p=f===1||f===3?-1:0;if(r.accessory&&r.accessory!=="none"){const d=FS(r.accessory,u);d&&d.pixels.length>0&&Qd(Ft,d.pixels,t,l+p,r)}Ft.globalAlpha=1}function XE(t){const l={};let r=0;for(const i of t){const c=It[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 Es(t,l,r,i,c){const u=Fe.corridorY[c]??l,f=[];return l<u-4&&f.push({x:t,y:u}),Math.abs(t-r)>4&&f.push({x:r,y:u}),f.push({x:r,y:i}),f}function Rd(t,l,r,i){const c=Fe.adjacency[r];if(!c)return[];const u=c.find(g=>g.room===i);if(!u)return[];const f=Fe.doors[u.door];if(!f)return[];const m=[],p=Fe.corridorY[r]??l,d=Fe.corridorY[i]??l;if(Math.abs(l-p)>4&&m.push({x:t,y:p}),f.type==="v"){const g=u.side==="A"?f.xA:f.xB,y=u.side==="A"?f.xB:f.xA;m.push({x:g,y:p}),m.push({x:g,y:f.doorY}),m.push({x:y,y:f.doorY}),m.push({x:y,y:d})}else{const g=u.side==="A"?f.yA:f.yB,y=u.side==="A"?f.yB:f.yA;m.push({x:f.doorX,y:p}),m.push({x:f.doorX,y:g}),m.push({x:f.doorX,y}),m.push({x:f.doorX,y:d})}return m}function Mg(t,l){const r=Fe.adjacency[t.room];if(!r)return[];if(!r.find(c=>c.room===l)){for(const c of r){const u=Fe.adjacency[c.room];if(u!=null&&u.find(f=>f.room===l)){const f=Rd(t.x,t.y,t.room,c.room),m=f[f.length-1],p=Rd((m==null?void 0:m.x)??t.x,(m==null?void 0:m.y)??t.y,c.room,l);return[...f,...p]}}return[]}return Rd(t.x,t.y,t.room,l)}function VE(t){if(t.room!==t.homeRoom){const l=Mg({...t},t.homeRoom),r=l[l.length-1],i=Es((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 Es(t.x,t.y,t.homeX,t.homeY,t.room)}function GE(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(Fe.rooms);if(Math.random()<.25&&i.length>1){const c=i.filter(p=>p!==r.room),u=c[Math.floor(Math.random()*c.length)],f=Mg(r,u),m=Fe.waypoints[u];if(m&&m.length>0){const p=m[Math.floor(Math.random()*m.length)],d=f[f.length-1]??{x:r.x,y:r.y},g=Es(d.x,d.y,p.x,p.y,u);r.path=[...f,...g]}else r.path=f;r.walkTimer=0}else{const c=Fe.waypoints[r.room];if(c&&c.length>0){const u=c[Math.floor(Math.random()*c.length)];r.path=Es(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,f=Math.sqrt(c*c+u*u);if(f<1.5){r.x=i.x,r.y=i.y,r.path.shift();for(const[m,p]of Object.entries(Fe.rooms))if(r.x>=p.fx&&r.x<=p.fx+p.fw&&r.y>=p.fy&&r.y<=p.fy+p.fh){r.room=m;break}}else r.x+=c/f*.2,r.y+=u/f*.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=Fe.waypoints[r.room];if(i&&i.length>0){const c=i[Math.floor(Math.random()*i.length)];r.path=Es(r.x,r.y,c.x,c.y,r.room)}r.walkTimer=0}else r.state="returning",r.path=VE(r),r.walkTimer=0}function KE(t,l,r){const{canvasW:i,canvasH:c,rooms:u}=Fe;Ft.clearRect(0,0,i,c),L(0,0,i,c,"#2A1E14");const f={wood:Md,dark:O0,carpet:LE,tile:$E};for(const y of Object.values(u))(f[y.floorType]??Md)(y);const m=Object.keys(u);if(m.length>=4){const y=u.exec,b=u.meet,{doors:v}=Fe;if(y&&b&&v.exec_meet&&v.work_comm){const S=(v.exec_meet.doorX??0)-14,C=(v.work_comm.doorX??0)-28/2,E=y.fy+y.fh,A=b.fy;Md({fx:S,fy:E,fw:28,fh:A-E}),O0({fx:C,fy:E,fw:28,fh:A-E})}}const p={};if(m.length>=4){const{doors:y}=Fe,b=28,v=y.exec_meet,j=y.work_comm;v!=null&&v.doorX&&(p.meet={x:v.doorX-b/2,w:b}),j!=null&&j.doorX&&(p.comm={x:j.doorX-b/2,w:b})}for(const y of Object.values(u))OE(y,p[y.id]),BE(y);HE(),TE(Fe);const d=[],g=new Set(Object.values(It).map(y=>y.room));zE(Fe,d,g);for(const[y,b]of Object.entries(It)){const v=t[y];if(!v)continue;const j=v.state==="sitting",S=l(y),C=r[y]==="working";d.push({y:b.dy+14,draw:()=>{if(YE(b.dx,b.dy,S,j?v.bobY:0,!j),j&&C){const E=Dc[y]??"#388bfd";L(b.dx+7,b.dy+14-4,12,5,E,.15),Je(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);d.push({y:b.y+14,draw:()=>qE(Math.round(b.x),Math.round(b.y),v,b.dir,b.walkFrame)})}d.sort((y,b)=>y.y-b.y);for(const y of d)y.draw();for(const y of ml){const b=ma===y.id,v=zg(y);if(Ft.save(),Ft.globalAlpha=b?.9:.5,Ft.fillStyle=y.color,Ft.fillRect(v.cx-1,v.botY-2,3,3),b){const j=Tg(y);Ft.globalAlpha=.3,Ft.strokeStyle=y.color,Ft.lineWidth=1,Ft.strokeRect(j.x-1,j.y-1,j.w+2,j.h+2)}Ft.restore()}if(tr){const y=new Set(Object.values(It).map(b=>b.room));if(xl&&xl!==Gn)if(xl.startsWith("desk:")){const b=xl.slice(5),v=It[b];v&&F0(Ft,v.dx,v.dy,"#FBBF24")}else R0(Ft,Fe,xl,"#FBBF24",y);if(Gn)if(Gn.startsWith("desk:")){const b=Gn.slice(5),v=It[b];v&&F0(Ft,v.dx,v.dy,"#3B82F6")}else R0(Ft,Fe,Gn,"#3B82F6",y)}if(pa){const y=It[pa],b=t[pa];y&&b&&(Ft.save(),Ft.globalAlpha=.25,Ft.fillStyle=Dc[pa]??"#fff",b.state==="sitting"?Ft.fillRect(y.dx-1,y.dy+6,28,30):Ft.fillRect(Math.round(b.x)-1,Math.round(b.y)-1,14,24),Ft.restore())}}function QE({roles:t,projects:l,roleStatuses:r,activeExecs:i,onRoleClick:c,onProjectClick:u,onBulletinClick:f,onDecisionsClick:m,onKnowledgeClick:p,getRoleSpeech:d,getAppearance:g,onHireClick:y}){const b=k.useRef(null),v=k.useRef(null),j=k.useRef(null),S=k.useRef({}),C=k.useRef(0),E=k.useRef(FE),[A,R]=k.useState(!1),[O,B]=k.useState(null),[T,I]=k.useState(null),X=k.useRef({}),ee=k.useRef({}),z=k.useRef([]),$=k.useRef([]);k.useEffect(()=>{tr=A},[A]),k.useEffect(()=>{li=O,jl=T},[O,T]),k.useEffect(()=>{Ee.getPreferences().then(oe=>{const K=oe.furnitureOverrides;K&&Object.keys(K).length>0&&(X.current=K,Fe=T0(Fe,K));const fe=oe.deskOverrides;if(fe&&Object.keys(fe).length>0){ee.current=fe,z0(It,fe);for(const[ke,je]of Object.entries(It)){const Te=S.current[ke];Te&&(Te.homeX=je.dx+8,Te.homeY=je.dy+34)}}const Se=oe.removedFurniture;Se&&Se.length>0&&(z.current=Se,Fe=Td(Fe,Se));const te=oe.addedFurniture;te&&te.length>0&&($.current=te,Fe=M0(Fe,te)),ml=Or(Fe)}).catch(()=>{})},[]);const U=k.useRef({roleStatuses:r,activeExecs:i,getRoleSpeech:d,getAppearance:g});U.current={roleStatuses:r,activeExecs:i,getRoleSpeech:d,getAppearance:g};const ne=k.useMemo(()=>t.map(oe=>oe.id),[t]),re=k.useRef(Fe);k.useEffect(()=>{const oe=ne.length,K=Cg(oe,re.current.preset);let fe=Eg(oe,K);z.current.length>0&&(fe=Td(fe,z.current)),$.current.length>0&&(fe=M0(fe,$.current)),Object.keys(X.current).length>0&&(fe=T0(fe,X.current)),Fe=fe,re.current=fe,It=_E(ne),Object.keys(ee.current).length>0&&z0(It,ee.current),ml=Or(fe),S.current=XE(ne);const Se=b.current;Se&&(Se.width=fe.canvasW,Se.height=fe.canvasH),Y()},[ne]);const V=k.useCallback(oe=>{var K,fe;return((fe=(K=U.current).getAppearance)==null?void 0:fe.call(K,oe))??Ch(oe)},[]),Y=k.useCallback(()=>{const oe=v.current,K=b.current;if(!oe||!K)return;const fe=oe.parentElement;if(!fe)return;const Se=fe.clientWidth,te=fe.clientHeight;if(Se===0||te===0)return;const{canvasW:ke,canvasH:je}=Fe;let Te=Math.floor(Math.min(Se/ke,te/je));Te=Math.max(2,Math.min(Te,5)),E.current=Te,K.style.width=ke*Te+"px",K.style.height=je*Te+"px",oe.style.width=ke*Te+"px",oe.style.height=je*Te+"px"},[]);k.useEffect(()=>{var je;const oe=b.current;if(!oe)return;const K=oe.getContext("2d");if(!K)return;Ft=K,xE(K),Y();const fe=new ResizeObserver(()=>Y()),Se=(je=v.current)==null?void 0:je.parentElement;Se&&fe.observe(Se);let te;const ke=()=>{C.current++,GE(S.current,C.current),KE(S.current,V,U.current.roleStatuses),Q(),te=requestAnimationFrame(ke)};return te=requestAnimationFrame(ke),()=>{cancelAnimationFrame(te),fe.disconnect()}},[V,Y]),k.useEffect(()=>{const oe=j.current;if(!oe)return;oe.innerHTML="";for(const fe of ne){const Se=Dc[fe]??"#8b949e",te=document.createElement("div");te.className="td-nametag",te.dataset.role=fe;const ke=document.createElement("span");ke.className="td-dot",ke.style.background=Se,te.appendChild(ke),te.appendChild(document.createTextNode(fe.toUpperCase())),oe.appendChild(te);const je=document.createElement("div");je.className="td-bubble",je.dataset.role=fe,je.dataset.type="bubble",oe.appendChild(je)}const K={meeting:()=>{const fe=l[0];fe?u(fe.id):f()},bulletin:f,decisions:m,knowledge:p};for(const fe of ml){const Se=document.createElement("div");Se.className="td-facility-label",Se.dataset.facility=fe.id,Se.textContent=`${fe.icon} ${fe.label}`,Se.style.borderColor=`${fe.color}44`;const te=K[fe.id];te&&Se.addEventListener("click",te),Se.addEventListener("mouseenter",()=>{ma=fe.id}),Se.addEventListener("mouseleave",()=>{ma=null}),oe.appendChild(Se)}},[ne,l,u,f,m,p]);const Q=k.useCallback(()=>{var je;const oe=j.current;if(!oe)return;const K=E.current,fe=S.current,{getRoleSpeech:Se,roleStatuses:te,activeExecs:ke}=U.current;for(const Te of Object.keys(fe)){const Le=fe[Te],$e=It[Te];if(!$e)continue;let Yt,pt,St;Le.state==="sitting"?(Yt=$e.dx+13,St=$e.dy+2,pt=$e.dy+37):(Yt=Math.round(Le.x)+6,St=Math.round(Le.y)-2,pt=Math.round(Le.y)+18);const Bt=Yt/Fe.canvasW*100,Kt=oe.querySelector(`.td-nametag[data-role="${Te}"]`);if(Kt){Kt.style.left=Bt+"%",Kt.style.top=pt*K+2+"px";const qt=Kt.querySelector(".td-dot");if(qt){const ae=te[Te]==="working";qt.style.background=ae?"#FBBF24":Dc[Te]??"#8b949e",ae?qt.style.animation="td-pulse 1s ease-in-out infinite":qt.style.animation=""}}const vt=oe.querySelector(`.td-bubble[data-role="${Te}"]`);if(vt){const qt=te[Te]==="working",ae=(je=ke.find(qe=>qe.roleId===Te))==null?void 0:je.task,ye=Se(Te),Re=qt&&ae?ae.slice(0,30):ye?ye.slice(0,30):"";Re&&Le.state==="sitting"?(vt.style.display="",vt.style.left=Bt+"%",vt.style.top=(St-5)*K+"px",vt.textContent=Re):vt.style.display="none"}}for(const Te of ml){const Le=oe.querySelector(`.td-facility-label[data-facility="${Te.id}"]`);if(Le){const $e=zg(Te);Le.style.left=$e.cx/Fe.canvasW*100+"%",Le.style.top=$e.botY*K+2+"px",Le.classList.toggle("td-facility-label--hover",ma===Te.id)}}},[]),se=k.useCallback(oe=>{const K=b.current;if(!K)return null;const fe=K.getBoundingClientRect(),Se=E.current,te=(oe.clientX-fe.left)/Se,ke=(oe.clientY-fe.top)/Se,je=S.current;for(const[Te,Le]of Object.entries(It)){if(!je[Te])continue;const $e=je[Te];if($e.state==="sitting"){if(te>=Le.dx&&te<=Le.dx+26&&ke>=Le.dy&&ke<=Le.dy+40)return{type:"role",id:Te}}else if(te>=$e.x-2&&te<=$e.x+14&&ke>=$e.y-2&&ke<=$e.y+20)return{type:"role",id:Te}}for(const Te of ml){const Le=Tg(Te);if(te>=Le.x&&te<=Le.x+Le.w&&ke>=Le.y&&ke<=Le.y+Le.h)return{type:"facility",id:Te.id}}return null},[]),ve=k.useCallback(oe=>{const K=b.current;if(!K)return{mx:0,my:0};const fe=K.getBoundingClientRect(),Se=E.current;return{mx:(oe.clientX-fe.left)/Se,my:(oe.clientY-fe.top)/Se}},[]),M=k.useCallback(oe=>{Ee.updatePreferences(oe).catch(()=>{})},[]),_=k.useCallback(oe=>{const K=[...z.current,oe];z.current=K,Fe=Td(Fe,[oe]),ml=Or(Fe),Gn=null,xl=null,M({removedFurniture:K})},[M]),J=k.useCallback((oe,K)=>{if(!li||!jl)return;let fe=null;for(const[Le,$e]of Object.entries(Fe.rooms)){const Yt=jl==="wall"?$e.wx:$e.fx,pt=jl==="wall"?$e.wy:$e.fy,St=jl==="wall"?$e.ww:$e.fw,Bt=jl==="wall"?$e.wh:$e.fh;if(oe>=Yt&&oe<=Yt+St&&K>=pt&&K<=pt+Bt){fe=Le;break}}if(!fe)return;const Se=Fe.rooms[fe],te=jl==="wall"?Se.wx:Se.fx,ke=jl==="wall"?Se.wy:Se.fy,je={id:`user-${li}-${Date.now()}`,type:li,room:fe,zone:jl,offsetX:Math.round(oe-te),offsetY:Math.round(K-ke)},Te=[...$.current,je];$.current=Te,jl==="wall"?Fe.wallDecorations.push(je):Fe.furniture.push(je),ml=Or(Fe),M({addedFurniture:Te}),B(null),I(null)},[M]),D=k.useCallback(oe=>{const K=b.current;if(tr&&mn){const{mx:Se,my:te}=ve(oe),je=[...Fe.furniture,...Fe.wallDecorations].find($e=>$e.id===mn.defId);if(!je)return;const Te=Se-mn.startMx,Le=te-mn.startMy;je.offsetX=Math.round(mn.origOffX+Te),je.offsetY=Math.round(mn.origOffY+Le),ml=Or(Fe),K&&(K.style.cursor="grabbing");return}if(tr&&nn){const{mx:Se,my:te}=ve(oe),ke=It[nn.roleId];if(!ke)return;ke.dx=Math.round(nn.origDx+(Se-nn.startMx)),ke.dy=Math.round(nn.origDy+(te-nn.startMy));const je=S.current[nn.roleId];je&&(je.homeX=ke.dx+8,je.homeY=ke.dy+34),K&&(K.style.cursor="grabbing");return}if(tr){const{mx:Se,my:te}=ve(oe);if(li){K&&(K.style.cursor="crosshair");return}const ke=new Set(Object.values(It).map(Te=>Te.room)),je=zd(Fe,Se,te,ke);if(je)xl=je;else{const Te=_0(It,Se,te);xl=Te?`desk:${Te}`:null}pa=null,ma=null,K&&(K.style.cursor=xl?"grab":"default");return}const fe=se(oe);pa=(fe==null?void 0:fe.type)==="role"?fe.id:null,ma=(fe==null?void 0:fe.type)==="facility"?fe.id:null,xl=null,K&&(K.style.cursor=fe?"pointer":"default")},[se,ve]),pe=k.useCallback(oe=>{if(!tr)return;const{mx:K,my:fe}=ve(oe);if(li){J(K,fe),oe.preventDefault();return}const Se=new Set(Object.values(It).map(je=>je.room)),te=zd(Fe,K,fe,Se);if(te){const Te=[...Fe.furniture,...Fe.wallDecorations].find(Le=>Le.id===te);Te&&(Gn=te,mn={defId:te,startMx:K,startMy:fe,origOffX:Te.offsetX,origOffY:Te.offsetY},oe.preventDefault());return}const ke=_0(It,K,fe);if(ke){const je=It[ke];Gn=`desk:${ke}`,nn={roleId:ke,startMx:K,startMy:fe,origDx:je.dx,origDy:je.dy},oe.preventDefault();return}Gn=null},[ve,J]),Ce=k.useCallback(oe=>{if(mn){const fe=[...Fe.furniture,...Fe.wallDecorations].find(Se=>Se.id===mn.defId);if(fe){const Se={...X.current,[fe.id]:{offsetX:fe.offsetX,offsetY:fe.offsetY}};X.current=Se,M({furnitureOverrides:Se}),ml=Or(Fe)}mn=null,b.current&&(b.current.style.cursor="grab");return}if(nn){const K=It[nn.roleId];if(K){const fe={...ee.current,[nn.roleId]:{dx:K.dx,dy:K.dy}};ee.current=fe,M({deskOverrides:fe})}nn=null,b.current&&(b.current.style.cursor="grab")}},[M]),Ne=k.useCallback(oe=>{if(!tr)return;oe.preventDefault();const{mx:K,my:fe}=ve(oe),Se=new Set(Object.values(It).map(ke=>ke.room)),te=zd(Fe,K,fe,Se);te&&_(te)},[ve,_]);k.useEffect(()=>{const oe=K=>{!tr||!Gn||(K.key==="Delete"||K.key==="Backspace")&&(Gn.startsWith("desk:")||_(Gn))};return window.addEventListener("keydown",oe),()=>window.removeEventListener("keydown",oe)},[_]);const He=k.useCallback(()=>{if(mn){const K=[...Fe.furniture,...Fe.wallDecorations].find(fe=>fe.id===mn.defId);K&&(K.offsetX=mn.origOffX,K.offsetY=mn.origOffY,ml=Or(Fe)),mn=null}if(nn){const oe=It[nn.roleId];oe&&(oe.dx=nn.origDx,oe.dy=nn.origDy);const K=S.current[nn.roleId];K&&(K.homeX=oe.dx+8,K.homeY=oe.dy+34),nn=null}pa=null,ma=null,xl=null,b.current&&(b.current.style.cursor="default")},[]),_e=k.useCallback(oe=>{if(tr)return;const K=se(oe);if(K){if(K.type==="role"){c(K.id);return}switch(K.id){case"meeting":{const fe=l[0];fe?u(fe.id):f();break}case"bulletin":f();break;case"decisions":m();break;case"knowledge":p();break}}},[se,c,u,f,m,p]);return o.jsxs("div",{className:`td-scene${A?" td-scene--editing":""}`,children:[o.jsxs("div",{ref:v,className:"td-wrap",children:[o.jsx("canvas",{ref:b,width:Fe.canvasW,height:Fe.canvasH,className:"td-canvas",onClick:_e,onMouseDown:pe,onMouseUp:Ce,onMouseMove:D,onMouseLeave:He,onContextMenu:Ne}),o.jsx("div",{ref:j,className:"td-overlay"})]}),A&&o.jsxs("div",{className:"td-edit-banner",children:[o.jsx("span",{className:"td-edit-banner__icon",children:"✎"})," EDIT MODE — Click DONE when finished"]}),o.jsxs("button",{className:`td-edit-btn${A?" td-edit-btn--active":""}`,onClick:()=>{R(oe=>{const K=!oe;return K||(B(null),I(null)),K}),Gn=null,mn=null,nn=null},title:A?"Exit Edit Mode":"Edit Furniture Layout",children:[o.jsx("span",{className:"td-edit-btn__icon",children:A?"✓":"✎"}),o.jsx("span",{className:"td-edit-btn__label",children:A?"DONE":"EDIT"})]}),A&&o.jsx("div",{className:"td-palette",children:RE.map(oe=>o.jsx("button",{className:`td-palette__item${O===oe.type?" td-palette__item--active":""}`,onClick:()=>{O===oe.type?(B(null),I(null)):(B(oe.type),I(oe.zone))},title:oe.label,children:o.jsx("span",{children:oe.icon})},oe.type))}),y&&o.jsxs("button",{className:"td-hire-btn",onClick:y,title:"Hire New Role",children:[o.jsx("span",{className:"td-hire-btn__icon",children:"+"}),o.jsx("span",{className:"td-hire-btn__label",children:"HIRE"})]})]})}function WE({role:t,appearance:l,onSave:r,onReset:i,onClose:c,theme:u,onThemeChange:f,onUpdateName:m,initialTab:p,speechSettings:d,onSpeechSettingsChange:g,language:y,onLanguageChange:b,roleLevel:v}){var z;const[j,S]=k.useState(p??"character"),[C,E]=k.useState({...l}),[A,R]=k.useState(t.name),[O,B]=k.useState(!1),T=k.useCallback(()=>E(vs(v)),[v]),I=k.useCallback(()=>{const $=Ch(t.id);E({...$}),i()},[t.id,i]),X=k.useCallback(async()=>{r(C);const $=A.trim();if(m&&$&&$!==t.name){B(!0);try{await m(t.id,$)}catch{}B(!1)}c()},[C,r,c,A,t.name,t.id,m]),ee=o.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6},children:[o.jsxs("span",{children:[t.id.toUpperCase()," –"]}),m?o.jsx("input",{value:A,onChange:$=>R($.target.value),disabled:O,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}}):o.jsx("span",{children:t.name})]});return o.jsx("div",{className:"customize-overlay",onClick:c,children:o.jsxs("div",{className:"customize-modal",onClick:$=>$.stopPropagation(),children:[o.jsxs("div",{className:"customize-header",children:[o.jsxs("div",{className:"customize-tabs",children:[o.jsx("button",{className:`customize-tab ${j==="character"?"active":""}`,onClick:()=>S("character"),children:"CHARACTER"}),o.jsx("button",{className:`customize-tab ${j==="office"?"active":""}`,onClick:()=>S("office"),children:"OFFICE THEME"}),o.jsx("button",{className:`customize-tab ${j==="settings"?"active":""}`,onClick:()=>S("settings"),children:"SETTINGS"})]}),o.jsx("button",{className:"customize-close",onClick:c,children:"X"})]}),j==="character"?o.jsx("div",{className:"customize-body",children:o.jsx(bg,{roleId:t.id,appearance:C,onChange:E,onRandomize:T,onReset:I,label:ee,roleLevel:v})}):j==="office"?o.jsx("div",{className:"customize-body",children:o.jsx("div",{className:"customize-themes",children:Object.entries($r).map(([$,U])=>o.jsxs("button",{className:`customize-theme-card ${u===$?"active":""}`,onClick:()=>f($),children:[o.jsxs("div",{className:"customize-theme-preview",style:{background:U.vars["--floor-light"],borderColor:U.vars["--pixel-border"]},children:[o.jsx("div",{style:{background:U.vars["--hud-bg"],height:8,borderBottom:`2px solid ${U.vars["--pixel-border"]}`}}),o.jsxs("div",{className:"flex-1 flex items-center justify-center gap-1 p-1",children:[o.jsx("div",{style:{width:10,height:14,background:U.vars["--accent"],borderRadius:1}}),o.jsx("div",{style:{width:10,height:14,background:U.vars["--active-green"],borderRadius:1}}),o.jsx("div",{style:{width:10,height:14,background:U.vars["--idle-amber"],borderRadius:1}})]}),o.jsx("div",{style:{background:U.vars["--hud-bg"],height:6,borderTop:`2px solid ${U.vars["--pixel-border"]}`}})]}),o.jsxs("div",{className:"customize-theme-name",children:[U.icon," ",U.name]})]},$))})}):o.jsx("div",{className:"customize-body",children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20,padding:"8px 0"},children:[o.jsxs("div",{children:[o.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"AMBIENT SPEECH MODE"}),o.jsx("div",{style:{display:"flex",gap:6},children:["template","llm","auto"].map($=>o.jsxs("button",{onClick:()=>g==null?void 0:g({mode:$}),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(d==null?void 0:d.mode)===$?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(d==null?void 0:d.mode)===$?"rgba(255,255,255,0.08)":"transparent",color:(d==null?void 0:d.mode)===$?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center"},children:[o.jsx("div",{style:{fontWeight:600,marginBottom:2},children:$==="template"?"TEMPLATE":$==="llm"?"AI":"AUTO"}),o.jsx("div",{style:{fontSize:9,opacity:.7},children:$==="template"?"Static pool ($0)":$==="llm"?"LLM generated":"Detect engine"})]},$))}),o.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Auto: CLI Max = AI, BYOK = Template"})]}),o.jsxs("div",{children:[o.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["SPEECH INTERVAL: ",(d==null?void 0:d.intervalSec)??18,"s"]}),o.jsx("input",{type:"range",min:5,max:120,step:5,value:(d==null?void 0:d.intervalSec)??18,onChange:$=>g==null?void 0:g({intervalSec:Number($.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[o.jsx("span",{children:"5s (frequent)"}),o.jsx("span",{children:"120s (rare)"})]})]}),(d==null?void 0:d.mode)!=="template"&&o.jsxs("div",{children:[o.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["DAILY LLM BUDGET: $",((z=d==null?void 0:d.dailyBudgetUsd)==null?void 0:z.toFixed(2))??"1.00"]}),o.jsx("input",{type:"range",min:0,max:5,step:.25,value:(d==null?void 0:d.dailyBudgetUsd)??1,onChange:$=>g==null?void 0:g({dailyBudgetUsd:Number($.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[o.jsx("span",{children:"$0 (unlimited)"}),o.jsx("span",{children:"$5.00/day"})]})]}),o.jsxs("div",{children:[o.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"LANGUAGE"}),o.jsx("div",{style:{display:"flex",gap:6},children:[{key:"auto",label:"Auto"},{key:"en",label:"English"},{key:"ko",label:"한국어"},{key:"ja",label:"日本語"}].map(({key:$,label:U})=>o.jsx("button",{onClick:()=>b==null?void 0:b($),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(y??"auto")===$?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(y??"auto")===$?"rgba(255,255,255,0.08)":"transparent",color:(y??"auto")===$?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center",fontWeight:600},children:U},$))}),o.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Sets language for AI responses and speech bubbles"})]})]})}),j==="character"&&o.jsxs("div",{className:"customize-footer",children:[o.jsx("button",{className:"customize-btn customize-btn--cancel",onClick:c,children:"CANCEL"}),o.jsx("button",{className:"customize-btn customize-btn--save",onClick:X,children:"SAVE"})]})]})})}function L0(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 ZE({status:t,history:l,onClose:r,onSave:i,onLoadHistory:c,onRestore:u,saving:f}){const[m,p]=k.useState("save"),[d,g]=k.useState(""),[y,b]=k.useState(null),[v,j]=k.useState(!1),[S,C]=k.useState(null),E=k.useRef(null);k.useEffect(()=>{m==="history"&&c()},[m,c]),k.useEffect(()=>{var T;(T=E.current)==null||T.focus()},[]);const A=[...((t==null?void 0:t.modified)??[]).map(T=>({status:"M",file:T})),...((t==null?void 0:t.untracked)??[]).map(T=>({status:"A",file:T}))],R=async()=>{b(null),C(null);try{const T=await i(d||void 0);C(T),g("")}catch(T){b(T instanceof Error?T.message:"Save failed")}},O=async T=>{if(confirm(`Restore from commit ${T.slice(0,7)}? This creates a new commit with those files.`)){j(!0);try{await u(T),j(!1)}catch(I){b(I instanceof Error?I.message:"Restore failed"),j(!1)}}};k.useEffect(()=>{const T=I=>{I.key==="Escape"&&r()};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[r]);const B=T=>{T.key==="Enter"&&(T.metaKey||T.ctrlKey)&&R()};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:r}),o.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:B,children:[o.jsxs("div",{className:"px-5 py-3 flex items-center justify-between shrink-0",style:{borderBottom:"2px solid var(--pixel-border)"},children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"text-lg font-black tracking-tight",children:"SAVE GAME"}),o.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-secondary)"},children:(t==null?void 0:t.branch)??""})]}),o.jsx("button",{onClick:r,className:"text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)] cursor-pointer text-lg",children:"×"})]}),o.jsx("div",{className:"flex shrink-0",style:{borderBottom:"2px solid var(--pixel-border)"},children:["save","history"].map(T=>o.jsx("button",{onClick:()=>p(T),className:"flex-1 py-2 text-[11px] font-bold uppercase tracking-wider cursor-pointer",style:{background:m===T?"var(--hud-bg-alt)":"transparent",color:m===T?"var(--terminal-text)":"var(--terminal-text-muted)",borderBottom:m===T?"2px solid var(--accent)":"2px solid transparent"},children:T==="save"?"SAVE":"HISTORY"},T))}),o.jsxs("div",{className:"flex-1 overflow-y-auto p-5 space-y-4",children:[m==="save"&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"text-[11px]",style:{color:"var(--terminal-text-secondary)"},children:A.length>0?o.jsxs("span",{style:{color:"var(--idle-amber)"},children:["* ",A.length," unsaved change",A.length>1?"s":""]}):o.jsx("span",{style:{color:"var(--active-green)"},children:"All changes saved"})}),A.length>0&&o.jsxs("div",{children:[o.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:"Changed Files"}),o.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:A.map(({status:T,file:I})=>o.jsxs("div",{className:"flex gap-2",children:[o.jsx("span",{style:{color:T==="A"?"var(--active-green)":"var(--idle-amber)",width:"14px"},children:T}),o.jsx("span",{style:{color:"var(--terminal-text-secondary)"},children:I})]},I))})]}),A.length>0&&o.jsxs("div",{children:[o.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:"Save Message"}),o.jsx("input",{ref:E,type:"text",value:d,onChange:T=>g(T.target.value),placeholder:"Optional: describe your progress...",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)"}})]}),A.length>0&&o.jsx("div",{className:"flex gap-3",children:o.jsx("button",{onClick:R,disabled:f,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:f?"SAVING...":t!=null&&t.hasRemote?"SAVE & PUSH":"SAVE"})}),A.length>0&&t&&!t.hasRemote&&o.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:"Local save only — add a git remote to enable push"}),S&&o.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! ",S.filesChanged," file",S.filesChanged>1?"s":""," committed",S.pushed?" & pushed":"",S.pushError?` (push error: ${S.pushError})`:""]}),y&&o.jsx("div",{className:"text-[11px] p-2",style:{background:"rgba(211,47,47,0.1)",border:"1px solid #D32F2F",color:"#EF5350"},children:y}),(t==null?void 0:t.lastCommit)&&o.jsxs("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:["Last save: ",t.lastCommit.message," (",L0(t.lastCommit.date),")"]})]}),m==="history"&&o.jsxs(o.Fragment,{children:[l.length===0&&o.jsx("div",{className:"text-[11px] text-center py-8",style:{color:"var(--terminal-text-muted)"},children:"No save history"}),o.jsx("div",{className:"space-y-1",children:l.map(T=>o.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:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-[11px] font-mono",style:{color:"var(--accent)"},children:T.shortSha}),o.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--terminal-text)"},children:T.message})]}),o.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:L0(T.date)})]}),o.jsx("button",{onClick:()=>O(T.sha),disabled:v,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 JE({onClose:t}){const[l,r]=k.useState(null),[i,c]=k.useState(!0),[u,f]=k.useState(null);return k.useEffect(()=>{Ee.getCompanyStats().then(r).catch(m=>f(m.message)).finally(()=>c(!1))},[]),i?o.jsx("div",{style:{padding:24,color:"rgba(255,255,255,0.6)"},children:"Loading stats..."}):u||!l?o.jsxs("div",{style:{padding:24,color:"#ff6b6b"},children:[u||"Failed to load stats",o.jsx("button",{onClick:t,style:{marginLeft:12,color:"rgba(255,255,255,0.6)",background:"none",border:"none",cursor:"pointer"},children:"Close"})]}):o.jsxs("div",{style:{padding:20,color:"rgba(255,255,255,0.9)",maxHeight:"100%",overflowY:"auto"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:20},children:[o.jsx("h3",{style:{margin:0,fontSize:16,fontWeight:600},children:"Company Stats"}),o.jsx("button",{onClick:t,style:{background:"none",border:"none",color:"rgba(255,255,255,0.5)",cursor:"pointer",fontSize:18},children:"×"})]}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10,marginBottom:20},children:[o.jsx(dc,{label:"Roles",value:String(l.company.roleCount)}),o.jsx(dc,{label:"Avg Level",value:`Lv.${l.company.avgLevel}`}),o.jsx(dc,{label:"Total Tokens",value:l.company.formattedTokens}),o.jsx(dc,{label:"Total Cost",value:`$${l.company.totalCostUsd.toFixed(2)}`})]}),o.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"}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[l.roles.map((m,p)=>o.jsx(PE,{role:m,rank:p+1},m.roleId)),l.roles.length===0&&o.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&&o.jsxs(o.Fragment,{children:[o.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"}),o.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:Object.entries(l.byModel).map(([m,p])=>o.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:[o.jsx("span",{style:{color:"rgba(255,255,255,0.7)"},children:eN(m)}),o.jsxs("span",{style:{color:"rgba(255,255,255,0.5)"},children:["$",p.costUsd.toFixed(2)]})]},m))})]})]})}function dc({label:t,value:l}){return o.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:[o.jsx("div",{style:{fontSize:11,color:"rgba(255,255,255,0.45)",marginBottom:4},children:t}),o.jsx("div",{style:{fontSize:18,fontWeight:600},children:l})]})}function PE({role:t,rank:l}){const r=["🥇","🥈","🥉"],i=l<=3?r[l-1]:`#${l}`;return o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",background:"rgba(255,255,255,0.03)",borderRadius:8},children:[o.jsx("span",{style:{fontSize:14,width:28,textAlign:"center",flexShrink:0},children:i}),o.jsxs("div",{style:{flex:1,minWidth:0},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",marginBottom:4},children:[o.jsx("span",{style:{fontSize:13,fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.name}),o.jsxs("span",{style:{fontSize:12,color:$0(t.level),fontWeight:600,flexShrink:0,marginLeft:8},children:["Lv.",t.level]})]}),o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[o.jsx("div",{style:{flex:1,height:4,background:"rgba(255,255,255,0.08)",borderRadius:2,overflow:"hidden"},children:o.jsx("div",{style:{width:`${t.progress*100}%`,height:"100%",background:$0(t.level),borderRadius:2,transition:"width 0.3s ease"}})}),o.jsx("span",{style:{fontSize:10,color:"rgba(255,255,255,0.4)",flexShrink:0},children:t.formattedTokens})]})]})]})}function $0(t){return t>=9?"#FFD700":t>=7?"#C0A0FF":t>=5?"#4FC3F7":t>=3?"#81C784":"rgba(255,255,255,0.4)"}function eN(t){return t.includes("opus")?"Opus":t.includes("sonnet")?"Sonnet":t.includes("haiku")?"Haiku":t.split("-").slice(0,2).join(" ")}function tN({onClose:t,onSyncComplete:l}){const[r,i]=k.useState([]),[c,u]=k.useState([]),[f,m]=k.useState(!0),[p,d]=k.useState(null),[g,y]=k.useState(new Set),[b,v]=k.useState(null),[j,S]=k.useState(null),C=k.useCallback(async()=>{m(!0),v(null);try{const{roles:A}=await Ee.getSyncRoles();i(A);const R=A.filter(B=>B.source.sync!=="off");if(R.length===0){u([]),S(null);return}let O=!1;try{const B=await Cs.syncCheck(R.map(I=>({roleId:I.roleId,sourceId:I.source.id,currentVersion:I.source.upstream_version??I.source.forked_at??"0.0.0"})));O=!0,S(!0);const T=[];for(const I of B.updates){if(!I.hasUpdate)continue;const X=R.find(ne=>ne.roleId===I.roleId);if(!X)continue;const{character:ee}=await Cs.syncPull(I.sourceId),z=[];X.persona.trim()!==ee.persona.trim()&&z.push({field:"persona",local:X.persona.slice(0,120)+(X.persona.length>120?"...":""),upstream:ee.persona.slice(0,120)+(ee.persona.length>120?"...":"")});const $=JSON.stringify(X.authority),U=JSON.stringify(ee.authority);$!==U&&z.push({field:"authority",local:`${X.authority.autonomous.length} autonomous, ${X.authority.needsApproval.length} approval`,upstream:`${ee.authority.autonomous.length} autonomous, ${ee.authority.needsApproval.length} approval`}),z.length>0&&T.push({roleId:I.roleId,roleName:X.name,sourceId:I.sourceId,currentVersion:I.currentVersion,latestVersion:I.latestVersion,fields:z})}u(T)}catch{S(!1),u([])}}catch(A){v(A instanceof Error?A.message:"Failed to check for updates")}finally{m(!1)}},[]);k.useEffect(()=>{C()},[C]);const E=async A=>{d(A.roleId);try{const{character:R,version:O}=await Cs.syncPull(A.sourceId);await Ee.applySyncUpdate({roleId:A.roleId,changes:{persona:R.persona,authority:R.authority},upstreamVersion:O}),y(B=>new Set(B).add(A.roleId)),l==null||l()}catch(R){v(R instanceof Error?R.message:"Failed to apply update")}finally{d(null)}};return o.jsxs("div",{style:{padding:20,color:"rgba(255,255,255,0.9)",maxHeight:"100%",overflowY:"auto"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[o.jsx("h3",{style:{margin:0,fontSize:16,fontWeight:600},children:"Role Sync"}),o.jsxs("div",{style:{display:"flex",gap:8},children:[o.jsx("button",{onClick:C,disabled:f,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:f?"wait":"pointer"},children:f?"Checking...":"Refresh"}),o.jsx("button",{onClick:t,style:{background:"none",border:"none",color:"rgba(255,255,255,0.5)",cursor:"pointer",fontSize:18},children:"×"})]})]}),j===!1&&o.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&&o.jsx("div",{style:{padding:"8px 12px",background:"rgba(255,100,100,0.1)",borderRadius:6,color:"#ff6b6b",fontSize:12,marginBottom:12},children:b}),o.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:[o.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Tracked roles: "}),o.jsx("span",{style:{fontWeight:500},children:r.length}),o.jsx("span",{style:{color:"rgba(255,255,255,0.3)",margin:"0 8px"},children:"·"}),o.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Updates available: "}),o.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}),j===!0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{color:"rgba(255,255,255,0.3)",margin:"0 8px"},children:"·"}),o.jsx("span",{style:{fontSize:11,color:"#81C784"},children:"Cloud connected"})]})]}),c.length===0&&!f&&o.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=>o.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:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:10},children:[o.jsxs("div",{children:[o.jsx("div",{style:{fontSize:14,fontWeight:500},children:A.roleName}),o.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)?o.jsx("span",{style:{fontSize:12,color:"#81C784"},children:"Applied ✓"}):o.jsx("button",{onClick:()=>E(A),disabled:p===A.roleId,style:{background:"#1565C0",border:"none",color:"white",borderRadius:6,padding:"5px 12px",fontSize:12,cursor:p===A.roleId?"wait":"pointer",opacity:p===A.roleId?.6:1},children:p===A.roleId?"Applying...":"Apply Update"})]}),A.fields.map(R=>o.jsxs("div",{style:{marginBottom:6,fontSize:12},children:[o.jsx("div",{style:{color:"rgba(255,255,255,0.5)",marginBottom:2,textTransform:"uppercase",fontSize:10,letterSpacing:.5},children:R.field}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:6},children:[o.jsxs("div",{style:{padding:"4px 8px",background:"rgba(255,100,100,0.08)",borderRadius:4,color:"rgba(255,255,255,0.6)"},children:[o.jsx("span",{style:{fontSize:9,color:"rgba(255,255,255,0.3)"},children:"LOCAL"}),o.jsx("br",{}),R.local]}),o.jsxs("div",{style:{padding:"4px 8px",background:"rgba(100,255,100,0.08)",borderRadius:4,color:"rgba(255,255,255,0.6)"},children:[o.jsx("span",{style:{fontSize:9,color:"rgba(255,255,255,0.3)"},children:"UPSTREAM"}),o.jsx("br",{}),R.upstream]})]})]},R.field))]},A.roleId)),r.length>0&&o.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 ",o.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 nN({onClose:t}){const[l,r]=k.useState(null),[i,c]=k.useState(!0),[u,f]=k.useState(null),[m,p]=k.useState(null),d=k.useCallback(async()=>{c(!0),f(null);try{const A=await Ee.getGitStatus();r(A)}catch(A){f(A instanceof Error?A.message:"Failed to load git status")}finally{c(!1)}},[]);k.useEffect(()=>{d()},[d]);const g=async A=>{p(A.path);try{await Ee.deleteWorktree(A.path),await d()}catch(R){f(R instanceof Error?R.message:"Failed to remove worktree")}finally{p(null)}},y=async A=>{p(A);try{await Ee.deleteBranch(A),await d()}catch(R){f(R instanceof Error?R.message:"Failed to delete branch")}finally{p(null)}};if(i&&!l)return o.jsx("div",{style:{padding:24,color:"rgba(255,255,255,0.6)"},children:"Loading git status..."});if(u&&!l)return o.jsxs("div",{style:{padding:24,color:"#ff6b6b"},children:[u,o.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"),j=l.worktrees.filter(A=>A.status==="stale");function S(A){const R=A.split("/");if(R.length>1){const O=R[R.length-1],B=["cto","cbo","pm","engineer","designer","qa","data-analyst"];for(const T of B)if(O.toLowerCase().includes(T))return T}return null}function C(A,R=40){return A.length<=R?A:"..."+A.slice(A.length-R+3)}function E(A){const R=Date.now()-new Date(A).getTime(),O=Math.floor(R/6e4);if(O<1)return"just now";if(O<60)return`${O}m ago`;const B=Math.floor(O/60);return B<24?`${B}h ago`:`${Math.floor(B/24)}d ago`}return o.jsxs("div",{style:{padding:20,color:"rgba(255,255,255,0.9)",maxHeight:"100%",overflowY:"auto"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[o.jsx("h3",{style:{margin:0,fontSize:16,fontWeight:600},children:"GIT STATUS"}),o.jsxs("div",{style:{display:"flex",gap:8},children:[o.jsx("button",{onClick:d,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"}),o.jsx("button",{onClick:t,style:{background:"none",border:"none",color:"rgba(255,255,255,0.5)",cursor:"pointer",fontSize:18},children:"×"})]})]}),u&&o.jsx("div",{style:{padding:"8px 12px",background:"rgba(255,100,100,0.1)",borderRadius:6,color:"#ff6b6b",fontSize:12,marginBottom:12},children:u}),o.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:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[o.jsxs("div",{children:[o.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Branch: "}),o.jsx("span",{style:{fontWeight:500},children:l.currentBranch})]}),o.jsx("div",{children:l.unsavedCount>0&&o.jsxs("span",{style:{color:"#FFB74D",fontSize:12},children:[l.unsavedCount," unsaved"]})})]}),l.lastCommit&&o.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?"...":""," · ",E(l.lastCommit.date)]})]}),b.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(hc,{label:"Active Worktrees",count:b.length}),b.map(A=>o.jsx(Fd,{wt:A,roleFromBranch:A.roleId||S(A.branch),truncatePath:C,timeAgo:E,removing:m===A.path,onRemove:()=>g(A),statusColor:"#4FC3F7",statusIcon:"📂"},A.path))]}),v.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(hc,{label:"Pending Merge",count:v.length}),v.map(A=>o.jsx(Fd,{wt:A,roleFromBranch:A.roleId||S(A.branch),truncatePath:C,timeAgo:E,removing:m===A.path,onRemove:()=>g(A),statusColor:"#FFB74D",statusIcon:"⚠️"},A.path))]}),j.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(hc,{label:"Stale",count:j.length}),j.map(A=>o.jsx(Fd,{wt:A,roleFromBranch:A.roleId||S(A.branch),truncatePath:C,timeAgo:E,removing:m===A.path,onRemove:()=>g(A),statusColor:"#ff6b6b",statusIcon:"🔴"},A.path))]}),l.staleBranches.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(hc,{label:"Unmerged Branches",count:l.staleBranches.length}),l.staleBranches.map(A=>o.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:[o.jsxs("div",{style:{fontSize:13},children:[o.jsx("span",{style:{color:"rgba(255,255,255,0.5)",marginRight:6},children:"⚠️"}),o.jsx("span",{style:{fontWeight:500},children:A})]}),o.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&&j.length===0&&l.staleBranches.length===0&&o.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&&o.jsxs("div",{style:{marginTop:16,fontSize:11,color:"rgba(255,255,255,0.3)",lineHeight:1.5},children:["Last merge: ",o.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:l.lastMerge.branch})," · ",l.lastMerge.roleId," · ",E(l.lastMerge.mergedAt)]})]})}function hc({label:t,count:l}){return o.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 Fd({wt:t,roleFromBranch:l,truncatePath:r,timeAgo:i,removing:c,onRemove:u,statusColor:f,statusIcon:m}){return o.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:o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[o.jsxs("div",{style:{flex:1,minWidth:0},children:[o.jsxs("div",{style:{fontSize:13,fontWeight:500,marginBottom:2},children:[o.jsx("span",{style:{marginRight:6},children:m}),t.branch,l&&o.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&&o.jsxs("div",{style:{fontSize:11,color:"rgba(255,255,255,0.5)",marginBottom:2},children:['"',t.task.slice(0,50),t.task.length>50?"...":"",'"']}),o.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&&o.jsxs("div",{style:{fontSize:10,color:"#ff6b6b",marginTop:4},children:["⛔"," CONFLICT: ",t.conflictFiles.join(", ")]})]}),o.jsx("button",{onClick:u,disabled:c,style:{background:"rgba(255,100,100,0.15)",border:"1px solid rgba(255,100,100,0.2)",color:f,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"})]})})}const Tc=[0,1e4,5e4,15e4,4e5,1e6,25e5,5e6,1e7,25e6];function Rg(t){let l=1;for(let r=Tc.length-1;r>=0;r--)if(t>=Tc[r]){l=r+1;break}return Math.min(l,10)}function lN(t){const l=Rg(t);if(l>=10)return 1;const r=Tc[l-1],i=Tc[l];return Math.min(1,(t-r)/(i-r))}function H0(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:lN(c)}}return l}const rN=[{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 U0(t){return rN.filter(l=>l.check(t))}const aN={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍","data-analyst":"📊"},bc={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},iN={cto:"아키텍처",cbo:"시장 분석",pm:"PRD 작성",engineer:"코딩",designer:"시안 제작",qa:"품질 검증"};function sN(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 oN({importJob:t,onImportDone:l}){var ja,Ca,Bl,Ll;const[r,i]=k.useState([]),[c,u]=k.useState([]),[f,m]=k.useState([]),[p,d]=k.useState([]),[g,y]=k.useState([]),[b,v]=k.useState([]),[j,S]=k.useState("TYCONO"),[C,E]=k.useState(!0),[A,R]=k.useState(null),[O,B]=k.useState({type:"none"}),[T,I]=k.useState(null),[X,ee]=k.useState(null),[z,$]=k.useState([]),[U,ne]=k.useState(!1),[re,V]=k.useState([]),[Y,Q]=k.useState(0),[se,ve]=k.useState(!1),[M,_]=k.useState({}),[J,D]=k.useState("ceo"),[pe,Ce]=k.useState(null),[Ne,He]=k.useState(!1),[_e,oe]=k.useState({}),K=k.useRef({}),[fe,Se]=k.useState(!1),[te,ke]=k.useState(null),[je,Te]=k.useState({}),[Le,$e]=k.useState([]),[Yt,pt]=k.useState([]),[St,Bt]=k.useState(void 0),[Kt,vt]=k.useState(!1);k.useEffect(()=>{Ee.getStatus().then(F=>{Bt(F.engine),vt(!!F.hasApiKey)}).catch(()=>{})},[]);const{getAppearance:qt,setAppearance:ae,resetAppearance:ye,theme:Re,setTheme:qe,speechSettings:we,setSpeechSettings:Ae,language:bt,setLanguage:rt}=IC(),[de,Pe]=k.useState(null),[dt,dn]=k.useState("character"),et=qC(),[$c,rr]=k.useState(!1),[wa,ar]=k.useState(!1),[zl,ir]=k.useState(!1),[Yr,di]=k.useState(!1),[yn,hi]=k.useState(null);k.useEffect(()=>{const F=ue=>{(ue.metaKey||ue.ctrlKey)&&ue.key==="s"&&(ue.preventDefault(),et.dirtyCount>0&&rr(!0))};return window.addEventListener("keydown",F),()=>window.removeEventListener("keydown",F)},[et.dirtyCount]),k.useEffect(()=>{let F=!1;const ue=async()=>{try{const xe=await Ee.getGitStatus();F||hi(xe)}catch{}};ue();const me=setInterval(ue,1e4);return()=>{F=!0,clearInterval(me)}},[]);const[Qn,mi]=k.useState(null),[Ml,Rl]=k.useState(null),[Fl,ka]=k.useState([]),[yl,xi]=k.useState(!1),pi=k.useRef(!1),Wn=k.useRef(null);let Qt=k.useRef(0);const sn=k.useRef(new Set),Sn=(F,ue,me)=>{const xe={id:Qt.current++,type:F,text:ue,detail:me};ka(ge=>[...ge,xe])};k.useEffect(()=>{var F;yl&&((F=Wn.current)==null||F.scrollIntoView({behavior:"smooth"}))},[Fl,yl]),k.useEffect(()=>{t&&(pi.current||(pi.current=!0,Rl("Scanning knowledge sources..."),ka([{id:0,type:"scan",text:"Starting knowledge import..."}]),Qt.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 ge;const ue=(ge=F.body)==null?void 0:ge.getReader();if(!ue)return;const me=new TextDecoder;let xe="";for(;;){const{done:ze,value:Oe}=await ue.read();if(ze)break;xe+=me.decode(Oe,{stream:!0});const Xe=xe.split(`
89
- `);xe=Xe.pop()||"";let at="";for(const Ve of Xe)if(Ve.startsWith("event: "))at=Ve.slice(7).trim();else if(Ve.startsWith("data: ")&&at){try{const Lt=JSON.parse(Ve.slice(6));switch(at){case"scanning":Rl(`Scanning: ${Lt.path} (${Lt.fileCount} files)`),Sn("scan",`Found ${Lt.fileCount} files`,Lt.path);break;case"processing":mi({index:Lt.index,total:Lt.total}),Rl(`Importing knowledge... (${Lt.index}/${Lt.total})`),Sn("process",`Processing: ${Lt.file}`,`${Lt.index} / ${Lt.total}`);break;case"created":Sn("created",Lt.title,Lt.summary);break;case"skipped":Sn("process",`Skipped: ${Lt.file}`,Lt.reason);break;case"done":Rl(null),mi(null),Sn("done",`Import complete! ${Lt.created} created, ${Lt.skipped} skipped.`),_t(`Knowledge import complete! ${Lt.created} documents imported.`,"#2E7D32"),l==null||l();break;case"error":Rl(null),mi(null),Sn("error",Lt.message),_t(`Import failed: ${Lt.message}`,"#B71C1C"),l==null||l();break}}catch{}at=""}}}).catch(F=>{Rl(null),Sn("error",F.message),_t(`Import error: ${F.message}`,"#B71C1C"),l==null||l()})))},[t]);const[qr,Bs]=k.useState("card"),[Ls,$s]=k.useState(typeof window<"u"?window.innerWidth:1200);k.useEffect(()=>{const F=()=>$s(window.innerWidth);return window.addEventListener("resize",F),()=>window.removeEventListener("resize",F)},[]);const _l=Ls<1024,[jn,On]=k.useState(!1),[Zn,Xr]=k.useState(560),[Bn,ft]=k.useState([]),[Vr,Jn]=k.useState(null),[Ln,gl]=k.useState(null),{sendMessage:Hc}=$C();k.useEffect(()=>{Promise.all([Ee.getCompany().then(F=>{S(F.name),i(F.roles)}),Ee.getProjects().then(u),Ee.getStandups().then(m),Ee.getWaves().then(d),Ee.getDecisions().then(y),Ee.getKnowledge().then(v).catch(()=>{}),Ee.getOrgTree().then(F=>{_(F.nodes),D(F.root)}).catch(()=>{}),Ee.getCostSummary().then(F=>Gr(H0(F.byRole))).catch(()=>{})]).catch(F=>R(`Failed to load: ${F.message}`)).finally(()=>E(!1))},[]),k.useEffect(()=>{Ee.deleteEmptySessions().catch(()=>{}),Ee.getSessions().then(F=>{if(F.length>0){const ue=F.map(xe=>({...xe,messages:[]}));ft(ue);const me=ue.find(xe=>xe.status==="active")??ue[0];Jn(me.id),On(!0)}}).catch(F=>{console.error("Failed to load sessions",F)})},[]),k.useEffect(()=>{const F=()=>{fetch("/api/exec/status").then(me=>me.json()).then(me=>{Te(me.statuses??{}),$e(me.activeExecutions??[])}).catch(()=>{})};F();const ue=setInterval(F,3e3);return()=>clearInterval(ue)},[]);const sr=k.useMemo(()=>{const F={...je};if(Ln){const ue=Bn.find(me=>me.id===Ln);ue&&(F[ue.roleId]="working")}return F},[je,Ln,Bn]);k.useEffect(()=>{O.type==="role"?Ee.getRole(O.roleId).then(I).catch(console.error):I(null)},[O]);const or=()=>B({type:"none"}),Uc=async(F,ue)=>{const me=r.find(ge=>ge.id===F),xe=(X==null?void 0:X.mode)==="ask";ee(null);try{const{jobId:ge}=await Ee.startJob({type:"assign",roleId:F,task:ue,readOnly:xe}),ze=bc[F]??"#666",Oe=`${F.toUpperCase()} · ${(me==null?void 0:me.name)??F}`;ve(!1),$([{jobId:ge,title:Oe,color:ze}]),Xt.pushMessage({ts:Date.now(),roleId:"ceo",text:`[CEO → ${(me==null?void 0:me.name)??F}] ${xe?"Ask":"Assign"}: ${ue}`,type:"dispatch",targetRoleId:F})}catch(ge){_t(`Failed to start job: ${ge instanceof Error?ge.message:"unknown"}`,"#C62828")}},_t=(F,ue)=>{const me=Date.now();pt(xe=>[...xe,{id:me,message:F,color:ue}]),setTimeout(()=>pt(xe=>xe.filter(ge=>ge.id!==me)),4e3)},Gr=F=>{var me,xe;const ue=K.current;for(const[ge,ze]of Object.entries(F)){const Oe=((me=ue[ge])==null?void 0:me.level)??0;if(Oe>0&&ze.level>Oe){const Xe=((xe=r.find(at=>at.id===ge))==null?void 0:xe.name)??ge.toUpperCase();_t(`${Xe} leveled up to Lv.${ze.level}!`,"#7C3AED")}}K.current=F,oe(F)};k.useEffect(()=>{const F={roles:Object.entries(_e).map(([xe,ge])=>({id:xe,level:ge.level,totalTokens:ge.totalTokens})),totalTokens:Object.values(_e).reduce((xe,ge)=>xe+ge.totalTokens,0),roleCount:r.length},ue=U0(F),me=sn.current;for(const xe of ue)me.has(xe.id)||me.size>0&&_t(`${xe.icon} Badge earned: ${xe.name}!`,"#D4A017");sn.current=new Set(ue.map(xe=>xe.id))},[_e,r.length]);const ol=()=>{var ue;const F=z[z.length-1];F&&(_t(`${F.title} completed`,F.color),Xt.pushMessage({ts:Date.now(),roleId:((ue=F.title.split(" · ")[0])==null?void 0:ue.toLowerCase())??"unknown",text:`[${F.title}] Job completed`,type:"dispatch"})),Ee.getStandups().then(m).catch(console.error),Ee.getCompany().then(me=>i(me.roles)).catch(console.error),Ee.getCostSummary().then(me=>Gr(H0(me.byRole))).catch(()=>{})},Cn=async F=>{ne(!1);try{const ue=await Ee.startJob({type:"wave",directive:F}),me=ue.jobIds??(ue.jobId?[ue.jobId]:[]),xe=r.filter(ze=>ze.level==="c-level"),ge=me.map((ze,Oe)=>{var Xe,at;return{jobId:ze,roleId:((Xe=xe[Oe])==null?void 0:Xe.id)??`role-${Oe}`,roleName:((at=xe[Oe])==null?void 0:at.name)??`C-Level ${Oe+1}`}});Xt.pushMessage({ts:Date.now(),roleId:"ceo",text:`[CEO WAVE] "${F}" → ${ge.map(ze=>ze.roleName).join(", ")}`,type:"dispatch"}),Object.keys(M).length>0?(Ce({directive:F,rootJobs:ge}),He(!1)):(V(ge),Q(0),ve(!1),ge.length>0&&$([{jobId:ge[0].jobId,title:`CEO WAVE · ${ge[0].roleId.toUpperCase()}`,color:"#B71C1C"}]))}catch(ue){_t(`Failed to start wave: ${ue instanceof Error?ue.message:"unknown"}`,"#C62828")}},yi=()=>{Ee.getWaves().then(d).catch(console.error),Ee.getStandups().then(m).catch(console.error)},gi=()=>{Ee.getCompany().then(F=>i(F.roles)).catch(console.error)},bi=async(F,ue)=>{await Ee.createRole(F),ae(F.id,ue),gi(),_t(`${F.name} hired!`,"#2E7D32")},Hs=async F=>{await Ee.deleteRole(F),gi(),ke(null),_t(`${F.toUpperCase()} removed`,"#B71C1C")},Kr=async(F,ue)=>{await Ee.updateRole(F,ue),gi(),O.type==="role"&&O.roleId===F&&Ee.getRole(F).then(I).catch(console.error),ue.name&&_t(`${F.toUpperCase()} renamed to "${ue.name}"`,"#1565C0")},Ic=F=>{On(!0)},En=async F=>{try{const ue=await Ee.createSession(F,"talk");ft(me=>[ue,...me]),Jn(ue.id),On(!0)}catch(ue){console.error("Failed to create session",ue),_t(`Failed to create session: ${ue instanceof Error?ue.message:"API unreachable"}`,"#B71C1C")}},vi=async F=>{try{const ue=await Ee.createSession(F,"talk");ft(me=>[ue,...me]),Jn(ue.id)}catch(ue){console.error("Failed to create session",ue),_t(`Failed to create session: ${ue instanceof Error?ue.message:"API unreachable"}`,"#B71C1C")}},Us=async F=>{const ue=Le.find(ge=>ge.roleId===F),me=(ue==null?void 0:ue.jobId)??(ue==null?void 0:ue.id);if(me&&sr[F]==="working"){const ge=r.find(Xe=>Xe.id===F),ze=bc[F]??"#666",Oe=`${F.toUpperCase()} · ${(ge==null?void 0:ge.name)??F}`;$([{jobId:me,title:Oe,color:ze}]),ve(!1);return}const xe=Bn.find(ge=>ge.roleId===F);if(xe)Jn(xe.id),Xt.setActiveChannelId(null);else try{const ge=await Ee.createSession(F,"talk");ft(ze=>[ge,...ze]),Jn(ge.id),Xt.setActiveChannelId(null)}catch(ge){console.error("Failed to create session",ge)}On(!0)},wi=async F=>{try{await Ee.deleteSession(F),ft(ue=>{var xe;const me=ue.filter(ge=>ge.id!==F);return Vr===F&&Jn(((xe=me[0])==null?void 0:xe.id)??null),me})}catch(ue){console.error("Failed to delete session",ue),_t(`Failed to close session: ${ue instanceof Error?ue.message:"API error"}`,"#B71C1C")}},cr=async()=>{try{const{ids:F}=await Ee.deleteEmptySessions();if(F.length===0)return;ft(ue=>{var xe;const me=ue.filter(ge=>!F.includes(ge.id));return Vr&&F.includes(Vr)&&Jn(((xe=me[0])==null?void 0:xe.id)??null),me}),_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")}},Is=async()=>{if(!confirm("Close all sessions? This cannot be undone."))return;const F=Bn.map(ue=>ue.id);try{await Ee.deleteSessions(F),ft([]),Jn(null),_t("All sessions closed","#2E7D32")}catch(ue){_t(`Failed to close sessions: ${ue instanceof Error?ue.message:"API error"}`,"#B71C1C")}},cl=(F,ue)=>{ft(me=>me.map(xe=>{if(xe.id!==F)return xe;const ge=[...xe.messages],ze=ge[ge.length-1];if(ze&&ze.from==="role"&&ze.status==="streaming"){const Oe=[...ze.streamEvents??[],ue];ge[ge.length-1]={...ze,streamEvents:Oe}}return{...xe,messages:ge}}))},Ol=(F,ue,me)=>{const xe={id:`msg-${Date.now()}-ceo`,from:"ceo",content:ue,type:me==="do"?"directive":"conversation",status:"done",timestamp:new Date().toISOString()},ge={id:`msg-${Date.now()+1}-role`,from:"role",content:"",type:"conversation",status:"streaming",timestamp:new Date().toISOString(),streamEvents:[]};ft(ze=>ze.map(Oe=>Oe.id===F?{...Oe,messages:[...Oe.messages,xe,ge],updatedAt:new Date().toISOString()}:Oe)),gl(F),Hc(F,ue,me,{onThinking:ze=>{ft(Oe=>Oe.map(Xe=>{if(Xe.id!==F)return Xe;const at=[...Xe.messages],Ve=at[at.length-1];return Ve&&Ve.from==="role"&&Ve.status==="streaming"&&(at[at.length-1]={...Ve,thinking:(Ve.thinking??"")+ze}),{...Xe,messages:at}})),cl(F,{type:"thinking",timestamp:Date.now(),text:ze})},onText:ze=>{ft(Oe=>Oe.map(Xe=>{if(Xe.id!==F)return Xe;const at=[...Xe.messages],Ve=at[at.length-1];return Ve&&Ve.from==="role"&&Ve.status==="streaming"&&(at[at.length-1]={...Ve,content:Ve.content+ze}),{...Xe,messages:at}}))},onToolUse:(ze,Oe)=>{cl(F,{type:"tool",timestamp:Date.now(),toolName:ze,toolInput:Oe})},onDispatch:(ze,Oe)=>{cl(F,{type:"dispatch",timestamp:Date.now(),roleId:ze,task:Oe})},onDispatchProgress:(ze,Oe,Xe)=>{var at;Oe==="tool"?cl(F,{type:"dispatch:progress",timestamp:Date.now(),roleId:ze,progressType:"tool",toolName:Xe.name,toolInput:Xe.input}):Oe==="thinking"?cl(F,{type:"dispatch:progress",timestamp:Date.now(),roleId:ze,progressType:"thinking",text:Xe.text}):Oe==="text"?cl(F,{type:"dispatch:progress",timestamp:Date.now(),roleId:ze,progressType:"text",text:(at=Xe.text)==null?void 0:at.slice(-200)}):(Oe==="done"||Oe==="error")&&cl(F,{type:"dispatch:progress",timestamp:Date.now(),roleId:ze,progressType:Oe})},onTurn:ze=>{cl(F,{type:"turn",timestamp:Date.now(),turn:ze})},onDone:()=>{ft(ze=>ze.map(Oe=>{if(Oe.id!==F)return Oe;const Xe=Oe.messages.map(Ve=>Ve.status==="streaming"?{...Ve,status:"done"}:Ve),at=Oe.messages.length<=2?ue.slice(0,40).replace(/\n/g," "):Oe.title;return{...Oe,messages:Xe,title:at}})),gl(null)},onError:ze=>{ft(Oe=>Oe.map(Xe=>{if(Xe.id!==F)return Xe;const at=Xe.messages.map(Ve=>Ve.status==="streaming"?{...Ve,status:"error",content:Ve.content||ze}:Ve);return{...Xe,messages:at}})),gl(null)}})},Yc=(F,ue)=>{ft(me=>me.map(xe=>xe.id===F?{...xe,mode:ue}:xe)),Ee.updateSession(F,{mode:ue}).catch(console.error)},Ys=new Date().toISOString().slice(0,10),ul=c[0],Sa={cto:"Chief Technology Officer",cbo:"Chief Business Officer",pm:"Product Manager",engineer:"Software Engineer",designer:"UI/UX Designer",qa:"QA Engineer"},qc=F=>{const ue=Sa[F];if(!ue)return"";for(const me of f){const xe=me.content,ge=xe.indexOf(`## ${ue}`);if(ge===-1)continue;const ze=xe.indexOf(`
90
- ## `,ge+10),Xe=(ze===-1?xe.slice(ge):xe.slice(ge,ze)).split(`
91
- `).filter(at=>at.trim().length>0);for(const at of Xe){const Ve=at.replace(/^#+\s*/,"").replace(/\*\*/g,"").replace(/^[-*]\s+/,"").trim();if(!(Ve.startsWith("|")||Ve.startsWith("{")||Ve.startsWith("[")||Ve.startsWith("```")||Ve.startsWith("---")||Ve.includes("Journal")||Ve.includes("(c-level)")||Ve.includes("(team-lead)")||Ve.includes("(member)")||/^(CEO |작업 결과|생성\/수정|APPROVAL|비고|상황 보고|태스크$)/.test(Ve))&&Ve.length>15&&Ve.length<120)return Ve}}return""},Xc=F=>{const ue=Sa[F];if(!ue)return"";for(const me of f){const xe=me.content,ge=xe.indexOf(`## ${ue}`);if(ge===-1)continue;const ze=xe.indexOf(`
92
- ## `,ge+10),Xe=(ze===-1?xe.slice(ge):xe.slice(ge,ze)).replace(/^## .+\n/,"").trim();if(Xe)return Xe.slice(0,1500)}return""},Xt=rE();k.useEffect(()=>{r.length>0&&Xt.syncDefaultMembers(r)},[r]);const gn=PC({roles:r,roleStatuses:je,activeExecs:Le,getStandupSpeech:qc});return cE({roles:r,roleStatuses:je,activeExecs:Le,channels:Xt.channels,relationships:gn.relationships,pushMessage:Xt.pushMessage,speechSettings:we,engineType:St,hasApiKey:Kt}),C?o.jsxs("div",{className:"h-screen flex flex-col bg-[var(--floor-light)]",style:{fontFamily:"var(--pixel-font)"},children:[(Ml||Fl.length>0)&&o.jsxs("div",{className:"shrink-0 z-[44]",children:[o.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:()=>xi(F=>!F),children:[Ml?o.jsx("div",{className:"w-3 h-3 border-2 border-white/40 border-t-white rounded-full animate-spin shrink-0"}):o.jsx("span",{className:"shrink-0",children:"✅"}),o.jsx("span",{className:"flex-1",children:Ml||"Knowledge import finished"}),Qn&&o.jsx("div",{className:"w-24 h-1.5 rounded-full overflow-hidden shrink-0",style:{background:"rgba(255,255,255,0.3)"},children:o.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Qn.index/Qn.total*100}%`,background:"#fff"}})}),o.jsx("span",{className:"text-[10px] opacity-70 shrink-0",children:yl?"▲":"▼"})]}),yl&&o.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:[Fl.map(F=>o.jsxs("div",{className:"flex items-start gap-2 px-5 py-1.5",style:{borderBottom:"1px solid var(--terminal-border)"},children:[o.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"&&"❌"]}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{style:{color:F.type==="error"?"#EF4444":F.type==="done"?"var(--active-green)":"var(--terminal-text)"},children:F.text}),F.detail&&o.jsx("div",{className:"text-[10px] truncate",style:{color:"var(--terminal-text-muted)"},children:F.detail})]})]},F.id)),o.jsx("div",{ref:Wn})]})]}),o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"text-4xl mb-3",children:"🏢"}),o.jsx("div",{className:"text-gray-600 font-semibold text-xs",children:"LOADING OFFICE..."})]})})]}):A?o.jsx("div",{className:"h-screen flex items-center justify-center bg-[var(--floor-light)]",children:o.jsxs("div",{className:"text-center max-w-md",style:{fontFamily:"var(--pixel-font)"},children:[o.jsx("div",{className:"text-4xl mb-3",children:"⚠️"}),o.jsx("div",{className:"text-gray-800 font-semibold mb-2 text-xs",children:"CONNECTION ERROR"}),o.jsx("div",{className:"text-gray-500 text-xs mb-4",children:A}),o.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"})]})}):o.jsxs("div",{className:"flex flex-col",style:{height:"100dvh",fontFamily:"var(--pixel-font)"},children:[o.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:[o.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:["🏢"," ",o.jsx("span",{style:{color:"var(--terminal-text)"},children:j})]}),o.jsxs("div",{className:"flex gap-4 text-[var(--terminal-text-secondary)] text-[11px] items-center",children:[(()=>{const F=Object.values(_e).reduce((ze,Oe)=>ze+Oe.totalTokens,0),ue=F>=1e6?`${(F/1e6).toFixed(1)}M`:F>=1e3?`${Math.round(F/1e3)}K`:String(F),me=Math.min(100,Math.round(F/25e4*100)),xe=Le.length,ge=r.length>0?Math.round(xe/r.length*100):0;return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"hidden md:flex items-center gap-1",children:["💰",o.jsx("div",{className:"w-[50px] h-2 bg-[#111] overflow-hidden",style:{border:"2px solid var(--pixel-border)"},children:o.jsx("div",{className:"h-full",style:{width:`${me}%`,background:"linear-gradient(90deg,#22c55e,#34D399)"}})}),o.jsx("strong",{className:"text-[var(--active-green)]",children:ue})]}),o.jsxs("div",{className:"hidden md:flex items-center gap-1",children:["⚡",o.jsx("div",{className:"w-[50px] h-2 bg-[#111] overflow-hidden",style:{border:"2px solid var(--pixel-border)"},children:o.jsx("div",{className:"h-full",style:{width:`${ge}%`,background:"linear-gradient(90deg,#3b82f6,#60A5FA)"}})}),o.jsx("strong",{className:"text-[var(--terminal-text)]",children:ge})]})]})})(),o.jsxs("span",{className:"hidden sm:inline",children:["Roles: ",o.jsx("strong",{className:"text-[var(--terminal-text)]",children:r.length})]}),o.jsxs("span",{className:"hidden sm:inline",children:["Projects: ",o.jsx("strong",{className:"text-[var(--terminal-text)]",children:c.length})]}),Le.length>0&&o.jsxs("span",{className:"text-amber-400",children:["Working: ",o.jsx("strong",{children:Le.length})]}),(()=>{const F={roles:Object.entries(_e).map(([me,xe])=>({id:me,level:xe.level,totalTokens:xe.totalTokens})),totalTokens:Object.values(_e).reduce((me,xe)=>me+xe.totalTokens,0),roleCount:r.length},ue=U0(F);return ue.length>0?o.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:ue.map(me=>o.jsx("span",{title:`${me.name}: ${me.description}`,style:{fontSize:12,cursor:"default"},children:me.icon},me.id))}):null})(),o.jsxs("button",{onClick:()=>{et.state==="no-git"?et.initGit():rr(!0)},className:"flex items-center gap-1 cursor-pointer px-1.5 py-0.5",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--pixel-border)"},title:et.state==="no-git"?"Click to initialize git repository":et.state==="dirty"?`${et.dirtyCount} unsaved changes`:"All saved",children:[o.jsx("span",{style:{display:"inline-block",width:6,height:6,borderRadius:"50%",background:et.state==="no-git"?"var(--terminal-text-muted)":et.state==="saving"||et.state==="dirty"?"var(--idle-amber)":et.state==="error"?"#EF5350":"var(--active-green)",animation:et.state==="saving"?"pulse 1s infinite":void 0}}),o.jsx("span",{children:Ys})]})]})]}),(Ml||Fl.length>0)&&o.jsxs("div",{className:"shrink-0 z-[44]",children:[o.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:()=>xi(F=>!F),children:[Ml?o.jsx("div",{className:"w-3 h-3 border-2 border-white/40 border-t-white rounded-full animate-spin shrink-0"}):o.jsx("span",{className:"shrink-0",children:"✅"}),o.jsx("span",{className:"flex-1",children:Ml||"Knowledge import finished"}),Qn&&o.jsx("div",{className:"w-24 h-1.5 rounded-full overflow-hidden shrink-0",style:{background:"rgba(255,255,255,0.3)"},children:o.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Qn.index/Qn.total*100}%`,background:"#fff"}})}),o.jsx("span",{className:"text-[10px] opacity-70 shrink-0",children:yl?"▲":"▼"})]}),yl&&o.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:[Fl.map(F=>o.jsxs("div",{className:"flex items-start gap-2 px-5 py-1.5",style:{borderBottom:"1px solid var(--terminal-border)"},children:[o.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"&&"❌"]}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{style:{color:F.type==="error"?"#EF4444":F.type==="done"?"var(--active-green)":"var(--terminal-text)"},children:F.text}),F.detail&&o.jsx("div",{className:"text-[10px] truncate",style:{color:"var(--terminal-text-muted)"},children:F.detail})]})]},F.id)),o.jsx("div",{ref:Wn}),Fl.length===0&&o.jsx("div",{className:"px-5 py-4 text-center",style:{color:"var(--terminal-text-muted)"},children:"Waiting for events..."})]})]}),o.jsxs("div",{className:"flex-1 overflow-hidden flex relative",children:[o.jsx("div",{className:"flex-1 overflow-y-auto relative floor-grid",style:{background:"var(--floor-light)"},children:qr==="iso"?o.jsx(QE,{roles:r,projects:c,waves:p,standups:f,decisions:g,roleStatuses:sr,activeExecs:Le,onRoleClick:F=>B({type:"role",roleId:F}),onProjectClick:F=>B({type:"project",projectId:F}),onBulletinClick:()=>B({type:"bulletin"}),onDecisionsClick:()=>B({type:"decisions"}),onKnowledgeClick:()=>B({type:"knowledge"}),knowledgeDocsCount:b.length,getRoleSpeech:gn.getSpeech,getAppearance:qt,onHireClick:()=>Se(!0)}):o.jsxs("div",{className:`${jn?"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(me=>me.level==="c-level"),ue=r.filter(me=>me.level!=="c-level");return o.jsxs(o.Fragment,{children:[F.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"pixel-section-label",children:"LEADERSHIP"}),o.jsx("div",{className:`grid gap-2 ${F.length===1?"grid-cols-1":"grid-cols-2"}`,children:F.map(me=>{var xe,ge;return o.jsx(I0,{role:me,speech:gn.getSpeech(me.id),onClick:()=>B({type:"role",roleId:me.id}),liveStatus:sr[me.id],activeTask:(xe=Le.find(ze=>ze.roleId===me.id))==null?void 0:xe.task,featured:!0,appearance:qt(me.id),xpLevel:(ge=_e[me.id])==null?void 0:ge.level},me.id)})})]}),o.jsx("div",{className:"pixel-section-label",children:"TEAM"}),o.jsxs("div",{className:`grid gap-2 ${jn?"grid-cols-3":"grid-cols-4"}`,children:[ue.map(me=>{var xe,ge;return o.jsx(I0,{role:me,speech:gn.getSpeech(me.id),onClick:()=>B({type:"role",roleId:me.id}),liveStatus:sr[me.id],activeTask:(xe=Le.find(ze=>ze.roleId===me.id))==null?void 0:xe.task,appearance:qt(me.id),xpLevel:(ge=_e[me.id])==null?void 0:ge.level},me.id)}),o.jsx("div",{className:"pixel-card pixel-card--hire",onClick:()=>Se(!0),children:o.jsxs("div",{className:"pixel-card--hire-inner",children:[o.jsx("span",{className:"pixel-card--hire-icon",children:"+"}),o.jsx("span",{className:"pixel-card--hire-label",children:"HIRE NEW ROLE"})]})})]})]})})(),o.jsx("div",{className:"pixel-section-label mt-1",children:"OFFICE"}),o.jsxs("div",{className:"grid grid-cols-4 gap-2",children:[o.jsxs("div",{className:"facility-card-compact",onClick:ul?()=>B({type:"project",projectId:ul.id}):void 0,style:ul?void 0:{borderStyle:"dashed",opacity:.5},children:[o.jsxs("div",{className:"fcc-hdr",style:{background:"#3B82F6"},children:["🏢"," MEETING ROOM"]}),o.jsx("div",{className:"fcc-canvas",children:o.jsx(oc,{type:"meeting"})}),o.jsxs("div",{className:"fcc-body",children:[o.jsx("div",{className:"fcc-desc",children:"Projects, PRDs, and task boards"}),ul?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"fcc-title",children:['"',ul.name,'"']}),o.jsxs("div",{className:"fcc-meta",children:["Status: ",o.jsx("strong",{style:{color:"var(--active-green)"},children:ul.status})]})]}):o.jsx("div",{className:"fcc-meta",style:{fontStyle:"italic"},children:"No active projects"})]})]}),o.jsxs("div",{className:"facility-card-compact",onClick:()=>B({type:"bulletin"}),children:[o.jsxs("div",{className:"fcc-hdr",style:{background:"#64748b"},children:["📋"," BULLETIN"]}),o.jsx("div",{className:"fcc-canvas",children:o.jsx(oc,{type:"bulletin"})}),o.jsxs("div",{className:"fcc-body",children:[o.jsx("div",{className:"fcc-desc",children:"Waves and daily standups"}),p.slice(0,1).map(F=>o.jsxs("div",{className:"fcc-item",children:["Wave ",F.id]},F.id)),f.slice(0,1).map(F=>o.jsxs("div",{className:"fcc-item",children:["Standup ",F.date]},F.date)),p.length===0&&f.length===0&&o.jsx("div",{className:"fcc-meta",style:{fontStyle:"italic"},children:"No entries yet"})]})]}),o.jsxs("div",{className:"facility-card-compact",onClick:()=>B({type:"decisions"}),children:[o.jsxs("div",{className:"fcc-hdr",style:{background:"#EF4444"},children:["📜"," DECISIONS"]}),o.jsx("div",{className:"fcc-canvas",children:o.jsx(oc,{type:"decision"})}),o.jsxs("div",{className:"fcc-body",children:[o.jsx("div",{className:"fcc-desc",children:"CEO strategic decision log"}),o.jsxs("div",{className:"fcc-title",children:[g.length," decisions"]}),g.slice(0,2).map(F=>o.jsxs("div",{className:"fcc-item",children:["#",F.id," ",F.title]},F.id))]})]}),o.jsxs("div",{className:"facility-card-compact",onClick:()=>B({type:"knowledge"}),children:[o.jsxs("div",{className:"fcc-hdr",style:{background:"#0D9488"},children:["📚"," KNOWLEDGE"]}),o.jsx("div",{className:"fcc-canvas",children:o.jsx(oc,{type:"knowledge"})}),o.jsxs("div",{className:"fcc-body",children:[o.jsx("div",{className:"fcc-desc",children:"Research, analysis, and references"}),o.jsxs("div",{className:"fcc-title",children:[b.length," docs"]}),b.slice(0,2).map(F=>o.jsx("div",{className:"fcc-item",children:F.title},F.id))]})]})]})]})}),jn&&o.jsx("div",{className:_l?"absolute inset-0 z-50":"contents",children:o.jsx(LC,{sessions:Bn,activeSessionId:Vr,roles:r,streamingSessionId:Ln,width:_l?Ls:Zn,onWidthChange:_l?void 0:Xr,onSwitchSession:Jn,onCloseSession:wi,onCreateSession:En,onClearEmpty:cr,onCloseAll:Is,onSendMessage:Ol,onModeChange:Yc,onCloseTerminal:()=>On(!1),chatChannels:Xt.channels,activeChatChannelId:Xt.activeChannelId,onSwitchChatChannel:Xt.setActiveChannelId,onCreateChatChannel:Xt.createChannel,onDeleteChatChannel:Xt.deleteChannel,onUpdateChatMembers:Xt.updateMembers,onUpdateChatTopic:Xt.updateTopic,unreadChannels:Xt.unreadChannels})})]}),o.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:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{onClick:()=>Bs("card"),className:`view-toggle-btn ${qr==="card"?"active":""}`,children:"CARD"}),o.jsx("button",{onClick:()=>Bs("iso"),className:`view-toggle-btn ${qr==="iso"?"active":""}`,children:"ISO"}),o.jsx("span",{className:"mx-1",children:"|"}),o.jsxs("button",{className:"theme-btn",onClick:()=>{dn("office"),Pe(r[0]??null)},title:"Customize",children:[((ja=$r[Re])==null?void 0:ja.icon)??""," ",((Ca=$r[Re])==null?void 0:Ca.name)??"THEME"]}),o.jsx("span",{className:"mx-1",children:"|"}),o.jsx("button",{className:"theme-btn",onClick:()=>ar(!0),title:"Company Stats",children:"STATS"}),o.jsx("button",{className:"theme-btn",onClick:()=>ir(!0),title:"Role Sync",children:"SYNC"}),o.jsx("span",{className:"mx-1",children:"|"}),o.jsx("button",{onClick:()=>di(!0),title:"Git Status",style:{background:"none",border:"none",cursor:"pointer",fontSize:10,fontFamily:"var(--pixel-font)",color:yn?yn.worktrees.some(F=>F.status==="stale")?"#ff6b6b":yn.worktrees.some(F=>F.status==="pending-merge")?"#FFB74D":yn.worktrees.length>0?"#4FC3F7":"#81C784":"var(--terminal-text-muted)"},children:yn?yn.worktrees.length===0&&yn.staleBranches.length===0?"✓ clean":`📂 ${yn.worktrees.length} worktree${yn.worktrees.length!==1?"s":""}${yn.staleBranches.length>0?` · ⚠ ${yn.staleBranches.length} branch${yn.staleBranches.length!==1?"es":""}`:""}`:"GIT"}),o.jsx("span",{className:"mx-1",children:"|"}),o.jsx("span",{style:{color:et.state==="dirty"?"var(--idle-amber)":"var(--terminal-text-muted)"},children:et.state==="no-git"?"No git":et.state==="saving"?"Saving...":et.state==="dirty"?`${et.dirtyCount} unsaved`:et.lastSaved?`Saved ${(()=>{const F=Math.floor((Date.now()-new Date(et.lastSaved).getTime())/6e4);return F<1?"just now":F<60?`${F}m ago`:`${Math.floor(F/60)}h ago`})()}`:"Saved"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[pe&&Ne&&o.jsx("button",{onClick:()=>He(!1),className:"px-3 py-1 font-black text-white cursor-pointer animate-pulse",style:{background:"#B71C1C",border:"2px solid #7f121288",fontFamily:"var(--pixel-font)",borderRadius:4},children:"WAVE"}),z.length>0&&se&&o.jsxs("button",{onClick:()=>ve(!1),className:"px-3 py-1 font-black text-white cursor-pointer animate-pulse",style:{background:z[z.length-1].color,border:`2px solid ${z[z.length-1].color}88`,fontFamily:"var(--pixel-font)",borderRadius:4},children:[z[z.length-1].title.slice(0,20),z[z.length-1].title.length>20?"..":""]}),o.jsxs("button",{onClick:()=>ne(!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"]}),o.jsx("button",{onClick:()=>jn?On(!1):Ic(),className:"px-3 py-1 font-black cursor-pointer",style:{background:jn?"var(--terminal-bg)":"var(--hud-bg-alt)",color:"var(--terminal-text)",border:`2px solid ${jn?"var(--terminal-border-hover)":"var(--pixel-border)"}`,fontFamily:"var(--pixel-font)"},children:"TERMINAL"})]}),o.jsxs("span",{children:["Expand: +",Math.max(0,10-r.length)," desks available"]})]}),O.type==="role"&&T&&(()=>{var ue;const F=Le.find(me=>me.roleId===T.id);return o.jsx(sj,{role:T,allRoles:r,recentActivity:Xc(T.id),onClose:or,onFireRole:(me,xe)=>{ke({roleId:me,roleName:xe}),or()},terminalWidth:jn?Zn:0,activeJobId:F==null?void 0:F.id,activeTask:F==null?void 0:F.task,isWorking:sr[T.id]==="working",jobStartedAt:F==null?void 0:F.startedAt,onStopJob:me=>Ee.abortJob(me),sessions:Bn,streamingSessionId:Ln,onCreateSessionSilent:vi,onSendMessage:Ol,onFocusTerminal:Us,onCustomize:me=>{const xe=r.find(ge=>ge.id===me);xe&&(dn("character"),Pe(xe))},onUpdateRole:Kr,appearance:qt(T.id),relationships:gn.relationships,roleLevel:(ue=_e[T.id])==null?void 0:ue.level})})(),O.type==="project"&&ul&&o.jsx(lC,{projectId:ul.id,onClose:or,terminalWidth:jn?Zn:0}),(O.type==="bulletin"||O.type==="decisions")&&o.jsx(tC,{standups:f,waves:p,decisions:g,mode:O.type==="bulletin"?"bulletin":"decisions",onClose:or,terminalWidth:jn?Zn:0}),O.type==="knowledge"&&o.jsx(eC,{docs:b,onClose:or,onRefresh:()=>Ee.getKnowledge().then(v).catch(()=>{}),terminalWidth:jn?Zn:0,initialDocId:O.docId}),X&&o.jsx(iC,{roleId:X.roleId,roleName:X.roleName,mode:X.mode,onClose:()=>ee(null),onExecutionStart:Uc}),pe&&!Ne&&o.jsx(mC,{directive:pe.directive,rootJobs:pe.rootJobs,orgNodes:M,rootRoleId:J,onClose:()=>{Ce(null),He(!1)},onMinimize:()=>He(!0),onDone:()=>{yi(),_t("Wave complete","#2E7D32")},onOpenKnowledgeDoc:F=>{Ce(null),He(!1),B({type:"knowledge",docId:F}),Ee.getKnowledge().then(v).catch(()=>{})}}),z.length>0&&!se&&(()=>{var me;const F=z[z.length-1],ue=re.length>1;return o.jsxs(o.Fragment,{children:[ue&&z.length===1&&o.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:re.map((xe,ge)=>o.jsx("button",{onClick:()=>{Q(ge),$([{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:Y===ge?"#B71C1C":"var(--terminal-bg)",color:Y===ge?"#fff":"var(--terminal-text-secondary)",border:`1px solid ${Y===ge?"#B71C1C":"var(--terminal-border)"}`,borderBottom:"none"},children:xe.roleId.toUpperCase()},xe.jobId))}),o.jsx(sC,{jobId:F.jobId,title:z.length>1?F.title:ue?`CEO WAVE · ${((me=re[Y])==null?void 0:me.roleName)??""}`:F.title,color:F.color,variant:"modal",style:ue&&z.length===1?{marginTop:28}:void 0,onClose:()=>{$([]),V([]),Q(0),ve(!1)},onMinimize:()=>ve(!0),onDone:()=>{ol(),yi()},onNavigateToJob:xe=>{Ee.getJob(xe).then(ge=>{const ze=bc[ge.roleId]??"#888";$(Oe=>[...Oe,{jobId:xe,title:`${ge.roleId.toUpperCase()} · ${ge.task.slice(0,40)}`,color:ze}])}).catch(console.error)},onOpenKnowledgeDoc:xe=>{$([]),V([]),Q(0),ve(!1),B({type:"knowledge",docId:xe}),Ee.getKnowledge().then(v).catch(()=>{})}},F.jobId)]})})(),z.length>1&&o.jsx("div",{className:"fixed top-[5%] left-1/2 -translate-x-1/2 w-[720px] max-w-[95vw] z-[62] pointer-events-none",children:o.jsx("div",{className:"pointer-events-auto",children:o.jsxs("button",{onClick:()=>$(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 ",(Bl=z[z.length-2])==null?void 0:Bl.title]})})}),U&&o.jsx(cC,{cLevelRoles:r.filter(F=>F.level==="c-level"),orgNodes:M,rootId:J,onClose:()=>ne(!1),onDispatch:Cn}),fe&&o.jsx(bC,{existingRoles:r,onClose:()=>Se(!1),onHire:bi}),te&&o.jsx(vC,{roleId:te.roleId,roleName:te.roleName,onClose:()=>ke(null),onConfirm:Hs}),de&&o.jsx(WE,{role:de,appearance:qt(de.id),onSave:F=>ae(de.id,F),onReset:()=>ye(de.id),onClose:()=>{Pe(null),dn("character")},theme:Re,onThemeChange:qe,onUpdateName:async(F,ue)=>{await Kr(F,{name:ue})},initialTab:dt,speechSettings:we,onSpeechSettingsChange:Ae,language:bt,onLanguageChange:rt,roleLevel:(Ll=_e[de.id])==null?void 0:Ll.level}),$c&&o.jsx(ZE,{status:et.status,history:et.history,onClose:()=>rr(!1),onSave:async F=>await et.save(F),onLoadHistory:et.loadHistory,onRestore:et.restore,saving:et.state==="saving"}),wa&&o.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>ar(!1),children:o.jsx("div",{style:{width:420,maxHeight:"80vh",background:"var(--terminal-bg)",border:"2px solid var(--pixel-border)",borderRadius:8},onClick:F=>F.stopPropagation(),children:o.jsx(JE,{onClose:()=>ar(!1)})})}),zl&&o.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>ir(!1),children:o.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:o.jsx(tN,{onClose:()=>ir(!1),onSyncComplete:()=>{}})})}),Yr&&o.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>di(!1),children:o.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:o.jsx(nN,{onClose:()=>di(!1)})})}),o.jsx("div",{className:"fixed top-16 right-4 z-[70] flex flex-col gap-2",children:Yt.map(F=>o.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:[o.jsx("div",{className:"w-2 h-2 bg-white/60"}),F.message]},F.id))})]})}function I0({role:t,speech:l,onClick:r,liveStatus:i,activeTask:c,featured:u,appearance:f,xpLevel:m}){const p=bc[t.id]??sN(t.id),d=m??1,g=iN[t.id]??t.name,y=i==="working",b=y&&c?c:l||g;return o.jsxs("div",{className:`pixel-card ${y?"working":""} ${u?"pixel-card--featured":""}`,onClick:r,children:[o.jsxs("div",{className:"pixel-card-hdr",style:{background:p},children:[o.jsxs("span",{children:[t.id.toUpperCase()," ","·"," ",t.name.toUpperCase()]}),o.jsxs("span",{className:"lvl",children:["Lv.",d]})]}),o.jsxs("div",{className:"pixel-card-body",children:[o.jsx("div",{className:"pixel-desk"}),o.jsx(Bc,{roleId:t.id,appearance:f}),o.jsx("div",{className:"pixel-status-dot",style:{background:y?"var(--idle-amber)":"var(--active-green)"}})]}),o.jsxs("div",{className:"pixel-card-task",children:[o.jsx("span",{className:"pixel-card-task-icon",children:y?"🛠️":aN[t.id]??"👤"}),o.jsx("span",{className:"pixel-card-task-text",children:b||g})]})]})}function _d({onSelect:t,onClose:l}){const[r,i]=k.useState(null),[c,u]=k.useState(!0),f=k.useCallback(async m=>{u(!0);try{const p=await Ee.browse(m);i(p)}catch{}finally{u(!1)}},[]);return k.useEffect(()=>{f()},[f]),c&&!r?o.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?o.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:[o.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:[o.jsx("span",{style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},className:"truncate flex-1",children:r.current}),o.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"}),o.jsx("button",{onClick:l,className:"opacity-50 hover:opacity-100 shrink-0",style:{color:"var(--terminal-text)"},children:"✕"})]}),r.parent&&o.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:()=>f(r.parent),children:[o.jsx("span",{children:"⬆️"}),o.jsx("span",{children:".."})]}),r.dirs.map(m=>o.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:()=>f(m.path),children:[o.jsx("span",{children:"📁"}),o.jsx("span",{children:m.name})]},m.path)),r.dirs.length===0&&o.jsx("div",{className:"px-3 py-3 text-center",style:{color:"var(--terminal-text-muted)"},children:"No subdirectories"})]}):null}const cN={engine:"AI Engine",company:"Company Info",project:"Project",knowledge:"Knowledge",team:"Team Template",create:"Create"};function Y0(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 uN({onComplete:t}){const[l,r]=k.useState(0),[i,c]=k.useState(null),[u,f]=k.useState("none"),[m,p]=k.useState(""),[d,g]=k.useState(!0),[y,b]=k.useState(""),[v,j]=k.useState(""),S=k.useRef(null),[C,E]=k.useState("fresh"),[A,R]=k.useState(""),[O,B]=k.useState(null),[T,I]=k.useState(!1),[X,ee]=k.useState(!1),[z,$]=k.useState("skip"),[U,ne]=k.useState([]),[re,V]=k.useState(""),[Y,Q]=k.useState(!1),[se,ve]=k.useState(""),[M,_]=k.useState(null),[J,D]=k.useState(!1),[pe,Ce]=k.useState(!1),[Ne,He]=k.useState([]),[_e,oe]=k.useState("startup"),[K,fe]=k.useState(!1),[Se,te]=k.useState(!1),[ke,je]=k.useState(null),[Te,Le]=k.useState([]),[$e,Yt]=k.useState(!1),pt=k.useMemo(()=>Y0(z),[z]),St=pt[l]??"engine";k.useEffect(()=>{Ee.detectEngine().then(de=>{c(de),f(de.recommended),g(!1)}).catch(()=>g(!1)),Ee.getTeams().then(He).catch(()=>{})},[]),k.useEffect(()=>{var de;St==="company"&&((de=S.current)==null||de.focus())},[St]);const Bt=()=>{switch(St){case"engine":return u!=="none"||m.length>10;case"company":return y.trim().length>0;case"project":return C==="fresh"||C==="existing"&&O===!0;case"knowledge":return z==="existing-akb"?M===!0:z==="import"?U.length>0:!0;case"team":return!0;case"create":return!Se;default:return!1}},Kt=()=>{l<pt.length-1&&Bt()&&r(l+1),St==="create"&&!K&&!$e&&(z==="existing-akb"?qe():Re())},vt=()=>{l>0&&r(l-1)};k.useEffect(()=>{const de=Y0(z);l>=de.length&&r(de.length-1)},[z,l]);const qt=async()=>{if(A.trim()){I(!0);try{const de=await Ee.validatePath(A.trim());B(de.valid)}catch{B(!1)}finally{I(!1)}}},ae=async()=>{if(se.trim()){D(!0);try{const de=await Ee.validatePath(se.trim());_(de.valid&&de.hasClaudeMd===!0)}catch{_(!1)}finally{D(!1)}}},ye=()=>{const de=re.trim();de&&!U.includes(de)&&(ne([...U,de]),V(""))},Re=async()=>{fe(!0),je(null);try{const de={companyName:y.trim(),description:v.trim()||"An AI-powered organization",team:_e,existingProjectPath:C==="existing"?A.trim():void 0,knowledgePaths:z==="import"&&U.length>0?U:void 0};(u==="direct-api"||m)&&(de.apiKey=m||void 0);const Pe=await Ee.scaffold(de);Le(Pe.created),te(!0)}catch(de){je(de instanceof Error?de.message:"Scaffold failed")}finally{fe(!1)}},qe=async()=>{Yt(!0),je(null);try{const de=await Ee.connectAkb(se.trim());de.ok?(te(!0),Le([`Connected to: ${de.companyRoot}`])):je(de.error||"Failed to connect")}catch(de){je(de instanceof Error?de.message:"Connect failed")}finally{Yt(!1)}},we=()=>{z==="import"&&U.length>0?t({paths:U,companyRoot:""}):t()},Ae=de=>{de.key==="Enter"&&Bt()&&(de.preventDefault(),Kt())},bt=`w-full px-3 py-2 rounded text-sm outline-none transition-colors
93
- bg-[var(--terminal-bg)] text-[var(--terminal-text)]
94
- border border-[var(--terminal-border)]
95
- focus:border-[var(--terminal-border-hover)]
96
- placeholder:text-[var(--terminal-text-muted)]`,rt=de=>`p-4 rounded-lg border-2 cursor-pointer transition-all text-[var(--terminal-text)] ${de?"border-[var(--accent)] bg-[var(--accent)]/10":"border-[var(--terminal-border)] bg-[var(--hud-bg-alt)] hover:border-[var(--accent)]/50"}`;return o.jsx("div",{className:"h-full flex items-center justify-center",style:{background:"var(--floor-dark)"},onKeyDown:Ae,children:o.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:[o.jsxs("div",{className:"px-6 py-5",style:{background:"var(--terminal-bg)",borderBottom:"1px solid var(--terminal-border)"},children:[o.jsx("div",{className:"text-lg font-bold",style:{color:"var(--terminal-text)",fontFamily:"var(--pixel-font)"},children:"tycono"}),o.jsx("div",{className:"text-xs mt-1",style:{color:"var(--terminal-text-secondary)"},children:"Build an AI company. Watch them work."}),o.jsx("div",{className:"flex gap-1.5 mt-4",children:pt.map((de,Pe)=>o.jsxs("div",{className:"flex-1",children:[o.jsx("div",{className:"h-1 rounded-full transition-colors",style:{background:Pe<=l?"var(--accent)":"var(--terminal-surface-light)"}}),o.jsx("div",{className:"text-[9px] mt-1 truncate",style:{color:Pe===l?"var(--terminal-text)":"var(--terminal-text-muted)"},children:cN[de]})]},de))})]}),o.jsxs("div",{className:"px-6 py-5 min-h-[280px]",children:[St==="engine"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"AI Engine Setup"}),d?o.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-secondary)"},children:"Detecting AI engine..."}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:rt(u==="claude-cli"),onClick:()=>(i==null?void 0:i.claudeCli)&&f("claude-cli"),style:{opacity:i!=null&&i.claudeCli?1:.4},children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-lg",children:i!=null&&i.claudeCli?"✅":"❌"}),o.jsxs("div",{children:[o.jsx("div",{className:"font-medium text-sm",children:"Claude Code CLI"}),o.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"})]})]})}),o.jsxs("div",{className:rt(u==="direct-api"),onClick:()=>f("direct-api"),children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-lg",children:i!=null&&i.apiKey?"✅":"🔑"}),o.jsxs("div",{className:"flex-1",children:[o.jsx("div",{className:"font-medium text-sm",children:"Anthropic API Key (BYOK)"}),o.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)&&o.jsx("input",{type:"password",className:`${bt} mt-3`,placeholder:"sk-ant-...",value:m,onChange:de=>p(de.target.value),autoFocus:!0})]})]})]}),St==="company"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Company Info"}),o.jsxs("div",{children:[o.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"Company Name *"}),o.jsx("input",{ref:S,className:bt,placeholder:"e.g. Acme Corp",value:y,onChange:de=>b(de.target.value)})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"Description"}),o.jsx("textarea",{className:`${bt} resize-none`,rows:3,placeholder:"What does your AI company do?",value:v,onChange:de=>j(de.target.value)})]})]}),St==="project"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Project Setup"}),o.jsxs("div",{className:rt(C==="fresh"),onClick:()=>{E("fresh"),B(null)},children:[o.jsxs("div",{className:"font-medium text-sm",children:["🌱"," Start Fresh"]}),o.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Create a new AI company from scratch with clean directory structure."})]}),o.jsxs("div",{className:rt(C==="existing"),onClick:()=>E("existing"),children:[o.jsxs("div",{className:"font-medium text-sm",children:["📂"," Connect Existing Project"]}),o.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Add AI company structure to an existing codebase or knowledge base."}),C==="existing"&&o.jsxs("div",{className:"mt-3",onClick:de=>de.stopPropagation(),children:[o.jsxs("div",{className:"flex gap-2",children:[o.jsx("input",{className:`${bt} flex-1`,placeholder:"/path/to/your/project",value:A,onChange:de=>{R(de.target.value),B(null)},autoFocus:!0}),o.jsx("button",{onClick:()=>ee(!X),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:"📁"}),o.jsx("button",{onClick:qt,disabled:T||!A.trim(),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--accent)",color:"#fff",opacity:T||!A.trim()?.5:1},children:T?"...":"Verify"})]}),O===!0&&o.jsxs("div",{className:"text-xs mt-2",style:{color:"var(--active-green)"},children:["✅"," Path verified: ",A]}),O===!1&&o.jsxs("div",{className:"text-xs mt-2",style:{color:"#EF4444"},children:["❌"," Invalid path"]}),X&&o.jsx(_d,{onSelect:de=>{R(de),B(!0),ee(!1)},onClose:()=>ee(!1)})]})]})]}),St==="knowledge"&&o.jsxs("div",{className:"space-y-3",children:[o.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Knowledge Strategy"}),o.jsx("p",{className:"text-xs",style:{color:"var(--terminal-text-secondary)"},children:"How should AI handle your knowledge base?"}),o.jsxs("div",{className:rt(z==="skip"),onClick:()=>$("skip"),children:[o.jsxs("div",{className:"font-medium text-sm",children:["🌱"," Start Fresh"]}),o.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Empty knowledge base. Add documents later from the office."})]}),o.jsxs("div",{className:rt(z==="import"),onClick:()=>$("import"),children:[o.jsxs("div",{className:"font-medium text-sm",children:["📚"," Import & Build"]}),o.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Select folders with documents — AI reads, summarizes, and organizes them."}),z==="import"&&o.jsxs("div",{className:"mt-3 space-y-2",onClick:de=>de.stopPropagation(),children:[o.jsxs("div",{className:"flex gap-2",children:[o.jsx("input",{className:`${bt} flex-1`,placeholder:"/path/to/docs",value:re,onChange:de=>V(de.target.value),onKeyDown:de=>{de.key==="Enter"&&(de.preventDefault(),ye())},autoFocus:!0}),o.jsx("button",{onClick:()=>Q(!Y),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:"📁"}),o.jsx("button",{onClick:ye,disabled:!re.trim(),className:"px-3 py-2 rounded text-xs font-medium",style:{background:"var(--accent)",color:"#fff",opacity:re.trim()?1:.5},children:"Add"})]}),Y&&o.jsx(_d,{onSelect:de=>{U.includes(de)||ne([...U,de]),Q(!1)},onClose:()=>Q(!1)}),U.length>0&&o.jsx("div",{className:"space-y-1",children:U.map((de,Pe)=>o.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:[o.jsx("span",{className:"flex-1 truncate",style:{fontFamily:"var(--pixel-font)"},children:de}),o.jsx("button",{onClick:()=>ne(U.filter((dt,dn)=>dn!==Pe)),className:"opacity-50 hover:opacity-100",children:"✕"})]},Pe))}),U.length===0&&o.jsx("div",{className:"text-[10px] text-center py-2",style:{color:"var(--terminal-text-muted)"},children:"Add at least one folder to import."})]})]}),o.jsxs("div",{className:rt(z==="existing-akb"),onClick:()=>$("existing-akb"),children:[o.jsxs("div",{className:"font-medium text-sm",children:["🔗"," Connect Existing AKB"]}),o.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Connect a directory that already has CLAUDE.md and AKB structure."}),z==="existing-akb"&&o.jsxs("div",{className:"mt-3",onClick:de=>de.stopPropagation(),children:[o.jsxs("div",{className:"flex gap-2",children:[o.jsx("input",{className:`${bt} flex-1`,placeholder:"/path/to/your/akb",value:se,onChange:de=>{ve(de.target.value),_(null)},autoFocus:!0}),o.jsx("button",{onClick:()=>Ce(!pe),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:"📁"}),o.jsx("button",{onClick:ae,disabled:J||!se.trim(),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--accent)",color:"#fff",opacity:J||!se.trim()?.5:1},children:J?"...":"Verify"})]}),M===!0&&o.jsxs("div",{className:"text-xs mt-2",style:{color:"var(--active-green)"},children:["✅"," Valid AKB found: ",se]}),M===!1&&o.jsxs("div",{className:"text-xs mt-2",style:{color:"#EF4444"},children:["❌"," No valid AKB (CLAUDE.md required)"]}),pe&&o.jsx(_d,{onSelect:de=>{ve(de),_(null),Ce(!1)},onClose:()=>Ce(!1)})]})]})]}),St==="team"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Team Template"}),o.jsx("p",{className:"text-xs",style:{color:"var(--terminal-text-secondary)"},children:"Choose a starting team. You can add or remove roles later."}),Ne.map(de=>o.jsxs("div",{className:rt(_e===de.id),onClick:()=>oe(de.id),children:[o.jsx("div",{className:"font-medium text-sm capitalize",children:de.id}),o.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:de.roles.map(Pe=>o.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:Pe.name},Pe.id))})]},de.id)),o.jsxs("div",{className:rt(_e==="custom"),onClick:()=>oe("custom"),children:[o.jsx("div",{className:"font-medium text-sm",children:"Custom"}),o.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Start with no pre-built roles. Hire them from the office."})]})]}),St==="create"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:Se?z==="existing-akb"?"AKB Connected!":"Company Created!":"Review & Create"}),!Se&&!K&&!$e&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"rounded-lg p-4 space-y-2 text-xs",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)",fontFamily:"var(--pixel-font)"},children:z==="existing-akb"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("span",{className:"opacity-50",children:"Mode:"})," Connect Existing AKB"]}),o.jsxs("div",{children:[o.jsx("span",{className:"opacity-50",children:"Path:"})," ",se]}),o.jsxs("div",{children:[o.jsx("span",{className:"opacity-50",children:"Engine:"})," ",u==="claude-cli"?"Claude Code CLI":"Direct API"]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("span",{className:"opacity-50",children:"Company:"})," ",y]}),o.jsxs("div",{children:[o.jsx("span",{className:"opacity-50",children:"Engine:"})," ",u==="claude-cli"?"Claude Code CLI":"Direct API"]}),o.jsxs("div",{children:[o.jsx("span",{className:"opacity-50",children:"Project:"})," ",C==="fresh"?"Start Fresh":`Existing (${A})`]}),o.jsxs("div",{children:[o.jsx("span",{className:"opacity-50",children:"Knowledge:"})," ",z==="skip"?"Fresh (empty)":`Import ${U.length} source(s)`]}),o.jsxs("div",{children:[o.jsx("span",{className:"opacity-50",children:"Team:"})," ",_e]}),z==="import"&&U.length>0&&o.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--idle-amber)"},children:"Knowledge import will run in the background after entering the office."})]})}),ke&&o.jsx("div",{className:"text-xs p-3 rounded",style:{background:"rgba(220,38,38,0.15)",color:"#f87171"},children:ke})]}),(K||$e)&&o.jsxs("div",{className:"flex flex-col items-center py-8 gap-3",children:[o.jsx("div",{className:"w-8 h-8 border-2 rounded-full animate-spin",style:{borderColor:"var(--terminal-border)",borderTopColor:"var(--accent)"}}),o.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-secondary)"},children:$e?"Connecting to AKB...":"Scaffolding your company..."})]}),Se&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"text-center py-4 text-4xl",children:"🏢"}),o.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:Te.map((de,Pe)=>o.jsxs("div",{className:"py-0.5",children:[o.jsx("span",{style:{color:"var(--active-green)"},children:"✓"})," ",de]},Pe))}),z==="import"&&U.length>0&&o.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."})]})]})]}),o.jsxs("div",{className:"px-6 py-4 flex justify-between items-center",style:{borderTop:"1px solid var(--terminal-border)"},children:[o.jsx("div",{children:l>0&&!Se&&o.jsx("button",{onClick:vt,className:"px-4 py-2 rounded text-sm transition-colors",style:{color:"var(--terminal-text-secondary)",border:"1px solid var(--terminal-border)"},children:"Back"})}),o.jsxs("div",{className:"text-xs",style:{color:"var(--terminal-text-muted)"},children:[l+1," / ",pt.length]}),o.jsx("div",{children:Se?o.jsx("button",{onClick:we,className:"px-5 py-2 rounded text-sm font-medium transition-colors",style:{background:"var(--active-green)",color:"#fff"},children:"Enter Office"}):o.jsx("button",{onClick:Kt,disabled:!Bt()||K||$e,className:"px-5 py-2 rounded text-sm font-medium transition-colors",style:{background:Bt()?"var(--accent)":"var(--terminal-border)",color:"#fff",opacity:Bt()&&!K&&!$e?1:.5},children:St==="create"?K||$e?$e?"Connecting...":"Creating...":z==="existing-akb"?"Connect AKB":"Create Company":"Next"})})]})]})})}function fN(){const[t,l]=k.useState(null),[r,i]=k.useState(!0),[c,u]=k.useState(null),f=k.useCallback(async()=>{i(!0),u(null);try{const m=await Ee.getStatus();l(m)}catch(m){u(m instanceof Error?m.message:"Failed to fetch status")}finally{i(!1)}},[]);return k.useEffect(()=>{f()},[f]),{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:f}}const dN=k.lazy(()=>Zb(()=>import("./preview-app-BR4p4AQ9.js"),[]));function Fg(){return o.jsx("div",{className:"h-full flex items-center justify-center",style:{background:"var(--floor-dark)"},children:o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"w-10 h-10 mx-auto border-2 rounded-full animate-spin",style:{borderColor:"var(--terminal-border)",borderTopColor:"var(--accent)"}}),o.jsx("div",{className:"mt-4 text-sm",style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},children:"Loading..."})]})})}function hN(){var t;try{const l=localStorage.getItem("tycono-theme")||localStorage.getItem("the-company-theme"),r=l&&l in $r?l:"default",i=(t=$r[r])==null?void 0:t.vars;if(!i)return;const c=document.documentElement;for(const[u,f]of Object.entries(i))c.style.setProperty(u,f)}catch{}}function mN(){const{initialized:t,loading:l,refetch:r}=fN(),[i,c]=k.useState(null);k.useEffect(()=>{hN()},[]);const u=f=>{f&&c(f),r()};return l?o.jsx(Fg,{}):t?o.jsx(oN,{importJob:i,onImportDone:()=>c(null)}):o.jsx(uN,{onComplete:u})}function xN(){const t=new URLSearchParams(window.location.search).has("sprite-preview");return o.jsx(Jb,{children:t?o.jsx(k.Suspense,{fallback:o.jsx(Fg,{}),children:o.jsx(dN,{})}):o.jsx(mN,{})})}Kb.createRoot(document.getElementById("root")).render(o.jsx(k.StrictMode,{children:o.jsx(xN,{})}));export{xg as H,yg as P,gg as S,gN as a,pg as b,mg as c,Kd as d,DS as e,AS as f,yN as g,TS as h,o as j,k as r};