tycono 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/api/package.json +4 -5
- package/src/api/src/create-server.ts +57 -49
- package/src/api/src/engine/context-assembler.ts +46 -20
- package/src/api/src/engine/llm-adapter.ts +73 -0
- package/src/api/src/engine/runners/claude-cli.ts +8 -2
- package/src/api/src/routes/cost.ts +98 -0
- package/src/api/src/routes/execute.ts +16 -9
- package/src/api/src/routes/setup.ts +33 -4
- package/src/api/src/routes/speech.ts +206 -111
- package/src/api/src/services/company-config.ts +1 -0
- package/src/api/src/services/job-manager.ts +8 -0
- package/src/api/src/services/preferences.ts +13 -0
- package/src/web/dist/assets/index-DkB5qeA8.css +1 -0
- package/src/web/dist/assets/index-ZYrhS4zS.js +95 -0
- package/src/web/dist/assets/{preview-app-a8V0eihg.js → preview-app-OwehBXPG.js} +1 -1
- package/src/web/dist/index.html +2 -2
- package/templates/CLAUDE.md.tmpl +77 -0
- package/src/web/dist/assets/index-Ct9pM1_i.js +0 -90
- package/src/web/dist/assets/index-Dy8nGrfX.css +0 -1
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
var ob=Object.defineProperty;var cb=(t,l,r)=>l in t?ob(t,l,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[l]=r;var Lp=(t,l,r)=>cb(t,typeof l!="symbol"?l+"":l,r);(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const u of o)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(o){const u={};return o.integrity&&(u.integrity=o.integrity),o.referrerPolicy&&(u.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?u.credentials="include":o.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function i(o){if(o.ep)return;o.ep=!0;const u=r(o);fetch(o.href,u)}})();function y0(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Nf={exports:{}},qi={};/**
|
|
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 Hp;function ub(){if(Hp)return qi;Hp=1;var t=Symbol.for("react.transitional.element"),l=Symbol.for("react.fragment");function r(i,o,u){var f=null;if(u!==void 0&&(f=""+u),o.key!==void 0&&(f=""+o.key),"key"in o){u={};for(var m in o)m!=="key"&&(u[m]=o[m])}else u=o;return o=u.ref,{$$typeof:t,type:i,key:f,ref:o!==void 0?o:null,props:u}}return qi.Fragment=l,qi.jsx=r,qi.jsxs=r,qi}var Up;function fb(){return Up||(Up=1,Nf.exports=ub()),Nf.exports}var c=fb(),Af={exports:{}},Le={};/**
|
|
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 Ip;function db(){if(Ip)return Le;Ip=1;var t=Symbol.for("react.transitional.element"),l=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=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"),h=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),b=Symbol.iterator;function v(M){return M===null||typeof M!="object"?null:(M=b&&M[b]||M["@@iterator"],typeof M=="function"?M:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,N={};function E(M,K,A){this.props=M,this.context=K,this.refs=N,this.updater=A||k}E.prototype.isReactComponent={},E.prototype.setState=function(M,K){if(typeof M!="object"&&typeof M!="function"&&M!=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,M,K,"setState")},E.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function _(){}_.prototype=E.prototype;function H(M,K,A){this.props=M,this.context=K,this.refs=N,this.updater=A||k}var B=H.prototype=new _;B.constructor=H,S(B,E.prototype),B.isPureReactComponent=!0;var $=Array.isArray;function T(){}var X={H:null,A:null,T:null,S:null},G=Object.prototype.hasOwnProperty;function ee(M,K,A){var oe=A.ref;return{$$typeof:t,type:M,key:K,ref:oe!==void 0?oe:null,props:A}}function D(M,K){return ee(M.type,K,M.props)}function Y(M){return typeof M=="object"&&M!==null&&M.$$typeof===t}function I(M){var K={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(A){return K[A]})}var ne=/\/+/g;function le(M,K){return typeof M=="object"&&M!==null&&M.key!=null?I(""+M.key):K.toString(36)}function L(M){switch(M.status){case"fulfilled":return M.value;case"rejected":throw M.reason;default:switch(typeof M.status=="string"?M.then(T,T):(M.status="pending",M.then(function(K){M.status==="pending"&&(M.status="fulfilled",M.value=K)},function(K){M.status==="pending"&&(M.status="rejected",M.reason=K)})),M.status){case"fulfilled":return M.value;case"rejected":throw M.reason}}throw M}function F(M,K,A,oe,be){var ve=typeof M;(ve==="undefined"||ve==="boolean")&&(M=null);var Ne=!1;if(M===null)Ne=!0;else switch(ve){case"bigint":case"string":case"number":Ne=!0;break;case"object":switch(M.$$typeof){case t:case l:Ne=!0;break;case g:return Ne=M._init,F(Ne(M._payload),K,A,oe,be)}}if(Ne)return be=be(M),Ne=oe===""?"."+le(M,0):oe,$(be)?(A="",Ne!=null&&(A=Ne.replace(ne,"$&/")+"/"),F(be,K,A,"",function(me){return me})):be!=null&&(Y(be)&&(be=D(be,A+(be.key==null||M&&M.key===be.key?"":(""+be.key).replace(ne,"$&/")+"/")+Ne)),K.push(be)),1;Ne=0;var Oe=oe===""?".":oe+":";if($(M))for(var Be=0;Be<M.length;Be++)oe=M[Be],ve=Oe+le(oe,Be),Ne+=F(oe,K,A,ve,be);else if(Be=v(M),typeof Be=="function")for(M=Be.call(M),Be=0;!(oe=M.next()).done;)oe=oe.value,ve=Oe+le(oe,Be++),Ne+=F(oe,K,A,ve,be);else if(ve==="object"){if(typeof M.then=="function")return F(L(M),K,A,oe,be);throw K=String(M),Error("Objects are not valid as a React child (found: "+(K==="[object Object]"?"object with keys {"+Object.keys(M).join(", ")+"}":K)+"). If you meant to render a collection of children, use an array instead.")}return Ne}function V(M,K,A){if(M==null)return M;var oe=[],be=0;return F(M,oe,"","",function(ve){return K.call(A,ve,be++)}),oe}function P(M){if(M._status===-1){var K=M._result;K=K(),K.then(function(A){(M._status===0||M._status===-1)&&(M._status=1,M._result=A)},function(A){(M._status===0||M._status===-1)&&(M._status=2,M._result=A)}),M._status===-1&&(M._status=0,M._result=K)}if(M._status===1)return M._result.default;throw M._result}var fe=typeof reportError=="function"?reportError:function(M){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var K=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof M=="object"&&M!==null&&typeof M.message=="string"?String(M.message):String(M),error:M});if(!window.dispatchEvent(K))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",M);return}console.error(M)},z={map:V,forEach:function(M,K,A){V(M,function(){K.apply(this,arguments)},A)},count:function(M){var K=0;return V(M,function(){K++}),K},toArray:function(M){return V(M,function(K){return K})||[]},only:function(M){if(!Y(M))throw Error("React.Children.only expected to receive a single React element child.");return M}};return Le.Activity=y,Le.Children=z,Le.Component=E,Le.Fragment=r,Le.Profiler=o,Le.PureComponent=H,Le.StrictMode=i,Le.Suspense=p,Le.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=X,Le.__COMPILER_RUNTIME={__proto__:null,c:function(M){return X.H.useMemoCache(M)}},Le.cache=function(M){return function(){return M.apply(null,arguments)}},Le.cacheSignal=function(){return null},Le.cloneElement=function(M,K,A){if(M==null)throw Error("The argument must be a React element, but you passed "+M+".");var oe=S({},M.props),be=M.key;if(K!=null)for(ve in K.key!==void 0&&(be=""+K.key),K)!G.call(K,ve)||ve==="key"||ve==="__self"||ve==="__source"||ve==="ref"&&K.ref===void 0||(oe[ve]=K[ve]);var ve=arguments.length-2;if(ve===1)oe.children=A;else if(1<ve){for(var Ne=Array(ve),Oe=0;Oe<ve;Oe++)Ne[Oe]=arguments[Oe+2];oe.children=Ne}return ee(M.type,be,oe)},Le.createContext=function(M){return M={$$typeof:f,_currentValue:M,_currentValue2:M,_threadCount:0,Provider:null,Consumer:null},M.Provider=M,M.Consumer={$$typeof:u,_context:M},M},Le.createElement=function(M,K,A){var oe,be={},ve=null;if(K!=null)for(oe in K.key!==void 0&&(ve=""+K.key),K)G.call(K,oe)&&oe!=="key"&&oe!=="__self"&&oe!=="__source"&&(be[oe]=K[oe]);var Ne=arguments.length-2;if(Ne===1)be.children=A;else if(1<Ne){for(var Oe=Array(Ne),Be=0;Be<Ne;Be++)Oe[Be]=arguments[Be+2];be.children=Oe}if(M&&M.defaultProps)for(oe in Ne=M.defaultProps,Ne)be[oe]===void 0&&(be[oe]=Ne[oe]);return ee(M,ve,be)},Le.createRef=function(){return{current:null}},Le.forwardRef=function(M){return{$$typeof:m,render:M}},Le.isValidElement=Y,Le.lazy=function(M){return{$$typeof:g,_payload:{_status:-1,_result:M},_init:P}},Le.memo=function(M,K){return{$$typeof:h,type:M,compare:K===void 0?null:K}},Le.startTransition=function(M){var K=X.T,A={};X.T=A;try{var oe=M(),be=X.S;be!==null&&be(A,oe),typeof oe=="object"&&oe!==null&&typeof oe.then=="function"&&oe.then(T,fe)}catch(ve){fe(ve)}finally{K!==null&&A.types!==null&&(K.types=A.types),X.T=K}},Le.unstable_useCacheRefresh=function(){return X.H.useCacheRefresh()},Le.use=function(M){return X.H.use(M)},Le.useActionState=function(M,K,A){return X.H.useActionState(M,K,A)},Le.useCallback=function(M,K){return X.H.useCallback(M,K)},Le.useContext=function(M){return X.H.useContext(M)},Le.useDebugValue=function(){},Le.useDeferredValue=function(M,K){return X.H.useDeferredValue(M,K)},Le.useEffect=function(M,K){return X.H.useEffect(M,K)},Le.useEffectEvent=function(M){return X.H.useEffectEvent(M)},Le.useId=function(){return X.H.useId()},Le.useImperativeHandle=function(M,K,A){return X.H.useImperativeHandle(M,K,A)},Le.useInsertionEffect=function(M,K){return X.H.useInsertionEffect(M,K)},Le.useLayoutEffect=function(M,K){return X.H.useLayoutEffect(M,K)},Le.useMemo=function(M,K){return X.H.useMemo(M,K)},Le.useOptimistic=function(M,K){return X.H.useOptimistic(M,K)},Le.useReducer=function(M,K,A){return X.H.useReducer(M,K,A)},Le.useRef=function(M){return X.H.useRef(M)},Le.useState=function(M){return X.H.useState(M)},Le.useSyncExternalStore=function(M,K,A){return X.H.useSyncExternalStore(M,K,A)},Le.useTransition=function(){return X.H.useTransition()},Le.version="19.2.4",Le}var Yp;function _d(){return Yp||(Yp=1,Af.exports=db()),Af.exports}var j=_d(),Df={exports:{}},Xi={},Tf={exports:{}},zf={};/**
|
|
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 qp;function hb(){return qp||(qp=1,(function(t){function l(F,V){var P=F.length;F.push(V);e:for(;0<P;){var fe=P-1>>>1,z=F[fe];if(0<o(z,V))F[fe]=V,F[P]=z,P=fe;else break e}}function r(F){return F.length===0?null:F[0]}function i(F){if(F.length===0)return null;var V=F[0],P=F.pop();if(P!==V){F[0]=P;e:for(var fe=0,z=F.length,M=z>>>1;fe<M;){var K=2*(fe+1)-1,A=F[K],oe=K+1,be=F[oe];if(0>o(A,P))oe<z&&0>o(be,A)?(F[fe]=be,F[oe]=P,fe=oe):(F[fe]=A,F[K]=P,fe=K);else if(oe<z&&0>o(be,P))F[fe]=be,F[oe]=P,fe=oe;else break e}}return V}function o(F,V){var P=F.sortIndex-V.sortIndex;return P!==0?P:F.id-V.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=[],h=[],g=1,y=null,b=3,v=!1,k=!1,S=!1,N=!1,E=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,H=typeof setImmediate<"u"?setImmediate:null;function B(F){for(var V=r(h);V!==null;){if(V.callback===null)i(h);else if(V.startTime<=F)i(h),V.sortIndex=V.expirationTime,l(p,V);else break;V=r(h)}}function $(F){if(S=!1,B(F),!k)if(r(p)!==null)k=!0,T||(T=!0,I());else{var V=r(h);V!==null&&L($,V.startTime-F)}}var T=!1,X=-1,G=5,ee=-1;function D(){return N?!0:!(t.unstable_now()-ee<G)}function Y(){if(N=!1,T){var F=t.unstable_now();ee=F;var V=!0;try{e:{k=!1,S&&(S=!1,_(X),X=-1),v=!0;var P=b;try{t:{for(B(F),y=r(p);y!==null&&!(y.expirationTime>F&&D());){var fe=y.callback;if(typeof fe=="function"){y.callback=null,b=y.priorityLevel;var z=fe(y.expirationTime<=F);if(F=t.unstable_now(),typeof z=="function"){y.callback=z,B(F),V=!0;break t}y===r(p)&&i(p),B(F)}else i(p);y=r(p)}if(y!==null)V=!0;else{var M=r(h);M!==null&&L($,M.startTime-F),V=!1}}break e}finally{y=null,b=P,v=!1}V=void 0}}finally{V?I():T=!1}}}var I;if(typeof H=="function")I=function(){H(Y)};else if(typeof MessageChannel<"u"){var ne=new MessageChannel,le=ne.port2;ne.port1.onmessage=Y,I=function(){le.postMessage(null)}}else I=function(){E(Y,0)};function L(F,V){X=E(function(){F(t.unstable_now())},V)}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(F){F.callback=null},t.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):G=0<F?Math.floor(1e3/F):5},t.unstable_getCurrentPriorityLevel=function(){return b},t.unstable_next=function(F){switch(b){case 1:case 2:case 3:var V=3;break;default:V=b}var P=b;b=V;try{return F()}finally{b=P}},t.unstable_requestPaint=function(){N=!0},t.unstable_runWithPriority=function(F,V){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var P=b;b=F;try{return V()}finally{b=P}},t.unstable_scheduleCallback=function(F,V,P){var fe=t.unstable_now();switch(typeof P=="object"&&P!==null?(P=P.delay,P=typeof P=="number"&&0<P?fe+P:fe):P=fe,F){case 1:var z=-1;break;case 2:z=250;break;case 5:z=1073741823;break;case 4:z=1e4;break;default:z=5e3}return z=P+z,F={id:g++,callback:V,priorityLevel:F,startTime:P,expirationTime:z,sortIndex:-1},P>fe?(F.sortIndex=P,l(h,F),r(p)===null&&F===r(h)&&(S?(_(X),X=-1):S=!0,L($,P-fe))):(F.sortIndex=z,l(p,F),k||v||(k=!0,T||(T=!0,I()))),F},t.unstable_shouldYield=D,t.unstable_wrapCallback=function(F){var V=b;return function(){var P=b;b=V;try{return F.apply(this,arguments)}finally{b=P}}}})(zf)),zf}var Xp;function mb(){return Xp||(Xp=1,Tf.exports=hb()),Tf.exports}var Mf={exports:{}},cn={};/**
|
|
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 Vp;function xb(){if(Vp)return cn;Vp=1;var t=_d();function l(p){var h="https://react.dev/errors/"+p;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)h+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+p+"; visit "+h+" 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},o=Symbol.for("react.portal");function u(p,h,g){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:y==null?null:""+y,children:p,containerInfo:h,implementation:g}}var f=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(p,h){if(p==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return cn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,cn.createPortal=function(p,h){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(l(299));return u(p,h,null,g)},cn.flushSync=function(p){var h=f.T,g=i.p;try{if(f.T=null,i.p=2,p)return p()}finally{f.T=h,i.p=g,i.d.f()}},cn.preconnect=function(p,h){typeof p=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,i.d.C(p,h))},cn.prefetchDNS=function(p){typeof p=="string"&&i.d.D(p)},cn.preinit=function(p,h){if(typeof p=="string"&&h&&typeof h.as=="string"){var g=h.as,y=m(g,h.crossOrigin),b=typeof h.integrity=="string"?h.integrity:void 0,v=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;g==="style"?i.d.S(p,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:y,integrity:b,fetchPriority:v}):g==="script"&&i.d.X(p,{crossOrigin:y,integrity:b,fetchPriority:v,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},cn.preinitModule=function(p,h){if(typeof p=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var g=m(h.as,h.crossOrigin);i.d.M(p,{crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&i.d.M(p)},cn.preload=function(p,h){if(typeof p=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var g=h.as,y=m(g,h.crossOrigin);i.d.L(p,g,{crossOrigin:y,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},cn.preloadModule=function(p,h){if(typeof p=="string")if(h){var g=m(h.as,h.crossOrigin);i.d.m(p,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else i.d.m(p)},cn.requestFormReset=function(p){i.d.r(p)},cn.unstable_batchedUpdates=function(p,h){return p(h)},cn.useFormState=function(p,h,g){return f.H.useFormState(p,h,g)},cn.useFormStatus=function(){return f.H.useHostTransitionStatus()},cn.version="19.2.4",cn}var Gp;function pb(){if(Gp)return Mf.exports;Gp=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(),Mf.exports=xb(),Mf.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 Kp;function yb(){if(Kp)return Xi;Kp=1;var t=mb(),l=_d(),r=pb();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 o(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 h(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 d=a.return;if(d===null)break;var x=d.alternate;if(x===null){if(s=d.return,s!==null){a=s;continue}break}if(d.child===x.child){for(x=d.child;x;){if(x===a)return p(d),e;if(x===s)return p(d),n;x=x.sibling}throw Error(i(188))}if(a.return!==s.return)a=d,s=x;else{for(var w=!1,C=d.child;C;){if(C===a){w=!0,a=d,s=x;break}if(C===s){w=!0,s=d,a=x;break}C=C.sibling}if(!w){for(C=x.child;C;){if(C===a){w=!0,a=x,s=d;break}if(C===s){w=!0,s=x,a=d;break}C=C.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"),k=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),_=Symbol.for("react.consumer"),H=Symbol.for("react.context"),B=Symbol.for("react.forward_ref"),$=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),X=Symbol.for("react.memo"),G=Symbol.for("react.lazy"),ee=Symbol.for("react.activity"),D=Symbol.for("react.memo_cache_sentinel"),Y=Symbol.iterator;function I(e){return e===null||typeof e!="object"?null:(e=Y&&e[Y]||e["@@iterator"],typeof e=="function"?e:null)}var ne=Symbol.for("react.client.reference");function le(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 N:return"StrictMode";case $:return"Suspense";case T:return"SuspenseList";case ee:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case k:return"Portal";case H:return e.displayName||"Context";case _:return(e._context.displayName||"Context")+".Consumer";case B:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case X:return n=e.displayName||null,n!==null?n:le(e.type)||"Memo";case G:n=e._payload,e=e._init;try{return le(e(n))}catch{}}return null}var L=Array.isArray,F=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P={pending:!1,data:null,method:null,action:null},fe=[],z=-1;function M(e){return{current:e}}function K(e){0>z||(e.current=fe[z],fe[z]=null,z--)}function A(e,n){z++,fe[z]=e.current,e.current=n}var oe=M(null),be=M(null),ve=M(null),Ne=M(null);function Oe(e,n){switch(A(ve,n),A(be,e),A(oe,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?op(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=op(n),e=cp(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}K(oe),A(oe,e)}function Be(){K(oe),K(be),K(ve)}function me(e){e.memoizedState!==null&&A(Ne,e);var n=oe.current,a=cp(n,e.type);n!==a&&(A(be,e),A(oe,a))}function Ve(e){be.current===e&&(K(oe),K(be)),Ne.current===e&&(K(Ne),Hi._currentValue=P)}var Ge,de;function Ee(e){if(Ge===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);Ge=n&&n[1]||"",de=-1<a.stack.indexOf(`
|
|
42
|
+
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
+
`+Ge+e+de}var nt=!1;function nn(e,n){if(!e||nt)return"";nt=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(n){var se=function(){throw Error()};if(Object.defineProperty(se.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(se,[])}catch(te){var J=te}Reflect.construct(e,[],se)}else{try{se.call()}catch(te){J=te}e.call(se.prototype)}}else{try{throw Error()}catch(te){J=te}(se=e())&&typeof se.catch=="function"&&se.catch(function(){})}}catch(te){if(te&&J&&typeof te.stack=="string")return[te.stack,J.stack]}return[null,null]}};s.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var d=Object.getOwnPropertyDescriptor(s.DetermineComponentFrameRoot,"name");d&&d.configurable&&Object.defineProperty(s.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=s.DetermineComponentFrameRoot(),w=x[0],C=x[1];if(w&&C){var O=w.split(`
|
|
44
|
+
`),W=C.split(`
|
|
45
|
+
`);for(d=s=0;s<O.length&&!O[s].includes("DetermineComponentFrameRoot");)s++;for(;d<W.length&&!W[d].includes("DetermineComponentFrameRoot");)d++;if(s===O.length||d===W.length)for(s=O.length-1,d=W.length-1;1<=s&&0<=d&&O[s]!==W[d];)d--;for(;1<=s&&0<=d;s--,d--)if(O[s]!==W[d]){if(s!==1||d!==1)do if(s--,d--,0>d||O[s]!==W[d]){var re=`
|
|
46
|
+
`+O[s].replace(" at new "," at ");return e.displayName&&re.includes("<anonymous>")&&(re=re.replace("<anonymous>",e.displayName)),re}while(1<=s&&0<=d);break}}}finally{nt=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?Ee(a):""}function Et(e,n){switch(e.tag){case 26:case 27:case 5:return Ee(e.type);case 16:return Ee("Lazy");case 13:return e.child!==n&&n!==null?Ee("Suspense Fallback"):Ee("Suspense");case 19:return Ee("SuspenseList");case 0:case 15:return nn(e.type,!1);case 11:return nn(e.type.render,!1);case 1:return nn(e.type,!0);case 31:return Ee("Activity");default:return""}}function Jt(e){try{var n="",a=null;do n+=Et(e,a),a=e,e=e.return;while(e);return n}catch(s){return`
|
|
47
|
+
Error generating stack: `+s.message+`
|
|
48
|
+
`+s.stack}}var Lt=Object.prototype.hasOwnProperty,on=t.unstable_scheduleCallback,Ct=t.unstable_cancelCallback,_t=t.unstable_shouldYield,$n=t.unstable_requestPaint,Ft=t.unstable_now,Ln=t.unstable_getCurrentPriorityLevel,ae=t.unstable_ImmediatePriority,xe=t.unstable_UserBlockingPriority,De=t.unstable_NormalPriority,he=t.unstable_LowPriority,ye=t.unstable_IdlePriority,at=t.log,mt=t.unstable_setDisableYieldValue,Ye=null,ce=null;function Ae(e){if(typeof at=="function"&&mt(e),ce&&typeof ce.setStrictMode=="function")try{ce.setStrictMode(Ye,e)}catch{}}var rt=Math.clz32?Math.clz32:Qr,yn=Math.log,Pt=Math.LN2;function Qr(e){return e>>>=0,e===0?32:31-(yn(e)/Pt|0)|0}var Wn=256,Jn=262144,Pn=4194304;function sl(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 el(e,n,a){var s=e.pendingLanes;if(s===0)return 0;var d=0,x=e.suspendedLanes,w=e.pingedLanes;e=e.warmLanes;var C=s&134217727;return C!==0?(s=C&~x,s!==0?d=sl(s):(w&=C,w!==0?d=sl(w):a||(a=C&~e,a!==0&&(d=sl(a))))):(C=s&~x,C!==0?d=sl(C):w!==0?d=sl(w):a||(a=s&~e,a!==0&&(d=sl(a)))),d===0?0:n!==0&&n!==d&&(n&x)===0&&(x=d&-d,a=n&-n,x>=a||x===32&&(a&4194048)!==0)?n:d}function ql(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function bs(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 Pa(){var e=Pn;return Pn<<=1,(Pn&62914560)===0&&(Pn=4194304),e}function er(e){for(var n=[],a=0;31>a;a++)n.push(e);return n}function Nn(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Zr(e,n,a,s,d,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 C=e.entanglements,O=e.expirationTimes,W=e.hiddenUpdates;for(a=w&~a;0<a;){var re=31-rt(a),se=1<<re;C[re]=0,O[re]=-1;var J=W[re];if(J!==null)for(W[re]=null,re=0;re<J.length;re++){var te=J[re];te!==null&&(te.lane&=-536870913)}a&=~se}s!==0&&Wr(e,s,0),x!==0&&d===0&&e.tag!==0&&(e.suspendedLanes|=x&~(w&~n))}function Wr(e,n,a){e.pendingLanes|=n,e.suspendedLanes&=~n;var s=31-rt(n);e.entangledLanes|=n,e.entanglements[s]=e.entanglements[s]|1073741824|a&261930}function Jr(e,n){var a=e.entangledLanes|=n;for(e=e.entanglements;a;){var s=31-rt(a),d=1<<s;d&n|e[s]&n&&(e[s]|=n),a&=~d}}function vs(e,n){var a=n&-n;return a=(a&42)!==0?1:Na(a),(a&(e.suspendedLanes|n))!==0?0:a}function Na(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 gn(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function wl(){var e=V.p;return e!==0?e:(e=window.event,e===void 0?32:Mp(e.type))}function Xl(e,n){var a=V.p;try{return V.p=e,n()}finally{V.p=a}}var ol=Math.random().toString(36).slice(2),Rt="__reactFiber$"+ol,xt="__reactProps$"+ol,tl="__reactContainer$"+ol,An="__reactEvents$"+ol,ws="__reactListeners$"+ol,Pr="__reactHandles$"+ol,ks="__reactResources$"+ol,nl="__reactMarker$"+ol;function ei(e){delete e[Rt],delete e[xt],delete e[An],delete e[ws],delete e[Pr]}function Tt(e){var n=e[Rt];if(n)return n;for(var a=e.parentNode;a;){if(n=a[tl]||a[Rt]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(e=pp(e);e!==null;){if(a=e[Rt])return a;e=pp(e)}return n}e=a,a=e.parentNode}return null}function Vl(e){if(e=e[Rt]||e[tl]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function Aa(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(i(33))}function kl(e){var n=e[ks];return n||(n=e[ks]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Ot(e){e[nl]=!0}var Ss=new Set,js={};function cl(e,n){Gl(e,n),Gl(e+"Capture",n)}function Gl(e,n){for(js[e]=n,e=0;e<n.length;e++)Ss.add(n[e])}var bc=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]*$"),Es={},Cs={};function vc(e){return Lt.call(Cs,e)?!0:Lt.call(Es,e)?!1:bc.test(e)?Cs[e]=!0:(Es[e]=!0,!1)}function tr(e,n,a){if(vc(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 nr(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 en(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 dn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ns(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function wc(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 d=s.get,x=s.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return d.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 Hn(e){if(!e._valueTracker){var n=Ns(e)?"checked":"value";e._valueTracker=wc(e,n,""+e[n])}}function ti(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var a=n.getValue(),s="";return e&&(s=Ns(e)?e.checked?"true":"false":e.value),e=s,e!==a?(n.setValue(e),!0):!1}function lr(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 kc=/[\n"\\]/g;function pt(e){return e.replace(kc,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function Sl(e,n,a,s,d,x,w,C){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=""+dn(n)):e.value!==""+dn(n)&&(e.value=""+dn(n)):w!=="submit"&&w!=="reset"||e.removeAttribute("value"),n!=null?ar(e,w,dn(n)):a!=null?ar(e,w,dn(a)):s!=null&&e.removeAttribute("value"),d==null&&x!=null&&(e.defaultChecked=!!x),d!=null&&(e.checked=d&&typeof d!="function"&&typeof d!="symbol"),C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?e.name=""+dn(C):e.removeAttribute("name")}function ni(e,n,a,s,d,x,w,C){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)){Hn(e);return}a=a!=null?""+dn(a):"",n=n!=null?""+dn(n):a,C||n===e.value||(e.value=n),e.defaultValue=n}s=s??d,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=C?e.checked:!!s,e.defaultChecked=!!s,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(e.name=w),Hn(e)}function ar(e,n,a){n==="number"&&lr(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function jl(e,n,a,s){if(e=e.options,n){n={};for(var d=0;d<a.length;d++)n["$"+a[d]]=!0;for(a=0;a<e.length;a++)d=n.hasOwnProperty("$"+e[a].value),e[a].selected!==d&&(e[a].selected=d),d&&s&&(e[a].defaultSelected=!0)}else{for(a=""+dn(a),n=null,d=0;d<e.length;d++){if(e[d].value===a){e[d].selected=!0,s&&(e[d].defaultSelected=!0);return}n!==null||e[d].disabled||(n=e[d])}n!==null&&(n.selected=!0)}}function U(e,n,a){if(n!=null&&(n=""+dn(n),n!==e.value&&(e.value=n),a==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=a!=null?""+dn(a):""}function ue(e,n,a,s){if(n==null){if(s!=null){if(a!=null)throw Error(i(92));if(L(s)){if(1<s.length)throw Error(i(93));s=s[0]}a=s}a==null&&(a=""),n=a}a=dn(n),e.defaultValue=a,s=e.textContent,s===a&&s!==""&&s!==null&&(e.value=s),Hn(e)}function ge(e,n){if(n){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=n;return}}e.textContent=n}var ke=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function we(e,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||ke.has(n)?n==="float"?e.cssFloat=a:e[n]=(""+a).trim():e[n]=a+"px"}function ze(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 d in n)s=n[d],n.hasOwnProperty(d)&&a[d]!==s&&we(e,d,s)}else for(var x in n)n.hasOwnProperty(x)&&we(e,x,n[x])}function Re(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 We=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"]]),it=/^[\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 $e(e){return it.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ht(){}var Sc=null;function jc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var rr=null,ir=null;function sh(e){var n=Vl(e);if(n&&(e=n.stateNode)){var a=e[xt]||null;e:switch(e=n.stateNode,n.type){case"input":if(Sl(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="'+pt(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var s=a[n];if(s!==e&&s.form===e.form){var d=s[xt]||null;if(!d)throw Error(i(90));Sl(s,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name)}}for(n=0;n<a.length;n++)s=a[n],s.form===e.form&&ti(s)}break e;case"textarea":U(e,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&jl(e,!!a.multiple,n,!1)}}}var Ec=!1;function oh(e,n,a){if(Ec)return e(n,a);Ec=!0;try{var s=e(n);return s}finally{if(Ec=!1,(rr!==null||ir!==null)&&(xo(),rr&&(n=rr,e=ir,ir=rr=null,sh(n),e)))for(n=0;n<e.length;n++)sh(e[n])}}function li(e,n){var a=e.stateNode;if(a===null)return null;var s=a[xt]||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 El=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Cc=!1;if(El)try{var ai={};Object.defineProperty(ai,"passive",{get:function(){Cc=!0}}),window.addEventListener("test",ai,ai),window.removeEventListener("test",ai,ai)}catch{Cc=!1}var Kl=null,Nc=null,As=null;function ch(){if(As)return As;var e,n=Nc,a=n.length,s,d="value"in Kl?Kl.value:Kl.textContent,x=d.length;for(e=0;e<a&&n[e]===d[e];e++);var w=a-e;for(s=1;s<=w&&n[a-s]===d[x-s];s++);return As=d.slice(e,1<s?1-s:void 0)}function Ds(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 Ts(){return!0}function uh(){return!1}function bn(e){function n(a,s,d,x,w){this._reactName=a,this._targetInst=d,this.type=s,this.nativeEvent=x,this.target=w,this.currentTarget=null;for(var C in e)e.hasOwnProperty(C)&&(a=e[C],this[C]=a?a(x):x[C]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Ts:uh,this.isPropagationStopped=uh,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=Ts)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Ts)},persist:function(){},isPersistent:Ts}),n}var Da={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},zs=bn(Da),ri=y({},Da,{view:0,detail:0}),ig=bn(ri),Ac,Dc,ii,Ms=y({},ri,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:zc,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!==ii&&(ii&&e.type==="mousemove"?(Ac=e.screenX-ii.screenX,Dc=e.screenY-ii.screenY):Dc=Ac=0,ii=e),Ac)},movementY:function(e){return"movementY"in e?e.movementY:Dc}}),fh=bn(Ms),sg=y({},Ms,{dataTransfer:0}),og=bn(sg),cg=y({},ri,{relatedTarget:0}),Tc=bn(cg),ug=y({},Da,{animationName:0,elapsedTime:0,pseudoElement:0}),fg=bn(ug),dg=y({},Da,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),hg=bn(dg),mg=y({},Da,{data:0}),dh=bn(mg),xg={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},pg={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"},yg={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function gg(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=yg[e])?!!n[e]:!1}function zc(){return gg}var bg=y({},ri,{key:function(e){if(e.key){var n=xg[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=Ds(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?pg[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:zc,charCode:function(e){return e.type==="keypress"?Ds(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ds(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),vg=bn(bg),wg=y({},Ms,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),hh=bn(wg),kg=y({},ri,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:zc}),Sg=bn(kg),jg=y({},Da,{propertyName:0,elapsedTime:0,pseudoElement:0}),Eg=bn(jg),Cg=y({},Ms,{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}),Ng=bn(Cg),Ag=y({},Da,{newState:0,oldState:0}),Dg=bn(Ag),Tg=[9,13,27,32],Mc=El&&"CompositionEvent"in window,si=null;El&&"documentMode"in document&&(si=document.documentMode);var zg=El&&"TextEvent"in window&&!si,mh=El&&(!Mc||si&&8<si&&11>=si),xh=" ",ph=!1;function yh(e,n){switch(e){case"keyup":return Tg.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function gh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var sr=!1;function Mg(e,n){switch(e){case"compositionend":return gh(n);case"keypress":return n.which!==32?null:(ph=!0,xh);case"textInput":return e=n.data,e===xh&&ph?null:e;default:return null}}function _g(e,n){if(sr)return e==="compositionend"||!Mc&&yh(e,n)?(e=ch(),As=Nc=Kl=null,sr=!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 Fg={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"?!!Fg[e.type]:n==="textarea"}function vh(e,n,a,s){rr?ir?ir.push(s):ir=[s]:rr=s,n=ko(n,"onChange"),0<n.length&&(a=new zs("onChange","change",null,a,s),e.push({event:a,listeners:n}))}var oi=null,ci=null;function Rg(e){np(e,0)}function _s(e){var n=Aa(e);if(ti(n))return e}function wh(e,n){if(e==="change")return n}var kh=!1;if(El){var _c;if(El){var Fc="oninput"in document;if(!Fc){var Sh=document.createElement("div");Sh.setAttribute("oninput","return;"),Fc=typeof Sh.oninput=="function"}_c=Fc}else _c=!1;kh=_c&&(!document.documentMode||9<document.documentMode)}function jh(){oi&&(oi.detachEvent("onpropertychange",Eh),ci=oi=null)}function Eh(e){if(e.propertyName==="value"&&_s(ci)){var n=[];vh(n,ci,e,jc(e)),oh(Rg,n)}}function Og(e,n,a){e==="focusin"?(jh(),oi=n,ci=a,oi.attachEvent("onpropertychange",Eh)):e==="focusout"&&jh()}function Bg(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return _s(ci)}function $g(e,n){if(e==="click")return _s(n)}function Lg(e,n){if(e==="input"||e==="change")return _s(n)}function Hg(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var Dn=typeof Object.is=="function"?Object.is:Hg;function ui(e,n){if(Dn(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 d=a[s];if(!Lt.call(n,d)||!Dn(e[d],n[d]))return!1}return!0}function Ch(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Nh(e,n){var a=Ch(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=Ch(a)}}function Ah(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Ah(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Dh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=lr(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=lr(e.document)}return n}function Rc(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 Ug=El&&"documentMode"in document&&11>=document.documentMode,or=null,Oc=null,fi=null,Bc=!1;function Th(e,n,a){var s=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Bc||or==null||or!==lr(s)||(s=or,"selectionStart"in s&&Rc(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}),fi&&ui(fi,s)||(fi=s,s=ko(Oc,"onSelect"),0<s.length&&(n=new zs("onSelect","select",null,n,a),e.push({event:n,listeners:s}),n.target=or)))}function Ta(e,n){var a={};return a[e.toLowerCase()]=n.toLowerCase(),a["Webkit"+e]="webkit"+n,a["Moz"+e]="moz"+n,a}var cr={animationend:Ta("Animation","AnimationEnd"),animationiteration:Ta("Animation","AnimationIteration"),animationstart:Ta("Animation","AnimationStart"),transitionrun:Ta("Transition","TransitionRun"),transitionstart:Ta("Transition","TransitionStart"),transitioncancel:Ta("Transition","TransitionCancel"),transitionend:Ta("Transition","TransitionEnd")},$c={},zh={};El&&(zh=document.createElement("div").style,"AnimationEvent"in window||(delete cr.animationend.animation,delete cr.animationiteration.animation,delete cr.animationstart.animation),"TransitionEvent"in window||delete cr.transitionend.transition);function za(e){if($c[e])return $c[e];if(!cr[e])return e;var n=cr[e],a;for(a in n)if(n.hasOwnProperty(a)&&a in zh)return $c[e]=n[a];return e}var Mh=za("animationend"),_h=za("animationiteration"),Fh=za("animationstart"),Ig=za("transitionrun"),Yg=za("transitionstart"),qg=za("transitioncancel"),Rh=za("transitionend"),Oh=new Map,Lc="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(" ");Lc.push("scrollEnd");function ll(e,n){Oh.set(e,n),cl(n,[e])}var Fs=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)},Un=[],ur=0,Hc=0;function Rs(){for(var e=ur,n=Hc=ur=0;n<e;){var a=Un[n];Un[n++]=null;var s=Un[n];Un[n++]=null;var d=Un[n];Un[n++]=null;var x=Un[n];if(Un[n++]=null,s!==null&&d!==null){var w=s.pending;w===null?d.next=d:(d.next=w.next,w.next=d),s.pending=d}x!==0&&Bh(a,d,x)}}function Os(e,n,a,s){Un[ur++]=e,Un[ur++]=n,Un[ur++]=a,Un[ur++]=s,Hc|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function Uc(e,n,a,s){return Os(e,n,a,s),Bs(e)}function Ma(e,n){return Os(e,null,null,n),Bs(e)}function Bh(e,n,a){e.lanes|=a;var s=e.alternate;s!==null&&(s.lanes|=a);for(var d=!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||(d=!0)),e=x,x=x.return;return e.tag===3?(x=e.stateNode,d&&n!==null&&(d=31-rt(a),e=x.hiddenUpdates,s=e[d],s===null?e[d]=[n]:s.push(n),n.lane=a|536870912),x):null}function Bs(e){if(50<_i)throw _i=0,Zu=null,Error(i(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var fr={};function Xg(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 Tn(e,n,a,s){return new Xg(e,n,a,s)}function Ic(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Cl(e,n){var a=e.alternate;return a===null?(a=Tn(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 $h(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 $s(e,n,a,s,d,x){var w=0;if(s=e,typeof e=="function")Ic(e)&&(w=1);else if(typeof e=="string")w=Z2(e,a,oe.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case ee:return e=Tn(31,a,n,d),e.elementType=ee,e.lanes=x,e;case S:return _a(a.children,d,x,n);case N:w=8,d|=24;break;case E:return e=Tn(12,a,n,d|2),e.elementType=E,e.lanes=x,e;case $:return e=Tn(13,a,n,d),e.elementType=$,e.lanes=x,e;case T:return e=Tn(19,a,n,d),e.elementType=T,e.lanes=x,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case H:w=10;break e;case _:w=9;break e;case B:w=11;break e;case X:w=14;break e;case G:w=16,s=null;break e}w=29,a=Error(i(130,e===null?"null":typeof e,"")),s=null}return n=Tn(w,a,n,d),n.elementType=e,n.type=s,n.lanes=x,n}function _a(e,n,a,s){return e=Tn(7,e,s,n),e.lanes=a,e}function Yc(e,n,a){return e=Tn(6,e,null,n),e.lanes=a,e}function Lh(e){var n=Tn(18,null,null,0);return n.stateNode=e,n}function qc(e,n,a){return n=Tn(4,e.children!==null?e.children:[],e.key,n),n.lanes=a,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var Hh=new WeakMap;function In(e,n){if(typeof e=="object"&&e!==null){var a=Hh.get(e);return a!==void 0?a:(n={value:e,source:n,stack:Jt(n)},Hh.set(e,n),n)}return{value:e,source:n,stack:Jt(n)}}var dr=[],hr=0,Ls=null,di=0,Yn=[],qn=0,Ql=null,ul=1,fl="";function Nl(e,n){dr[hr++]=di,dr[hr++]=Ls,Ls=e,di=n}function Uh(e,n,a){Yn[qn++]=ul,Yn[qn++]=fl,Yn[qn++]=Ql,Ql=e;var s=ul;e=fl;var d=32-rt(s)-1;s&=~(1<<d),a+=1;var x=32-rt(n)+d;if(30<x){var w=d-d%5;x=(s&(1<<w)-1).toString(32),s>>=w,d-=w,ul=1<<32-rt(n)+d|a<<d|s,fl=x+e}else ul=1<<x|a<<d|s,fl=e}function Xc(e){e.return!==null&&(Nl(e,1),Uh(e,1,0))}function Vc(e){for(;e===Ls;)Ls=dr[--hr],dr[hr]=null,di=dr[--hr],dr[hr]=null;for(;e===Ql;)Ql=Yn[--qn],Yn[qn]=null,fl=Yn[--qn],Yn[qn]=null,ul=Yn[--qn],Yn[qn]=null}function Ih(e,n){Yn[qn++]=ul,Yn[qn++]=fl,Yn[qn++]=Ql,ul=n.id,fl=n.overflow,Ql=e}var ln=null,At=null,tt=!1,Zl=null,Xn=!1,Gc=Error(i(519));function Wl(e){var n=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw hi(In(n,e)),Gc}function Yh(e){var n=e.stateNode,a=e.type,s=e.memoizedProps;switch(n[Rt]=e,n[xt]=s,a){case"dialog":Qe("cancel",n),Qe("close",n);break;case"iframe":case"object":case"embed":Qe("load",n);break;case"video":case"audio":for(a=0;a<Ri.length;a++)Qe(Ri[a],n);break;case"source":Qe("error",n);break;case"img":case"image":case"link":Qe("error",n),Qe("load",n);break;case"details":Qe("toggle",n);break;case"input":Qe("invalid",n),ni(n,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":Qe("invalid",n);break;case"textarea":Qe("invalid",n),ue(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||ip(n.textContent,a)?(s.popover!=null&&(Qe("beforetoggle",n),Qe("toggle",n)),s.onScroll!=null&&Qe("scroll",n),s.onScrollEnd!=null&&Qe("scrollend",n),s.onClick!=null&&(n.onclick=ht),n=!0):n=!1,n||Wl(e,!0)}function qh(e){for(ln=e.return;ln;)switch(ln.tag){case 5:case 31:case 13:Xn=!1;return;case 27:case 3:Xn=!0;return;default:ln=ln.return}}function mr(e){if(e!==ln)return!1;if(!tt)return qh(e),tt=!0,!1;var n=e.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||df(e.type,e.memoizedProps)),a=!a),a&&At&&Wl(e),qh(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));At=xp(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));At=xp(e)}else n===27?(n=At,fa(e.type)?(e=yf,yf=null,At=e):At=n):At=ln?Gn(e.stateNode.nextSibling):null;return!0}function Fa(){At=ln=null,tt=!1}function Kc(){var e=Zl;return e!==null&&(Sn===null?Sn=e:Sn.push.apply(Sn,e),Zl=null),e}function hi(e){Zl===null?Zl=[e]:Zl.push(e)}var Qc=M(null),Ra=null,Al=null;function Jl(e,n,a){A(Qc,n._currentValue),n._currentValue=a}function Dl(e){e._currentValue=Qc.current,K(Qc)}function Zc(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 Wc(e,n,a,s){var d=e.child;for(d!==null&&(d.return=e);d!==null;){var x=d.dependencies;if(x!==null){var w=d.child;x=x.firstContext;e:for(;x!==null;){var C=x;x=d;for(var O=0;O<n.length;O++)if(C.context===n[O]){x.lanes|=a,C=x.alternate,C!==null&&(C.lanes|=a),Zc(x.return,a,e),s||(w=null);break e}x=C.next}}else if(d.tag===18){if(w=d.return,w===null)throw Error(i(341));w.lanes|=a,x=w.alternate,x!==null&&(x.lanes|=a),Zc(w,a,e),w=null}else w=d.child;if(w!==null)w.return=d;else for(w=d;w!==null;){if(w===e){w=null;break}if(d=w.sibling,d!==null){d.return=w.return,w=d;break}w=w.return}d=w}}function xr(e,n,a,s){e=null;for(var d=n,x=!1;d!==null;){if(!x){if((d.flags&524288)!==0)x=!0;else if((d.flags&262144)!==0)break}if(d.tag===10){var w=d.alternate;if(w===null)throw Error(i(387));if(w=w.memoizedProps,w!==null){var C=d.type;Dn(d.pendingProps.value,w.value)||(e!==null?e.push(C):e=[C])}}else if(d===Ne.current){if(w=d.alternate,w===null)throw Error(i(387));w.memoizedState.memoizedState!==d.memoizedState.memoizedState&&(e!==null?e.push(Hi):e=[Hi])}d=d.return}e!==null&&Wc(n,e,a,s),n.flags|=262144}function Hs(e){for(e=e.firstContext;e!==null;){if(!Dn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Oa(e){Ra=e,Al=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function an(e){return Xh(Ra,e)}function Us(e,n){return Ra===null&&Oa(e),Xh(e,n)}function Xh(e,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},Al===null){if(e===null)throw Error(i(308));Al=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else Al=Al.next=n;return a}var Vg=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()})}},Gg=t.unstable_scheduleCallback,Kg=t.unstable_NormalPriority,qt={$$typeof:H,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Jc(){return{controller:new Vg,data:new Map,refCount:0}}function mi(e){e.refCount--,e.refCount===0&&Gg(Kg,function(){e.controller.abort()})}var xi=null,Pc=0,pr=0,yr=null;function Qg(e,n){if(xi===null){var a=xi=[];Pc=0,pr=nf(),yr={status:"pending",value:void 0,then:function(s){a.push(s)}}}return Pc++,n.then(Vh,Vh),n}function Vh(){if(--Pc===0&&xi!==null){yr!==null&&(yr.status="fulfilled");var e=xi;xi=null,pr=0,yr=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function Zg(e,n){var a=[],s={status:"pending",value:null,reason:null,then:function(d){a.push(d)}};return e.then(function(){s.status="fulfilled",s.value=n;for(var d=0;d<a.length;d++)(0,a[d])(n)},function(d){for(s.status="rejected",s.reason=d,d=0;d<a.length;d++)(0,a[d])(void 0)}),s}var Gh=F.S;F.S=function(e,n){Tx=Ft(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&Qg(e,n),Gh!==null&&Gh(e,n)};var Ba=M(null);function eu(){var e=Ba.current;return e!==null?e:St.pooledCache}function Is(e,n){n===null?A(Ba,Ba.current):A(Ba,n.pool)}function Kh(){var e=eu();return e===null?null:{parent:qt._currentValue,pool:e}}var gr=Error(i(460)),tu=Error(i(474)),Ys=Error(i(542)),qs={then:function(){}};function Qh(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Zh(e,n,a){switch(a=e[a],a===void 0?e.push(n):a!==n&&(n.then(ht,ht),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,Jh(e),e;default:if(typeof n.status=="string")n.then(ht,ht);else{if(e=St,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=n,e.status="pending",e.then(function(s){if(n.status==="pending"){var d=n;d.status="fulfilled",d.value=s}},function(s){if(n.status==="pending"){var d=n;d.status="rejected",d.reason=s}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,Jh(e),e}throw La=n,gr}}function $a(e){try{var n=e._init;return n(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(La=a,gr):a}}var La=null;function Wh(){if(La===null)throw Error(i(459));var e=La;return La=null,e}function Jh(e){if(e===gr||e===Ys)throw Error(i(483))}var br=null,pi=0;function Xs(e){var n=pi;return pi+=1,br===null&&(br=[]),Zh(br,e,n)}function yi(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function Vs(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 Ph(e){function n(Q,q){if(e){var Z=Q.deletions;Z===null?(Q.deletions=[q],Q.flags|=16):Z.push(q)}}function a(Q,q){if(!e)return null;for(;q!==null;)n(Q,q),q=q.sibling;return null}function s(Q){for(var q=new Map;Q!==null;)Q.key!==null?q.set(Q.key,Q):q.set(Q.index,Q),Q=Q.sibling;return q}function d(Q,q){return Q=Cl(Q,q),Q.index=0,Q.sibling=null,Q}function x(Q,q,Z){return Q.index=Z,e?(Z=Q.alternate,Z!==null?(Z=Z.index,Z<q?(Q.flags|=67108866,q):Z):(Q.flags|=67108866,q)):(Q.flags|=1048576,q)}function w(Q){return e&&Q.alternate===null&&(Q.flags|=67108866),Q}function C(Q,q,Z,ie){return q===null||q.tag!==6?(q=Yc(Z,Q.mode,ie),q.return=Q,q):(q=d(q,Z),q.return=Q,q)}function O(Q,q,Z,ie){var Te=Z.type;return Te===S?re(Q,q,Z.props.children,ie,Z.key):q!==null&&(q.elementType===Te||typeof Te=="object"&&Te!==null&&Te.$$typeof===G&&$a(Te)===q.type)?(q=d(q,Z.props),yi(q,Z),q.return=Q,q):(q=$s(Z.type,Z.key,Z.props,null,Q.mode,ie),yi(q,Z),q.return=Q,q)}function W(Q,q,Z,ie){return q===null||q.tag!==4||q.stateNode.containerInfo!==Z.containerInfo||q.stateNode.implementation!==Z.implementation?(q=qc(Z,Q.mode,ie),q.return=Q,q):(q=d(q,Z.children||[]),q.return=Q,q)}function re(Q,q,Z,ie,Te){return q===null||q.tag!==7?(q=_a(Z,Q.mode,ie,Te),q.return=Q,q):(q=d(q,Z),q.return=Q,q)}function se(Q,q,Z){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return q=Yc(""+q,Q.mode,Z),q.return=Q,q;if(typeof q=="object"&&q!==null){switch(q.$$typeof){case v:return Z=$s(q.type,q.key,q.props,null,Q.mode,Z),yi(Z,q),Z.return=Q,Z;case k:return q=qc(q,Q.mode,Z),q.return=Q,q;case G:return q=$a(q),se(Q,q,Z)}if(L(q)||I(q))return q=_a(q,Q.mode,Z,null),q.return=Q,q;if(typeof q.then=="function")return se(Q,Xs(q),Z);if(q.$$typeof===H)return se(Q,Us(Q,q),Z);Vs(Q,q)}return null}function J(Q,q,Z,ie){var Te=q!==null?q.key:null;if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return Te!==null?null:C(Q,q,""+Z,ie);if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case v:return Z.key===Te?O(Q,q,Z,ie):null;case k:return Z.key===Te?W(Q,q,Z,ie):null;case G:return Z=$a(Z),J(Q,q,Z,ie)}if(L(Z)||I(Z))return Te!==null?null:re(Q,q,Z,ie,null);if(typeof Z.then=="function")return J(Q,q,Xs(Z),ie);if(Z.$$typeof===H)return J(Q,q,Us(Q,Z),ie);Vs(Q,Z)}return null}function te(Q,q,Z,ie,Te){if(typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint")return Q=Q.get(Z)||null,C(q,Q,""+ie,Te);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case v:return Q=Q.get(ie.key===null?Z:ie.key)||null,O(q,Q,ie,Te);case k:return Q=Q.get(ie.key===null?Z:ie.key)||null,W(q,Q,ie,Te);case G:return ie=$a(ie),te(Q,q,Z,ie,Te)}if(L(ie)||I(ie))return Q=Q.get(Z)||null,re(q,Q,ie,Te,null);if(typeof ie.then=="function")return te(Q,q,Z,Xs(ie),Te);if(ie.$$typeof===H)return te(Q,q,Z,Us(q,ie),Te);Vs(q,ie)}return null}function Se(Q,q,Z,ie){for(var Te=null,st=null,je=q,Ue=q=0,Pe=null;je!==null&&Ue<Z.length;Ue++){je.index>Ue?(Pe=je,je=null):Pe=je.sibling;var ot=J(Q,je,Z[Ue],ie);if(ot===null){je===null&&(je=Pe);break}e&&je&&ot.alternate===null&&n(Q,je),q=x(ot,q,Ue),st===null?Te=ot:st.sibling=ot,st=ot,je=Pe}if(Ue===Z.length)return a(Q,je),tt&&Nl(Q,Ue),Te;if(je===null){for(;Ue<Z.length;Ue++)je=se(Q,Z[Ue],ie),je!==null&&(q=x(je,q,Ue),st===null?Te=je:st.sibling=je,st=je);return tt&&Nl(Q,Ue),Te}for(je=s(je);Ue<Z.length;Ue++)Pe=te(je,Q,Ue,Z[Ue],ie),Pe!==null&&(e&&Pe.alternate!==null&&je.delete(Pe.key===null?Ue:Pe.key),q=x(Pe,q,Ue),st===null?Te=Pe:st.sibling=Pe,st=Pe);return e&&je.forEach(function(pa){return n(Q,pa)}),tt&&Nl(Q,Ue),Te}function _e(Q,q,Z,ie){if(Z==null)throw Error(i(151));for(var Te=null,st=null,je=q,Ue=q=0,Pe=null,ot=Z.next();je!==null&&!ot.done;Ue++,ot=Z.next()){je.index>Ue?(Pe=je,je=null):Pe=je.sibling;var pa=J(Q,je,ot.value,ie);if(pa===null){je===null&&(je=Pe);break}e&&je&&pa.alternate===null&&n(Q,je),q=x(pa,q,Ue),st===null?Te=pa:st.sibling=pa,st=pa,je=Pe}if(ot.done)return a(Q,je),tt&&Nl(Q,Ue),Te;if(je===null){for(;!ot.done;Ue++,ot=Z.next())ot=se(Q,ot.value,ie),ot!==null&&(q=x(ot,q,Ue),st===null?Te=ot:st.sibling=ot,st=ot);return tt&&Nl(Q,Ue),Te}for(je=s(je);!ot.done;Ue++,ot=Z.next())ot=te(je,Q,Ue,ot.value,ie),ot!==null&&(e&&ot.alternate!==null&&je.delete(ot.key===null?Ue:ot.key),q=x(ot,q,Ue),st===null?Te=ot:st.sibling=ot,st=ot);return e&&je.forEach(function(sb){return n(Q,sb)}),tt&&Nl(Q,Ue),Te}function wt(Q,q,Z,ie){if(typeof Z=="object"&&Z!==null&&Z.type===S&&Z.key===null&&(Z=Z.props.children),typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case v:e:{for(var Te=Z.key;q!==null;){if(q.key===Te){if(Te=Z.type,Te===S){if(q.tag===7){a(Q,q.sibling),ie=d(q,Z.props.children),ie.return=Q,Q=ie;break e}}else if(q.elementType===Te||typeof Te=="object"&&Te!==null&&Te.$$typeof===G&&$a(Te)===q.type){a(Q,q.sibling),ie=d(q,Z.props),yi(ie,Z),ie.return=Q,Q=ie;break e}a(Q,q);break}else n(Q,q);q=q.sibling}Z.type===S?(ie=_a(Z.props.children,Q.mode,ie,Z.key),ie.return=Q,Q=ie):(ie=$s(Z.type,Z.key,Z.props,null,Q.mode,ie),yi(ie,Z),ie.return=Q,Q=ie)}return w(Q);case k:e:{for(Te=Z.key;q!==null;){if(q.key===Te)if(q.tag===4&&q.stateNode.containerInfo===Z.containerInfo&&q.stateNode.implementation===Z.implementation){a(Q,q.sibling),ie=d(q,Z.children||[]),ie.return=Q,Q=ie;break e}else{a(Q,q);break}else n(Q,q);q=q.sibling}ie=qc(Z,Q.mode,ie),ie.return=Q,Q=ie}return w(Q);case G:return Z=$a(Z),wt(Q,q,Z,ie)}if(L(Z))return Se(Q,q,Z,ie);if(I(Z)){if(Te=I(Z),typeof Te!="function")throw Error(i(150));return Z=Te.call(Z),_e(Q,q,Z,ie)}if(typeof Z.then=="function")return wt(Q,q,Xs(Z),ie);if(Z.$$typeof===H)return wt(Q,q,Us(Q,Z),ie);Vs(Q,Z)}return typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint"?(Z=""+Z,q!==null&&q.tag===6?(a(Q,q.sibling),ie=d(q,Z),ie.return=Q,Q=ie):(a(Q,q),ie=Yc(Z,Q.mode,ie),ie.return=Q,Q=ie),w(Q)):a(Q,q)}return function(Q,q,Z,ie){try{pi=0;var Te=wt(Q,q,Z,ie);return br=null,Te}catch(je){if(je===gr||je===Ys)throw je;var st=Tn(29,je,null,Q.mode);return st.lanes=ie,st.return=Q,st}finally{}}}var Ha=Ph(!0),em=Ph(!1),Pl=!1;function nu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function lu(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 ea(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ta(e,n,a){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(ut&2)!==0){var d=s.pending;return d===null?n.next=n:(n.next=d.next,d.next=n),s.pending=n,n=Bs(e),Bh(e,null,a),n}return Os(e,s,n,a),Bs(e)}function gi(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,Jr(e,a)}}function au(e,n){var a=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,a===s)){var d=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?d=x=w:x=x.next=w,a=a.next}while(a!==null);x===null?d=x=n:x=x.next=n}else d=x=n;a={baseState:s.baseState,firstBaseUpdate:d,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 ru=!1;function bi(){if(ru){var e=yr;if(e!==null)throw e}}function vi(e,n,a,s){ru=!1;var d=e.updateQueue;Pl=!1;var x=d.firstBaseUpdate,w=d.lastBaseUpdate,C=d.shared.pending;if(C!==null){d.shared.pending=null;var O=C,W=O.next;O.next=null,w===null?x=W:w.next=W,w=O;var re=e.alternate;re!==null&&(re=re.updateQueue,C=re.lastBaseUpdate,C!==w&&(C===null?re.firstBaseUpdate=W:C.next=W,re.lastBaseUpdate=O))}if(x!==null){var se=d.baseState;w=0,re=W=O=null,C=x;do{var J=C.lane&-536870913,te=J!==C.lane;if(te?(Je&J)===J:(s&J)===J){J!==0&&J===pr&&(ru=!0),re!==null&&(re=re.next={lane:0,tag:C.tag,payload:C.payload,callback:null,next:null});e:{var Se=e,_e=C;J=n;var wt=a;switch(_e.tag){case 1:if(Se=_e.payload,typeof Se=="function"){se=Se.call(wt,se,J);break e}se=Se;break e;case 3:Se.flags=Se.flags&-65537|128;case 0:if(Se=_e.payload,J=typeof Se=="function"?Se.call(wt,se,J):Se,J==null)break e;se=y({},se,J);break e;case 2:Pl=!0}}J=C.callback,J!==null&&(e.flags|=64,te&&(e.flags|=8192),te=d.callbacks,te===null?d.callbacks=[J]:te.push(J))}else te={lane:J,tag:C.tag,payload:C.payload,callback:C.callback,next:null},re===null?(W=re=te,O=se):re=re.next=te,w|=J;if(C=C.next,C===null){if(C=d.shared.pending,C===null)break;te=C,C=te.next,te.next=null,d.lastBaseUpdate=te,d.shared.pending=null}}while(!0);re===null&&(O=se),d.baseState=O,d.firstBaseUpdate=W,d.lastBaseUpdate=re,x===null&&(d.shared.lanes=0),ia|=w,e.lanes=w,e.memoizedState=se}}function tm(e,n){if(typeof e!="function")throw Error(i(191,e));e.call(n)}function nm(e,n){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)tm(a[e],n)}var vr=M(null),Gs=M(0);function lm(e,n){e=$l,A(Gs,e),A(vr,n),$l=e|n.baseLanes}function iu(){A(Gs,$l),A(vr,vr.current)}function su(){$l=Gs.current,K(vr),K(Gs)}var zn=M(null),Vn=null;function na(e){var n=e.alternate;A(Ht,Ht.current&1),A(zn,e),Vn===null&&(n===null||vr.current!==null||n.memoizedState!==null)&&(Vn=e)}function ou(e){A(Ht,Ht.current),A(zn,e),Vn===null&&(Vn=e)}function am(e){e.tag===22?(A(Ht,Ht.current),A(zn,e),Vn===null&&(Vn=e)):la()}function la(){A(Ht,Ht.current),A(zn,zn.current)}function Mn(e){K(zn),Vn===e&&(Vn=null),K(Ht)}var Ht=M(0);function Ks(e){for(var n=e;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||xf(a)||pf(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 Tl=0,He=null,bt=null,Xt=null,Qs=!1,wr=!1,Ua=!1,Zs=0,wi=0,kr=null,Wg=0;function Bt(){throw Error(i(321))}function cu(e,n){if(n===null)return!1;for(var a=0;a<n.length&&a<e.length;a++)if(!Dn(e[a],n[a]))return!1;return!0}function uu(e,n,a,s,d,x){return Tl=x,He=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,F.H=e===null||e.memoizedState===null?Um:Eu,Ua=!1,x=a(s,d),Ua=!1,wr&&(x=im(n,a,s,d)),rm(e),x}function rm(e){F.H=ji;var n=bt!==null&&bt.next!==null;if(Tl=0,Xt=bt=He=null,Qs=!1,wi=0,kr=null,n)throw Error(i(300));e===null||Vt||(e=e.dependencies,e!==null&&Hs(e)&&(Vt=!0))}function im(e,n,a,s){He=e;var d=0;do{if(wr&&(kr=null),wi=0,wr=!1,25<=d)throw Error(i(301));if(d+=1,Xt=bt=null,e.updateQueue!=null){var x=e.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}F.H=Im,x=n(a,s)}while(wr);return x}function Jg(){var e=F.H,n=e.useState()[0];return n=typeof n.then=="function"?ki(n):n,e=e.useState()[0],(bt!==null?bt.memoizedState:null)!==e&&(He.flags|=1024),n}function fu(){var e=Zs!==0;return Zs=0,e}function du(e,n,a){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~a}function hu(e){if(Qs){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}Qs=!1}Tl=0,Xt=bt=He=null,wr=!1,wi=Zs=0,kr=null}function hn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Xt===null?He.memoizedState=Xt=e:Xt=Xt.next=e,Xt}function Ut(){if(bt===null){var e=He.alternate;e=e!==null?e.memoizedState:null}else e=bt.next;var n=Xt===null?He.memoizedState:Xt.next;if(n!==null)Xt=n,bt=e;else{if(e===null)throw He.alternate===null?Error(i(467)):Error(i(310));bt=e,e={memoizedState:bt.memoizedState,baseState:bt.baseState,baseQueue:bt.baseQueue,queue:bt.queue,next:null},Xt===null?He.memoizedState=Xt=e:Xt=Xt.next=e}return Xt}function Ws(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ki(e){var n=wi;return wi+=1,kr===null&&(kr=[]),e=Zh(kr,e,n),n=He,(Xt===null?n.memoizedState:Xt.next)===null&&(n=n.alternate,F.H=n===null||n.memoizedState===null?Um:Eu),e}function Js(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ki(e);if(e.$$typeof===H)return an(e)}throw Error(i(438,String(e)))}function mu(e){var n=null,a=He.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var s=He.alternate;s!==null&&(s=s.updateQueue,s!==null&&(s=s.memoCache,s!=null&&(n={data:s.data.map(function(d){return d.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),a===null&&(a=Ws(),He.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]=D;return n.index++,a}function zl(e,n){return typeof n=="function"?n(e):n}function Ps(e){var n=Ut();return xu(n,bt,e)}function xu(e,n,a){var s=e.queue;if(s===null)throw Error(i(311));s.lastRenderedReducer=a;var d=e.baseQueue,x=s.pending;if(x!==null){if(d!==null){var w=d.next;d.next=x.next,x.next=w}n.baseQueue=d=x,s.pending=null}if(x=e.baseState,d===null)e.memoizedState=x;else{n=d.next;var C=w=null,O=null,W=n,re=!1;do{var se=W.lane&-536870913;if(se!==W.lane?(Je&se)===se:(Tl&se)===se){var J=W.revertLane;if(J===0)O!==null&&(O=O.next={lane:0,revertLane:0,gesture:null,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null}),se===pr&&(re=!0);else if((Tl&J)===J){W=W.next,J===pr&&(re=!0);continue}else se={lane:0,revertLane:W.revertLane,gesture:null,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null},O===null?(C=O=se,w=x):O=O.next=se,He.lanes|=J,ia|=J;se=W.action,Ua&&a(x,se),x=W.hasEagerState?W.eagerState:a(x,se)}else J={lane:se,revertLane:W.revertLane,gesture:W.gesture,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null},O===null?(C=O=J,w=x):O=O.next=J,He.lanes|=se,ia|=se;W=W.next}while(W!==null&&W!==n);if(O===null?w=x:O.next=C,!Dn(x,e.memoizedState)&&(Vt=!0,re&&(a=yr,a!==null)))throw a;e.memoizedState=x,e.baseState=w,e.baseQueue=O,s.lastRenderedState=x}return d===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function pu(e){var n=Ut(),a=n.queue;if(a===null)throw Error(i(311));a.lastRenderedReducer=e;var s=a.dispatch,d=a.pending,x=n.memoizedState;if(d!==null){a.pending=null;var w=d=d.next;do x=e(x,w.action),w=w.next;while(w!==d);Dn(x,n.memoizedState)||(Vt=!0),n.memoizedState=x,n.baseQueue===null&&(n.baseState=x),a.lastRenderedState=x}return[x,s]}function sm(e,n,a){var s=He,d=Ut(),x=tt;if(x){if(a===void 0)throw Error(i(407));a=a()}else a=n();var w=!Dn((bt||d).memoizedState,a);if(w&&(d.memoizedState=a,Vt=!0),d=d.queue,bu(um.bind(null,s,d,e),[e]),d.getSnapshot!==n||w||Xt!==null&&Xt.memoizedState.tag&1){if(s.flags|=2048,Sr(9,{destroy:void 0},cm.bind(null,s,d,a,n),null),St===null)throw Error(i(349));x||(Tl&127)!==0||om(s,n,a)}return a}function om(e,n,a){e.flags|=16384,e={getSnapshot:n,value:a},n=He.updateQueue,n===null?(n=Ws(),He.updateQueue=n,n.stores=[e]):(a=n.stores,a===null?n.stores=[e]:a.push(e))}function cm(e,n,a,s){n.value=a,n.getSnapshot=s,fm(n)&&dm(e)}function um(e,n,a){return a(function(){fm(n)&&dm(e)})}function fm(e){var n=e.getSnapshot;e=e.value;try{var a=n();return!Dn(e,a)}catch{return!0}}function dm(e){var n=Ma(e,2);n!==null&&jn(n,e,2)}function yu(e){var n=hn();if(typeof e=="function"){var a=e;if(e=a(),Ua){Ae(!0);try{a()}finally{Ae(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:zl,lastRenderedState:e},n}function hm(e,n,a,s){return e.baseState=a,xu(e,bt,typeof s=="function"?s:zl)}function Pg(e,n,a,s,d){if(no(e))throw Error(i(485));if(e=n.action,e!==null){var x={payload:d,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){x.listeners.push(w)}};F.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,d=e.state;if(n.isTransition){var x=F.T,w={};F.T=w;try{var C=a(d,s),O=F.S;O!==null&&O(w,C),xm(e,n,C)}catch(W){gu(e,n,W)}finally{x!==null&&w.types!==null&&(x.types=w.types),F.T=x}}else try{x=a(d,s),xm(e,n,x)}catch(W){gu(e,n,W)}}function xm(e,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(s){pm(e,n,s)},function(s){return gu(e,n,s)}):pm(e,n,a)}function pm(e,n,a){n.status="fulfilled",n.value=a,ym(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 gu(e,n,a){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do n.status="rejected",n.reason=a,ym(n),n=n.next;while(n!==s)}e.action=null}function ym(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function gm(e,n){return n}function bm(e,n){if(tt){var a=St.formState;if(a!==null){e:{var s=He;if(tt){if(At){t:{for(var d=At,x=Xn;d.nodeType!==8;){if(!x){d=null;break t}if(d=Gn(d.nextSibling),d===null){d=null;break t}}x=d.data,d=x==="F!"||x==="F"?d:null}if(d){At=Gn(d.nextSibling),s=d.data==="F!";break e}}Wl(s)}s=!1}s&&(n=a[0])}}return a=hn(),a.memoizedState=a.baseState=n,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:gm,lastRenderedState:n},a.queue=s,a=$m.bind(null,He,s),s.dispatch=a,s=yu(!1),x=ju.bind(null,He,!1,s.queue),s=hn(),d={state:n,dispatch:null,action:e,pending:null},s.queue=d,a=Pg.bind(null,He,d,x,a),d.dispatch=a,s.memoizedState=e,[n,a,!1]}function vm(e){var n=Ut();return wm(n,bt,e)}function wm(e,n,a){if(n=xu(e,n,gm)[0],e=Ps(zl)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var s=ki(n)}catch(w){throw w===gr?Ys:w}else s=n;n=Ut();var d=n.queue,x=d.dispatch;return a!==n.memoizedState&&(He.flags|=2048,Sr(9,{destroy:void 0},e2.bind(null,d,a),null)),[s,x,e]}function e2(e,n){e.action=n}function km(e){var n=Ut(),a=bt;if(a!==null)return wm(n,a,e);Ut(),n=n.memoizedState,a=Ut();var s=a.queue.dispatch;return a.memoizedState=e,[n,s,!1]}function Sr(e,n,a,s){return e={tag:e,create:a,deps:s,inst:n,next:null},n=He.updateQueue,n===null&&(n=Ws(),He.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 Sm(){return Ut().memoizedState}function eo(e,n,a,s){var d=hn();He.flags|=e,d.memoizedState=Sr(1|n,{destroy:void 0},a,s===void 0?null:s)}function to(e,n,a,s){var d=Ut();s=s===void 0?null:s;var x=d.memoizedState.inst;bt!==null&&s!==null&&cu(s,bt.memoizedState.deps)?d.memoizedState=Sr(n,x,a,s):(He.flags|=e,d.memoizedState=Sr(1|n,x,a,s))}function jm(e,n){eo(8390656,8,e,n)}function bu(e,n){to(2048,8,e,n)}function t2(e){He.flags|=4;var n=He.updateQueue;if(n===null)n=Ws(),He.updateQueue=n,n.events=[e];else{var a=n.events;a===null?n.events=[e]:a.push(e)}}function Em(e){var n=Ut().memoizedState;return t2({ref:n,nextImpl:e}),function(){if((ut&2)!==0)throw Error(i(440));return n.impl.apply(void 0,arguments)}}function Cm(e,n){return to(4,2,e,n)}function Nm(e,n){return to(4,4,e,n)}function Am(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 Dm(e,n,a){a=a!=null?a.concat([e]):null,to(4,4,Am.bind(null,n,e),a)}function vu(){}function Tm(e,n){var a=Ut();n=n===void 0?null:n;var s=a.memoizedState;return n!==null&&cu(n,s[1])?s[0]:(a.memoizedState=[e,n],e)}function zm(e,n){var a=Ut();n=n===void 0?null:n;var s=a.memoizedState;if(n!==null&&cu(n,s[1]))return s[0];if(s=e(),Ua){Ae(!0);try{e()}finally{Ae(!1)}}return a.memoizedState=[s,n],s}function wu(e,n,a){return a===void 0||(Tl&1073741824)!==0&&(Je&261930)===0?e.memoizedState=n:(e.memoizedState=a,e=Mx(),He.lanes|=e,ia|=e,a)}function Mm(e,n,a,s){return Dn(a,n)?a:vr.current!==null?(e=wu(e,a,s),Dn(e,n)||(Vt=!0),e):(Tl&42)===0||(Tl&1073741824)!==0&&(Je&261930)===0?(Vt=!0,e.memoizedState=a):(e=Mx(),He.lanes|=e,ia|=e,n)}function _m(e,n,a,s,d){var x=V.p;V.p=x!==0&&8>x?x:8;var w=F.T,C={};F.T=C,ju(e,!1,n,a);try{var O=d(),W=F.S;if(W!==null&&W(C,O),O!==null&&typeof O=="object"&&typeof O.then=="function"){var re=Zg(O,s);Si(e,n,re,Rn(e))}else Si(e,n,s,Rn(e))}catch(se){Si(e,n,{then:function(){},status:"rejected",reason:se},Rn())}finally{V.p=x,w!==null&&C.types!==null&&(w.types=C.types),F.T=w}}function n2(){}function ku(e,n,a,s){if(e.tag!==5)throw Error(i(476));var d=Fm(e).queue;_m(e,d,n,P,a===null?n2:function(){return Rm(e),a(s)})}function Fm(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:P,baseState:P,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:zl,lastRenderedState:P},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:zl,lastRenderedState:a},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function Rm(e){var n=Fm(e);n.next===null&&(n=e.alternate.memoizedState),Si(e,n.next.queue,{},Rn())}function Su(){return an(Hi)}function Om(){return Ut().memoizedState}function Bm(){return Ut().memoizedState}function l2(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var a=Rn();e=ea(a);var s=ta(n,e,a);s!==null&&(jn(s,n,a),gi(s,n,a)),n={cache:Jc()},e.payload=n;return}n=n.return}}function a2(e,n,a){var s=Rn();a={lane:s,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},no(e)?Lm(n,a):(a=Uc(e,n,a,s),a!==null&&(jn(a,e,s),Hm(a,n,s)))}function $m(e,n,a){var s=Rn();Si(e,n,a,s)}function Si(e,n,a,s){var d={lane:s,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(no(e))Lm(n,d);else{var x=e.alternate;if(e.lanes===0&&(x===null||x.lanes===0)&&(x=n.lastRenderedReducer,x!==null))try{var w=n.lastRenderedState,C=x(w,a);if(d.hasEagerState=!0,d.eagerState=C,Dn(C,w))return Os(e,n,d,0),St===null&&Rs(),!1}catch{}finally{}if(a=Uc(e,n,d,s),a!==null)return jn(a,e,s),Hm(a,n,s),!0}return!1}function ju(e,n,a,s){if(s={lane:2,revertLane:nf(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},no(e)){if(n)throw Error(i(479))}else n=Uc(e,a,s,2),n!==null&&jn(n,e,2)}function no(e){var n=e.alternate;return e===He||n!==null&&n===He}function Lm(e,n){wr=Qs=!0;var a=e.pending;a===null?n.next=n:(n.next=a.next,a.next=n),e.pending=n}function Hm(e,n,a){if((a&4194048)!==0){var s=n.lanes;s&=e.pendingLanes,a|=s,n.lanes=a,Jr(e,a)}}var ji={readContext:an,use:Js,useCallback:Bt,useContext:Bt,useEffect:Bt,useImperativeHandle:Bt,useLayoutEffect:Bt,useInsertionEffect:Bt,useMemo:Bt,useReducer:Bt,useRef:Bt,useState:Bt,useDebugValue:Bt,useDeferredValue:Bt,useTransition:Bt,useSyncExternalStore:Bt,useId:Bt,useHostTransitionStatus:Bt,useFormState:Bt,useActionState:Bt,useOptimistic:Bt,useMemoCache:Bt,useCacheRefresh:Bt};ji.useEffectEvent=Bt;var Um={readContext:an,use:Js,useCallback:function(e,n){return hn().memoizedState=[e,n===void 0?null:n],e},useContext:an,useEffect:jm,useImperativeHandle:function(e,n,a){a=a!=null?a.concat([e]):null,eo(4194308,4,Am.bind(null,n,e),a)},useLayoutEffect:function(e,n){return eo(4194308,4,e,n)},useInsertionEffect:function(e,n){eo(4,2,e,n)},useMemo:function(e,n){var a=hn();n=n===void 0?null:n;var s=e();if(Ua){Ae(!0);try{e()}finally{Ae(!1)}}return a.memoizedState=[s,n],s},useReducer:function(e,n,a){var s=hn();if(a!==void 0){var d=a(n);if(Ua){Ae(!0);try{a(n)}finally{Ae(!1)}}}else d=n;return s.memoizedState=s.baseState=d,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:d},s.queue=e,e=e.dispatch=a2.bind(null,He,e),[s.memoizedState,e]},useRef:function(e){var n=hn();return e={current:e},n.memoizedState=e},useState:function(e){e=yu(e);var n=e.queue,a=$m.bind(null,He,n);return n.dispatch=a,[e.memoizedState,a]},useDebugValue:vu,useDeferredValue:function(e,n){var a=hn();return wu(a,e,n)},useTransition:function(){var e=yu(!1);return e=_m.bind(null,He,e.queue,!0,!1),hn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,a){var s=He,d=hn();if(tt){if(a===void 0)throw Error(i(407));a=a()}else{if(a=n(),St===null)throw Error(i(349));(Je&127)!==0||om(s,n,a)}d.memoizedState=a;var x={value:a,getSnapshot:n};return d.queue=x,jm(um.bind(null,s,x,e),[e]),s.flags|=2048,Sr(9,{destroy:void 0},cm.bind(null,s,x,a,n),null),a},useId:function(){var e=hn(),n=St.identifierPrefix;if(tt){var a=fl,s=ul;a=(s&~(1<<32-rt(s)-1)).toString(32)+a,n="_"+n+"R_"+a,a=Zs++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=Wg++,n="_"+n+"r_"+a.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:Su,useFormState:bm,useActionState:bm,useOptimistic:function(e){var n=hn();n.memoizedState=n.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=ju.bind(null,He,!0,a),a.dispatch=n,[e,n]},useMemoCache:mu,useCacheRefresh:function(){return hn().memoizedState=l2.bind(null,He)},useEffectEvent:function(e){var n=hn(),a={impl:e};return n.memoizedState=a,function(){if((ut&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}},Eu={readContext:an,use:Js,useCallback:Tm,useContext:an,useEffect:bu,useImperativeHandle:Dm,useInsertionEffect:Cm,useLayoutEffect:Nm,useMemo:zm,useReducer:Ps,useRef:Sm,useState:function(){return Ps(zl)},useDebugValue:vu,useDeferredValue:function(e,n){var a=Ut();return Mm(a,bt.memoizedState,e,n)},useTransition:function(){var e=Ps(zl)[0],n=Ut().memoizedState;return[typeof e=="boolean"?e:ki(e),n]},useSyncExternalStore:sm,useId:Om,useHostTransitionStatus:Su,useFormState:vm,useActionState:vm,useOptimistic:function(e,n){var a=Ut();return hm(a,bt,e,n)},useMemoCache:mu,useCacheRefresh:Bm};Eu.useEffectEvent=Em;var Im={readContext:an,use:Js,useCallback:Tm,useContext:an,useEffect:bu,useImperativeHandle:Dm,useInsertionEffect:Cm,useLayoutEffect:Nm,useMemo:zm,useReducer:pu,useRef:Sm,useState:function(){return pu(zl)},useDebugValue:vu,useDeferredValue:function(e,n){var a=Ut();return bt===null?wu(a,e,n):Mm(a,bt.memoizedState,e,n)},useTransition:function(){var e=pu(zl)[0],n=Ut().memoizedState;return[typeof e=="boolean"?e:ki(e),n]},useSyncExternalStore:sm,useId:Om,useHostTransitionStatus:Su,useFormState:km,useActionState:km,useOptimistic:function(e,n){var a=Ut();return bt!==null?hm(a,bt,e,n):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:mu,useCacheRefresh:Bm};Im.useEffectEvent=Em;function Cu(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 Nu={enqueueSetState:function(e,n,a){e=e._reactInternals;var s=Rn(),d=ea(s);d.payload=n,a!=null&&(d.callback=a),n=ta(e,d,s),n!==null&&(jn(n,e,s),gi(n,e,s))},enqueueReplaceState:function(e,n,a){e=e._reactInternals;var s=Rn(),d=ea(s);d.tag=1,d.payload=n,a!=null&&(d.callback=a),n=ta(e,d,s),n!==null&&(jn(n,e,s),gi(n,e,s))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var a=Rn(),s=ea(a);s.tag=2,n!=null&&(s.callback=n),n=ta(e,s,a),n!==null&&(jn(n,e,a),gi(n,e,a))}};function Ym(e,n,a,s,d,x,w){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,x,w):n.prototype&&n.prototype.isPureReactComponent?!ui(a,s)||!ui(d,x):!0}function qm(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&&Nu.enqueueReplaceState(n,n.state,null)}function Ia(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 d in e)a[d]===void 0&&(a[d]=e[d])}return a}function Xm(e){Fs(e)}function Vm(e){console.error(e)}function Gm(e){Fs(e)}function lo(e,n){try{var a=e.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(s){setTimeout(function(){throw s})}}function Km(e,n,a){try{var s=e.onCaughtError;s(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(d){setTimeout(function(){throw d})}}function Au(e,n,a){return a=ea(a),a.tag=3,a.payload={element:null},a.callback=function(){lo(e,n)},a}function Qm(e){return e=ea(e),e.tag=3,e}function Zm(e,n,a,s){var d=a.type.getDerivedStateFromError;if(typeof d=="function"){var x=s.value;e.payload=function(){return d(x)},e.callback=function(){Km(n,a,s)}}var w=a.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(e.callback=function(){Km(n,a,s),typeof d!="function"&&(sa===null?sa=new Set([this]):sa.add(this));var C=s.stack;this.componentDidCatch(s.value,{componentStack:C!==null?C:""})})}function r2(e,n,a,s,d){if(a.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(n=a.alternate,n!==null&&xr(n,a,d,!0),a=zn.current,a!==null){switch(a.tag){case 31:case 13:return Vn===null?po():a.alternate===null&&$t===0&&($t=3),a.flags&=-257,a.flags|=65536,a.lanes=d,s===qs?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([s]):n.add(s),Pu(e,s,d)),!1;case 22:return a.flags|=65536,s===qs?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)),Pu(e,s,d)),!1}throw Error(i(435,a.tag))}return Pu(e,s,d),po(),!1}if(tt)return n=zn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=d,s!==Gc&&(e=Error(i(422),{cause:s}),hi(In(e,a)))):(s!==Gc&&(n=Error(i(423),{cause:s}),hi(In(n,a))),e=e.current.alternate,e.flags|=65536,d&=-d,e.lanes|=d,s=In(s,a),d=Au(e.stateNode,s,d),au(e,d),$t!==4&&($t=2)),!1;var x=Error(i(520),{cause:s});if(x=In(x,a),Mi===null?Mi=[x]:Mi.push(x),$t!==4&&($t=2),n===null)return!0;s=In(s,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,e=d&-d,a.lanes|=e,e=Au(a.stateNode,s,e),au(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"&&(sa===null||!sa.has(x))))return a.flags|=65536,d&=-d,a.lanes|=d,d=Qm(d),Zm(d,e,a,s),au(a,d),!1}a=a.return}while(a!==null);return!1}var Du=Error(i(461)),Vt=!1;function rn(e,n,a,s){n.child=e===null?em(n,null,a,s):Ha(n,e.child,a,s)}function Wm(e,n,a,s,d){a=a.render;var x=n.ref;if("ref"in s){var w={};for(var C in s)C!=="ref"&&(w[C]=s[C])}else w=s;return Oa(n),s=uu(e,n,a,w,x,d),C=fu(),e!==null&&!Vt?(du(e,n,d),Ml(e,n,d)):(tt&&C&&Xc(n),n.flags|=1,rn(e,n,s,d),n.child)}function Jm(e,n,a,s,d){if(e===null){var x=a.type;return typeof x=="function"&&!Ic(x)&&x.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=x,Pm(e,n,x,s,d)):(e=$s(a.type,null,s,n,n.mode,d),e.ref=n.ref,e.return=n,n.child=e)}if(x=e.child,!Bu(e,d)){var w=x.memoizedProps;if(a=a.compare,a=a!==null?a:ui,a(w,s)&&e.ref===n.ref)return Ml(e,n,d)}return n.flags|=1,e=Cl(x,s),e.ref=n.ref,e.return=n,n.child=e}function Pm(e,n,a,s,d){if(e!==null){var x=e.memoizedProps;if(ui(x,s)&&e.ref===n.ref)if(Vt=!1,n.pendingProps=s=x,Bu(e,d))(e.flags&131072)!==0&&(Vt=!0);else return n.lanes=e.lanes,Ml(e,n,d)}return Tu(e,n,a,s,d)}function ex(e,n,a,s){var d=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,d=0;s!==null;)d=d|s.lanes|s.childLanes,s=s.sibling;s=d&~x}else s=0,n.child=null;return tx(e,n,x,a,s)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&Is(n,x!==null?x.cachePool:null),x!==null?lm(n,x):iu(),am(n);else return s=n.lanes=536870912,tx(e,n,x!==null?x.baseLanes|a:a,a,s)}else x!==null?(Is(n,x.cachePool),lm(n,x),la(),n.memoizedState=null):(e!==null&&Is(n,null),iu(),la());return rn(e,n,d,a),n.child}function Ei(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function tx(e,n,a,s,d){var x=eu();return x=x===null?null:{parent:qt._currentValue,pool:x},n.memoizedState={baseLanes:a,cachePool:x},e!==null&&Is(n,null),iu(),am(n),e!==null&&xr(e,n,s,!0),n.childLanes=d,null}function ao(e,n){return n=io({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function nx(e,n,a){return Ha(n,e.child,null,a),e=ao(n,n.pendingProps),e.flags|=2,Mn(n),n.memoizedState=null,e}function i2(e,n,a){var s=n.pendingProps,d=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(tt){if(s.mode==="hidden")return e=ao(n,s),n.lanes=536870912,Ei(null,e);if(ou(n),(e=At)?(e=mp(e,Xn),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:Ql!==null?{id:ul,overflow:fl}:null,retryLane:536870912,hydrationErrors:null},a=Lh(e),a.return=n,n.child=a,ln=n,At=null)):e=null,e===null)throw Wl(n);return n.lanes=536870912,null}return ao(n,s)}var x=e.memoizedState;if(x!==null){var w=x.dehydrated;if(ou(n),d)if(n.flags&256)n.flags&=-257,n=nx(e,n,a);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(i(558));else if(Vt||xr(e,n,a,!1),d=(a&e.childLanes)!==0,Vt||d){if(s=St,s!==null&&(w=vs(s,a),w!==0&&w!==x.retryLane))throw x.retryLane=w,Ma(e,w),jn(s,e,w),Du;po(),n=nx(e,n,a)}else e=x.treeContext,At=Gn(w.nextSibling),ln=n,tt=!0,Zl=null,Xn=!1,e!==null&&Ih(n,e),n=ao(n,s),n.flags|=4096;return n}return e=Cl(e.child,{mode:s.mode,children:s.children}),e.ref=n.ref,n.child=e,e.return=n,e}function ro(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 Tu(e,n,a,s,d){return Oa(n),a=uu(e,n,a,s,void 0,d),s=fu(),e!==null&&!Vt?(du(e,n,d),Ml(e,n,d)):(tt&&s&&Xc(n),n.flags|=1,rn(e,n,a,d),n.child)}function lx(e,n,a,s,d,x){return Oa(n),n.updateQueue=null,a=im(n,s,a,d),rm(e),s=fu(),e!==null&&!Vt?(du(e,n,x),Ml(e,n,x)):(tt&&s&&Xc(n),n.flags|=1,rn(e,n,a,x),n.child)}function ax(e,n,a,s,d){if(Oa(n),n.stateNode===null){var x=fr,w=a.contextType;typeof w=="object"&&w!==null&&(x=an(w)),x=new a(s,x),n.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=Nu,n.stateNode=x,x._reactInternals=n,x=n.stateNode,x.props=s,x.state=n.memoizedState,x.refs={},nu(n),w=a.contextType,x.context=typeof w=="object"&&w!==null?an(w):fr,x.state=n.memoizedState,w=a.getDerivedStateFromProps,typeof w=="function"&&(Cu(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&&Nu.enqueueReplaceState(x,x.state,null),vi(n,s,x,d),bi(),x.state=n.memoizedState),typeof x.componentDidMount=="function"&&(n.flags|=4194308),s=!0}else if(e===null){x=n.stateNode;var C=n.memoizedProps,O=Ia(a,C);x.props=O;var W=x.context,re=a.contextType;w=fr,typeof re=="object"&&re!==null&&(w=an(re));var se=a.getDerivedStateFromProps;re=typeof se=="function"||typeof x.getSnapshotBeforeUpdate=="function",C=n.pendingProps!==C,re||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(C||W!==w)&&qm(n,x,s,w),Pl=!1;var J=n.memoizedState;x.state=J,vi(n,s,x,d),bi(),W=n.memoizedState,C||J!==W||Pl?(typeof se=="function"&&(Cu(n,a,se,s),W=n.memoizedState),(O=Pl||Ym(n,a,O,s,J,W,w))?(re||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=W),x.props=s,x.state=W,x.context=w,s=O):(typeof x.componentDidMount=="function"&&(n.flags|=4194308),s=!1)}else{x=n.stateNode,lu(e,n),w=n.memoizedProps,re=Ia(a,w),x.props=re,se=n.pendingProps,J=x.context,W=a.contextType,O=fr,typeof W=="object"&&W!==null&&(O=an(W)),C=a.getDerivedStateFromProps,(W=typeof C=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(w!==se||J!==O)&&qm(n,x,s,O),Pl=!1,J=n.memoizedState,x.state=J,vi(n,s,x,d),bi();var te=n.memoizedState;w!==se||J!==te||Pl||e!==null&&e.dependencies!==null&&Hs(e.dependencies)?(typeof C=="function"&&(Cu(n,a,C,s),te=n.memoizedState),(re=Pl||Ym(n,a,re,s,J,te,O)||e!==null&&e.dependencies!==null&&Hs(e.dependencies))?(W||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(s,te,O),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(s,te,O)),typeof x.componentDidUpdate=="function"&&(n.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof x.componentDidUpdate!="function"||w===e.memoizedProps&&J===e.memoizedState||(n.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===e.memoizedProps&&J===e.memoizedState||(n.flags|=1024),n.memoizedProps=s,n.memoizedState=te),x.props=s,x.state=te,x.context=O,s=re):(typeof x.componentDidUpdate!="function"||w===e.memoizedProps&&J===e.memoizedState||(n.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===e.memoizedProps&&J===e.memoizedState||(n.flags|=1024),s=!1)}return x=s,ro(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=Ha(n,e.child,null,d),n.child=Ha(n,null,a,d)):rn(e,n,a,d),n.memoizedState=x.state,e=n.child):e=Ml(e,n,d),e}function rx(e,n,a,s){return Fa(),n.flags|=256,rn(e,n,a,s),n.child}var zu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Mu(e){return{baseLanes:e,cachePool:Kh()}}function _u(e,n,a){return e=e!==null?e.childLanes&~a:0,n&&(e|=Fn),e}function ix(e,n,a){var s=n.pendingProps,d=!1,x=(n.flags&128)!==0,w;if((w=x)||(w=e!==null&&e.memoizedState===null?!1:(Ht.current&2)!==0),w&&(d=!0,n.flags&=-129),w=(n.flags&32)!==0,n.flags&=-33,e===null){if(tt){if(d?na(n):la(),(e=At)?(e=mp(e,Xn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:Ql!==null?{id:ul,overflow:fl}:null,retryLane:536870912,hydrationErrors:null},a=Lh(e),a.return=n,n.child=a,ln=n,At=null)):e=null,e===null)throw Wl(n);return pf(e)?n.lanes=32:n.lanes=536870912,null}var C=s.children;return s=s.fallback,d?(la(),d=n.mode,C=io({mode:"hidden",children:C},d),s=_a(s,d,a,null),C.return=n,s.return=n,C.sibling=s,n.child=C,s=n.child,s.memoizedState=Mu(a),s.childLanes=_u(e,w,a),n.memoizedState=zu,Ei(null,s)):(na(n),Fu(n,C))}var O=e.memoizedState;if(O!==null&&(C=O.dehydrated,C!==null)){if(x)n.flags&256?(na(n),n.flags&=-257,n=Ru(e,n,a)):n.memoizedState!==null?(la(),n.child=e.child,n.flags|=128,n=null):(la(),C=s.fallback,d=n.mode,s=io({mode:"visible",children:s.children},d),C=_a(C,d,a,null),C.flags|=2,s.return=n,C.return=n,s.sibling=C,n.child=s,Ha(n,e.child,null,a),s=n.child,s.memoizedState=Mu(a),s.childLanes=_u(e,w,a),n.memoizedState=zu,n=Ei(null,s));else if(na(n),pf(C)){if(w=C.nextSibling&&C.nextSibling.dataset,w)var W=w.dgst;w=W,s=Error(i(419)),s.stack="",s.digest=w,hi({value:s,source:null,stack:null}),n=Ru(e,n,a)}else if(Vt||xr(e,n,a,!1),w=(a&e.childLanes)!==0,Vt||w){if(w=St,w!==null&&(s=vs(w,a),s!==0&&s!==O.retryLane))throw O.retryLane=s,Ma(e,s),jn(w,e,s),Du;xf(C)||po(),n=Ru(e,n,a)}else xf(C)?(n.flags|=192,n.child=e.child,n=null):(e=O.treeContext,At=Gn(C.nextSibling),ln=n,tt=!0,Zl=null,Xn=!1,e!==null&&Ih(n,e),n=Fu(n,s.children),n.flags|=4096);return n}return d?(la(),C=s.fallback,d=n.mode,O=e.child,W=O.sibling,s=Cl(O,{mode:"hidden",children:s.children}),s.subtreeFlags=O.subtreeFlags&65011712,W!==null?C=Cl(W,C):(C=_a(C,d,a,null),C.flags|=2),C.return=n,s.return=n,s.sibling=C,n.child=s,Ei(null,s),s=n.child,C=e.child.memoizedState,C===null?C=Mu(a):(d=C.cachePool,d!==null?(O=qt._currentValue,d=d.parent!==O?{parent:O,pool:O}:d):d=Kh(),C={baseLanes:C.baseLanes|a,cachePool:d}),s.memoizedState=C,s.childLanes=_u(e,w,a),n.memoizedState=zu,Ei(e.child,s)):(na(n),a=e.child,e=a.sibling,a=Cl(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 Fu(e,n){return n=io({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function io(e,n){return e=Tn(22,e,null,n),e.lanes=0,e}function Ru(e,n,a){return Ha(n,e.child,null,a),e=Fu(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function sx(e,n,a){e.lanes|=n;var s=e.alternate;s!==null&&(s.lanes|=n),Zc(e.return,n,a)}function Ou(e,n,a,s,d,x){var w=e.memoizedState;w===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:s,tail:a,tailMode:d,treeForkCount:x}:(w.isBackwards=n,w.rendering=null,w.renderingStartTime=0,w.last=s,w.tail=a,w.tailMode=d,w.treeForkCount=x)}function ox(e,n,a){var s=n.pendingProps,d=s.revealOrder,x=s.tail;s=s.children;var w=Ht.current,C=(w&2)!==0;if(C?(w=w&1|2,n.flags|=128):w&=1,A(Ht,w),rn(e,n,s,a),s=tt?di:0,!C&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&sx(e,a,n);else if(e.tag===19)sx(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(d){case"forwards":for(a=n.child,d=null;a!==null;)e=a.alternate,e!==null&&Ks(e)===null&&(d=a),a=a.sibling;a=d,a===null?(d=n.child,n.child=null):(d=a.sibling,a.sibling=null),Ou(n,!1,d,a,x,s);break;case"backwards":case"unstable_legacy-backwards":for(a=null,d=n.child,n.child=null;d!==null;){if(e=d.alternate,e!==null&&Ks(e)===null){n.child=d;break}e=d.sibling,d.sibling=a,a=d,d=e}Ou(n,!0,a,null,x,s);break;case"together":Ou(n,!1,null,null,void 0,s);break;default:n.memoizedState=null}return n.child}function Ml(e,n,a){if(e!==null&&(n.dependencies=e.dependencies),ia|=n.lanes,(a&n.childLanes)===0)if(e!==null){if(xr(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=Cl(e,e.pendingProps),n.child=a,a.return=n;e.sibling!==null;)e=e.sibling,a=a.sibling=Cl(e,e.pendingProps),a.return=n;a.sibling=null}return n.child}function Bu(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&Hs(e)))}function s2(e,n,a){switch(n.tag){case 3:Oe(n,n.stateNode.containerInfo),Jl(n,qt,e.memoizedState.cache),Fa();break;case 27:case 5:me(n);break;case 4:Oe(n,n.stateNode.containerInfo);break;case 10:Jl(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,ou(n),null;break;case 13:var s=n.memoizedState;if(s!==null)return s.dehydrated!==null?(na(n),n.flags|=128,null):(a&n.child.childLanes)!==0?ix(e,n,a):(na(n),e=Ml(e,n,a),e!==null?e.sibling:null);na(n);break;case 19:var d=(e.flags&128)!==0;if(s=(a&n.childLanes)!==0,s||(xr(e,n,a,!1),s=(a&n.childLanes)!==0),d){if(s)return ox(e,n,a);n.flags|=128}if(d=n.memoizedState,d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),A(Ht,Ht.current),s)break;return null;case 22:return n.lanes=0,ex(e,n,a,n.pendingProps);case 24:Jl(n,qt,e.memoizedState.cache)}return Ml(e,n,a)}function cx(e,n,a){if(e!==null)if(e.memoizedProps!==n.pendingProps)Vt=!0;else{if(!Bu(e,a)&&(n.flags&128)===0)return Vt=!1,s2(e,n,a);Vt=(e.flags&131072)!==0}else Vt=!1,tt&&(n.flags&1048576)!==0&&Uh(n,di,n.index);switch(n.lanes=0,n.tag){case 16:e:{var s=n.pendingProps;if(e=$a(n.elementType),n.type=e,typeof e=="function")Ic(e)?(s=Ia(e,s),n.tag=1,n=ax(null,n,e,s,a)):(n.tag=0,n=Tu(null,n,e,s,a));else{if(e!=null){var d=e.$$typeof;if(d===B){n.tag=11,n=Wm(null,n,e,s,a);break e}else if(d===X){n.tag=14,n=Jm(null,n,e,s,a);break e}}throw n=le(e)||e,Error(i(306,n,""))}}return n;case 0:return Tu(e,n,n.type,n.pendingProps,a);case 1:return s=n.type,d=Ia(s,n.pendingProps),ax(e,n,s,d,a);case 3:e:{if(Oe(n,n.stateNode.containerInfo),e===null)throw Error(i(387));s=n.pendingProps;var x=n.memoizedState;d=x.element,lu(e,n),vi(n,s,null,a);var w=n.memoizedState;if(s=w.cache,Jl(n,qt,s),s!==x.cache&&Wc(n,[qt],a,!0),bi(),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=rx(e,n,s,a);break e}else if(s!==d){d=In(Error(i(424)),n),hi(d),n=rx(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(At=Gn(e.firstChild),ln=n,tt=!0,Zl=null,Xn=!0,a=em(n,null,s,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(Fa(),s===d){n=Ml(e,n,a);break e}rn(e,n,s,a)}n=n.child}return n;case 26:return ro(e,n),e===null?(a=vp(n.type,null,n.pendingProps,null))?n.memoizedState=a:tt||(a=n.type,e=n.pendingProps,s=So(ve.current).createElement(a),s[Rt]=n,s[xt]=e,sn(s,a,e),Ot(s),n.stateNode=s):n.memoizedState=vp(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return me(n),e===null&&tt&&(s=n.stateNode=yp(n.type,n.pendingProps,ve.current),ln=n,Xn=!0,d=At,fa(n.type)?(yf=d,At=Gn(s.firstChild)):At=d),rn(e,n,n.pendingProps.children,a),ro(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&tt&&((d=s=At)&&(s=B2(s,n.type,n.pendingProps,Xn),s!==null?(n.stateNode=s,ln=n,At=Gn(s.firstChild),Xn=!1,d=!0):d=!1),d||Wl(n)),me(n),d=n.type,x=n.pendingProps,w=e!==null?e.memoizedProps:null,s=x.children,df(d,x)?s=null:w!==null&&df(d,w)&&(n.flags|=32),n.memoizedState!==null&&(d=uu(e,n,Jg,null,null,a),Hi._currentValue=d),ro(e,n),rn(e,n,s,a),n.child;case 6:return e===null&&tt&&((e=a=At)&&(a=$2(a,n.pendingProps,Xn),a!==null?(n.stateNode=a,ln=n,At=null,e=!0):e=!1),e||Wl(n)),null;case 13:return ix(e,n,a);case 4:return Oe(n,n.stateNode.containerInfo),s=n.pendingProps,e===null?n.child=Ha(n,null,s,a):rn(e,n,s,a),n.child;case 11:return Wm(e,n,n.type,n.pendingProps,a);case 7:return rn(e,n,n.pendingProps,a),n.child;case 8:return rn(e,n,n.pendingProps.children,a),n.child;case 12:return rn(e,n,n.pendingProps.children,a),n.child;case 10:return s=n.pendingProps,Jl(n,n.type,s.value),rn(e,n,s.children,a),n.child;case 9:return d=n.type._context,s=n.pendingProps.children,Oa(n),d=an(d),s=s(d),n.flags|=1,rn(e,n,s,a),n.child;case 14:return Jm(e,n,n.type,n.pendingProps,a);case 15:return Pm(e,n,n.type,n.pendingProps,a);case 19:return ox(e,n,a);case 31:return i2(e,n,a);case 22:return ex(e,n,a,n.pendingProps);case 24:return Oa(n),s=an(qt),e===null?(d=eu(),d===null&&(d=St,x=Jc(),d.pooledCache=x,x.refCount++,x!==null&&(d.pooledCacheLanes|=a),d=x),n.memoizedState={parent:s,cache:d},nu(n),Jl(n,qt,d)):((e.lanes&a)!==0&&(lu(e,n),vi(n,null,null,a),bi()),d=e.memoizedState,x=n.memoizedState,d.parent!==s?(d={parent:s,cache:s},n.memoizedState=d,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=d),Jl(n,qt,s)):(s=x.cache,Jl(n,qt,s),s!==d.cache&&Wc(n,[qt],a,!0))),rn(e,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(i(156,n.tag))}function _l(e){e.flags|=4}function $u(e,n,a,s,d){if((n=(e.mode&32)!==0)&&(n=!1),n){if(e.flags|=16777216,(d&335544128)===d)if(e.stateNode.complete)e.flags|=8192;else if(Ox())e.flags|=8192;else throw La=qs,tu}else e.flags&=-16777217}function ux(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Ep(n))if(Ox())e.flags|=8192;else throw La=qs,tu}function so(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?Pa():536870912,e.lanes|=n,Nr|=n)}function Ci(e,n){if(!tt)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 Dt(e){var n=e.alternate!==null&&e.alternate.child===e.child,a=0,s=0;if(n)for(var d=e.child;d!==null;)a|=d.lanes|d.childLanes,s|=d.subtreeFlags&65011712,s|=d.flags&65011712,d.return=e,d=d.sibling;else for(d=e.child;d!==null;)a|=d.lanes|d.childLanes,s|=d.subtreeFlags,s|=d.flags,d.return=e,d=d.sibling;return e.subtreeFlags|=s,e.childLanes=a,n}function o2(e,n,a){var s=n.pendingProps;switch(Vc(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Dt(n),null;case 1:return Dt(n),null;case 3:return a=n.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),n.memoizedState.cache!==s&&(n.flags|=2048),Dl(qt),Be(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(mr(n)?_l(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Kc())),Dt(n),null;case 26:var d=n.type,x=n.memoizedState;return e===null?(_l(n),x!==null?(Dt(n),ux(n,x)):(Dt(n),$u(n,d,null,s,a))):x?x!==e.memoizedState?(_l(n),Dt(n),ux(n,x)):(Dt(n),n.flags&=-16777217):(e=e.memoizedProps,e!==s&&_l(n),Dt(n),$u(n,d,e,s,a)),null;case 27:if(Ve(n),a=ve.current,d=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==s&&_l(n);else{if(!s){if(n.stateNode===null)throw Error(i(166));return Dt(n),null}e=oe.current,mr(n)?Yh(n):(e=yp(d,s,a),n.stateNode=e,_l(n))}return Dt(n),null;case 5:if(Ve(n),d=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==s&&_l(n);else{if(!s){if(n.stateNode===null)throw Error(i(166));return Dt(n),null}if(x=oe.current,mr(n))Yh(n);else{var w=So(ve.current);switch(x){case 1:x=w.createElementNS("http://www.w3.org/2000/svg",d);break;case 2:x=w.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;default:switch(d){case"svg":x=w.createElementNS("http://www.w3.org/2000/svg",d);break;case"math":x=w.createElementNS("http://www.w3.org/1998/Math/MathML",d);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(d,{is:s.is}):w.createElement(d)}}x[Rt]=n,x[xt]=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(sn(x,d,s),d){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&_l(n)}}return Dt(n),$u(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,a),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==s&&_l(n);else{if(typeof s!="string"&&n.stateNode===null)throw Error(i(166));if(e=ve.current,mr(n)){if(e=n.stateNode,a=n.memoizedProps,s=null,d=ln,d!==null)switch(d.tag){case 27:case 5:s=d.memoizedProps}e[Rt]=n,e=!!(e.nodeValue===a||s!==null&&s.suppressHydrationWarning===!0||ip(e.nodeValue,a)),e||Wl(n,!0)}else e=So(e).createTextNode(s),e[Rt]=n,n.stateNode=e}return Dt(n),null;case 31:if(a=n.memoizedState,e===null||e.memoizedState!==null){if(s=mr(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[Rt]=n}else Fa(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Dt(n),e=!1}else a=Kc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return n.flags&256?(Mn(n),n):(Mn(n),null);if((n.flags&128)!==0)throw Error(i(558))}return Dt(n),null;case 13:if(s=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(d=mr(n),s!==null&&s.dehydrated!==null){if(e===null){if(!d)throw Error(i(318));if(d=n.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(i(317));d[Rt]=n}else Fa(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Dt(n),d=!1}else d=Kc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=d),d=!0;if(!d)return n.flags&256?(Mn(n),n):(Mn(n),null)}return Mn(n),(n.flags&128)!==0?(n.lanes=a,n):(a=s!==null,e=e!==null&&e.memoizedState!==null,a&&(s=n.child,d=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(d=s.alternate.memoizedState.cachePool.pool),x=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(x=s.memoizedState.cachePool.pool),x!==d&&(s.flags|=2048)),a!==e&&a&&(n.child.flags|=8192),so(n,n.updateQueue),Dt(n),null);case 4:return Be(),e===null&&sf(n.stateNode.containerInfo),Dt(n),null;case 10:return Dl(n.type),Dt(n),null;case 19:if(K(Ht),s=n.memoizedState,s===null)return Dt(n),null;if(d=(n.flags&128)!==0,x=s.rendering,x===null)if(d)Ci(s,!1);else{if($t!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(x=Ks(e),x!==null){for(n.flags|=128,Ci(s,!1),e=x.updateQueue,n.updateQueue=e,so(n,e),n.subtreeFlags=0,e=a,a=n.child;a!==null;)$h(a,e),a=a.sibling;return A(Ht,Ht.current&1|2),tt&&Nl(n,s.treeForkCount),n.child}e=e.sibling}s.tail!==null&&Ft()>ho&&(n.flags|=128,d=!0,Ci(s,!1),n.lanes=4194304)}else{if(!d)if(e=Ks(x),e!==null){if(n.flags|=128,d=!0,e=e.updateQueue,n.updateQueue=e,so(n,e),Ci(s,!0),s.tail===null&&s.tailMode==="hidden"&&!x.alternate&&!tt)return Dt(n),null}else 2*Ft()-s.renderingStartTime>ho&&a!==536870912&&(n.flags|=128,d=!0,Ci(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=Ft(),e.sibling=null,a=Ht.current,A(Ht,d?a&1|2:a&1),tt&&Nl(n,s.treeForkCount),e):(Dt(n),null);case 22:case 23:return Mn(n),su(),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&&(Dt(n),n.subtreeFlags&6&&(n.flags|=8192)):Dt(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&&K(Ba),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),Dl(qt),Dt(n),null;case 25:return null;case 30:return null}throw Error(i(156,n.tag))}function c2(e,n){switch(Vc(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return Dl(qt),Be(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return Ve(n),null;case 31:if(n.memoizedState!==null){if(Mn(n),n.alternate===null)throw Error(i(340));Fa()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(Mn(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(i(340));Fa()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return K(Ht),null;case 4:return Be(),null;case 10:return Dl(n.type),null;case 22:case 23:return Mn(n),su(),e!==null&&K(Ba),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return Dl(qt),null;case 25:return null;default:return null}}function fx(e,n){switch(Vc(n),n.tag){case 3:Dl(qt),Be();break;case 26:case 27:case 5:Ve(n);break;case 4:Be();break;case 31:n.memoizedState!==null&&Mn(n);break;case 13:Mn(n);break;case 19:K(Ht);break;case 10:Dl(n.type);break;case 22:case 23:Mn(n),su(),e!==null&&K(Ba);break;case 24:Dl(qt)}}function Ni(e,n){try{var a=n.updateQueue,s=a!==null?a.lastEffect:null;if(s!==null){var d=s.next;a=d;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!==d)}}catch(C){gt(n,n.return,C)}}function aa(e,n,a){try{var s=n.updateQueue,d=s!==null?s.lastEffect:null;if(d!==null){var x=d.next;s=x;do{if((s.tag&e)===e){var w=s.inst,C=w.destroy;if(C!==void 0){w.destroy=void 0,d=n;var O=a,W=C;try{W()}catch(re){gt(d,O,re)}}}s=s.next}while(s!==x)}}catch(re){gt(n,n.return,re)}}function dx(e){var n=e.updateQueue;if(n!==null){var a=e.stateNode;try{nm(n,a)}catch(s){gt(e,e.return,s)}}}function hx(e,n,a){a.props=Ia(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(s){gt(e,n,s)}}function Ai(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(d){gt(e,n,d)}}function dl(e,n){var a=e.ref,s=e.refCleanup;if(a!==null)if(typeof s=="function")try{s()}catch(d){gt(e,n,d)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(d){gt(e,n,d)}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(d){gt(e,e.return,d)}}function Lu(e,n,a){try{var s=e.stateNode;z2(s,e.type,a,n),s[xt]=n}catch(d){gt(e,e.return,d)}}function xx(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&fa(e.type)||e.tag===4}function Hu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||xx(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&&fa(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 Uu(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=ht));else if(s!==4&&(s===27&&fa(e.type)&&(a=e.stateNode,n=null),e=e.child,e!==null))for(Uu(e,n,a),e=e.sibling;e!==null;)Uu(e,n,a),e=e.sibling}function oo(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&&fa(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(oo(e,n,a),e=e.sibling;e!==null;)oo(e,n,a),e=e.sibling}function px(e){var n=e.stateNode,a=e.memoizedProps;try{for(var s=e.type,d=n.attributes;d.length;)n.removeAttributeNode(d[0]);sn(n,s,a),n[Rt]=e,n[xt]=a}catch(x){gt(e,e.return,x)}}var Fl=!1,Gt=!1,Iu=!1,yx=typeof WeakSet=="function"?WeakSet:Set,tn=null;function u2(e,n){if(e=e.containerInfo,uf=To,e=Dh(e),Rc(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 d=s.anchorOffset,x=s.focusNode;s=s.focusOffset;try{a.nodeType,x.nodeType}catch{a=null;break e}var w=0,C=-1,O=-1,W=0,re=0,se=e,J=null;t:for(;;){for(var te;se!==a||d!==0&&se.nodeType!==3||(C=w+d),se!==x||s!==0&&se.nodeType!==3||(O=w+s),se.nodeType===3&&(w+=se.nodeValue.length),(te=se.firstChild)!==null;)J=se,se=te;for(;;){if(se===e)break t;if(J===a&&++W===d&&(C=w),J===x&&++re===s&&(O=w),(te=se.nextSibling)!==null)break;se=J,J=se.parentNode}se=te}a=C===-1||O===-1?null:{start:C,end:O}}else a=null}a=a||{start:0,end:0}}else a=null;for(ff={focusedElem:e,selectionRange:a},To=!1,tn=n;tn!==null;)if(n=tn,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,tn=e;else for(;tn!==null;){switch(n=tn,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++)d=e[a],d.ref.impl=d.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&x!==null){e=void 0,a=n,d=x.memoizedProps,x=x.memoizedState,s=a.stateNode;try{var Se=Ia(a.type,d);e=s.getSnapshotBeforeUpdate(Se,x),s.__reactInternalSnapshotBeforeUpdate=e}catch(_e){gt(a,a.return,_e)}}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,tn=e;break}tn=n.return}}function gx(e,n,a){var s=a.flags;switch(a.tag){case 0:case 11:case 15:Ol(e,a),s&4&&Ni(5,a);break;case 1:if(Ol(e,a),s&4)if(e=a.stateNode,n===null)try{e.componentDidMount()}catch(w){gt(a,a.return,w)}else{var d=Ia(a.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(d,n,e.__reactInternalSnapshotBeforeUpdate)}catch(w){gt(a,a.return,w)}}s&64&&dx(a),s&512&&Ai(a,a.return);break;case 3:if(Ol(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{nm(e,n)}catch(w){gt(a,a.return,w)}}break;case 27:n===null&&s&4&&px(a);case 26:case 5:Ol(e,a),n===null&&s&4&&mx(a),s&512&&Ai(a,a.return);break;case 12:Ol(e,a);break;case 31:Ol(e,a),s&4&&wx(e,a);break;case 13:Ol(e,a),s&4&&kx(e,a),s&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=b2.bind(null,a),L2(e,a))));break;case 22:if(s=a.memoizedState!==null||Fl,!s){n=n!==null&&n.memoizedState!==null||Gt,d=Fl;var x=Gt;Fl=s,(Gt=n)&&!x?Bl(e,a,(a.subtreeFlags&8772)!==0):Ol(e,a),Fl=d,Gt=x}break;case 30:break;default:Ol(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&&ei(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 zt=null,vn=!1;function Rl(e,n,a){for(a=a.child;a!==null;)vx(e,n,a),a=a.sibling}function vx(e,n,a){if(ce&&typeof ce.onCommitFiberUnmount=="function")try{ce.onCommitFiberUnmount(Ye,a)}catch{}switch(a.tag){case 26:Gt||dl(a,n),Rl(e,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Gt||dl(a,n);var s=zt,d=vn;fa(a.type)&&(zt=a.stateNode,vn=!1),Rl(e,n,a),Bi(a.stateNode),zt=s,vn=d;break;case 5:Gt||dl(a,n);case 6:if(s=zt,d=vn,zt=null,Rl(e,n,a),zt=s,vn=d,zt!==null)if(vn)try{(zt.nodeType===9?zt.body:zt.nodeName==="HTML"?zt.ownerDocument.body:zt).removeChild(a.stateNode)}catch(x){gt(a,n,x)}else try{zt.removeChild(a.stateNode)}catch(x){gt(a,n,x)}break;case 18:zt!==null&&(vn?(e=zt,dp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),Rr(e)):dp(zt,a.stateNode));break;case 4:s=zt,d=vn,zt=a.stateNode.containerInfo,vn=!0,Rl(e,n,a),zt=s,vn=d;break;case 0:case 11:case 14:case 15:aa(2,a,n),Gt||aa(4,a,n),Rl(e,n,a);break;case 1:Gt||(dl(a,n),s=a.stateNode,typeof s.componentWillUnmount=="function"&&hx(a,n,s)),Rl(e,n,a);break;case 21:Rl(e,n,a);break;case 22:Gt=(s=Gt)||a.memoizedState!==null,Rl(e,n,a),Gt=s;break;default:Rl(e,n,a)}}function wx(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Rr(e)}catch(a){gt(n,n.return,a)}}}function kx(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Rr(e)}catch(a){gt(n,n.return,a)}}function f2(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new yx),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new yx),n;default:throw Error(i(435,e.tag))}}function co(e,n){var a=f2(e);n.forEach(function(s){if(!a.has(s)){a.add(s);var d=v2.bind(null,e,s);s.then(d,d)}})}function wn(e,n){var a=n.deletions;if(a!==null)for(var s=0;s<a.length;s++){var d=a[s],x=e,w=n,C=w;e:for(;C!==null;){switch(C.tag){case 27:if(fa(C.type)){zt=C.stateNode,vn=!1;break e}break;case 5:zt=C.stateNode,vn=!1;break e;case 3:case 4:zt=C.stateNode.containerInfo,vn=!0;break e}C=C.return}if(zt===null)throw Error(i(160));vx(x,w,d),zt=null,vn=!1,x=d.alternate,x!==null&&(x.return=null),d.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Sx(n,e),n=n.sibling}var al=null;function Sx(e,n){var a=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:wn(n,e),kn(e),s&4&&(aa(3,e,e.return),Ni(3,e),aa(5,e,e.return));break;case 1:wn(n,e),kn(e),s&512&&(Gt||a===null||dl(a,a.return)),s&64&&Fl&&(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 d=al;if(wn(n,e),kn(e),s&512&&(Gt||a===null||dl(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,d=d.ownerDocument||d;t:switch(s){case"title":x=d.getElementsByTagName("title")[0],(!x||x[nl]||x[Rt]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=d.createElement(s),d.head.insertBefore(x,d.querySelector("head > title"))),sn(x,s,a),x[Rt]=e,Ot(x),s=x;break e;case"link":var w=Sp("link","href",d).get(s+(a.href||""));if(w){for(var C=0;C<w.length;C++)if(x=w[C],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(C,1);break t}}x=d.createElement(s),sn(x,s,a),d.head.appendChild(x);break;case"meta":if(w=Sp("meta","content",d).get(s+(a.content||""))){for(C=0;C<w.length;C++)if(x=w[C],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(C,1);break t}}x=d.createElement(s),sn(x,s,a),d.head.appendChild(x);break;default:throw Error(i(468,s))}x[Rt]=e,Ot(x),s=x}e.stateNode=s}else jp(d,e.type,e.stateNode);else e.stateNode=kp(d,s,e.memoizedProps);else x!==s?(x===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):x.count--,s===null?jp(d,e.type,e.stateNode):kp(d,s,e.memoizedProps)):s===null&&e.stateNode!==null&&Lu(e,e.memoizedProps,a.memoizedProps)}break;case 27:wn(n,e),kn(e),s&512&&(Gt||a===null||dl(a,a.return)),a!==null&&s&4&&Lu(e,e.memoizedProps,a.memoizedProps);break;case 5:if(wn(n,e),kn(e),s&512&&(Gt||a===null||dl(a,a.return)),e.flags&32){d=e.stateNode;try{ge(d,"")}catch(Se){gt(e,e.return,Se)}}s&4&&e.stateNode!=null&&(d=e.memoizedProps,Lu(e,d,a!==null?a.memoizedProps:d)),s&1024&&(Iu=!0);break;case 6:if(wn(n,e),kn(e),s&4){if(e.stateNode===null)throw Error(i(162));s=e.memoizedProps,a=e.stateNode;try{a.nodeValue=s}catch(Se){gt(e,e.return,Se)}}break;case 3:if(Co=null,d=al,al=jo(n.containerInfo),wn(n,e),al=d,kn(e),s&4&&a!==null&&a.memoizedState.isDehydrated)try{Rr(n.containerInfo)}catch(Se){gt(e,e.return,Se)}Iu&&(Iu=!1,jx(e));break;case 4:s=al,al=jo(e.stateNode.containerInfo),wn(n,e),kn(e),al=s;break;case 12:wn(n,e),kn(e);break;case 31:wn(n,e),kn(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,co(e,s)));break;case 13:wn(n,e),kn(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(fo=Ft()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,co(e,s)));break;case 22:d=e.memoizedState!==null;var O=a!==null&&a.memoizedState!==null,W=Fl,re=Gt;if(Fl=W||d,Gt=re||O,wn(n,e),Gt=re,Fl=W,kn(e),s&8192)e:for(n=e.stateNode,n._visibility=d?n._visibility&-2:n._visibility|1,d&&(a===null||O||Fl||Gt||Ya(e)),a=null,n=e;;){if(n.tag===5||n.tag===26){if(a===null){O=a=n;try{if(x=O.stateNode,d)w=x.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{C=O.stateNode;var se=O.memoizedProps.style,J=se!=null&&se.hasOwnProperty("display")?se.display:null;C.style.display=J==null||typeof J=="boolean"?"":(""+J).trim()}}catch(Se){gt(O,O.return,Se)}}}else if(n.tag===6){if(a===null){O=n;try{O.stateNode.nodeValue=d?"":O.memoizedProps}catch(Se){gt(O,O.return,Se)}}}else if(n.tag===18){if(a===null){O=n;try{var te=O.stateNode;d?hp(te,!0):hp(O.stateNode,!1)}catch(Se){gt(O,O.return,Se)}}}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:wn(n,e),kn(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,co(e,s)));break;case 30:break;case 21:break;default:wn(n,e),kn(e)}}function kn(e){var n=e.flags;if(n&2){try{for(var a,s=e.return;s!==null;){if(xx(s)){a=s;break}s=s.return}if(a==null)throw Error(i(160));switch(a.tag){case 27:var d=a.stateNode,x=Hu(e);oo(e,x,d);break;case 5:var w=a.stateNode;a.flags&32&&(ge(w,""),a.flags&=-33);var C=Hu(e);oo(e,C,w);break;case 3:case 4:var O=a.stateNode.containerInfo,W=Hu(e);Uu(e,W,O);break;default:throw Error(i(161))}}catch(re){gt(e,e.return,re)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function jx(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;jx(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function Ol(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)gx(e,n.alternate,n),n=n.sibling}function Ya(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:aa(4,n,n.return),Ya(n);break;case 1:dl(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&hx(n,n.return,a),Ya(n);break;case 27:Bi(n.stateNode);case 26:case 5:dl(n,n.return),Ya(n);break;case 22:n.memoizedState===null&&Ya(n);break;case 30:Ya(n);break;default:Ya(n)}e=e.sibling}}function Bl(e,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var s=n.alternate,d=e,x=n,w=x.flags;switch(x.tag){case 0:case 11:case 15:Bl(d,x,a),Ni(4,x);break;case 1:if(Bl(d,x,a),s=x,d=s.stateNode,typeof d.componentDidMount=="function")try{d.componentDidMount()}catch(W){gt(s,s.return,W)}if(s=x,d=s.updateQueue,d!==null){var C=s.stateNode;try{var O=d.shared.hiddenCallbacks;if(O!==null)for(d.shared.hiddenCallbacks=null,d=0;d<O.length;d++)tm(O[d],C)}catch(W){gt(s,s.return,W)}}a&&w&64&&dx(x),Ai(x,x.return);break;case 27:px(x);case 26:case 5:Bl(d,x,a),a&&s===null&&w&4&&mx(x),Ai(x,x.return);break;case 12:Bl(d,x,a);break;case 31:Bl(d,x,a),a&&w&4&&wx(d,x);break;case 13:Bl(d,x,a),a&&w&4&&kx(d,x);break;case 22:x.memoizedState===null&&Bl(d,x,a),Ai(x,x.return);break;case 30:break;default:Bl(d,x,a)}n=n.sibling}}function Yu(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&&mi(a))}function qu(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&mi(e))}function rl(e,n,a,s){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Ex(e,n,a,s),n=n.sibling}function Ex(e,n,a,s){var d=n.flags;switch(n.tag){case 0:case 11:case 15:rl(e,n,a,s),d&2048&&Ni(9,n);break;case 1:rl(e,n,a,s);break;case 3:rl(e,n,a,s),d&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&mi(e)));break;case 12:if(d&2048){rl(e,n,a,s),e=n.stateNode;try{var x=n.memoizedProps,w=x.id,C=x.onPostCommit;typeof C=="function"&&C(w,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(O){gt(n,n.return,O)}}else rl(e,n,a,s);break;case 31:rl(e,n,a,s);break;case 13:rl(e,n,a,s);break;case 23:break;case 22:x=n.stateNode,w=n.alternate,n.memoizedState!==null?x._visibility&2?rl(e,n,a,s):Di(e,n):x._visibility&2?rl(e,n,a,s):(x._visibility|=2,jr(e,n,a,s,(n.subtreeFlags&10256)!==0||!1)),d&2048&&Yu(w,n);break;case 24:rl(e,n,a,s),d&2048&&qu(n.alternate,n);break;default:rl(e,n,a,s)}}function jr(e,n,a,s,d){for(d=d&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var x=e,w=n,C=a,O=s,W=w.flags;switch(w.tag){case 0:case 11:case 15:jr(x,w,C,O,d),Ni(8,w);break;case 23:break;case 22:var re=w.stateNode;w.memoizedState!==null?re._visibility&2?jr(x,w,C,O,d):Di(x,w):(re._visibility|=2,jr(x,w,C,O,d)),d&&W&2048&&Yu(w.alternate,w);break;case 24:jr(x,w,C,O,d),d&&W&2048&&qu(w.alternate,w);break;default:jr(x,w,C,O,d)}n=n.sibling}}function Di(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=e,s=n,d=s.flags;switch(s.tag){case 22:Di(a,s),d&2048&&Yu(s.alternate,s);break;case 24:Di(a,s),d&2048&&qu(s.alternate,s);break;default:Di(a,s)}n=n.sibling}}var Ti=8192;function Er(e,n,a){if(e.subtreeFlags&Ti)for(e=e.child;e!==null;)Cx(e,n,a),e=e.sibling}function Cx(e,n,a){switch(e.tag){case 26:Er(e,n,a),e.flags&Ti&&e.memoizedState!==null&&W2(a,al,e.memoizedState,e.memoizedProps);break;case 5:Er(e,n,a);break;case 3:case 4:var s=al;al=jo(e.stateNode.containerInfo),Er(e,n,a),al=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=Ti,Ti=16777216,Er(e,n,a),Ti=s):Er(e,n,a));break;default:Er(e,n,a)}}function Nx(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 zi(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];tn=s,Dx(s,e)}Nx(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Ax(e),e=e.sibling}function Ax(e){switch(e.tag){case 0:case 11:case 15:zi(e),e.flags&2048&&aa(9,e,e.return);break;case 3:zi(e);break;case 12:zi(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,uo(e)):zi(e);break;default:zi(e)}}function uo(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];tn=s,Dx(s,e)}Nx(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:aa(8,n,n.return),uo(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,uo(n));break;default:uo(n)}e=e.sibling}}function Dx(e,n){for(;tn!==null;){var a=tn;switch(a.tag){case 0:case 11:case 15:aa(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:mi(a.memoizedState.cache)}if(s=a.child,s!==null)s.return=a,tn=s;else e:for(a=e;tn!==null;){s=tn;var d=s.sibling,x=s.return;if(bx(s),s===a){tn=null;break e}if(d!==null){d.return=x,tn=d;break e}tn=x}}}var d2={getCacheForType:function(e){var n=an(qt),a=n.data.get(e);return a===void 0&&(a=e(),n.data.set(e,a)),a},cacheSignal:function(){return an(qt).controller.signal}},h2=typeof WeakMap=="function"?WeakMap:Map,ut=0,St=null,Ke=null,Je=0,yt=0,_n=null,ra=!1,Cr=!1,Xu=!1,$l=0,$t=0,ia=0,qa=0,Vu=0,Fn=0,Nr=0,Mi=null,Sn=null,Gu=!1,fo=0,Tx=0,ho=1/0,mo=null,sa=null,Qt=0,oa=null,Ar=null,Ll=0,Ku=0,Qu=null,zx=null,_i=0,Zu=null;function Rn(){return(ut&2)!==0&&Je!==0?Je&-Je:F.T!==null?nf():wl()}function Mx(){if(Fn===0)if((Je&536870912)===0||tt){var e=Jn;Jn<<=1,(Jn&3932160)===0&&(Jn=262144),Fn=e}else Fn=536870912;return e=zn.current,e!==null&&(e.flags|=32),Fn}function jn(e,n,a){(e===St&&(yt===2||yt===9)||e.cancelPendingCommit!==null)&&(Dr(e,0),ca(e,Je,Fn,!1)),Nn(e,a),((ut&2)===0||e!==St)&&(e===St&&((ut&2)===0&&(qa|=a),$t===4&&ca(e,Je,Fn,!1)),hl(e))}function _x(e,n,a){if((ut&6)!==0)throw Error(i(327));var s=!a&&(n&127)===0&&(n&e.expiredLanes)===0||ql(e,n),d=s?p2(e,n):Ju(e,n,!0),x=s;do{if(d===0){Cr&&!s&&ca(e,n,0,!1);break}else{if(a=e.current.alternate,x&&!m2(a)){d=Ju(e,n,!1),x=!1;continue}if(d===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 C=e;d=Mi;var O=C.current.memoizedState.isDehydrated;if(O&&(Dr(C,w).flags|=256),w=Ju(C,w,!1),w!==2){if(Xu&&!O){C.errorRecoveryDisabledLanes|=x,qa|=x,d=4;break e}x=Sn,Sn=d,x!==null&&(Sn===null?Sn=x:Sn.push.apply(Sn,x))}d=w}if(x=!1,d!==2)continue}}if(d===1){Dr(e,0),ca(e,n,0,!0);break}e:{switch(s=e,x=d,x){case 0:case 1:throw Error(i(345));case 4:if((n&4194048)!==n)break;case 6:ca(s,n,Fn,!ra);break e;case 2:Sn=null;break;case 3:case 5:break;default:throw Error(i(329))}if((n&62914560)===n&&(d=fo+300-Ft(),10<d)){if(ca(s,n,Fn,!ra),el(s,0,!0)!==0)break e;Ll=n,s.timeoutHandle=up(Fx.bind(null,s,a,Sn,mo,Gu,n,Fn,qa,Nr,ra,x,"Throttled",-0,0),d);break e}Fx(s,a,Sn,mo,Gu,n,Fn,qa,Nr,ra,x,null,-0,0)}}break}while(!0);hl(e)}function Fx(e,n,a,s,d,x,w,C,O,W,re,se,J,te){if(e.timeoutHandle=-1,se=n.subtreeFlags,se&8192||(se&16785408)===16785408){se={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ht},Cx(n,x,se);var Se=(x&62914560)===x?fo-Ft():(x&4194048)===x?Tx-Ft():0;if(Se=J2(se,Se),Se!==null){Ll=x,e.cancelPendingCommit=Se(Ix.bind(null,e,n,x,a,s,d,w,C,O,re,se,null,J,te)),ca(e,x,w,!W);return}}Ix(e,n,x,a,s,d,w,C,O)}function m2(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 d=a[s],x=d.getSnapshot;d=d.value;try{if(!Dn(x(),d))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 ca(e,n,a,s){n&=~Vu,n&=~qa,e.suspendedLanes|=n,e.pingedLanes&=~n,s&&(e.warmLanes|=n),s=e.expirationTimes;for(var d=n;0<d;){var x=31-rt(d),w=1<<x;s[x]=-1,d&=~w}a!==0&&Wr(e,a,n)}function xo(){return(ut&6)===0?(Fi(0),!1):!0}function Wu(){if(Ke!==null){if(yt===0)var e=Ke.return;else e=Ke,Al=Ra=null,hu(e),br=null,pi=0,e=Ke;for(;e!==null;)fx(e.alternate,e),e=e.return;Ke=null}}function Dr(e,n){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,F2(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),Ll=0,Wu(),St=e,Ke=a=Cl(e.current,null),Je=n,yt=0,_n=null,ra=!1,Cr=ql(e,n),Xu=!1,Nr=Fn=Vu=qa=ia=$t=0,Sn=Mi=null,Gu=!1,(n&8)!==0&&(n|=n&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=n;0<s;){var d=31-rt(s),x=1<<d;n|=e[d],s&=~x}return $l=n,Rs(),a}function Rx(e,n){He=null,F.H=ji,n===gr||n===Ys?(n=Wh(),yt=3):n===tu?(n=Wh(),yt=4):yt=n===Du?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,_n=n,Ke===null&&($t=1,lo(e,In(n,e.current)))}function Ox(){var e=zn.current;return e===null?!0:(Je&4194048)===Je?Vn===null:(Je&62914560)===Je||(Je&536870912)!==0?e===Vn:!1}function Bx(){var e=F.H;return F.H=ji,e===null?ji:e}function $x(){var e=F.A;return F.A=d2,e}function po(){$t=4,ra||(Je&4194048)!==Je&&zn.current!==null||(Cr=!0),(ia&134217727)===0&&(qa&134217727)===0||St===null||ca(St,Je,Fn,!1)}function Ju(e,n,a){var s=ut;ut|=2;var d=Bx(),x=$x();(St!==e||Je!==n)&&(mo=null,Dr(e,n)),n=!1;var w=$t;e:do try{if(yt!==0&&Ke!==null){var C=Ke,O=_n;switch(yt){case 8:Wu(),w=6;break e;case 3:case 2:case 9:case 6:zn.current===null&&(n=!0);var W=yt;if(yt=0,_n=null,Tr(e,C,O,W),a&&Cr){w=0;break e}break;default:W=yt,yt=0,_n=null,Tr(e,C,O,W)}}x2(),w=$t;break}catch(re){Rx(e,re)}while(!0);return n&&e.shellSuspendCounter++,Al=Ra=null,ut=s,F.H=d,F.A=x,Ke===null&&(St=null,Je=0,Rs()),w}function x2(){for(;Ke!==null;)Lx(Ke)}function p2(e,n){var a=ut;ut|=2;var s=Bx(),d=$x();St!==e||Je!==n?(mo=null,ho=Ft()+500,Dr(e,n)):Cr=ql(e,n);e:do try{if(yt!==0&&Ke!==null){n=Ke;var x=_n;t:switch(yt){case 1:yt=0,_n=null,Tr(e,n,x,1);break;case 2:case 9:if(Qh(x)){yt=0,_n=null,Hx(n);break}n=function(){yt!==2&&yt!==9||St!==e||(yt=7),hl(e)},x.then(n,n);break e;case 3:yt=7;break e;case 4:yt=5;break e;case 7:Qh(x)?(yt=0,_n=null,Hx(n)):(yt=0,_n=null,Tr(e,n,x,7));break;case 5:var w=null;switch(Ke.tag){case 26:w=Ke.memoizedState;case 5:case 27:var C=Ke;if(w?Ep(w):C.stateNode.complete){yt=0,_n=null;var O=C.sibling;if(O!==null)Ke=O;else{var W=C.return;W!==null?(Ke=W,yo(W)):Ke=null}break t}}yt=0,_n=null,Tr(e,n,x,5);break;case 6:yt=0,_n=null,Tr(e,n,x,6);break;case 8:Wu(),$t=6;break e;default:throw Error(i(462))}}y2();break}catch(re){Rx(e,re)}while(!0);return Al=Ra=null,F.H=s,F.A=d,ut=a,Ke!==null?0:(St=null,Je=0,Rs(),$t)}function y2(){for(;Ke!==null&&!_t();)Lx(Ke)}function Lx(e){var n=cx(e.alternate,e,$l);e.memoizedProps=e.pendingProps,n===null?yo(e):Ke=n}function Hx(e){var n=e,a=n.alternate;switch(n.tag){case 15:case 0:n=lx(a,n,n.pendingProps,n.type,void 0,Je);break;case 11:n=lx(a,n,n.pendingProps,n.type.render,n.ref,Je);break;case 5:hu(n);default:fx(a,n),n=Ke=$h(n,$l),n=cx(a,n,$l)}e.memoizedProps=e.pendingProps,n===null?yo(e):Ke=n}function Tr(e,n,a,s){Al=Ra=null,hu(n),br=null,pi=0;var d=n.return;try{if(r2(e,d,n,a,Je)){$t=1,lo(e,In(a,e.current)),Ke=null;return}}catch(x){if(d!==null)throw Ke=d,x;$t=1,lo(e,In(a,e.current)),Ke=null;return}n.flags&32768?(tt||s===1?e=!0:Cr||(Je&536870912)!==0?e=!1:(ra=e=!0,(s===2||s===9||s===3||s===6)&&(s=zn.current,s!==null&&s.tag===13&&(s.flags|=16384))),Ux(n,e)):yo(n)}function yo(e){var n=e;do{if((n.flags&32768)!==0){Ux(n,ra);return}e=n.return;var a=o2(n.alternate,n,$l);if(a!==null){Ke=a;return}if(n=n.sibling,n!==null){Ke=n;return}Ke=n=e}while(n!==null);$t===0&&($t=5)}function Ux(e,n){do{var a=c2(e.alternate,e);if(a!==null){a.flags&=32767,Ke=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(e=e.sibling,e!==null)){Ke=e;return}Ke=e=a}while(e!==null);$t=6,Ke=null}function Ix(e,n,a,s,d,x,w,C,O){e.cancelPendingCommit=null;do go();while(Qt!==0);if((ut&6)!==0)throw Error(i(327));if(n!==null){if(n===e.current)throw Error(i(177));if(x=n.lanes|n.childLanes,x|=Hc,Zr(e,a,x,w,C,O),e===St&&(Ke=St=null,Je=0),Ar=n,oa=e,Ll=a,Ku=x,Qu=d,zx=s,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,w2(De,function(){return Gx(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||s){s=F.T,F.T=null,d=V.p,V.p=2,w=ut,ut|=4;try{u2(e,n,a)}finally{ut=w,V.p=d,F.T=s}}Qt=1,Yx(),qx(),Xx()}}function Yx(){if(Qt===1){Qt=0;var e=oa,n=Ar,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=F.T,F.T=null;var s=V.p;V.p=2;var d=ut;ut|=4;try{Sx(n,e);var x=ff,w=Dh(e.containerInfo),C=x.focusedElem,O=x.selectionRange;if(w!==C&&C&&C.ownerDocument&&Ah(C.ownerDocument.documentElement,C)){if(O!==null&&Rc(C)){var W=O.start,re=O.end;if(re===void 0&&(re=W),"selectionStart"in C)C.selectionStart=W,C.selectionEnd=Math.min(re,C.value.length);else{var se=C.ownerDocument||document,J=se&&se.defaultView||window;if(J.getSelection){var te=J.getSelection(),Se=C.textContent.length,_e=Math.min(O.start,Se),wt=O.end===void 0?_e:Math.min(O.end,Se);!te.extend&&_e>wt&&(w=wt,wt=_e,_e=w);var Q=Nh(C,_e),q=Nh(C,wt);if(Q&&q&&(te.rangeCount!==1||te.anchorNode!==Q.node||te.anchorOffset!==Q.offset||te.focusNode!==q.node||te.focusOffset!==q.offset)){var Z=se.createRange();Z.setStart(Q.node,Q.offset),te.removeAllRanges(),_e>wt?(te.addRange(Z),te.extend(q.node,q.offset)):(Z.setEnd(q.node,q.offset),te.addRange(Z))}}}}for(se=[],te=C;te=te.parentNode;)te.nodeType===1&&se.push({element:te,left:te.scrollLeft,top:te.scrollTop});for(typeof C.focus=="function"&&C.focus(),C=0;C<se.length;C++){var ie=se[C];ie.element.scrollLeft=ie.left,ie.element.scrollTop=ie.top}}To=!!uf,ff=uf=null}finally{ut=d,V.p=s,F.T=a}}e.current=n,Qt=2}}function qx(){if(Qt===2){Qt=0;var e=oa,n=Ar,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=F.T,F.T=null;var s=V.p;V.p=2;var d=ut;ut|=4;try{gx(e,n.alternate,n)}finally{ut=d,V.p=s,F.T=a}}Qt=3}}function Xx(){if(Qt===4||Qt===3){Qt=0,$n();var e=oa,n=Ar,a=Ll,s=zx;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Qt=5:(Qt=0,Ar=oa=null,Vx(e,e.pendingLanes));var d=e.pendingLanes;if(d===0&&(sa=null),gn(a),n=n.stateNode,ce&&typeof ce.onCommitFiberRoot=="function")try{ce.onCommitFiberRoot(Ye,n,void 0,(n.current.flags&128)===128)}catch{}if(s!==null){n=F.T,d=V.p,V.p=2,F.T=null;try{for(var x=e.onRecoverableError,w=0;w<s.length;w++){var C=s[w];x(C.value,{componentStack:C.stack})}}finally{F.T=n,V.p=d}}(Ll&3)!==0&&go(),hl(e),d=e.pendingLanes,(a&261930)!==0&&(d&42)!==0?e===Zu?_i++:(_i=0,Zu=e):_i=0,Fi(0)}}function Vx(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,mi(n)))}function go(){return Yx(),qx(),Xx(),Gx()}function Gx(){if(Qt!==5)return!1;var e=oa,n=Ku;Ku=0;var a=gn(Ll),s=F.T,d=V.p;try{V.p=32>a?32:a,F.T=null,a=Qu,Qu=null;var x=oa,w=Ll;if(Qt=0,Ar=oa=null,Ll=0,(ut&6)!==0)throw Error(i(331));var C=ut;if(ut|=4,Ax(x.current),Ex(x,x.current,w,a),ut=C,Fi(0,!1),ce&&typeof ce.onPostCommitFiberRoot=="function")try{ce.onPostCommitFiberRoot(Ye,x)}catch{}return!0}finally{V.p=d,F.T=s,Vx(e,n)}}function Kx(e,n,a){n=In(a,n),n=Au(e.stateNode,n,2),e=ta(e,n,2),e!==null&&(Nn(e,2),hl(e))}function gt(e,n,a){if(e.tag===3)Kx(e,e,a);else for(;n!==null;){if(n.tag===3){Kx(n,e,a);break}else if(n.tag===1){var s=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(sa===null||!sa.has(s))){e=In(a,e),a=Qm(2),s=ta(n,a,2),s!==null&&(Zm(a,s,n,e),Nn(s,2),hl(s));break}}n=n.return}}function Pu(e,n,a){var s=e.pingCache;if(s===null){s=e.pingCache=new h2;var d=new Set;s.set(n,d)}else d=s.get(n),d===void 0&&(d=new Set,s.set(n,d));d.has(a)||(Xu=!0,d.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,St===e&&(Je&a)===a&&($t===4||$t===3&&(Je&62914560)===Je&&300>Ft()-fo?(ut&2)===0&&Dr(e,0):Vu|=a,Nr===Je&&(Nr=0)),hl(e)}function Qx(e,n){n===0&&(n=Pa()),e=Ma(e,n),e!==null&&(Nn(e,n),hl(e))}function b2(e){var n=e.memoizedState,a=0;n!==null&&(a=n.retryLane),Qx(e,a)}function v2(e,n){var a=0;switch(e.tag){case 31:case 13:var s=e.stateNode,d=e.memoizedState;d!==null&&(a=d.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),Qx(e,a)}function w2(e,n){return on(e,n)}var bo=null,zr=null,ef=!1,vo=!1,tf=!1,ua=0;function hl(e){e!==zr&&e.next===null&&(zr===null?bo=zr=e:zr=zr.next=e),vo=!0,ef||(ef=!0,S2())}function Fi(e,n){if(!tf&&vo){tf=!0;do for(var a=!1,s=bo;s!==null;){if(e!==0){var d=s.pendingLanes;if(d===0)var x=0;else{var w=s.suspendedLanes,C=s.pingedLanes;x=(1<<31-rt(42|e)+1)-1,x&=d&~(w&~C),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(a=!0,Px(s,x))}else x=Je,x=el(s,s===St?x:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(x&3)===0||ql(s,x)||(a=!0,Px(s,x));s=s.next}while(a);tf=!1}}function k2(){Zx()}function Zx(){vo=ef=!1;var e=0;ua!==0&&_2()&&(e=ua);for(var n=Ft(),a=null,s=bo;s!==null;){var d=s.next,x=Wx(s,n);x===0?(s.next=null,a===null?bo=d:a.next=d,d===null&&(zr=a)):(a=s,(e!==0||(x&3)!==0)&&(vo=!0)),s=d}Qt!==0&&Qt!==5||Fi(e),ua!==0&&(ua=0)}function Wx(e,n){for(var a=e.suspendedLanes,s=e.pingedLanes,d=e.expirationTimes,x=e.pendingLanes&-62914561;0<x;){var w=31-rt(x),C=1<<w,O=d[w];O===-1?((C&a)===0||(C&s)!==0)&&(d[w]=bs(C,n)):O<=n&&(e.expiredLanes|=C),x&=~C}if(n=St,a=Je,a=el(e,e===n?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,a===0||e===n&&(yt===2||yt===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&Ct(s),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||ql(e,a)){if(n=a&-a,n===e.callbackPriority)return n;switch(s!==null&&Ct(s),gn(a)){case 2:case 8:a=xe;break;case 32:a=De;break;case 268435456:a=ye;break;default:a=De}return s=Jx.bind(null,e),a=on(a,s),e.callbackPriority=n,e.callbackNode=a,n}return s!==null&&s!==null&&Ct(s),e.callbackPriority=2,e.callbackNode=null,2}function Jx(e,n){if(Qt!==0&&Qt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(go()&&e.callbackNode!==a)return null;var s=Je;return s=el(e,e===St?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(_x(e,s,n),Wx(e,Ft()),e.callbackNode!=null&&e.callbackNode===a?Jx.bind(null,e):null)}function Px(e,n){if(go())return null;_x(e,n,!0)}function S2(){R2(function(){(ut&6)!==0?on(ae,k2):Zx()})}function nf(){if(ua===0){var e=pr;e===0&&(e=Wn,Wn<<=1,(Wn&261888)===0&&(Wn=256)),ua=e}return ua}function ep(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:$e(""+e)}function tp(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 j2(e,n,a,s,d){if(n==="submit"&&a&&a.stateNode===d){var x=ep((d[xt]||null).action),w=s.submitter;w&&(n=(n=w[xt]||null)?ep(n.formAction):w.getAttribute("formAction"),n!==null&&(x=n,w=null));var C=new zs("action","action",null,s,d);e.push({event:C,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(ua!==0){var O=w?tp(d,w):new FormData(d);ku(a,{pending:!0,data:O,method:d.method,action:x},null,O)}}else typeof x=="function"&&(C.preventDefault(),O=w?tp(d,w):new FormData(d),ku(a,{pending:!0,data:O,method:d.method,action:x},x,O))},currentTarget:d}]})}}for(var lf=0;lf<Lc.length;lf++){var af=Lc[lf],E2=af.toLowerCase(),C2=af[0].toUpperCase()+af.slice(1);ll(E2,"on"+C2)}ll(Mh,"onAnimationEnd"),ll(_h,"onAnimationIteration"),ll(Fh,"onAnimationStart"),ll("dblclick","onDoubleClick"),ll("focusin","onFocus"),ll("focusout","onBlur"),ll(Ig,"onTransitionRun"),ll(Yg,"onTransitionStart"),ll(qg,"onTransitionCancel"),ll(Rh,"onTransitionEnd"),Gl("onMouseEnter",["mouseout","mouseover"]),Gl("onMouseLeave",["mouseout","mouseover"]),Gl("onPointerEnter",["pointerout","pointerover"]),Gl("onPointerLeave",["pointerout","pointerover"]),cl("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),cl("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),cl("onBeforeInput",["compositionend","keypress","textInput","paste"]),cl("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),cl("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),cl("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ri="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(" "),N2=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ri));function np(e,n){n=(n&4)!==0;for(var a=0;a<e.length;a++){var s=e[a],d=s.event;s=s.listeners;e:{var x=void 0;if(n)for(var w=s.length-1;0<=w;w--){var C=s[w],O=C.instance,W=C.currentTarget;if(C=C.listener,O!==x&&d.isPropagationStopped())break e;x=C,d.currentTarget=W;try{x(d)}catch(re){Fs(re)}d.currentTarget=null,x=O}else for(w=0;w<s.length;w++){if(C=s[w],O=C.instance,W=C.currentTarget,C=C.listener,O!==x&&d.isPropagationStopped())break e;x=C,d.currentTarget=W;try{x(d)}catch(re){Fs(re)}d.currentTarget=null,x=O}}}}function Qe(e,n){var a=n[An];a===void 0&&(a=n[An]=new Set);var s=e+"__bubble";a.has(s)||(lp(n,e,2,!1),a.add(s))}function rf(e,n,a){var s=0;n&&(s|=4),lp(a,e,s,n)}var wo="_reactListening"+Math.random().toString(36).slice(2);function sf(e){if(!e[wo]){e[wo]=!0,Ss.forEach(function(a){a!=="selectionchange"&&(N2.has(a)||rf(a,!1,e),rf(a,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[wo]||(n[wo]=!0,rf("selectionchange",!1,n))}}function lp(e,n,a,s){switch(Mp(n)){case 2:var d=tb;break;case 8:d=nb;break;default:d=kf}a=d.bind(null,n,a,e),d=void 0,!Cc||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(d=!0),s?d!==void 0?e.addEventListener(n,a,{capture:!0,passive:d}):e.addEventListener(n,a,!0):d!==void 0?e.addEventListener(n,a,{passive:d}):e.addEventListener(n,a,!1)}function of(e,n,a,s,d){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 C=s.stateNode.containerInfo;if(C===d)break;if(w===4)for(w=s.return;w!==null;){var O=w.tag;if((O===3||O===4)&&w.stateNode.containerInfo===d)return;w=w.return}for(;C!==null;){if(w=Tt(C),w===null)return;if(O=w.tag,O===5||O===6||O===26||O===27){s=x=w;continue e}C=C.parentNode}}s=s.return}oh(function(){var W=x,re=jc(a),se=[];e:{var J=Oh.get(e);if(J!==void 0){var te=zs,Se=e;switch(e){case"keypress":if(Ds(a)===0)break e;case"keydown":case"keyup":te=vg;break;case"focusin":Se="focus",te=Tc;break;case"focusout":Se="blur",te=Tc;break;case"beforeblur":case"afterblur":te=Tc;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":te=fh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":te=og;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":te=Sg;break;case Mh:case _h:case Fh:te=fg;break;case Rh:te=Eg;break;case"scroll":case"scrollend":te=ig;break;case"wheel":te=Ng;break;case"copy":case"cut":case"paste":te=hg;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":te=hh;break;case"toggle":case"beforetoggle":te=Dg}var _e=(n&4)!==0,wt=!_e&&(e==="scroll"||e==="scrollend"),Q=_e?J!==null?J+"Capture":null:J;_e=[];for(var q=W,Z;q!==null;){var ie=q;if(Z=ie.stateNode,ie=ie.tag,ie!==5&&ie!==26&&ie!==27||Z===null||Q===null||(ie=li(q,Q),ie!=null&&_e.push(Oi(q,ie,Z))),wt)break;q=q.return}0<_e.length&&(J=new te(J,Se,null,a,re),se.push({event:J,listeners:_e}))}}if((n&7)===0){e:{if(J=e==="mouseover"||e==="pointerover",te=e==="mouseout"||e==="pointerout",J&&a!==Sc&&(Se=a.relatedTarget||a.fromElement)&&(Tt(Se)||Se[tl]))break e;if((te||J)&&(J=re.window===re?re:(J=re.ownerDocument)?J.defaultView||J.parentWindow:window,te?(Se=a.relatedTarget||a.toElement,te=W,Se=Se?Tt(Se):null,Se!==null&&(wt=u(Se),_e=Se.tag,Se!==wt||_e!==5&&_e!==27&&_e!==6)&&(Se=null)):(te=null,Se=W),te!==Se)){if(_e=fh,ie="onMouseLeave",Q="onMouseEnter",q="mouse",(e==="pointerout"||e==="pointerover")&&(_e=hh,ie="onPointerLeave",Q="onPointerEnter",q="pointer"),wt=te==null?J:Aa(te),Z=Se==null?J:Aa(Se),J=new _e(ie,q+"leave",te,a,re),J.target=wt,J.relatedTarget=Z,ie=null,Tt(re)===W&&(_e=new _e(Q,q+"enter",Se,a,re),_e.target=Z,_e.relatedTarget=wt,ie=_e),wt=ie,te&&Se)t:{for(_e=A2,Q=te,q=Se,Z=0,ie=Q;ie;ie=_e(ie))Z++;ie=0;for(var Te=q;Te;Te=_e(Te))ie++;for(;0<Z-ie;)Q=_e(Q),Z--;for(;0<ie-Z;)q=_e(q),ie--;for(;Z--;){if(Q===q||q!==null&&Q===q.alternate){_e=Q;break t}Q=_e(Q),q=_e(q)}_e=null}else _e=null;te!==null&&ap(se,J,te,_e,!1),Se!==null&&wt!==null&&ap(se,wt,Se,_e,!0)}}e:{if(J=W?Aa(W):window,te=J.nodeName&&J.nodeName.toLowerCase(),te==="select"||te==="input"&&J.type==="file")var st=wh;else if(bh(J))if(kh)st=Lg;else{st=Bg;var je=Og}else te=J.nodeName,!te||te.toLowerCase()!=="input"||J.type!=="checkbox"&&J.type!=="radio"?W&&Re(W.elementType)&&(st=wh):st=$g;if(st&&(st=st(e,W))){vh(se,st,a,re);break e}je&&je(e,J,W),e==="focusout"&&W&&J.type==="number"&&W.memoizedProps.value!=null&&ar(J,"number",J.value)}switch(je=W?Aa(W):window,e){case"focusin":(bh(je)||je.contentEditable==="true")&&(or=je,Oc=W,fi=null);break;case"focusout":fi=Oc=or=null;break;case"mousedown":Bc=!0;break;case"contextmenu":case"mouseup":case"dragend":Bc=!1,Th(se,a,re);break;case"selectionchange":if(Ug)break;case"keydown":case"keyup":Th(se,a,re)}var Ue;if(Mc)e:{switch(e){case"compositionstart":var Pe="onCompositionStart";break e;case"compositionend":Pe="onCompositionEnd";break e;case"compositionupdate":Pe="onCompositionUpdate";break e}Pe=void 0}else sr?yh(e,a)&&(Pe="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Pe="onCompositionStart");Pe&&(mh&&a.locale!=="ko"&&(sr||Pe!=="onCompositionStart"?Pe==="onCompositionEnd"&&sr&&(Ue=ch()):(Kl=re,Nc="value"in Kl?Kl.value:Kl.textContent,sr=!0)),je=ko(W,Pe),0<je.length&&(Pe=new dh(Pe,e,null,a,re),se.push({event:Pe,listeners:je}),Ue?Pe.data=Ue:(Ue=gh(a),Ue!==null&&(Pe.data=Ue)))),(Ue=zg?Mg(e,a):_g(e,a))&&(Pe=ko(W,"onBeforeInput"),0<Pe.length&&(je=new dh("onBeforeInput","beforeinput",null,a,re),se.push({event:je,listeners:Pe}),je.data=Ue)),j2(se,e,W,a,re)}np(se,n)})}function Oi(e,n,a){return{instance:e,listener:n,currentTarget:a}}function ko(e,n){for(var a=n+"Capture",s=[];e!==null;){var d=e,x=d.stateNode;if(d=d.tag,d!==5&&d!==26&&d!==27||x===null||(d=li(e,a),d!=null&&s.unshift(Oi(e,d,x)),d=li(e,n),d!=null&&s.push(Oi(e,d,x))),e.tag===3)return s;e=e.return}return[]}function A2(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function ap(e,n,a,s,d){for(var x=n._reactName,w=[];a!==null&&a!==s;){var C=a,O=C.alternate,W=C.stateNode;if(C=C.tag,O!==null&&O===s)break;C!==5&&C!==26&&C!==27||W===null||(O=W,d?(W=li(a,x),W!=null&&w.unshift(Oi(a,W,O))):d||(W=li(a,x),W!=null&&w.push(Oi(a,W,O)))),a=a.return}w.length!==0&&e.push({event:n,listeners:w})}var D2=/\r\n?/g,T2=/\u0000|\uFFFD/g;function rp(e){return(typeof e=="string"?e:""+e).replace(D2,`
|
|
49
|
+
`).replace(T2,"")}function ip(e,n){return n=rp(n),rp(e)===n}function vt(e,n,a,s,d,x){switch(a){case"children":typeof s=="string"?n==="body"||n==="textarea"&&s===""||ge(e,s):(typeof s=="number"||typeof s=="bigint")&&n!=="body"&&ge(e,""+s);break;case"className":nr(e,"class",s);break;case"tabIndex":nr(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":nr(e,a,s);break;case"style":ze(e,s,x);break;case"data":if(n!=="object"){nr(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=$e(""+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"&&vt(e,n,"name",d.name,d,null),vt(e,n,"formEncType",d.formEncType,d,null),vt(e,n,"formMethod",d.formMethod,d,null),vt(e,n,"formTarget",d.formTarget,d,null)):(vt(e,n,"encType",d.encType,d,null),vt(e,n,"method",d.method,d,null),vt(e,n,"target",d.target,d,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(a);break}s=$e(""+s),e.setAttribute(a,s);break;case"onClick":s!=null&&(e.onclick=ht);break;case"onScroll":s!=null&&Qe("scroll",e);break;case"onScrollEnd":s!=null&&Qe("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(d.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=$e(""+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":Qe("beforetoggle",e),Qe("toggle",e),tr(e,"popover",s);break;case"xlinkActuate":en(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":en(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":en(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":en(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":en(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":en(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":en(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":en(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":en(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":tr(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=We.get(a)||a,tr(e,a,s))}}function cf(e,n,a,s,d,x){switch(a){case"style":ze(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(d.children!=null)throw Error(i(60));e.innerHTML=a}}break;case"children":typeof s=="string"?ge(e,s):(typeof s=="number"||typeof s=="bigint")&&ge(e,""+s);break;case"onScroll":s!=null&&Qe("scroll",e);break;case"onScrollEnd":s!=null&&Qe("scrollend",e);break;case"onClick":s!=null&&(e.onclick=ht);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!js.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(d=a.endsWith("Capture"),n=a.slice(2,d?a.length-7:void 0),x=e[xt]||null,x=x!=null?x[a]:null,typeof x=="function"&&e.removeEventListener(n,x,d),typeof s=="function")){typeof x!="function"&&x!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(n,s,d);break e}a in e?e[a]=s:s===!0?e.setAttribute(a,""):tr(e,a,s)}}}function sn(e,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Qe("error",e),Qe("load",e);var s=!1,d=!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":d=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:vt(e,n,x,w,a,null)}}d&&vt(e,n,"srcSet",a.srcSet,a,null),s&&vt(e,n,"src",a.src,a,null);return;case"input":Qe("invalid",e);var C=x=w=d=null,O=null,W=null;for(s in a)if(a.hasOwnProperty(s)){var re=a[s];if(re!=null)switch(s){case"name":d=re;break;case"type":w=re;break;case"checked":O=re;break;case"defaultChecked":W=re;break;case"value":x=re;break;case"defaultValue":C=re;break;case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(i(137,n));break;default:vt(e,n,s,re,a,null)}}ni(e,x,C,O,W,w,d,!1);return;case"select":Qe("invalid",e),s=w=x=null;for(d in a)if(a.hasOwnProperty(d)&&(C=a[d],C!=null))switch(d){case"value":x=C;break;case"defaultValue":w=C;break;case"multiple":s=C;default:vt(e,n,d,C,a,null)}n=x,a=w,e.multiple=!!s,n!=null?jl(e,!!s,n,!1):a!=null&&jl(e,!!s,a,!0);return;case"textarea":Qe("invalid",e),x=d=s=null;for(w in a)if(a.hasOwnProperty(w)&&(C=a[w],C!=null))switch(w){case"value":s=C;break;case"defaultValue":d=C;break;case"children":x=C;break;case"dangerouslySetInnerHTML":if(C!=null)throw Error(i(91));break;default:vt(e,n,w,C,a,null)}ue(e,s,d,x);return;case"option":for(O in a)if(a.hasOwnProperty(O)&&(s=a[O],s!=null))switch(O){case"selected":e.selected=s&&typeof s!="function"&&typeof s!="symbol";break;default:vt(e,n,O,s,a,null)}return;case"dialog":Qe("beforetoggle",e),Qe("toggle",e),Qe("cancel",e),Qe("close",e);break;case"iframe":case"object":Qe("load",e);break;case"video":case"audio":for(s=0;s<Ri.length;s++)Qe(Ri[s],e);break;case"image":Qe("error",e),Qe("load",e);break;case"details":Qe("toggle",e);break;case"embed":case"source":case"link":Qe("error",e),Qe("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(W in a)if(a.hasOwnProperty(W)&&(s=a[W],s!=null))switch(W){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:vt(e,n,W,s,a,null)}return;default:if(Re(n)){for(re in a)a.hasOwnProperty(re)&&(s=a[re],s!==void 0&&cf(e,n,re,s,a,void 0));return}}for(C in a)a.hasOwnProperty(C)&&(s=a[C],s!=null&&vt(e,n,C,s,a,null))}function z2(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 d=null,x=null,w=null,C=null,O=null,W=null,re=null;for(te in a){var se=a[te];if(a.hasOwnProperty(te)&&se!=null)switch(te){case"checked":break;case"value":break;case"defaultValue":O=se;default:s.hasOwnProperty(te)||vt(e,n,te,null,s,se)}}for(var J in s){var te=s[J];if(se=a[J],s.hasOwnProperty(J)&&(te!=null||se!=null))switch(J){case"type":x=te;break;case"name":d=te;break;case"checked":W=te;break;case"defaultChecked":re=te;break;case"value":w=te;break;case"defaultValue":C=te;break;case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(i(137,n));break;default:te!==se&&vt(e,n,J,te,s,se)}}Sl(e,w,C,O,W,re,x,d);return;case"select":te=w=C=J=null;for(x in a)if(O=a[x],a.hasOwnProperty(x)&&O!=null)switch(x){case"value":break;case"multiple":te=O;default:s.hasOwnProperty(x)||vt(e,n,x,null,s,O)}for(d in s)if(x=s[d],O=a[d],s.hasOwnProperty(d)&&(x!=null||O!=null))switch(d){case"value":J=x;break;case"defaultValue":C=x;break;case"multiple":w=x;default:x!==O&&vt(e,n,d,x,s,O)}n=C,a=w,s=te,J!=null?jl(e,!!a,J,!1):!!s!=!!a&&(n!=null?jl(e,!!a,n,!0):jl(e,!!a,a?[]:"",!1));return;case"textarea":te=J=null;for(C in a)if(d=a[C],a.hasOwnProperty(C)&&d!=null&&!s.hasOwnProperty(C))switch(C){case"value":break;case"children":break;default:vt(e,n,C,null,s,d)}for(w in s)if(d=s[w],x=a[w],s.hasOwnProperty(w)&&(d!=null||x!=null))switch(w){case"value":J=d;break;case"defaultValue":te=d;break;case"children":break;case"dangerouslySetInnerHTML":if(d!=null)throw Error(i(91));break;default:d!==x&&vt(e,n,w,d,s,x)}U(e,J,te);return;case"option":for(var Se in a)if(J=a[Se],a.hasOwnProperty(Se)&&J!=null&&!s.hasOwnProperty(Se))switch(Se){case"selected":e.selected=!1;break;default:vt(e,n,Se,null,s,J)}for(O in s)if(J=s[O],te=a[O],s.hasOwnProperty(O)&&J!==te&&(J!=null||te!=null))switch(O){case"selected":e.selected=J&&typeof J!="function"&&typeof J!="symbol";break;default:vt(e,n,O,J,s,te)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var _e in a)J=a[_e],a.hasOwnProperty(_e)&&J!=null&&!s.hasOwnProperty(_e)&&vt(e,n,_e,null,s,J);for(W in s)if(J=s[W],te=a[W],s.hasOwnProperty(W)&&J!==te&&(J!=null||te!=null))switch(W){case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(i(137,n));break;default:vt(e,n,W,J,s,te)}return;default:if(Re(n)){for(var wt in a)J=a[wt],a.hasOwnProperty(wt)&&J!==void 0&&!s.hasOwnProperty(wt)&&cf(e,n,wt,void 0,s,J);for(re in s)J=s[re],te=a[re],!s.hasOwnProperty(re)||J===te||J===void 0&&te===void 0||cf(e,n,re,J,s,te);return}}for(var Q in a)J=a[Q],a.hasOwnProperty(Q)&&J!=null&&!s.hasOwnProperty(Q)&&vt(e,n,Q,null,s,J);for(se in s)J=s[se],te=a[se],!s.hasOwnProperty(se)||J===te||J==null&&te==null||vt(e,n,se,J,s,te)}function sp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function M2(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,a=performance.getEntriesByType("resource"),s=0;s<a.length;s++){var d=a[s],x=d.transferSize,w=d.initiatorType,C=d.duration;if(x&&C&&sp(w)){for(w=0,C=d.responseEnd,s+=1;s<a.length;s++){var O=a[s],W=O.startTime;if(W>C)break;var re=O.transferSize,se=O.initiatorType;re&&sp(se)&&(O=O.responseEnd,w+=re*(O<C?1:(C-W)/(O-W)))}if(--s,n+=8*(x+w)/(d.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 uf=null,ff=null;function So(e){return e.nodeType===9?e:e.ownerDocument}function op(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 cp(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 df(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 hf=null;function _2(){var e=window.event;return e&&e.type==="popstate"?e===hf?!1:(hf=e,!0):(hf=null,!1)}var up=typeof setTimeout=="function"?setTimeout:void 0,F2=typeof clearTimeout=="function"?clearTimeout:void 0,fp=typeof Promise=="function"?Promise:void 0,R2=typeof queueMicrotask=="function"?queueMicrotask:typeof fp<"u"?function(e){return fp.resolve(null).then(e).catch(O2)}:up;function O2(e){setTimeout(function(){throw e})}function fa(e){return e==="head"}function dp(e,n){var a=n,s=0;do{var d=a.nextSibling;if(e.removeChild(a),d&&d.nodeType===8)if(a=d.data,a==="/$"||a==="/&"){if(s===0){e.removeChild(d),Rr(n);return}s--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")s++;else if(a==="html")Bi(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,Bi(a);for(var x=a.firstChild;x;){var w=x.nextSibling,C=x.nodeName;x[nl]||C==="SCRIPT"||C==="STYLE"||C==="LINK"&&x.rel.toLowerCase()==="stylesheet"||a.removeChild(x),x=w}}else a==="body"&&Bi(e.ownerDocument.body);a=d}while(a);Rr(n)}function hp(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),ei(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function B2(e,n,a,s){for(;e.nodeType===1;){var d=a;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!s&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(s){if(!e[nl])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!==d.rel||e.getAttribute("href")!==(d.href==null||d.href===""?null:d.href)||e.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin)||e.getAttribute("title")!==(d.title==null?null:d.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(x=e.getAttribute("src"),(x!==(d.src==null?null:d.src)||e.getAttribute("type")!==(d.type==null?null:d.type)||e.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin))&&x&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var x=d.name==null?null:""+d.name;if(d.type==="hidden"&&e.getAttribute("name")===x)return e}else return e;if(e=Gn(e.nextSibling),e===null)break}return null}function $2(e,n,a){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=Gn(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=Gn(e.nextSibling),e===null))return null;return e}function xf(e){return e.data==="$?"||e.data==="$~"}function pf(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function L2(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 Gn(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 yf=null;function xp(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(n===0)return Gn(e.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}e=e.nextSibling}return null}function pp(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 yp(e,n,a){switch(n=So(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 Bi(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);ei(e)}var Kn=new Map,gp=new Set;function jo(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Hl=V.d;V.d={f:H2,r:U2,D:I2,C:Y2,L:q2,m:X2,X:G2,S:V2,M:K2};function H2(){var e=Hl.f(),n=xo();return e||n}function U2(e){var n=Vl(e);n!==null&&n.tag===5&&n.type==="form"?Rm(n):Hl.r(e)}var Mr=typeof document>"u"?null:document;function bp(e,n,a){var s=Mr;if(s&&typeof n=="string"&&n){var d=pt(n);d='link[rel="'+e+'"][href="'+d+'"]',typeof a=="string"&&(d+='[crossorigin="'+a+'"]'),gp.has(d)||(gp.add(d),e={rel:e,crossOrigin:a,href:n},s.querySelector(d)===null&&(n=s.createElement("link"),sn(n,"link",e),Ot(n),s.head.appendChild(n)))}}function I2(e){Hl.D(e),bp("dns-prefetch",e,null)}function Y2(e,n){Hl.C(e,n),bp("preconnect",e,n)}function q2(e,n,a){Hl.L(e,n,a);var s=Mr;if(s&&e&&n){var d='link[rel="preload"][as="'+pt(n)+'"]';n==="image"&&a&&a.imageSrcSet?(d+='[imagesrcset="'+pt(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(d+='[imagesizes="'+pt(a.imageSizes)+'"]')):d+='[href="'+pt(e)+'"]';var x=d;switch(n){case"style":x=_r(e);break;case"script":x=Fr(e)}Kn.has(x)||(e=y({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:e,as:n},a),Kn.set(x,e),s.querySelector(d)!==null||n==="style"&&s.querySelector($i(x))||n==="script"&&s.querySelector(Li(x))||(n=s.createElement("link"),sn(n,"link",e),Ot(n),s.head.appendChild(n)))}}function X2(e,n){Hl.m(e,n);var a=Mr;if(a&&e){var s=n&&typeof n.as=="string"?n.as:"script",d='link[rel="modulepreload"][as="'+pt(s)+'"][href="'+pt(e)+'"]',x=d;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=Fr(e)}if(!Kn.has(x)&&(e=y({rel:"modulepreload",href:e},n),Kn.set(x,e),a.querySelector(d)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Li(x)))return}s=a.createElement("link"),sn(s,"link",e),Ot(s),a.head.appendChild(s)}}}function V2(e,n,a){Hl.S(e,n,a);var s=Mr;if(s&&e){var d=kl(s).hoistableStyles,x=_r(e);n=n||"default";var w=d.get(x);if(!w){var C={loading:0,preload:null};if(w=s.querySelector($i(x)))C.loading=5;else{e=y({rel:"stylesheet",href:e,"data-precedence":n},a),(a=Kn.get(x))&&gf(e,a);var O=w=s.createElement("link");Ot(O),sn(O,"link",e),O._p=new Promise(function(W,re){O.onload=W,O.onerror=re}),O.addEventListener("load",function(){C.loading|=1}),O.addEventListener("error",function(){C.loading|=2}),C.loading|=4,Eo(w,n,s)}w={type:"stylesheet",instance:w,count:1,state:C},d.set(x,w)}}}function G2(e,n){Hl.X(e,n);var a=Mr;if(a&&e){var s=kl(a).hoistableScripts,d=Fr(e),x=s.get(d);x||(x=a.querySelector(Li(d)),x||(e=y({src:e,async:!0},n),(n=Kn.get(d))&&bf(e,n),x=a.createElement("script"),Ot(x),sn(x,"link",e),a.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},s.set(d,x))}}function K2(e,n){Hl.M(e,n);var a=Mr;if(a&&e){var s=kl(a).hoistableScripts,d=Fr(e),x=s.get(d);x||(x=a.querySelector(Li(d)),x||(e=y({src:e,async:!0,type:"module"},n),(n=Kn.get(d))&&bf(e,n),x=a.createElement("script"),Ot(x),sn(x,"link",e),a.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},s.set(d,x))}}function vp(e,n,a,s){var d=(d=ve.current)?jo(d):null;if(!d)throw Error(i(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(n=_r(a.href),a=kl(d).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=_r(a.href);var x=kl(d).hoistableStyles,w=x.get(e);if(w||(d=d.ownerDocument||d,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(e,w),(x=d.querySelector($i(e)))&&!x._p&&(w.instance=x,w.state.loading=5),Kn.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},Kn.set(e,a),x||Q2(d,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=Fr(a),a=kl(d).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 _r(e){return'href="'+pt(e)+'"'}function $i(e){return'link[rel="stylesheet"]['+e+"]"}function wp(e){return y({},e,{"data-precedence":e.precedence,precedence:null})}function Q2(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}),sn(n,"link",a),Ot(n),e.head.appendChild(n))}function Fr(e){return'[src="'+pt(e)+'"]'}function Li(e){return"script[async]"+e}function kp(e,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var s=e.querySelector('style[data-href~="'+pt(a.href)+'"]');if(s)return n.instance=s,Ot(s),s;var d=y({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),Ot(s),sn(s,"style",d),Eo(s,a.precedence,e),n.instance=s;case"stylesheet":d=_r(a.href);var x=e.querySelector($i(d));if(x)return n.state.loading|=4,n.instance=x,Ot(x),x;s=wp(a),(d=Kn.get(d))&&gf(s,d),x=(e.ownerDocument||e).createElement("link"),Ot(x);var w=x;return w._p=new Promise(function(C,O){w.onload=C,w.onerror=O}),sn(x,"link",s),n.state.loading|=4,Eo(x,a.precedence,e),n.instance=x;case"script":return x=Fr(a.src),(d=e.querySelector(Li(x)))?(n.instance=d,Ot(d),d):(s=a,(d=Kn.get(x))&&(s=y({},a),bf(s,d)),e=e.ownerDocument||e,d=e.createElement("script"),Ot(d),sn(d,"link",s),e.head.appendChild(d),n.instance=d);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,Eo(s,a.precedence,e));return n.instance}function Eo(e,n,a){for(var s=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),d=s.length?s[s.length-1]:null,x=d,w=0;w<s.length;w++){var C=s[w];if(C.dataset.precedence===n)x=C;else if(x!==d)break}x?x.parentNode.insertBefore(e,x.nextSibling):(n=a.nodeType===9?a.head:a,n.insertBefore(e,n.firstChild))}function gf(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 Co=null;function Sp(e,n,a){if(Co===null){var s=new Map,d=Co=new Map;d.set(a,s)}else d=Co,s=d.get(a),s||(s=new Map,d.set(a,s));if(s.has(e))return s;for(s.set(e,null),a=a.getElementsByTagName(e),d=0;d<a.length;d++){var x=a[d];if(!(x[nl]||x[Rt]||e==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var w=x.getAttribute(n)||"";w=e+w;var C=s.get(w);C?C.push(x):s.set(w,[x])}}return s}function jp(e,n,a){e=e.ownerDocument||e,e.head.insertBefore(a,n==="title"?e.querySelector("head > title"):null)}function Z2(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 Ep(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function W2(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 d=_r(s.href),x=n.querySelector($i(d));if(x){n=x._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=No.bind(e),n.then(e,e)),a.state.loading|=4,a.instance=x,Ot(x);return}x=n.ownerDocument||n,s=wp(s),(d=Kn.get(d))&&gf(s,d),x=x.createElement("link"),Ot(x);var w=x;w._p=new Promise(function(C,O){w.onload=C,w.onerror=O}),sn(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=No.bind(e),n.addEventListener("load",a),n.addEventListener("error",a))}}var vf=0;function J2(e,n){return e.stylesheets&&e.count===0&&Do(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var s=setTimeout(function(){if(e.stylesheets&&Do(e,e.stylesheets),e.unsuspend){var x=e.unsuspend;e.unsuspend=null,x()}},6e4+n);0<e.imgBytes&&vf===0&&(vf=62500*M2());var d=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Do(e,e.stylesheets),e.unsuspend)){var x=e.unsuspend;e.unsuspend=null,x()}},(e.imgBytes>vf?50:800)+n);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(d)}}:null}function No(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Do(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Ao=null;function Do(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Ao=new Map,n.forEach(P2,e),Ao=null,No.call(e))}function P2(e,n){if(!(n.state.loading&4)){var a=Ao.get(e);if(a)var s=a.get(null);else{a=new Map,Ao.set(e,a);for(var d=e.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<d.length;x++){var w=d[x];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(a.set(w.dataset.precedence,w),s=w)}s&&a.set(null,s)}d=n.instance,w=d.getAttribute("data-precedence"),x=a.get(w)||s,x===s&&a.set(null,d),a.set(w,d),this.count++,s=No.bind(this),d.addEventListener("load",s),d.addEventListener("error",s),x?x.parentNode.insertBefore(d,x.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(d,e.firstChild)),n.state.loading|=4}}var Hi={$$typeof:H,Provider:null,Consumer:null,_currentValue:P,_currentValue2:P,_threadCount:0};function eb(e,n,a,s,d,x,w,C,O){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=er(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=er(0),this.hiddenUpdates=er(null),this.identifierPrefix=s,this.onUncaughtError=d,this.onCaughtError=x,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=O,this.incompleteTransitions=new Map}function Cp(e,n,a,s,d,x,w,C,O,W,re,se){return e=new eb(e,n,a,w,O,W,re,se,C),n=1,x===!0&&(n|=24),x=Tn(3,null,null,n),e.current=x,x.stateNode=e,n=Jc(),n.refCount++,e.pooledCache=n,n.refCount++,x.memoizedState={element:s,isDehydrated:a,cache:n},nu(x),e}function Np(e){return e?(e=fr,e):fr}function Ap(e,n,a,s,d,x){d=Np(d),s.context===null?s.context=d:s.pendingContext=d,s=ea(n),s.payload={element:a},x=x===void 0?null:x,x!==null&&(s.callback=x),a=ta(e,s,n),a!==null&&(jn(a,e,n),gi(a,e,n))}function Dp(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<n?a:n}}function wf(e,n){Dp(e,n),(e=e.alternate)&&Dp(e,n)}function Tp(e){if(e.tag===13||e.tag===31){var n=Ma(e,67108864);n!==null&&jn(n,e,67108864),wf(e,67108864)}}function zp(e){if(e.tag===13||e.tag===31){var n=Rn();n=Na(n);var a=Ma(e,n);a!==null&&jn(a,e,n),wf(e,n)}}var To=!0;function tb(e,n,a,s){var d=F.T;F.T=null;var x=V.p;try{V.p=2,kf(e,n,a,s)}finally{V.p=x,F.T=d}}function nb(e,n,a,s){var d=F.T;F.T=null;var x=V.p;try{V.p=8,kf(e,n,a,s)}finally{V.p=x,F.T=d}}function kf(e,n,a,s){if(To){var d=Sf(s);if(d===null)of(e,n,s,zo,a),_p(e,s);else if(ab(d,e,n,a,s))s.stopPropagation();else if(_p(e,s),n&4&&-1<lb.indexOf(e)){for(;d!==null;){var x=Vl(d);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var w=sl(x.pendingLanes);if(w!==0){var C=x;for(C.pendingLanes|=2,C.entangledLanes|=2;w;){var O=1<<31-rt(w);C.entanglements[1]|=O,w&=~O}hl(x),(ut&6)===0&&(ho=Ft()+500,Fi(0))}}break;case 31:case 13:C=Ma(x,2),C!==null&&jn(C,x,2),xo(),wf(x,2)}if(x=Sf(s),x===null&&of(e,n,s,zo,a),x===d)break;d=x}d!==null&&s.stopPropagation()}else of(e,n,s,null,a)}}function Sf(e){return e=jc(e),jf(e)}var zo=null;function jf(e){if(zo=null,e=Tt(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 zo=e,null}function Mp(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(Ln()){case ae:return 2;case xe:return 8;case De:case he:return 32;case ye:return 268435456;default:return 32}default:return 32}}var Ef=!1,da=null,ha=null,ma=null,Ui=new Map,Ii=new Map,xa=[],lb="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 _p(e,n){switch(e){case"focusin":case"focusout":da=null;break;case"dragenter":case"dragleave":ha=null;break;case"mouseover":case"mouseout":ma=null;break;case"pointerover":case"pointerout":Ui.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ii.delete(n.pointerId)}}function Yi(e,n,a,s,d,x){return e===null||e.nativeEvent!==x?(e={blockedOn:n,domEventName:a,eventSystemFlags:s,nativeEvent:x,targetContainers:[d]},n!==null&&(n=Vl(n),n!==null&&Tp(n)),e):(e.eventSystemFlags|=s,n=e.targetContainers,d!==null&&n.indexOf(d)===-1&&n.push(d),e)}function ab(e,n,a,s,d){switch(n){case"focusin":return da=Yi(da,e,n,a,s,d),!0;case"dragenter":return ha=Yi(ha,e,n,a,s,d),!0;case"mouseover":return ma=Yi(ma,e,n,a,s,d),!0;case"pointerover":var x=d.pointerId;return Ui.set(x,Yi(Ui.get(x)||null,e,n,a,s,d)),!0;case"gotpointercapture":return x=d.pointerId,Ii.set(x,Yi(Ii.get(x)||null,e,n,a,s,d)),!0}return!1}function Fp(e){var n=Tt(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,Xl(e.priority,function(){zp(a)});return}}else if(n===31){if(n=m(a),n!==null){e.blockedOn=n,Xl(e.priority,function(){zp(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 Mo(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var a=Sf(e.nativeEvent);if(a===null){a=e.nativeEvent;var s=new a.constructor(a.type,a);Sc=s,a.target.dispatchEvent(s),Sc=null}else return n=Vl(a),n!==null&&Tp(n),e.blockedOn=a,!1;n.shift()}return!0}function Rp(e,n,a){Mo(e)&&a.delete(n)}function rb(){Ef=!1,da!==null&&Mo(da)&&(da=null),ha!==null&&Mo(ha)&&(ha=null),ma!==null&&Mo(ma)&&(ma=null),Ui.forEach(Rp),Ii.forEach(Rp)}function _o(e,n){e.blockedOn===n&&(e.blockedOn=null,Ef||(Ef=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,rb)))}var Fo=null;function Op(e){Fo!==e&&(Fo=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Fo===e&&(Fo=null);for(var n=0;n<e.length;n+=3){var a=e[n],s=e[n+1],d=e[n+2];if(typeof s!="function"){if(jf(s||a)===null)continue;break}var x=Vl(a);x!==null&&(e.splice(n,3),n-=3,ku(x,{pending:!0,data:d,method:a.method,action:s},s,d))}}))}function Rr(e){function n(O){return _o(O,e)}da!==null&&_o(da,e),ha!==null&&_o(ha,e),ma!==null&&_o(ma,e),Ui.forEach(n),Ii.forEach(n);for(var a=0;a<xa.length;a++){var s=xa[a];s.blockedOn===e&&(s.blockedOn=null)}for(;0<xa.length&&(a=xa[0],a.blockedOn===null);)Fp(a),a.blockedOn===null&&xa.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(s=0;s<a.length;s+=3){var d=a[s],x=a[s+1],w=d[xt]||null;if(typeof x=="function")w||Op(a);else if(w){var C=null;if(x&&x.hasAttribute("formAction")){if(d=x,w=x[xt]||null)C=w.formAction;else if(jf(d)!==null)continue}else C=w.action;typeof C=="function"?a[s+1]=C:(a.splice(s,3),s-=3),Op(a)}}}function Bp(){function e(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(w){return d=w})},focusReset:"manual",scroll:"manual"})}function n(){d!==null&&(d(),d=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,d=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),d!==null&&(d(),d=null)}}}function Cf(e){this._internalRoot=e}Ro.prototype.render=Cf.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(i(409));var a=n.current,s=Rn();Ap(a,s,e,n,null,null)},Ro.prototype.unmount=Cf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;Ap(e.current,2,null,e,null,null),xo(),n[tl]=null}};function Ro(e){this._internalRoot=e}Ro.prototype.unstable_scheduleHydration=function(e){if(e){var n=wl();e={blockedOn:null,target:e,priority:n};for(var a=0;a<xa.length&&n!==0&&n<xa[a].priority;a++);xa.splice(a,0,e),a===0&&Fp(e)}};var $p=l.version;if($p!=="19.2.4")throw Error(i(527,$p,"19.2.4"));V.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=h(n),e=e!==null?g(e):null,e=e===null?null:e.stateNode,e};var ib={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:F,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Oo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Oo.isDisabled&&Oo.supportsFiber)try{Ye=Oo.inject(ib),ce=Oo}catch{}}return Xi.createRoot=function(e,n){if(!o(e))throw Error(i(299));var a=!1,s="",d=Xm,x=Vm,w=Gm;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onUncaughtError!==void 0&&(d=n.onUncaughtError),n.onCaughtError!==void 0&&(x=n.onCaughtError),n.onRecoverableError!==void 0&&(w=n.onRecoverableError)),n=Cp(e,1,!1,null,null,a,s,null,d,x,w,Bp),e[tl]=n.current,sf(e),new Cf(n)},Xi.hydrateRoot=function(e,n,a){if(!o(e))throw Error(i(299));var s=!1,d="",x=Xm,w=Vm,C=Gm,O=null;return a!=null&&(a.unstable_strictMode===!0&&(s=!0),a.identifierPrefix!==void 0&&(d=a.identifierPrefix),a.onUncaughtError!==void 0&&(x=a.onUncaughtError),a.onCaughtError!==void 0&&(w=a.onCaughtError),a.onRecoverableError!==void 0&&(C=a.onRecoverableError),a.formState!==void 0&&(O=a.formState)),n=Cp(e,1,!0,n,a??null,s,d,O,x,w,C,Bp),n.context=Np(null),a=n.current,s=Rn(),s=Na(s),d=ea(s),d.callback=null,ta(a,d,s),a=s,n.current.lanes=a,Nn(n,a),hl(n),e[tl]=n.current,sf(e),new Ro(n)},Xi.version="19.2.4",Xi}var Qp;function gb(){if(Qp)return Df.exports;Qp=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(),Df.exports=yb(),Df.exports}var bb=gb();const vb="modulepreload",wb=function(t){return"/"+t},Zp={},kb=function(l,r,i){let o=Promise.resolve();if(r&&r.length>0){let f=function(h){return Promise.all(h.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"));o=f(r.map(h=>{if(h=wb(h),h in Zp)return;Zp[h]=!0;const g=h.endsWith(".css"),y=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${y}`))return;const b=document.createElement("link");if(b.rel=g?"stylesheet":vb,g||(b.as="script"),b.crossOrigin="",b.href=h,p&&b.setAttribute("nonce",p),document.head.appendChild(b),g)return new Promise((v,k)=>{b.addEventListener("load",v),b.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${h}`)))})}))}function u(f){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=f,window.dispatchEvent(m),!m.defaultPrevented)throw f}return o.then(f=>{for(const m of f||[])m.status==="rejected"&&u(m.reason);return l().catch(u)})};class Sb extends j.Component{constructor(){super(...arguments);Lp(this,"state",{hasError:!1,error:null})}static getDerivedStateFromError(r){return{hasError:!0,error:r}}render(){var r;return this.state.hasError?c.jsx("div",{className:"h-screen flex items-center justify-center bg-[var(--floor-light)]",children:c.jsxs("div",{className:"text-center max-w-md",children:[c.jsx("div",{className:"text-4xl mb-3",children:"🚨"}),c.jsx("div",{className:"text-gray-800 font-semibold mb-2",children:"Something went wrong"}),c.jsx("div",{className:"text-gray-500 text-sm mb-4",children:((r=this.state.error)==null?void 0:r.message)??"An unexpected error occurred."}),c.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 It(t){const l=await fetch(`${ms}${t}`);if(!l.ok)throw new Error(`API error: ${l.status}`);return l.json()}async function Qn(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 _f(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 Or(t,l){const r={method:"DELETE"};l!==void 0&&(r.headers={"Content-Type":"application/json"},r.body=JSON.stringify(l));const i=await fetch(`${ms}${t}`,r);if(!i.ok)throw new Error(`API error: ${i.status}`);return i.json()}const Ce={getCompany:()=>It("/company"),getRoles:()=>It("/roles"),getRole:t=>It(`/roles/${t}`),getProjects:()=>It("/projects"),getProject:t=>It(`/projects/${t}`),getStandups:()=>It("/operations/standups"),getWaves:()=>It("/operations/waves"),getDecisions:()=>It("/operations/decisions"),getOrgTree:()=>It("/engine/org"),getSkills:()=>It("/skills"),createRole:t=>Qn("/engine/roles",t),updateRole:(t,l)=>_f(`/engine/roles/${t}`,l),deleteRole:t=>Or(`/engine/roles/${t}`),getSessions:()=>It("/sessions"),getSession:t=>It(`/sessions/${t}`),createSession:(t,l="talk")=>Qn("/sessions",{roleId:t,mode:l}),deleteSession:t=>Or(`/sessions/${t}`),deleteSessions:t=>Or("/sessions",{ids:t}),deleteEmptySessions:()=>Or("/sessions?empty=true"),updateSession:(t,l)=>_f(`/sessions/${t}`,l),startJob:t=>Qn("/jobs",t),getJob:t=>It(`/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 It(`/jobs${r?"?"+r:""}`)},abortJob:t=>Or(`/jobs/${t}`),getStatus:()=>It("/status"),detectEngine:()=>Qn("/setup/detect-engine",{}),validatePath:t=>Qn("/setup/validate-path",{path:t}),scaffold:t=>Qn("/setup/scaffold",t),getTeams:()=>It("/setup/teams"),browse:t=>Qn("/setup/browse",{path:t}),connectAkb:t=>Qn("/setup/connect-akb",{path:t}),getKnowledge:()=>It("/knowledge"),getKnowledgeDoc:t=>It(`/knowledge/${t}`),createKnowledgeDoc:t=>Qn("/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=>Or(`/knowledge/${t}`),getPreferences:()=>It("/preferences"),updatePreferences:t=>_f("/preferences",t),chatInChannel:t=>Qn("/speech/chat",t),getSaveStatus:()=>It("/save/status"),save:t=>Qn("/save",{message:t}),getSaveHistory:(t=20)=>It(`/save/history?limit=${t}`),restoreSave:(t,l)=>Qn("/save/restore",{sha:t,paths:l})};function g0(t){const[l,r]=j.useState([]),[i,o]=j.useState("idle"),[u,f]=j.useState(""),[m,p]=j.useState([]),h=j.useRef(-1),g=j.useRef(null),y=j.useRef(0),b=j.useCallback(()=>{var E;if(!t)return;(E=g.current)==null||E.abort();const k=new AbortController;g.current=k,o("connecting");const S=h.current+1,N=`/api/jobs/${t}/stream?from=${S}`;fetch(N,{signal:k.signal}).then(async _=>{if(!_.ok||!_.body){o("error");return}o("streaming");const H=_.body.getReader(),B=new TextDecoder;let $="";for(;;){const{done:T,value:X}=await H.read();if(T)break;$+=B.decode(X,{stream:!0});const G=$.split(`
|
|
50
|
+
`);$=G.pop()??"";let ee="";for(const D of G)if(D.startsWith("event: "))ee=D.slice(7).trim();else if(D.startsWith("data: ")){try{const Y=JSON.parse(D.slice(6));if(ee==="activity"){const I=Y;I.seq>h.current&&(h.current=I.seq),r(ne=>ne.some(le=>le.seq===I.seq)?ne:[...ne,I]),I.type==="text"&&f(ne=>ne+(I.data.text??"")),I.type==="dispatch:start"&&I.data.childJobId&&p(ne=>[...ne,I.data.childJobId]),I.type==="job:done"?o("done"):I.type==="job:error"&&o("error")}else if(ee==="stream:end"){const I=Y.reason;o(I==="done"?"done":I==="error"?"error":"done")}}catch{}ee=""}}i==="streaming"&&o("done")}).catch(_=>{_.name!=="AbortError"&&(o("error"),y.current<3&&(y.current++,setTimeout(b,1e3*y.current)))})},[t]),v=j.useCallback(()=>{y.current=0,b()},[b]);return j.useEffect(()=>{if(!t){r([]),o("idle"),f(""),p([]),h.current=-1;return}return r([]),f(""),p([]),h.current=-1,y.current=0,b(),()=>{var k;(k=g.current)==null||k.abort()}},[t,b]),{events:l,status:i,textOutput:u,childJobIds:m,reconnect:v}}function jb(t,l){const r={};return(t[t.length-1]===""?[...t,""]:t).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const Eb=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Cb=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Nb={};function Wp(t,l){return(Nb.jsx?Cb:Eb).test(t)}const Ab=/[ \t\n\f\r]/g;function Db(t){return typeof t=="object"?t.type==="text"?Jp(t.value):!1:Jp(t)}function Jp(t){return t.replace(Ab,"")===""}class xs{constructor(l,r,i){this.normal=r,this.property=l,i&&(this.space=i)}}xs.prototype.normal={};xs.prototype.property={};xs.prototype.space=void 0;function b0(t,l){const r={},i={};for(const o of t)Object.assign(r,o.property),Object.assign(i,o.normal);return new xs(r,i,l)}function xd(t){return t.toLowerCase()}class Cn{constructor(l,r){this.attribute=r,this.property=l}}Cn.prototype.attribute="";Cn.prototype.booleanish=!1;Cn.prototype.boolean=!1;Cn.prototype.commaOrSpaceSeparated=!1;Cn.prototype.commaSeparated=!1;Cn.prototype.defined=!1;Cn.prototype.mustUseProperty=!1;Cn.prototype.number=!1;Cn.prototype.overloadedBoolean=!1;Cn.prototype.property="";Cn.prototype.spaceSeparated=!1;Cn.prototype.space=void 0;let Tb=0;const Ie=Ja(),Kt=Ja(),pd=Ja(),pe=Ja(),Nt=Ja(),Yr=Ja(),On=Ja();function Ja(){return 2**++Tb}const yd=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ie,booleanish:Kt,commaOrSpaceSeparated:On,commaSeparated:Yr,number:pe,overloadedBoolean:pd,spaceSeparated:Nt},Symbol.toStringTag,{value:"Module"})),Ff=Object.keys(yd);class Fd extends Cn{constructor(l,r,i,o){let u=-1;if(super(l,r),Pp(this,"space",o),typeof i=="number")for(;++u<Ff.length;){const f=Ff[u];Pp(this,Ff[u],(i&yd[f])===yd[f])}}}Fd.prototype.defined=!0;function Pp(t,l,r){r&&(t[l]=r)}function Vr(t){const l={},r={};for(const[i,o]of Object.entries(t.properties)){const u=new Fd(i,t.transform(t.attributes||{},i),o,t.space);t.mustUseProperty&&t.mustUseProperty.includes(i)&&(u.mustUseProperty=!0),l[i]=u,r[xd(i)]=i,r[xd(u.attribute)]=i}return new xs(l,r,t.space)}const v0=Vr({properties:{ariaActiveDescendant:null,ariaAtomic:Kt,ariaAutoComplete:null,ariaBusy:Kt,ariaChecked:Kt,ariaColCount:pe,ariaColIndex:pe,ariaColSpan:pe,ariaControls:Nt,ariaCurrent:null,ariaDescribedBy:Nt,ariaDetails:null,ariaDisabled:Kt,ariaDropEffect:Nt,ariaErrorMessage:null,ariaExpanded:Kt,ariaFlowTo:Nt,ariaGrabbed:Kt,ariaHasPopup:null,ariaHidden:Kt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Nt,ariaLevel:pe,ariaLive:null,ariaModal:Kt,ariaMultiLine:Kt,ariaMultiSelectable:Kt,ariaOrientation:null,ariaOwns:Nt,ariaPlaceholder:null,ariaPosInSet:pe,ariaPressed:Kt,ariaReadOnly:Kt,ariaRelevant:null,ariaRequired:Kt,ariaRoleDescription:Nt,ariaRowCount:pe,ariaRowIndex:pe,ariaRowSpan:pe,ariaSelected:Kt,ariaSetSize:pe,ariaSort:null,ariaValueMax:pe,ariaValueMin:pe,ariaValueNow:pe,ariaValueText:null,role:null},transform(t,l){return l==="role"?l:"aria-"+l.slice(4).toLowerCase()}});function w0(t,l){return l in t?t[l]:l}function k0(t,l){return w0(t,l.toLowerCase())}const zb=Vr({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Yr,acceptCharset:Nt,accessKey:Nt,action:null,allow:null,allowFullScreen:Ie,allowPaymentRequest:Ie,allowUserMedia:Ie,alt:null,as:null,async:Ie,autoCapitalize:null,autoComplete:Nt,autoFocus:Ie,autoPlay:Ie,blocking:Nt,capture:null,charSet:null,checked:Ie,cite:null,className:Nt,cols:pe,colSpan:null,content:null,contentEditable:Kt,controls:Ie,controlsList:Nt,coords:pe|Yr,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ie,defer:Ie,dir:null,dirName:null,disabled:Ie,download:pd,draggable:Kt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ie,formTarget:null,headers:Nt,height:pe,hidden:pd,high:pe,href:null,hrefLang:null,htmlFor:Nt,httpEquiv:Nt,id:null,imageSizes:null,imageSrcSet:null,inert:Ie,inputMode:null,integrity:null,is:null,isMap:Ie,itemId:null,itemProp:Nt,itemRef:Nt,itemScope:Ie,itemType:Nt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ie,low:pe,manifest:null,max:null,maxLength:pe,media:null,method:null,min:null,minLength:pe,multiple:Ie,muted:Ie,name:null,nonce:null,noModule:Ie,noValidate:Ie,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:Ie,optimum:pe,pattern:null,ping:Nt,placeholder:null,playsInline:Ie,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ie,referrerPolicy:null,rel:Nt,required:Ie,reversed:Ie,rows:pe,rowSpan:pe,sandbox:Nt,scope:null,scoped:Ie,seamless:Ie,selected:Ie,shadowRootClonable:Ie,shadowRootDelegatesFocus:Ie,shadowRootMode:null,shape:null,size:pe,sizes:null,slot:null,span:pe,spellCheck:Kt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:pe,step:null,style:null,tabIndex:pe,target:null,title:null,translate:null,type:null,typeMustMatch:Ie,useMap:null,value:Kt,width:pe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Nt,axis:null,background:null,bgColor:null,border:pe,borderColor:null,bottomMargin:pe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ie,declare:Ie,event:null,face:null,frame:null,frameBorder:null,hSpace:pe,leftMargin:pe,link:null,longDesc:null,lowSrc:null,marginHeight:pe,marginWidth:pe,noResize:Ie,noHref:Ie,noShade:Ie,noWrap:Ie,object:null,profile:null,prompt:null,rev:null,rightMargin:pe,rules:null,scheme:null,scrolling:Kt,standby:null,summary:null,text:null,topMargin:pe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:pe,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ie,disableRemotePlayback:Ie,prefix:null,property:null,results:pe,security:null,unselectable:null},space:"html",transform:k0}),Mb=Vr({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:On,accentHeight:pe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:pe,amplitude:pe,arabicForm:null,ascent:pe,attributeName:null,attributeType:null,azimuth:pe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:pe,by:null,calcMode:null,capHeight:pe,className:Nt,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:pe,diffuseConstant:pe,direction:null,display:null,dur:null,divisor:pe,dominantBaseline:null,download:Ie,dx:null,dy:null,edgeMode:null,editable:null,elevation:pe,enableBackground:null,end:null,event:null,exponent:pe,externalResourcesRequired:null,fill:null,fillOpacity:pe,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:Yr,g2:Yr,glyphName:Yr,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:pe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:pe,horizOriginX:pe,horizOriginY:pe,id:null,ideographic:pe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:pe,k:pe,k1:pe,k2:pe,k3:pe,k4:pe,kernelMatrix:On,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:pe,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:pe,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:pe,overlineThickness:pe,paintOrder:null,panose1:null,path:null,pathLength:pe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Nt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:pe,pointsAtY:pe,pointsAtZ:pe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:On,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:On,rev:On,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:On,requiredFeatures:On,requiredFonts:On,requiredFormats:On,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:pe,specularExponent:pe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:pe,strikethroughThickness:pe,string:null,stroke:null,strokeDashArray:On,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:pe,strokeOpacity:pe,strokeWidth:null,style:null,surfaceScale:pe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:On,tabIndex:pe,tableValues:null,target:null,targetX:pe,targetY:pe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:On,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:pe,underlineThickness:pe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:pe,values:null,vAlphabetic:pe,vMathematical:pe,vectorEffect:null,vHanging:pe,vIdeographic:pe,version:null,vertAdvY:pe,vertOriginX:pe,vertOriginY:pe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:pe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:w0}),S0=Vr({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,l){return"xlink:"+l.slice(5).toLowerCase()}}),j0=Vr({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:k0}),E0=Vr({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,l){return"xml:"+l.slice(3).toLowerCase()}}),_b={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"},Fb=/[A-Z]/g,e1=/-[a-z]/g,Rb=/^data[-\w.:]+$/i;function Ob(t,l){const r=xd(l);let i=l,o=Cn;if(r in t.normal)return t.property[t.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&Rb.test(l)){if(l.charAt(4)==="-"){const u=l.slice(5).replace(e1,$b);i="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=l.slice(4);if(!e1.test(u)){let f=u.replace(Fb,Bb);f.charAt(0)!=="-"&&(f="-"+f),l="data"+f}}o=Fd}return new o(i,l)}function Bb(t){return"-"+t.toLowerCase()}function $b(t){return t.charAt(1).toUpperCase()}const Lb=b0([v0,zb,S0,j0,E0],"html"),Rd=b0([v0,Mb,S0,j0,E0],"svg");function Hb(t){return t.join(" ").trim()}var Br={},Rf,t1;function Ub(){if(t1)return Rf;t1=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,l=/\n/g,r=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,f=/^[;\s]*/,m=/^\s+|\s+$/g,p=`
|
|
51
|
+
`,h="/",g="*",y="",b="comment",v="declaration";function k(N,E){if(typeof N!="string")throw new TypeError("First argument must be a string");if(!N)return[];E=E||{};var _=1,H=1;function B(le){var L=le.match(l);L&&(_+=L.length);var F=le.lastIndexOf(p);H=~F?le.length-F:H+le.length}function $(){var le={line:_,column:H};return function(L){return L.position=new T(le),ee(),L}}function T(le){this.start=le,this.end={line:_,column:H},this.source=E.source}T.prototype.content=N;function X(le){var L=new Error(E.source+":"+_+":"+H+": "+le);if(L.reason=le,L.filename=E.source,L.line=_,L.column=H,L.source=N,!E.silent)throw L}function G(le){var L=le.exec(N);if(L){var F=L[0];return B(F),N=N.slice(F.length),L}}function ee(){G(r)}function D(le){var L;for(le=le||[];L=Y();)L!==!1&&le.push(L);return le}function Y(){var le=$();if(!(h!=N.charAt(0)||g!=N.charAt(1))){for(var L=2;y!=N.charAt(L)&&(g!=N.charAt(L)||h!=N.charAt(L+1));)++L;if(L+=2,y===N.charAt(L-1))return X("End of comment missing");var F=N.slice(2,L-2);return H+=2,B(F),N=N.slice(L),H+=2,le({type:b,comment:F})}}function I(){var le=$(),L=G(i);if(L){if(Y(),!G(o))return X("property missing ':'");var F=G(u),V=le({type:v,property:S(L[0].replace(t,y)),value:F?S(F[0].replace(t,y)):y});return G(f),V}}function ne(){var le=[];D(le);for(var L;L=I();)L!==!1&&(le.push(L),D(le));return le}return ee(),ne()}function S(N){return N?N.replace(m,y):y}return Rf=k,Rf}var n1;function Ib(){if(n1)return Br;n1=1;var t=Br&&Br.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Br,"__esModule",{value:!0}),Br.default=r;const l=t(Ub());function r(i,o){let u=null;if(!i||typeof i!="string")return u;const f=(0,l.default)(i),m=typeof o=="function";return f.forEach(p=>{if(p.type!=="declaration")return;const{property:h,value:g}=p;m?o(h,g,p):g&&(u=u||{},u[h]=g)}),u}return Br}var Vi={},l1;function Yb(){if(l1)return Vi;l1=1,Object.defineProperty(Vi,"__esModule",{value:!0}),Vi.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,l=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,u=function(h){return!h||r.test(h)||t.test(h)},f=function(h,g){return g.toUpperCase()},m=function(h,g){return"".concat(g,"-")},p=function(h,g){return g===void 0&&(g={}),u(h)?h:(h=h.toLowerCase(),g.reactCompat?h=h.replace(o,m):h=h.replace(i,m),h.replace(l,f))};return Vi.camelCase=p,Vi}var Gi,a1;function qb(){if(a1)return Gi;a1=1;var t=Gi&&Gi.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},l=t(Ib()),r=Yb();function i(o,u){var f={};return!o||typeof o!="string"||(0,l.default)(o,function(m,p){m&&p&&(f[(0,r.camelCase)(m,u)]=p)}),f}return i.default=i,Gi=i,Gi}var Xb=qb();const Vb=y0(Xb),C0=N0("end"),Od=N0("start");function N0(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 Gb(t){const l=Od(t),r=C0(t);if(l&&r)return{start:l,end:r}}function rs(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?r1(t.position):"start"in t||"end"in t?r1(t):"line"in t||"column"in t?gd(t):""}function gd(t){return i1(t&&t.line)+":"+i1(t&&t.column)}function r1(t){return gd(t&&t.start)+"-"+gd(t&&t.end)}function i1(t){return t&&typeof t=="number"?t:1}class fn extends Error{constructor(l,r,i){super(),typeof r=="string"&&(i=r,r=void 0);let o="",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"?o=l:!u.cause&&l&&(f=!0,o=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=o,this.line=m?m.line:void 0,this.name=rs(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}}fn.prototype.file="";fn.prototype.name="";fn.prototype.reason="";fn.prototype.message="";fn.prototype.stack="";fn.prototype.column=void 0;fn.prototype.line=void 0;fn.prototype.ancestors=void 0;fn.prototype.cause=void 0;fn.prototype.fatal=void 0;fn.prototype.place=void 0;fn.prototype.ruleId=void 0;fn.prototype.source=void 0;const Bd={}.hasOwnProperty,Kb=new Map,Qb=/[A-Z]/g,Zb=new Set(["table","tbody","thead","tfoot","tr"]),Wb=new Set(["td","th"]),A0="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Jb(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=iv(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=rv(r,l.jsx,l.jsxs)}const o={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"?Rd:Lb,stylePropertyNameCase:l.stylePropertyNameCase||"dom",tableCellAlignToStyle:l.tableCellAlignToStyle!==!1},u=D0(o,t,void 0);return u&&typeof u!="string"?u:o.create(t,o.Fragment,{children:u||void 0},void 0)}function D0(t,l,r){if(l.type==="element")return Pb(t,l,r);if(l.type==="mdxFlowExpression"||l.type==="mdxTextExpression")return ev(t,l);if(l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement")return nv(t,l,r);if(l.type==="mdxjsEsm")return tv(t,l);if(l.type==="root")return lv(t,l,r);if(l.type==="text")return av(t,l)}function Pb(t,l,r){const i=t.schema;let o=i;l.tagName.toLowerCase()==="svg"&&i.space==="html"&&(o=Rd,t.schema=o),t.ancestors.push(l);const u=z0(t,l.tagName,!1),f=sv(t,l);let m=Ld(t,l);return Zb.has(l.tagName)&&(m=m.filter(function(p){return typeof p=="string"?!Db(p):!0})),T0(t,f,u,l),$d(f,m),t.ancestors.pop(),t.schema=i,t.create(l,u,f,r)}function ev(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)}cs(t,l.position)}function tv(t,l){if(l.data&&l.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(l.data.estree);cs(t,l.position)}function nv(t,l,r){const i=t.schema;let o=i;l.name==="svg"&&i.space==="html"&&(o=Rd,t.schema=o),t.ancestors.push(l);const u=l.name===null?t.Fragment:z0(t,l.name,!0),f=ov(t,l),m=Ld(t,l);return T0(t,f,u,l),$d(f,m),t.ancestors.pop(),t.schema=i,t.create(l,u,f,r)}function lv(t,l,r){const i={};return $d(i,Ld(t,l)),t.create(l,t.Fragment,i,r)}function av(t,l){return l.value}function T0(t,l,r,i){typeof r!="string"&&r!==t.Fragment&&t.passNode&&(l.node=i)}function $d(t,l){if(l.length>0){const r=l.length>1?l:l[0];r&&(t.children=r)}}function rv(t,l,r){return i;function i(o,u,f,m){const h=Array.isArray(f.children)?r:l;return m?h(u,f,m):h(u,f)}}function iv(t,l){return r;function r(i,o,u,f){const m=Array.isArray(u.children),p=Od(i);return l(o,u,f,m,{columnNumber:p?p.column-1:void 0,fileName:t,lineNumber:p?p.line:void 0},void 0)}}function sv(t,l){const r={};let i,o;for(o in l.properties)if(o!=="children"&&Bd.call(l.properties,o)){const u=cv(t,o,l.properties[o]);if(u){const[f,m]=u;t.tableCellAlignToStyle&&f==="align"&&typeof m=="string"&&Wb.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 ov(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 cs(t,l.position);else{const o=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 cs(t,l.position);else u=i.value===null?!0:i.value;r[o]=u}return r}function Ld(t,l){const r=[];let i=-1;const o=t.passKeys?new Map:Kb;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 h=o.get(p)||0;f=p+"-"+h,o.set(p,h+1)}}const m=D0(t,u,f);m!==void 0&&r.push(m)}return r}function cv(t,l,r){const i=Ob(t.schema,l);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=i.commaSeparated?jb(r):Hb(r)),i.property==="style"){let o=typeof r=="object"?r:uv(t,String(r));return t.stylePropertyNameCase==="css"&&(o=fv(o)),["style",o]}return[t.elementAttributeNameCase==="react"&&i.space?_b[i.property]||i.property:i.attribute,r]}}function uv(t,l){try{return Vb(l,{reactCompat:!0})}catch(r){if(t.ignoreInvalidStyle)return{};const i=r,o=new fn("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=t.filePath||void 0,o.url=A0+"#cannot-parse-style-attribute",o}}function z0(t,l,r){let i;if(!r)i={type:"Literal",value:l};else if(l.includes(".")){const o=l.split(".");let u=-1,f;for(;++u<o.length;){const m=Wp(o[u])?{type:"Identifier",name:o[u]}:{type:"Literal",value:o[u]};f=f?{type:"MemberExpression",object:f,property:m,computed:!!(u&&m.type==="Literal"),optional:!1}:m}i=f}else i=Wp(l)&&!/^[a-z]/.test(l)?{type:"Identifier",name:l}:{type:"Literal",value:l};if(i.type==="Literal"){const o=i.value;return Bd.call(t.components,o)?t.components[o]:o}if(t.evaluater)return t.evaluater.evaluateExpression(i);cs(t)}function cs(t,l){const r=new fn("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=A0+"#cannot-handle-mdx-estrees-without-createevaluater",r}function fv(t){const l={};let r;for(r in t)Bd.call(t,r)&&(l[dv(r)]=t[r]);return l}function dv(t){let l=t.replace(Qb,hv);return l.slice(0,3)==="ms-"&&(l="-"+l),l}function hv(t){return"-"+t.toLowerCase()}const Of={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"]},mv={};function Hd(t,l){const r=mv,i=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,o=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return M0(t,i,o)}function M0(t,l,r){if(xv(t)){if("value"in t)return t.type==="html"&&!r?"":t.value;if(l&&"alt"in t&&t.alt)return t.alt;if("children"in t)return s1(t.children,l,r)}return Array.isArray(t)?s1(t,l,r):""}function s1(t,l,r){const i=[];let o=-1;for(;++o<t.length;)i[o]=M0(t[o],l,r);return i.join("")}function xv(t){return!!(t&&typeof t=="object")}const o1=document.createElement("i");function Ud(t){const l="&"+t+";";o1.innerHTML=l;const r=o1.textContent;return r.charCodeAt(r.length-1)===59&&t!=="semi"||r===l?!1:r}function Bn(t,l,r,i){const o=t.length;let u=0,f;if(l<0?l=-l>o?0:o+l:l=l>o?o: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 Zn(t,l){return t.length>0?(Bn(t,t.length,0,l),t):l}const c1={}.hasOwnProperty;function _0(t){const l={};let r=-1;for(;++r<t.length;)pv(l,t[r]);return l}function pv(t,l){let r;for(r in l){const o=(c1.call(t,r)?t[r]:void 0)||(t[r]={}),u=l[r];let f;if(u)for(f in u){c1.call(o,f)||(o[f]=[]);const m=u[f];yv(o[f],Array.isArray(m)?m:m?[m]:[])}}}function yv(t,l){let r=-1;const i=[];for(;++r<l.length;)(l[r].add==="after"?t:i).push(l[r]);Bn(t,0,0,i)}function F0(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 il(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const mn=ja(/[A-Za-z]/),un=ja(/[\dA-Za-z]/),gv=ja(/[#-'*+\--9=?A-Z^-~]/);function tc(t){return t!==null&&(t<32||t===127)}const bd=ja(/\d/),bv=ja(/[\dA-Fa-f]/),vv=ja(/[!-/:-@[-`{-~]/);function Me(t){return t!==null&&t<-2}function jt(t){return t!==null&&(t<0||t===32)}function Ze(t){return t===-2||t===-1||t===32}const fc=ja(new RegExp("\\p{P}|\\p{S}","u")),Za=ja(/\s/);function ja(t){return l;function l(r){return r!==null&&r>-1&&t.test(String.fromCharCode(r))}}function Gr(t){const l=[];let r=-1,i=0,o=0;for(;++r<t.length;){const u=t.charCodeAt(r);let f="";if(u===37&&un(t.charCodeAt(r+1))&&un(t.charCodeAt(r+2)))o=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),o=1):f="�"}else f=String.fromCharCode(u);f&&(l.push(t.slice(i,r),encodeURIComponent(f)),i=r+o+1,f=""),o&&(r+=o,o=0)}return l.join("")+t.slice(i)}function lt(t,l,r,i){const o=i?i-1:Number.POSITIVE_INFINITY;let u=0;return f;function f(p){return Ze(p)?(t.enter(r),m(p)):l(p)}function m(p){return Ze(p)&&u++<o?(t.consume(p),m):(t.exit(r),l(p))}}const wv={tokenize:kv};function kv(t){const l=t.attempt(this.parser.constructs.contentInitial,i,o);let r;return l;function i(m){if(m===null){t.consume(m);return}return t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),lt(t,l,"linePrefix")}function o(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 Me(m)?(t.consume(m),t.exit("chunkText"),u):(t.consume(m),f)}}const Sv={tokenize:jv},u1={tokenize:Ev};function jv(t){const l=this,r=[];let i=0,o,u,f;return m;function m(H){if(i<r.length){const B=r[i];return l.containerState=B[1],t.attempt(B[0].continuation,p,h)(H)}return h(H)}function p(H){if(i++,l.containerState._closeFlow){l.containerState._closeFlow=void 0,o&&_();const B=l.events.length;let $=B,T;for(;$--;)if(l.events[$][0]==="exit"&&l.events[$][1].type==="chunkFlow"){T=l.events[$][1].end;break}E(i);let X=B;for(;X<l.events.length;)l.events[X][1].end={...T},X++;return Bn(l.events,$+1,0,l.events.slice(B)),l.events.length=X,h(H)}return m(H)}function h(H){if(i===r.length){if(!o)return b(H);if(o.currentConstruct&&o.currentConstruct.concrete)return k(H);l.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return l.containerState={},t.check(u1,g,y)(H)}function g(H){return o&&_(),E(i),b(H)}function y(H){return l.parser.lazy[l.now().line]=i!==r.length,f=l.now().offset,k(H)}function b(H){return l.containerState={},t.attempt(u1,v,k)(H)}function v(H){return i++,r.push([l.currentConstruct,l.containerState]),b(H)}function k(H){if(H===null){o&&_(),E(0),t.consume(H);return}return o=o||l.parser.flow(l.now()),t.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:u}),S(H)}function S(H){if(H===null){N(t.exit("chunkFlow"),!0),E(0),t.consume(H);return}return Me(H)?(t.consume(H),N(t.exit("chunkFlow")),i=0,l.interrupt=void 0,m):(t.consume(H),S)}function N(H,B){const $=l.sliceStream(H);if(B&&$.push(null),H.previous=u,u&&(u.next=H),u=H,o.defineSkip(H.start),o.write($),l.parser.lazy[H.start.line]){let T=o.events.length;for(;T--;)if(o.events[T][1].start.offset<f&&(!o.events[T][1].end||o.events[T][1].end.offset>f))return;const X=l.events.length;let G=X,ee,D;for(;G--;)if(l.events[G][0]==="exit"&&l.events[G][1].type==="chunkFlow"){if(ee){D=l.events[G][1].end;break}ee=!0}for(E(i),T=X;T<l.events.length;)l.events[T][1].end={...D},T++;Bn(l.events,G+1,0,l.events.slice(X)),l.events.length=T}}function E(H){let B=r.length;for(;B-- >H;){const $=r[B];l.containerState=$[1],$[0].exit.call(l,t)}r.length=H}function _(){o.write([null]),u=void 0,o=void 0,l.containerState._closeFlow=void 0}}function Ev(t,l,r){return lt(t,t.attempt(this.parser.constructs.document,l,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function qr(t){if(t===null||jt(t)||Za(t))return 1;if(fc(t))return 2}function dc(t,l,r){const i=[];let o=-1;for(;++o<t.length;){const u=t[o].resolveAll;u&&!i.includes(u)&&(l=u(l,r),i.push(u))}return l}const vd={name:"attention",resolveAll:Cv,tokenize:Nv};function Cv(t,l){let r=-1,i,o,u,f,m,p,h,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};f1(y,-p),f1(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}},o={type:p>1?"strong":"emphasis",start:{...f.start},end:{...m.end}},t[i][1].end={...f.start},t[r][1].start={...m.end},h=[],t[i][1].end.offset-t[i][1].start.offset&&(h=Zn(h,[["enter",t[i][1],l],["exit",t[i][1],l]])),h=Zn(h,[["enter",o,l],["enter",f,l],["exit",f,l],["enter",u,l]]),h=Zn(h,dc(l.parser.constructs.insideSpan.null,t.slice(i+1,r),l)),h=Zn(h,[["exit",u,l],["enter",m,l],["exit",m,l],["exit",o,l]]),t[r][1].end.offset-t[r][1].start.offset?(g=2,h=Zn(h,[["enter",t[r][1],l],["exit",t[r][1],l]])):g=0,Bn(t,i-1,r-i+3,h),r=i+h.length-g-2;break}}for(r=-1;++r<t.length;)t[r][1].type==="attentionSequence"&&(t[r][1].type="data");return t}function Nv(t,l){const r=this.parser.constructs.attentionMarkers.null,i=this.previous,o=qr(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 h=t.exit("attentionSequence"),g=qr(p),y=!g||g===2&&o||r.includes(p),b=!o||o===2&&g||r.includes(i);return h._open=!!(u===42?y:y&&(o||!b)),h._close=!!(u===42?b:b&&(g||!y)),l(p)}}function f1(t,l){t.column+=l,t.offset+=l,t._bufferIndex+=l}const Av={name:"autolink",tokenize:Dv};function Dv(t,l,r){let i=0;return o;function o(v){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(v),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),u}function u(v){return mn(v)?(t.consume(v),f):v===64?r(v):h(v)}function f(v){return v===43||v===45||v===46||un(v)?(i=1,m(v)):h(v)}function m(v){return v===58?(t.consume(v),i=0,p):(v===43||v===45||v===46||un(v))&&i++<32?(t.consume(v),m):(i=0,h(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||tc(v)?r(v):(t.consume(v),p)}function h(v){return v===64?(t.consume(v),g):gv(v)?(t.consume(v),h):r(v)}function g(v){return un(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||un(v))&&i++<63){const k=v===45?b:y;return t.consume(v),k}return r(v)}}const ps={partial:!0,tokenize:Tv};function Tv(t,l,r){return i;function i(u){return Ze(u)?lt(t,o,"linePrefix")(u):o(u)}function o(u){return u===null||Me(u)?l(u):r(u)}}const R0={continuation:{tokenize:Mv},exit:_v,name:"blockQuote",tokenize:zv};function zv(t,l,r){const i=this;return o;function o(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 Ze(f)?(t.enter("blockQuotePrefixWhitespace"),t.consume(f),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),l):(t.exit("blockQuotePrefix"),l(f))}}function Mv(t,l,r){const i=this;return o;function o(f){return Ze(f)?lt(t,u,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f):u(f)}function u(f){return t.attempt(R0,l,r)(f)}}function _v(t){t.exit("blockQuote")}const O0={name:"characterEscape",tokenize:Fv};function Fv(t,l,r){return i;function i(u){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(u),t.exit("escapeMarker"),o}function o(u){return vv(u)?(t.enter("characterEscapeValue"),t.consume(u),t.exit("characterEscapeValue"),t.exit("characterEscape"),l):r(u)}}const B0={name:"characterReference",tokenize:Rv};function Rv(t,l,r){const i=this;let o=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"),h):(t.enter("characterReferenceValue"),u=31,f=un,g(y))}function h(y){return y===88||y===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(y),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),u=6,f=bv,g):(t.enter("characterReferenceValue"),u=7,f=bd,g(y))}function g(y){if(y===59&&o){const b=t.exit("characterReferenceValue");return f===un&&!Ud(i.sliceSerialize(b))?r(y):(t.enter("characterReferenceMarker"),t.consume(y),t.exit("characterReferenceMarker"),t.exit("characterReference"),l)}return f(y)&&o++<u?(t.consume(y),g):r(y)}}const d1={partial:!0,tokenize:Bv},h1={concrete:!0,name:"codeFenced",tokenize:Ov};function Ov(t,l,r){const i=this,o={partial:!0,tokenize:$};let u=0,f=0,m;return p;function p(T){return h(T)}function h(T){const X=i.events[i.events.length-1];return u=X&&X[1].type==="linePrefix"?X[2].sliceSerialize(X[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"),Ze(T)?lt(t,y,"whitespace")(T):y(T))}function y(T){return T===null||Me(T)?(t.exit("codeFencedFence"),i.interrupt?l(T):t.check(d1,S,B)(T)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),b(T))}function b(T){return T===null||Me(T)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),y(T)):Ze(T)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),lt(t,v,"whitespace")(T)):T===96&&T===m?r(T):(t.consume(T),b)}function v(T){return T===null||Me(T)?y(T):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),k(T))}function k(T){return T===null||Me(T)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),y(T)):T===96&&T===m?r(T):(t.consume(T),k)}function S(T){return t.attempt(o,B,N)(T)}function N(T){return t.enter("lineEnding"),t.consume(T),t.exit("lineEnding"),E}function E(T){return u>0&&Ze(T)?lt(t,_,"linePrefix",u+1)(T):_(T)}function _(T){return T===null||Me(T)?t.check(d1,S,B)(T):(t.enter("codeFlowValue"),H(T))}function H(T){return T===null||Me(T)?(t.exit("codeFlowValue"),_(T)):(t.consume(T),H)}function B(T){return t.exit("codeFenced"),l(T)}function $(T,X,G){let ee=0;return D;function D(L){return T.enter("lineEnding"),T.consume(L),T.exit("lineEnding"),Y}function Y(L){return T.enter("codeFencedFence"),Ze(L)?lt(T,I,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):I(L)}function I(L){return L===m?(T.enter("codeFencedFenceSequence"),ne(L)):G(L)}function ne(L){return L===m?(ee++,T.consume(L),ne):ee>=f?(T.exit("codeFencedFenceSequence"),Ze(L)?lt(T,le,"whitespace")(L):le(L)):G(L)}function le(L){return L===null||Me(L)?(T.exit("codeFencedFence"),X(L)):G(L)}}}function Bv(t,l,r){const i=this;return o;function o(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 Bf={name:"codeIndented",tokenize:Lv},$v={partial:!0,tokenize:Hv};function Lv(t,l,r){const i=this;return o;function o(h){return t.enter("codeIndented"),lt(t,u,"linePrefix",5)(h)}function u(h){const g=i.events[i.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?f(h):r(h)}function f(h){return h===null?p(h):Me(h)?t.attempt($v,f,p)(h):(t.enter("codeFlowValue"),m(h))}function m(h){return h===null||Me(h)?(t.exit("codeFlowValue"),f(h)):(t.consume(h),m)}function p(h){return t.exit("codeIndented"),l(h)}}function Hv(t,l,r){const i=this;return o;function o(f){return i.parser.lazy[i.now().line]?r(f):Me(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),o):lt(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):Me(f)?o(f):r(f)}}const Uv={name:"codeText",previous:Yv,resolve:Iv,tokenize:qv};function Iv(t){let l=t.length-4,r=3,i,o;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;)o===void 0?i!==l&&t[i][1].type!=="lineEnding"&&(o=i):(i===l||t[i][1].type==="lineEnding")&&(t[o][1].type="codeTextData",i!==o+2&&(t[o][1].end=t[i-1][1].end,t.splice(o+2,i-o-2),l-=i-o-2,i=o+2),o=void 0);return t}function Yv(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function qv(t,l,r){let i=0,o,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"),o=0,g(y)):Me(y)?(t.enter("lineEnding"),t.consume(y),t.exit("lineEnding"),p):(t.enter("codeTextData"),h(y))}function h(y){return y===null||y===32||y===96||Me(y)?(t.exit("codeTextData"),p(y)):(t.consume(y),h)}function g(y){return y===96?(t.consume(y),o++,g):o===i?(t.exit("codeTextSequence"),t.exit("codeText"),l(y)):(u.type="codeTextData",h(y))}}class Xv{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 o=r||0;this.setCursor(Math.trunc(l));const u=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return i&&Ki(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),Ki(this.left,l)}unshift(l){this.setCursor(0),this.right.push(l)}unshiftMany(l){this.setCursor(0),Ki(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);Ki(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-l,Number.POSITIVE_INFINITY);Ki(this.left,r.reverse())}}}function Ki(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 $0(t){const l={};let r=-1,i,o,u,f,m,p,h;const g=new Xv(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,Vv(g,r)),r=l[r],h=!0);else if(i[1]._container){for(u=r,o=void 0;u--;)if(f=g.get(u),f[1].type==="lineEnding"||f[1].type==="lineEndingBlank")f[0]==="enter"&&(o&&(g.get(o)[1].type="lineEndingBlank"),f[1].type="lineEnding",o=u);else if(!(f[1].type==="linePrefix"||f[1].type==="listItemIndent"))break;o&&(i[1].end={...g.get(o)[1].start},m=g.slice(o,r),m.unshift(i),g.splice(o,r-o+1,m))}}return Bn(t,0,Number.POSITIVE_INFINITY,g.slice(0)),!h}function Vv(t,l){const r=t.get(l)[1],i=t.get(l)[2];let o=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=[],h={};let g,y,b=-1,v=r,k=0,S=0;const N=[S];for(;v;){for(;t.get(++o)[1]!==v;);u.push(o),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,N.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):N.pop(),b=N.length;b--;){const E=m.slice(N[b],N[b+1]),_=u.pop();p.push([_,_+E.length-1]),t.splice(_,2,E)}for(p.reverse(),b=-1;++b<p.length;)h[k+p[b][0]]=k+p[b][1],k+=p[b][1]-p[b][0]-1;return h}const Gv={resolve:Qv,tokenize:Zv},Kv={partial:!0,tokenize:Wv};function Qv(t){return $0(t),t}function Zv(t,l){let r;return i;function i(m){return t.enter("content"),r=t.enter("chunkContent",{contentType:"content"}),o(m)}function o(m){return m===null?u(m):Me(m)?t.check(Kv,f,u)(m):(t.consume(m),o)}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,o}}function Wv(t,l,r){const i=this;return o;function o(f){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),lt(t,u,"linePrefix")}function u(f){if(f===null||Me(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 L0(t,l,r,i,o,u,f,m,p){const h=p||Number.POSITIVE_INFINITY;let g=0;return y;function y(E){return E===60?(t.enter(i),t.enter(o),t.enter(u),t.consume(E),t.exit(u),b):E===null||E===32||E===41||tc(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(o),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||Me(E)?r(E):(t.consume(E),E===92?k:v)}function k(E){return E===60||E===62||E===92?(t.consume(E),v):v(E)}function S(E){return!g&&(E===null||E===41||jt(E))?(t.exit("chunkString"),t.exit(m),t.exit(f),t.exit(i),l(E)):g<h&&E===40?(t.consume(E),g++,S):E===41?(t.consume(E),g--,S):E===null||E===32||E===40||tc(E)?r(E):(t.consume(E),E===92?N:S)}function N(E){return E===40||E===41||E===92?(t.consume(E),S):S(E)}}function H0(t,l,r,i,o,u){const f=this;let m=0,p;return h;function h(v){return t.enter(i),t.enter(o),t.consume(v),t.exit(o),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(o),t.consume(v),t.exit(o),t.exit(i),l):Me(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||Me(v)||m++>999?(t.exit("chunkString"),g(v)):(t.consume(v),p||(p=!Ze(v)),v===92?b:y)}function b(v){return v===91||v===92||v===93?(t.consume(v),m++,y):y(v)}}function U0(t,l,r,i,o,u){let f;return m;function m(b){return b===34||b===39||b===40?(t.enter(i),t.enter(o),t.consume(b),t.exit(o),f=b===40?41:b,p):r(b)}function p(b){return b===f?(t.enter(o),t.consume(b),t.exit(o),t.exit(i),l):(t.enter(u),h(b))}function h(b){return b===f?(t.exit(u),p(f)):b===null?r(b):Me(b)?(t.enter("lineEnding"),t.consume(b),t.exit("lineEnding"),lt(t,h,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===f||b===null||Me(b)?(t.exit("chunkString"),h(b)):(t.consume(b),b===92?y:g)}function y(b){return b===f||b===92?(t.consume(b),g):g(b)}}function is(t,l){let r;return i;function i(o){return Me(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),r=!0,i):Ze(o)?lt(t,i,r?"linePrefix":"lineSuffix")(o):l(o)}}const Jv={name:"definition",tokenize:ew},Pv={partial:!0,tokenize:tw};function ew(t,l,r){const i=this;let o;return u;function u(v){return t.enter("definition"),f(v)}function f(v){return H0.call(i,t,m,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function m(v){return o=il(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 jt(v)?is(t,h)(v):h(v)}function h(v){return L0(t,g,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function g(v){return t.attempt(Pv,y,y)(v)}function y(v){return Ze(v)?lt(t,b,"whitespace")(v):b(v)}function b(v){return v===null||Me(v)?(t.exit("definition"),i.parser.defined.push(o),l(v)):r(v)}}function tw(t,l,r){return i;function i(m){return jt(m)?is(t,o)(m):r(m)}function o(m){return U0(t,u,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(m)}function u(m){return Ze(m)?lt(t,f,"whitespace")(m):f(m)}function f(m){return m===null||Me(m)?l(m):r(m)}}const nw={name:"hardBreakEscape",tokenize:lw};function lw(t,l,r){return i;function i(u){return t.enter("hardBreakEscape"),t.consume(u),o}function o(u){return Me(u)?(t.exit("hardBreakEscape"),l(u)):r(u)}}const aw={name:"headingAtx",resolve:rw,tokenize:iw};function rw(t,l){let r=t.length-2,i=3,o,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&&(o={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"},Bn(t,i,r-i+1,[["enter",o,l],["enter",u,l],["exit",u,l],["exit",o,l]])),t}function iw(t,l,r){let i=0;return o;function o(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||jt(g)?(t.exit("atxHeadingSequence"),m(g)):r(g)}function m(g){return g===35?(t.enter("atxHeadingSequence"),p(g)):g===null||Me(g)?(t.exit("atxHeading"),l(g)):Ze(g)?lt(t,m,"whitespace")(g):(t.enter("atxHeadingText"),h(g))}function p(g){return g===35?(t.consume(g),p):(t.exit("atxHeadingSequence"),m(g))}function h(g){return g===null||g===35||jt(g)?(t.exit("atxHeadingText"),m(g)):(t.consume(g),h)}}const sw=["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"],ow={concrete:!0,name:"htmlFlow",resolveTo:fw,tokenize:dw},cw={partial:!0,tokenize:mw},uw={partial:!0,tokenize:hw};function fw(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 dw(t,l,r){const i=this;let o,u,f,m,p;return h;function h(A){return g(A)}function g(A){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(A),y}function y(A){return A===33?(t.consume(A),b):A===47?(t.consume(A),u=!0,S):A===63?(t.consume(A),o=3,i.interrupt?l:z):mn(A)?(t.consume(A),f=String.fromCharCode(A),N):r(A)}function b(A){return A===45?(t.consume(A),o=2,v):A===91?(t.consume(A),o=5,m=0,k):mn(A)?(t.consume(A),o=4,i.interrupt?l:z):r(A)}function v(A){return A===45?(t.consume(A),i.interrupt?l:z):r(A)}function k(A){const oe="CDATA[";return A===oe.charCodeAt(m++)?(t.consume(A),m===oe.length?i.interrupt?l:I:k):r(A)}function S(A){return mn(A)?(t.consume(A),f=String.fromCharCode(A),N):r(A)}function N(A){if(A===null||A===47||A===62||jt(A)){const oe=A===47,be=f.toLowerCase();return!oe&&!u&&m1.includes(be)?(o=1,i.interrupt?l(A):I(A)):sw.includes(f.toLowerCase())?(o=6,oe?(t.consume(A),E):i.interrupt?l(A):I(A)):(o=7,i.interrupt&&!i.parser.lazy[i.now().line]?r(A):u?_(A):H(A))}return A===45||un(A)?(t.consume(A),f+=String.fromCharCode(A),N):r(A)}function E(A){return A===62?(t.consume(A),i.interrupt?l:I):r(A)}function _(A){return Ze(A)?(t.consume(A),_):D(A)}function H(A){return A===47?(t.consume(A),D):A===58||A===95||mn(A)?(t.consume(A),B):Ze(A)?(t.consume(A),H):D(A)}function B(A){return A===45||A===46||A===58||A===95||un(A)?(t.consume(A),B):$(A)}function $(A){return A===61?(t.consume(A),T):Ze(A)?(t.consume(A),$):H(A)}function T(A){return A===null||A===60||A===61||A===62||A===96?r(A):A===34||A===39?(t.consume(A),p=A,X):Ze(A)?(t.consume(A),T):G(A)}function X(A){return A===p?(t.consume(A),p=null,ee):A===null||Me(A)?r(A):(t.consume(A),X)}function G(A){return A===null||A===34||A===39||A===47||A===60||A===61||A===62||A===96||jt(A)?$(A):(t.consume(A),G)}function ee(A){return A===47||A===62||Ze(A)?H(A):r(A)}function D(A){return A===62?(t.consume(A),Y):r(A)}function Y(A){return A===null||Me(A)?I(A):Ze(A)?(t.consume(A),Y):r(A)}function I(A){return A===45&&o===2?(t.consume(A),F):A===60&&o===1?(t.consume(A),V):A===62&&o===4?(t.consume(A),M):A===63&&o===3?(t.consume(A),z):A===93&&o===5?(t.consume(A),fe):Me(A)&&(o===6||o===7)?(t.exit("htmlFlowData"),t.check(cw,K,ne)(A)):A===null||Me(A)?(t.exit("htmlFlowData"),ne(A)):(t.consume(A),I)}function ne(A){return t.check(uw,le,K)(A)}function le(A){return t.enter("lineEnding"),t.consume(A),t.exit("lineEnding"),L}function L(A){return A===null||Me(A)?ne(A):(t.enter("htmlFlowData"),I(A))}function F(A){return A===45?(t.consume(A),z):I(A)}function V(A){return A===47?(t.consume(A),f="",P):I(A)}function P(A){if(A===62){const oe=f.toLowerCase();return m1.includes(oe)?(t.consume(A),M):I(A)}return mn(A)&&f.length<8?(t.consume(A),f+=String.fromCharCode(A),P):I(A)}function fe(A){return A===93?(t.consume(A),z):I(A)}function z(A){return A===62?(t.consume(A),M):A===45&&o===2?(t.consume(A),z):I(A)}function M(A){return A===null||Me(A)?(t.exit("htmlFlowData"),K(A)):(t.consume(A),M)}function K(A){return t.exit("htmlFlow"),l(A)}}function hw(t,l,r){const i=this;return o;function o(f){return Me(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 mw(t,l,r){return i;function i(o){return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),t.attempt(ps,l,r)}}const xw={name:"htmlText",tokenize:pw};function pw(t,l,r){const i=this;let o,u,f;return m;function m(z){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(z),p}function p(z){return z===33?(t.consume(z),h):z===47?(t.consume(z),$):z===63?(t.consume(z),H):mn(z)?(t.consume(z),G):r(z)}function h(z){return z===45?(t.consume(z),g):z===91?(t.consume(z),u=0,k):mn(z)?(t.consume(z),_):r(z)}function g(z){return z===45?(t.consume(z),v):r(z)}function y(z){return z===null?r(z):z===45?(t.consume(z),b):Me(z)?(f=y,V(z)):(t.consume(z),y)}function b(z){return z===45?(t.consume(z),v):y(z)}function v(z){return z===62?F(z):z===45?b(z):y(z)}function k(z){const M="CDATA[";return z===M.charCodeAt(u++)?(t.consume(z),u===M.length?S:k):r(z)}function S(z){return z===null?r(z):z===93?(t.consume(z),N):Me(z)?(f=S,V(z)):(t.consume(z),S)}function N(z){return z===93?(t.consume(z),E):S(z)}function E(z){return z===62?F(z):z===93?(t.consume(z),E):S(z)}function _(z){return z===null||z===62?F(z):Me(z)?(f=_,V(z)):(t.consume(z),_)}function H(z){return z===null?r(z):z===63?(t.consume(z),B):Me(z)?(f=H,V(z)):(t.consume(z),H)}function B(z){return z===62?F(z):H(z)}function $(z){return mn(z)?(t.consume(z),T):r(z)}function T(z){return z===45||un(z)?(t.consume(z),T):X(z)}function X(z){return Me(z)?(f=X,V(z)):Ze(z)?(t.consume(z),X):F(z)}function G(z){return z===45||un(z)?(t.consume(z),G):z===47||z===62||jt(z)?ee(z):r(z)}function ee(z){return z===47?(t.consume(z),F):z===58||z===95||mn(z)?(t.consume(z),D):Me(z)?(f=ee,V(z)):Ze(z)?(t.consume(z),ee):F(z)}function D(z){return z===45||z===46||z===58||z===95||un(z)?(t.consume(z),D):Y(z)}function Y(z){return z===61?(t.consume(z),I):Me(z)?(f=Y,V(z)):Ze(z)?(t.consume(z),Y):ee(z)}function I(z){return z===null||z===60||z===61||z===62||z===96?r(z):z===34||z===39?(t.consume(z),o=z,ne):Me(z)?(f=I,V(z)):Ze(z)?(t.consume(z),I):(t.consume(z),le)}function ne(z){return z===o?(t.consume(z),o=void 0,L):z===null?r(z):Me(z)?(f=ne,V(z)):(t.consume(z),ne)}function le(z){return z===null||z===34||z===39||z===60||z===61||z===96?r(z):z===47||z===62||jt(z)?ee(z):(t.consume(z),le)}function L(z){return z===47||z===62||jt(z)?ee(z):r(z)}function F(z){return z===62?(t.consume(z),t.exit("htmlTextData"),t.exit("htmlText"),l):r(z)}function V(z){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(z),t.exit("lineEnding"),P}function P(z){return Ze(z)?lt(t,fe,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):fe(z)}function fe(z){return t.enter("htmlTextData"),f(z)}}const Id={name:"labelEnd",resolveAll:vw,resolveTo:ww,tokenize:kw},yw={tokenize:Sw},gw={tokenize:jw},bw={tokenize:Ew};function vw(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 o=i.type==="labelImage"?4:2;i.type="data",l+=o}}return t.length!==r.length&&Bn(t,0,t.length,r),t}function ww(t,l){let r=t.length,i=0,o,u,f,m;for(;r--;)if(o=t[r][1],u){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;t[r][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(f){if(t[r][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(u=r,o.type!=="labelLink")){i=2;break}}else o.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}},h={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",h,l]],m=Zn(m,t.slice(u+1,u+i+3)),m=Zn(m,[["enter",g,l]]),m=Zn(m,dc(l.parser.constructs.insideSpan.null,t.slice(u+i+4,f-3),l)),m=Zn(m,[["exit",g,l],t[f-2],t[f-1],["exit",h,l]]),m=Zn(m,t.slice(f+1)),m=Zn(m,[["exit",p,l]]),Bn(t,u,t.length,m),t}function kw(t,l,r){const i=this;let o=i.events.length,u,f;for(;o--;)if((i.events[o][1].type==="labelImage"||i.events[o][1].type==="labelLink")&&!i.events[o][1]._balanced){u=i.events[o][1];break}return m;function m(b){return u?u._inactive?y(b):(f=i.parser.defined.includes(il(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(yw,g,f?g:y)(b):b===91?t.attempt(gw,g,f?h:y)(b):f?g(b):y(b)}function h(b){return t.attempt(bw,g,y)(b)}function g(b){return l(b)}function y(b){return u._balanced=!0,r(b)}}function Sw(t,l,r){return i;function i(y){return t.enter("resource"),t.enter("resourceMarker"),t.consume(y),t.exit("resourceMarker"),o}function o(y){return jt(y)?is(t,u)(y):u(y)}function u(y){return y===41?g(y):L0(t,f,m,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(y)}function f(y){return jt(y)?is(t,p)(y):g(y)}function m(y){return r(y)}function p(y){return y===34||y===39||y===40?U0(t,h,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(y):g(y)}function h(y){return jt(y)?is(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 jw(t,l,r){const i=this;return o;function o(m){return H0.call(i,t,u,f,"reference","referenceMarker","referenceString")(m)}function u(m){return i.parser.defined.includes(il(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?l(m):r(m)}function f(m){return r(m)}}function Ew(t,l,r){return i;function i(u){return t.enter("reference"),t.enter("referenceMarker"),t.consume(u),t.exit("referenceMarker"),o}function o(u){return u===93?(t.enter("referenceMarker"),t.consume(u),t.exit("referenceMarker"),t.exit("reference"),l):r(u)}}const Cw={name:"labelStartImage",resolveAll:Id.resolveAll,tokenize:Nw};function Nw(t,l,r){const i=this;return o;function o(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 Aw={name:"labelStartLink",resolveAll:Id.resolveAll,tokenize:Dw};function Dw(t,l,r){const i=this;return o;function o(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 $f={name:"lineEnding",tokenize:Tw};function Tw(t,l){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),lt(t,l,"linePrefix")}}const Qo={name:"thematicBreak",tokenize:zw};function zw(t,l,r){let i=0,o;return u;function u(h){return t.enter("thematicBreak"),f(h)}function f(h){return o=h,m(h)}function m(h){return h===o?(t.enter("thematicBreakSequence"),p(h)):i>=3&&(h===null||Me(h))?(t.exit("thematicBreak"),l(h)):r(h)}function p(h){return h===o?(t.consume(h),i++,p):(t.exit("thematicBreakSequence"),Ze(h)?lt(t,m,"whitespace")(h):m(h))}}const En={continuation:{tokenize:Rw},exit:Bw,name:"list",tokenize:Fw},Mw={partial:!0,tokenize:$w},_w={partial:!0,tokenize:Ow};function Fw(t,l,r){const i=this,o=i.events[i.events.length-1];let u=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,f=0;return m;function m(v){const k=i.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!i.containerState.marker||v===i.containerState.marker:bd(v)){if(i.containerState.type||(i.containerState.type=k,t.enter(k,{_container:!0})),k==="listUnordered")return t.enter("listItemPrefix"),v===42||v===45?t.check(Qo,r,h)(v):h(v);if(!i.interrupt||v===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),p(v)}return r(v)}function p(v){return bd(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"),h(v)):r(v)}function h(v){return t.enter("listItemMarker"),t.consume(v),t.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||v,t.check(ps,i.interrupt?r:g,t.attempt(Mw,b,y))}function g(v){return i.containerState.initialBlankLine=!0,u++,b(v)}function y(v){return Ze(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 Rw(t,l,r){const i=this;return i.containerState._closeFlow=void 0,t.check(ps,o,u);function o(m){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,lt(t,l,"listItemIndent",i.containerState.size+1)(m)}function u(m){return i.containerState.furtherBlankLines||!Ze(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(_w,l,f)(m))}function f(m){return i.containerState._closeFlow=!0,i.interrupt=void 0,lt(t,t.attempt(En,l,r),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(m)}}function Ow(t,l,r){const i=this;return lt(t,o,"listItemIndent",i.containerState.size+1);function o(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 Bw(t){t.exit(this.containerState.type)}function $w(t,l,r){const i=this;return lt(t,o,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(u){const f=i.events[i.events.length-1];return!Ze(u)&&f&&f[1].type==="listItemPrefixWhitespace"?l(u):r(u)}}const x1={name:"setextUnderline",resolveTo:Lw,tokenize:Hw};function Lw(t,l){let r=t.length,i,o,u;for(;r--;)if(t[r][0]==="enter"){if(t[r][1].type==="content"){i=r;break}t[r][1].type==="paragraph"&&(o=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[o][1].type="setextHeadingText",u?(t.splice(o,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 Hw(t,l,r){const i=this;let o;return u;function u(h){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"),o=h,f(h)):r(h)}function f(h){return t.enter("setextHeadingLineSequence"),m(h)}function m(h){return h===o?(t.consume(h),m):(t.exit("setextHeadingLineSequence"),Ze(h)?lt(t,p,"lineSuffix")(h):p(h))}function p(h){return h===null||Me(h)?(t.exit("setextHeadingLine"),l(h)):r(h)}}const Uw={tokenize:Iw};function Iw(t){const l=this,r=t.attempt(ps,i,t.attempt(this.parser.constructs.flowInitial,o,lt(t,t.attempt(this.parser.constructs.flow,o,t.attempt(Gv,o)),"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 o(u){if(u===null){t.consume(u);return}return t.enter("lineEnding"),t.consume(u),t.exit("lineEnding"),l.currentConstruct=void 0,r}}const Yw={resolveAll:Y0()},qw=I0("string"),Xw=I0("text");function I0(t){return{resolveAll:Y0(t==="text"?Vw:void 0),tokenize:l};function l(r){const i=this,o=this.parser.constructs[t],u=r.attempt(o,f,m);return f;function f(g){return h(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 h(g)?(r.exit("data"),u(g)):(r.consume(g),p)}function h(g){if(g===null)return!0;const y=o[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 Y0(t){return l;function l(r,i){let o=-1,u;for(;++o<=r.length;)u===void 0?r[o]&&r[o][1].type==="data"&&(u=o,o++):(!r[o]||r[o][1].type!=="data")&&(o!==u+2&&(r[u][1].end=r[o-1][1].end,r.splice(u+2,o-u-2),o=u+2),u=void 0);return t?t(r,i):r}}function Vw(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],o=l.sliceStream(i);let u=o.length,f=-1,m=0,p;for(;u--;){const h=o[u];if(typeof h=="string"){for(f=h.length;h.charCodeAt(f-1)===32;)m++,f--;if(f)break;f=-1}else if(h===-2)p=!0,m++;else if(h!==-1){u++;break}}if(l._contentTypeTextTrailing&&r===t.length&&(m=0),m){const h={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={...h.start},i.start.offset===i.end.offset?Object.assign(i,h):(t.splice(r,0,["enter",h,l],["exit",h,l]),r+=2)}r++}return t}const Gw={42:En,43:En,45:En,48:En,49:En,50:En,51:En,52:En,53:En,54:En,55:En,56:En,57:En,62:R0},Kw={91:Jv},Qw={[-2]:Bf,[-1]:Bf,32:Bf},Zw={35:aw,42:Qo,45:[x1,Qo],60:ow,61:x1,95:Qo,96:h1,126:h1},Ww={38:B0,92:O0},Jw={[-5]:$f,[-4]:$f,[-3]:$f,33:Cw,38:B0,42:vd,60:[Av,xw],91:Aw,92:[nw,O0],93:Id,95:vd,96:Uv},Pw={null:[vd,Yw]},e5={null:[42,95]},t5={null:[]},n5=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:e5,contentInitial:Kw,disable:t5,document:Gw,flow:Zw,flowInitial:Qw,insideSpan:Pw,string:Ww,text:Jw},Symbol.toStringTag,{value:"Module"}));function l5(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 o={},u=[];let f=[],m=[];const p={attempt:X($),check:X(T),consume:_,enter:H,exit:B,interrupt:X(T,{interrupt:!0})},h={code:null,containerState:{},defineSkip:S,events:[],now:k,parser:t,previous:null,sliceSerialize:b,sliceStream:v,write:y};let g=l.tokenize.call(h,p);return l.resolveAll&&u.push(l),h;function y(Y){return f=Zn(f,Y),N(),f[f.length-1]!==null?[]:(G(l,0),h.events=dc(u,h.events,h),h.events)}function b(Y,I){return r5(v(Y),I)}function v(Y){return a5(f,Y)}function k(){const{_bufferIndex:Y,_index:I,line:ne,column:le,offset:L}=i;return{_bufferIndex:Y,_index:I,line:ne,column:le,offset:L}}function S(Y){o[Y.line]=Y.column,D()}function N(){let Y;for(;i._index<f.length;){const I=f[i._index];if(typeof I=="string")for(Y=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===Y&&i._bufferIndex<I.length;)E(I.charCodeAt(i._bufferIndex));else E(I)}}function E(Y){g=g(Y)}function _(Y){Me(Y)?(i.line++,i.column=1,i.offset+=Y===-3?2:1,D()):Y!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===f[i._index].length&&(i._bufferIndex=-1,i._index++)),h.previous=Y}function H(Y,I){const ne=I||{};return ne.type=Y,ne.start=k(),h.events.push(["enter",ne,h]),m.push(ne),ne}function B(Y){const I=m.pop();return I.end=k(),h.events.push(["exit",I,h]),I}function $(Y,I){G(Y,I.from)}function T(Y,I){I.restore()}function X(Y,I){return ne;function ne(le,L,F){let V,P,fe,z;return Array.isArray(le)?K(le):"tokenize"in le?K([le]):M(le);function M(ve){return Ne;function Ne(Oe){const Be=Oe!==null&&ve[Oe],me=Oe!==null&&ve.null,Ve=[...Array.isArray(Be)?Be:Be?[Be]:[],...Array.isArray(me)?me:me?[me]:[]];return K(Ve)(Oe)}}function K(ve){return V=ve,P=0,ve.length===0?F:A(ve[P])}function A(ve){return Ne;function Ne(Oe){return z=ee(),fe=ve,ve.partial||(h.currentConstruct=ve),ve.name&&h.parser.constructs.disable.null.includes(ve.name)?be():ve.tokenize.call(I?Object.assign(Object.create(h),I):h,p,oe,be)(Oe)}}function oe(ve){return Y(fe,z),L}function be(ve){return z.restore(),++P<V.length?A(V[P]):F}}}function G(Y,I){Y.resolveAll&&!u.includes(Y)&&u.push(Y),Y.resolve&&Bn(h.events,I,h.events.length-I,Y.resolve(h.events.slice(I),h)),Y.resolveTo&&(h.events=Y.resolveTo(h.events,h))}function ee(){const Y=k(),I=h.previous,ne=h.currentConstruct,le=h.events.length,L=Array.from(m);return{from:le,restore:F};function F(){i=Y,h.previous=I,h.currentConstruct=ne,h.events.length=le,m=L,D()}}function D(){i.line in o&&i.column<2&&(i.column=o[i.line],i.offset+=o[i.line]-1)}}function a5(t,l){const r=l.start._index,i=l.start._bufferIndex,o=l.end._index,u=l.end._bufferIndex;let f;if(r===o)f=[t[r].slice(i,u)];else{if(f=t.slice(r,o),i>-1){const m=f[0];typeof m=="string"?f[0]=m.slice(i):f.shift()}u>0&&f.push(t[o].slice(0,u))}return f}function r5(t,l){let r=-1;const i=[];let o;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&&o)continue;f=" ";break}default:f=String.fromCharCode(u)}o=u===-2,i.push(f)}return i.join("")}function i5(t){const i={constructs:_0([n5,...(t||{}).extensions||[]]),content:o(wv),defined:[],document:o(Sv),flow:o(Uw),lazy:{},string:o(qw),text:o(Xw)};return i;function o(u){return f;function f(m){return l5(i,u,m)}}}function s5(t){for(;!$0(t););return t}const p1=/[\0\t\n\r]/g;function o5(){let t=1,l="",r=!0,i;return o;function o(u,f,m){const p=[];let h,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(p1.lastIndex=y,h=p1.exec(u),b=h&&h.index!==void 0?h.index:u.length,v=u.charCodeAt(b),!h){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 c5=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function u5(t){return t.replace(c5,f5)}function f5(t,l,r){if(l)return l;if(r.charCodeAt(0)===35){const o=r.charCodeAt(1),u=o===120||o===88;return F0(r.slice(u?2:1),u?16:10)}return Ud(r)||t}const q0={}.hasOwnProperty;function d5(t,l,r){return l&&typeof l=="object"&&(r=l,l=void 0),h5(r)(s5(i5(r).document().write(o5()(t,l,!0))))}function h5(t){const l={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(Lt),autolinkProtocol:ee,autolinkEmail:ee,atxHeading:u(nt),blockQuote:u(me),characterEscape:ee,characterReference:ee,codeFenced:u(Ve),codeFencedFenceInfo:f,codeFencedFenceMeta:f,codeIndented:u(Ve,f),codeText:u(Ge,f),codeTextData:ee,data:ee,codeFlowValue:ee,definition:u(de),definitionDestinationString:f,definitionLabelString:f,definitionTitleString:f,emphasis:u(Ee),hardBreakEscape:u(nn),hardBreakTrailing:u(nn),htmlFlow:u(Et,f),htmlFlowData:ee,htmlText:u(Et,f),htmlTextData:ee,image:u(Jt),label:f,link:u(Lt),listItem:u(Ct),listItemValue:b,listOrdered:u(on,y),listUnordered:u(on),paragraph:u(_t),reference:A,referenceString:f,resourceDestinationString:f,resourceTitleString:f,setextHeading:u(nt),strong:u($n),thematicBreak:u(Ln)},exit:{atxHeading:p(),atxHeadingSequence:$,autolink:p(),autolinkEmail:Be,autolinkProtocol:Oe,blockQuote:p(),characterEscapeValue:D,characterReferenceMarkerHexadecimal:be,characterReferenceMarkerNumeric:be,characterReferenceValue:ve,characterReference:Ne,codeFenced:p(N),codeFencedFence:S,codeFencedFenceInfo:v,codeFencedFenceMeta:k,codeFlowValue:D,codeIndented:p(E),codeText:p(L),codeTextData:D,data:D,definition:p(),definitionDestinationString:B,definitionLabelString:_,definitionTitleString:H,emphasis:p(),hardBreakEscape:p(I),hardBreakTrailing:p(I),htmlFlow:p(ne),htmlFlowData:D,htmlText:p(le),htmlTextData:D,image:p(V),label:fe,labelText:P,lineEnding:Y,link:p(F),listItem:p(),listOrdered:p(),listUnordered:p(),paragraph:p(),referenceString:oe,resourceDestinationString:z,resourceTitleString:M,resource:K,setextHeading:p(G),setextHeadingLineSequence:X,setextHeadingText:T,strong:p(),thematicBreak:p()}};X0(l,(t||{}).mdastExtensions||[]);const r={};return i;function i(ae){let xe={type:"root",children:[]};const De={stack:[xe],tokenStack:[],config:l,enter:m,exit:h,buffer:f,resume:g,data:r},he=[];let ye=-1;for(;++ye<ae.length;)if(ae[ye][1].type==="listOrdered"||ae[ye][1].type==="listUnordered")if(ae[ye][0]==="enter")he.push(ye);else{const at=he.pop();ye=o(ae,at,ye)}for(ye=-1;++ye<ae.length;){const at=l[ae[ye][0]];q0.call(at,ae[ye][1].type)&&at[ae[ye][1].type].call(Object.assign({sliceSerialize:ae[ye][2].sliceSerialize},De),ae[ye][1])}if(De.tokenStack.length>0){const at=De.tokenStack[De.tokenStack.length-1];(at[1]||y1).call(De,void 0,at[0])}for(xe.position={start:ya(ae.length>0?ae[0][1].start:{line:1,column:1,offset:0}),end:ya(ae.length>0?ae[ae.length-2][1].end:{line:1,column:1,offset:0})},ye=-1;++ye<l.transforms.length;)xe=l.transforms[ye](xe)||xe;return xe}function o(ae,xe,De){let he=xe-1,ye=-1,at=!1,mt,Ye,ce,Ae;for(;++he<=De;){const rt=ae[he];switch(rt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{rt[0]==="enter"?ye++:ye--,Ae=void 0;break}case"lineEndingBlank":{rt[0]==="enter"&&(mt&&!Ae&&!ye&&!ce&&(ce=he),Ae=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ae=void 0}if(!ye&&rt[0]==="enter"&&rt[1].type==="listItemPrefix"||ye===-1&&rt[0]==="exit"&&(rt[1].type==="listUnordered"||rt[1].type==="listOrdered")){if(mt){let yn=he;for(Ye=void 0;yn--;){const Pt=ae[yn];if(Pt[1].type==="lineEnding"||Pt[1].type==="lineEndingBlank"){if(Pt[0]==="exit")continue;Ye&&(ae[Ye][1].type="lineEndingBlank",at=!0),Pt[1].type="lineEnding",Ye=yn}else if(!(Pt[1].type==="linePrefix"||Pt[1].type==="blockQuotePrefix"||Pt[1].type==="blockQuotePrefixWhitespace"||Pt[1].type==="blockQuoteMarker"||Pt[1].type==="listItemIndent"))break}ce&&(!Ye||ce<Ye)&&(mt._spread=!0),mt.end=Object.assign({},Ye?ae[Ye][1].start:rt[1].end),ae.splice(Ye||he,0,["exit",mt,rt[2]]),he++,De++}if(rt[1].type==="listItemPrefix"){const yn={type:"listItem",_spread:!1,start:Object.assign({},rt[1].start),end:void 0};mt=yn,ae.splice(he,0,["enter",yn,rt[2]]),he++,De++,ce=void 0,Ae=!0}}}return ae[xe][1]._spread=at,De}function u(ae,xe){return De;function De(he){m.call(this,ae(he),he),xe&&xe.call(this,he)}}function f(){this.stack.push({type:"fragment",children:[]})}function m(ae,xe,De){this.stack[this.stack.length-1].children.push(ae),this.stack.push(ae),this.tokenStack.push([xe,De||void 0]),ae.position={start:ya(xe.start),end:void 0}}function p(ae){return xe;function xe(De){ae&&ae.call(this,De),h.call(this,De)}}function h(ae,xe){const De=this.stack.pop(),he=this.tokenStack.pop();if(he)he[0].type!==ae.type&&(xe?xe.call(this,ae,he[0]):(he[1]||y1).call(this,ae,he[0]));else throw new Error("Cannot close `"+ae.type+"` ("+rs({start:ae.start,end:ae.end})+"): it’s not open");De.position.end=ya(ae.end)}function g(){return Hd(this.stack.pop())}function y(){this.data.expectingFirstListItemValue=!0}function b(ae){if(this.data.expectingFirstListItemValue){const xe=this.stack[this.stack.length-2];xe.start=Number.parseInt(this.sliceSerialize(ae),10),this.data.expectingFirstListItemValue=void 0}}function v(){const ae=this.resume(),xe=this.stack[this.stack.length-1];xe.lang=ae}function k(){const ae=this.resume(),xe=this.stack[this.stack.length-1];xe.meta=ae}function S(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function N(){const ae=this.resume(),xe=this.stack[this.stack.length-1];xe.value=ae.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function E(){const ae=this.resume(),xe=this.stack[this.stack.length-1];xe.value=ae.replace(/(\r?\n|\r)$/g,"")}function _(ae){const xe=this.resume(),De=this.stack[this.stack.length-1];De.label=xe,De.identifier=il(this.sliceSerialize(ae)).toLowerCase()}function H(){const ae=this.resume(),xe=this.stack[this.stack.length-1];xe.title=ae}function B(){const ae=this.resume(),xe=this.stack[this.stack.length-1];xe.url=ae}function $(ae){const xe=this.stack[this.stack.length-1];if(!xe.depth){const De=this.sliceSerialize(ae).length;xe.depth=De}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function X(ae){const xe=this.stack[this.stack.length-1];xe.depth=this.sliceSerialize(ae).codePointAt(0)===61?1:2}function G(){this.data.setextHeadingSlurpLineEnding=void 0}function ee(ae){const De=this.stack[this.stack.length-1].children;let he=De[De.length-1];(!he||he.type!=="text")&&(he=Ft(),he.position={start:ya(ae.start),end:void 0},De.push(he)),this.stack.push(he)}function D(ae){const xe=this.stack.pop();xe.value+=this.sliceSerialize(ae),xe.position.end=ya(ae.end)}function Y(ae){const xe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const De=xe.children[xe.children.length-1];De.position.end=ya(ae.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&l.canContainEols.includes(xe.type)&&(ee.call(this,ae),D.call(this,ae))}function I(){this.data.atHardBreak=!0}function ne(){const ae=this.resume(),xe=this.stack[this.stack.length-1];xe.value=ae}function le(){const ae=this.resume(),xe=this.stack[this.stack.length-1];xe.value=ae}function L(){const ae=this.resume(),xe=this.stack[this.stack.length-1];xe.value=ae}function F(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const xe=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=xe,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function V(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const xe=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=xe,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function P(ae){const xe=this.sliceSerialize(ae),De=this.stack[this.stack.length-2];De.label=u5(xe),De.identifier=il(xe).toLowerCase()}function fe(){const ae=this.stack[this.stack.length-1],xe=this.resume(),De=this.stack[this.stack.length-1];if(this.data.inReference=!0,De.type==="link"){const he=ae.children;De.children=he}else De.alt=xe}function z(){const ae=this.resume(),xe=this.stack[this.stack.length-1];xe.url=ae}function M(){const ae=this.resume(),xe=this.stack[this.stack.length-1];xe.title=ae}function K(){this.data.inReference=void 0}function A(){this.data.referenceType="collapsed"}function oe(ae){const xe=this.resume(),De=this.stack[this.stack.length-1];De.label=xe,De.identifier=il(this.sliceSerialize(ae)).toLowerCase(),this.data.referenceType="full"}function be(ae){this.data.characterReferenceType=ae.type}function ve(ae){const xe=this.sliceSerialize(ae),De=this.data.characterReferenceType;let he;De?(he=F0(xe,De==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):he=Ud(xe);const ye=this.stack[this.stack.length-1];ye.value+=he}function Ne(ae){const xe=this.stack.pop();xe.position.end=ya(ae.end)}function Oe(ae){D.call(this,ae);const xe=this.stack[this.stack.length-1];xe.url=this.sliceSerialize(ae)}function Be(ae){D.call(this,ae);const xe=this.stack[this.stack.length-1];xe.url="mailto:"+this.sliceSerialize(ae)}function me(){return{type:"blockquote",children:[]}}function Ve(){return{type:"code",lang:null,meta:null,value:""}}function Ge(){return{type:"inlineCode",value:""}}function de(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ee(){return{type:"emphasis",children:[]}}function nt(){return{type:"heading",depth:0,children:[]}}function nn(){return{type:"break"}}function Et(){return{type:"html",value:""}}function Jt(){return{type:"image",title:null,url:"",alt:null}}function Lt(){return{type:"link",title:null,url:"",children:[]}}function on(ae){return{type:"list",ordered:ae.type==="listOrdered",start:null,spread:ae._spread,children:[]}}function Ct(ae){return{type:"listItem",spread:ae._spread,checked:null,children:[]}}function _t(){return{type:"paragraph",children:[]}}function $n(){return{type:"strong",children:[]}}function Ft(){return{type:"text",value:""}}function Ln(){return{type:"thematicBreak"}}}function ya(t){return{line:t.line,column:t.column,offset:t.offset}}function X0(t,l){let r=-1;for(;++r<l.length;){const i=l[r];Array.isArray(i)?X0(t,i):m5(t,i)}}function m5(t,l){let r;for(r in l)if(q0.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 y1(t,l){throw t?new Error("Cannot close `"+t.type+"` ("+rs({start:t.start,end:t.end})+"): a different token (`"+l.type+"`, "+rs({start:l.start,end:l.end})+") is open"):new Error("Cannot close document, a token (`"+l.type+"`, "+rs({start:l.start,end:l.end})+") is still open")}function x5(t){const l=this;l.parser=r;function r(i){return d5(i,{...l.data("settings"),...t,extensions:l.data("micromarkExtensions")||[],mdastExtensions:l.data("fromMarkdownExtensions")||[]})}}function p5(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 y5(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={},o=l.lang?l.lang.split(/\s+/):[];o.length>0&&(i.className=["language-"+o[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 b5(t,l){const r={type:"element",tagName:"del",properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}function v5(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(),o=Gr(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-"+o,id:r+"fnref-"+o+(m>1?"-"+m:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(f)}]};t.patch(l,p);const h={type:"element",tagName:"sup",properties:{},children:[p]};return t.patch(l,h),t.applyData(l,h)}function k5(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 S5(t,l){if(t.options.allowDangerousHtml){const r={type:"raw",value:l.value};return t.patch(l,r),t.applyData(l,r)}}function V0(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 o=t.all(l),u=o[0];u&&u.type==="text"?u.value="["+u.value:o.unshift({type:"text",value:"["});const f=o[o.length-1];return f&&f.type==="text"?f.value+=i:o.push({type:"text",value:i}),o}function j5(t,l){const r=String(l.identifier).toUpperCase(),i=t.definitionById.get(r);if(!i)return V0(t,l);const o={src:Gr(i.url||""),alt:l.alt};i.title!==null&&i.title!==void 0&&(o.title=i.title);const u={type:"element",tagName:"img",properties:o,children:[]};return t.patch(l,u),t.applyData(l,u)}function E5(t,l){const r={src:Gr(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 C5(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 N5(t,l){const r=String(l.identifier).toUpperCase(),i=t.definitionById.get(r);if(!i)return V0(t,l);const o={href:Gr(i.url||"")};i.title!==null&&i.title!==void 0&&(o.title=i.title);const u={type:"element",tagName:"a",properties:o,children:t.all(l)};return t.patch(l,u),t.applyData(l,u)}function A5(t,l){const r={href:Gr(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 D5(t,l,r){const i=t.all(l),o=r?T5(r):G0(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];(o||m!==0||g.type!=="element"||g.tagName!=="p")&&f.push({type:"text",value:`
|
|
56
|
+
`}),g.type==="element"&&g.tagName==="p"&&!o?f.push(...g.children):f.push(g)}const p=i[i.length-1];p&&(o||p.type!=="element"||p.tagName!=="p")&&f.push({type:"text",value:`
|
|
57
|
+
`});const h={type:"element",tagName:"li",properties:u,children:f};return t.patch(l,h),t.applyData(l,h)}function T5(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=G0(r[i])}return l}function G0(t){const l=t.spread;return l??t.children.length>1}function z5(t,l){const r={},i=t.all(l);let o=-1;for(typeof l.start=="number"&&l.start!==1&&(r.start=l.start);++o<i.length;){const f=i[o];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 M5(t,l){const r={type:"element",tagName:"p",properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}function _5(t,l){const r={type:"root",children:t.wrap(t.all(l))};return t.patch(l,r),t.applyData(l,r)}function F5(t,l){const r={type:"element",tagName:"strong",properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}function R5(t,l){const r=t.all(l),i=r.shift(),o=[];if(i){const f={type:"element",tagName:"thead",properties:{},children:t.wrap([i],!0)};t.patch(l.children[0],f),o.push(f)}if(r.length>0){const f={type:"element",tagName:"tbody",properties:{},children:t.wrap(r,!0)},m=Od(l.children[1]),p=C0(l.children[l.children.length-1]);m&&p&&(f.position={start:m,end:p}),o.push(f)}const u={type:"element",tagName:"table",properties:{},children:t.wrap(o,!0)};return t.patch(l,u),t.applyData(l,u)}function O5(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 h=[];for(;++p<m;){const y=l.children[p],b={},v=f?f[p]:void 0;v&&(b.align=v);let k={type:"element",tagName:u,properties:b,children:[]};y&&(k.children=t.all(y),t.patch(y,k),k=t.applyData(y,k)),h.push(k)}const g={type:"element",tagName:"tr",properties:{},children:t.wrap(h,!0)};return t.patch(l,g),t.applyData(l,g)}function B5(t,l){const r={type:"element",tagName:"td",properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}const g1=9,b1=32;function $5(t){const l=String(t),r=/\r?\n|\r/g;let i=r.exec(l),o=0;const u=[];for(;i;)u.push(v1(l.slice(o,i.index),o>0,!0),i[0]),o=i.index+i[0].length,i=r.exec(l);return u.push(v1(l.slice(o),o>0,!1)),u.join("")}function v1(t,l,r){let i=0,o=t.length;if(l){let u=t.codePointAt(i);for(;u===g1||u===b1;)i++,u=t.codePointAt(i)}if(r){let u=t.codePointAt(o-1);for(;u===g1||u===b1;)o--,u=t.codePointAt(o-1)}return o>i?t.slice(i,o):""}function L5(t,l){const r={type:"text",value:$5(String(l.value))};return t.patch(l,r),t.applyData(l,r)}function H5(t,l){const r={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(l,r),t.applyData(l,r)}const U5={blockquote:p5,break:y5,code:g5,delete:b5,emphasis:v5,footnoteReference:w5,heading:k5,html:S5,imageReference:j5,image:E5,inlineCode:C5,linkReference:N5,link:A5,listItem:D5,list:z5,paragraph:M5,root:_5,strong:F5,table:R5,tableCell:B5,tableRow:O5,text:L5,thematicBreak:H5,toml:Bo,yaml:Bo,definition:Bo,footnoteDefinition:Bo};function Bo(){}const K0=-1,hc=0,ss=1,nc=2,Yd=3,qd=4,Xd=5,Vd=6,Q0=7,Z0=8,w1=typeof self=="object"?self:globalThis,I5=(t,l)=>{const r=(o,u)=>(t.set(u,o),o),i=o=>{if(t.has(o))return t.get(o);const[u,f]=l[o];switch(u){case hc:case K0:return r(f,o);case ss:{const m=r([],o);for(const p of f)m.push(i(p));return m}case nc:{const m=r({},o);for(const[p,h]of f)m[i(p)]=i(h);return m}case Yd:return r(new Date(f),o);case qd:{const{source:m,flags:p}=f;return r(new RegExp(m,p),o)}case Xd:{const m=r(new Map,o);for(const[p,h]of f)m.set(i(p),i(h));return m}case Vd:{const m=r(new Set,o);for(const p of f)m.add(i(p));return m}case Q0:{const{name:m,message:p}=f;return r(new w1[m](p),o)}case Z0:return r(BigInt(f),o);case"BigInt":return r(Object(BigInt(f)),o);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 w1[u](f),o)};return i},k1=t=>I5(new Map,t)(0),$r="",{toString:Y5}={},{keys:q5}=Object,Qi=t=>{const l=typeof t;if(l!=="object"||!t)return[hc,l];const r=Y5.call(t).slice(8,-1);switch(r){case"Array":return[ss,$r];case"Object":return[nc,$r];case"Date":return[Yd,$r];case"RegExp":return[qd,$r];case"Map":return[Xd,$r];case"Set":return[Vd,$r];case"DataView":return[ss,r]}return r.includes("Array")?[ss,r]:r.includes("Error")?[Q0,r]:[nc,r]},$o=([t,l])=>t===hc&&(l==="function"||l==="symbol"),X5=(t,l,r,i)=>{const o=(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]=Qi(f);switch(m){case hc:{let g=f;switch(p){case"bigint":m=Z0,g=f.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+p);g=null;break;case"undefined":return o([K0],f)}return o([m,g],f)}case ss:{if(p){let b=f;return p==="DataView"?b=new Uint8Array(f.buffer):p==="ArrayBuffer"&&(b=new Uint8Array(f)),o([p,[...b]],f)}const g=[],y=o([m,g],f);for(const b of f)g.push(u(b));return y}case nc:{if(p)switch(p){case"BigInt":return o([p,f.toString()],f);case"Boolean":case"Number":case"String":return o([p,f.valueOf()],f)}if(l&&"toJSON"in f)return u(f.toJSON());const g=[],y=o([m,g],f);for(const b of q5(f))(t||!$o(Qi(f[b])))&&g.push([u(b),u(f[b])]);return y}case Yd:return o([m,f.toISOString()],f);case qd:{const{source:g,flags:y}=f;return o([m,{source:g,flags:y}],f)}case Xd:{const g=[],y=o([m,g],f);for(const[b,v]of f)(t||!($o(Qi(b))||$o(Qi(v))))&&g.push([u(b),u(v)]);return y}case Vd:{const g=[],y=o([m,g],f);for(const b of f)(t||!$o(Qi(b)))&&g.push(u(b));return y}}const{message:h}=f;return o([m,{name:p,message:h}],f)};return u},S1=(t,{json:l,lossy:r}={})=>{const i=[];return X5(!(l||r),!!l,new Map,i)(t),i},lc=typeof structuredClone=="function"?(t,l)=>l&&("json"in l||"lossy"in l)?k1(S1(t,l)):structuredClone(t):(t,l)=>k1(S1(t,l));function V5(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 G5(t,l){return"Back to reference "+(t+1)+(l>1?"-"+l:"")}function K5(t){const l=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=t.options.footnoteBackContent||V5,i=t.options.footnoteBackLabel||G5,o=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 h=t.footnoteById.get(t.footnoteOrder[p]);if(!h)continue;const g=t.all(h),y=String(h.identifier).toUpperCase(),b=Gr(y.toLowerCase());let v=0;const k=[],S=t.footnoteCounts.get(y);for(;S!==void 0&&++v<=S;){k.length>0&&k.push({type:"text",value:" "});let _=typeof r=="string"?r:r(p,v);typeof _=="string"&&(_={type:"text",value:_}),k.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(_)?_:[_]})}const N=g[g.length-1];if(N&&N.type==="element"&&N.tagName==="p"){const _=N.children[N.children.length-1];_&&_.type==="text"?_.value+=" ":N.children.push({type:"text",value:" "}),N.children.push(...k)}else g.push(...k);const E={type:"element",tagName:"li",properties:{id:l+"fn-"+b},children:t.wrap(g,!0)};t.patch(h,E),m.push(E)}if(m.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...lc(f),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
|
|
58
|
+
`},{type:"element",tagName:"ol",properties:{},children:t.wrap(m,!0)},{type:"text",value:`
|
|
59
|
+
`}]}}const mc=(function(t){if(t==null)return J5;if(typeof t=="function")return xc(t);if(typeof t=="object")return Array.isArray(t)?Q5(t):Z5(t);if(typeof t=="string")return W5(t);throw new Error("Expected function, string, or object as test")});function Q5(t){const l=[];let r=-1;for(;++r<t.length;)l[r]=mc(t[r]);return xc(i);function i(...o){let u=-1;for(;++u<l.length;)if(l[u].apply(this,o))return!0;return!1}}function Z5(t){const l=t;return xc(r);function r(i){const o=i;let u;for(u in t)if(o[u]!==l[u])return!1;return!0}}function W5(t){return xc(l);function l(r){return r&&r.type===t}}function xc(t){return l;function l(r,i,o){return!!(P5(r)&&t.call(this,r,typeof i=="number"?i:void 0,o||void 0))}}function J5(){return!0}function P5(t){return t!==null&&typeof t=="object"&&"type"in t}const W0=[],e3=!0,wd=!1,t3="skip";function J0(t,l,r,i){let o;typeof l=="function"&&typeof r!="function"?(i=r,r=l):o=l;const u=mc(o),f=i?-1:1;m(t,void 0,[])();function m(p,h,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=W0,k,S,N;if((!l||u(p,h,g[g.length-1]||void 0))&&(v=n3(r(p,g)),v[0]===wd))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,N=g.concat(E);S>-1&&S<E.children.length;){const _=E.children[S];if(k=m(_,S,N)(),k[0]===wd)return k;S=typeof k[1]=="number"?k[1]:S+f}}return v}}}function n3(t){return Array.isArray(t)?t:typeof t=="number"?[e3,t]:t==null?W0:[t]}function Gd(t,l,r,i){let o,u,f;typeof l=="function"&&typeof r!="function"?(u=void 0,f=l,o=r):(u=l,f=r,o=i),J0(t,u,m,o);function m(p,h){const g=h[h.length-1],y=g?g.children.indexOf(p):void 0;return f(p,y,g)}}const kd={}.hasOwnProperty,l3={};function a3(t,l){const r=l||l3,i=new Map,o=new Map,u=new Map,f={...U5,...r.handlers},m={all:h,applyData:i3,definitionById:i,footnoteById:o,footnoteCounts:u,footnoteOrder:[],handlers:f,one:p,options:r,patch:r3,wrap:o3};return Gd(t,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const y=g.type==="definition"?i:o,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(kd.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,...N}=g,E=lc(N);return E.children=m.all(g),E}return lc(g)}return(m.options.unknownHandler||s3)(m,g,y)}function h(g){const y=[];if("children"in g){const b=g.children;let v=-1;for(;++v<b.length;){const k=m.one(b[v],g);if(k){if(v&&b[v-1].type==="break"&&(!Array.isArray(k)&&k.type==="text"&&(k.value=j1(k.value)),!Array.isArray(k)&&k.type==="element")){const S=k.children[0];S&&S.type==="text"&&(S.value=j1(S.value))}Array.isArray(k)?y.push(...k):y.push(k)}}}return y}}function r3(t,l){t.position&&(l.position=Gb(t))}function i3(t,l){let r=l;if(t&&t.data){const i=t.data.hName,o=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,lc(u)),"children"in r&&r.children&&o!==null&&o!==void 0&&(r.children=o)}return r}function s3(t,l){const r=l.data||{},i="value"in l&&!(kd.call(r,"hProperties")||kd.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 o3(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 j1(t){let l=0,r=t.charCodeAt(l);for(;r===9||r===32;)l++,r=t.charCodeAt(l);return t.slice(l)}function E1(t,l){const r=a3(t,l),i=r.one(t,void 0),o=K5(r),u=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return o&&u.children.push({type:"text",value:`
|
|
63
|
+
`},o),u}function c3(t,l){return t&&"run"in t?async function(r,i){const o=E1(r,{file:i,...l});await t.run(o,i)}:function(r,i){return E1(r,{file:i,...t||l})}}function C1(t){if(t)throw t}var Lf,N1;function u3(){if(N1)return Lf;N1=1;var t=Object.prototype.hasOwnProperty,l=Object.prototype.toString,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,o=function(h){return typeof Array.isArray=="function"?Array.isArray(h):l.call(h)==="[object Array]"},u=function(h){if(!h||l.call(h)!=="[object Object]")return!1;var g=t.call(h,"constructor"),y=h.constructor&&h.constructor.prototype&&t.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!g&&!y)return!1;var b;for(b in h);return typeof b>"u"||t.call(h,b)},f=function(h,g){r&&g.name==="__proto__"?r(h,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):h[g.name]=g.newValue},m=function(h,g){if(g==="__proto__")if(t.call(h,g)){if(i)return i(h,g).value}else return;return h[g]};return Lf=function p(){var h,g,y,b,v,k,S=arguments[0],N=1,E=arguments.length,_=!1;for(typeof S=="boolean"&&(_=S,S=arguments[1]||{},N=2),(S==null||typeof S!="object"&&typeof S!="function")&&(S={});N<E;++N)if(h=arguments[N],h!=null)for(g in h)y=m(S,g),b=m(h,g),S!==b&&(_&&b&&(u(b)||(v=o(b)))?(v?(v=!1,k=y&&o(y)?y:[]):k=y&&u(y)?y:{},f(S,{name:g,newValue:p(_,k,b)})):typeof b<"u"&&f(S,{name:g,newValue:b}));return S},Lf}var f3=u3();const Hf=y0(f3);function Sd(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 d3(){const t=[],l={run:r,use:i};return l;function r(...o){let u=-1;const f=o.pop();if(typeof f!="function")throw new TypeError("Expected function as last argument, not "+f);m(null,...o);function m(p,...h){const g=t[++u];let y=-1;if(p){f(p);return}for(;++y<o.length;)(h[y]===null||h[y]===void 0)&&(h[y]=o[y]);o=h,g?h3(g,m)(...h):f(null,...h)}}function i(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return t.push(o),l}}function h3(t,l){let r;return i;function i(...f){const m=t.length>f.length;let p;m&&f.push(o);try{p=t.apply(this,f)}catch(h){const g=h;if(m&&r)throw g;return o(g)}m||(p&&p.then&&typeof p.then=="function"?p.then(u,o):p instanceof Error?o(p):u(p))}function o(f,...m){r||(r=!0,l(f,...m))}function u(f){o(null,f)}}const xl={basename:m3,dirname:x3,extname:p3,join:y3,sep:"/"};function m3(t,l){if(l!==void 0&&typeof l!="string")throw new TypeError('"ext" argument must be a string');ys(t);let r=0,i=-1,o=t.length,u;if(l===void 0||l.length===0||l.length>t.length){for(;o--;)if(t.codePointAt(o)===47){if(u){r=o+1;break}}else i<0&&(u=!0,i=o+1);return i<0?"":t.slice(r,i)}if(l===t)return"";let f=-1,m=l.length-1;for(;o--;)if(t.codePointAt(o)===47){if(u){r=o+1;break}}else f<0&&(u=!0,f=o+1),m>-1&&(t.codePointAt(o)===l.codePointAt(m--)?m<0&&(i=o):(m=-1,i=f));return r===i?i=f:i<0&&(i=t.length),t.slice(r,i)}function x3(t){if(ys(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 p3(t){ys(t);let l=t.length,r=-1,i=0,o=-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?o<0?o=l:u!==1&&(u=1):o>-1&&(u=-1)}return o<0||r<0||u===0||u===1&&o===r-1&&o===i+1?"":t.slice(o,r)}function y3(...t){let l=-1,r;for(;++l<t.length;)ys(t[l]),t[l]&&(r=r===void 0?t[l]:r+"/"+t[l]);return r===void 0?".":g3(r)}function g3(t){ys(t);const l=t.codePointAt(0)===47;let r=b3(t,!l);return r.length===0&&!l&&(r="."),r.length>0&&t.codePointAt(t.length-1)===47&&(r+="/"),l?"/"+r:r}function b3(t,l){let r="",i=0,o=-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(!(o===f-1||u===1))if(o!==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("/")),o=f,u=0;continue}}else if(r.length>0){r="",i=0,o=f,u=0;continue}}l&&(r=r.length>0?r+"/..":"..",i=2)}else r.length>0?r+="/"+t.slice(o+1,f):r=t.slice(o+1,f),i=f-o-1;o=f,u=0}else m===46&&u>-1?u++:u=-1}return r}function ys(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const v3={cwd:w3};function w3(){return"/"}function jd(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function k3(t){if(typeof t=="string")t=new URL(t);else if(!jd(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 S3(t)}function S3(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 o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(l)}const Uf=["history","path","basename","stem","extname","dirname"];class P0{constructor(l){let r;l?jd(l)?r={path:l}:typeof l=="string"||j3(l)?r={value:l}:r=l:r={},this.cwd="cwd"in r?"":v3.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<Uf.length;){const u=Uf[i];u in r&&r[u]!==void 0&&r[u]!==null&&(this[u]=u==="history"?[...r[u]]:r[u])}let o;for(o in r)Uf.includes(o)||(this[o]=r[o])}get basename(){return typeof this.path=="string"?xl.basename(this.path):void 0}set basename(l){Yf(l,"basename"),If(l,"basename"),this.path=xl.join(this.dirname||"",l)}get dirname(){return typeof this.path=="string"?xl.dirname(this.path):void 0}set dirname(l){A1(this.basename,"dirname"),this.path=xl.join(l||"",this.basename)}get extname(){return typeof this.path=="string"?xl.extname(this.path):void 0}set extname(l){if(If(l,"extname"),A1(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=xl.join(this.dirname,this.stem+(l||""))}get path(){return this.history[this.history.length-1]}set path(l){jd(l)&&(l=k3(l)),Yf(l,"path"),this.path!==l&&this.history.push(l)}get stem(){return typeof this.path=="string"?xl.basename(this.path,this.extname):void 0}set stem(l){Yf(l,"stem"),If(l,"stem"),this.path=xl.join(this.dirname||"",l+(this.extname||""))}fail(l,r,i){const o=this.message(l,r,i);throw o.fatal=!0,o}info(l,r,i){const o=this.message(l,r,i);return o.fatal=void 0,o}message(l,r,i){const o=new fn(l,r,i);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(l){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(l||void 0).decode(this.value)}}function If(t,l){if(t&&t.includes(xl.sep))throw new Error("`"+l+"` cannot be a path: did not expect `"+xl.sep+"`")}function Yf(t,l){if(!t)throw new Error("`"+l+"` cannot be empty")}function A1(t,l){if(!t)throw new Error("Setting `"+l+"` requires `path` to be set too")}function j3(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const E3=(function(t){const i=this.constructor.prototype,o=i[t],u=function(){return o.apply(u,arguments)};return Object.setPrototypeOf(u,i),u}),C3={}.hasOwnProperty;class Kd extends E3{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=d3()}copy(){const l=new Kd;let r=-1;for(;++r<this.attachers.length;){const i=this.attachers[r];l.use(...i)}return l.data(Hf(!0,{},this.namespace)),l}data(l,r){return typeof l=="string"?arguments.length===2?(Vf("data",this.frozen),this.namespace[l]=r,this):C3.call(this.namespace,l)&&this.namespace[l]||void 0:l?(Vf("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 o=r.call(l,...i);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(l){this.freeze();const r=Lo(l),i=this.parser||this.Parser;return qf("parse",i),i(String(r),r)}process(l,r){const i=this;return this.freeze(),qf("process",this.parser||this.Parser),Xf("process",this.compiler||this.Compiler),r?o(void 0,r):new Promise(o);function o(u,f){const m=Lo(l),p=i.parse(m);i.run(p,m,function(g,y,b){if(g||!y||!b)return h(g);const v=y,k=i.stringify(v,b);D3(k)?b.value=k:b.result=k,h(g,b)});function h(g,y){g||!y?f(g):u?u(y):r(void 0,y)}}}processSync(l){let r=!1,i;return this.freeze(),qf("processSync",this.parser||this.Parser),Xf("processSync",this.compiler||this.Compiler),this.process(l,o),T1("processSync","process",r),i;function o(u,f){r=!0,C1(u),i=f}}run(l,r,i){D1(l),this.freeze();const o=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=Lo(r);o.run(l,p,h);function h(g,y,b){const v=y||l;g?m(g):f?f(v):i(void 0,v,b)}}}runSync(l,r){let i=!1,o;return this.run(l,r,u),T1("runSync","run",i),o;function u(f,m){C1(f),o=m,i=!0}}stringify(l,r){this.freeze();const i=Lo(r),o=this.compiler||this.Compiler;return Xf("stringify",o),D1(l),o(l,i)}use(l,...r){const i=this.attachers,o=this.namespace;if(Vf("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(h){if(typeof h=="function")p(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[g,...y]=h;p(g,y)}else f(h);else throw new TypeError("Expected usable value, not `"+h+"`")}function f(h){if(!("plugins"in h)&&!("settings"in h))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(h.plugins),h.settings&&(o.settings=Hf(!0,o.settings,h.settings))}function m(h){let g=-1;if(h!=null)if(Array.isArray(h))for(;++g<h.length;){const y=h[g];u(y)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function p(h,g){let y=-1,b=-1;for(;++y<i.length;)if(i[y][0]===h){b=y;break}if(b===-1)i.push([h,...g]);else if(g.length>0){let[v,...k]=g;const S=i[b][1];Sd(S)&&Sd(v)&&(v=Hf(!0,S,v)),i[b]=[h,v,...k]}}}}const N3=new Kd().freeze();function qf(t,l){if(typeof l!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Xf(t,l){if(typeof l!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Vf(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 D1(t){if(!Sd(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function T1(t,l,r){if(!r)throw new Error("`"+t+"` finished async. Use `"+l+"` instead")}function Lo(t){return A3(t)?t:new P0(t)}function A3(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function D3(t){return typeof t=="string"||T3(t)}function T3(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const z3="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",z1=[],M1={allowDangerousHtml:!0},M3=/^(https?|ircs?|mailto|xmpp)$/i,_3=[{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 ey(t){const l=F3(t),r=R3(t);return O3(l.runSync(l.parse(r),r),t)}function F3(t){const l=t.rehypePlugins||z1,r=t.remarkPlugins||z1,i=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...M1}:M1;return N3().use(x5).use(r).use(c3,i).use(l)}function R3(t){const l=t.children||"",r=new P0;return typeof l=="string"&&(r.value=l),r}function O3(t,l){const r=l.allowedElements,i=l.allowElement,o=l.components,u=l.disallowedElements,f=l.skipHtml,m=l.unwrapDisallowed,p=l.urlTransform||B3;for(const g of _3)Object.hasOwn(l,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+z3+g.id,void 0);return Gd(t,h),Jb(t,{Fragment:c.Fragment,components:o,ignoreInvalidStyle:!0,jsx:c.jsx,jsxs:c.jsxs,passKeys:!0,passNode:!0});function h(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 Of)if(Object.hasOwn(Of,v)&&Object.hasOwn(g.properties,v)){const k=g.properties[v],S=Of[v];(S===null||S.includes(g.tagName))&&(g.properties[v]=p(String(k||""),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 B3(t){const l=t.indexOf(":"),r=t.indexOf("?"),i=t.indexOf("#"),o=t.indexOf("/");return l===-1||o!==-1&&l>o||r!==-1&&l>r||i!==-1&&l>i||M3.test(t.slice(0,l))?t:""}function _1(t,l){const r=String(t);if(typeof l!="string")throw new TypeError("Expected character");let i=0,o=r.indexOf(l);for(;o!==-1;)i++,o=r.indexOf(l,o+l.length);return i}function $3(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function L3(t,l,r){const o=mc((r||{}).ignore||[]),u=H3(l);let f=-1;for(;++f<u.length;)J0(t,"text",m);function m(h,g){let y=-1,b;for(;++y<g.length;){const v=g[y],k=b?b.children:void 0;if(o(v,k?k.indexOf(v):void 0,b))return;b=v}if(b)return p(h,g)}function p(h,g){const y=g[g.length-1],b=u[f][0],v=u[f][1];let k=0;const N=y.children.indexOf(h);let E=!1,_=[];b.lastIndex=0;let H=b.exec(h.value);for(;H;){const B=H.index,$={index:H.index,input:H.input,stack:[...g,h]};let T=v(...H,$);if(typeof T=="string"&&(T=T.length>0?{type:"text",value:T}:void 0),T===!1?b.lastIndex=B+1:(k!==B&&_.push({type:"text",value:h.value.slice(k,B)}),Array.isArray(T)?_.push(...T):T&&_.push(T),k=B+H[0].length,E=!0),!b.global)break;H=b.exec(h.value)}return E?(k<h.value.length&&_.push({type:"text",value:h.value.slice(k)}),y.children.splice(N,1,..._)):_=[h],N+_.length}}function H3(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 o=r[i];l.push([U3(o[0]),I3(o[1])])}return l}function U3(t){return typeof t=="string"?new RegExp($3(t),"g"):t}function I3(t){return typeof t=="function"?t:function(){return t}}const Gf="phrasing",Kf=["autolink","link","image","label"];function Y3(){return{transforms:[Z3],enter:{literalAutolink:X3,literalAutolinkEmail:Qf,literalAutolinkHttp:Qf,literalAutolinkWww:Qf},exit:{literalAutolink:Q3,literalAutolinkEmail:K3,literalAutolinkHttp:V3,literalAutolinkWww:G3}}}function q3(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Gf,notInConstruct:Kf},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Gf,notInConstruct:Kf},{character:":",before:"[ps]",after:"\\/",inConstruct:Gf,notInConstruct:Kf}]}}function X3(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function Qf(t){this.config.enter.autolinkProtocol.call(this,t)}function V3(t){this.config.exit.autolinkProtocol.call(this,t)}function G3(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 K3(t){this.config.exit.autolinkEmail.call(this,t)}function Q3(t){this.exit(t)}function Z3(t){L3(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,W3],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),J3]],{ignore:["link","linkReference"]})}function W3(t,l,r,i,o){let u="";if(!ty(o)||(/^w/i.test(l)&&(r=l+r,l="",u="http://"),!P3(r)))return!1;const f=ek(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 J3(t,l,r,i){return!ty(i,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+l+"@"+r,children:[{type:"text",value:l+"@"+r}]}}function P3(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 ek(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 o=_1(t,"(");let u=_1(t,")");for(;i!==-1&&o>u;)t+=r.slice(0,i+1),r=r.slice(i+1),i=r.indexOf(")"),u++;return[t,r]}function ty(t,l){const r=t.input.charCodeAt(t.index-1);return(t.index===0||Za(r)||fc(r))&&(!l||r!==47)}ny.peek=ck;function tk(){this.buffer()}function nk(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function lk(){this.buffer()}function ak(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function rk(t){const l=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=il(this.sliceSerialize(t)).toLowerCase(),r.label=l}function ik(t){this.exit(t)}function sk(t){const l=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=il(this.sliceSerialize(t)).toLowerCase(),r.label=l}function ok(t){this.exit(t)}function ck(){return"["}function ny(t,l,r,i){const o=r.createTracker(i);let u=o.move("[^");const f=r.enter("footnoteReference"),m=r.enter("reference");return u+=o.move(r.safe(r.associationId(t),{after:"]",before:u})),m(),f(),u+=o.move("]"),u}function uk(){return{enter:{gfmFootnoteCallString:tk,gfmFootnoteCall:nk,gfmFootnoteDefinitionLabelString:lk,gfmFootnoteDefinition:ak},exit:{gfmFootnoteCallString:rk,gfmFootnoteCall:ik,gfmFootnoteDefinitionLabelString:sk,gfmFootnoteDefinition:ok}}}function fk(t){let l=!1;return t&&t.firstLineBlank&&(l=!0),{handlers:{footnoteDefinition:r,footnoteReference:ny},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(i,o,u,f){const m=u.createTracker(f);let p=m.move("[^");const h=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?ly:dk))),h(),p}}function dk(t,l,r){return l===0?t:ly(t,l,r)}function ly(t,l,r){return(r?"":" ")+t}const hk=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];ay.peek=gk;function mk(){return{canContainEols:["delete"],enter:{strikethrough:pk},exit:{strikethrough:yk}}}function xk(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:hk}],handlers:{delete:ay}}}function pk(t){this.enter({type:"delete",children:[]},t)}function yk(t){this.exit(t)}function ay(t,l,r,i){const o=r.createTracker(i),u=r.enter("strikethrough");let f=o.move("~~");return f+=r.containerPhrasing(t,{...o.current(),before:f,after:"~"}),f+=o.move("~~"),u(),f}function gk(){return"~"}function bk(t){return t.length}function vk(t,l){const r=l||{},i=(r.align||[]).concat(),o=r.stringLength||bk,u=[],f=[],m=[],p=[];let h=0,g=-1;for(;++g<t.length;){const S=[],N=[];let E=-1;for(t[g].length>h&&(h=t[g].length);++E<t[g].length;){const _=wk(t[g][E]);if(r.alignDelimiters!==!1){const H=o(_);N[E]=H,(p[E]===void 0||H>p[E])&&(p[E]=H)}S.push(_)}f[g]=S,m[g]=N}let y=-1;if(typeof i=="object"&&"length"in i)for(;++y<h;)u[y]=F1(i[y]);else{const S=F1(i);for(;++y<h;)u[y]=S}y=-1;const b=[],v=[];for(;++y<h;){const S=u[y];let N="",E="";S===99?(N=":",E=":"):S===108?N=":":S===114&&(E=":");let _=r.alignDelimiters===!1?1:Math.max(1,p[y]-N.length-E.length);const H=N+"-".repeat(_)+E;r.alignDelimiters!==!1&&(_=N.length+_+E.length,_>p[y]&&(p[y]=_),v[y]=_),b[y]=H}f.splice(1,0,b),m.splice(1,0,v),g=-1;const k=[];for(;++g<f.length;){const S=f[g],N=m[g];y=-1;const E=[];for(;++y<h;){const _=S[y]||"";let H="",B="";if(r.alignDelimiters!==!1){const $=p[y]-(N[y]||0),T=u[y];T===114?H=" ".repeat($):T===99?$%2?(H=" ".repeat($/2+.5),B=" ".repeat($/2-.5)):(H=" ".repeat($/2),B=H):B=" ".repeat($)}r.delimiterStart!==!1&&!y&&E.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&_==="")&&(r.delimiterStart!==!1||y)&&E.push(" "),r.alignDelimiters!==!1&&E.push(H),E.push(_),r.alignDelimiters!==!1&&E.push(B),r.padding!==!1&&E.push(" "),(r.delimiterEnd!==!1||y!==h-1)&&E.push("|")}k.push(r.delimiterEnd===!1?E.join("").replace(/ +$/,""):E.join(""))}return k.join(`
|
|
65
|
+
`)}function wk(t){return t==null?"":String(t)}function F1(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 kk(t,l,r,i){const o=r.enter("blockquote"),u=r.createTracker(i);u.move("> "),u.shift(2);const f=r.indentLines(r.containerFlow(t,u.current()),Sk);return o(),f}function Sk(t,l,r){return">"+(r?"":" ")+t}function jk(t,l){return R1(t,l.inConstruct,!0)&&!R1(t,l.notInConstruct,!1)}function R1(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 O1(t,l,r,i){let o=-1;for(;++o<r.unsafe.length;)if(r.unsafe[o].character===`
|
|
66
|
+
`&&jk(r.stack,r.unsafe[o]))return/[ \t]/.test(i.before)?"":" ";return`\\
|
|
67
|
+
`}function Ek(t,l){const r=String(t);let i=r.indexOf(l),o=i,u=0,f=0;if(typeof l!="string")throw new TypeError("Expected substring");for(;i!==-1;)i===o?++u>f&&(f=u):u=1,o=i+l.length,i=r.indexOf(l,o);return f}function Ck(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 Nk(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 Ak(t,l,r,i){const o=Nk(r),u=t.value||"",f=o==="`"?"GraveAccent":"Tilde";if(Ck(t,r)){const y=r.enter("codeIndented"),b=r.indentLines(u,Dk);return y(),b}const m=r.createTracker(i),p=o.repeat(Math.max(Ek(u,o)+1,3)),h=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),h(),g}function Dk(t,l,r){return(r?"":" ")+t}function Qd(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 Tk(t,l,r,i){const o=Qd(r),u=o==='"'?"Quote":"Apostrophe",f=r.enter("definition");let m=r.enter("label");const p=r.createTracker(i);let h=p.move("[");return h+=p.move(r.safe(r.associationId(t),{before:h,after:"]",...p.current()})),h+=p.move("]: "),m(),!t.url||/[\0- \u007F]/.test(t.url)?(m=r.enter("destinationLiteral"),h+=p.move("<"),h+=p.move(r.safe(t.url,{before:h,after:">",...p.current()})),h+=p.move(">")):(m=r.enter("destinationRaw"),h+=p.move(r.safe(t.url,{before:h,after:t.title?" ":`
|
|
71
|
+
`,...p.current()}))),m(),t.title&&(m=r.enter(`title${u}`),h+=p.move(" "+o),h+=p.move(r.safe(t.title,{before:h,after:o,...p.current()})),h+=p.move(o),m()),f(),h}function zk(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 us(t){return"&#x"+t.toString(16).toUpperCase()+";"}function ac(t,l,r){const i=qr(t),o=qr(l);return i===void 0?o===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:i===1?o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}ry.peek=Mk;function ry(t,l,r,i){const o=zk(r),u=r.enter("emphasis"),f=r.createTracker(i),m=f.move(o);let p=f.move(r.containerPhrasing(t,{after:o,before:m,...f.current()}));const h=p.charCodeAt(0),g=ac(i.before.charCodeAt(i.before.length-1),h,o);g.inside&&(p=us(h)+p.slice(1));const y=p.charCodeAt(p.length-1),b=ac(i.after.charCodeAt(0),y,o);b.inside&&(p=p.slice(0,-1)+us(y));const v=f.move(o);return u(),r.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},m+p+v}function Mk(t,l,r){return r.options.emphasis||"*"}function _k(t,l){let r=!1;return Gd(t,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return r=!0,wd}),!!((!t.depth||t.depth<3)&&Hd(t)&&(l.options.setext||r))}function Fk(t,l,r,i){const o=Math.max(Math.min(6,t.depth||1),1),u=r.createTracker(i);if(_k(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
|
+
`+(o===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(`
|
|
75
|
+
`))+1))}const f="#".repeat(o),m=r.enter("headingAtx"),p=r.enter("phrasing");u.move(f+" ");let h=r.containerPhrasing(t,{before:"# ",after:`
|
|
76
|
+
`,...u.current()});return/^[\t ]/.test(h)&&(h=us(h.charCodeAt(0))+h.slice(1)),h=h?f+" "+h:f,r.options.closeAtx&&(h+=" "+f),p(),m(),h}iy.peek=Rk;function iy(t){return t.value||""}function Rk(){return"<"}sy.peek=Ok;function sy(t,l,r,i){const o=Qd(r),u=o==='"'?"Quote":"Apostrophe",f=r.enter("image");let m=r.enter("label");const p=r.createTracker(i);let h=p.move("![");return h+=p.move(r.safe(t.alt,{before:h,after:"]",...p.current()})),h+=p.move("]("),m(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(m=r.enter("destinationLiteral"),h+=p.move("<"),h+=p.move(r.safe(t.url,{before:h,after:">",...p.current()})),h+=p.move(">")):(m=r.enter("destinationRaw"),h+=p.move(r.safe(t.url,{before:h,after:t.title?" ":")",...p.current()}))),m(),t.title&&(m=r.enter(`title${u}`),h+=p.move(" "+o),h+=p.move(r.safe(t.title,{before:h,after:o,...p.current()})),h+=p.move(o),m()),h+=p.move(")"),f(),h}function Ok(){return"!"}oy.peek=Bk;function oy(t,l,r,i){const o=t.referenceType,u=r.enter("imageReference");let f=r.enter("label");const m=r.createTracker(i);let p=m.move("![");const h=r.safe(t.alt,{before:p,after:"]",...m.current()});p+=m.move(h+"]["),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(),o==="full"||!h||h!==y?p+=m.move(y+"]"):o==="shortcut"?p=p.slice(0,-1):p+=m.move("]"),p}function Bk(){return"!"}cy.peek=$k;function cy(t,l,r){let i=t.value||"",o="`",u=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(i);)o+="`";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 h=p.index;i.charCodeAt(h)===10&&i.charCodeAt(h-1)===13&&h--,i=i.slice(0,h)+" "+i.slice(p.index+1)}}return o+i+o}function $k(){return"`"}function uy(t,l){const r=Hd(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))}fy.peek=Lk;function fy(t,l,r,i){const o=Qd(r),u=o==='"'?"Quote":"Apostrophe",f=r.createTracker(i);let m,p;if(uy(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 h=f.move("[");return h+=f.move(r.containerPhrasing(t,{before:h,after:"](",...f.current()})),h+=f.move("]("),p(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(p=r.enter("destinationLiteral"),h+=f.move("<"),h+=f.move(r.safe(t.url,{before:h,after:">",...f.current()})),h+=f.move(">")):(p=r.enter("destinationRaw"),h+=f.move(r.safe(t.url,{before:h,after:t.title?" ":")",...f.current()}))),p(),t.title&&(p=r.enter(`title${u}`),h+=f.move(" "+o),h+=f.move(r.safe(t.title,{before:h,after:o,...f.current()})),h+=f.move(o),p()),h+=f.move(")"),m(),h}function Lk(t,l,r){return uy(t,r)?"<":"["}dy.peek=Hk;function dy(t,l,r,i){const o=t.referenceType,u=r.enter("linkReference");let f=r.enter("label");const m=r.createTracker(i);let p=m.move("[");const h=r.containerPhrasing(t,{before:p,after:"]",...m.current()});p+=m.move(h+"]["),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(),o==="full"||!h||h!==y?p+=m.move(y+"]"):o==="shortcut"?p=p.slice(0,-1):p+=m.move("]"),p}function Hk(){return"["}function Zd(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 Uk(t){const l=Zd(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 Ik(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 Yk(t,l,r,i){const o=r.enter("list"),u=r.bulletCurrent;let f=t.ordered?Ik(r):Zd(r);const m=t.ordered?f==="."?")":".":Uk(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 h=r.containerFlow(t,i);return r.bulletLastUsed=f,r.bulletCurrent=u,o(),h}function qk(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 Xk(t,l,r,i){const o=qk(r);let u=r.bulletCurrent||Zd(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;(o==="tab"||o==="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"),h=r.indentLines(r.containerFlow(t,m.current()),g);return p(),h;function g(y,b,v){return b?(v?"":" ".repeat(f))+y:(v?u:u+" ".repeat(f-u.length))+y}}function Vk(t,l,r,i){const o=r.enter("paragraph"),u=r.enter("phrasing"),f=r.containerPhrasing(t,i);return u(),o(),f}const Gk=mc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Kk(t,l,r,i){return(t.children.some(function(f){return Gk(f)})?r.containerPhrasing:r.containerFlow).call(r,t,i)}function Qk(t){const l=t.options.strong||"*";if(l!=="*"&&l!=="_")throw new Error("Cannot serialize strong with `"+l+"` for `options.strong`, expected `*`, or `_`");return l}my.peek=Zk;function my(t,l,r,i){const o=Qk(r),u=r.enter("strong"),f=r.createTracker(i),m=f.move(o+o);let p=f.move(r.containerPhrasing(t,{after:o,before:m,...f.current()}));const h=p.charCodeAt(0),g=ac(i.before.charCodeAt(i.before.length-1),h,o);g.inside&&(p=us(h)+p.slice(1));const y=p.charCodeAt(p.length-1),b=ac(i.after.charCodeAt(0),y,o);b.inside&&(p=p.slice(0,-1)+us(y));const v=f.move(o+o);return u(),r.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},m+p+v}function Zk(t,l,r){return r.options.strong||"*"}function Wk(t,l,r,i){return r.safe(t.value,i)}function Jk(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 Pk(t,l,r){const i=(hy(r)+(r.options.ruleSpaces?" ":"")).repeat(Jk(r));return r.options.ruleSpaces?i.slice(0,-1):i}const xy={blockquote:kk,break:O1,code:Ak,definition:Tk,emphasis:ry,hardBreak:O1,heading:Fk,html:iy,image:sy,imageReference:oy,inlineCode:cy,link:fy,linkReference:dy,list:Yk,listItem:Xk,paragraph:Vk,root:Kk,strong:my,text:Wk,thematicBreak:Pk};function e4(){return{enter:{table:t4,tableData:B1,tableHeader:B1,tableRow:l4},exit:{codeText:a4,table:n4,tableData:Zf,tableHeader:Zf,tableRow:Zf}}}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 n4(t){this.exit(t),this.data.inTable=void 0}function l4(t){this.enter({type:"tableRow",children:[]},t)}function Zf(t){this.exit(t)}function B1(t){this.enter({type:"tableCell",children:[]},t)}function a4(t){let l=this.resume();this.data.inTable&&(l=l.replace(/\\([\\|])/g,r4));const r=this.stack[this.stack.length-1];r.type,r.value=l,this.exit(t)}function r4(t,l){return l==="|"?l:t}function i4(t){const l=t||{},r=l.tableCellPadding,i=l.tablePipeAlign,o=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,k,S,N){return h(g(v,S,N),v.align)}function m(v,k,S,N){const E=y(v,S,N),_=h([E]);return _.slice(0,_.indexOf(`
|
|
78
|
+
`))}function p(v,k,S,N){const E=S.enter("tableCell"),_=S.enter("phrasing"),H=S.containerPhrasing(v,{...N,before:u,after:u});return _(),E(),H}function h(v,k){return vk(v,{align:k,alignDelimiters:i,padding:r,stringLength:o})}function g(v,k,S){const N=v.children;let E=-1;const _=[],H=k.enter("table");for(;++E<N.length;)_[E]=y(N[E],k,S);return H(),_}function y(v,k,S){const N=v.children;let E=-1;const _=[],H=k.enter("tableRow");for(;++E<N.length;)_[E]=p(N[E],v,k,S);return H(),_}function b(v,k,S){let N=xy.inlineCode(v,k,S);return S.stack.includes("tableCell")&&(N=N.replace(/\|/g,"\\$&")),N}}function s4(){return{exit:{taskListCheckValueChecked:$1,taskListCheckValueUnchecked:$1,paragraph:c4}}}function o4(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:u4}}}function $1(t){const l=this.stack[this.stack.length-2];l.type,l.checked=t.type==="taskListCheckValueChecked"}function c4(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 o=l.children;let u=-1,f;for(;++u<o.length;){const m=o[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 u4(t,l,r,i){const o=t.children[0],u=typeof t.checked=="boolean"&&o&&o.type==="paragraph",f="["+(t.checked?"x":" ")+"] ",m=r.createTracker(i);u&&m.move(f);let p=xy.listItem(t,l,r,{...i,...m.current()});return u&&(p=p.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),p;function h(g){return g+f}}function f4(){return[Y3(),uk(),mk(),e4(),s4()]}function d4(t){return{extensions:[q3(),fk(t),xk(),i4(t),o4()]}}const h4={tokenize:b4,partial:!0},py={tokenize:v4,partial:!0},yy={tokenize:w4,partial:!0},gy={tokenize:k4,partial:!0},m4={tokenize:S4,partial:!0},by={name:"wwwAutolink",tokenize:y4,previous:wy},vy={name:"protocolAutolink",tokenize:g4,previous:ky},Yl={name:"emailAutolink",tokenize:p4,previous:Sy},bl={};function x4(){return{text:bl}}let Xa=48;for(;Xa<123;)bl[Xa]=Yl,Xa++,Xa===58?Xa=65:Xa===91&&(Xa=97);bl[43]=Yl;bl[45]=Yl;bl[46]=Yl;bl[95]=Yl;bl[72]=[Yl,vy];bl[104]=[Yl,vy];bl[87]=[Yl,by];bl[119]=[Yl,by];function p4(t,l,r){const i=this;let o,u;return f;function f(y){return!Ed(y)||!Sy.call(i,i.previous)||Wd(i.events)?r(y):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),m(y))}function m(y){return Ed(y)?(t.consume(y),m):y===64?(t.consume(y),p):r(y)}function p(y){return y===46?t.check(m4,g,h)(y):y===45||y===95||un(y)?(u=!0,t.consume(y),p):g(y)}function h(y){return t.consume(y),o=!0,p}function g(y){return u&&o&&mn(i.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),l(y)):r(y)}}function y4(t,l,r){const i=this;return o;function o(f){return f!==87&&f!==119||!wy.call(i,i.previous)||Wd(i.events)?r(f):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(h4,t.attempt(py,t.attempt(yy,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 o="",u=!1;return f;function f(y){return(y===72||y===104)&&ky.call(i,i.previous)&&!Wd(i.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),o+=String.fromCodePoint(y),t.consume(y),m):r(y)}function m(y){if(mn(y)&&o.length<5)return o+=String.fromCodePoint(y),t.consume(y),m;if(y===58){const b=o.toLowerCase();if(b==="http"||b==="https")return t.consume(y),p}return r(y)}function p(y){return y===47?(t.consume(y),u?h:(u=!0,p)):r(y)}function h(y){return y===null||tc(y)||jt(y)||Za(y)||fc(y)?r(y):t.attempt(py,t.attempt(yy,g),r)(y)}function g(y){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),l(y)}}function b4(t,l,r){let i=0;return o;function o(f){return(f===87||f===119)&&i<3?(i++,t.consume(f),o):f===46&&i===3?(t.consume(f),u):r(f)}function u(f){return f===null?r(f):l(f)}}function v4(t,l,r){let i,o,u;return f;function f(h){return h===46||h===95?t.check(gy,p,m)(h):h===null||jt(h)||Za(h)||h!==45&&fc(h)?p(h):(u=!0,t.consume(h),f)}function m(h){return h===95?i=!0:(o=i,i=void 0),t.consume(h),f}function p(h){return o||i||!u?r(h):l(h)}}function w4(t,l){let r=0,i=0;return o;function o(f){return f===40?(r++,t.consume(f),o):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(gy,l,u)(f):f===null||jt(f)||Za(f)?l(f):(t.consume(f),o)}function u(f){return f===41&&i++,t.consume(f),o}}function k4(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),o):m===60||m===null||jt(m)||Za(m)?l(m):r(m)}function o(m){return m===null||m===40||m===91||jt(m)||Za(m)?l(m):i(m)}function u(m){return mn(m)?f(m):r(m)}function f(m){return m===59?(t.consume(m),i):mn(m)?(t.consume(m),f):r(m)}}function S4(t,l,r){return i;function i(u){return t.consume(u),o}function o(u){return un(u)?r(u):l(u)}}function wy(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||jt(t)}function ky(t){return!mn(t)}function Sy(t){return!(t===47||Ed(t))}function Ed(t){return t===43||t===45||t===46||t===95||un(t)}function Wd(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 j4={tokenize:M4,partial:!0};function E4(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:D4,continuation:{tokenize:T4},exit:z4}},text:{91:{name:"gfmFootnoteCall",tokenize:A4},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:C4,resolveTo:N4}}}}function C4(t,l,r){const i=this;let o=i.events.length;const u=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let f;for(;o--;){const p=i.events[o][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 h=il(i.sliceSerialize({start:f.end,end:i.now()}));return h.codePointAt(0)!==94||!u.includes(h.slice(1))?r(p):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(p),t.exit("gfmFootnoteCallLabelMarker"),l(p))}}function N4(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)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},t[r+3][1].end),end:Object.assign({},t[r+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const u={type:"gfmFootnoteCallString",start:Object.assign({},o.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",o,l],["exit",o,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 A4(t,l,r){const i=this,o=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",h)}function h(y){if(u>999||y===93&&!f||y===null||y===91||jt(y))return r(y);if(y===93){t.exit("chunkString");const b=t.exit("gfmFootnoteCallString");return o.includes(il(i.sliceSerialize(b)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(y),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),l):r(y)}return jt(y)||(f=!0),u++,t.consume(y),y===92?g:h}function g(y){return y===91||y===92||y===93?(t.consume(y),u++,h):h(y)}}function D4(t,l,r){const i=this,o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u,f=0,m;return p;function p(k){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(k),t.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(k){return k===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(k),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",g):r(k)}function g(k){if(f>999||k===93&&!m||k===null||k===91||jt(k))return r(k);if(k===93){t.exit("chunkString");const S=t.exit("gfmFootnoteDefinitionLabelString");return u=il(i.sliceSerialize(S)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(k),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),b}return jt(k)||(m=!0),f++,t.consume(k),k===92?y:g}function y(k){return k===91||k===92||k===93?(t.consume(k),f++,g):g(k)}function b(k){return k===58?(t.enter("definitionMarker"),t.consume(k),t.exit("definitionMarker"),o.includes(u)||o.push(u),lt(t,v,"gfmFootnoteDefinitionWhitespace")):r(k)}function v(k){return l(k)}}function T4(t,l,r){return t.check(ps,l,t.attempt(j4,l,r))}function z4(t){t.exit("gfmFootnoteDefinition")}function M4(t,l,r){const i=this;return lt(t,o,"gfmFootnoteDefinitionIndent",5);function o(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 _4(t){let r=(t||{}).singleTilde;const i={name:"strikethrough",tokenize:u,resolveAll:o};return r==null&&(r=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function o(f,m){let p=-1;for(;++p<f.length;)if(f[p][0]==="enter"&&f[p][1].type==="strikethroughSequenceTemporary"&&f[p][1]._close){let h=p;for(;h--;)if(f[h][0]==="exit"&&f[h][1].type==="strikethroughSequenceTemporary"&&f[h][1]._open&&f[p][1].end.offset-f[p][1].start.offset===f[h][1].end.offset-f[h][1].start.offset){f[p][1].type="strikethroughSequence",f[h][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},f[h][1].start),end:Object.assign({},f[p][1].end)},y={type:"strikethroughText",start:Object.assign({},f[h][1].end),end:Object.assign({},f[p][1].start)},b=[["enter",g,m],["enter",f[h][1],m],["exit",f[h][1],m],["enter",y,m]],v=m.parser.constructs.insideSpan.null;v&&Bn(b,b.length,0,dc(v,f.slice(h+1,p),m)),Bn(b,b.length,0,[["exit",y,m],["enter",f[p][1],m],["exit",f[p][1],m],["exit",g,m]]),Bn(f,h-1,p-h+3,b),p=h+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 h=this.previous,g=this.events;let y=0;return b;function b(k){return h===126&&g[g.length-1][1].type!=="characterEscape"?p(k):(f.enter("strikethroughSequenceTemporary"),v(k))}function v(k){const S=qr(h);if(k===126)return y>1?p(k):(f.consume(k),y++,v);if(y<2&&!r)return p(k);const N=f.exit("strikethroughSequenceTemporary"),E=qr(k);return N._open=!E||E===2&&!!S,N._close=!S||S===2&&!!E,m(k)}}}class F4{constructor(){this.map=[]}add(l,r,i){R4(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 o=i.pop();for(;o;){for(const u of o)l.push(u);o=i.pop()}this.map.length=0}}function R4(t,l,r,i){let o=0;if(!(r===0&&i.length===0)){for(;o<t.map.length;){if(t.map[o][0]===l){t.map[o][1]+=r,t.map[o][2].push(...i);return}o+=1}t.map.push([l,r,i])}}function O4(t,l){let r=!1;const i=[];for(;l<t.length;){const o=t[l];if(r){if(o[0]==="enter")o[1].type==="tableContent"&&i.push(t[l+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(t[l-1][1].type==="tableDelimiterMarker"){const u=i.length-1;i[u]=i[u]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(r=!0);l+=1}return i}function B4(){return{flow:{null:{name:"table",tokenize:$4,resolveAll:L4}}}}function $4(t,l,r){const i=this;let o=0,u=0,f;return m;function m(D){let Y=i.events.length-1;for(;Y>-1;){const le=i.events[Y][1].type;if(le==="lineEnding"||le==="linePrefix")Y--;else break}const I=Y>-1?i.events[Y][1].type:null,ne=I==="tableHead"||I==="tableRow"?T:p;return ne===T&&i.parser.lazy[i.now().line]?r(D):ne(D)}function p(D){return t.enter("tableHead"),t.enter("tableRow"),h(D)}function h(D){return D===124||(f=!0,u+=1),g(D)}function g(D){return D===null?r(D):Me(D)?u>1?(u=0,i.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(D),t.exit("lineEnding"),v):r(D):Ze(D)?lt(t,g,"whitespace")(D):(u+=1,f&&(f=!1,o+=1),D===124?(t.enter("tableCellDivider"),t.consume(D),t.exit("tableCellDivider"),f=!0,g):(t.enter("data"),y(D)))}function y(D){return D===null||D===124||jt(D)?(t.exit("data"),g(D)):(t.consume(D),D===92?b:y)}function b(D){return D===92||D===124?(t.consume(D),y):y(D)}function v(D){return i.interrupt=!1,i.parser.lazy[i.now().line]?r(D):(t.enter("tableDelimiterRow"),f=!1,Ze(D)?lt(t,k,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):k(D))}function k(D){return D===45||D===58?N(D):D===124?(f=!0,t.enter("tableCellDivider"),t.consume(D),t.exit("tableCellDivider"),S):$(D)}function S(D){return Ze(D)?lt(t,N,"whitespace")(D):N(D)}function N(D){return D===58?(u+=1,f=!0,t.enter("tableDelimiterMarker"),t.consume(D),t.exit("tableDelimiterMarker"),E):D===45?(u+=1,E(D)):D===null||Me(D)?B(D):$(D)}function E(D){return D===45?(t.enter("tableDelimiterFiller"),_(D)):$(D)}function _(D){return D===45?(t.consume(D),_):D===58?(f=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(D),t.exit("tableDelimiterMarker"),H):(t.exit("tableDelimiterFiller"),H(D))}function H(D){return Ze(D)?lt(t,B,"whitespace")(D):B(D)}function B(D){return D===124?k(D):D===null||Me(D)?!f||o!==u?$(D):(t.exit("tableDelimiterRow"),t.exit("tableHead"),l(D)):$(D)}function $(D){return r(D)}function T(D){return t.enter("tableRow"),X(D)}function X(D){return D===124?(t.enter("tableCellDivider"),t.consume(D),t.exit("tableCellDivider"),X):D===null||Me(D)?(t.exit("tableRow"),l(D)):Ze(D)?lt(t,X,"whitespace")(D):(t.enter("data"),G(D))}function G(D){return D===null||D===124||jt(D)?(t.exit("data"),X(D)):(t.consume(D),D===92?ee:G)}function ee(D){return D===92||D===124?(t.consume(D),G):G(D)}}function L4(t,l){let r=-1,i=!0,o=0,u=[0,0,0,0],f=[0,0,0,0],m=!1,p=0,h,g,y;const b=new F4;for(;++r<t.length;){const v=t[r],k=v[1];v[0]==="enter"?k.type==="tableHead"?(m=!1,p!==0&&(L1(b,l,p,h,g),g=void 0,p=0),h={type:"table",start:Object.assign({},k.start),end:Object.assign({},k.end)},b.add(r,0,[["enter",h,l]])):k.type==="tableRow"||k.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({},k.start),end:Object.assign({},k.end)},b.add(r,0,[["enter",g,l]])),o=k.type==="tableDelimiterRow"?2:g?3:1):o&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")?(i=!1,f[2]===0&&(u[1]!==0&&(f[0]=f[1],y=Ho(b,l,u,o,void 0,y),u=[0,0,0,0]),f[2]=r)):k.type==="tableCellDivider"&&(i?i=!1:(u[1]!==0&&(f[0]=f[1],y=Ho(b,l,u,o,void 0,y)),u=f,f=[u[1],r,0,0])):k.type==="tableHead"?(m=!0,p=r):k.type==="tableRow"||k.type==="tableDelimiterRow"?(p=r,u[1]!==0?(f[0]=f[1],y=Ho(b,l,u,o,r,y)):f[1]!==0&&(y=Ho(b,l,f,o,r,y)),o=0):o&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")&&(f[3]=r)}for(p!==0&&L1(b,l,p,h,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=O4(l.events,r))}return t}function Ho(t,l,r,i,o,u){const f=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",m="tableContent";r[0]!==0&&(u.end=Object.assign({},Lr(l.events,r[0])),t.add(r[0],0,[["exit",u,l]]));const p=Lr(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 h=Lr(l.events,r[2]),g=Lr(l.events,r[3]),y={type:m,start:Object.assign({},h),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 k=r[2]+1,S=r[3]-r[2]-1;t.add(k,S,[])}}t.add(r[3]+1,0,[["exit",y,l]])}return o!==void 0&&(u.end=Object.assign({},Lr(l.events,o)),t.add(o,0,[["exit",u,l]]),u=void 0),u}function L1(t,l,r,i,o){const u=[],f=Lr(l.events,r);o&&(o.end=Object.assign({},f),u.push(["exit",o,l])),i.end=Object.assign({},f),u.push(["exit",i,l]),t.add(r+1,0,u)}function Lr(t,l){const r=t[l],i=r[0]==="enter"?"start":"end";return r[1][i]}const H4={name:"tasklistCheck",tokenize:I4};function U4(){return{text:{91:H4}}}function I4(t,l,r){const i=this;return o;function o(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 jt(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 Me(p)?l(p):Ze(p)?t.check({tokenize:Y4},l,r)(p):r(p)}}function Y4(t,l,r){return lt(t,i,"whitespace");function i(o){return o===null?r(o):l(o)}}function q4(t){return _0([x4(),E4(),_4(t),B4(),U4()])}const X4={};function jy(t){const l=this,r=t||X4,i=l.data(),o=i.micromarkExtensions||(i.micromarkExtensions=[]),u=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),f=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);o.push(q4(r)),u.push(f4()),f.push(d4(r))}function gs({content:t,className:l=""}){return c.jsx("div",{className:`office-markdown ${l}`,children:c.jsx(ey,{remarkPlugins:[jy],components:{code:V4,table:({children:r})=>c.jsx("div",{className:"overflow-x-auto my-2",children:c.jsx("table",{className:"office-table",children:r})})},children:t})})}function V4({className:t,children:l,...r}){const i=/language-(\w+)/.exec(t??"");return i||typeof l=="string"&&l.includes(`
|
|
79
|
+
`)?c.jsx(G4,{language:i==null?void 0:i[1],children:l}):c.jsx("code",{className:"bg-gray-100 text-gray-700 px-1 py-0.5 rounded text-[0.9em] font-mono",...r,children:l})}function G4({children:t,language:l}){const[r,i]=j.useState(!1),o=String(t).replace(/\n$/,""),u=()=>{navigator.clipboard.writeText(o),i(!0),setTimeout(()=>i(!1),1500)};return c.jsxs("div",{className:"office-code-block group relative my-2",children:[l&&c.jsx("div",{className:"text-[10px] text-gray-400 px-3 pt-1.5",children:l}),c.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"}),c.jsx("pre",{className:"overflow-x-auto p-3 text-xs leading-relaxed",children:c.jsx("code",{children:o})})]})}const H1={$skin:"skinColor",$hair:"hairColor",$shirt:"shirtColor",$pants:"pantsColor",$shoes:"shoeColor"},K4=/^(darken|lighten)\((\$\w+),\s*(\d+)\)$/;function Q4(t,l){const r=parseInt(t.replace("#",""),16),i=Math.max(0,(r>>16&255)-l),o=Math.max(0,(r>>8&255)-l),u=Math.max(0,(r&255)-l);return`#${(i<<16|o<<8|u).toString(16).padStart(6,"0")}`}function Z4(t,l){const r=parseInt(t.replace("#",""),16),i=Math.min(255,(r>>16&255)+l),o=Math.min(255,(r>>8&255)+l),u=Math.min(255,(r&255)+l);return`#${(i<<16|o<<8|u).toString(16).padStart(6,"0")}`}function Ey(t,l){const r=H1[t];if(r&&l)return l[r];const i=K4.exec(t);if(i){const[,o,u,f]=i,m=H1[u],p=m&&l?l[m]:u,h=parseInt(f,10);return o==="darken"?Q4(p,h):Z4(p,h)}return t}function U1(t,l=12){return t.map(r=>({...r,x:l-r.x-r.w}))}function W4(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:U1(t.left.pixels)}:l==="left"&&t.right?{name:t.right.name,pixels:U1(t.right.pixels)}:t.down}function J4(t,l){return Cd(t,"hair",l,1)}function Cd(t,l,r,i){const o=t.layers.findIndex(f=>f.name===l),u=[...t.layers];if(o>=0)u[o]={...r,name:l};else{const f=i??u.length;u.splice(f,0,{...r,name:l})}return{...t,layers:u}}const Jd=new Map,Pd=new Map;function Cy(t,l){Jd.set(t,l)}function pc(t,l){Pd.set(t,l)}function Nd(t){return Jd.get(t)}function P4(t){return Pd.get(t)}function _C(){return Array.from(Jd.keys())}function FC(){return Array.from(Pd.keys())}function eS(t,l,r,i,o=2){t.clearRect(0,0,l.width*o,l.height*o);for(const u of l.layers)Ny(t,u.pixels,o,r,i)}function Ad(t,l,r,i,o){for(const u of l){const f=Ey(u.c,o);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),Ny(t,l.pixels,r,0)}function Ny(t,l,r,i,o){for(const u of l){const f=Ey(u.c,o);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 rc=new Map;function Ea(t,l,r){if("down"in r&&!("pixels"in r)){const o=r;rc.set(t,{id:t,name:l,layer:{...o.down,name:"hair"},directions:{down:{...o.down,name:"hair"},up:o.up?{...o.up,name:"hair"}:void 0,left:o.left?{...o.left,name:"hair"}:void 0,right:o.right?{...o.right,name:"hair"}:void 0}})}else{const o=r;rc.set(t,{id:t,name:l,layer:{...o,name:"hair"}})}}function nS(t){return rc.get(t)}function Ay(){return Array.from(rc.values())}Ea("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}]}});Ea("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}]}});Ea("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}]}});Ea("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}]}});Ea("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"}]}});Ea("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}]}});Ea("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}]}});Ea("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 ic=new Map;function vl(t,l,r){if("down"in r&&!("pixels"in r)){const o=r;ic.set(t,{id:t,name:l,layer:{...o.down,name:"torso"},directions:{down:{...o.down,name:"torso"},up:o.up?{...o.up,name:"torso"}:void 0,left:o.left?{...o.left,name:"torso"}:void 0,right:o.right?{...o.right,name:"torso"}:void 0}})}else{const o=r;ic.set(t,{id:t,name:l,layer:{...o,name:"torso"}})}}function lS(t){return ic.get(t)}function Dy(){return Array.from(ic.values())}vl("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"}]}});vl("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"}]}});vl("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"}]}});vl("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)"}]}});vl("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)"}]}});vl("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"}]}});vl("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"}]}});vl("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"}]}});vl("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"}]}});vl("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 fs=new Map;function dt(t,l,r){if("down"in r&&!("pixels"in r)){const o=r;fs.set(t,{id:t,name:l,layer:{...o.down,name:"accessory"},directions:{down:{...o.down,name:"accessory"},up:o.up?{...o.up,name:"accessory"}:void 0,left:o.left?{...o.left,name:"accessory"}:void 0,right:o.right?{...o.right,name:"accessory"}:void 0}})}else{const o=r;fs.set(t,{id:t,name:l,layer:{...o,name:"accessory"}})}}function aS(t){return fs.get(t)}function rS(t,l){const r=fs.get(t);if(!r)return;if(r.directions)return W4(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 o=l==="right"?1:l==="left"?-1:0;return{name:r.layer.name,pixels:o?i.map(u=>({...u,x:u.x+o})):i}}function Ty(){return Array.from(fs.values())}dt("none","None",{name:"accessory",pixels:[]});dt("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}]}});dt("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}]}});dt("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}]}});dt("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}]}});dt("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}]}});dt("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}]}});dt("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}]}});dt("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}]}});dt("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}]}});dt("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}]}});dt("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}]}});dt("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"}]}});dt("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}]}});dt("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}]}});dt("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"}]}});dt("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}]}});dt("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}]}});dt("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}]}});dt("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}]}});dt("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"}]}});dt("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}]}});dt("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}]}});dt("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}]}});dt("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}]}});dt("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"}]}});dt("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"}]}});dt("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}]}});dt("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}]}});dt("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}]}});dt("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 Zi({r:t,g:l,b:r}){return`#${(t<<16|l<<8|r).toString(16).padStart(6,"0")}`}function Zo(t,l){const r=t.r-l.r,i=t.g-l.g,o=t.b-l.b;return r*r+i*i+o*o}function iS(t,l){const r=[];r.push(t[Math.floor(Math.random()*t.length)]);for(let i=1;i<l;i++){const o=t.map(m=>{let p=1/0;for(const h of r)p=Math.min(p,Zo(m,h));return p}),u=o.reduce((m,p)=>m+p,0);let f=Math.random()*u;for(let m=0;m<t.length;m++)if(f-=o[m],f<=0){r.push(t[m]);break}r.length<=i&&r.push(t[Math.floor(Math.random()*t.length)])}return r}function sS(t,l,r=20){if(t.length===0)return[];const i=iS(t,l);for(let u=0;u<r;u++){const f=Array.from({length:l},()=>[]);for(const p of t){let h=1/0,g=0;for(let y=0;y<l;y++){const b=Zo(p,i[y]);b<h&&(h=b,g=y)}f[g].push(p)}let m=!0;for(let p=0;p<l;p++){if(f[p].length===0)continue;const h={r:0,g:0,b:0};for(const b of f[p])h.r+=b.r,h.g+=b.g,h.b+=b.b;const g=f[p].length,y={r:Math.round(h.r/g),g:Math.round(h.g/g),b:Math.round(h.b/g)};Zo(y,i[p])>1&&(m=!1),i[p]=y}if(m)break}const o=new Array(l).fill(0);for(const u of t){let f=1/0,m=0;for(let p=0;p<l;p++){const h=Zo(u,i[p]);h<f&&(f=h,m=p)}o[m]++}return i.map((u,f)=>({c:u,count:o[f]})).sort((u,f)=>f.count-u.count).map(u=>u.c)}function oS(t,l=1e4){const r=document.createElement("canvas"),i=t instanceof HTMLImageElement?t.naturalWidth:t.width,o=t instanceof HTMLImageElement?t.naturalHeight:t.height;r.width=i,r.height=o;const u=r.getContext("2d");u.drawImage(t,0,0);const f=u.getImageData(0,0,i,o).data,m=i*o,p=Math.max(1,Math.floor(m/l)),h=[];for(let g=0;g<m;g+=p){const y=g*4;f[y+3]<128||h.push({r:f[y],g:f[y+1],b:f[y+2]})}return h}function I1(t){return .299*t.r+.587*t.g+.114*t.b}function Y1(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 cS(t,l=8){const r=oS(t),i=sS(r,l);if(i.length<5)return{skinColor:"#F5CBA7",hairColor:"#2C1810",shirtColor:"#1565C0",pantsColor:"#37474F",shoeColor:"#212121"};const o=[...i].sort((y,b)=>I1(b)-I1(y)),u=[...i].sort((y,b)=>Y1(b)-Y1(y)),f=o[0],m=o[o.length-1],p=u[0],h=o[o.length-2],g=o[o.length-1];return{skinColor:Zi(f),hairColor:Zi(m),shirtColor:Zi(p),pantsColor:Zi(h),shoeColor:Zi(g)}}const uS=[{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}],fS=[{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"}],dS=[{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"}],hS=[{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 mS(){return{width:12,height:22,layers:[{name:"lower",pixels:uS},{name:"torso",pixels:fS},{name:"head",pixels:dS},{name:"hair",pixels:hS},{name:"accessory",pixels:[]}]}}const xS=["cto","cbo","pm","engineer","designer","qa","data-analyst","default"];for(const t of xS)Cy(`mini:${t}`,mS());const pS=[{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"}],yS=[{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"}],gS=[{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 bS(){return{width:12,height:22,layers:[{name:"torso",pixels:pS},{name:"head",pixels:yS},{name:"hair",pixels:gS},{name:"accessory",pixels:[]}]}}Cy("mini-seated:default",bS());const vS={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"}]},wS={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"}]},kS={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"}]},SS={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"}]};pc("meeting",vS);pc("bulletin",wS);pc("decision",SS);pc("knowledge",kS);const Wf=16,Jf=24,jS=60,ES={cbo:0,cto:8,pm:15,engineer:22,designer:5,qa:12};function zy(t,l){if(!t)return t;let r=t;if(l!=null&&l.hairStyle){const i=nS(l.hairStyle);i&&(r=J4(r,i.layer))}if(l!=null&&l.outfitStyle){const i=lS(l.outfitStyle);i&&(r=Cd(r,"torso",i.layer,1))}if(l!=null&&l.accessory&&l.accessory!=="none"){const i=aS(l.accessory);i&&(r=Cd(r,"accessory",i.layer))}return r}function yc({roleId:t,className:l,appearance:r,scale:i}){const o=j.useRef(null),u=j.useRef(0),f=j.useRef(0),m=j.useRef(r);m.current=r;const p=i??4,h=Wf*p,g=Jf*p,y=j.useMemo(()=>{const b=Nd(`mini:${t}`)??Nd("mini:default");return zy(b,r)},[t,r==null?void 0:r.hairStyle,r==null?void 0:r.outfitStyle,r==null?void 0:r.accessory]);return j.useEffect(()=>{const b=o.current;if(!b)return;const v=b.getContext("2d");if(!v)return;const k=ES[t]??0,S=()=>{f.current++;const N=m.current;if(!N||!y){u.current=requestAnimationFrame(S);return}const _=(f.current+k)%jS<30?1:0;v.clearRect(0,0,Wf,Jf),v.save(),v.translate(2,1),eS(v,y,_,N,1),v.restore(),u.current=requestAnimationFrame(S)};return u.current=requestAnimationFrame(S),()=>cancelAnimationFrame(u.current)},[t,y]),c.jsx("canvas",{ref:o,width:Wf,height:Jf,className:l,style:{imageRendering:"pixelated",display:"block",width:h,height:g}})}const CS={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"},Pf={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"},NS={cto:8,cbo:7,pm:6,engineer:5,designer:5,qa:4,"data-analyst":4},AS={cto:"Chief Technology Officer",cbo:"Chief Business Officer",pm:"Product Manager",engineer:"Software Engineer",designer:"UI/UX Designer",qa:"QA Engineer"},DS=500,q1=360,X1=700,TS=t=>`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`;function zS({role:t,allRoles:l,recentActivity:r,onClose:i,onFireRole:o,terminalWidth:u=0,activeJobId:f,activeTask:m,isWorking:p,jobStartedAt:h,onStopJob:g,sessions:y,streamingSessionId:b,onCreateSessionSilent:v,onSendMessage:k,onFocusTerminal:S,onCustomize:N,onUpdateRole:E,appearance:_,relationships:H}){var xe,De;const[B,$]=j.useState(DS),[T,X]=j.useState(!1),G=j.useRef(0),ee=j.useRef(0),[D,Y]=j.useState(!1),[I,ne]=j.useState(!1),[le,L]=j.useState(!1),[F,V]=j.useState(!1),[P,fe]=j.useState("talk"),[z,M]=j.useState(!1),[K,A]=j.useState(""),[oe,be]=j.useState(!1),ve=j.useRef(null),{events:Ne,status:Oe}=g0(f??null),[Be,me]=j.useState(0);j.useEffect(()=>{if(!p||!h){me(0);return}const he=new Date(h).getTime(),ye=()=>me(Math.floor((Date.now()-he)/1e3));ye();const at=setInterval(ye,1e3);return()=>clearInterval(at)},[p,h]);const Ve=u>0,Ge=Ve?u:0,de=Ve?Math.max(q1,window.innerWidth-u-100):X1,Ee=Math.min(B,de),nt=j.useCallback(he=>{he.preventDefault(),G.current=he.clientX,ee.current=Ee,X(!0);const ye=mt=>{const Ye=G.current-mt.clientX,ce=Math.min(X1,Math.max(q1,ee.current+Ye));$(ce)},at=()=>{X(!1),document.removeEventListener("mousemove",ye),document.removeEventListener("mouseup",at)};document.addEventListener("mousemove",ye),document.addEventListener("mouseup",at)},[Ee]),nn=j.useRef(null),Et=t?y.find(he=>he.roleId===t.id):null,Jt=he=>{if(!t)return;const ye=p?"talk":P;Et?(k(Et.id,he,ye),S(t.id)):(nn.current={content:he,mode:ye},v(t.id))};j.useEffect(()=>{if(Et&&nn.current){const{content:he,mode:ye}=nn.current;nn.current=null,k(Et.id,he,ye),t&&S(t.id)}},[Et==null?void 0:Et.id]);const Lt=(()=>{if(!Ne.length)return null;const he=[];let ye=0,at=0,mt=0;for(const Ye of Ne)if(Ye.type==="thinking")ye++;else if(Ye.type==="text")at++;else if(Ye.type==="tool:start"){const ce=String(Ye.data.name??"");he.includes(ce)||he.push(ce)}else Ye.type==="dispatch:start"&&mt++;return{tools:he,thinkCount:ye,textCount:at,dispatchCount:mt,total:Ne.length}})(),on=m||(()=>{if(!Et)return null;const he=Et.messages;for(let ye=he.length-1;ye>=0;ye--)if(he[ye].from==="ceo")return he[ye].content;return null})(),Ct=(()=>{if(!Et)return null;const he=Et.messages;for(let ye=he.length-1;ye>=0;ye--)if(he[ye].from==="role"&&he[ye].content)return he[ye].content;return null})();if(!t)return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:Ge},onClick:i}),c.jsx("div",{className:"side-panel open fixed top-0 h-full z-50 flex items-center justify-center border-l-[3px]",style:{right:Ge,width:Ee,background:"var(--terminal-bg)",borderLeftColor:"var(--pixel-border)"},children:c.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-muted)"},children:"Loading role..."})})]});const _t=Pf[t.id]??"#666",$n=CS[t.id]??"👤",Ft=l.filter(he=>he.reportsTo===t.id),Ln=Et&&b===Et.id,ae=t.name||AS[t.id]||t.id;return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:Ge},onClick:i}),c.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)] ${T?"resizing":""}`,style:{borderLeftColor:_t,right:Ge,width:Ee,background:"var(--terminal-bg)"},children:[c.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${T?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:nt}),c.jsxs("div",{className:"relative shrink-0 overflow-hidden",style:{background:`linear-gradient(135deg, ${_t}ee, ${_t}99)`},children:[c.jsx("div",{className:"absolute inset-0 opacity-[0.06]",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 8px, white 8px, white 9px)"}}),c.jsxs("div",{className:"absolute top-3 right-3 flex items-center gap-1.5 z-10",children:[N&&c.jsx("button",{onClick:()=>N(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:"🎨"}),c.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:"×"})]}),c.jsxs("div",{className:"relative flex items-end gap-4 px-4 pt-4 pb-3",children:[c.jsx("div",{className:"shrink-0 relative",style:{marginBottom:-2},children:c.jsx("div",{className:"rounded-lg p-1",style:{background:"rgba(0,0,0,0.2)"},children:c.jsx(yc,{roleId:t.id,appearance:_,scale:8})})}),c.jsxs("div",{className:"flex-1 min-w-0 text-white pb-1",children:[c.jsxs("div",{className:"text-lg font-bold flex items-center gap-2",style:{fontFamily:"var(--pixel-font)"},children:[$n," ",t.id.toUpperCase(),p&&c.jsx("span",{className:"text-[9px] font-semibold px-2 py-0.5 rounded-full animate-pulse",style:{background:"rgba(251,191,36,0.25)",color:"#fde68a"},children:"WORKING"})]}),z?c.jsxs("form",{className:"flex items-center gap-1.5 mt-0.5",onSubmit:async he=>{he.preventDefault();const ye=K.trim();if(!ye||ye===ae||!E){M(!1);return}be(!0);try{await E(t.id,{name:ye})}catch{}be(!1),M(!1)},children:[c.jsx("input",{ref:ve,value:K,onChange:he=>A(he.target.value),onKeyDown:he=>{he.key==="Escape"&&M(!1)},disabled:oe,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"}}),c.jsx("button",{type:"submit",disabled:oe,className:"text-white/80 hover:text-white text-[10px] cursor-pointer shrink-0",children:"✓"}),c.jsx("button",{type:"button",onClick:()=>M(!1),className:"text-white/60 hover:text-white text-[10px] cursor-pointer shrink-0",children:"✕"})]}):c.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&&(A(ae),M(!0))},title:E?"Click to edit name":void 0,children:[ae,E&&c.jsx("span",{className:"opacity-0 group-hover/name:opacity-60 text-[10px]",children:"✎"})]})]})]}),c.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:[c.jsxs("span",{children:["Lv.",NS[t.id]??1]}),c.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),c.jsxs("span",{className:"flex items-center gap-1.5",children:[c.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:p?"var(--idle-amber)":"var(--active-green)"}}),p?"Working":"Idle"]}),c.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),c.jsx("span",{children:t.level}),t.reportsTo&&c.jsxs(c.Fragment,{children:[c.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),c.jsxs("span",{className:"opacity-60",children:["→"," ",t.reportsTo]})]})]})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto flex flex-col min-h-0",children:[p&&c.jsxs("div",{className:"px-4 py-3 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)",background:"var(--hud-bg-alt)"},children:[c.jsxs("div",{className:"flex items-center justify-between mb-1",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("div",{className:"w-2 h-2 rounded-full animate-pulse",style:{background:"var(--idle-amber)"}}),c.jsxs("span",{className:"text-xs font-semibold",style:{color:"var(--idle-amber)"},children:["Working",Be>0?` · ${TS(Be)}`:""]})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("button",{onClick:()=>S(t.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"Open chat ↗"}),f&&g&&c.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"})]})]}),on&&c.jsx("div",{className:"text-xs truncate",style:{color:"var(--terminal-text-secondary)"},children:on})]}),p&&f&&Lt&&c.jsxs("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[c.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[c.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)"},children:"Activity"}),c.jsx("button",{onClick:()=>S(t.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"View details ↗"})]}),c.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[Lt.thinkCount>0&&c.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:[c.jsx("span",{className:"w-1.5 h-1.5 rounded-full",style:{background:"#a855f7"}}),"thinking ×",Lt.thinkCount]}),Lt.tools.map(he=>c.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(59,130,246,0.15)",color:"#60a5fa"},children:he},he)),Lt.dispatchCount>0&&c.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(249,115,22,0.15)",color:"#fb923c"},children:["dispatch ×",Lt.dispatchCount]}),Lt.textCount>0&&c.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(34,197,94,0.15)",color:"#4ade80"},children:["output ×",Lt.textCount]}),(Oe==="streaming"||Oe==="connecting")&&c.jsx("span",{className:"inline-block w-1.5 h-3 animate-pulse rounded-sm",style:{background:"var(--active-green)"}})]}),c.jsxs("div",{className:"text-[10px] mt-1",style:{color:"var(--terminal-text-muted)"},children:[Lt.total," events"]})]}),p&&Ct&&c.jsxs("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[c.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[c.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)"},children:"Last Message"}),c.jsx("button",{onClick:()=>S(t.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"Open chat ↗"})]}),c.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:[Ct.slice(0,200),Ct.length>200&&"..."]})]}),p&&c.jsx("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:c.jsx(V1,{onSend:Jt,disabled:!!Ln,placeholder:"Ask something...",color:_t})}),!p&&c.jsxs("div",{className:"px-4 pt-4 pb-2",children:[c.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-secondary)"},children:"Latest"}),c.jsx(MS,{icon:$n,roleId:t.id,roleName:ae,color:_t,text:r})]}),!p&&c.jsx("div",{className:"px-4 py-3",style:{borderBottom:"1px solid var(--terminal-border)"},children:c.jsxs("div",{className:"rounded-xl overflow-hidden",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[Ct&&c.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:[c.jsxs("div",{className:"flex items-center justify-between mb-1",children:[c.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--terminal-text-muted)"},children:"Last response"}),c.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:"View ↗"})]}),c.jsxs("div",{className:"text-xs leading-relaxed line-clamp-2 overflow-hidden",style:{color:"var(--terminal-text-secondary)"},children:[Ct.slice(0,150),Ct.length>150&&"..."]})]}),c.jsx("div",{className:"p-2",children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs("div",{className:"flex rounded-lg overflow-hidden shrink-0",style:{border:"1px solid var(--pixel-border)"},children:[c.jsx("button",{onClick:()=>fe("talk"),className:"px-2 py-1 text-[10px] font-semibold cursor-pointer transition-colors",style:{background:P==="talk"?"var(--accent)":"transparent",color:P==="talk"?"#fff":"var(--terminal-text-secondary)"},children:"Talk"}),c.jsx("button",{onClick:()=>fe("do"),className:"px-2 py-1 text-[10px] font-semibold cursor-pointer transition-colors",style:{background:P==="do"?"var(--idle-amber)":"transparent",color:P==="do"?"#fff":"var(--terminal-text-secondary)"},children:"Do"})]}),c.jsx(V1,{onSend:Jt,disabled:!!Ln,placeholder:P==="talk"?"Ask something...":"Give a directive...",color:_t})]})})]})}),c.jsxs("div",{className:"px-4 py-2 space-y-1",children:[c.jsxs(Uo,{title:`Profile${t.persona?"":" (empty)"}`,open:D,onToggle:()=>Y(he=>!he),children:[t.persona&&c.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}),c.jsxs("div",{className:"space-y-0 mt-2",children:[c.jsx(ed,{label:"Level",value:t.level}),c.jsx(ed,{label:"Reports to",value:t.reportsTo}),c.jsx(ed,{label:"Status",value:t.status})]}),Ft.length>0&&c.jsxs("div",{className:"mt-3",children:[c.jsx("div",{className:"text-[11px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"Direct Reports"}),c.jsx("div",{className:"space-y-1",children:Ft.map(he=>c.jsxs("div",{className:"flex items-center gap-2 p-1.5 rounded-lg",style:{background:"var(--hud-bg-alt)"},children:[c.jsx("div",{className:"w-6 h-6 rounded flex items-center justify-center text-white text-[10px] font-bold",style:{background:Pf[he.id]??"#666"},children:he.id.slice(0,2).toUpperCase()}),c.jsx("div",{className:"text-xs",style:{color:"var(--terminal-text)"},children:he.name})]},he.id))})]})]}),t.authority&&c.jsxs(Uo,{title:"Authority",open:I,onToggle:()=>ne(he=>!he),children:[((xe=t.authority.autonomous)==null?void 0:xe.length)>0&&c.jsxs("div",{className:"mb-2",children:[c.jsx("div",{className:"text-xs font-semibold mb-1",style:{color:"var(--active-green)"},children:"Autonomous"}),t.authority.autonomous.map((he,ye)=>c.jsxs("div",{className:"text-xs pl-3 py-0.5",style:{color:"var(--terminal-text-secondary)"},children:["- ",he]},ye))]}),((De=t.authority.needsApproval)==null?void 0:De.length)>0&&c.jsxs("div",{children:[c.jsx("div",{className:"text-xs font-semibold mb-1",style:{color:"var(--idle-amber)"},children:"Needs Approval"}),t.authority.needsApproval.map((he,ye)=>c.jsxs("div",{className:"text-xs pl-3 py-0.5",style:{color:"var(--terminal-text-secondary)"},children:["- ",he]},ye))]})]}),t&&H&&(()=>{const he=H.filter(ye=>ye.roleA===t.id||ye.roleB===t.id).filter(ye=>ye.familiarity>0).sort((ye,at)=>at.familiarity-ye.familiarity);return he.length===0?null:c.jsx(Uo,{title:`Relationships (${he.length})`,open:le,onToggle:()=>L(ye=>!ye),children:c.jsx("div",{className:"space-y-1.5",children:he.map((ye,at)=>{const mt=ye.roleA===t.id?ye.roleB:ye.roleA,Ye=l.find(rt=>rt.id===mt),ce=ye.familiarity>=80?"Best Partner":ye.familiarity>=50?"Friend":ye.familiarity>=20?"Colleague":"Acquaintance",Ae=ye.familiarity>=80?"#4CAF50":ye.familiarity>=50?"#2196F3":ye.familiarity>=20?"#FF9800":"#9E9E9E";return c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-xs w-20 truncate",style:{color:Pf[mt]??"var(--terminal-text-secondary)"},children:(Ye==null?void 0:Ye.name)??mt}),c.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-white/10",children:c.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${ye.familiarity}%`,background:Ae}})}),c.jsx("span",{className:"text-[10px] w-16 text-right",style:{color:"var(--terminal-text-muted)"},children:ce})]},at)})})})})(),t.journal&&c.jsx(Uo,{title:`Journal (${(t.journal.match(/### /g)??[]).length})`,open:F,onToggle:()=>V(he=>!he),children:c.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:[c.jsx(gs,{content:t.journal.slice(0,3e3)}),t.journal.length>3e3&&c.jsx("div",{className:"italic mt-2",style:{color:"var(--terminal-text-muted)"},children:"... (truncated)"})]})})]}),o&&c.jsx("div",{className:"px-4 pb-4 mt-auto shrink-0",children:c.jsx("button",{onClick:()=>{o(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 MS({icon:t,roleId:l,roleName:r,color:i,text:o}){const u=!!o;return c.jsx("div",{className:"relative",children:c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsxs("div",{className:"shrink-0",children:[c.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}),c.jsx("div",{className:"text-[9px] font-bold text-center mt-0.5 uppercase tracking-wide",style:{color:i},children:l})]}),c.jsx("div",{className:"flex-1 min-w-0",children:c.jsxs("div",{className:"relative",children:[c.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`}}),c.jsxs("div",{className:"rounded-xl rounded-tl-sm p-4 border",style:{background:`${i}08`,borderColor:`${i}22`},children:[c.jsx("div",{className:"text-[10px] font-semibold mb-1.5 uppercase tracking-wider",style:{color:i},children:r}),u?c.jsx("div",{className:"text-sm leading-relaxed",style:{color:"var(--terminal-text)"},children:c.jsx(gs,{content:o})}):c.jsx("div",{className:"text-sm italic",style:{color:"var(--terminal-text-muted)"},children:"No recent activity."})]})]})})]})})}function Uo({title:t,open:l,onToggle:r,children:i}){return c.jsxs("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--terminal-border)"},children:[c.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:[c.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},children:t}),c.jsx("span",{className:"text-[10px] transition-transform",style:{color:"var(--terminal-text-muted)",transform:l?"rotate(0deg)":"rotate(-90deg)"},children:"▼"})]}),l&&c.jsx("div",{className:"px-3 pb-3 pt-2",style:{borderTop:"1px solid var(--terminal-border)"},children:i})]})}function V1({onSend:t,disabled:l,placeholder:r,color:i}){const[o,u]=j.useState(""),f=()=>{const m=o.trim();!m||l||(t(m),u(""))};return c.jsxs("div",{className:"flex items-center gap-1.5 flex-1",children:[c.jsx("input",{type:"text",value:o,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)"}}),c.jsx("button",{onClick:f,disabled:l||!o.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||!o.trim()?"#666":i},children:c.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[c.jsx("path",{d:"M22 2L11 13"}),c.jsx("path",{d:"M22 2L15 22L11 13L2 9L22 2Z"})]})})]})}function ed({label:t,value:l}){return c.jsxs("div",{className:"flex justify-between py-1.5 text-xs",style:{borderBottom:"1px solid var(--terminal-border)"},children:[c.jsx("span",{style:{color:"var(--terminal-text-muted)"},children:t}),c.jsx("span",{className:"font-semibold",style:{color:"var(--terminal-text)"},children:l})]})}function _S(t,l){var r,i=1;t==null&&(t=0),l==null&&(l=0);function o(){var u,f=r.length,m,p=0,h=0;for(u=0;u<f;++u)m=r[u],p+=m.x,h+=m.y;for(p=(p/f-t)*i,h=(h/f-l)*i,u=0;u<f;++u)m=r[u],m.x-=p,m.y-=h}return o.initialize=function(u){r=u},o.x=function(u){return arguments.length?(t=+u,o):t},o.y=function(u){return arguments.length?(l=+u,o):l},o.strength=function(u){return arguments.length?(i=+u,o):i},o}function FS(t){const l=+this._x.call(null,t),r=+this._y.call(null,t);return My(this.cover(l,r),l,r,t)}function My(t,l,r,i){if(isNaN(l)||isNaN(r))return t;var o,u=t._root,f={data:i},m=t._x0,p=t._y0,h=t._x1,g=t._y1,y,b,v,k,S,N,E,_;if(!u)return t._root=f,t;for(;u.length;)if((S=l>=(y=(m+h)/2))?m=y:h=y,(N=r>=(b=(p+g)/2))?p=b:g=b,o=u,!(u=u[E=N<<1|S]))return o[E]=f,t;if(v=+t._x.call(null,u.data),k=+t._y.call(null,u.data),l===v&&r===k)return f.next=u,o?o[E]=f:t._root=f,t;do o=o?o[E]=new Array(4):t._root=new Array(4),(S=l>=(y=(m+h)/2))?m=y:h=y,(N=r>=(b=(p+g)/2))?p=b:g=b;while((E=N<<1|S)===(_=(k>=b)<<1|v>=y));return o[_]=u,o[E]=f,t}function RS(t){var l,r,i=t.length,o,u,f=new Array(i),m=new Array(i),p=1/0,h=1/0,g=-1/0,y=-1/0;for(r=0;r<i;++r)isNaN(o=+this._x.call(null,l=t[r]))||isNaN(u=+this._y.call(null,l))||(f[r]=o,m[r]=u,o<p&&(p=o),o>g&&(g=o),u<h&&(h=u),u>y&&(y=u));if(p>g||h>y)return this;for(this.cover(p,h).cover(g,y),r=0;r<i;++r)My(this,f[r],m[r],t[r]);return this}function OS(t,l){if(isNaN(t=+t)||isNaN(l=+l))return this;var r=this._x0,i=this._y0,o=this._x1,u=this._y1;if(isNaN(r))o=(r=Math.floor(t))+1,u=(i=Math.floor(l))+1;else{for(var f=o-r||1,m=this._root,p,h;r>t||t>=o||i>l||l>=u;)switch(h=(l<i)<<1|t<r,p=new Array(4),p[h]=m,m=p,f*=2,h){case 0:o=r+f,u=i+f;break;case 1:r=o-f,u=i+f;break;case 2:o=r+f,i=u-f;break;case 3:r=o-f,i=u-f;break}this._root&&this._root.length&&(this._root=m)}return this._x0=r,this._y0=i,this._x1=o,this._y1=u,this}function BS(){var t=[];return this.visit(function(l){if(!l.length)do t.push(l.data);while(l=l.next)}),t}function $S(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 xn(t,l,r,i,o){this.node=t,this.x0=l,this.y0=r,this.x1=i,this.y1=o}function LS(t,l,r){var i,o=this._x0,u=this._y0,f,m,p,h,g=this._x1,y=this._y1,b=[],v=this._root,k,S;for(v&&b.push(new xn(v,o,u,g,y)),r==null?r=1/0:(o=t-r,u=l-r,g=t+r,y=l+r,r*=r);k=b.pop();)if(!(!(v=k.node)||(f=k.x0)>g||(m=k.y0)>y||(p=k.x1)<o||(h=k.y1)<u))if(v.length){var N=(f+p)/2,E=(m+h)/2;b.push(new xn(v[3],N,E,p,h),new xn(v[2],f,E,N,h),new xn(v[1],N,m,p,E),new xn(v[0],f,m,N,E)),(S=(l>=E)<<1|t>=N)&&(k=b[b.length-1],b[b.length-1]=b[b.length-1-S],b[b.length-1-S]=k)}else{var _=t-+this._x.call(null,v.data),H=l-+this._y.call(null,v.data),B=_*_+H*H;if(B<r){var $=Math.sqrt(r=B);o=t-$,u=l-$,g=t+$,y=l+$,i=v.data}}return i}function HS(t){if(isNaN(g=+this._x.call(null,t))||isNaN(y=+this._y.call(null,t)))return this;var l,r=this._root,i,o,u,f=this._x0,m=this._y0,p=this._x1,h=this._y1,g,y,b,v,k,S,N,E;if(!r)return this;if(r.length)for(;;){if((k=g>=(b=(f+p)/2))?f=b:p=b,(S=y>=(v=(m+h)/2))?m=v:h=v,l=r,!(r=r[N=S<<1|k]))return this;if(!r.length)break;(l[N+1&3]||l[N+2&3]||l[N+3&3])&&(i=l,E=N)}for(;r.data!==t;)if(o=r,!(r=r.next))return this;return(u=r.next)&&delete r.next,o?(u?o.next=u:delete o.next,this):l?(u?l[N]=u:delete l[N],(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 US(t){for(var l=0,r=t.length;l<r;++l)this.remove(t[l]);return this}function IS(){return this._root}function YS(){var t=0;return this.visit(function(l){if(!l.length)do++t;while(l=l.next)}),t}function qS(t){var l=[],r,i=this._root,o,u,f,m,p;for(i&&l.push(new xn(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 h=(u+m)/2,g=(f+p)/2;(o=i[3])&&l.push(new xn(o,h,g,m,p)),(o=i[2])&&l.push(new xn(o,u,g,h,p)),(o=i[1])&&l.push(new xn(o,h,f,m,g)),(o=i[0])&&l.push(new xn(o,u,f,h,g))}return this}function XS(t){var l=[],r=[],i;for(this._root&&l.push(new xn(this._root,this._x0,this._y0,this._x1,this._y1));i=l.pop();){var o=i.node;if(o.length){var u,f=i.x0,m=i.y0,p=i.x1,h=i.y1,g=(f+p)/2,y=(m+h)/2;(u=o[0])&&l.push(new xn(u,f,m,g,y)),(u=o[1])&&l.push(new xn(u,g,m,p,y)),(u=o[2])&&l.push(new xn(u,f,y,g,h)),(u=o[3])&&l.push(new xn(u,g,y,p,h))}r.push(i)}for(;i=r.pop();)t(i.node,i.x0,i.y0,i.x1,i.y1);return this}function VS(t){return t[0]}function GS(t){return arguments.length?(this._x=t,this):this._x}function KS(t){return t[1]}function QS(t){return arguments.length?(this._y=t,this):this._y}function eh(t,l,r){var i=new th(l??VS,r??KS,NaN,NaN,NaN,NaN);return t==null?i:i.addAll(t)}function th(t,l,r,i,o,u){this._x=t,this._y=l,this._x0=r,this._y0=i,this._x1=o,this._y1=u,this._root=void 0}function G1(t){for(var l={data:t.data},r=l;t=t.next;)r=r.next={data:t.data};return l}var pn=eh.prototype=th.prototype;pn.copy=function(){var t=new th(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=G1(l),t;for(r=[{source:l,target:t._root=new Array(4)}];l=r.pop();)for(var o=0;o<4;++o)(i=l.source[o])&&(i.length?r.push({source:i,target:l.target[o]=new Array(4)}):l.target[o]=G1(i));return t};pn.add=FS;pn.addAll=RS;pn.cover=OS;pn.data=BS;pn.extent=$S;pn.find=LS;pn.remove=HS;pn.removeAll=US;pn.root=IS;pn.size=YS;pn.visit=qS;pn.visitAfter=XS;pn.x=GS;pn.y=QS;function Qa(t){return function(){return t}}function wa(t){return(t()-.5)*1e-6}function ZS(t){return t.x+t.vx}function WS(t){return t.y+t.vy}function JS(t){var l,r,i,o=1,u=1;typeof t!="function"&&(t=Qa(t==null?1:+t));function f(){for(var h,g=l.length,y,b,v,k,S,N,E=0;E<u;++E)for(y=eh(l,ZS,WS).visitAfter(m),h=0;h<g;++h)b=l[h],S=r[b.index],N=S*S,v=b.x+b.vx,k=b.y+b.vy,y.visit(_);function _(H,B,$,T,X){var G=H.data,ee=H.r,D=S+ee;if(G){if(G.index>b.index){var Y=v-G.x-G.vx,I=k-G.y-G.vy,ne=Y*Y+I*I;ne<D*D&&(Y===0&&(Y=wa(i),ne+=Y*Y),I===0&&(I=wa(i),ne+=I*I),ne=(D-(ne=Math.sqrt(ne)))/ne*o,b.vx+=(Y*=ne)*(D=(ee*=ee)/(N+ee)),b.vy+=(I*=ne)*D,G.vx-=Y*(D=1-D),G.vy-=I*D)}return}return B>v+D||T<v-D||$>k+D||X<k-D}}function m(h){if(h.data)return h.r=r[h.data.index];for(var g=h.r=0;g<4;++g)h[g]&&h[g].r>h.r&&(h.r=h[g].r)}function p(){if(l){var h,g=l.length,y;for(r=new Array(g),h=0;h<g;++h)y=l[h],r[y.index]=+t(y,h,l)}}return f.initialize=function(h,g){l=h,i=g,p()},f.iterations=function(h){return arguments.length?(u=+h,f):u},f.strength=function(h){return arguments.length?(o=+h,f):o},f.radius=function(h){return arguments.length?(t=typeof h=="function"?h:Qa(+h),p(),f):t},f}function PS(t){return t.index}function K1(t,l){var r=t.get(l);if(!r)throw new Error("node not found: "+l);return r}function ej(t){var l=PS,r=y,i,o=Qa(30),u,f,m,p,h,g=1;t==null&&(t=[]);function y(N){return 1/Math.min(m[N.source.index],m[N.target.index])}function b(N){for(var E=0,_=t.length;E<g;++E)for(var H=0,B,$,T,X,G,ee,D;H<_;++H)B=t[H],$=B.source,T=B.target,X=T.x+T.vx-$.x-$.vx||wa(h),G=T.y+T.vy-$.y-$.vy||wa(h),ee=Math.sqrt(X*X+G*G),ee=(ee-u[H])/ee*N*i[H],X*=ee,G*=ee,T.vx-=X*(D=p[H]),T.vy-=G*D,$.vx+=X*(D=1-D),$.vy+=G*D}function v(){if(f){var N,E=f.length,_=t.length,H=new Map(f.map(($,T)=>[l($,T,f),$])),B;for(N=0,m=new Array(E);N<_;++N)B=t[N],B.index=N,typeof B.source!="object"&&(B.source=K1(H,B.source)),typeof B.target!="object"&&(B.target=K1(H,B.target)),m[B.source.index]=(m[B.source.index]||0)+1,m[B.target.index]=(m[B.target.index]||0)+1;for(N=0,p=new Array(_);N<_;++N)B=t[N],p[N]=m[B.source.index]/(m[B.source.index]+m[B.target.index]);i=new Array(_),k(),u=new Array(_),S()}}function k(){if(f)for(var N=0,E=t.length;N<E;++N)i[N]=+r(t[N],N,t)}function S(){if(f)for(var N=0,E=t.length;N<E;++N)u[N]=+o(t[N],N,t)}return b.initialize=function(N,E){f=N,h=E,v()},b.links=function(N){return arguments.length?(t=N,v(),b):t},b.id=function(N){return arguments.length?(l=N,b):l},b.iterations=function(N){return arguments.length?(g=+N,b):g},b.strength=function(N){return arguments.length?(r=typeof N=="function"?N:Qa(+N),k(),b):r},b.distance=function(N){return arguments.length?(o=typeof N=="function"?N:Qa(+N),S(),b):o},b}var tj={value:()=>{}};function _y(){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 Wo(r)}function Wo(t){this._=t}function nj(t,l){return t.trim().split(/^|\s+/).map(function(r){var i="",o=r.indexOf(".");if(o>=0&&(i=r.slice(o+1),r=r.slice(0,o)),r&&!l.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:i}})}Wo.prototype=_y.prototype={constructor:Wo,on:function(t,l){var r=this._,i=nj(t+"",r),o,u=-1,f=i.length;if(arguments.length<2){for(;++u<f;)if((o=(t=i[u]).type)&&(o=lj(r[o],t.name)))return o;return}if(l!=null&&typeof l!="function")throw new Error("invalid callback: "+l);for(;++u<f;)if(o=(t=i[u]).type)r[o]=Q1(r[o],t.name,l);else if(l==null)for(o in r)r[o]=Q1(r[o],t.name,null);return this},copy:function(){var t={},l=this._;for(var r in l)t[r]=l[r].slice();return new Wo(t)},call:function(t,l){if((o=arguments.length-2)>0)for(var r=new Array(o),i=0,o,u;i<o;++i)r[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(u=this._[t],i=0,o=u.length;i<o;++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],o=0,u=i.length;o<u;++o)i[o].value.apply(l,r)}};function lj(t,l){for(var r=0,i=t.length,o;r<i;++r)if((o=t[r]).name===l)return o.value}function Q1(t,l,r){for(var i=0,o=t.length;i<o;++i)if(t[i].name===l){t[i]=tj,t=t.slice(0,i).concat(t.slice(i+1));break}return r!=null&&t.push({name:l,value:r}),t}var Xr=0,ts=0,Wi=0,Fy=1e3,sc,ns,oc=0,Wa=0,gc=0,ds=typeof performance=="object"&&performance.now?performance:Date,Ry=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Oy(){return Wa||(Ry(aj),Wa=ds.now()+gc)}function aj(){Wa=0}function Dd(){this._call=this._time=this._next=null}Dd.prototype=By.prototype={constructor:Dd,restart:function(t,l,r){if(typeof t!="function")throw new TypeError("callback is not a function");r=(r==null?Oy():+r)+(l==null?0:+l),!this._next&&ns!==this&&(ns?ns._next=this:sc=this,ns=this),this._call=t,this._time=r,Td()},stop:function(){this._call&&(this._call=null,this._time=1/0,Td())}};function By(t,l,r){var i=new Dd;return i.restart(t,l,r),i}function rj(){Oy(),++Xr;for(var t=sc,l;t;)(l=Wa-t._time)>=0&&t._call.call(void 0,l),t=t._next;--Xr}function Z1(){Wa=(oc=ds.now())+gc,Xr=ts=0;try{rj()}finally{Xr=0,sj(),Wa=0}}function ij(){var t=ds.now(),l=t-oc;l>Fy&&(gc-=l,oc=t)}function sj(){for(var t,l=sc,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:sc=r);ns=t,Td(i)}function Td(t){if(!Xr){ts&&(ts=clearTimeout(ts));var l=t-Wa;l>24?(t<1/0&&(ts=setTimeout(Z1,t-ds.now()-gc)),Wi&&(Wi=clearInterval(Wi))):(Wi||(oc=ds.now(),Wi=setInterval(ij,Fy)),Xr=1,Ry(Z1))}}const oj=1664525,cj=1013904223,W1=4294967296;function uj(){let t=1;return()=>(t=(oj*t+cj)%W1)/W1}function fj(t){return t.x}function dj(t){return t.y}var hj=10,mj=Math.PI*(3-Math.sqrt(5));function xj(t){var l,r=1,i=.001,o=1-Math.pow(i,1/300),u=0,f=.6,m=new Map,p=By(y),h=_y("tick","end"),g=uj();t==null&&(t=[]);function y(){b(),h.call("tick",l),r<i&&(p.stop(),h.call("end",l))}function b(S){var N,E=t.length,_;S===void 0&&(S=1);for(var H=0;H<S;++H)for(r+=(u-r)*o,m.forEach(function(B){B(r)}),N=0;N<E;++N)_=t[N],_.fx==null?_.x+=_.vx*=f:(_.x=_.fx,_.vx=0),_.fy==null?_.y+=_.vy*=f:(_.y=_.fy,_.vy=0);return l}function v(){for(var S=0,N=t.length,E;S<N;++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 _=hj*Math.sqrt(.5+S),H=S*mj;E.x=_*Math.cos(H),E.y=_*Math.sin(H)}(isNaN(E.vx)||isNaN(E.vy))&&(E.vx=E.vy=0)}}function k(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(k),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?(o=+S,l):+o},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(k),l):g},force:function(S,N){return arguments.length>1?(N==null?m.delete(S):m.set(S,k(N)),l):m.get(S)},find:function(S,N,E){var _=0,H=t.length,B,$,T,X,G;for(E==null?E=1/0:E*=E,_=0;_<H;++_)X=t[_],B=S-X.x,$=N-X.y,T=B*B+$*$,T<E&&(G=X,E=T);return G},on:function(S,N){return arguments.length>1?(h.on(S,N),l):h.on(S)}}}function pj(){var t,l,r,i,o=Qa(-30),u,f=1,m=1/0,p=.81;function h(v){var k,S=t.length,N=eh(t,fj,dj).visitAfter(y);for(i=v,k=0;k<S;++k)l=t[k],N.visit(b)}function g(){if(t){var v,k=t.length,S;for(u=new Array(k),v=0;v<k;++v)S=t[v],u[S.index]=+o(S,v,t)}}function y(v){var k=0,S,N,E=0,_,H,B;if(v.length){for(_=H=B=0;B<4;++B)(S=v[B])&&(N=Math.abs(S.value))&&(k+=S.value,E+=N,_+=N*S.x,H+=N*S.y);v.x=_/E,v.y=H/E}else{S=v,S.x=S.data.x,S.y=S.data.y;do k+=u[S.data.index];while(S=S.next)}v.value=k}function b(v,k,S,N){if(!v.value)return!0;var E=v.x-l.x,_=v.y-l.y,H=N-k,B=E*E+_*_;if(H*H/p<B)return B<m&&(E===0&&(E=wa(r),B+=E*E),_===0&&(_=wa(r),B+=_*_),B<f&&(B=Math.sqrt(f*B)),l.vx+=E*v.value*i/B,l.vy+=_*v.value*i/B),!0;if(v.length||B>=m)return;(v.data!==l||v.next)&&(E===0&&(E=wa(r),B+=E*E),_===0&&(_=wa(r),B+=_*_),B<f&&(B=Math.sqrt(f*B)));do v.data!==l&&(H=u[v.data.index]*i/B,l.vx+=E*H,l.vy+=_*H);while(v=v.next)}return h.initialize=function(v,k){t=v,r=k,g()},h.strength=function(v){return arguments.length?(o=typeof v=="function"?v:Qa(+v),g(),h):o},h.distanceMin=function(v){return arguments.length?(f=v*v,h):Math.sqrt(f)},h.distanceMax=function(v){return arguments.length?(m=v*v,h):Math.sqrt(m)},h.theta=function(v){return arguments.length?(p=v*v,h):Math.sqrt(p)},h}const hs={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 yj(t){return hs[t]??hs.general}function gj({docs:t,onNodeClick:l,selectedDocId:r}){var Y;const i=j.useRef(null),o=j.useRef(null),[u,f]=j.useState({width:600,height:400}),[m,p]=j.useState({nodes:[],links:[]}),[h,g]=j.useState(null),[y,b]=j.useState(null),[v,k]=j.useState({x:0,y:0}),[S,N]=j.useState({x:0,y:0,w:600,h:400}),E=j.useRef(!1),_=j.useRef({x:0,y:0,vx:0,vy:0}),H=j.useRef(null),B=j.useRef(null);j.useEffect(()=>{const I=i.current;if(!I)return;const ne=new ResizeObserver(le=>{const{width:L,height:F}=le[0].contentRect;L>0&&F>0&&(f({width:L,height:F}),N(V=>({...V,w:L,h:F})))});return ne.observe(I),()=>ne.disconnect()},[]),j.useEffect(()=>{if(t.length===0)return;const I=new Set(t.map(P=>P.id)),ne=t.map(P=>({id:P.id,title:P.title,category:P.category,akb_type:P.akb_type})),le=[];for(const P of t)for(const fe of P.links){const z=fe.href.replace(/^.*knowledge\//,"").replace(/^\.\.\/.*$/,"").replace(/^\.\//,"");I.has(z)&&z!==P.id&&(le.some(M=>M.source===P.id&&M.target===z||M.source===z&&M.target===P.id)||le.push({source:P.id,target:z,label:fe.text}))}const{width:L,height:F}=u,V=xj(ne).force("link",ej(le).id(P=>P.id).distance(140)).force("charge",pj().strength(-400)).force("center",_S(L/2,F/2)).force("collide",JS(50));B.current=V,V.on("tick",()=>{for(const P of ne)P.x=Math.max(60,Math.min(L-60,P.x??L/2)),P.y=Math.max(60,Math.min(F-60,P.y??F/2));p({nodes:[...ne],links:[...le]})}),V.alpha(1).restart();for(let P=0;P<150;P++)V.tick();return V.stop(),p({nodes:[...ne],links:[...le]}),()=>{V.stop()}},[t,u]);const $=I=>{if(typeof I=="string"){const ne=m.nodes.find(le=>le.id===I);return{x:(ne==null?void 0:ne.x)??0,y:(ne==null?void 0:ne.y)??0}}return{x:I.x??0,y:I.y??0}},T=j.useCallback(I=>{I.preventDefault();const ne=I.deltaY>0?1.1:.9;N(le=>{const L=Math.max(200,Math.min(u.width*3,le.w*ne)),F=Math.max(150,Math.min(u.height*3,le.h*ne)),V=(L-le.w)/2,P=(F-le.h)/2;return{x:le.x-V,y:le.y-P,w:L,h:F}})},[u]),X=j.useCallback(I=>{I.button===0&&(E.current=!0,_.current={x:I.clientX,y:I.clientY,vx:S.x,vy:S.y})},[S]),G=j.useCallback(I=>{var ne;if(H.current){const le=o.current;if(!le)return;const L=le.getBoundingClientRect(),F=S.w/L.width,V=S.h/L.height,P=S.x+(I.clientX-L.left)*F,fe=S.y+(I.clientY-L.top)*V;H.current.fx=P,H.current.fy=fe,(ne=B.current)==null||ne.alpha(.3).restart();return}if(E.current){const le=(I.clientX-_.current.x)*(S.w/u.width),L=(I.clientY-_.current.y)*(S.h/u.height);N(F=>({...F,x:_.current.vx-le,y:_.current.vy-L}))}},[S,u]),ee=j.useCallback(()=>{E.current=!1,H.current&&(H.current.fx=null,H.current.fy=null,H.current=null)},[]),D=j.useCallback((I,ne)=>{var le;I.stopPropagation(),H.current=ne,(le=B.current)==null||le.alpha(.3).restart()},[]);return c.jsxs("div",{ref:i,className:"relative flex-1 overflow-hidden",style:{background:"#1e1e2e"},children:[c.jsxs("svg",{ref:o,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:X,onMouseMove:G,onMouseUp:ee,onMouseLeave:ee,children:[c.jsx("defs",{children:c.jsx("pattern",{id:"grid",width:"20",height:"20",patternUnits:"userSpaceOnUse",children:c.jsx("circle",{cx:"0",cy:"0",r:"0.5",fill:"rgba(255,255,255,0.06)"})})}),c.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((I,ne)=>{const le=$(I.source),L=$(I.target),F=y===ne,V=(le.x+L.x)/2,P=(le.y+L.y)/2;return c.jsxs("g",{children:[c.jsx("line",{x1:le.x,y1:le.y,x2:L.x,y2:L.y,stroke:"transparent",strokeWidth:12,style:{cursor:"default"},onMouseEnter:()=>b(ne),onMouseLeave:()=>b(null)}),c.jsx("line",{x1:le.x,y1:le.y,x2:L.x,y2:L.y,stroke:F?"rgba(148,163,184,0.7)":"rgba(148,163,184,0.3)",strokeWidth:F?2:1.5,strokeDasharray:"4 3",pointerEvents:"none"}),F&&I.label&&c.jsx("text",{x:V,y:P-6,textAnchor:"middle",fill:"#e2e8f0",fontSize:9,fontFamily:"monospace",style:{pointerEvents:"none"},children:c.jsx("tspan",{style:{filter:"drop-shadow(0 0 2px rgba(0,0,0,0.8))"},children:I.label.length>30?I.label.slice(0,28)+"..":I.label})})]},ne)}),m.nodes.map(I=>{const ne=hs[I.category]??hs.general,le=I.akb_type==="hub",L=le?24:16,F=(h==null?void 0:h.id)===I.id,V=r===I.id,P=F?1.2:V?1.15:1;return c.jsxs("g",{transform:`translate(${I.x??0}, ${I.y??0}) scale(${P})`,style:{cursor:"pointer",transition:"transform 0.15s ease"},onClick:fe=>{fe.stopPropagation();const z=t.find(M=>M.id===I.id);z&&l(z)},onMouseDown:fe=>D(fe,I),onMouseEnter:fe=>{var M;g(I);const z=(M=i.current)==null?void 0:M.getBoundingClientRect();z&&k({x:fe.clientX-z.left,y:fe.clientY-z.top})},onMouseLeave:()=>g(null),children:[V&&c.jsx("rect",{x:-L/2-4,y:-L/2-4,width:L+8,height:L+8,fill:"none",stroke:"#22c55e",strokeWidth:2,rx:le?5:2,opacity:.6}),c.jsx("rect",{x:-L/2,y:-L/2,width:L,height:L,fill:ne.border,rx:le?4:2,opacity:F?1:.9}),c.jsx("rect",{x:-L/2+3,y:-L/2+3,width:Math.max(0,L-6),height:Math.max(0,L-6),fill:ne.bg,rx:le?3:1}),c.jsx("text",{y:L/2+14,textAnchor:"middle",fill:V?"#e2e8f0":"#94a3b8",fontSize:11,fontFamily:"monospace",fontWeight:V?"bold":"normal",style:{pointerEvents:"none"},children:I.title.length>24?I.title.slice(0,22)+"..":I.title})]},I.id)})]}),h&&!H.current&&c.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:[c.jsx("div",{className:"font-bold mb-1",children:h.title}),c.jsxs("div",{className:"text-[10px] opacity-60 mb-1",children:[h.akb_type.toUpperCase()," / ",h.category]}),((Y=t.find(I=>I.id===h.id))==null?void 0:Y.tldr)&&c.jsx("div",{className:"text-[10px] opacity-80 mb-1",children:t.find(I=>I.id===h.id).tldr}),c.jsx("div",{className:"text-[10px] text-green-400",children:"Click to open | Drag to move"})]}),t.length===0&&c.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 bj({doc:t,allDocs:l,onOpen:r,onNavigateDoc:i}){const[o,u]=j.useState(!1),f=yj(t.category),m=t.akb_type==="hub",p=new Set(l.map(h=>h.id));return c.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:[c.jsxs("div",{className:"p-3 cursor-pointer hover:bg-white/5",onClick:()=>u(!o),children:[c.jsxs("div",{className:"flex items-start gap-2",children:[c.jsx("span",{className:"shrink-0 text-sm",children:m?"🗂":t.format==="html"?"🌐":"📄"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[c.jsx("span",{className:"font-semibold text-xs truncate",style:{color:"var(--terminal-text)"},children:t.title}),c.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})]}),c.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:t.tags.slice(0,4).map(h=>c.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:h},h))})]}),c.jsx("span",{className:"text-xs shrink-0",style:{color:"var(--terminal-text-muted)"},children:o?"▲":"▼"})]}),!o&&t.tldr&&c.jsx("div",{className:"mt-1.5 text-[10px] line-clamp-2 ml-6",style:{color:"var(--terminal-text-secondary)"},children:t.tldr})]}),o&&c.jsxs("div",{className:"px-3 pb-3",style:{borderTop:"1px solid var(--terminal-border)"},children:[t.tldr&&c.jsx("div",{className:"mt-2 text-[11px] leading-relaxed italic",style:{color:"var(--terminal-text-secondary)"},children:t.tldr}),t.links.length>0&&c.jsxs("div",{className:"mt-2",children:[c.jsx("div",{className:"text-[9px] font-bold uppercase mb-1",style:{color:"var(--terminal-text-muted)"},children:"Cross-links"}),c.jsx("div",{className:"flex flex-wrap gap-1",children:t.links.slice(0,5).map((h,g)=>{const y=h.href.replace(/^.*knowledge\//,"").replace(/^\.\.\/.*$/,"").replace(/^\.\//,""),b=p.has(y);return c.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:["🔗"," ",h.text]},g)})})]}),c.jsxs("button",{className:"mt-2 text-[10px] font-semibold cursor-pointer hover:opacity-70",style:{color:"var(--active-green)"},onClick:h=>{h.stopPropagation(),r(t)},children:["Open full ","→"]})]})]})}function vj({docId:t,onBack:l,onDocUpdated:r,onDelete:i,onNavigateDoc:o,allDocs:u}){const[f,m]=j.useState(null),[p,h]=j.useState(!0),[g,y]=j.useState(!1),[b,v]=j.useState(""),[k,S]=j.useState(!1),N=new Set(u.map($=>$.id)),E=j.useCallback($=>{const T=$.split("#")[0];if(!T.match(/\.(md|html)$/))return null;const X=t.includes("/")?t.replace(/\/[^/]+$/,""):"";let G;if(T.startsWith("./"))G=X?`${X}/${T.slice(2)}`:T.slice(2);else if(T.startsWith("../")){const Y=X.split("/").filter(Boolean);let I=T;for(;I.startsWith("../");)Y.length>0&&Y.pop(),I=I.slice(3);G=Y.length>0?`${Y.join("/")}/${I}`:I}else G=T;if(N.has(G))return G;const ee=G.split("/").pop()??"",D=u.find(Y=>Y.id===ee||Y.id.endsWith("/"+ee));return D?D.id:null},[t,N,u]),_=j.useCallback($=>{const X=$.target.closest("a");if(!X)return;const G=X.getAttribute("href");if(!G||G.startsWith("http://")||G.startsWith("https://")||!G.match(/\.(md|html)(#.*)?$/))return;$.preventDefault(),$.stopPropagation();const ee=E(G);ee&&o(ee)},[E,o]);j.useEffect(()=>{h(!0),Ce.getKnowledgeDoc(t).then($=>{m($),v($.content)}).catch(console.error).finally(()=>h(!1))},[t]);const H=async()=>{if(f){S(!0);try{await Ce.updateKnowledgeDoc(t,b),m({...f,content:b}),y(!1),r()}catch($){console.error("Save failed:",$)}finally{S(!1)}}},B=async()=>{if(confirm(`Delete "${f==null?void 0:f.title}"?`))try{await Ce.deleteKnowledgeDoc(t),i(t)}catch($){console.error("Delete failed:",$)}};return p?c.jsx("div",{className:"flex-1 flex items-center justify-center text-xs",style:{color:"var(--terminal-text-muted)"},children:"Loading..."}):f?c.jsxs("div",{className:"flex-1 overflow-y-auto flex flex-col",children:[c.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[c.jsxs("button",{onClick:l,className:"text-xs font-semibold cursor-pointer hover:opacity-70",style:{color:"var(--active-green)"},children:["←"," Back"]}),c.jsx("div",{className:"flex-1"}),g?c.jsxs(c.Fragment,{children:[c.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"}),c.jsx("button",{onClick:H,disabled:k,className:"px-2.5 py-1 text-[10px] rounded cursor-pointer font-semibold text-white",style:{background:k?"#86efac":"#16a34a"},children:k?"Saving...":"Save"})]}):c.jsxs(c.Fragment,{children:[c.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"}),c.jsx("button",{onClick:B,className:"px-2.5 py-1 text-[10px] rounded cursor-pointer font-semibold",style:{background:"rgba(239,68,68,0.15)",color:"#f87171",border:"1px solid rgba(239,68,68,0.3)"},children:"Delete"})]})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[c.jsx("h2",{className:"text-sm font-bold mb-1",style:{color:"var(--terminal-text)"},children:f.title}),f.tldr&&!g&&c.jsx("div",{className:"mb-3 text-xs italic",style:{color:"var(--terminal-text-secondary)"},children:f.tldr}),f.format==="html"?g?c.jsx("textarea",{className:"w-full h-full min-h-[400px] p-3 text-xs leading-relaxed rounded border resize-y",style:{fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace',background:"var(--hud-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},value:b,onChange:$=>v($.target.value),spellCheck:!1}):c.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?c.jsx("textarea",{className:"w-full h-full min-h-[400px] p-3 text-xs leading-relaxed rounded border resize-y",style:{fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace',background:"#1e1e2e",color:"#e2e8f0",border:"1px solid #334155"},value:b,onChange:$=>v($.target.value),spellCheck:!1}):c.jsx("div",{className:"text-xs leading-relaxed",style:{color:"var(--terminal-text-secondary)"},onClick:_,children:c.jsx(gs,{content:f.content})})]})]}):c.jsx("div",{className:"flex-1 flex items-center justify-center text-xs",style:{color:"var(--terminal-text-muted)"},children:"Failed to load document"})}function wj({onCreated:t,onCancel:l}){const[r,i]=j.useState(""),[o,u]=j.useState(""),[f,m]=j.useState(""),[p,h]=j.useState(!1),[g,y]=j.useState("");j.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()||!o.trim()){y("Title and filename are required");return}h(!0),y("");try{const v=await Ce.createKnowledgeDoc({filename:o,title:r,category:f||void 0});t(v.id)}catch(v){y(v instanceof Error?v.message:"Failed to create")}finally{h(!1)}};return c.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[c.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[c.jsxs("button",{onClick:l,className:"text-xs font-semibold cursor-pointer hover:opacity-70",style:{color:"var(--active-green)"},children:["←"," Cancel"]}),c.jsx("h2",{className:"text-sm font-bold",style:{color:"var(--terminal-text)"},children:"New Document"})]}),c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-[10px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"TITLE"}),c.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)"}})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-[10px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"FILENAME"}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("input",{type:"text",value:o,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)"}}),c.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:".md"})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-[10px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"CATEGORY (optional)"}),c.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&&c.jsx("div",{className:"text-[10px] px-3 py-1.5 rounded",style:{background:"rgba(239,68,68,0.15)",color:"#f87171"},children:g}),c.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 kj=500,J1=360,P1=700;function nh(t){const[l,r]=j.useState(kj),[i,o]=j.useState(!1),u=j.useRef(0),f=j.useRef(0),m=t>0,p=m?t:0,h=m?Math.max(J1,window.innerWidth-t-100):P1,g=Math.min(l,h),y=j.useCallback(b=>{b.preventDefault(),u.current=b.clientX,f.current=g,o(!0);const v=S=>{const N=u.current-S.clientX,E=Math.min(P1,Math.max(J1,f.current+N));r(E)},k=()=>{o(!1),document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",k)};document.addEventListener("mousemove",v),document.addEventListener("mouseup",k)},[g]);return{panelRight:p,panelWidth:g,isResizing:i,handleResizeStart:y}}function Sj({docs:t,onClose:l,onRefresh:r,terminalWidth:i=0,initialDocId:o}){const[u,f]=j.useState("list"),[m,p]=j.useState("all"),[h,g]=j.useState(o??null),[y,b]=j.useState(""),[v,k]=j.useState(!1),[S,N]=j.useState(null),{panelRight:E,panelWidth:_,isResizing:H,handleResizeStart:B}=nh(i),$=["all",...Array.from(new Set(t.map(Y=>Y.category))).sort()],T=t.filter(Y=>{if(m!=="all"&&Y.category!==m)return!1;if(y){const I=y.toLowerCase();return Y.title.toLowerCase().includes(I)||(Y.tldr??"").toLowerCase().includes(I)||Y.tags.some(ne=>ne.toLowerCase().includes(I))}return!0}),X=Y=>{k(!1),r(),g(Y)},G=Y=>{g(null),r()},ee=Y=>{N(Y.id)},D=S?t.find(Y=>Y.id===S):null;return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:E},onClick:l}),c.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)] ${H?"resizing":""}`,style:{right:E,width:_,background:"var(--terminal-bg)",borderLeftColor:"#16a34a"},children:[c.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${H?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:B}),c.jsxs("div",{className:"p-5 text-white relative",style:{background:"#16a34a"},children:[c.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:"×"}),c.jsxs("div",{className:"text-lg font-bold",children:["📚"," Knowledge Base"]}),c.jsxs("div",{className:"text-xs opacity-80 mt-0.5",children:[t.length," documents"]})]}),c.jsxs("div",{className:"flex",style:{borderBottom:"1px solid var(--terminal-border)"},children:[c.jsx(e0,{label:"List",active:u==="list",onClick:()=>{f("list"),N(null)}}),c.jsx(e0,{label:"Graph",active:u==="graph",onClick:()=>f("graph")})]}),u==="list"&&!h&&!v&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[c.jsx("input",{type:"text",value:y,onChange:Y=>b(Y.target.value),placeholder:"Search docs...",className:"flex-1 px-2.5 py-1.5 text-[11px] rounded focus:outline-none",style:{background:"var(--hud-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)"}}),c.jsx("button",{onClick:()=>k(!0),className:"px-2.5 py-1.5 text-[10px] font-semibold rounded cursor-pointer text-white shrink-0",style:{background:"#16a34a"},children:"+ New"})]}),c.jsx("div",{className:"flex overflow-x-auto shrink-0",style:{borderBottom:"1px solid var(--terminal-border)",scrollbarWidth:"none"},children:$.map(Y=>c.jsx("button",{onClick:()=>p(Y),className:"px-3 py-1.5 text-[10px] font-medium cursor-pointer whitespace-nowrap",style:{color:m===Y?"#4ade80":"var(--terminal-text-muted)",borderBottom:m===Y?"2px solid #4ade80":"2px solid transparent"},children:Y==="all"?`All (${t.length})`:`${Y} (${t.filter(I=>I.category===Y).length})`},Y))}),c.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:T.length===0?c.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(Y=>c.jsx(bj,{doc:Y,allDocs:t,onOpen:I=>g(I.id),onNavigateDoc:I=>g(I)},Y.id))})]}),u==="list"&&h&&!v&&c.jsx(vj,{docId:h,onBack:()=>g(null),onDocUpdated:r,onDelete:G,onNavigateDoc:Y=>g(Y),allDocs:t}),u==="list"&&v&&c.jsx(wj,{onCreated:X,onCancel:()=>k(!1)}),u==="graph"&&c.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[c.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[c.jsx(gj,{docs:t,onNodeClick:ee,selectedDocId:S}),D&&c.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:[c.jsx("div",{className:"text-[10px] font-bold uppercase mb-1",style:{color:"var(--terminal-text-muted)"},children:"Selected"}),c.jsx("div",{className:"text-xs font-bold mb-1",style:{color:"var(--terminal-text)"},children:D.title}),c.jsx("div",{className:"w-2 h-2 rounded-full mb-2",style:{background:D.status==="active"?"#16a34a":D.status==="draft"?"#f59e0b":"#94a3b8"}}),D.tldr&&c.jsx("div",{className:"text-[10px] mb-2 leading-relaxed",style:{color:"var(--terminal-text-secondary)"},children:D.tldr}),D.links.length>0&&c.jsxs("div",{className:"mb-2",children:[c.jsx("div",{className:"text-[9px] font-bold mb-1",style:{color:"var(--terminal-text-muted)"},children:"Links"}),D.links.slice(0,5).map((Y,I)=>c.jsxs("div",{className:"text-[9px] mb-0.5 truncate",style:{color:"var(--terminal-text-secondary)"},children:["🔗"," ",Y.text]},I))]}),c.jsx("button",{className:"w-full py-1.5 text-[10px] font-semibold rounded cursor-pointer text-white",style:{background:"#16a34a"},onClick:()=>{f("list"),g(D.id),N(null)},children:"Open Document"})]})]}),c.jsx("div",{className:"shrink-0 p-2",style:{borderTop:"1px solid var(--terminal-border)"},children:c.jsx("div",{className:"flex flex-wrap gap-2",children:Object.entries(hs).map(([Y,I])=>c.jsxs("div",{className:"flex items-center gap-1 text-[9px]",children:[c.jsx("div",{className:"w-2 h-2",style:{background:I.border}}),c.jsx("span",{style:{color:"var(--terminal-text-muted)"},children:Y})]},Y))})})]})]})]})}function e0({label:t,active:l,onClick:r}){return c.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 jj({standups:t,waves:l,decisions:r,mode:i,onClose:o,terminalWidth:u=0}){const[f,m]=j.useState(i==="decisions"?"decisions":"standups"),{panelRight:p,panelWidth:h,isResizing:g,handleResizeStart:y}=nh(u);return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:p},onClick:o}),c.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:h,background:"var(--terminal-bg)",borderLeftColor:"var(--desk-wood)"},children:[c.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}),c.jsxs("div",{className:"p-5 bg-[var(--desk-wood)] text-white relative",children:[c.jsx("button",{onClick:o,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:"×"}),c.jsx("div",{className:"text-lg font-bold",children:i==="bulletin"?"📌 Bulletin Board":"📜 Decision Log"})]}),c.jsx("div",{className:"flex",style:{borderBottom:"1px solid var(--terminal-border)"},children:i==="bulletin"?c.jsxs(c.Fragment,{children:[c.jsx(td,{label:`Standups (${t.length})`,active:f==="standups",onClick:()=>m("standups")}),c.jsx(td,{label:`Waves (${l.length})`,active:f==="waves",onClick:()=>m("waves")})]}):c.jsx(td,{label:`Decisions (${r.length})`,active:f==="decisions",onClick:()=>m("decisions")})}),c.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[f==="standups"&&t.map((b,v)=>c.jsx(nd,{title:`Standup ${b.date}`,content:b.content},v)),f==="waves"&&l.map((b,v)=>c.jsx(nd,{title:`Wave ${b.id}`,subtitle:b.timestamp,content:b.content},v)),f==="decisions"&&r.map((b,v)=>c.jsx(nd,{title:`#${b.id} ${b.title}`,subtitle:b.date,content:b.content},v))]})]})]})}function td({label:t,active:l,onClick:r}){return c.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 Ej(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 nd({title:t,subtitle:l,content:r}){const[i,o]=j.useState(!1),u=r.length>100,f=Ej(r).slice(0,160);return c.jsxs("div",{className:"mb-3 rounded-lg overflow-hidden",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[c.jsxs("div",{className:"p-3 cursor-pointer hover:bg-white/5",onClick:()=>o(!i),children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("div",{className:"font-medium text-sm",style:{color:"var(--terminal-text)"},children:t}),c.jsx("span",{className:"text-xs shrink-0 ml-2",style:{color:"var(--terminal-text-muted)"},children:i?"▲":"▼"})]}),l&&c.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--terminal-text-muted)"},children:l})]}),i&&c.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:c.jsx(gs,{content:r})}),!i&&u&&c.jsx("div",{className:"px-3 pb-2 text-xs line-clamp-2 leading-relaxed",style:{color:"var(--terminal-text-muted)"},children:f})]})}function Cj({projectId:t,onClose:l,terminalWidth:r=0}){const[i,o]=j.useState(null),{panelRight:u,panelWidth:f,isResizing:m,handleResizeStart:p}=nh(r);if(j.useEffect(()=>{Ce.getProject(t).then(o).catch(console.error)},[t]),!i)return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:u},onClick:l}),c.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:c.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-muted)"},children:"Loading project..."})})]});const h=i.tasks.filter(b=>b.status==="done").length,g=i.tasks.length,y=g>0?Math.round(h/g*100):0;return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:u},onClick:l}),c.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:[c.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}),c.jsxs("div",{className:"p-5 bg-[var(--meeting-blue)] text-white relative",children:[c.jsx("div",{className:"text-sm opacity-70",children:"Meeting Room"}),c.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:"×"}),c.jsx("div",{className:"text-xl font-bold mt-1",children:i.name}),c.jsxs("div",{className:"flex items-center gap-3 mt-3 text-sm",children:[c.jsxs("span",{children:["Tasks: ",g]}),c.jsxs("span",{children:["Done: ",h]}),c.jsxs("span",{children:["Progress: ",y,"%"]})]}),c.jsx("div",{className:"mt-2 h-1.5 bg-white/20 rounded-full overflow-hidden",children:c.jsx("div",{className:"h-full bg-white rounded-full transition-all",style:{width:`${y}%`}})})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[i.prd&&c.jsxs("div",{className:"mb-5",children:[c.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:"PRD"}),c.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:c.jsx(gs,{content:i.prd})})]}),c.jsxs("div",{children:[c.jsxs("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:["Tasks (",g,")"]}),c.jsx("div",{className:"space-y-2",children:i.tasks.map(b=>c.jsxs("div",{className:"rounded-lg p-3",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("span",{className:"text-sm font-medium",style:{color:"var(--terminal-text)"},children:b.title}),c.jsx(Nj,{status:b.status})]}),c.jsx("div",{className:"text-xs mt-1",style:{color:"var(--terminal-text-muted)"},children:b.role}),b.description&&c.jsx("div",{className:"text-xs mt-1.5 line-clamp-2",style:{color:"var(--terminal-text-secondary)"},children:b.description})]},b.id))})]})]})]})]})}function Nj({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 c.jsx("span",{className:"text-[10px] font-semibold px-2 py-0.5 rounded-full",style:{background:r.bg,color:r.color},children:t})}const Aj={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"};function Dj({roleId:t,roleName:l,mode:r="assign",onClose:i,onExecutionStart:o}){const[u,f]=j.useState(""),m=j.useRef(null);j.useEffect(()=>{var y;(y=m.current)==null||y.focus()},[]);const p=()=>{u.trim()&&(o(t,u.trim()),i())},h=y=>{y.key==="Enter"&&(y.metaKey||y.ctrlKey)&&p(),y.key==="Escape"&&i()},g=Aj[t]??"#666";return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:i}),c.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:[c.jsxs("div",{className:"p-5 text-white",style:{background:`linear-gradient(135deg, ${g}, ${g}cc)`},children:[c.jsx("div",{className:"text-lg font-bold",children:r==="ask"?"Ask":"Assign Task"}),c.jsx("div",{className:"text-sm opacity-80 mt-0.5",children:r==="ask"?`to ${l}`:`to ${l} (${t})`})]}),c.jsxs("div",{className:"p-5",children:[c.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Task Description"}),c.jsx("textarea",{ref:m,value:u,onChange:y=>f(y.target.value),onKeyDown:h,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"}),c.jsx("div",{className:"text-[10px] text-white/30 mt-1",children:"Cmd+Enter to submit"})]}),c.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[c.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"}),c.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 t0={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"};function $y({event:t,isThinkingCollapsed:l,onToggleThinking:r,onNavigateToJob:i,onOpenKnowledgeDoc:o,compact:u}){var m;const f=t0[t.roleId]??"#888";switch(t.type){case"text":return c.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 c.jsxs("div",{className:"group",children:[c.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:[c.jsx("span",{children:l?"▶":"▼"}),c.jsx("span",{className:"italic",children:"thinking..."})]}),!l&&c.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??""),h=t.data.input,g=typeof(h==null?void 0:h.command)=="string"?h.command.slice(0,80):"",y=typeof(h==null?void 0:h.file_path)=="string"?String(h.file_path):typeof(h==null?void 0:h.path)=="string"?String(h.path):"",b=y?y.split("/").pop()??"":"",v=/^(write_file|Write|edit_file|Edit)$/i.test(p),k=(m=y.match(/(?:^|\/)knowledge\/(.+\.md)$/))==null?void 0:m[1],S=v&&k&&o;return c.jsxs("div",{className:"flex items-center gap-2 py-0.5",children:[c.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?c.jsx("button",{onClick:()=>o(k),className:"text-[10px] text-green-400 hover:text-green-300 underline underline-offset-2 cursor-pointer truncate",style:{maxWidth:u?200:400},children:b}):c.jsxs(c.Fragment,{children:[g&&c.jsx("span",{className:`text-[var(--terminal-text-muted)] text-[10px] truncate ${u?"max-w-[200px]":"max-w-[400px]"}`,children:g}),b&&c.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??"",h=t.data.task??"",g=t.data.childJobId,y=t0[p]??"#888";return c.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:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs("span",{style:{color:y},className:"font-bold text-[11px]",children:["→"," ",p.toUpperCase()]}),c.jsx("span",{className:"text-[var(--terminal-text-secondary)] text-[10px] truncate flex-1",children:h.slice(0,u?60:100)}),g&&i&&c.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 c.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 c.jsx("div",{className:"border-t border-[var(--terminal-border)] my-2 relative",children:c.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 c.jsxs("div",{className:"text-red-400/80 text-[11px]",children:["⚠"," ",t.data.message]});case"job:start":return c.jsxs("div",{className:"text-[var(--terminal-text-muted)] text-[10px] pb-1",children:[c.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,h=t.data.toolCalls??0;return c.jsx("div",{className:"mt-2 p-2 rounded-lg bg-green-900/20 border border-green-800/30",children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"w-2 h-2 rounded-full bg-green-400"}),c.jsx("span",{className:"text-green-300 font-bold text-[11px]",children:"Complete"}),c.jsxs("span",{className:"text-[var(--terminal-text-muted)] text-[10px]",children:[p," turns · ",h," tools"]})]})})}case"job:error":return c.jsx("div",{className:"mt-2 p-2 rounded-lg bg-red-900/20 border border-red-800/30",children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"w-2 h-2 rounded-full bg-red-400"}),c.jsx("span",{className:"text-red-300 font-bold text-[11px]",children:"Error"}),c.jsx("span",{className:"text-red-200/70 text-[10px]",children:t.data.message})]})});case"import:scan":case"import:process":case"import:created":return c.jsxs("div",{className:"text-cyan-300/70 text-[11px]",children:["[",t.type,"] ",JSON.stringify(t.data)]});default:return null}}function Tj({jobId:t,title:l,color:r,variant:i,style:o,onClose:u,onMinimize:f,onDone:m,onNavigateToJob:p,onOpenKnowledgeDoc:h}){const{events:g,status:y,textOutput:b,childJobIds:v}=g0(t),[k,S]=j.useState(0),[N,E]=j.useState(new Set),_=j.useRef(null),H=j.useRef(Date.now()),B=j.useRef(!1);j.useEffect(()=>{const Y=setInterval(()=>{S(Math.floor((Date.now()-H.current)/1e3))},1e3);return()=>clearInterval(Y)},[]),j.useEffect(()=>{_.current&&(_.current.scrollTop=_.current.scrollHeight)},[g]),j.useEffect(()=>{(y==="done"||y==="error")&&!B.current&&(B.current=!0,m==null||m())},[y,m]);const $=Y=>{E(I=>{const ne=new Set(I);return ne.has(Y)?ne.delete(Y):ne.add(Y),ne})},T={idle:"Waiting",connecting:"Connecting...",streaming:"Working",done:"Complete",error:"Error"}[y],X={idle:"#888",connecting:"#888",streaming:r,done:"#2E7D32",error:"#C62828"}[y],G=Y=>`${Math.floor(Y/60)}:${String(Y%60).padStart(2,"0")}`,ee=y==="done"||y==="error",D=c.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:o,children:[c.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-[var(--terminal-border)] shrink-0",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:"w-3 h-3 rounded-full animate-pulse",style:{background:X}}),c.jsx("div",{children:c.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-sm",children:l})})]}),c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs font-mono",children:G(k)}),c.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full font-semibold",style:{background:`${X}22`,color:X},children:T}),f&&i==="modal"&&c.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&&c.jsx("button",{onClick:u,className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-lg cursor-pointer",children:"×"})]})]}),c.jsxs("div",{ref:_,className:"flex-1 overflow-y-auto p-4 space-y-1 text-xs font-mono",children:[g.length===0&&y==="connecting"&&c.jsx("div",{className:"text-[var(--terminal-text-muted)]",children:"Connecting to activity stream..."}),g.map(Y=>c.jsx($y,{event:Y,isThinkingCollapsed:N.has(Y.seq),onToggleThinking:()=>$(Y.seq),onNavigateToJob:p,onOpenKnowledgeDoc:h},Y.seq)),y==="streaming"&&c.jsx("span",{className:"inline-block w-2 h-4 bg-green-400 animate-pulse ml-0.5"})]}),c.jsxs("div",{className:"px-5 py-3 border-t border-[var(--terminal-border)] flex items-center justify-between shrink-0",children:[c.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&&c.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"?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:ee?u:void 0}),D]}):D}const ld={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};function zj({orgNodes:t,rootId:l}){const r=t[l];if(!r)return null;const o=r.children.map(m=>t[m]).filter(Boolean),u=[];for(const m of o)for(const p of m.children){const h=t[p];h&&u.push({node:h,parentId:m.id})}const f=o.length+u.length;return c.jsxs("div",{children:[c.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Propagation Preview"}),c.jsxs("div",{className:"bg-white/5 border border-white/10 rounded-lg p-4",children:[c.jsx("div",{className:"flex justify-center mb-2",children:c.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"})}),o.length>0&&c.jsx("div",{className:"flex justify-center mb-1",children:c.jsx("div",{className:"w-px h-3 bg-white/15"})}),o.length>1&&c.jsx("div",{className:"flex justify-center mb-1",children:c.jsx("div",{className:"h-px bg-white/15",style:{width:`${Math.min(o.length*80,320)}px`}})}),c.jsx("div",{className:"flex justify-center gap-3 mb-2 flex-wrap",children:o.map(m=>c.jsxs("div",{className:"flex flex-col items-center",children:[c.jsx("span",{className:"px-2.5 py-1 text-[10px] font-bold rounded border-2 uppercase",style:{borderColor:ld[m.id]??"#888",color:ld[m.id]??"#888",background:`${ld[m.id]??"#888"}22`},children:m.id}),c.jsx("span",{className:"text-[8px] text-white/30 mt-0.5",children:"direct"})]},m.id))}),u.length>0&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"flex justify-center mb-1",children:c.jsx("div",{className:"w-px h-2 bg-white/10"})}),c.jsx("div",{className:"flex justify-center gap-2 flex-wrap",children:u.map(({node:m})=>c.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))}),c.jsx("div",{className:"text-center text-[8px] text-white/30 mt-1",children:"via re-dispatch"})]})]}),c.jsxs("div",{className:"text-[10px] text-gray-400 mt-1.5",children:[f," role",f!==1?"s":""," will receive this wave"]})]})}function Mj({cLevelRoles:t,orgNodes:l,rootId:r,onClose:i,onDispatch:o}){const[u,f]=j.useState(""),m=j.useRef(null);j.useEffect(()=>{var y;(y=m.current)==null||y.focus()},[]);const p=()=>{!u.trim()||t.length===0||(o(u.trim()),i())},h=y=>{y.key==="Enter"&&(y.metaKey||y.ctrlKey)&&p(),y.key==="Escape"&&i()},g=r&&Object.keys(l).length>0;return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:i}),c.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:[c.jsxs("div",{className:"p-5 text-white",style:{background:"linear-gradient(135deg, #B71C1C, #D32F2F)"},children:[c.jsx("div",{className:"text-lg font-bold",children:"CEO Wave"}),c.jsx("div",{className:"text-sm opacity-80 mt-0.5",children:"Broadcast a directive to all C-Level reports"})]}),c.jsxs("div",{className:"p-5 space-y-4",children:[g&&c.jsx(zj,{orgNodes:l,rootId:r}),!g&&c.jsxs("div",{children:[c.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Dispatching to"}),c.jsx("div",{className:"flex gap-2 flex-wrap",children:t.length>0?t.map(y=>c.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)):c.jsx("span",{className:"text-xs text-gray-400 italic",children:"No C-Level roles found"})}),c.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"Each C-Level receives the directive and delegates to their reports"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Directive"}),c.jsx("textarea",{ref:m,value:u,onChange:y=>f(y.target.value),onKeyDown:h,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"}),c.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"Cmd+Enter to dispatch"})]})]}),c.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[c.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"}),c.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 _j(t,l,r){const[i,o]=j.useState(new Map),[u,f]=j.useState(null),m=j.useRef(new Map),p=j.useRef(i);p.current=i,j.useEffect(()=>{if(!r||Object.keys(l).length===0)return;const b=new Map,v=S=>{const N=l[S];N&&(b.set(S,{jobId:null,roleId:S,roleName:N.name,children:N.children,status:"waiting",events:[],streamStatus:"idle"}),N.children.forEach(v))},k=l[r];k&&(b.set(r,{jobId:null,roleId:r,roleName:"CEO",children:k.children,status:"not-dispatched",events:[],streamStatus:"idle"}),k.children.forEach(v));for(const S of t){const N=b.get(S.roleId);N&&(N.jobId=S.jobId,N.status="running",N.streamStatus="connecting")}o(b),t.length>0&&f(t[0].roleId)},[t,l,r]);const h=j.useCallback((b,v)=>{const k=m.current.get(b);k&&k.controller.abort();const S=new AbortController,N={controller:S,lastSeq:-1};m.current.set(b,N);const _=`/api/jobs/${b}/stream?from=0`;fetch(_,{signal:S.signal}).then(async H=>{if(!H.ok||!H.body){o(X=>{const G=new Map(X),ee=G.get(v);return ee&&G.set(v,{...ee,streamStatus:"error"}),G});return}o(X=>{const G=new Map(X),ee=G.get(v);return ee&&G.set(v,{...ee,streamStatus:"streaming",status:"running"}),G});const B=H.body.getReader(),$=new TextDecoder;let T="";for(;;){const{done:X,value:G}=await B.read();if(X)break;T+=$.decode(G,{stream:!0});const ee=T.split(`
|
|
80
|
+
`);T=ee.pop()??"";let D="";for(const Y of ee)if(Y.startsWith("event: "))D=Y.slice(7).trim();else if(Y.startsWith("data: ")){try{const I=JSON.parse(Y.slice(6));if(D==="activity"){const ne=I;ne.seq>N.lastSeq&&(N.lastSeq=ne.seq),o(le=>{const L=new Map(le),F=L.get(v);if(!F||F.events.some(P=>P.seq===ne.seq))return le;const V={...F,events:[...F.events,ne]};if(ne.type==="dispatch:start"&&ne.data.childJobId){const P=ne.data.childJobId,fe=ne.data.targetRoleId??ne.data.roleId;if(fe){const z=L.get(fe);z&&(L.set(fe,{...z,jobId:P,status:"running",streamStatus:"connecting"}),setTimeout(()=>h(P,fe),0))}}return ne.type==="job:done"?(V.status="done",V.streamStatus="done"):ne.type==="job:error"&&(V.status="error",V.streamStatus="error"),L.set(v,V),L})}else if(D==="stream:end"){const ne=I.reason;o(le=>{const L=new Map(le),F=L.get(v);if(!F)return le;const V=ne==="error"?"error":"done";return L.set(v,{...F,status:F.status==="running"?V:F.status,streamStatus:V==="error"?"error":"done"}),L})}}catch{}D=""}}}).catch(H=>{H.name!=="AbortError"&&o(B=>{const $=new Map(B),T=$.get(v);return T&&$.set(v,{...T,streamStatus:"error"}),$})})},[]);j.useEffect(()=>{if(t.length!==0){for(const b of t)h(b.jobId,b.roleId);return()=>{for(const[,b]of m.current)b.controller.abort();m.current.clear()}}},[t,h]);const g=(()=>{let b=0,v=0,k=0;for(const[S,N]of i)S!==r&&(k++,N.status==="done"?b++:N.status==="running"&&v++);return{done:b,total:k,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 j.useEffect(()=>{y&&o(b=>{const v=new Map(b);let k=!1;for(const[S,N]of v)N.status==="waiting"&&(v.set(S,{...N,status:"not-dispatched"}),k=!0);return k?v:b})},[y]),{nodes:i,selectedRoleId:u,selectNode:f,progress:g,allDone:y}}const n0={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},Ka=120,Ul=44,l0=80;function Fj(t,l){if(!t.get(l))return{layout:[],width:300,height:200};const i=[],o=[],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);o.length<=y;)o.push([]);o[y].push(g),i.push({roleId:g,x:0,y:y*l0+20,parentId:b});const v=t.get(g);if(v)for(const k of v.children)t.has(k)&&!f.has(k)&&u.push({id:k,depth:y+1,parentId:g})}const m=Math.max(...o.map(g=>g.length))*(Ka+16),p=Math.max(m,280);for(const g of o){const y=g.length*(Ka+16)-16,b=(p-y)/2;g.forEach((v,k)=>{const S=i.find(N=>N.roleId===v);S&&(S.x=b+k*(Ka+16))})}const h=o.length*l0+40;return{layout:i,width:p,height:h}}function Rj({nodes:t,rootId:l,selectedRoleId:r,onSelectNode:i}){const{layout:o,width:u,height:f}=Fj(t,l),m=h=>{const g=o.find(y=>y.roleId===h);return g?{cx:g.x+Ka/2,cy:g.y+Ul/2}:{cx:0,cy:0}},p=h=>{switch(h.status){case"running":return n0[h.roleId]??"#FBBF24";case"done":return"#2E7D32";case"error":return"#C62828";case"not-dispatched":return"#666";default:return"#888"}};return c.jsxs("svg",{viewBox:`0 0 ${u} ${f}`,width:"100%",height:"100%",className:"block",children:[c.jsx("defs",{children:c.jsxs("filter",{id:"glow",children:[c.jsx("feGaussianBlur",{stdDeviation:"2",result:"blur"}),c.jsxs("feMerge",{children:[c.jsx("feMergeNode",{in:"blur"}),c.jsx("feMergeNode",{in:"SourceGraphic"})]})]})}),o.filter(h=>h.parentId).map(h=>{const g=m(h.parentId),y=m(h.roleId),b=t.get(h.roleId),v=t.get(h.parentId);let k="rgba(180,200,240,0.15)",S="4 4",N="";return(b==null?void 0:b.status)==="done"||(v==null?void 0:v.status)==="done"?(k="#2E7D3266",S=""):(b==null?void 0:b.status)==="running"&&(k=n0[h.roleId]??"#FBBF24",S="6 4",N="wave-edge-flow"),c.jsx("line",{x1:g.cx,y1:g.cy+Ul/2-4,x2:y.cx,y2:y.cy-Ul/2+4,stroke:k,strokeWidth:1.5,strokeDasharray:S,className:N},`${h.parentId}-${h.roleId}`)}),o.map(h=>{const g=t.get(h.roleId);if(!g)return null;const y=p(g),b=r===h.roleId,v=h.roleId===l,k=v?.4:g.status==="not-dispatched"?.35:1;return c.jsxs("g",{transform:`translate(${h.x}, ${h.y})`,style:{cursor:v?"default":"pointer",opacity:k},onClick:()=>!v&&i(h.roleId),children:[c.jsx("rect",{x:0,y:0,width:Ka,height:Ul,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":""}),c.jsx("circle",{cx:14,cy:Ul/2,r:4,fill:y,filter:g.status==="running"?"url(#glow)":void 0,children:g.status==="running"&&c.jsx("animate",{attributeName:"opacity",values:"1;0.4;1",dur:"1.5s",repeatCount:"indefinite"})}),c.jsx("text",{x:26,y:Ul/2-4,fill:"var(--terminal-text, #fff)",fontSize:10,fontWeight:700,fontFamily:"var(--pixel-font)",children:g.roleId.toUpperCase()}),c.jsx("text",{x:26,y:Ul/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"&&c.jsx("text",{x:Ka-18,y:Ul/2+4,fontSize:14,fill:"#2E7D32",children:"✓"}),g.status==="error"&&c.jsx("text",{x:Ka-18,y:Ul/2+4,fontSize:14,fill:"#C62828",children:"✗"})]},h.roleId)})]})}const Oj={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};function Bj({directive:t,rootJobs:l,orgNodes:r,rootRoleId:i,onClose:o,onMinimize:u,onDone:f,onOpenKnowledgeDoc:m}){const{nodes:p,selectedRoleId:h,selectNode:g,progress:y,allDone:b}=_j(l,r,i),[v,k]=j.useState(0),[S,N]=j.useState(new Set),E=j.useRef(null),_=j.useRef(Date.now()),H=j.useRef(!1);j.useEffect(()=>{const G=setInterval(()=>{k(Math.floor((Date.now()-_.current)/1e3))},1e3);return()=>clearInterval(G)},[]),j.useEffect(()=>{E.current&&(E.current.scrollTop=E.current.scrollHeight)},[h,p]),j.useEffect(()=>{b&&!H.current&&(H.current=!0,f==null||f())},[b,f]);const B=G=>`${Math.floor(G/60)}:${String(G%60).padStart(2,"0")}`,$=h?p.get(h):null,T=h?Oj[h]??"#888":"#888",X=G=>{N(ee=>{const D=new Set(ee);return D.has(G)?D.delete(G):D.add(G),D})};return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:b?o:void 0}),c.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:[c.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-[var(--terminal-border)] shrink-0",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.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"}}),c.jsx("div",{children:c.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-sm",children:b?"WAVE COMPLETE":"WAVE COMMAND CENTER"})})]}),c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs font-mono",children:B(v)}),c.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"]}),c.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&&c.jsx("button",{onClick:o,className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-lg cursor-pointer",children:"×"})]})]}),c.jsx("div",{className:"px-5 py-2 border-b border-[var(--terminal-border)] shrink-0",children:c.jsxs("span",{className:"text-[var(--terminal-text-secondary)] text-xs italic",children:["“",t,"”"]})}),c.jsxs("div",{className:"flex flex-1 min-h-0",children:[c.jsxs("div",{className:"w-[280px] shrink-0 border-r border-[var(--terminal-border)] flex flex-col",children:[c.jsx("div",{className:"px-3 py-2 border-b border-[var(--terminal-border)]",children:c.jsx("span",{className:"text-[10px] font-bold text-[var(--terminal-text-secondary)] uppercase tracking-wider",children:"Org Propagation"})}),c.jsx("div",{className:"flex-1 overflow-auto p-3",children:c.jsx(Rj,{nodes:p,rootId:i,selectedRoleId:h,onSelectNode:g})}),c.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(G=>c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("span",{className:"w-2 h-2 rounded-full inline-block",style:{background:G.color,animation:G.dot?"wave-pulse 1.5s ease-in-out infinite":void 0}}),c.jsx("span",{className:"text-[8px] text-[var(--terminal-text-muted)]",children:G.label})]},G.label))})]}),c.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[$&&c.jsxs("div",{className:"px-4 py-2 border-b border-[var(--terminal-border)] shrink-0 flex items-center gap-2",children:[c.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:T}}),c.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-xs",children:$.roleId.toUpperCase()}),c.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs",children:$.roleName}),c.jsx("span",{className:"ml-auto text-[10px] px-2 py-0.5 rounded-full font-semibold",style:{background:`${T}22`,color:T},children:$.status==="running"?"Working":$.status==="done"?"Complete":$.status==="error"?"Error":$.status==="waiting"?"Waiting":"Not dispatched"})]}),c.jsxs("div",{ref:E,className:"flex-1 overflow-y-auto p-4 space-y-1 text-xs font-mono",children:[$&&$.events.length===0&&c.jsx("div",{className:"text-[var(--terminal-text-muted)]",children:$.status==="waiting"?"Waiting for dispatch...":$.status==="running"?"Connecting to activity stream...":$.status==="not-dispatched"?"This role was not dispatched in this wave.":""}),$==null?void 0:$.events.map(G=>c.jsx($y,{event:G,isThinkingCollapsed:S.has(G.seq),onToggleThinking:()=>X(G.seq),onNavigateToJob:ee=>{for(const[,D]of p)if(D.jobId===ee){g(D.roleId);return}},onOpenKnowledgeDoc:m},G.seq)),($==null?void 0:$.status)==="running"&&c.jsx("span",{className:"inline-block w-2 h-4 bg-green-400 animate-pulse ml-0.5"})]}),!$&&c.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"}),c.jsxs("div",{className:"px-4 py-2 border-t border-[var(--terminal-border)] flex items-center justify-between shrink-0",children:[c.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:$&&$.events.length>0&&`${$.events.length} events`}),b&&c.jsx("button",{onClick:o,className:"px-4 py-1.5 text-xs text-white rounded-lg font-semibold cursor-pointer",style:{background:"#2E7D32"},children:"Close"})]})]})]})]})]})}const $j={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 lh(t){return $j[t]??{skinColor:"#B0BEC5",hairColor:"#78909C",shirtColor:"#607D8B",pantsColor:"#455A64",shoeColor:"#37474F"}}const Ly=["#FDEBD0","#F5CBA7","#D4A07A","#C68642","#8D5524","#5C3A1E","#F3D1C7","#E8BEAC","#B07D62","#704214"],Hy=["#1A0A00","#2C1810","#4E342E","#6D4C41","#8D6E63","#D4A574","#F5E6CA","#FFD700","#B71C1C","#AD1457","#4A148C","#1A237E","#004D40","#1A1A1A","#78909C","#E0E0E0"],Uy=["#1565C0","#E65100","#2E7D32","#4A148C","#AD1457","#00695C","#D32F2F","#F57F17","#1B5E20","#283593","#4E342E","#37474F","#880E4F","#00838F","#6A1B9A","#FF6F00"],Iy=["#37474F","#1A237E","#3E2723","#263238","#1B5E20","#455A64","#212121","#4E342E","#0D47A1","#311B92"],Yy=["#212121","#1A1A1A","#37474F","#4E342E","#7B1FA2","#D32F2F","#1565C0","#F57F17","#2E7D32","#FFFFFF"],Sa={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 Lj({color:t,selected:l,onClick:r}){return c.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 Ji({label:t,presets:l,value:r,onChange:i}){return c.jsxs("div",{className:"customize-row",children:[c.jsxs("div",{className:"customize-row-header",children:[c.jsx("span",{className:"customize-row-label",children:t}),c.jsx("div",{className:"customize-row-current",style:{background:r}})]}),c.jsx("div",{className:"customize-swatches",children:l.map(o=>c.jsx(Lj,{color:o,selected:o===r,onClick:()=>i(o)},o))})]})}function ad({label:t,items:l,value:r,onChange:i}){return c.jsxs("div",{className:"customize-row",children:[c.jsx("div",{className:"customize-row-header",children:c.jsx("span",{className:"customize-row-label",children:t})}),c.jsx("div",{className:"customize-swatches",style:{gap:4},children:l.map(o=>c.jsx("button",{onClick:()=>i(o.id===r?void 0:o.id),className:"customize-swatch",style:{width:"auto",height:"auto",padding:"2px 6px",fontSize:9,fontFamily:"var(--font-pixel, monospace)",background:o.id===r?"rgba(255,255,255,0.15)":"rgba(255,255,255,0.04)",outline:o.id===r?"2px solid #fff":"2px solid transparent",color:o.id===r?"#fff":"rgba(255,255,255,0.5)",borderRadius:4},children:o.name},o.id))})]})}function rd({label:t,active:l,onClick:r}){return c.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 ga(t){return t[Math.floor(Math.random()*t.length)]}function ls(){var i,o,u;const t=Ay(),l=Dy(),r=Ty();return{skinColor:ga(Ly),hairColor:ga(Hy),shirtColor:ga(Uy),pantsColor:ga(Iy),shoeColor:ga(Yy),hairStyle:(i=ga(t))==null?void 0:i.id,outfitStyle:(o=ga(l))==null?void 0:o.id,accessory:(u=ga(r))==null?void 0:u.id}}function qy({roleId:t,appearance:l,onChange:r,onRandomize:i,onReset:o,label:u}){const[f,m]=j.useState("look"),p=j.useCallback((k,S)=>{r({...l,[k]:S})},[l,r]),h=j.useRef(null),g=j.useCallback(k=>{var E;const S=(E=k.target.files)==null?void 0:E[0];if(!S)return;const N=new Image;N.onload=()=>{const _=cS(N);r({..._,hairStyle:l.hairStyle,outfitStyle:l.outfitStyle,accessory:l.accessory}),URL.revokeObjectURL(N.src)},N.src=URL.createObjectURL(S),k.target.value=""},[l.hairStyle,l.outfitStyle,l.accessory,r]),y=Ay(),b=Dy(),v=Ty();return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"customize-preview",children:[c.jsx("div",{className:"customize-preview-bg",children:c.jsx(yc,{roleId:t,appearance:l,scale:12})}),u&&c.jsx("div",{className:"customize-preview-name",children:u}),c.jsxs("div",{className:"customize-preview-actions",children:[c.jsx("button",{className:"customize-btn customize-btn--random",onClick:i,children:"RANDOM"}),c.jsx("button",{className:"customize-btn customize-btn--reset",onClick:o,children:"RESET"}),c.jsx("button",{className:"customize-btn",onClick:()=>{var k;return(k=h.current)==null?void 0:k.click()},style:{fontSize:9,opacity:.7},children:"PHOTO"}),c.jsx("input",{ref:h,type:"file",accept:"image/*",onChange:g,style:{display:"none"}})]})]}),c.jsxs("div",{className:"customize-colors",children:[c.jsxs("div",{style:{display:"flex",borderBottom:"1px solid rgba(255,255,255,0.06)",marginBottom:4},children:[c.jsx(rd,{label:"LOOK",active:f==="look",onClick:()=>m("look")}),c.jsx(rd,{label:"OUTFIT",active:f==="outfit",onClick:()=>m("outfit")}),c.jsx(rd,{label:"ACCESSORY",active:f==="accessory",onClick:()=>m("accessory")})]}),f==="look"&&c.jsxs(c.Fragment,{children:[c.jsx(Ji,{label:"SKIN",presets:Ly,value:l.skinColor,onChange:k=>p("skinColor",k)}),c.jsx(Ji,{label:"HAIR COLOR",presets:Hy,value:l.hairColor,onChange:k=>p("hairColor",k)}),c.jsx(ad,{label:"HAIR STYLE",items:y,value:l.hairStyle,onChange:k=>p("hairStyle",k)})]}),f==="outfit"&&c.jsxs(c.Fragment,{children:[c.jsx(ad,{label:"STYLE",items:b,value:l.outfitStyle,onChange:k=>p("outfitStyle",k)}),c.jsx(Ji,{label:"TOP",presets:Uy,value:l.shirtColor,onChange:k=>p("shirtColor",k)}),c.jsx(Ji,{label:"PANTS",presets:Iy,value:l.pantsColor,onChange:k=>p("pantsColor",k)}),c.jsx(Ji,{label:"SHOES",presets:Yy,value:l.shoeColor,onChange:k=>p("shoeColor",k)})]}),f==="accessory"&&c.jsxs(c.Fragment,{children:[c.jsx(ad,{label:"ACCESSORY",items:v,value:l.accessory,onChange:k=>p("accessory",k)}),c.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:"More accessories coming soon"})]})]})]})}const Hj=[{value:"c-level",label:"C-Level"},{value:"team-lead",label:"Team Lead"},{value:"member",label:"Member"}];function Xy(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,24)}function a0(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 Pi=4;function Uj(t,l,r){const i=t.trim();if(!i||i.startsWith("#"))return null;const o=i.split(",").map(y=>y.trim()),u=o[0];if(!u)return null;const f=Xy(u),m=(o[1]||"member").toLowerCase(),p=m==="c-level"?"c-level":m==="team-lead"?"team-lead":"member",h=o[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:h,error:g}}function Ij({existingRoles:t,onClose:l,onHire:r}){const[i,o]=j.useState("single"),[u,f]=j.useState(1),[m,p]=j.useState(""),[h,g]=j.useState(""),[y,b]=j.useState(!1),[v,k]=j.useState("member"),[S,N]=j.useState("ceo"),[E,_]=j.useState(""),[H,B]=j.useState(ls),[$,T]=j.useState(!1),[X,G]=j.useState(""),[ee,D]=j.useState([]),[Y,I]=j.useState(new Set),[ne,le]=j.useState(""),[L,F]=j.useState("input"),[V,P]=j.useState({done:0,total:0}),fe=j.useRef(null),z=j.useRef(null),M=j.useRef(null);j.useEffect(()=>{Ce.getSkills().then(de=>D(de.filter(Ee=>Ee.installed))).catch(()=>{})},[]),j.useEffect(()=>{var de,Ee,nt;i==="single"?(u===1&&((de=fe.current)==null||de.focus()),u===2&&((Ee=z.current)==null||Ee.focus())):L==="input"&&((nt=M.current)==null||nt.focus())},[u,i,L]);const K=j.useMemo(()=>new Set(t.map(de=>de.id)),[t]),A=j.useMemo(()=>{const de=ne.split(`
|
|
81
|
+
`),Ee=new Set;return de.map(nt=>Uj(nt,K,Ee)).filter(nt=>nt!==null)},[ne,K]),oe=A.length>0&&A.every(de=>!de.error),be=de=>{p(de),y||g(Xy(de))},ve=m.trim().length>0&&h.trim().length>0&&!t.some(de=>de.id===h),Ne=E.trim().length>0,Oe=async()=>{T(!0),G("");const de=a0(v);try{await r({id:h,name:m.trim(),level:v,reportsTo:S,persona:E.trim(),...de,skills:Y.size>0?[...Y]:void 0},H),l()}catch(Ee){G(Ee instanceof Error?Ee.message:"Failed to create role"),T(!1)}},Be=de=>de===1?ve:de===2?Ne:!0,me=async()=>{T(!0),G(""),P({done:0,total:A.length});try{for(let de=0;de<A.length;de++){const Ee=A[de],nt=a0(Ee.level),nn=ls(),Et=`${Ee.name}. A ${Ee.level} role reporting to ${Ee.reportsTo}.`;await r({id:Ee.id,name:Ee.name,level:Ee.level,reportsTo:Ee.reportsTo,persona:Et,...nt},nn),P({done:de+1,total:A.length})}l()}catch(de){G(de instanceof Error?de.message:"Failed to create roles"),T(!1)}},Ve=de=>{de.key==="Escape"&&l(),de.key==="Enter"&&(de.metaKey||de.ctrlKey)&&(i==="single"?u<Pi&&Be(u)?f(u+1):u===Pi&&Oe():L==="input"&&oe?F("review"):L==="review"&&me())},Ge=t.some(de=>de.id===h)&&h.length>0;return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:l}),c.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:Ve,children:[c.jsxs("div",{className:"p-5 text-white",style:{background:"linear-gradient(135deg, #2E7D32, #43A047)"},children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("div",{className:"text-lg font-bold",children:"Hire New Role"}),c.jsxs("div",{className:"flex bg-black/20 rounded-lg p-0.5",children:[c.jsx("button",{onClick:()=>{o("single"),G("")},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"}),c.jsx("button",{onClick:()=>{o("bulk"),G("")},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"})]})]}),c.jsx("div",{className:"text-sm opacity-80 mt-0.5",children:i==="single"?`Step ${u} of ${Pi}`:L==="input"?"Enter roles, one per line":`Review ${A.length} roles`})]}),i==="single"&&c.jsx("div",{className:"flex gap-1 px-5 pt-4",children:Array.from({length:Pi},(de,Ee)=>Ee+1).map(de=>c.jsx("div",{className:"flex-1 h-1 rounded-full transition-colors",style:{background:de<=u?"#2E7D32":"rgba(255,255,255,0.1)"}},de))}),c.jsx("div",{className:"p-5 min-h-[240px] overflow-y-auto flex-1",children:i==="single"?c.jsxs(c.Fragment,{children:[u===1&&c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Role Name"}),c.jsx("input",{ref:fe,value:m,onChange:de=>be(de.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"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Role ID (slug)"}),c.jsx("input",{value:h,onChange:de=>{g(de.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 ${Ge?"border-red-400":"border-white/10 focus:border-white/25"}`}),Ge&&c.jsx("div",{className:"text-xs text-red-500 mt-1",children:"ID already exists"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Level"}),c.jsx("div",{className:"flex gap-2",children:Hj.map(de=>c.jsx("button",{onClick:()=>k(de.value),className:`flex-1 p-2 text-xs font-semibold rounded-lg border cursor-pointer transition-colors ${v===de.value?"border-green-600 bg-green-900/30 text-green-400":"border-white/10 text-white/50 hover:border-white/20"}`,children:de.label},de.value))})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Reports To"}),c.jsxs("select",{value:S,onChange:de=>N(de.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:[c.jsx("option",{value:"ceo",className:"bg-[var(--wall)] text-white",children:"CEO"}),t.map(de=>c.jsxs("option",{value:de.id,className:"bg-[var(--wall)] text-white",children:[de.name," (",de.id,")"]},de.id))]})]})]}),u===2&&c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Persona"}),c.jsx("textarea",{ref:z,value:E,onChange:de=>_(de.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"}),c.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&&c.jsxs("div",{children:[c.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Skills"}),c.jsx("div",{className:"space-y-1.5 max-h-[120px] overflow-y-auto",children:ee.map(de=>c.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:[c.jsx("input",{type:"checkbox",checked:Y.has(de.id),onChange:()=>I(Ee=>{const nt=new Set(Ee);return nt.has(de.id)?nt.delete(de.id):nt.add(de.id),nt}),className:"accent-green-600"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("div",{className:"text-xs font-semibold text-white/80",children:de.name}),c.jsx("div",{className:"text-[10px] text-white/40 truncate",children:de.description})]})]},de.id))})]})]}),u===3&&c.jsx("div",{className:"customize-body",style:{padding:0},children:c.jsx(qy,{roleId:"default",appearance:H,onChange:B,onRandomize:()=>B(ls()),onReset:()=>B(ls()),label:c.jsxs("span",{children:[h||"new-role"," — ",m||"New Role"]})})}),u===4&&c.jsxs("div",{className:"space-y-3",children:[c.jsx("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Review"}),c.jsxs("div",{className:"bg-white/5 rounded-xl p-4 border border-white/10",children:[c.jsxs("div",{className:"flex gap-4",children:[c.jsx("div",{className:"flex-shrink-0 rounded-lg overflow-hidden",style:{background:"#0d1117",padding:8},children:c.jsx(yc,{roleId:"default",appearance:H,scale:4})}),c.jsxs("div",{className:"flex-1 space-y-2.5",children:[c.jsx(es,{label:"Name",value:m}),c.jsx(es,{label:"ID",value:h,mono:!0}),c.jsx(es,{label:"Level",value:v}),c.jsx(es,{label:"Reports To",value:S}),Y.size>0&&c.jsx(es,{label:"Skills",value:[...Y].join(", ")})]})]}),c.jsxs("div",{className:"pt-3 mt-3 border-t border-white/10",children:[c.jsx("div",{className:"text-[10px] text-white/30 uppercase tracking-wider mb-1",children:"Persona"}),c.jsx("div",{className:"text-xs text-white/60 leading-relaxed",children:E})]})]}),X&&c.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 p-2 rounded-lg border border-red-800/30",children:X})]})]}):c.jsxs(c.Fragment,{children:[L==="input"&&c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Roles (one per line)"}),c.jsx("textarea",{ref:M,value:ne,onChange:de=>le(de.target.value),placeholder:`Name, Level, ReportsTo
|
|
82
|
+
e.g.
|
|
83
|
+
Data Analyst
|
|
84
|
+
DevOps Engineer, member, cto
|
|
85
|
+
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"}),c.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."})]}),A.length>0&&c.jsxs("div",{children:[c.jsxs("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:["Preview (",A.length," role",A.length!==1?"s":"",")"]}),c.jsx("div",{className:"bg-white/5 rounded-lg border border-white/10 overflow-hidden",children:c.jsxs("table",{className:"w-full text-xs",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"border-b border-white/10",children:[c.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Name"}),c.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"ID"}),c.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Level"}),c.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Reports To"})]})}),c.jsx("tbody",{children:A.map((de,Ee)=>c.jsxs("tr",{className:`border-b border-white/5 ${de.error?"bg-red-900/10":""}`,children:[c.jsx("td",{className:"p-2 text-white/80",children:de.name}),c.jsx("td",{className:"p-2 text-white/60 font-mono",children:de.id}),c.jsx("td",{className:"p-2 text-white/60",children:de.level}),c.jsx("td",{className:"p-2 text-white/60",children:de.reportsTo}),de.error&&c.jsx("td",{className:"p-2 text-red-400 text-[10px]",children:de.error})]},Ee))})]})})]})]}),L==="review"&&c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:["Confirm Bulk Hire — ",A.length," roles"]}),c.jsx("div",{className:"bg-white/5 rounded-lg border border-white/10 overflow-hidden max-h-[300px] overflow-y-auto",children:c.jsxs("table",{className:"w-full text-xs",children:[c.jsx("thead",{className:"sticky top-0 bg-[var(--wall)]",children:c.jsxs("tr",{className:"border-b border-white/10",children:[c.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"#"}),c.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Name"}),c.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"ID"}),c.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Level"}),c.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Reports To"})]})}),c.jsx("tbody",{children:A.map((de,Ee)=>c.jsxs("tr",{className:"border-b border-white/5",children:[c.jsx("td",{className:"p-2 text-white/30",children:Ee+1}),c.jsx("td",{className:"p-2 text-white/80",children:de.name}),c.jsx("td",{className:"p-2 text-white/60 font-mono",children:de.id}),c.jsx("td",{className:"p-2 text-white/60",children:de.level}),c.jsx("td",{className:"p-2 text-white/60",children:de.reportsTo})]},Ee))})]})}),$&&V.total>0&&c.jsxs("div",{children:[c.jsxs("div",{className:"flex justify-between text-[10px] text-white/40 mb-1",children:[c.jsx("span",{children:"Hiring..."}),c.jsxs("span",{children:[V.done,"/",V.total]})]}),c.jsx("div",{className:"h-1.5 bg-white/10 rounded-full overflow-hidden",children:c.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${V.done/V.total*100}%`,background:"#2E7D32"}})})]}),c.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."}),X&&c.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 p-2 rounded-lg border border-red-800/30",children:X})]})]})}),c.jsxs("div",{className:"flex justify-between px-5 pb-5",children:[c.jsxs("div",{children:[i==="single"&&u>1&&c.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"&&L==="review"&&c.jsx("button",{onClick:()=>F("input"),disabled:$,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"})]}),c.jsxs("div",{className:"flex gap-3",children:[c.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<Pi?c.jsx("button",{onClick:()=>f(u+1),disabled:!Be(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"}):c.jsx("button",{onClick:Oe,disabled:$,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:$?"Hiring...":"HIRE"}):L==="input"?c.jsxs("button",{onClick:()=>F("review"),disabled:!oe,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 (",A.length,")"]}):c.jsx("button",{onClick:me,disabled:$,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:$?`Hiring ${V.done}/${V.total}...`:`HIRE ALL (${A.length})`})]})]})]})]})}function es({label:t,value:l,mono:r}){return c.jsxs("div",{className:"flex justify-between text-sm",children:[c.jsx("span",{className:"text-white/40",children:t}),c.jsx("span",{className:`font-semibold text-white/80 ${r?"font-mono":""}`,children:l})]})}function Yj({roleId:t,roleName:l,onClose:r,onConfirm:i}){const[o,u]=j.useState(!1),f=async()=>{u(!0);try{await i(t)}finally{u(!1)}};return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:r}),c.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:[c.jsxs("div",{className:"p-5 text-white",style:{background:"linear-gradient(135deg, #B71C1C, #D32F2F)"},children:[c.jsx("div",{className:"text-lg font-bold",children:"Fire Role"}),c.jsxs("div",{className:"text-sm opacity-80 mt-0.5",children:["Remove ",l," (",t,")"]})]}),c.jsxs("div",{className:"p-5",children:[c.jsxs("div",{className:"p-4 rounded-lg border-2 border-red-300 bg-red-50 mb-4",children:[c.jsx("div",{className:"text-sm font-bold text-red-800 mb-1",children:"Warning"}),c.jsxs("div",{className:"text-xs text-red-700 leading-relaxed",children:["This will permanently delete the role directory including",c.jsx("strong",{children:" role.yaml"}),", ",c.jsx("strong",{children:"profile.md"}),", ",c.jsx("strong",{children:"SKILL.md"}),", and all journal entries. This action cannot be undone."]})]}),c.jsxs("div",{className:"text-sm text-gray-600",children:["Are you sure you want to fire ",c.jsx("strong",{children:l}),"?"]})]}),c.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[c.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"}),c.jsx("button",{onClick:f,disabled:o,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:o?"Removing...":"Confirm Fire"})]})]})]})}const qj={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"};function Xj({roleId:t,title:l,roleColor:r,active:i,onClick:o,onClose:u,"data-session-id":f}){return c.jsxs("button",{onClick:o,"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:[c.jsx("span",{className:"text-xs",children:qj[t]??"👤"}),c.jsx("span",{className:"truncate",children:l}),c.jsx("span",{onClick:u,className:"ml-auto text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-sm leading-none",children:"×"})]})}function Vj({content:t,streaming:l}){let r=t;return l&&(t.match(/```/g)??[]).length%2!==0&&(r+="\n```"),c.jsx("div",{className:"terminal-markdown",children:c.jsx(ey,{remarkPlugins:[jy],components:{code:Gj,table:({children:i})=>c.jsx("div",{className:"overflow-x-auto my-2",children:c.jsx("table",{className:"terminal-table",children:i})})},children:r})})}function Gj({className:t,children:l,...r}){const i=/language-(\w+)/.exec(t??"");return i||typeof l=="string"&&l.includes(`
|
|
86
|
+
`)?c.jsx(Kj,{language:i==null?void 0:i[1],children:l}):c.jsx("code",{className:"terminal-inline-code",...r,children:l})}function Kj({children:t,language:l}){const[r,i]=j.useState(!1),o=String(t).replace(/\n$/,""),u=()=>{navigator.clipboard.writeText(o),i(!0),setTimeout(()=>i(!1),1500)};return c.jsxs("div",{className:"terminal-code-block group relative my-2",children:[l&&c.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] px-3 pt-1.5",children:l}),c.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"}),c.jsx("pre",{className:"overflow-x-auto p-3 text-xs leading-relaxed",children:c.jsx("code",{children:o})})]})}const Qj={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"};function id(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 Zj(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:id(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 o=l.length>0?l[l.length-1]:null;(o==null?void 0:o.type)==="dispatch:progress"&&o.roleId===i.roleId?i.progressType==="tool"?(o.toolName=i.toolName,o.toolSummary=id(i.toolName??"",i.toolInput),o.progressType="tool"):i.progressType==="thinking"?(o.text=i.text,o.progressType="thinking"):i.progressType==="text"?(o.text=i.text,o.progressType="text"):(i.progressType==="done"||i.progressType==="error")&&(o.progressType=i.progressType):l.push({type:"dispatch:progress",roleId:i.roleId,progressType:i.progressType,text:i.text,toolName:i.toolName,toolSummary:i.toolName?id(i.toolName,i.toolInput):void 0})}if(r){const i=l.filter(o=>o.type==="thinking");i.length>0&&(i[i.length-1].text=r)}return l}function Wj({event:t,isStreaming:l}){var o,u,f;const[r,i]=j.useState(!1);switch(t.type){case"thinking":return c.jsxs("div",{className:"stream-event-thinking",children:[c.jsxs("div",{className:"stream-event-thinking-header",onClick:()=>i(!r),children:[c.jsx("span",{className:"stream-event-thinking-icon"}),c.jsxs("span",{className:"stream-event-thinking-label",children:["thinking",l?"...":""]}),t.text&&!l&&c.jsx("span",{className:"stream-event-thinking-toggle",children:r?"▾":"▸"})]}),(l||r)&&t.text&&c.jsx("div",{className:"stream-event-thinking-content",children:t.text.slice(-500)})]});case"tool":return c.jsxs("div",{className:"stream-event-tool",children:[c.jsx("span",{className:"stream-event-tool-badge",children:t.toolName}),t.toolSummary&&c.jsx("span",{className:"stream-event-tool-path",children:t.toolSummary}),t.toolInput&&c.jsx("span",{className:"stream-event-tool-toggle",onClick:()=>i(!r),children:r?"▾":"▸"}),r&&t.toolInput&&c.jsx("div",{className:"stream-event-tool-detail",children:JSON.stringify(t.toolInput,null,1).slice(0,300)})]});case"dispatch":return c.jsxs("div",{className:"stream-event-dispatch",children:[c.jsxs("span",{className:"stream-event-dispatch-badge",children:["→"," ",(o=t.roleId)==null?void 0:o.toUpperCase()]}),c.jsx("span",{className:"stream-event-dispatch-task",children:(u=t.task)==null?void 0:u.slice(0,80)})]});case"dispatch:progress":return c.jsxs("div",{className:"stream-event-dispatch-progress",children:[c.jsx("span",{className:"stream-event-dispatch-progress-role",children:(f=t.roleId)==null?void 0:f.toUpperCase()}),t.progressType==="thinking"&&c.jsxs("span",{className:"stream-event-dispatch-progress-status",children:["thinking",l?"...":""]}),t.progressType==="tool"&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"stream-event-tool-badge",children:t.toolName}),t.toolSummary&&c.jsx("span",{className:"stream-event-tool-path",children:t.toolSummary})]}),t.progressType==="text"&&t.text&&c.jsx("span",{className:"stream-event-dispatch-progress-status",children:"responding..."}),t.progressType==="done"&&c.jsx("span",{className:"stream-event-dispatch-progress-done",children:"done"}),t.progressType==="error"&&c.jsx("span",{className:"stream-event-dispatch-progress-error",children:"error"})]});default:return null}}function Jj({events:t,isStreaming:l}){const[r,i]=j.useState(!1);if(t.length===0)return null;const o=Zj(t);if(o.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),h=[];if(u>0&&h.push("thinking"),f.length>0){const b=[...new Set(f.map(v=>v.toolName))];b.length<=3?h.push(b.join(", ")):h.push(`${f.length} tool calls`)}m.length>0&&h.push(`${m.length} dispatch`),p>1&&h.push(`${p} turns`);const g=h.join(" · "),y=!r;return c.jsxs("div",{className:"stream-activity-log",children:[c.jsxs("div",{className:"stream-activity-header",onClick:()=>i(!r),children:[l&&c.jsx("span",{className:"stream-activity-pulse"}),c.jsxs("span",{className:"stream-activity-summary",children:[r?"▸":"▾"," ",g,l?"...":""]})]}),y&&c.jsx("div",{className:"stream-activity-events",children:o.map((b,v)=>c.jsx(Wj,{event:b,isStreaming:l&&v===o.length-1},v))})]})}function Pj({message:t,roleId:l,roleColor:r}){var h;const i=t.from==="ceo",o=t.type==="system",u=t.status==="streaming";if(o)return c.jsx("div",{className:"flex justify-center my-2",children:c.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 c.jsx("div",{className:"flex justify-end mb-3",children:c.jsxs("div",{className:"max-w-[85%]",children:[c.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] text-right mb-1",children:"CEO"}),c.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"&&c.jsx("span",{className:"text-amber-400 text-[10px] font-bold mr-1.5",children:"DO"}),t.content]})]})});const f=(((h=t.streamEvents)==null?void 0:h.length)??0)>0,m=!!t.thinking,p=m&&!t.content&&u&&!f;return c.jsxs("div",{className:"flex gap-2.5 mb-3",children:[c.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:Qj[l]??"👤"}),c.jsxs("div",{className:"max-w-[85%] min-w-0",children:[c.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] mb-1",children:l.toUpperCase()}),f&&c.jsx(Jj,{events:t.streamEvents,isStreaming:u}),m&&!f&&c.jsxs("details",{open:p,className:"mb-1",children:[c.jsxs("summary",{className:"text-[10px] text-purple-400/70 cursor-pointer select-none flex items-center gap-1",children:[p&&c.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-purple-400 animate-pulse"}),"thinking",p?"...":` (${t.thinking.length} chars)`]}),c.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)})]}),c.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?c.jsx(Vj,{content:t.content,streaming:u}):u&&!m?c.jsx("span",{className:"inline-block w-2 h-4 bg-[var(--terminal-text-secondary)] animate-pulse"}):u&&m?c.jsx("span",{className:"text-[11px] text-purple-400/50 italic",children:"analyzing..."}):null,u&&t.content&&c.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"&&c.jsx("div",{className:"text-[10px] text-red-400 mt-1",children:"Error occurred"})]})]})}function eE({messages:t,roleId:l,roleColor:r}){var o;const i=j.useRef(null);return j.useEffect(()=>{var u;(u=i.current)==null||u.scrollIntoView({behavior:"smooth"})},[t,(o=t[t.length-1])==null?void 0:o.content]),t.length===0?c.jsxs("div",{className:"flex-1 flex items-center justify-center text-[var(--terminal-text-muted)] text-sm",children:["Start a conversation with ",l.toUpperCase()]}):c.jsxs("div",{className:"flex-1 overflow-y-auto p-4 terminal-scrollbar",children:[t.map(u=>c.jsx(Pj,{message:u,roleId:l,roleColor:r},u.id)),c.jsx("div",{ref:i})]})}function tE({mode:t,onModeChange:l,onSend:r,disabled:i,disabledReason:o}){const[u,f]=j.useState(""),m=j.useRef(null);j.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(""))},h=g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),p())};return c.jsxs("div",{className:"border-t border-[var(--terminal-border)] p-3 shrink-0",children:[o&&c.jsx("div",{className:"text-[10px] text-amber-400/70 mb-2 text-center",children:o}),c.jsxs("div",{className:"flex items-end gap-2",children:[c.jsxs("div",{className:"flex rounded-lg overflow-hidden border border-[var(--terminal-border)] shrink-0",children:[c.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"}),c.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"})]}),c.jsx("textarea",{ref:m,value:u,onChange:g=>f(g.target.value),onKeyDown:h,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"}),c.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:c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[c.jsx("path",{d:"M22 2L11 13"}),c.jsx("path",{d:"M22 2L15 22L11 13L2 9L22 2Z"})]})})]})]})}const nE={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},Vy={cto:"CTO",cbo:"CBO",pm:"PM",engineer:"Engineer",designer:"Designer",qa:"QA","data-analyst":"Data Analyst"};function r0(t){return new Date(t).toLocaleTimeString("ko-KR",{hour:"2-digit",minute:"2-digit"})}function lE({msg:t}){const l=nE[t.roleId]??"#888",r=Vy[t.roleId]??t.roleId;if(t.type==="dispatch"){const i=t.text.includes("WAVE"),o=t.text.includes("completed")||t.text.includes("완료"),u=i?"📡":o?"✓":"→",f=o?"text-green-400/70":"text-[var(--terminal-text-muted)]";return c.jsxs("div",{className:"flex items-start gap-2 px-3 py-1 hover:bg-white/[0.02]",children:[c.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)] shrink-0 w-10 text-right mt-0.5",children:r0(t.ts)}),c.jsx("span",{className:"text-[10px] shrink-0 mt-0.5",children:u}),c.jsx("span",{className:`text-[11px] ${f}`,children:t.text})]})}return c.jsxs("div",{className:"flex items-start gap-2 px-3 py-1.5 hover:bg-white/[0.02]",children:[c.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)] shrink-0 w-10 text-right mt-0.5",children:r0(t.ts)}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("span",{className:"text-[11px] font-semibold mr-1.5",style:{color:l},children:r}),c.jsx("span",{className:"text-xs text-[var(--terminal-text-secondary)]",children:t.text})]})]})}function aE({channel:t,allRoles:l,onUpdateMembers:r,onUpdateTopic:i}){const o=j.useRef(null),u=j.useRef(null);j.useEffect(()=>{var k;const b=u.current;if(!b)return;b.scrollHeight-b.scrollTop-b.clientHeight<80&&((k=o.current)==null||k.scrollIntoView({behavior:"smooth"}))},[t.messages.length]);const[f,m]=j.useState(!1),[p,h]=j.useState(!1),[g,y]=j.useState("");return c.jsxs("div",{ref:u,className:"flex-1 overflow-y-auto terminal-scrollbar py-2",children:[c.jsxs("div",{className:"px-3 py-2 mb-2 border-b border-[var(--terminal-border)] flex items-center gap-2",children:[c.jsx("span",{className:"text-sm font-semibold text-[var(--terminal-text)]",children:t.name}),t.members.length>0&&c.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:t.members.map(b=>Vy[b]??b).join(", ")}),t.members.length===0&&c.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:t.isDefault?"system logs":"no members"}),!t.isDefault&&l&&r&&c.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&&c.jsx("div",{className:"px-3 pb-2 mb-1",children:p?c.jsx("input",{autoFocus:!0,value:g,onChange:b=>y(b.target.value),onKeyDown:b=>{b.key==="Enter"&&(i(t.id,g.trim()),h(!1)),b.key==="Escape"&&h(!1)},onBlur:()=>{i(t.id,g.trim()),h(!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"}):c.jsx("button",{onClick:()=>{y(t.topic??""),h(!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&&c.jsx("div",{className:"px-3 pb-2 mb-2 border-b border-[var(--terminal-border)]",children:c.jsx("div",{className:"flex flex-wrap gap-1",children:l.map(b=>{const v=t.members.includes(b.id);return c.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 k=v?t.members.filter(S=>S!==b.id):[...t.members,b.id];r(t.id,k)},children:[v?"✓ ":"",b.name]},b.id)})})}),t.messages.length===0&&c.jsx("div",{className:"flex-1 flex flex-col items-center justify-center text-[var(--terminal-text-muted)] text-xs gap-1 py-8",children:c.jsx("span",{children:t.isDefault?"No dispatch events yet":"No messages yet — invite roles to start chatting"})}),t.messages.map(b=>c.jsx(lE,{msg:b},b.id)),c.jsx("div",{ref:o})]})}const sd={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"},rE=400,iE=800;function sE({sessions:t,activeSessionId:l,roles:r,streamingSessionId:i,width:o,onWidthChange:u,onSwitchSession:f,onCloseSession:m,onCreateSession:p,onClearEmpty:h,onCloseAll:g,onSendMessage:y,onModeChange:b,onCloseTerminal:v,chatChannels:k,activeChatChannelId:S,onSwitchChatChannel:N,onCreateChatChannel:E,onDeleteChatChannel:_,onUpdateChatMembers:H,onUpdateChatTopic:B,unreadChannels:$}){const[T,X]=j.useState(!1),[G,ee]=j.useState(!1),[D,Y]=j.useState(!1),[I,ne]=j.useState(""),le=S!=null,L=k==null?void 0:k.find(me=>me.id===S),[F,V]=j.useState(!1),[P,fe]=j.useState(!1),[z,M]=j.useState(!1),K=j.useRef(0),A=j.useRef(0),oe=j.useRef(null),be=t.find(me=>me.id===l),ve=i===l,Ne=t.filter(me=>me.messages.length===0).length,Oe=j.useCallback(()=>{const me=oe.current;me&&(fe(me.scrollLeft>0),M(me.scrollLeft+me.clientWidth<me.scrollWidth-1))},[]);j.useEffect(()=>{if(!l||!oe.current)return;const me=oe.current.querySelector(`[data-session-id="${l}"]`);me&&me.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"}),Oe()},[l,t.length,Oe]),j.useEffect(()=>{const me=oe.current;if(!me)return;Oe(),me.addEventListener("scroll",Oe);const Ve=new ResizeObserver(Oe);return Ve.observe(me),()=>{me.removeEventListener("scroll",Oe),Ve.disconnect()}},[Oe]);const Be=j.useCallback(me=>{me.preventDefault(),K.current=me.clientX,A.current=o,V(!0);const Ve=de=>{const Ee=K.current-de.clientX,nt=Math.min(iE,Math.max(rE,A.current+Ee));u==null||u(nt)},Ge=()=>{V(!1),document.removeEventListener("mousemove",Ve),document.removeEventListener("mouseup",Ge)};document.addEventListener("mousemove",Ve),document.addEventListener("mouseup",Ge)},[o,u]);return c.jsxs("div",{className:"shrink-0 bg-[var(--terminal-bg)] border-l border-[var(--terminal-border)] flex flex-col h-full relative",style:{width:o},children:[u&&c.jsx("div",{className:`terminal-resize-handle absolute top-0 left-0 w-1 h-full cursor-col-resize z-10 transition-colors ${F?"bg-[var(--terminal-border-hover)]":"bg-transparent"}`,onMouseDown:Be}),c.jsxs("div",{className:"flex items-center bg-[var(--terminal-bg-deeper)] border-b border-[var(--terminal-border)] shrink-0",children:[c.jsxs("div",{className:"relative flex-1 min-w-0",children:[P&&c.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"}),c.jsxs("div",{ref:oe,className:"flex items-center overflow-x-auto terminal-tab-scroll gap-px px-1 py-1",children:[k==null?void 0:k.map(me=>c.jsxs("button",{onClick:()=>{N==null||N(me.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===me.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===me.id?{borderTop:"2px solid #4CAF50"}:void 0,children:[c.jsx("span",{className:"text-[10px]",children:"💬"}),c.jsx("span",{className:"truncate",children:me.name}),($==null?void 0:$.has(me.id))&&S!==me.id&&c.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-400 shrink-0"}),!me.isDefault&&c.jsx("span",{onClick:Ve=>{Ve.stopPropagation(),_==null||_(me.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:"×"})]},me.id)),k&&k.length>0&&t.length>0&&c.jsx("div",{className:"w-px h-4 bg-[var(--terminal-border)] shrink-0 mx-1"}),t.map(me=>c.jsx(Xj,{roleId:me.roleId,title:me.title,roleColor:sd[me.roleId]??"#666",active:!le&&me.id===l,onClick:()=>{N==null||N(null),f(me.id)},onClose:Ve=>{Ve.stopPropagation(),m(me.id)},"data-session-id":me.id},me.id))]}),z&&c.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"})]}),c.jsxs("div",{className:"relative shrink-0",children:[c.jsx("button",{onClick:()=>{X(!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&&c.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&&c.jsxs(c.Fragment,{children:[D?c.jsxs("div",{className:"px-3 py-2 flex items-center gap-1",children:[c.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:"#"}),c.jsx("input",{autoFocus:!0,value:I,onChange:me=>ne(me.target.value),onKeyDown:me=>{me.key==="Enter"&&I.trim()&&(E(I.trim(),[]),ne(""),Y(!1),X(!1)),me.key==="Escape"&&(Y(!1),ne(""))},placeholder:"channel name",className:"flex-1 bg-transparent text-xs text-[var(--terminal-text)] outline-none border-b border-[var(--terminal-border)]"})]}):c.jsxs("button",{onClick:()=>Y(!0),className:"w-full text-left px-3 py-2 text-xs text-[var(--terminal-text-secondary)] hover:bg-[var(--terminal-surface-light)] cursor-pointer flex items-center gap-2",children:[c.jsx("span",{className:"text-[10px]",children:"💬"}),"New Channel"]}),c.jsx("div",{className:"border-b border-[var(--terminal-border)] my-1"})]}),r.map(me=>c.jsxs("button",{onClick:()=>{p(me.id),N==null||N(null),X(!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:[c.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:sd[me.id]??"#666"}}),me.id.toUpperCase()," — ",me.name]},me.id))]})]}),c.jsxs("div",{className:"relative shrink-0",children:[c.jsx("button",{onClick:()=>{ee(!G),X(!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:"···"}),G&&c.jsxs("div",{className:"absolute top-full right-0 mt-1 bg-[var(--terminal-surface)] border border-[var(--terminal-border)] rounded-lg shadow-xl z-50 py-1 min-w-[200px]",children:[c.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":""]}),Ne>0&&h&&c.jsxs("button",{onClick:()=>{h(),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 (",Ne,")"]}),t.length>0&&g&&c.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&&c.jsx("div",{className:"px-3 py-2 text-xs text-[var(--terminal-text-muted)]",children:"No sessions"})]})]}),c.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:"×"})]}),le&&L?c.jsx(aE,{channel:L,allRoles:r,onUpdateMembers:H,onUpdateTopic:B}):be?c.jsxs(c.Fragment,{children:[c.jsx(eE,{messages:be.messages,roleId:be.roleId,roleColor:sd[be.roleId]??"#666"}),c.jsx(tE,{mode:be.mode,onModeChange:me=>b(be.id,me),onSend:me=>y(be.id,me,be.mode),disabled:ve,disabledReason:ve?`${be.roleId.toUpperCase()} is responding...`:void 0})]}):c.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 oE(){const t=j.useRef(null),l=j.useCallback(()=>{var i;(i=t.current)==null||i.abort(),t.current=null},[]);return{sendMessage:j.useCallback((i,o,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:o,mode:u}),signal:m.signal}).then(async p=>{var b,v,k,S,N;if(!p.ok||!p.body){f.onError("Failed to connect");return}const h=p.body.getReader(),g=new TextDecoder;let y="";for(;;){const{done:E,value:_}=await h.read();if(E)break;y+=g.decode(_,{stream:!0});const H=y.split(`
|
|
87
|
+
`);y=H.pop()??"";let B="";for(let $=0;$<H.length;$++){const T=H[$];if(T.startsWith("event: ")){B=T.slice(7).trim();continue}if(T.startsWith("data: ")){let X;try{X=JSON.parse(T.slice(6))}catch{B="";continue}switch(B){case"thinking":X.text&&((b=f.onThinking)==null||b.call(f,X.text));break;case"output":X.text&&f.onText(X.text);break;case"tool":(v=f.onToolUse)==null||v.call(f,X.name,X.input);break;case"dispatch":(k=f.onDispatch)==null||k.call(f,X.roleId,X.task);break;case"dispatch:progress":(S=f.onDispatchProgress)==null||S.call(f,X.roleId,X.type,X);break;case"turn":(N=f.onTurn)==null||N.call(f,X.turn);break;case"done":f.onDone(X);break;case"error":f.onError(X.message??"Unknown error");break;default:X.text&&f.onText(X.text);break}B=""}}}}).catch(p=>{p.name!=="AbortError"&&f.onError(p.message)}),{abort:l}},[l]),abort:l}}const ah="tycono-appearances",cc="tycono-theme";(()=>{try{for(const[t,l]of[["the-company-appearances",ah],["the-company-theme",cc]]){const r=localStorage.getItem(t);r&&!localStorage.getItem(l)&&(localStorage.setItem(l,r),localStorage.removeItem(t))}}catch{}})();function i0(){try{const t=localStorage.getItem(ah);return t?JSON.parse(t):{}}catch{return{}}}function od(t){localStorage.setItem(ah,JSON.stringify(t))}function s0(){try{const t=localStorage.getItem(cc);if(t&&t in Sa)return t}catch{}return"default"}function cE(t){var i;const l=(i=Sa[t])==null?void 0:i.vars;if(!l)return;const r=document.documentElement;for(const[o,u]of Object.entries(l))r.style.setProperty(o,u)}const cd={mode:"auto",intervalSec:18,dailyBudgetUsd:1},zd="tycono-speech-settings",ud="tycono-language";function uE(){try{const t=localStorage.getItem(zd);return t?{...cd,...JSON.parse(t)}:cd}catch{return cd}}function fE(){const[t,l]=j.useState(i0),[r,i]=j.useState(s0),[o,u]=j.useState(uE),[f,m]=j.useState(()=>{try{return localStorage.getItem(ud)??"auto"}catch{return"auto"}}),p=j.useRef(!1);j.useEffect(()=>{p.current||(p.current=!0,Ce.getPreferences().then(S=>{const N=Object.keys(S.appearances??{}).length>0||S.theme!=="default";if(S.speech&&(u(E=>({...E,...S.speech})),localStorage.setItem(zd,JSON.stringify(S.speech))),S.language&&(m(S.language),localStorage.setItem(ud,S.language)),N){const E=S.appearances;l(E),od(E),S.theme&&S.theme in Sa&&(i(S.theme),localStorage.setItem(cc,S.theme))}else{const E=i0(),_=s0();(Object.keys(E).length>0||_!=="default")&&Ce.updatePreferences({appearances:E,theme:_}).catch(()=>{})}}).catch(()=>{}))},[]),j.useEffect(()=>{cE(r)},[r]);const h=j.useCallback(S=>t[S]??lh(S),[t]),g=j.useCallback((S,N)=>{l(E=>{const _={...E,[S]:N};return od(_),Ce.updatePreferences({appearances:_}).catch(()=>{}),_})},[]),y=j.useCallback(S=>{l(N=>{const E={...N};return delete E[S],od(E),Ce.updatePreferences({appearances:E}).catch(()=>{}),E})},[]),b=j.useCallback(S=>{i(S),localStorage.setItem(cc,S),Ce.updatePreferences({theme:S}).catch(()=>{})},[]),v=j.useCallback(S=>{u(N=>{const E={...N,...S};return localStorage.setItem(zd,JSON.stringify(E)),Ce.updatePreferences({speech:E}).catch(()=>{}),E})},[]),k=j.useCallback(S=>{m(S),localStorage.setItem(ud,S),Ce.updatePreferences({language:S}).catch(()=>{})},[]);return{appearances:t,getAppearance:h,setAppearance:g,resetAppearance:y,theme:r,setTheme:b,speechSettings:o,setSpeechSettings:v,language:f,setLanguage:k}}const dE=3e4;function hE(){var v;const[t,l]=j.useState(null),[r,i]=j.useState("synced"),[o,u]=j.useState([]),f=j.useRef(null),m=j.useCallback(async()=>{try{const k=await Ce.getSaveStatus();l(k),k.noGit?i("no-git"):i(S=>S==="saving"?S:k.dirty?"dirty":"synced")}catch{i("error")}},[]);j.useEffect(()=>(m(),f.current=setInterval(m,dE),()=>{f.current&&clearInterval(f.current)}),[m]);const p=j.useCallback(async k=>{i("saving");try{const S=await Ce.save(k);return await m(),S}catch(S){throw i("error"),S}},[m]),h=j.useCallback(async()=>{try{const k=await Ce.getSaveHistory(20);u(k)}catch{}},[]),g=j.useCallback(async k=>{i("saving");try{await Ce.restoreSave(k),await m()}catch(S){throw i("error"),S}},[m]),y=t?t.modified.length+t.untracked.length:0,b=((v=t==null?void 0:t.lastCommit)==null?void 0:v.date)??null;return{state:r,dirtyCount:y,lastSaved:b,status:t,save:p,history:o,loadHistory:h,restore:g,refresh:m}}const o0={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."]},c0={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."]},mE=[{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."}]}],xE=18e3,u0=6e3,pE=2500,yE=30*6e4,Gy="tycono:relationships";function gE(){try{const t=localStorage.getItem(Gy);return t?JSON.parse(t):[]}catch{return[]}}function bE(t){localStorage.setItem(Gy,JSON.stringify(t))}function Io(t,l,r){const[i,o]=l<r?[l,r]:[r,l];let u=t.find(f=>f.roleA===i&&f.roleB===o);return u||(u={roleA:i,roleB:o,dispatches:0,wavesTogether:0,conversations:0,familiarity:0,lastInteraction:new Date().toISOString()},t.push(u)),u}function Yo(t){return Math.min(100,t.dispatches*5+t.wavesTogether*10+t.conversations*2)}function qo(t){return t[Math.floor(Math.random()*t.length)]}function vE(t,l,r){const i=r.find(m=>m.id===t),o=r.find(m=>m.id===l);if(!i||!o)return null;const u=i.level==="c-level",f=o.level==="c-level";return u&&f?"c-level":i.reportsTo===l||o.reportsTo===t?"superior-subordinate":(i.reportsTo===o.reportsTo,"peer")}function wE(t,l){return t.relation==="any"?!0:t.relation===l}function kE({roles:t,roleStatuses:l,activeExecs:r,getStandupSpeech:i}){const[o,u]=j.useState(new Map),[f,m]=j.useState(gE),p=j.useRef({}),h=j.useRef(null),g=j.useRef(t),y=j.useRef(l),b=j.useRef(r),v=j.useRef(i),k=j.useRef(f);g.current=t,y.current=l,b.current=r,v.current=i,k.current=f,j.useEffect(()=>{const B=Date.now();for(const[$,T]of Object.entries(l))T==="working"&&(p.current[$]=B)},[l]),j.useEffect(()=>{bE(f)},[f]);const S=j.useCallback(B=>{const $=y.current[B],T=b.current.find(Y=>Y.roleId===B);if($==="working"&&(T!=null&&T.task))return null;const X=v.current(B);if(X&&Math.random()<.3)return{text:X,type:"work",ts:Date.now()};const G=Date.now(),ee=p.current[B]??0;if(G-ee>yE&&Math.random()<.5){const Y=c0[B]??c0.engineer;return{text:qo(Y),type:"guilt",ts:G}}const D=o0[B]??o0.engineer;return{text:qo(D),type:"personality",ts:G}},[]),N=j.useCallback(B=>{if(h.current)return!1;const $=B.filter(V=>y.current[V.id]!=="working");if($.length<2)return!1;const T=[...$].sort(()=>Math.random()-.5),X=T[0],G=T[1],ee=vE(X.id,G.id,B);if(!ee)return!1;const D=Io(k.current,X.id,G.id),Y=Yo(D),I=mE.filter(V=>wE(V,ee)&&Y>=V.minFamiliarity);if(I.length===0)return!1;const ne=qo(I);let le=X.id,L=G.id;ne.relation==="superior-subordinate"&&(G.reportsTo===X.id||X.level==="c-level"?(le=X.id,L=G.id):(le=G.id,L=X.id)),h.current={templateId:ne.id,roleA:le,roleB:L,turnIdx:0,timer:null};const F=V=>{if(!h.current||V>=ne.turns.length){h.current=null,m(M=>{const K=[...M],A=Io(K,le,L);return A.conversations++,A.familiarity=Yo(A),A.lastInteraction=new Date().toISOString(),K}),setTimeout(()=>{u(M=>{const K=new Map(M);return K.delete(le),K.delete(L),K})},u0);return}const P=ne.turns[V],fe=P.speaker==="A"?le:L,z=P.speaker==="A"?L:le;u(M=>{const K=new Map(M);if(K.set(fe,{text:P.text,type:"social",partnerId:z,ts:Date.now()}),V>0){const A=ne.turns[V-1].speaker==="A"?le:L;A!==fe&&K.delete(A)}return K}),h.current.turnIdx=V,h.current.timer=setTimeout(()=>F(V+1),pE)};return F(0),!0},[]);j.useEffect(()=>{const B=setInterval(()=>{const $=g.current;if($.length===0||h.current||Math.random()<.35&&N($))return;const T=$.filter(ee=>y.current[ee.id]!=="working");if(T.length===0)return;const X=qo(T),G=S(X.id);G&&(u(ee=>{const D=new Map(ee);return D.set(X.id,G),D}),setTimeout(()=>{u(ee=>{const D=new Map(ee),Y=D.get(X.id);return Y&&Y.ts===G.ts&&D.delete(X.id),D})},u0))},xE);return()=>{var $;clearInterval(B),($=h.current)!=null&&$.timer&&clearTimeout(h.current.timer)}},[S,N]);const E=j.useCallback(B=>{const $=o.get(B);return($==null?void 0:$.text)??""},[o]),_=j.useCallback((B,$)=>{m(T=>{const X=[...T],G=Io(X,B,$);return G.dispatches++,G.familiarity=Yo(G),G.lastInteraction=new Date().toISOString(),X})},[]),H=j.useCallback(B=>{B.length<2||m($=>{const T=[...$];for(let X=0;X<B.length;X++)for(let G=X+1;G<B.length;G++){const ee=Io(T,B[X],B[G]);ee.wavesTogether++,ee.familiarity=Yo(ee),ee.lastInteraction=new Date().toISOString()}return T})},[]);return{speeches:o,getSpeech:E,relationships:f,notifyDispatch:_,notifyWave:H}}const Ky="tycono:office-chat";let SE=0;function jE(){return`chat-${Date.now()}-${++SE}`}function fd(){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 EE(){try{const t=localStorage.getItem(Ky);if(t){const l=JSON.parse(t);if(l.find(i=>i.id==="office")&&!l.find(i=>i.id==="general")){const i=l.filter(o=>o.id!=="office");return[...fd(),...i]}const r=fd();for(const i of r)l.find(o=>o.id===i.id)||l.unshift(i);return l}}catch{}return fd()}function CE(t){const l=t.map(r=>({...r,messages:r.messages.slice(-200)}));localStorage.setItem(Ky,JSON.stringify(l))}function NE(){const[t,l]=j.useState(EE),[r,i]=j.useState(null),[o,u]=j.useState(new Set);j.useEffect(()=>{CE(t)},[t]);const f=j.useCallback(v=>{i(v),v&&u(k=>{const S=new Set(k);return S.delete(v),S})},[]),m=j.useCallback(v=>{const k={...v,id:jE()};l(S=>{const N=S.map(E=>E.id==="general"?v.type==="dispatch"?{...E,messages:[...E.messages,k].slice(-200)}:E:v.channelId?E.id===v.channelId?{...E,messages:[...E.messages,k].slice(-200)}:E:E.members.length>0&&E.members.includes(v.roleId)?{...E,messages:[...E.messages,k].slice(-200)}:E);return u(E=>{const _=new Set(E);for(const H of N){const B=S.find($=>$.id===H.id);B&&H.messages.length>B.messages.length&&_.add(H.id)}return _}),N})},[]),p=j.useCallback((v,k,S)=>{const N=`ch-${Date.now()}`,E={id:N,name:v.startsWith("#")?v:`#${v}`,members:k,isDefault:!1,messages:[],topic:S};l(_=>[..._,E]),i(N)},[]),h=j.useCallback(v=>{l(k=>k.filter(S=>S.id!==v||S.isDefault)),i(k=>k===v?"general":k)},[]),g=j.useCallback((v,k)=>{l(S=>S.map(N=>N.id===v&&!N.isDefault?{...N,members:k}:N))},[]),y=j.useCallback((v,k)=>{l(S=>S.map(N=>N.id===v&&!N.isDefault?{...N,topic:k||void 0}:N))},[]),b=j.useCallback(v=>{l(k=>k.map(S=>{if(S.id==="watercooler"){const N=v.filter(E=>E.level!=="c-level").map(E=>E.id);if(S.members.length!==N.length||!N.every(E=>S.members.includes(E)))return{...S,members:N}}return S}))},[]);return{channels:t,activeChannelId:r,setActiveChannelId:f,pushMessage:m,createChannel:p,deleteChannel:h,updateMembers:g,updateTopic:y,unreadChannels:o,syncDefaultMembers:b}}const AE=45e3,DE=3e3,TE=3,zE=20;function ME({roles:t,roleStatuses:l,activeExecs:r,channels:i,relationships:o,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=j.useRef(t),v=j.useRef(l),k=j.useRef(r),S=j.useRef(i),N=j.useRef(o),E=j.useRef(u),_=j.useRef(0),H=j.useRef(!1);b.current=t,v.current=l,k.current=r,S.current=i,N.current=o,E.current=u;const B=j.useCallback(async(T,X)=>{if(H.current)return!1;H.current=!0;try{if(!b.current.find(L=>L.id===T))return!1;const ee=X.messages.slice(-zE).map(L=>({roleId:L.roleId,text:L.text,ts:L.ts})),D=b.current.filter(L=>X.members.includes(L.id)),Y=N.current.filter(L=>L.roleA===T||L.roleB===T).map(L=>({partnerId:L.roleA===T?L.roleB:L.roleA,familiarity:L.familiarity})),I=k.current.find(L=>L.roleId===T),ne=I?{currentTask:I.task,taskProgress:null}:{currentTask:null,taskProgress:null},le=await Ce.chatInChannel({channelId:X.name.replace("#",""),channelTopic:X.topic,roleId:T,history:ee,members:D.map(L=>({id:L.id,name:L.name,level:L.level})),relationships:Y,workContext:ne});return le.message?(E.current({ts:Date.now(),roleId:T,text:le.message,type:"chat",channelId:X.id}),!0):!1}catch{return!1}finally{H.current=!1}},[]),$=j.useCallback(async(T,X)=>{if(_.current>=TE){_.current=0;return}const G=T.members.filter(D=>D!==X&&v.current[D]!=="working");if(G.length===0){_.current=0;return}const ee=G[Math.floor(Math.random()*G.length)];if(Math.random()>.6){_.current=0;return}setTimeout(async()=>{_.current++;const D=S.current.find(I=>I.id===T.id);if(!D)return;await B(ee,D)?$(D,ee):_.current=0},DE+Math.random()*2e3)},[B]);j.useEffect(()=>{if(!g)return;const T=setInterval(async()=>{const X=b.current;if(X.length===0||H.current)return;const G=X.filter(ne=>v.current[ne.id]!=="working");if(G.length===0)return;const ee=G[Math.floor(Math.random()*G.length)],D=S.current.filter(ne=>ne.members.length===0?!0:ne.members.includes(ee.id));if(D.length===0)return;const Y=D[Math.floor(Math.random()*D.length)];_.current=0,await B(ee.id,Y)&&$(Y,ee.id)},y);return()=>clearInterval(T)},[g,y,B,$])}function Xo({type:t,className:l}){const r=j.useRef(null),i=P4(t);return j.useEffect(()=>{const o=r.current;if(!o||!i)return;const u=o.getContext("2d");u&&tS(u,i)},[t,i]),i?c.jsx("canvas",{ref:r,width:i.canvasWidth,height:i.canvasHeight,className:l,style:{imageRendering:"pixelated",display:"block"}}):null}const Qy=[[1,8],[3,5],[8,1],[5,3]],_E=[[1,4],[2,3],[4,1],[3,2]];function Vo(t){const l=t===1||t===3?-1:0,r=Qy[t],i=t<2?[0,1]:[1,0],o=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:o+8,w:10,h:6,c:"$shirt"},{x:2,y:o+8,w:8,h:1,c:"lighten($shirt, 20)",a:.35},{x:1,y:o+8,w:1,h:5,c:"darken($shirt, 30)",a:.2},{x:10,y:o+8,w:1,h:5,c:"darken($shirt, 30)",a:.2},{x:-1,y:o+9+i[0],w:3,h:4-i[0],c:"$shirt"},{x:10,y:o+9+i[1],w:3,h:4-i[1],c:"$shirt"},{x:-1,y:o+12,w:2,h:1,c:"$skin"},{x:11,y:o+12,w:2,h:1,c:"$skin"},{x:4,y:o+6,w:4,h:3,c:"$skin"},{x:1,y:o+0,w:10,h:7,c:"$skin"},{x:3,y:o+3,w:2,h:2,c:"#1A1A2E"},{x:7,y:o+3,w:2,h:2,c:"#1A1A2E"},{x:3,y:o+3,w:1,h:1,c:"#FFF",a:.4},{x:7,y:o+3,w:1,h:1,c:"#FFF",a:.4},{x:5,y:o+6,w:2,h:1,c:"darken($skin, 25)",a:.35},{x:0,y:o+3,w:1,h:1,c:"$skin"},{x:11,y:o+3,w:1,h:1,c:"$skin"},{x:1,y:o+0,w:10,h:3,c:"$hair"},{x:0,y:o+1,w:2,h:3,c:"$hair"},{x:10,y:o+1,w:2,h:3,c:"$hair"},{x:2,y:o+0,w:8,h:1,c:"lighten($hair, 25)",a:.3}]}function Go(t){const l=t===1||t===3?-1:0,r=Qy[t],i=t<2?[0,1]:[1,0],o=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:o+8,w:10,h:6,c:"$shirt"},{x:2,y:o+8,w:8,h:1,c:"lighten($shirt, 20)",a:.2},{x:5,y:o+10,w:2,h:3,c:"darken($shirt, 30)",a:.12},{x:-1,y:o+9+i[0],w:3,h:4-i[0],c:"$shirt"},{x:10,y:o+9+i[1],w:3,h:4-i[1],c:"$shirt"},{x:4,y:o+6,w:4,h:3,c:"$skin"},{x:1,y:o+0,w:10,h:7,c:"$skin"},{x:1,y:o+0,w:10,h:6,c:"$hair"},{x:0,y:o+1,w:2,h:5,c:"$hair"},{x:10,y:o+1,w:2,h:5,c:"$hair"},{x:2,y:o+0,w:8,h:1,c:"lighten($hair, 25)",a:.3},{x:0,y:o+4,w:1,h:1,c:"$skin",a:.6},{x:11,y:o+4,w:1,h:1,c:"$skin",a:.6}]}function ba(t,l){const r=t===1||t===3?-1:0,i=_E[t],o=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:o+8,w:8,h:6,c:"$shirt"},{x:2,y:o+8,w:8,h:1,c:"lighten($shirt, 20)",a:.2},{x:8,y:o+9+u,w:3,h:4-u,c:"$shirt"},{x:9,y:o+12,w:2,h:1,c:"$skin"},{x:4,y:o+6,w:4,h:3,c:"$skin"},{x:2,y:o+0,w:8,h:7,c:"$skin"},{x:7,y:o+3,w:2,h:2,c:"#1A1A2E"},{x:7,y:o+3,w:1,h:1,c:"#FFF",a:.3},{x:9,y:o+4,w:1,h:1,c:"darken($skin, 25)",a:.3},{x:2,y:o+0,w:8,h:3,c:"$hair"},{x:1,y:o+1,w:2,h:4,c:"$hair"},{x:9,y:o+1,w:2,h:3,c:"$hair"},{x:3,y:o+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:o+8,w:8,h:6,c:"$shirt"},{x:2,y:o+8,w:8,h:1,c:"lighten($shirt, 20)",a:.2},{x:0,y:o+9+u,w:3,h:4-u,c:"$shirt"},{x:-1,y:o+12,w:2,h:1,c:"$skin"},{x:4,y:o+6,w:4,h:3,c:"$skin"},{x:2,y:o+0,w:8,h:7,c:"$skin"},{x:3,y:o+3,w:2,h:2,c:"#1A1A2E"},{x:3,y:o+3,w:1,h:1,c:"#FFF",a:.3},{x:1,y:o+4,w:1,h:1,c:"darken($skin, 25)",a:.3},{x:2,y:o+0,w:8,h:3,c:"$hair"},{x:1,y:o+1,w:2,h:3,c:"$hair"},{x:9,y:o+1,w:2,h:4,c:"$hair"},{x:3,y:o+0,w:6,h:1,c:"lighten($hair, 25)",a:.25}]}const f0={down:[Vo(0),Vo(1),Vo(2),Vo(3)],up:[Go(0),Go(1),Go(2),Go(3)],right:[ba(0,!0),ba(1,!0),ba(2,!0),ba(3,!0)],left:[ba(0,!1),ba(1,!1),ba(2,!1),ba(3,!1)]},Fe=4,kt=28,Wt=2,et=4,qe=4,Il=[{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 rh(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=[],h=f*28,g=t.fx+Math.max(8,Math.floor((t.fw-h)/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=Il[0],o={id:"main",wx:Fe+qe,wy:Fe,ww:160-2*(Fe+qe),wh:kt,fx:Fe+qe,fy:Fe+kt+Wt,fw:160-2*(Fe+qe),fh:120-Fe-kt-Wt-Fe,...i},u=rh(o,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*(Fe+qe))/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:o},desks:u,doors:{},adjacency:{main:[]},corridorY:{main:o.fy+o.fh-12},waypoints:{main:[{x:o.fx+10,y:o.fy+o.fh-14},{x:o.fx+o.fw/2,y:o.fy+o.fh-14},{x:o.fx+o.fw-10,y:o.fy+o.fh-14}]},wallDecorations:f,furniture:m}}function RE(t){const o={id:"exec",wx:Fe+qe,wy:Fe,ww:144-Fe-qe-et/2,wh:kt,fx:Fe+qe,fy:Fe+kt+Wt,fw:144-Fe-qe-et/2,fh:66,...Il[0]},u={id:"work",wx:144+et/2+qe,wy:Fe,ww:144-et/2-qe-Fe,wh:kt,fx:144+et/2+qe,fy:Fe+kt+Wt,fw:144-et/2-qe-Fe,fh:66,...Il[1]},f={id:"meet",wx:Fe+qe,wy:Fe+kt+Wt+66+et,ww:144-Fe-qe-et/2,wh:kt,fx:Fe+qe,fy:Fe+kt+Wt+66+et+kt+Wt,fw:144-Fe-qe-et/2,fh:70,...Il[2]},m={id:"comm",wx:144+et/2+qe,wy:Fe+kt+Wt+66+et,ww:144-et/2-qe-Fe,wh:kt,fx:144+et/2+qe,fy:Fe+kt+Wt+66+et+kt+Wt,fw:144-et/2-qe-Fe,fh:70,...Il[3]},p={exec:o,work:u,meet:f,comm:m},h=[];let g=t;const y=[[o,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,X]of[...y,...b])X>0&&h.push(...rh(T,X,3));const k=Fe+kt+Wt+66,S=144-et/2,N={exec_work:{id:"exec_work",type:"v",doorY:Fe+kt+Wt+20+12,xA:S-2,xB:u.fx+2},meet_comm:{id:"meet_comm",type:"v",doorY:Fe+kt+Wt+66+et+kt+Wt+20+12,xA:S-2,xB:m.fx+2},exec_meet:{id:"exec_meet",type:"h",doorX:Fe+qe+40+14,yA:k-2,yB:f.fy+2},work_comm:{id:"work_comm",type:"h",doorX:144+et/2+qe+40+14,yA:k-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"}]},_={exec:o.fy+52,work:u.fy+48,meet:f.fy+56,comm:m.fy+42},H={exec:[{x:o.fx+6,y:o.fy+52},{x:o.fx+60,y:o.fy+54},{x:o.fx+112,y:o.fy+50},{x:o.fx+50,y:o.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}]},B=[{id:"exec-window-1",type:"window",room:"exec",zone:"wall",offsetX:10,offsetY:6,windowW:16,windowH:14},{id:"exec-picture-1",type:"picture",room:"exec",zone:"wall",offsetX:34,offsetY:8,pictureColor:"#1565C0"},{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}],$=[{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(o.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:h,doors:N,adjacency:E,corridorY:_,waypoints:H,wallDecorations:B,furniture:$}}function OE(t){const f={id:"exec",wx:Fe+qe,wy:Fe,ww:180-Fe-qe-et/2,wh:kt,fx:Fe+qe,fy:Fe+kt+Wt,fw:180-Fe-qe-et/2,fh:82,...Il[0]},m={id:"work",wx:180+et/2+qe,wy:Fe,ww:180-et/2-qe-Fe,wh:kt,fx:180+et/2+qe,fy:Fe+kt+Wt,fw:180-et/2-qe-Fe,fh:82,...Il[1]},p=Fe+kt+Wt+82,h={id:"meet",wx:Fe+qe,wy:p+et,ww:180-Fe-qe-et/2,wh:kt,fx:Fe+qe,fy:p+et+kt+Wt,fw:180-Fe-qe-et/2,fh:86,...Il[2]},g={id:"comm",wx:180+et/2+qe,wy:p+et,ww:180-et/2-qe-Fe,wh:kt,fx:180+et/2+qe,fy:p+et+kt+Wt,fw:180-et/2-qe-Fe,fh:86,...Il[3]},y={exec:f,work:m,meet:h,comm:g},b=[];let v=t;const k=[[f,Math.min(5,v)],[m,0]];k[1][1]=Math.min(5,v-k[0][1]);const S=[[h,0],[g,0]];let N=v-k[0][1]-k[1][1];N>0&&(S[0][1]=Math.min(3,N),N-=S[0][1]),N>0&&(S[1][1]=Math.min(3,N));for(const[G,ee]of[...k,...S])ee>0&&b.push(...rh(G,ee,4));const E=180-et/2,_={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:h.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:h.fy+2},work_comm:{id:"work_comm",type:"h",doorX:m.fx+54,yA:p-2,yB:g.fy+2}},H={exec:[{room:"work",door:"exec_work",side:"A"},{room:"meet",door:"exec_meet",side:"A"}],work:[{room:"exec",door:"exec_work",side:"B"},{room:"comm",door:"work_comm",side:"A"}],meet:[{room:"exec",door:"exec_meet",side:"B"},{room:"comm",door:"meet_comm",side:"A"}],comm:[{room:"work",door:"work_comm",side:"B"},{room:"meet",door:"meet_comm",side:"B"}]},B={exec:f.fy+82-12,work:m.fy+82-12,meet:h.fy+86-12,comm:g.fy+86-12},$={exec:[{x:f.fx+10,y:B.exec},{x:f.fx+f.fw/2,y:B.exec},{x:f.fx+f.fw-10,y:B.exec}],work:[{x:m.fx+10,y:B.work},{x:m.fx+m.fw/2,y:B.work},{x:m.fx+m.fw-10,y:B.work}],meet:[{x:h.fx+10,y:B.meet},{x:h.fx+h.fw/2,y:B.meet},{x:h.fx+h.fw-10,y:B.meet}],comm:[{x:g.fx+10,y:B.comm},{x:g.fx+g.fw/2,y:B.comm},{x:g.fx+g.fw-10,y:B.comm}]},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}],X=[{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:_,adjacency:H,corridorY:B,waypoints:$,wallDecorations:T,furniture:X}}const BE=2;function Zy(t,l){return l?l==="L"&&t<=12-BE?"M":l==="M"&&t>12?"L":l:t<=12?"M":"L"}function Wy(t,l){switch(l??Zy(t)){case"S":return FE(t);case"M":return RE(t);case"L":return OE(t)}}function $E(t,l){if(!l||Object.keys(l).length===0)return t;const r=i=>i.map(o=>{const u=l[o.id];return u?{...o,offsetX:u.offsetX,offsetY:u.offsetY}:o});return{...t,wallDecorations:r(t.wallDecorations),furniture:r(t.furniture)}}let as;function LE(t){as=t}function R(t,l,r,i,o,u){t=Math.round(t),l=Math.round(l),!(u!==void 0&&u<.01)&&(u!==void 0&&u!==1&&(as.globalAlpha=u),as.fillStyle=o,as.fillRect(t,l,r,i),u!==void 0&&u!==1&&(as.globalAlpha=1))}function Xe(t,l,r,i){R(t,l,1,1,r,i)}let Jo=1;function Kr(t){Jo=t}function yl(){return Jo=Jo*16807%2147483647,(Jo&65535)/65535}function Jy(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,o=Math.max(l,r,i),u=Math.min(l,r,i);let f=0,m=0;const p=(o+u)/2;if(o!==u){const h=o-u;m=p>.5?h/(2-o-u):h/(o+u),o===l?f=((r-i)/h+(r<i?6:0))/6:o===r?f=((i-l)/h+2)/6:f=((l-r)/h+4)/6}return[f*360,m*100,p*100]}function Py(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),o=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(o(0))+u(o(8))+u(o(4))}function gl(t,l=1){const[r,i,o]=Jy(t);return Py(r+15*l,Math.min(100,i+8),o-12*l)}function Mt(t,l=1){const[r,i,o]=Jy(t);return Py(r-10*l,i-3,o+10*l)}const Zt={hi:"#D4AA5C",base:"#B08040",sh:"#7A5038",deep:"#4E3028"},pl={hi:"#8A6848",base:"#604832",sh:"#3A2E24",deep:"#2A1E18"},ml={hi:"#5A6A80",base:"#485868",sh:"#364858",deep:"#283848"},Ca="#100A06";function HE(t,l,r=14,i=12){R(t,l,r,i,"#4A3828"),R(t+1,l+1,r-2,i-2,"#5A4838"),R(t+2,l+2,r-4,i-4,"#4A7098"),R(t+2,l+2,r-4,Math.floor((i-4)/2),"#6A90B8",.35);const o=Math.floor(r/2);R(t+o,l+1,1,i-2,"#4A3828"),R(t+1,l+Math.floor(i/2),r-2,1,"#4A3828",.5),Xe(t+3,l+3,"#8AB8E8",.35),Xe(t+o+2,l+3,"#8AB8E8",.25),R(t-1,l+i,r+2,2,"#5A4838"),R(t-1,l+i,r+2,1,Mt("#5A4838",.5),.35)}function UE(t,l,r){R(t,l,10,8,"#3A2818"),R(t+1,l+1,8,6,r),R(t+2,l+2,4,3,Mt(r,1.2),.3),Xe(t+3,l+2,Mt(r,2),.25)}function IE(t,l){R(t,l,7,7,"#3A2818"),R(t+1,l+1,5,5,"#F0EDE5"),Xe(t+3,l+1,"#AAA"),Xe(t+3,l+5,"#AAA"),Xe(t+1,l+3,"#AAA"),Xe(t+5,l+3,"#AAA"),Xe(t+3,l+3,"#222"),R(t+3,l+1,1,2,"#333"),Xe(t+4,l+3,"#D32F2F")}function YE(t,l){R(t,l,26,16,"#586878"),R(t+1,l+1,24,13,"#ECEFF1"),R(t+1,l+1,24,1,"#F5F5F5",.4),R(t+3,l+3,14,1,"#1565C0",.6),R(t+3,l+5,18,1,"#333",.2),R(t+3,l+7,12,1,"#D32F2F",.35),R(t+3,l+9,16,1,"#333",.15),R(t+1,l+14,24,2,"#708898"),R(t+3,l+14,3,1,"#D32F2F"),R(t+7,l+14,3,1,"#1565C0"),R(t+11,l+14,3,1,"#2E7D32")}function qE(t,l){R(t,l,22,16,"#6A5030"),R(t+1,l+1,20,14,"#C4A66A"),Kr(88);for(let r=0;r<14;r++)for(let i=0;i<20;i++)yl()>.5&&Xe(t+1+i,l+1+r,yl()>.5?"#B89858":"#D4B87A",.18);R(t+2,l+2,5,4,"#FFF176"),R(t+8,l+2,5,4,"#90CAF9"),R(t+14,l+3,5,4,"#CE93D8"),R(t+3,l+8,7,4,"#C8E6C9"),R(t+11,l+8,8,4,"#F8BBD0"),Xe(t+4,l+2,"#E53935"),Xe(t+10,l+2,"#1E88E5"),Xe(t+16,l+3,"#FF9800")}function XE(t,l){R(t,l,20,3,"#5A4030"),R(t,l,20,1,Mt("#5A4030",.5),.35),R(t,l+2,20,1,gl("#5A4030",.5),.3),R(t+2,l-4,3,4,"#E53935"),R(t+2,l-4,3,1,Mt("#E53935",1),.3),R(t+6,l-3,2,3,"#1E88E5"),R(t+9,l-5,4,5,"#43A047"),R(t+14,l-3,3,3,"#FFD54F"),Xe(t+15,l-3,"#FFF176",.4)}function VE(t,l){R(t,l,16,12,"#1E1E28"),R(t+1,l+1,14,9,"#0C1420"),R(t+2,l+2,12,1,"#EF4444",.6),Xe(t+2,l+4,"#4CAF50"),R(t+4,l+4,7,1,"#8b949e",.4),Xe(t+2,l+6,"#FF9800"),R(t+4,l+6,5,1,"#8b949e",.3),Xe(t+2,l+8,"#42A5F5"),R(t+4,l+8,8,1,"#8b949e",.25),R(t+7,l+10,2,2,"#1E1E28"),R(t+5,l+11,6,1,"#586878")}function GE(t,l,r){R(t+2,l+20,22,2,Ca,.15),R(t,l,22,20,pl.deep),R(t+1,l+1,20,18,pl.base),R(t,l,22,1,pl.hi,.35),R(t,l,1,20,pl.hi,.2);for(const u of[6,12])R(t+1,l+u,20,2,pl.sh),R(t+1,l+u,20,1,pl.hi,.2);const i=["#E53935","#1E88E5","#43A047","#8E24AA","#FB8C00","#00897B","#5C6BC0"];let o=t+2;for(let u=0;u<5;u++){const f=2+u%2;R(o,l+1,f,5,i[u]),R(o,l+1,f,1,Mt(i[u],1),.35),o+=f+1}o=t+2;for(let u=0;u<4;u++)R(o,l+7,4,5,i[u+3]),R(o,l+7,4,1,Mt(i[u+3],1),.25),o+=5;R(t+2,l+14,4,4,"#FFD54F"),R(t+8,l+14,7,4,"#90CAF9"),r&&R(t,l-1,22,1,r,.7)}function KE(t,l){R(t+2,l+11,6,2,Ca,.1),R(t+2,l+8,6,4,"#8B5E3C"),R(t+1,l+7,8,2,gl("#A06E48",.3)),R(t+2,l+7,6,1,Mt("#A06E48",.5),.4),R(t+1,l+3,3,4,"#2E7D32"),R(t+5,l+2,3,4,"#2E7D32"),R(t+2,l+1,4,4,"#43A047"),R(t+3,l+0,3,3,"#66BB6A"),Xe(t+4,l,"#81C784"),Xe(t+3,l+1,"#A5D6A7",.4)}function QE(t,l){Ga(t+4,l-4,"down"),Ga(t+16,l-4,"down"),Ga(t+28,l-4,"down"),R(t+3,l+24,34,3,Ca,.15),R(t,l+2,36,18,Zt.deep),R(t+1,l+3,34,16,Zt.base),R(t+1,l+3,34,1,Zt.hi,.35);for(let r=0;r<14;r+=3)R(t+1,l+4+r,34,1,gl(Zt.base,.2),.08);R(t,l+20,36,4,Zt.deep),R(t+1,l+21,34,2,Zt.sh),R(t+6,l+7,10,6,"#1A1A24"),R(t+7,l+8,8,4,"#0C1420"),R(t+8,l+9,4,1,"#2A6898",.4),R(t+20,l+8,6,4,"#F0F0F0"),R(t+15,l+7,3,3,"#ECEFF1"),Xe(t+16,l+8,"#795548"),Ga(t+4,l+24,"up"),Ga(t+16,l+24,"up"),Ga(t+28,l+24,"up")}function ZE(t,l){R(t+2,l+16,36,3,Ca,.15),R(t,l,36,5,"#5D4037"),R(t+1,l+1,34,3,"#6D4C41"),R(t+1,l+1,34,1,Mt("#6D4C41",.5),.3),R(t,l+5,36,8,"#5D4037"),R(t+2,l+6,15,6,"#6D4C41"),R(t+3,l+6,13,1,Mt("#6D4C41",.5),.35),R(t+19,l+6,15,6,"#6D4C41"),R(t+20,l+6,13,1,Mt("#6D4C41",.5),.35),R(t+17,l+6,2,6,"#5D4037"),R(t,l+13,36,3,gl("#5D4037",1)),R(t-2,l+2,3,12,"#5D4037"),R(t+35,l+2,3,12,"#5D4037"),R(t+4,l+7,6,4,"#FF8A65"),R(t+5,l+7,4,1,Mt("#FF8A65",1),.35)}function WE(t,l){R(t+2,l+10,22,2,Ca,.12),R(t,l,22,8,pl.deep),R(t+1,l+1,20,6,pl.base),R(t+1,l+1,20,1,pl.hi,.3),R(t,l+8,22,2,pl.sh),R(t+3,l+2,6,4,"#F0F0F0"),R(t+13,l+3,3,3,"#ECEFF1"),Xe(t+14,l+4,"#795548")}function JE(t,l){R(t+1,l+14,10,2,Ca,.12),R(t,l,10,14,"#546E7A"),R(t,l,10,1,Mt("#546E7A",1),.35),R(t+1,l+1,8,3,"#78909C"),R(t+1,l+5,8,4,"#37474F"),Xe(t+2,l+6,"#EF5350"),Xe(t+4,l+6,"#66BB6A"),R(t+2,l+11,4,2,"#ECEFF1")}function PE(t,l){R(t+2,l+16,26,3,Ca,.18),R(t,l,26,10,Zt.deep),R(t+1,l+1,24,8,Zt.base),R(t+1,l+2,24,1,Zt.hi,.2),R(t+1,l+4,24,1,gl(Zt.base,.2),.1),R(t+1,l+6,24,1,Zt.hi,.15),R(t+1,l+1,24,1,Zt.hi,.4),R(t+1,l+1,1,8,Zt.hi,.2),R(t,l+10,26,5,Zt.deep),R(t+1,l+11,24,3,Zt.sh),R(t+1,l+10,24,1,gl(Zt.base,1.5),.4),R(t+1,l+14,24,1,Zt.base,.15),R(t+2,l+12,10,1,Zt.deep,.4),R(t+14,l+12,10,1,Zt.deep,.4),Xe(t+7,l+11,"#C8D0D8",.6),Xe(t+19,l+11,"#C8D0D8",.6),R(t+6,l-5,14,7,"#1E1E28"),R(t+7,l-4,12,5,"#0C1420"),R(t+8,l-3,5,1,"#2A6898",.6),R(t+8,l-2,8,1,"#1A3858",.4),R(t+8,l-1,3,1,"#2A6898",.35),Xe(t+7,l-4,"#4A98D8",.25),Xe(t+12,l+1,"#4CAF50",.4),R(t+12,l+2,2,3,"#586878"),R(t+10,l+4,6,1,"#8898A8"),R(t+6,l+4,12,4,"#222228"),R(t+6,l+4,12,1,"#333338",.4);for(let r=0;r<5;r++)Xe(t+7+r*2,l+5,"#444",.6),Xe(t+7+r*2,l+6,"#3A3A3E",.4);R(t+20,l+5,3,4,"#333338"),R(t+20,l+5,3,1,"#444448"),R(t+1,l+3,4,4,"#F0EDE8"),R(t+1,l+3,4,1,"#F8F6F2"),Xe(t+2,l+5,"#6D4C41")}function Ga(t,l,r){R(t+1,l+9,10,2,Ca,.1),Xe(t+5,l+9,"#1E1E22"),Xe(t+1,l+10,"#1A1A1E"),Xe(t+9,l+10,"#1A1A1E"),Xe(t+3,l+11,"#1A1A1E"),Xe(t+7,l+11,"#1A1A1E"),R(t+1,l+2,8,6,ml.base),R(t+2,l+3,6,4,ml.hi,.35),R(t+2,l+3,6,1,Mt(ml.hi,.5),.25),R(t+1,l+7,8,1,ml.deep),r==="up"?(R(t,l+7,10,3,ml.deep),R(t+1,l+8,8,1,ml.sh)):(R(t,l-1,10,3,ml.deep),R(t+1,l,8,1,ml.sh)),R(t,l+3,1,4,ml.sh),R(t+9,l+3,1,4,ml.sh)}const eg={bookshelf:(t,l,r)=>GE(t,l,r.accent),plant:(t,l)=>KE(t,l),"meeting-table":(t,l)=>QE(t,l),sofa:(t,l)=>ZE(t,l),"coffee-table":(t,l)=>WE(t,l),"coffee-machine":(t,l)=>JE(t,l),window:(t,l,r)=>HE(t,l,r.windowW??16,r.windowH??14),picture:(t,l,r)=>UE(t,l,r.pictureColor??"#1565C0"),clock:(t,l)=>IE(t,l),whiteboard:(t,l)=>YE(t,l),"bulletin-board":(t,l)=>qE(t,l),shelf:(t,l)=>XE(t,l),screen:(t,l)=>VE(t,l)};function ih(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 eC(t){for(const l of t.wallDecorations){const r=t.rooms[l.room];if(!r)continue;const{x:i,y:o}=ih(l,r),u=eg[l.type];u&&u(i,o,l)}}function tC(t,l,r){for(const i of t.furniture){const o=t.rooms[i.room];if(!o||i.condition==="no-desks"&&r.has(i.room))continue;const{x:u,y:f}=ih(i,o),m=eg[i.type];m&&l.push({y:f,draw:()=>m(u,f,i)})}}function Md(t){const l=[],r=[...t.wallDecorations,...t.furniture];for(const i of r){if(!i.facility)continue;const o=t.rooms[i.room];if(!o)continue;const{x:u,y:f}=ih(i,o);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 Ko=16,nC=4,Va=4,Po=2,ct=4,va=4;let ft=Wy(7);const uc={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};let Hr=Md(ft);function tg(t){return{x:t.dx,y:t.dy,w:t.pw,h:t.ph}}function ng(t){return{cx:t.dx+t.pw/2,botY:t.dy+t.ph}}let ka={};function lC(t){const l={};for(let r=0;r<t.length&&r<ft.desks.length;r++)l[t[r]]=ft.desks[r];return l}let Yt,Ir=null,Ur=null,lg=!1;function aC(t,l){const{wx:r,wy:i,ww:o,wh:u,wallColor:f,baseboardColor:m}=t,p=gl(f,.5),h=Mt(f,.5),g=[];if(l){const y=l.x-r,b=l.w;y>0&&g.push({sx:r,sw:y}),y+b<o&&g.push({sx:l.x+b,sw:o-y-b})}else g.push({sx:r,sw:o});for(const y of g){R(y.sx,i,y.sw,u,f);for(let b=0;b<u;b+=4)R(y.sx,i+b,y.sw,1,h,.08),R(y.sx,i+b+2,y.sw,1,p,.05);Kr(Math.round(y.sx*7+i*13));for(let b=0;b<y.sw;b+=3)yl()>.4&&R(y.sx+b,i,1,u,h,.04);R(y.sx,i,y.sw,2,h,.3),R(y.sx,i,y.sw,1,Mt(f,1),.2),R(y.sx,i+u-2,y.sw,2,p,.3),R(y.sx,i+u,y.sw,Po,m),R(y.sx,i+u,y.sw,1,Mt(m,.5),.4)}l&&(R(l.x-1,i,1,u+Po,"#4A3828"),R(l.x+l.w,i,1,u+Po,"#4A3828"),R(l.x,i,l.w,1,"#0A0808",.12)),R(t.fx,t.fy,t.fw,3,"#0A0808",.12),R(t.fx,t.fy+3,t.fw,2,"#0A0808",.06)}function rC(t){const l="#504038",r=gl(l,.5),i=Mt(l,.5),o=t.wx-va,u=t.wy,f=t.wh+Po+t.fh;R(o,u,va,f,l),R(o,u,1,f,i,.3),R(o+va-1,u,1,f,r,.4);for(let p=0;p<f;p+=6)R(o+1,u+p,va-2,1,i,.06);const m=t.wx+t.ww;R(m,u,va,f,l),R(m,u,1,f,i,.2),R(m+va-1,u,1,f,r,.3)}function dd(t){const{fx:l,fy:r,fw:i,fh:o}=t,u="#B08040",f="#C89848",m="#8A6030",p="#6A4820";R(l,r,i,o,u),Kr(42);for(let h=0;h<o;h+=5){const g=Math.floor(h/5)%2*10;for(let y=-10;y<i+10;y+=20){const b=l+y+g,v=Math.max(l,b),k=Math.min(b+19,l+i)-v;if(k<=0)continue;const S=yl()>.5?f:u;R(v,r+h,k,4,S,.25),R(v,r+h,k,1,f,.3),R(v,r+h+4,k,1,p,.35),b>=l&&b<l+i&&R(b,r+h,1,4,p,.2),R(v,r+h+2,k,1,m,.1)}}R(l,r,i,2,"#0A0808",.08),R(l,r,2,o,"#0A0808",.06)}function d0(t){const{fx:l,fy:r,fw:i,fh:o}=t,u="#1C2A38",f="#101820";Kr(99),R(l,r,i,o,u);for(let m=0;m<o;m+=Ko)for(let p=0;p<i;p+=Ko){const h=Math.min(Ko,i-p),g=Math.min(Ko,o-m);yl()>.5&&R(l+p,r+m,h,g,Mt(u,.2),.15),R(l+p+2,r+m+2,h-4,g-4,Mt(u,.3),.08),R(l+p,r+m,h,1,f,.5),R(l+p,r+m,1,g,f,.5),R(l+p+1,r+m+1,1,g-1,Mt(u,.4),.1),yl()>.85&&Xe(l+p+4+Math.floor(yl()*8),r+m+4+Math.floor(yl()*8),"#3A6A9A",.08)}}function iC(t){const{fx:l,fy:r,fw:i,fh:o}=t,u="#387848",f="#4A9058",m="#285E38";R(l,r,i,o,u),Kr(77);for(let h=0;h<o;h+=2)for(let g=0;g<i;g+=2)yl()>.5&&Xe(l+g,r+h,f,.1),yl()>.8&&Xe(l+g+1,r+h+1,m,.12);const p=5;R(l+p,r+p,i-p*2,1,f,.45),R(l+p,r+o-p-1,i-p*2,1,m,.45),R(l+p,r+p,1,o-p*2,f,.35),R(l+i-p-1,r+p,1,o-p*2,m,.35)}function sC(t){const{fx:l,fy:r,fw:i,fh:o}=t,u="#D8C490",f="#B09060",m="#907848";Kr(55);for(let p=0;p<o;p+=8)for(let h=0;h<i;h+=8){const g=Math.min(8,i-h),y=Math.min(8,o-p),b=(h/8+p/8)%2===0?f:u;R(l+h,r+p,g,y,b),R(l+h+1,r+p+1,g-2,1,Mt(b,.4),.2),R(l+h+1,r+p+1,1,y-2,Mt(b,.4),.15),R(l+h+g-2,r+p+2,1,y-3,gl(b,.4),.15),R(l+h+2,r+p+y-2,g-3,1,gl(b,.4),.15),R(l+h,r+p,g,1,m,.3),R(l+h,r+p,1,y,m,.3)}}function oC(){const{canvasW:t,canvasH:l,rooms:r,doors:i}=ft,o="#2A1E14",u="#3A2E24";if(R(0,0,t,Va,o),R(0,l-Va,t,Va,o),R(0,0,Va,l,o),R(t-Va,0,Va,l,o),R(0,0,t,1,u,.3),R(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,h=p-ct/2,g=f.fy+f.fh,y=i.exec_work,b=i.meet_comm,v=i.exec_meet,k=i.work_comm,S=24,N=28,E=((y==null?void 0:y.doorY)??f.fy+20)-S/2,_=((v==null?void 0:v.doorX)??Va+va+54)-N/2,H=((k==null?void 0:k.doorX)??p+ct/2+va+54)-N/2,B=((b==null?void 0:b.doorY)??m.fy+20)-S/2;R(0,g,_,ct,o),R(_+N,g,h-_-N,ct,o),R(h+ct,g,H-h-ct,ct,o),R(H+N,g,t-H-N,ct,o),R(0,g,_,1,u,.3),R(_+N,g,h-_-N,1,u,.3),R(h+ct,g,H-h-ct,1,u,.3),R(H+N,g,t-H-N,1,u,.3),R(h,0,ct,E,o),R(h,E+S,ct,g-E-S,o),R(h,g+ct,ct,B-g-ct,o),R(h,B+S,ct,l-B-S,o),R(h,0,1,E,u,.2),R(h,E+S,1,g-E-S,u,.2),R(h,g+ct,1,B-g-ct,u,.2),R(h,B+S,1,l-B-S,u,.2),R(h,E,ct,S,"#C4A070"),R(h+ct/2,E,ct/2,S,"#3A4858"),R(h,B,ct,S,"#7AA880"),R(h+ct/2,B,ct/2,S,"#C8B890");const $="#4A3828";R(h,E-1,ct,1,$),R(h,E+S,ct,1,$),R(_-1,g,1,ct,$),R(_+N,g,1,ct,$),R(H-1,g,1,ct,$),R(H+N,g,1,ct,$),R(h,B-1,ct,1,$),R(h,B+S,ct,1,$)}const h0=new Map;function cC(t){const l=`${t.hairStyle??""}|${t.outfitStyle??""}|${t.accessory??""}`;let r=h0.get(l);if(!r){const i=Nd("mini-seated:default"),o=zy(i,t);r=o?o.layers.flatMap(u=>u.pixels):[],h0.set(l,r)}return r}function uC(t,l,r){Ad(Yt,cC(r),t,l,r)}function fC(t,l,r,i,o){Ga(t+8,l+20,"up"),o||uC(t+8,l+0+i,r),PE(t,l+14)}function dC(t,l,r,i,o){const u=i in f0?i:"down",f=o%4,m=f0[u][f];Ad(Yt,m,t,l,r);const p=f===1||f===3?-1:0;if(r.accessory&&r.accessory!=="none"){const h=rS(r.accessory,u);h&&h.pixels.length>0&&Ad(Yt,h.pixels,t,l+p,r)}Yt.globalAlpha=1}function hC(t){const l={};let r=0;for(const i of t){const o=ka[i];o&&(l[i]={state:"sitting",homeX:o.dx+8,homeY:o.dy+34,homeRoom:o.room,x:o.dx+8,y:o.dy+34,path:[],room:o.room,dir:"down",walkFrame:0,walkTimer:0,bobY:0,bobOff:r*17,stateTimer:600+Math.floor(Math.random()*900)},r++)}return l}function os(t,l,r,i,o){const u=ft.corridorY[o]??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 hd(t,l,r,i){const o=ft.adjacency[r];if(!o)return[];const u=o.find(g=>g.room===i);if(!u)return[];const f=ft.doors[u.door];if(!f)return[];const m=[],p=ft.corridorY[r]??l,h=ft.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:h})}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:h})}return m}function ag(t,l){const r=ft.adjacency[t.room];if(!r)return[];if(!r.find(o=>o.room===l)){for(const o of r){const u=ft.adjacency[o.room];if(u!=null&&u.find(f=>f.room===l)){const f=hd(t.x,t.y,t.room,o.room),m=f[f.length-1],p=hd((m==null?void 0:m.x)??t.x,(m==null?void 0:m.y)??t.y,o.room,l);return[...f,...p]}}return[]}return hd(t.x,t.y,t.room,l)}function mC(t){if(t.room!==t.homeRoom){const l=ag({...t},t.homeRoom),r=l[l.length-1],i=os((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 os(t.x,t.y,t.homeX,t.homeY,t.room)}function xC(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(ft.rooms);if(Math.random()<.25&&i.length>1){const o=i.filter(p=>p!==r.room),u=o[Math.floor(Math.random()*o.length)],f=ag(r,u),m=ft.waypoints[u];if(m&&m.length>0){const p=m[Math.floor(Math.random()*m.length)],h=f[f.length-1]??{x:r.x,y:r.y},g=os(h.x,h.y,p.x,p.y,u);r.path=[...f,...g]}else r.path=f;r.walkTimer=0}else{const o=ft.waypoints[r.room];if(o&&o.length>0){const u=o[Math.floor(Math.random()*o.length)];r.path=os(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],o=i.x-r.x,u=i.y-r.y,f=Math.sqrt(o*o+u*u);if(f<1.5){r.x=i.x,r.y=i.y,r.path.shift();for(const[m,p]of Object.entries(ft.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+=o/f*.2,r.y+=u/f*.2,Math.abs(o)>Math.abs(u)?r.dir=o>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=ft.waypoints[r.room];if(i&&i.length>0){const o=i[Math.floor(Math.random()*i.length)];r.path=os(r.x,r.y,o.x,o.y,r.room)}r.walkTimer=0}else r.state="returning",r.path=mC(r),r.walkTimer=0}function pC(t,l,r){const{canvasW:i,canvasH:o,rooms:u}=ft;Yt.clearRect(0,0,i,o),R(0,0,i,o,"#2A1E14");const f={wood:dd,dark:d0,carpet:iC,tile:sC};for(const y of Object.values(u))(f[y.floorType]??dd)(y);const m=Object.keys(u);if(m.length>=4){const y=u.exec,b=u.meet,{doors:v}=ft;if(y&&b&&v.exec_meet&&v.work_comm){const S=(v.exec_meet.doorX??0)-14,N=(v.work_comm.doorX??0)-28/2,E=y.fy+y.fh,_=b.fy;dd({fx:S,fy:E,fw:28,fh:_-E}),d0({fx:N,fy:E,fw:28,fh:_-E})}}const p={};if(m.length>=4){const{doors:y}=ft,b=28,v=y.exec_meet,k=y.work_comm;v!=null&&v.doorX&&(p.meet={x:v.doorX-b/2,w:b}),k!=null&&k.doorX&&(p.comm={x:k.doorX-b/2,w:b})}for(const y of Object.values(u))aC(y,p[y.id]),rC(y);oC(),eC(ft);const h=[],g=new Set(Object.values(ka).map(y=>y.room));tC(ft,h,g);for(const[y,b]of Object.entries(ka)){const v=t[y];if(!v)continue;const k=v.state==="sitting",S=l(y),N=r[y]==="working";h.push({y:b.dy+14,draw:()=>{if(fC(b.dx,b.dy,S,k?v.bobY:0,!k),k&&N){const E=uc[y]??"#388bfd";R(b.dx+7,b.dy+14-4,12,5,E,.15),Xe(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);h.push({y:b.y+14,draw:()=>dC(Math.round(b.x),Math.round(b.y),v,b.dir,b.walkFrame)})}h.sort((y,b)=>y.y-b.y);for(const y of h)y.draw();for(const y of Hr){const b=Ur===y.id,v=ng(y);if(Yt.save(),Yt.globalAlpha=b?.9:.5,Yt.fillStyle=y.color,Yt.fillRect(v.cx-1,v.botY-2,3,3),b){const k=tg(y);Yt.globalAlpha=.3,Yt.strokeStyle=y.color,Yt.lineWidth=1,Yt.strokeRect(k.x-1,k.y-1,k.w+2,k.h+2)}Yt.restore()}if(lg&&new Set(Object.values(ka).map(y=>y.room)),Ir){const y=ka[Ir],b=t[Ir];y&&b&&(Yt.save(),Yt.globalAlpha=.25,Yt.fillStyle=uc[Ir]??"#fff",b.state==="sitting"?Yt.fillRect(y.dx-1,y.dy+6,28,30):Yt.fillRect(Math.round(b.x)-1,Math.round(b.y)-1,14,24),Yt.restore())}}function yC({roles:t,projects:l,roleStatuses:r,activeExecs:i,onRoleClick:o,onProjectClick:u,onBulletinClick:f,onDecisionsClick:m,onKnowledgeClick:p,getRoleSpeech:h,getAppearance:g,onHireClick:y}){const b=j.useRef(null),v=j.useRef(null),k=j.useRef(null),S=j.useRef({}),N=j.useRef(0),E=j.useRef(nC),[_,H]=j.useState(!1),B=j.useRef({});j.useEffect(()=>{lg=_},[_]),j.useEffect(()=>{Ce.getPreferences().then(L=>{const F=L.furnitureOverrides;F&&Object.keys(F).length>0&&(B.current=F,ft=$E(ft,F),Hr=Md(ft))}).catch(()=>{})},[]);const $=j.useRef({roleStatuses:r,activeExecs:i,getRoleSpeech:h,getAppearance:g});$.current={roleStatuses:r,activeExecs:i,getRoleSpeech:h,getAppearance:g};const T=j.useMemo(()=>t.map(L=>L.id),[t]),X=j.useRef(ft);j.useEffect(()=>{const L=T.length,F=Zy(L,X.current.preset),V=Wy(L,F);ft=V,X.current=V,ka=lC(T),Hr=Md(V),S.current=hC(T);const P=b.current;P&&(P.width=V.canvasW,P.height=V.canvasH),ee()},[T]);const G=j.useCallback(L=>{var F,V;return((V=(F=$.current).getAppearance)==null?void 0:V.call(F,L))??lh(L)},[]),ee=j.useCallback(()=>{const L=v.current,F=b.current;if(!L||!F)return;const V=L.parentElement;if(!V)return;const P=V.clientWidth,fe=V.clientHeight;if(P===0||fe===0)return;const{canvasW:z,canvasH:M}=ft;let K=Math.floor(Math.min(P/z,fe/M));K=Math.max(2,Math.min(K,5)),E.current=K,F.style.width=z*K+"px",F.style.height=M*K+"px",L.style.width=z*K+"px",L.style.height=M*K+"px"},[]);j.useEffect(()=>{var M;const L=b.current;if(!L)return;const F=L.getContext("2d");if(!F)return;Yt=F,LE(F),ee();const V=new ResizeObserver(()=>ee()),P=(M=v.current)==null?void 0:M.parentElement;P&&V.observe(P);let fe;const z=()=>{N.current++,xC(S.current,N.current),pC(S.current,G,$.current.roleStatuses),D(),fe=requestAnimationFrame(z)};return fe=requestAnimationFrame(z),()=>{cancelAnimationFrame(fe),V.disconnect()}},[G,ee]),j.useEffect(()=>{const L=k.current;if(!L)return;L.innerHTML="";for(const V of T){const P=uc[V]??"#8b949e",fe=document.createElement("div");fe.className="td-nametag",fe.dataset.role=V;const z=document.createElement("span");z.className="td-dot",z.style.background=P,fe.appendChild(z),fe.appendChild(document.createTextNode(V.toUpperCase())),L.appendChild(fe);const M=document.createElement("div");M.className="td-bubble",M.dataset.role=V,M.dataset.type="bubble",L.appendChild(M)}const F={meeting:()=>{const V=l[0];V?u(V.id):f()},bulletin:f,decisions:m,knowledge:p};for(const V of Hr){const P=document.createElement("div");P.className="td-facility-label",P.dataset.facility=V.id,P.textContent=`${V.icon} ${V.label}`,P.style.borderColor=`${V.color}44`;const fe=F[V.id];fe&&P.addEventListener("click",fe),P.addEventListener("mouseenter",()=>{Ur=V.id}),P.addEventListener("mouseleave",()=>{Ur=null}),L.appendChild(P)}},[T,l,u,f,m,p]);const D=j.useCallback(()=>{var M;const L=k.current;if(!L)return;const F=E.current,V=S.current,{getRoleSpeech:P,roleStatuses:fe,activeExecs:z}=$.current;for(const K of Object.keys(V)){const A=V[K],oe=ka[K];if(!oe)continue;let be,ve,Ne;A.state==="sitting"?(be=oe.dx+13,Ne=oe.dy+2,ve=oe.dy+37):(be=Math.round(A.x)+6,Ne=Math.round(A.y)-2,ve=Math.round(A.y)+18);const Oe=be/ft.canvasW*100,Be=L.querySelector(`.td-nametag[data-role="${K}"]`);if(Be){Be.style.left=Oe+"%",Be.style.top=ve*F+2+"px";const Ve=Be.querySelector(".td-dot");if(Ve){const Ge=fe[K]==="working";Ve.style.background=Ge?"#FBBF24":uc[K]??"#8b949e",Ge?Ve.style.animation="td-pulse 1s ease-in-out infinite":Ve.style.animation=""}}const me=L.querySelector(`.td-bubble[data-role="${K}"]`);if(me){const Ve=fe[K]==="working",Ge=(M=z.find(nt=>nt.roleId===K))==null?void 0:M.task,de=P(K),Ee=Ve&&Ge?Ge.slice(0,30):de?de.slice(0,30):"";Ee&&A.state==="sitting"?(me.style.display="",me.style.left=Oe+"%",me.style.top=(Ne-5)*F+"px",me.textContent=Ee):me.style.display="none"}}for(const K of Hr){const A=L.querySelector(`.td-facility-label[data-facility="${K.id}"]`);if(A){const oe=ng(K);A.style.left=oe.cx/ft.canvasW*100+"%",A.style.top=oe.botY*F+2+"px",A.classList.toggle("td-facility-label--hover",Ur===K.id)}}},[]),Y=j.useCallback(L=>{const F=b.current;if(!F)return null;const V=F.getBoundingClientRect(),P=E.current,fe=(L.clientX-V.left)/P,z=(L.clientY-V.top)/P,M=S.current;for(const[K,A]of Object.entries(ka)){if(!M[K])continue;const oe=M[K];if(oe.state==="sitting"){if(fe>=A.dx&&fe<=A.dx+26&&z>=A.dy&&z<=A.dy+40)return{type:"role",id:K}}else if(fe>=oe.x-2&&fe<=oe.x+14&&z>=oe.y-2&&z<=oe.y+20)return{type:"role",id:K}}for(const K of Hr){const A=tg(K);if(fe>=A.x&&fe<=A.x+A.w&&z>=A.y&&z<=A.y+A.h)return{type:"facility",id:K.id}}return null},[]),I=j.useCallback(L=>{const F=Y(L),V=b.current;Ir=(F==null?void 0:F.type)==="role"?F.id:null,Ur=(F==null?void 0:F.type)==="facility"?F.id:null,V&&(V.style.cursor=F?"pointer":"default")},[Y]),ne=j.useCallback(()=>{Ir=null,Ur=null,b.current&&(b.current.style.cursor="default")},[]),le=j.useCallback(L=>{const F=Y(L);if(F){if(F.type==="role"){o(F.id);return}switch(F.id){case"meeting":{const V=l[0];V?u(V.id):f();break}case"bulletin":f();break;case"decisions":m();break;case"knowledge":p();break}}},[Y,o,u,f,m,p]);return c.jsxs("div",{className:"td-scene",children:[c.jsxs("div",{ref:v,className:"td-wrap",children:[c.jsx("canvas",{ref:b,width:ft.canvasW,height:ft.canvasH,className:"td-canvas",onClick:le,onMouseMove:I,onMouseLeave:ne}),c.jsx("div",{ref:k,className:"td-overlay"})]}),y&&c.jsxs("button",{className:"td-hire-btn",onClick:y,title:"Hire New Role",children:[c.jsx("span",{className:"td-hire-btn__icon",children:"+"}),c.jsx("span",{className:"td-hire-btn__label",children:"HIRE"})]})]})}function gC({role:t,appearance:l,onSave:r,onReset:i,onClose:o,theme:u,onThemeChange:f,onUpdateName:m,initialTab:p,speechSettings:h,onSpeechSettingsChange:g,language:y,onLanguageChange:b}){var ee;const[v,k]=j.useState(p??"character"),[S,N]=j.useState({...l}),[E,_]=j.useState(t.name),[H,B]=j.useState(!1),$=j.useCallback(()=>N(ls()),[]),T=j.useCallback(()=>{const D=lh(t.id);N({...D}),i()},[t.id,i]),X=j.useCallback(async()=>{r(S);const D=E.trim();if(m&&D&&D!==t.name){B(!0);try{await m(t.id,D)}catch{}B(!1)}o()},[S,r,o,E,t.name,t.id,m]),G=c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6},children:[c.jsxs("span",{children:[t.id.toUpperCase()," –"]}),m?c.jsx("input",{value:E,onChange:D=>_(D.target.value),disabled:H,className:"customize-name-input",style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.15)",borderRadius:4,color:"inherit",font:"inherit",padding:"2px 6px",flex:1,minWidth:0}}):c.jsx("span",{children:t.name})]});return c.jsx("div",{className:"customize-overlay",onClick:o,children:c.jsxs("div",{className:"customize-modal",onClick:D=>D.stopPropagation(),children:[c.jsxs("div",{className:"customize-header",children:[c.jsxs("div",{className:"customize-tabs",children:[c.jsx("button",{className:`customize-tab ${v==="character"?"active":""}`,onClick:()=>k("character"),children:"CHARACTER"}),c.jsx("button",{className:`customize-tab ${v==="office"?"active":""}`,onClick:()=>k("office"),children:"OFFICE THEME"}),c.jsx("button",{className:`customize-tab ${v==="settings"?"active":""}`,onClick:()=>k("settings"),children:"SETTINGS"})]}),c.jsx("button",{className:"customize-close",onClick:o,children:"X"})]}),v==="character"?c.jsx("div",{className:"customize-body",children:c.jsx(qy,{roleId:t.id,appearance:S,onChange:N,onRandomize:$,onReset:T,label:G})}):v==="office"?c.jsx("div",{className:"customize-body",children:c.jsx("div",{className:"customize-themes",children:Object.entries(Sa).map(([D,Y])=>c.jsxs("button",{className:`customize-theme-card ${u===D?"active":""}`,onClick:()=>f(D),children:[c.jsxs("div",{className:"customize-theme-preview",style:{background:Y.vars["--floor-light"],borderColor:Y.vars["--pixel-border"]},children:[c.jsx("div",{style:{background:Y.vars["--hud-bg"],height:8,borderBottom:`2px solid ${Y.vars["--pixel-border"]}`}}),c.jsxs("div",{className:"flex-1 flex items-center justify-center gap-1 p-1",children:[c.jsx("div",{style:{width:10,height:14,background:Y.vars["--accent"],borderRadius:1}}),c.jsx("div",{style:{width:10,height:14,background:Y.vars["--active-green"],borderRadius:1}}),c.jsx("div",{style:{width:10,height:14,background:Y.vars["--idle-amber"],borderRadius:1}})]}),c.jsx("div",{style:{background:Y.vars["--hud-bg"],height:6,borderTop:`2px solid ${Y.vars["--pixel-border"]}`}})]}),c.jsxs("div",{className:"customize-theme-name",children:[Y.icon," ",Y.name]})]},D))})}):c.jsx("div",{className:"customize-body",children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20,padding:"8px 0"},children:[c.jsxs("div",{children:[c.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"AMBIENT SPEECH MODE"}),c.jsx("div",{style:{display:"flex",gap:6},children:["template","llm","auto"].map(D=>c.jsxs("button",{onClick:()=>g==null?void 0:g({mode:D}),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(h==null?void 0:h.mode)===D?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(h==null?void 0:h.mode)===D?"rgba(255,255,255,0.08)":"transparent",color:(h==null?void 0:h.mode)===D?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center"},children:[c.jsx("div",{style:{fontWeight:600,marginBottom:2},children:D==="template"?"TEMPLATE":D==="llm"?"AI":"AUTO"}),c.jsx("div",{style:{fontSize:9,opacity:.7},children:D==="template"?"Static pool ($0)":D==="llm"?"LLM generated":"Detect engine"})]},D))}),c.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Auto: CLI Max = AI, BYOK = Template"})]}),c.jsxs("div",{children:[c.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["SPEECH INTERVAL: ",(h==null?void 0:h.intervalSec)??18,"s"]}),c.jsx("input",{type:"range",min:5,max:120,step:5,value:(h==null?void 0:h.intervalSec)??18,onChange:D=>g==null?void 0:g({intervalSec:Number(D.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),c.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[c.jsx("span",{children:"5s (frequent)"}),c.jsx("span",{children:"120s (rare)"})]})]}),(h==null?void 0:h.mode)!=="template"&&c.jsxs("div",{children:[c.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["DAILY LLM BUDGET: $",((ee=h==null?void 0:h.dailyBudgetUsd)==null?void 0:ee.toFixed(2))??"1.00"]}),c.jsx("input",{type:"range",min:0,max:5,step:.25,value:(h==null?void 0:h.dailyBudgetUsd)??1,onChange:D=>g==null?void 0:g({dailyBudgetUsd:Number(D.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),c.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[c.jsx("span",{children:"$0 (unlimited)"}),c.jsx("span",{children:"$5.00/day"})]})]}),c.jsxs("div",{children:[c.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"LANGUAGE"}),c.jsx("div",{style:{display:"flex",gap:6},children:[{key:"auto",label:"Auto"},{key:"en",label:"English"},{key:"ko",label:"한국어"},{key:"ja",label:"日本語"}].map(({key:D,label:Y})=>c.jsx("button",{onClick:()=>b==null?void 0:b(D),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(y??"auto")===D?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(y??"auto")===D?"rgba(255,255,255,0.08)":"transparent",color:(y??"auto")===D?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center",fontWeight:600},children:Y},D))}),c.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Sets language for AI responses and speech bubbles"})]})]})}),v==="character"&&c.jsxs("div",{className:"customize-footer",children:[c.jsx("button",{className:"customize-btn customize-btn--cancel",onClick:o,children:"CANCEL"}),c.jsx("button",{className:"customize-btn customize-btn--save",onClick:X,children:"SAVE"})]})]})})}function m0(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 bC({status:t,history:l,onClose:r,onSave:i,onLoadHistory:o,onRestore:u,saving:f}){const[m,p]=j.useState("save"),[h,g]=j.useState(""),[y,b]=j.useState(null),[v,k]=j.useState(!1),[S,N]=j.useState(null),E=j.useRef(null);j.useEffect(()=>{m==="history"&&o()},[m,o]),j.useEffect(()=>{var T;(T=E.current)==null||T.focus()},[]);const _=[...((t==null?void 0:t.modified)??[]).map(T=>({status:"M",file:T})),...((t==null?void 0:t.untracked)??[]).map(T=>({status:"A",file:T}))],H=async()=>{b(null),N(null);try{const T=await i(h||void 0);N(T),g("")}catch(T){b(T instanceof Error?T.message:"Save failed")}},B=async T=>{if(confirm(`Restore from commit ${T.slice(0,7)}? This creates a new commit with those files.`)){k(!0);try{await u(T),k(!1)}catch(X){b(X instanceof Error?X.message:"Restore failed"),k(!1)}}};j.useEffect(()=>{const T=X=>{X.key==="Escape"&&r()};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[r]);const $=T=>{T.key==="Enter"&&(T.metaKey||T.ctrlKey)&&H()};return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:r}),c.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:$,children:[c.jsxs("div",{className:"px-5 py-3 flex items-center justify-between shrink-0",style:{borderBottom:"2px solid var(--pixel-border)"},children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("span",{className:"text-lg font-black tracking-tight",children:"SAVE GAME"}),c.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-secondary)"},children:(t==null?void 0:t.branch)??""})]}),c.jsx("button",{onClick:r,className:"text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)] cursor-pointer text-lg",children:"×"})]}),c.jsx("div",{className:"flex shrink-0",style:{borderBottom:"2px solid var(--pixel-border)"},children:["save","history"].map(T=>c.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))}),c.jsxs("div",{className:"flex-1 overflow-y-auto p-5 space-y-4",children:[m==="save"&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"text-[11px]",style:{color:"var(--terminal-text-secondary)"},children:_.length>0?c.jsxs("span",{style:{color:"var(--idle-amber)"},children:["* ",_.length," unsaved change",_.length>1?"s":""]}):c.jsx("span",{style:{color:"var(--active-green)"},children:"All changes saved"})}),_.length>0&&c.jsxs("div",{children:[c.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:"Changed Files"}),c.jsx("div",{className:"text-[11px] max-h-[160px] overflow-y-auto p-2 space-y-0.5",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)"},children:_.map(({status:T,file:X})=>c.jsxs("div",{className:"flex gap-2",children:[c.jsx("span",{style:{color:T==="A"?"var(--active-green)":"var(--idle-amber)",width:"14px"},children:T}),c.jsx("span",{style:{color:"var(--terminal-text-secondary)"},children:X})]},X))})]}),_.length>0&&c.jsxs("div",{children:[c.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:"Save Message"}),c.jsx("input",{ref:E,type:"text",value:h,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)"}})]}),_.length>0&&c.jsx("div",{className:"flex gap-3",children:c.jsx("button",{onClick:H,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"})}),_.length>0&&t&&!t.hasRemote&&c.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:"Local save only — add a git remote to enable push"}),S&&c.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&&c.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)&&c.jsxs("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:["Last save: ",t.lastCommit.message," (",m0(t.lastCommit.date),")"]})]}),m==="history"&&c.jsxs(c.Fragment,{children:[l.length===0&&c.jsx("div",{className:"text-[11px] text-center py-8",style:{color:"var(--terminal-text-muted)"},children:"No save history"}),c.jsx("div",{className:"space-y-1",children:l.map(T=>c.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:[c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-[11px] font-mono",style:{color:"var(--accent)"},children:T.shortSha}),c.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--terminal-text)"},children:T.message})]}),c.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:m0(T.date)})]}),c.jsx("button",{onClick:()=>B(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))})]})]})]})]})}const vC={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍","data-analyst":"📊"},ec={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},wC={cto:8,cbo:7,pm:6,engineer:5,designer:5,qa:4,"data-analyst":4},kC={cto:"아키텍처",cbo:"시장 분석",pm:"PRD 작성",engineer:"코딩",designer:"시안 제작",qa:"품질 검증"};function SC(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 jC({importJob:t,onImportDone:l}){var ni,ar,jl;const[r,i]=j.useState([]),[o,u]=j.useState([]),[f,m]=j.useState([]),[p,h]=j.useState([]),[g,y]=j.useState([]),[b,v]=j.useState([]),[k,S]=j.useState("TYCONO"),[N,E]=j.useState(!0),[_,H]=j.useState(null),[B,$]=j.useState({type:"none"}),[T,X]=j.useState(null),[G,ee]=j.useState(null),[D,Y]=j.useState([]),[I,ne]=j.useState(!1),[le,L]=j.useState([]),[F,V]=j.useState(0),[P,fe]=j.useState(!1),[z,M]=j.useState({}),[K,A]=j.useState("ceo"),[oe,be]=j.useState(null),[ve,Ne]=j.useState(!1),[Oe,Be]=j.useState(!1),[me,Ve]=j.useState(null),[Ge,de]=j.useState({}),[Ee,nt]=j.useState([]),[nn,Et]=j.useState([]),[Jt,Lt]=j.useState(void 0),[on,Ct]=j.useState(!1);j.useEffect(()=>{Ce.getStatus().then(U=>{Lt(U.engine),Ct(!!U.hasApiKey)}).catch(()=>{})},[]);const{getAppearance:_t,setAppearance:$n,resetAppearance:Ft,theme:Ln,setTheme:ae,speechSettings:xe,setSpeechSettings:De,language:he,setLanguage:ye}=fE(),[at,mt]=j.useState(null),[Ye,ce]=j.useState("character"),Ae=hE(),[rt,yn]=j.useState(!1);j.useEffect(()=>{const U=ue=>{(ue.metaKey||ue.ctrlKey)&&ue.key==="s"&&(ue.preventDefault(),Ae.dirtyCount>0&&yn(!0))};return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[Ae.dirtyCount]);const[Pt,Qr]=j.useState(null),[Wn,Jn]=j.useState(null),[Pn,sl]=j.useState([]),[el,ql]=j.useState(!1),bs=j.useRef(!1),Pa=j.useRef(null);let er=j.useRef(0);const Nn=(U,ue,ge)=>{const ke={id:er.current++,type:U,text:ue,detail:ge};sl(we=>[...we,ke])};j.useEffect(()=>{var U;el&&((U=Pa.current)==null||U.scrollIntoView({behavior:"smooth"}))},[Pn,el]),j.useEffect(()=>{t&&(bs.current||(bs.current=!0,Jn("Scanning knowledge sources..."),sl([{id:0,type:"scan",text:"Starting knowledge import..."}]),er.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 U=>{var we;const ue=(we=U.body)==null?void 0:we.getReader();if(!ue)return;const ge=new TextDecoder;let ke="";for(;;){const{done:ze,value:Re}=await ue.read();if(ze)break;ke+=ge.decode(Re,{stream:!0});const We=ke.split(`
|
|
88
|
+
`);ke=We.pop()||"";let it="";for(const $e of We)if($e.startsWith("event: "))it=$e.slice(7).trim();else if($e.startsWith("data: ")&&it){try{const ht=JSON.parse($e.slice(6));switch(it){case"scanning":Jn(`Scanning: ${ht.path} (${ht.fileCount} files)`),Nn("scan",`Found ${ht.fileCount} files`,ht.path);break;case"processing":Qr({index:ht.index,total:ht.total}),Jn(`Importing knowledge... (${ht.index}/${ht.total})`),Nn("process",`Processing: ${ht.file}`,`${ht.index} / ${ht.total}`);break;case"created":Nn("created",ht.title,ht.summary);break;case"skipped":Nn("process",`Skipped: ${ht.file}`,ht.reason);break;case"done":Jn(null),Qr(null),Nn("done",`Import complete! ${ht.created} created, ${ht.skipped} skipped.`),Tt(`Knowledge import complete! ${ht.created} documents imported.`,"#2E7D32"),l==null||l();break;case"error":Jn(null),Qr(null),Nn("error",ht.message),Tt(`Import failed: ${ht.message}`,"#B71C1C"),l==null||l();break}}catch{}it=""}}}).catch(U=>{Jn(null),Nn("error",U.message),Tt(`Import error: ${U.message}`,"#B71C1C"),l==null||l()})))},[t]);const[Zr,Wr]=j.useState("card"),[Jr,vs]=j.useState(typeof window<"u"?window.innerWidth:1200);j.useEffect(()=>{const U=()=>vs(window.innerWidth);return window.addEventListener("resize",U),()=>window.removeEventListener("resize",U)},[]);const Na=Jr<1024,[gn,wl]=j.useState(!1),[Xl,ol]=j.useState(560),[Rt,xt]=j.useState([]),[tl,An]=j.useState(null),[ws,Pr]=j.useState(null),{sendMessage:ks}=oE();j.useEffect(()=>{Promise.all([Ce.getCompany().then(U=>{S(U.name),i(U.roles)}),Ce.getProjects().then(u),Ce.getStandups().then(m),Ce.getWaves().then(h),Ce.getDecisions().then(y),Ce.getKnowledge().then(v).catch(()=>{}),Ce.getOrgTree().then(U=>{M(U.nodes),A(U.root)}).catch(()=>{})]).catch(U=>H(`Failed to load: ${U.message}`)).finally(()=>E(!1))},[]),j.useEffect(()=>{Ce.deleteEmptySessions().catch(()=>{}),Ce.getSessions().then(U=>{if(U.length>0){const ue=U.map(ke=>({...ke,messages:[]}));xt(ue);const ge=ue.find(ke=>ke.status==="active")??ue[0];An(ge.id),wl(!0)}}).catch(U=>{console.error("Failed to load sessions",U)})},[]),j.useEffect(()=>{const U=()=>{fetch("/api/exec/status").then(ge=>ge.json()).then(ge=>{de(ge.statuses??{}),nt(ge.activeExecutions??[])}).catch(()=>{})};U();const ue=setInterval(U,3e3);return()=>clearInterval(ue)},[]),j.useEffect(()=>{B.type==="role"?Ce.getRole(B.roleId).then(X).catch(console.error):X(null)},[B]);const nl=()=>$({type:"none"}),ei=async(U,ue)=>{const ge=r.find(we=>we.id===U),ke=(G==null?void 0:G.mode)==="ask";ee(null);try{const{jobId:we}=await Ce.startJob({type:"assign",roleId:U,task:ue,readOnly:ke}),ze=ec[U]??"#666",Re=`${U.toUpperCase()} · ${(ge==null?void 0:ge.name)??U}`;fe(!1),Y([{jobId:we,title:Re,color:ze}]),pt.pushMessage({ts:Date.now(),roleId:"ceo",text:`[CEO → ${(ge==null?void 0:ge.name)??U}] ${ke?"Ask":"Assign"}: ${ue}`,type:"dispatch",targetRoleId:U})}catch(we){Tt(`Failed to start job: ${we instanceof Error?we.message:"unknown"}`,"#C62828")}},Tt=(U,ue)=>{const ge=Date.now();Et(ke=>[...ke,{id:ge,message:U,color:ue}]),setTimeout(()=>Et(ke=>ke.filter(we=>we.id!==ge)),4e3)},Vl=()=>{var ue;const U=D[D.length-1];U&&(Tt(`${U.title} completed`,U.color),pt.pushMessage({ts:Date.now(),roleId:((ue=U.title.split(" · ")[0])==null?void 0:ue.toLowerCase())??"unknown",text:`[${U.title}] Job completed`,type:"dispatch"})),Ce.getStandups().then(m).catch(console.error),Ce.getCompany().then(ge=>i(ge.roles)).catch(console.error)},Aa=async U=>{ne(!1);try{const ue=await Ce.startJob({type:"wave",directive:U}),ge=ue.jobIds??(ue.jobId?[ue.jobId]:[]),ke=r.filter(ze=>ze.level==="c-level"),we=ge.map((ze,Re)=>{var We,it;return{jobId:ze,roleId:((We=ke[Re])==null?void 0:We.id)??`role-${Re}`,roleName:((it=ke[Re])==null?void 0:it.name)??`C-Level ${Re+1}`}});pt.pushMessage({ts:Date.now(),roleId:"ceo",text:`[CEO WAVE] "${U}" → ${we.map(ze=>ze.roleName).join(", ")}`,type:"dispatch"}),Object.keys(z).length>0?(be({directive:U,rootJobs:we}),Ne(!1)):(L(we),V(0),fe(!1),we.length>0&&Y([{jobId:we[0].jobId,title:`CEO WAVE · ${we[0].roleId.toUpperCase()}`,color:"#B71C1C"}]))}catch(ue){Tt(`Failed to start wave: ${ue instanceof Error?ue.message:"unknown"}`,"#C62828")}},kl=()=>{Ce.getWaves().then(h).catch(console.error),Ce.getStandups().then(m).catch(console.error)},Ot=()=>{Ce.getCompany().then(U=>i(U.roles)).catch(console.error)},Ss=async(U,ue)=>{await Ce.createRole(U),$n(U.id,ue),Ot(),Tt(`${U.name} hired!`,"#2E7D32")},js=async U=>{await Ce.deleteRole(U),Ot(),Ve(null),Tt(`${U.toUpperCase()} removed`,"#B71C1C")},cl=async(U,ue)=>{await Ce.updateRole(U,ue),Ot(),ue.name&&Tt(`${U.toUpperCase()} renamed to "${ue.name}"`,"#1565C0")},Gl=U=>{wl(!0)},bc=async U=>{try{const ue=await Ce.createSession(U,"talk");xt(ge=>[ue,...ge]),An(ue.id),wl(!0)}catch(ue){console.error("Failed to create session",ue),Tt(`Failed to create session: ${ue instanceof Error?ue.message:"API unreachable"}`,"#B71C1C")}},Es=async U=>{try{const ue=await Ce.createSession(U,"talk");xt(ge=>[ue,...ge]),An(ue.id)}catch(ue){console.error("Failed to create session",ue),Tt(`Failed to create session: ${ue instanceof Error?ue.message:"API unreachable"}`,"#B71C1C")}},Cs=async U=>{const ue=Ee.find(we=>we.roleId===U),ge=(ue==null?void 0:ue.jobId)??(ue==null?void 0:ue.id);if(ge&&Ge[U]==="working"){const we=r.find(We=>We.id===U),ze=ec[U]??"#666",Re=`${U.toUpperCase()} · ${(we==null?void 0:we.name)??U}`;Y([{jobId:ge,title:Re,color:ze}]),fe(!1);return}const ke=Rt.find(we=>we.roleId===U);if(ke)An(ke.id),pt.setActiveChannelId(null);else try{const we=await Ce.createSession(U,"talk");xt(ze=>[we,...ze]),An(we.id),pt.setActiveChannelId(null)}catch(we){console.error("Failed to create session",we)}wl(!0)},vc=async U=>{try{await Ce.deleteSession(U),xt(ue=>{var ke;const ge=ue.filter(we=>we.id!==U);return tl===U&&An(((ke=ge[0])==null?void 0:ke.id)??null),ge})}catch(ue){console.error("Failed to delete session",ue),Tt(`Failed to close session: ${ue instanceof Error?ue.message:"API error"}`,"#B71C1C")}},tr=async()=>{try{const{ids:U}=await Ce.deleteEmptySessions();if(U.length===0)return;xt(ue=>{var ke;const ge=ue.filter(we=>!U.includes(we.id));return tl&&U.includes(tl)&&An(((ke=ge[0])==null?void 0:ke.id)??null),ge}),Tt(`Cleared ${U.length} empty session${U.length!==1?"s":""}`,"#2E7D32")}catch(U){Tt(`Failed to clear empty sessions: ${U instanceof Error?U.message:"API error"}`,"#B71C1C")}},nr=async()=>{if(!confirm("Close all sessions? This cannot be undone."))return;const U=Rt.map(ue=>ue.id);try{await Ce.deleteSessions(U),xt([]),An(null),Tt("All sessions closed","#2E7D32")}catch(ue){Tt(`Failed to close sessions: ${ue instanceof Error?ue.message:"API error"}`,"#B71C1C")}},en=(U,ue)=>{xt(ge=>ge.map(ke=>{if(ke.id!==U)return ke;const we=[...ke.messages],ze=we[we.length-1];if(ze&&ze.from==="role"&&ze.status==="streaming"){const Re=[...ze.streamEvents??[],ue];we[we.length-1]={...ze,streamEvents:Re}}return{...ke,messages:we}}))},dn=(U,ue,ge)=>{const ke={id:`msg-${Date.now()}-ceo`,from:"ceo",content:ue,type:ge==="do"?"directive":"conversation",status:"done",timestamp:new Date().toISOString()},we={id:`msg-${Date.now()+1}-role`,from:"role",content:"",type:"conversation",status:"streaming",timestamp:new Date().toISOString(),streamEvents:[]};xt(ze=>ze.map(Re=>Re.id===U?{...Re,messages:[...Re.messages,ke,we],updatedAt:new Date().toISOString()}:Re)),Pr(U),ks(U,ue,ge,{onThinking:ze=>{xt(Re=>Re.map(We=>{if(We.id!==U)return We;const it=[...We.messages],$e=it[it.length-1];return $e&&$e.from==="role"&&$e.status==="streaming"&&(it[it.length-1]={...$e,thinking:($e.thinking??"")+ze}),{...We,messages:it}})),en(U,{type:"thinking",timestamp:Date.now(),text:ze})},onText:ze=>{xt(Re=>Re.map(We=>{if(We.id!==U)return We;const it=[...We.messages],$e=it[it.length-1];return $e&&$e.from==="role"&&$e.status==="streaming"&&(it[it.length-1]={...$e,content:$e.content+ze}),{...We,messages:it}}))},onToolUse:(ze,Re)=>{en(U,{type:"tool",timestamp:Date.now(),toolName:ze,toolInput:Re})},onDispatch:(ze,Re)=>{en(U,{type:"dispatch",timestamp:Date.now(),roleId:ze,task:Re})},onDispatchProgress:(ze,Re,We)=>{var it;Re==="tool"?en(U,{type:"dispatch:progress",timestamp:Date.now(),roleId:ze,progressType:"tool",toolName:We.name,toolInput:We.input}):Re==="thinking"?en(U,{type:"dispatch:progress",timestamp:Date.now(),roleId:ze,progressType:"thinking",text:We.text}):Re==="text"?en(U,{type:"dispatch:progress",timestamp:Date.now(),roleId:ze,progressType:"text",text:(it=We.text)==null?void 0:it.slice(-200)}):(Re==="done"||Re==="error")&&en(U,{type:"dispatch:progress",timestamp:Date.now(),roleId:ze,progressType:Re})},onTurn:ze=>{en(U,{type:"turn",timestamp:Date.now(),turn:ze})},onDone:()=>{xt(ze=>ze.map(Re=>{if(Re.id!==U)return Re;const We=Re.messages.map($e=>$e.status==="streaming"?{...$e,status:"done"}:$e),it=Re.messages.length<=2?ue.slice(0,40).replace(/\n/g," "):Re.title;return{...Re,messages:We,title:it}})),Pr(null)},onError:ze=>{xt(Re=>Re.map(We=>{if(We.id!==U)return We;const it=We.messages.map($e=>$e.status==="streaming"?{...$e,status:"error",content:$e.content||ze}:$e);return{...We,messages:it}})),Pr(null)}})},Ns=(U,ue)=>{xt(ge=>ge.map(ke=>ke.id===U?{...ke,mode:ue}:ke)),Ce.updateSession(U,{mode:ue}).catch(console.error)},wc=new Date().toISOString().slice(0,10),Hn=o[0],ti={cto:"Chief Technology Officer",cbo:"Chief Business Officer",pm:"Product Manager",engineer:"Software Engineer",designer:"UI/UX Designer",qa:"QA Engineer"},lr=U=>{const ue=ti[U];if(!ue)return"";for(const ge of f){const ke=ge.content,we=ke.indexOf(`## ${ue}`);if(we===-1)continue;const ze=ke.indexOf(`
|
|
89
|
+
## `,we+10),We=(ze===-1?ke.slice(we):ke.slice(we,ze)).split(`
|
|
90
|
+
`).filter(it=>it.trim().length>0);for(const it of We){const $e=it.replace(/^#+\s*/,"").replace(/\*\*/g,"").replace(/^[-*]\s+/,"").trim();if(!($e.startsWith("|")||$e.startsWith("{")||$e.startsWith("[")||$e.startsWith("```")||$e.startsWith("---")||$e.includes("Journal")||$e.includes("(c-level)")||$e.includes("(team-lead)")||$e.includes("(member)")||/^(CEO |작업 결과|생성\/수정|APPROVAL|비고|상황 보고|태스크$)/.test($e))&&$e.length>15&&$e.length<120)return $e}}return""},kc=U=>{const ue=ti[U];if(!ue)return"";for(const ge of f){const ke=ge.content,we=ke.indexOf(`## ${ue}`);if(we===-1)continue;const ze=ke.indexOf(`
|
|
91
|
+
## `,we+10),We=(ze===-1?ke.slice(we):ke.slice(we,ze)).replace(/^## .+\n/,"").trim();if(We)return We.slice(0,1500)}return""},pt=NE();j.useEffect(()=>{r.length>0&&pt.syncDefaultMembers(r)},[r]);const Sl=kE({roles:r,roleStatuses:Ge,activeExecs:Ee,getStandupSpeech:lr});return ME({roles:r,roleStatuses:Ge,activeExecs:Ee,channels:pt.channels,relationships:Sl.relationships,pushMessage:pt.pushMessage,speechSettings:xe,engineType:Jt,hasApiKey:on}),N?c.jsxs("div",{className:"h-screen flex flex-col bg-[var(--floor-light)]",style:{fontFamily:"var(--pixel-font)"},children:[(Wn||Pn.length>0)&&c.jsxs("div",{className:"shrink-0 z-[44]",children:[c.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:()=>ql(U=>!U),children:[Wn?c.jsx("div",{className:"w-3 h-3 border-2 border-white/40 border-t-white rounded-full animate-spin shrink-0"}):c.jsx("span",{className:"shrink-0",children:"✅"}),c.jsx("span",{className:"flex-1",children:Wn||"Knowledge import finished"}),Pt&&c.jsx("div",{className:"w-24 h-1.5 rounded-full overflow-hidden shrink-0",style:{background:"rgba(255,255,255,0.3)"},children:c.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Pt.index/Pt.total*100}%`,background:"#fff"}})}),c.jsx("span",{className:"text-[10px] opacity-70 shrink-0",children:el?"▲":"▼"})]}),el&&c.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:[Pn.map(U=>c.jsxs("div",{className:"flex items-start gap-2 px-5 py-1.5",style:{borderBottom:"1px solid var(--terminal-border)"},children:[c.jsxs("span",{className:"shrink-0 mt-0.5",style:{width:14,textAlign:"center"},children:[U.type==="scan"&&"🔍",U.type==="process"&&"⚙️",U.type==="created"&&"✅",U.type==="done"&&"🎉",U.type==="error"&&"❌"]}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("div",{style:{color:U.type==="error"?"#EF4444":U.type==="done"?"var(--active-green)":"var(--terminal-text)"},children:U.text}),U.detail&&c.jsx("div",{className:"text-[10px] truncate",style:{color:"var(--terminal-text-muted)"},children:U.detail})]})]},U.id)),c.jsx("div",{ref:Pa})]})]}),c.jsx("div",{className:"flex-1 flex items-center justify-center",children:c.jsxs("div",{className:"text-center",children:[c.jsx("div",{className:"text-4xl mb-3",children:"🏢"}),c.jsx("div",{className:"text-gray-600 font-semibold text-xs",children:"LOADING OFFICE..."})]})})]}):_?c.jsx("div",{className:"h-screen flex items-center justify-center bg-[var(--floor-light)]",children:c.jsxs("div",{className:"text-center max-w-md",style:{fontFamily:"var(--pixel-font)"},children:[c.jsx("div",{className:"text-4xl mb-3",children:"⚠️"}),c.jsx("div",{className:"text-gray-800 font-semibold mb-2 text-xs",children:"CONNECTION ERROR"}),c.jsx("div",{className:"text-gray-500 text-xs mb-4",children:_}),c.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"})]})}):c.jsxs("div",{className:"flex flex-col",style:{height:"100dvh",fontFamily:"var(--pixel-font)"},children:[c.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:[c.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:["🏢"," ",c.jsx("span",{style:{color:"var(--terminal-text)"},children:k})]}),c.jsxs("div",{className:"flex gap-4 text-[var(--terminal-text-secondary)] text-[11px] items-center",children:[c.jsxs("div",{className:"hidden md:flex items-center gap-1",children:["💰",c.jsx("div",{className:"w-[50px] h-2 bg-[#111] overflow-hidden",style:{border:"2px solid var(--pixel-border)"},children:c.jsx("div",{className:"h-full",style:{width:"72%",background:"linear-gradient(90deg,#22c55e,#34D399)"}})}),c.jsx("strong",{className:"text-[var(--active-green)]",children:"$72K"})]}),c.jsxs("div",{className:"hidden md:flex items-center gap-1",children:["⚡",c.jsx("div",{className:"w-[50px] h-2 bg-[#111] overflow-hidden",style:{border:"2px solid var(--pixel-border)"},children:c.jsx("div",{className:"h-full",style:{width:"85%",background:"linear-gradient(90deg,#3b82f6,#60A5FA)"}})}),c.jsx("strong",{className:"text-[var(--terminal-text)]",children:"85"})]}),c.jsxs("span",{className:"hidden sm:inline",children:["Roles: ",c.jsx("strong",{className:"text-[var(--terminal-text)]",children:r.length})]}),c.jsxs("span",{className:"hidden sm:inline",children:["Projects: ",c.jsx("strong",{className:"text-[var(--terminal-text)]",children:o.length})]}),Ee.length>0&&c.jsxs("span",{className:"text-amber-400",children:["Working: ",c.jsx("strong",{children:Ee.length})]}),c.jsxs("button",{onClick:()=>Ae.state!=="no-git"&&yn(!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)",opacity:Ae.state==="no-git"?.5:1,cursor:Ae.state==="no-git"?"default":"pointer"},title:Ae.state==="no-git"?'No git repository — run "git init" to enable save':Ae.state==="dirty"?`${Ae.dirtyCount} unsaved changes`:"All saved",children:[c.jsx("span",{style:{display:"inline-block",width:6,height:6,borderRadius:"50%",background:Ae.state==="no-git"?"var(--terminal-text-muted)":Ae.state==="saving"||Ae.state==="dirty"?"var(--idle-amber)":Ae.state==="error"?"#EF5350":"var(--active-green)",animation:Ae.state==="saving"?"pulse 1s infinite":void 0}}),c.jsx("span",{children:wc})]})]})]}),(Wn||Pn.length>0)&&c.jsxs("div",{className:"shrink-0 z-[44]",children:[c.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:()=>ql(U=>!U),children:[Wn?c.jsx("div",{className:"w-3 h-3 border-2 border-white/40 border-t-white rounded-full animate-spin shrink-0"}):c.jsx("span",{className:"shrink-0",children:"✅"}),c.jsx("span",{className:"flex-1",children:Wn||"Knowledge import finished"}),Pt&&c.jsx("div",{className:"w-24 h-1.5 rounded-full overflow-hidden shrink-0",style:{background:"rgba(255,255,255,0.3)"},children:c.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Pt.index/Pt.total*100}%`,background:"#fff"}})}),c.jsx("span",{className:"text-[10px] opacity-70 shrink-0",children:el?"▲":"▼"})]}),el&&c.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:[Pn.map(U=>c.jsxs("div",{className:"flex items-start gap-2 px-5 py-1.5",style:{borderBottom:"1px solid var(--terminal-border)"},children:[c.jsxs("span",{className:"shrink-0 mt-0.5",style:{width:14,textAlign:"center"},children:[U.type==="scan"&&"🔍",U.type==="process"&&"⚙️",U.type==="created"&&"✅",U.type==="done"&&"🎉",U.type==="error"&&"❌"]}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("div",{style:{color:U.type==="error"?"#EF4444":U.type==="done"?"var(--active-green)":"var(--terminal-text)"},children:U.text}),U.detail&&c.jsx("div",{className:"text-[10px] truncate",style:{color:"var(--terminal-text-muted)"},children:U.detail})]})]},U.id)),c.jsx("div",{ref:Pa}),Pn.length===0&&c.jsx("div",{className:"px-5 py-4 text-center",style:{color:"var(--terminal-text-muted)"},children:"Waiting for events..."})]})]}),c.jsxs("div",{className:"flex-1 overflow-hidden flex relative",children:[c.jsx("div",{className:"flex-1 overflow-y-auto relative floor-grid",style:{background:"var(--floor-light)"},children:Zr==="iso"?c.jsx(yC,{roles:r,projects:o,waves:p,standups:f,decisions:g,roleStatuses:Ge,activeExecs:Ee,onRoleClick:U=>$({type:"role",roleId:U}),onProjectClick:U=>$({type:"project",projectId:U}),onBulletinClick:()=>$({type:"bulletin"}),onDecisionsClick:()=>$({type:"decisions"}),onKnowledgeClick:()=>$({type:"knowledge"}),knowledgeDocsCount:b.length,getRoleSpeech:Sl.getSpeech,getAppearance:_t,onHireClick:()=>Be(!0)}):c.jsxs("div",{className:`${gn?"max-w-full":"max-w-[1100px]"} mx-auto h-full p-4 flex flex-col gap-3 relative z-[1]`,children:[(()=>{const U=r.filter(ge=>ge.level==="c-level"),ue=r.filter(ge=>ge.level!=="c-level");return c.jsxs(c.Fragment,{children:[U.length>0&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"pixel-section-label",children:"LEADERSHIP"}),c.jsx("div",{className:`grid gap-2 ${U.length===1?"grid-cols-1":"grid-cols-2"}`,children:U.map(ge=>{var ke;return c.jsx(x0,{role:ge,speech:Sl.getSpeech(ge.id),onClick:()=>$({type:"role",roleId:ge.id}),liveStatus:Ge[ge.id],activeTask:(ke=Ee.find(we=>we.roleId===ge.id))==null?void 0:ke.task,featured:!0,appearance:_t(ge.id)},ge.id)})})]}),c.jsx("div",{className:"pixel-section-label",children:"TEAM"}),c.jsxs("div",{className:`grid gap-2 ${gn?"grid-cols-3":"grid-cols-4"}`,children:[ue.map(ge=>{var ke;return c.jsx(x0,{role:ge,speech:Sl.getSpeech(ge.id),onClick:()=>$({type:"role",roleId:ge.id}),liveStatus:Ge[ge.id],activeTask:(ke=Ee.find(we=>we.roleId===ge.id))==null?void 0:ke.task,appearance:_t(ge.id)},ge.id)}),c.jsx("div",{className:"pixel-card pixel-card--hire",onClick:()=>Be(!0),children:c.jsxs("div",{className:"pixel-card--hire-inner",children:[c.jsx("span",{className:"pixel-card--hire-icon",children:"+"}),c.jsx("span",{className:"pixel-card--hire-label",children:"HIRE NEW ROLE"})]})})]})]})})(),c.jsx("div",{className:"pixel-section-label mt-1",children:"OFFICE"}),c.jsxs("div",{className:"grid grid-cols-4 gap-2",children:[c.jsxs("div",{className:"facility-card-compact",onClick:Hn?()=>$({type:"project",projectId:Hn.id}):void 0,style:Hn?void 0:{borderStyle:"dashed",opacity:.5},children:[c.jsxs("div",{className:"fcc-hdr",style:{background:"#3B82F6"},children:["🏢"," MEETING ROOM"]}),c.jsx("div",{className:"fcc-canvas",children:c.jsx(Xo,{type:"meeting"})}),c.jsxs("div",{className:"fcc-body",children:[c.jsx("div",{className:"fcc-desc",children:"Projects, PRDs, and task boards"}),Hn?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"fcc-title",children:['"',Hn.name,'"']}),c.jsxs("div",{className:"fcc-meta",children:["Status: ",c.jsx("strong",{style:{color:"var(--active-green)"},children:Hn.status})]})]}):c.jsx("div",{className:"fcc-meta",style:{fontStyle:"italic"},children:"No active projects"})]})]}),c.jsxs("div",{className:"facility-card-compact",onClick:()=>$({type:"bulletin"}),children:[c.jsxs("div",{className:"fcc-hdr",style:{background:"#64748b"},children:["📋"," BULLETIN"]}),c.jsx("div",{className:"fcc-canvas",children:c.jsx(Xo,{type:"bulletin"})}),c.jsxs("div",{className:"fcc-body",children:[c.jsx("div",{className:"fcc-desc",children:"Waves and daily standups"}),p.slice(0,1).map(U=>c.jsxs("div",{className:"fcc-item",children:["Wave ",U.id]},U.id)),f.slice(0,1).map(U=>c.jsxs("div",{className:"fcc-item",children:["Standup ",U.date]},U.date)),p.length===0&&f.length===0&&c.jsx("div",{className:"fcc-meta",style:{fontStyle:"italic"},children:"No entries yet"})]})]}),c.jsxs("div",{className:"facility-card-compact",onClick:()=>$({type:"decisions"}),children:[c.jsxs("div",{className:"fcc-hdr",style:{background:"#EF4444"},children:["📜"," DECISIONS"]}),c.jsx("div",{className:"fcc-canvas",children:c.jsx(Xo,{type:"decision"})}),c.jsxs("div",{className:"fcc-body",children:[c.jsx("div",{className:"fcc-desc",children:"CEO strategic decision log"}),c.jsxs("div",{className:"fcc-title",children:[g.length," decisions"]}),g.slice(0,2).map(U=>c.jsxs("div",{className:"fcc-item",children:["#",U.id," ",U.title]},U.id))]})]}),c.jsxs("div",{className:"facility-card-compact",onClick:()=>$({type:"knowledge"}),children:[c.jsxs("div",{className:"fcc-hdr",style:{background:"#0D9488"},children:["📚"," KNOWLEDGE"]}),c.jsx("div",{className:"fcc-canvas",children:c.jsx(Xo,{type:"knowledge"})}),c.jsxs("div",{className:"fcc-body",children:[c.jsx("div",{className:"fcc-desc",children:"Research, analysis, and references"}),c.jsxs("div",{className:"fcc-title",children:[b.length," docs"]}),b.slice(0,2).map(U=>c.jsx("div",{className:"fcc-item",children:U.title},U.id))]})]})]})]})}),gn&&c.jsx("div",{className:Na?"absolute inset-0 z-50":"contents",children:c.jsx(sE,{sessions:Rt,activeSessionId:tl,roles:r,streamingSessionId:ws,width:Na?Jr:Xl,onWidthChange:Na?void 0:ol,onSwitchSession:An,onCloseSession:vc,onCreateSession:bc,onClearEmpty:tr,onCloseAll:nr,onSendMessage:dn,onModeChange:Ns,onCloseTerminal:()=>wl(!1),chatChannels:pt.channels,activeChatChannelId:pt.activeChannelId,onSwitchChatChannel:pt.setActiveChannelId,onCreateChatChannel:pt.createChannel,onDeleteChatChannel:pt.deleteChannel,onUpdateChatMembers:pt.updateMembers,onUpdateChatTopic:pt.updateTopic,unreadChannels:pt.unreadChannels})})]}),c.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:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("button",{onClick:()=>Wr("card"),className:`view-toggle-btn ${Zr==="card"?"active":""}`,children:"CARD"}),c.jsx("button",{onClick:()=>Wr("iso"),className:`view-toggle-btn ${Zr==="iso"?"active":""}`,children:"ISO"}),c.jsx("span",{className:"mx-1",children:"|"}),c.jsxs("button",{className:"theme-btn",onClick:()=>{ce("office"),mt(r[0]??null)},title:"Customize",children:[((ni=Sa[Ln])==null?void 0:ni.icon)??""," ",((ar=Sa[Ln])==null?void 0:ar.name)??"THEME"]}),c.jsx("span",{className:"mx-1",children:"|"}),c.jsx("span",{style:{color:Ae.state==="dirty"?"var(--idle-amber)":"var(--terminal-text-muted)"},children:Ae.state==="no-git"?"No git":Ae.state==="saving"?"Saving...":Ae.state==="dirty"?`${Ae.dirtyCount} unsaved`:Ae.lastSaved?`Saved ${(()=>{const U=Math.floor((Date.now()-new Date(Ae.lastSaved).getTime())/6e4);return U<1?"just now":U<60?`${U}m ago`:`${Math.floor(U/60)}h ago`})()}`:"Saved"})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[oe&&ve&&c.jsx("button",{onClick:()=>Ne(!1),className:"px-3 py-1 font-black text-white cursor-pointer animate-pulse",style:{background:"#B71C1C",border:"2px solid #7f121288",fontFamily:"var(--pixel-font)",borderRadius:4},children:"WAVE"}),D.length>0&&P&&c.jsxs("button",{onClick:()=>fe(!1),className:"px-3 py-1 font-black text-white cursor-pointer animate-pulse",style:{background:D[D.length-1].color,border:`2px solid ${D[D.length-1].color}88`,fontFamily:"var(--pixel-font)",borderRadius:4},children:[D[D.length-1].title.slice(0,20),D[D.length-1].title.length>20?"..":""]}),c.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"]}),c.jsx("button",{onClick:()=>gn?wl(!1):Gl(),className:"px-3 py-1 font-black cursor-pointer",style:{background:gn?"var(--terminal-bg)":"var(--hud-bg-alt)",color:"var(--terminal-text)",border:`2px solid ${gn?"var(--terminal-border-hover)":"var(--pixel-border)"}`,fontFamily:"var(--pixel-font)"},children:"TERMINAL"})]}),c.jsxs("span",{children:["Expand: +",Math.max(0,10-r.length)," desks available"]})]}),B.type==="role"&&T&&(()=>{const U=Ee.find(ue=>ue.roleId===T.id);return c.jsx(zS,{role:T,allRoles:r,recentActivity:kc(T.id),onClose:nl,onFireRole:(ue,ge)=>{Ve({roleId:ue,roleName:ge}),nl()},terminalWidth:gn?Xl:0,activeJobId:U==null?void 0:U.id,activeTask:U==null?void 0:U.task,isWorking:Ge[T.id]==="working",jobStartedAt:U==null?void 0:U.startedAt,onStopJob:ue=>Ce.abortJob(ue),sessions:Rt,streamingSessionId:ws,onCreateSessionSilent:Es,onSendMessage:dn,onFocusTerminal:Cs,onCustomize:ue=>{const ge=r.find(ke=>ke.id===ue);ge&&(ce("character"),mt(ge))},onUpdateRole:cl,appearance:_t(T.id),relationships:Sl.relationships})})(),B.type==="project"&&Hn&&c.jsx(Cj,{projectId:Hn.id,onClose:nl,terminalWidth:gn?Xl:0}),(B.type==="bulletin"||B.type==="decisions")&&c.jsx(jj,{standups:f,waves:p,decisions:g,mode:B.type==="bulletin"?"bulletin":"decisions",onClose:nl,terminalWidth:gn?Xl:0}),B.type==="knowledge"&&c.jsx(Sj,{docs:b,onClose:nl,onRefresh:()=>Ce.getKnowledge().then(v).catch(()=>{}),terminalWidth:gn?Xl:0,initialDocId:B.docId}),G&&c.jsx(Dj,{roleId:G.roleId,roleName:G.roleName,mode:G.mode,onClose:()=>ee(null),onExecutionStart:ei}),oe&&!ve&&c.jsx(Bj,{directive:oe.directive,rootJobs:oe.rootJobs,orgNodes:z,rootRoleId:K,onClose:()=>{be(null),Ne(!1)},onMinimize:()=>Ne(!0),onDone:()=>{kl(),Tt("Wave complete","#2E7D32")},onOpenKnowledgeDoc:U=>{be(null),Ne(!1),$({type:"knowledge",docId:U}),Ce.getKnowledge().then(v).catch(()=>{})}}),D.length>0&&!P&&(()=>{var ge;const U=D[D.length-1],ue=le.length>1;return c.jsxs(c.Fragment,{children:[ue&&D.length===1&&c.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:le.map((ke,we)=>c.jsx("button",{onClick:()=>{V(we),Y([{jobId:ke.jobId,title:`CEO WAVE · ${ke.roleId.toUpperCase()}`,color:"#B71C1C"}])},className:"px-3 py-1.5 text-xs font-bold rounded-t-lg cursor-pointer transition-colors",style:{background:F===we?"#B71C1C":"var(--terminal-bg)",color:F===we?"#fff":"var(--terminal-text-secondary)",border:`1px solid ${F===we?"#B71C1C":"var(--terminal-border)"}`,borderBottom:"none"},children:ke.roleId.toUpperCase()},ke.jobId))}),c.jsx(Tj,{jobId:U.jobId,title:D.length>1?U.title:ue?`CEO WAVE · ${((ge=le[F])==null?void 0:ge.roleName)??""}`:U.title,color:U.color,variant:"modal",style:ue&&D.length===1?{marginTop:28}:void 0,onClose:()=>{Y([]),L([]),V(0),fe(!1)},onMinimize:()=>fe(!0),onDone:()=>{Vl(),kl()},onNavigateToJob:ke=>{Ce.getJob(ke).then(we=>{const ze=ec[we.roleId]??"#888";Y(Re=>[...Re,{jobId:ke,title:`${we.roleId.toUpperCase()} · ${we.task.slice(0,40)}`,color:ze}])}).catch(console.error)},onOpenKnowledgeDoc:ke=>{Y([]),L([]),V(0),fe(!1),$({type:"knowledge",docId:ke}),Ce.getKnowledge().then(v).catch(()=>{})}},U.jobId)]})})(),D.length>1&&c.jsx("div",{className:"fixed top-[5%] left-1/2 -translate-x-1/2 w-[720px] max-w-[95vw] z-[62] pointer-events-none",children:c.jsx("div",{className:"pointer-events-auto",children:c.jsxs("button",{onClick:()=>Y(U=>U.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 ",(jl=D[D.length-2])==null?void 0:jl.title]})})}),I&&c.jsx(Mj,{cLevelRoles:r.filter(U=>U.level==="c-level"),orgNodes:z,rootId:K,onClose:()=>ne(!1),onDispatch:Aa}),Oe&&c.jsx(Ij,{existingRoles:r,onClose:()=>Be(!1),onHire:Ss}),me&&c.jsx(Yj,{roleId:me.roleId,roleName:me.roleName,onClose:()=>Ve(null),onConfirm:js}),at&&c.jsx(gC,{role:at,appearance:_t(at.id),onSave:U=>$n(at.id,U),onReset:()=>Ft(at.id),onClose:()=>{mt(null),ce("character")},theme:Ln,onThemeChange:ae,onUpdateName:async(U,ue)=>{await cl(U,{name:ue})},initialTab:Ye,speechSettings:xe,onSpeechSettingsChange:De,language:he,onLanguageChange:ye}),rt&&c.jsx(bC,{status:Ae.status,history:Ae.history,onClose:()=>yn(!1),onSave:async U=>await Ae.save(U),onLoadHistory:Ae.loadHistory,onRestore:Ae.restore,saving:Ae.state==="saving"}),c.jsx("div",{className:"fixed top-16 right-4 z-[70] flex flex-col gap-2",children:nn.map(U=>c.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:U.color,border:"2px solid rgba(0,0,0,0.3)",fontFamily:"var(--pixel-font)"},children:[c.jsx("div",{className:"w-2 h-2 bg-white/60"}),U.message]},U.id))})]})}function x0({role:t,speech:l,onClick:r,liveStatus:i,activeTask:o,featured:u,appearance:f}){const m=ec[t.id]??SC(t.id),p=wC[t.id]??1,h=kC[t.id]??t.name,g=i==="working",y=g&&o?o:l||h;return c.jsxs("div",{className:`pixel-card ${g?"working":""} ${u?"pixel-card--featured":""}`,onClick:r,children:[c.jsxs("div",{className:"pixel-card-hdr",style:{background:m},children:[c.jsxs("span",{children:[t.id.toUpperCase()," ","·"," ",t.name.toUpperCase()]}),c.jsxs("span",{className:"lvl",children:["Lv.",p]})]}),c.jsxs("div",{className:"pixel-card-body",children:[c.jsx("div",{className:"pixel-desk"}),c.jsx(yc,{roleId:t.id,appearance:f}),c.jsx("div",{className:"pixel-status-dot",style:{background:g?"var(--idle-amber)":"var(--active-green)"}})]}),c.jsxs("div",{className:"pixel-card-task",children:[c.jsx("span",{className:"pixel-card-task-icon",children:g?"🛠️":vC[t.id]??"👤"}),c.jsx("span",{className:"pixel-card-task-text",children:y||h})]})]})}function md({onSelect:t,onClose:l}){const[r,i]=j.useState(null),[o,u]=j.useState(!0),f=j.useCallback(async m=>{u(!0);try{const p=await Ce.browse(m);i(p)}catch{}finally{u(!1)}},[]);return j.useEffect(()=>{f()},[f]),o&&!r?c.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?c.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:[c.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:[c.jsx("span",{style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},className:"truncate flex-1",children:r.current}),c.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"}),c.jsx("button",{onClick:l,className:"opacity-50 hover:opacity-100 shrink-0",style:{color:"var(--terminal-text)"},children:"✕"})]}),r.parent&&c.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:[c.jsx("span",{children:"⬆️"}),c.jsx("span",{children:".."})]}),r.dirs.map(m=>c.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:[c.jsx("span",{children:"📁"}),c.jsx("span",{children:m.name})]},m.path)),r.dirs.length===0&&c.jsx("div",{className:"px-3 py-3 text-center",style:{color:"var(--terminal-text-muted)"},children:"No subdirectories"})]}):null}const EC={engine:"AI Engine",company:"Company Info",project:"Project",knowledge:"Knowledge",team:"Team Template",create:"Create"};function p0(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 CC({onComplete:t}){const[l,r]=j.useState(0),[i,o]=j.useState(null),[u,f]=j.useState("none"),[m,p]=j.useState(""),[h,g]=j.useState(!0),[y,b]=j.useState(""),[v,k]=j.useState(""),S=j.useRef(null),[N,E]=j.useState("fresh"),[_,H]=j.useState(""),[B,$]=j.useState(null),[T,X]=j.useState(!1),[G,ee]=j.useState(!1),[D,Y]=j.useState("skip"),[I,ne]=j.useState([]),[le,L]=j.useState(""),[F,V]=j.useState(!1),[P,fe]=j.useState(""),[z,M]=j.useState(null),[K,A]=j.useState(!1),[oe,be]=j.useState(!1),[ve,Ne]=j.useState([]),[Oe,Be]=j.useState("startup"),[me,Ve]=j.useState(!1),[Ge,de]=j.useState(!1),[Ee,nt]=j.useState(null),[nn,Et]=j.useState([]),[Jt,Lt]=j.useState(!1),on=j.useMemo(()=>p0(D),[D]),Ct=on[l]??"engine";j.useEffect(()=>{Ce.detectEngine().then(ce=>{o(ce),f(ce.recommended),g(!1)}).catch(()=>g(!1)),Ce.getTeams().then(Ne).catch(()=>{})},[]),j.useEffect(()=>{var ce;Ct==="company"&&((ce=S.current)==null||ce.focus())},[Ct]);const _t=()=>{switch(Ct){case"engine":return u!=="none"||m.length>10;case"company":return y.trim().length>0;case"project":return N==="fresh"||N==="existing"&&B===!0;case"knowledge":return D==="existing-akb"?z===!0:D==="import"?I.length>0:!0;case"team":return!0;case"create":return!Ge;default:return!1}},$n=()=>{l<on.length-1&&_t()&&r(l+1),Ct==="create"&&!me&&!Jt&&(D==="existing-akb"?he():De())},Ft=()=>{l>0&&r(l-1)};j.useEffect(()=>{const ce=p0(D);l>=ce.length&&r(ce.length-1)},[D,l]);const Ln=async()=>{if(_.trim()){X(!0);try{const ce=await Ce.validatePath(_.trim());$(ce.valid)}catch{$(!1)}finally{X(!1)}}},ae=async()=>{if(P.trim()){A(!0);try{const ce=await Ce.validatePath(P.trim());M(ce.valid&&ce.hasClaudeMd===!0)}catch{M(!1)}finally{A(!1)}}},xe=()=>{const ce=le.trim();ce&&!I.includes(ce)&&(ne([...I,ce]),L(""))},De=async()=>{Ve(!0),nt(null);try{const ce={companyName:y.trim(),description:v.trim()||"An AI-powered organization",team:Oe,existingProjectPath:N==="existing"?_.trim():void 0,knowledgePaths:D==="import"&&I.length>0?I:void 0};(u==="direct-api"||m)&&(ce.apiKey=m||void 0);const Ae=await Ce.scaffold(ce);Et(Ae.created),de(!0)}catch(ce){nt(ce instanceof Error?ce.message:"Scaffold failed")}finally{Ve(!1)}},he=async()=>{Lt(!0),nt(null);try{const ce=await Ce.connectAkb(P.trim());ce.ok?(de(!0),Et([`Connected to: ${ce.companyRoot}`])):nt(ce.error||"Failed to connect")}catch(ce){nt(ce instanceof Error?ce.message:"Connect failed")}finally{Lt(!1)}},ye=()=>{D==="import"&&I.length>0?t({paths:I,companyRoot:""}):t()},at=ce=>{ce.key==="Enter"&&_t()&&(ce.preventDefault(),$n())},mt=`w-full px-3 py-2 rounded text-sm outline-none transition-colors
|
|
92
|
+
bg-[var(--terminal-bg)] text-[var(--terminal-text)]
|
|
93
|
+
border border-[var(--terminal-border)]
|
|
94
|
+
focus:border-[var(--terminal-border-hover)]
|
|
95
|
+
placeholder:text-[var(--terminal-text-muted)]`,Ye=ce=>`p-4 rounded-lg border-2 cursor-pointer transition-all text-[var(--terminal-text)] ${ce?"border-[var(--accent)] bg-[var(--accent)]/10":"border-[var(--terminal-border)] bg-[var(--hud-bg-alt)] hover:border-[var(--accent)]/50"}`;return c.jsx("div",{className:"h-full flex items-center justify-center",style:{background:"var(--floor-dark)"},onKeyDown:at,children:c.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:[c.jsxs("div",{className:"px-6 py-5",style:{background:"var(--terminal-bg)",borderBottom:"1px solid var(--terminal-border)"},children:[c.jsx("div",{className:"text-lg font-bold",style:{color:"var(--terminal-text)",fontFamily:"var(--pixel-font)"},children:"tycono"}),c.jsx("div",{className:"text-xs mt-1",style:{color:"var(--terminal-text-secondary)"},children:"Build an AI company. Watch them work."}),c.jsx("div",{className:"flex gap-1.5 mt-4",children:on.map((ce,Ae)=>c.jsxs("div",{className:"flex-1",children:[c.jsx("div",{className:"h-1 rounded-full transition-colors",style:{background:Ae<=l?"var(--accent)":"var(--terminal-surface-light)"}}),c.jsx("div",{className:"text-[9px] mt-1 truncate",style:{color:Ae===l?"var(--terminal-text)":"var(--terminal-text-muted)"},children:EC[ce]})]},ce))})]}),c.jsxs("div",{className:"px-6 py-5 min-h-[280px]",children:[Ct==="engine"&&c.jsxs("div",{className:"space-y-4",children:[c.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"AI Engine Setup"}),h?c.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-secondary)"},children:"Detecting AI engine..."}):c.jsxs(c.Fragment,{children:[c.jsx("div",{className:Ye(u==="claude-cli"),onClick:()=>(i==null?void 0:i.claudeCli)&&f("claude-cli"),style:{opacity:i!=null&&i.claudeCli?1:.4},children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-lg",children:i!=null&&i.claudeCli?"✅":"❌"}),c.jsxs("div",{children:[c.jsx("div",{className:"font-medium text-sm",children:"Claude Code CLI"}),c.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"})]})]})}),c.jsxs("div",{className:Ye(u==="direct-api"),onClick:()=>f("direct-api"),children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-lg",children:i!=null&&i.apiKey?"✅":"🔑"}),c.jsxs("div",{className:"flex-1",children:[c.jsx("div",{className:"font-medium text-sm",children:"Anthropic API Key (BYOK)"}),c.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)&&c.jsx("input",{type:"password",className:`${mt} mt-3`,placeholder:"sk-ant-...",value:m,onChange:ce=>p(ce.target.value),autoFocus:!0})]})]})]}),Ct==="company"&&c.jsxs("div",{className:"space-y-4",children:[c.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Company Info"}),c.jsxs("div",{children:[c.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"Company Name *"}),c.jsx("input",{ref:S,className:mt,placeholder:"e.g. Acme Corp",value:y,onChange:ce=>b(ce.target.value)})]}),c.jsxs("div",{children:[c.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"Description"}),c.jsx("textarea",{className:`${mt} resize-none`,rows:3,placeholder:"What does your AI company do?",value:v,onChange:ce=>k(ce.target.value)})]})]}),Ct==="project"&&c.jsxs("div",{className:"space-y-4",children:[c.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Project Setup"}),c.jsxs("div",{className:Ye(N==="fresh"),onClick:()=>{E("fresh"),$(null)},children:[c.jsxs("div",{className:"font-medium text-sm",children:["🌱"," Start Fresh"]}),c.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Create a new AI company from scratch with clean directory structure."})]}),c.jsxs("div",{className:Ye(N==="existing"),onClick:()=>E("existing"),children:[c.jsxs("div",{className:"font-medium text-sm",children:["📂"," Connect Existing Project"]}),c.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Add AI company structure to an existing codebase or knowledge base."}),N==="existing"&&c.jsxs("div",{className:"mt-3",onClick:ce=>ce.stopPropagation(),children:[c.jsxs("div",{className:"flex gap-2",children:[c.jsx("input",{className:`${mt} flex-1`,placeholder:"/path/to/your/project",value:_,onChange:ce=>{H(ce.target.value),$(null)},autoFocus:!0}),c.jsx("button",{onClick:()=>ee(!G),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:"📁"}),c.jsx("button",{onClick:Ln,disabled:T||!_.trim(),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--accent)",color:"#fff",opacity:T||!_.trim()?.5:1},children:T?"...":"Verify"})]}),B===!0&&c.jsxs("div",{className:"text-xs mt-2",style:{color:"var(--active-green)"},children:["✅"," Path verified: ",_]}),B===!1&&c.jsxs("div",{className:"text-xs mt-2",style:{color:"#EF4444"},children:["❌"," Invalid path"]}),G&&c.jsx(md,{onSelect:ce=>{H(ce),$(!0),ee(!1)},onClose:()=>ee(!1)})]})]})]}),Ct==="knowledge"&&c.jsxs("div",{className:"space-y-3",children:[c.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Knowledge Strategy"}),c.jsx("p",{className:"text-xs",style:{color:"var(--terminal-text-secondary)"},children:"How should AI handle your knowledge base?"}),c.jsxs("div",{className:Ye(D==="skip"),onClick:()=>Y("skip"),children:[c.jsxs("div",{className:"font-medium text-sm",children:["🌱"," Start Fresh"]}),c.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Empty knowledge base. Add documents later from the office."})]}),c.jsxs("div",{className:Ye(D==="import"),onClick:()=>Y("import"),children:[c.jsxs("div",{className:"font-medium text-sm",children:["📚"," Import & Build"]}),c.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Select folders with documents — AI reads, summarizes, and organizes them."}),D==="import"&&c.jsxs("div",{className:"mt-3 space-y-2",onClick:ce=>ce.stopPropagation(),children:[c.jsxs("div",{className:"flex gap-2",children:[c.jsx("input",{className:`${mt} flex-1`,placeholder:"/path/to/docs",value:le,onChange:ce=>L(ce.target.value),onKeyDown:ce=>{ce.key==="Enter"&&(ce.preventDefault(),xe())},autoFocus:!0}),c.jsx("button",{onClick:()=>V(!F),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:"📁"}),c.jsx("button",{onClick:xe,disabled:!le.trim(),className:"px-3 py-2 rounded text-xs font-medium",style:{background:"var(--accent)",color:"#fff",opacity:le.trim()?1:.5},children:"Add"})]}),F&&c.jsx(md,{onSelect:ce=>{I.includes(ce)||ne([...I,ce]),V(!1)},onClose:()=>V(!1)}),I.length>0&&c.jsx("div",{className:"space-y-1",children:I.map((ce,Ae)=>c.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:[c.jsx("span",{className:"flex-1 truncate",style:{fontFamily:"var(--pixel-font)"},children:ce}),c.jsx("button",{onClick:()=>ne(I.filter((rt,yn)=>yn!==Ae)),className:"opacity-50 hover:opacity-100",children:"✕"})]},Ae))}),I.length===0&&c.jsx("div",{className:"text-[10px] text-center py-2",style:{color:"var(--terminal-text-muted)"},children:"Add at least one folder to import."})]})]}),c.jsxs("div",{className:Ye(D==="existing-akb"),onClick:()=>Y("existing-akb"),children:[c.jsxs("div",{className:"font-medium text-sm",children:["🔗"," Connect Existing AKB"]}),c.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Connect a directory that already has CLAUDE.md and AKB structure."}),D==="existing-akb"&&c.jsxs("div",{className:"mt-3",onClick:ce=>ce.stopPropagation(),children:[c.jsxs("div",{className:"flex gap-2",children:[c.jsx("input",{className:`${mt} flex-1`,placeholder:"/path/to/your/akb",value:P,onChange:ce=>{fe(ce.target.value),M(null)},autoFocus:!0}),c.jsx("button",{onClick:()=>be(!oe),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:"📁"}),c.jsx("button",{onClick:ae,disabled:K||!P.trim(),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--accent)",color:"#fff",opacity:K||!P.trim()?.5:1},children:K?"...":"Verify"})]}),z===!0&&c.jsxs("div",{className:"text-xs mt-2",style:{color:"var(--active-green)"},children:["✅"," Valid AKB found: ",P]}),z===!1&&c.jsxs("div",{className:"text-xs mt-2",style:{color:"#EF4444"},children:["❌"," No valid AKB (CLAUDE.md required)"]}),oe&&c.jsx(md,{onSelect:ce=>{fe(ce),M(null),be(!1)},onClose:()=>be(!1)})]})]})]}),Ct==="team"&&c.jsxs("div",{className:"space-y-4",children:[c.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Team Template"}),c.jsx("p",{className:"text-xs",style:{color:"var(--terminal-text-secondary)"},children:"Choose a starting team. You can add or remove roles later."}),ve.map(ce=>c.jsxs("div",{className:Ye(Oe===ce.id),onClick:()=>Be(ce.id),children:[c.jsx("div",{className:"font-medium text-sm capitalize",children:ce.id}),c.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:ce.roles.map(Ae=>c.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:Ae.name},Ae.id))})]},ce.id)),c.jsxs("div",{className:Ye(Oe==="custom"),onClick:()=>Be("custom"),children:[c.jsx("div",{className:"font-medium text-sm",children:"Custom"}),c.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Start with no pre-built roles. Hire them from the office."})]})]}),Ct==="create"&&c.jsxs("div",{className:"space-y-4",children:[c.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:Ge?D==="existing-akb"?"AKB Connected!":"Company Created!":"Review & Create"}),!Ge&&!me&&!Jt&&c.jsxs(c.Fragment,{children:[c.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:D==="existing-akb"?c.jsxs(c.Fragment,{children:[c.jsxs("div",{children:[c.jsx("span",{className:"opacity-50",children:"Mode:"})," Connect Existing AKB"]}),c.jsxs("div",{children:[c.jsx("span",{className:"opacity-50",children:"Path:"})," ",P]}),c.jsxs("div",{children:[c.jsx("span",{className:"opacity-50",children:"Engine:"})," ",u==="claude-cli"?"Claude Code CLI":"Direct API"]})]}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{children:[c.jsx("span",{className:"opacity-50",children:"Company:"})," ",y]}),c.jsxs("div",{children:[c.jsx("span",{className:"opacity-50",children:"Engine:"})," ",u==="claude-cli"?"Claude Code CLI":"Direct API"]}),c.jsxs("div",{children:[c.jsx("span",{className:"opacity-50",children:"Project:"})," ",N==="fresh"?"Start Fresh":`Existing (${_})`]}),c.jsxs("div",{children:[c.jsx("span",{className:"opacity-50",children:"Knowledge:"})," ",D==="skip"?"Fresh (empty)":`Import ${I.length} source(s)`]}),c.jsxs("div",{children:[c.jsx("span",{className:"opacity-50",children:"Team:"})," ",Oe]}),D==="import"&&I.length>0&&c.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--idle-amber)"},children:"Knowledge import will run in the background after entering the office."})]})}),Ee&&c.jsx("div",{className:"text-xs p-3 rounded",style:{background:"rgba(220,38,38,0.15)",color:"#f87171"},children:Ee})]}),(me||Jt)&&c.jsxs("div",{className:"flex flex-col items-center py-8 gap-3",children:[c.jsx("div",{className:"w-8 h-8 border-2 rounded-full animate-spin",style:{borderColor:"var(--terminal-border)",borderTopColor:"var(--accent)"}}),c.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-secondary)"},children:Jt?"Connecting to AKB...":"Scaffolding your company..."})]}),Ge&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"text-center py-4 text-4xl",children:"🏢"}),c.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:nn.map((ce,Ae)=>c.jsxs("div",{className:"py-0.5",children:[c.jsx("span",{style:{color:"var(--active-green)"},children:"✓"})," ",ce]},Ae))}),D==="import"&&I.length>0&&c.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."})]})]})]}),c.jsxs("div",{className:"px-6 py-4 flex justify-between items-center",style:{borderTop:"1px solid var(--terminal-border)"},children:[c.jsx("div",{children:l>0&&!Ge&&c.jsx("button",{onClick:Ft,className:"px-4 py-2 rounded text-sm transition-colors",style:{color:"var(--terminal-text-secondary)",border:"1px solid var(--terminal-border)"},children:"Back"})}),c.jsxs("div",{className:"text-xs",style:{color:"var(--terminal-text-muted)"},children:[l+1," / ",on.length]}),c.jsx("div",{children:Ge?c.jsx("button",{onClick:ye,className:"px-5 py-2 rounded text-sm font-medium transition-colors",style:{background:"var(--active-green)",color:"#fff"},children:"Enter Office"}):c.jsx("button",{onClick:$n,disabled:!_t()||me||Jt,className:"px-5 py-2 rounded text-sm font-medium transition-colors",style:{background:_t()?"var(--accent)":"var(--terminal-border)",color:"#fff",opacity:_t()&&!me&&!Jt?1:.5},children:Ct==="create"?me||Jt?Jt?"Connecting...":"Creating...":D==="existing-akb"?"Connect AKB":"Create Company":"Next"})})]})]})})}function NC(){const[t,l]=j.useState(null),[r,i]=j.useState(!0),[o,u]=j.useState(null),f=j.useCallback(async()=>{i(!0),u(null);try{const m=await Ce.getStatus();l(m)}catch(m){u(m instanceof Error?m.message:"Failed to fetch status")}finally{i(!1)}},[]);return j.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:o,refetch:f}}const AC=j.lazy(()=>kb(()=>import("./preview-app-OwehBXPG.js"),[]));function rg(){return c.jsx("div",{className:"h-full flex items-center justify-center",style:{background:"var(--floor-dark)"},children:c.jsxs("div",{className:"text-center",children:[c.jsx("div",{className:"w-10 h-10 mx-auto border-2 rounded-full animate-spin",style:{borderColor:"var(--terminal-border)",borderTopColor:"var(--accent)"}}),c.jsx("div",{className:"mt-4 text-sm",style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},children:"Loading..."})]})})}function DC(){var t;try{const l=localStorage.getItem("tycono-theme")||localStorage.getItem("the-company-theme"),r=l&&l in Sa?l:"default",i=(t=Sa[r])==null?void 0:t.vars;if(!i)return;const o=document.documentElement;for(const[u,f]of Object.entries(i))o.style.setProperty(u,f)}catch{}}function TC(){const{initialized:t,loading:l,refetch:r}=NC(),[i,o]=j.useState(null);j.useEffect(()=>{DC()},[]);const u=f=>{f&&o(f),r()};return l?c.jsx(rg,{}):t?c.jsx(jC,{importJob:i,onImportDone:()=>o(null)}):c.jsx(CC,{onComplete:u})}function zC(){const t=new URLSearchParams(window.location.search).has("sprite-preview");return c.jsx(Sb,{children:t?c.jsx(j.Suspense,{fallback:c.jsx(rg,{}),children:c.jsx(AC,{})}):c.jsx(TC,{})})}bb.createRoot(document.getElementById("root")).render(c.jsx(j.StrictMode,{children:c.jsx(zC,{})}));export{Hy as H,Iy as P,Yy as S,FC as a,Uy as b,Ly as c,Nd as d,eS as e,P4 as f,_C as g,tS as h,c as j,j as r};
|